def tinfo(self): print "[INFO] Ignoring import function at 0x{0:08X}".format( self.address) tinfo = idaapi.tinfo_t() if idaapi.guess_tinfo2(self.address, tinfo): return tinfo return const.DUMMY_FUNC
def get_or_guess_tinfo(ea): '''ea_t -> tinfo_t''' # XXX mutates (blah_tinfo2, unavoidable) ti = idaapi.tinfo_t() idaapi.get_tinfo2(ea, ti) or idaapi.guess_tinfo2(ea, ti) return ti
def getArguments(self): """ Retrieve function arguments and populate the object`s args list. """ isGuessed = False # Is function prototype guessed # Get function type info if not idaapi.get_tinfo2(self.proto_ea, self.typeInfo): idaapi.guess_tinfo2(self.proto_ea, self.typeInfo) isGuessed = True if self.typeInfo.empty(): raise RuntimeError("Failed to retrieve function type info for function %s at %s" % (self.funcName, hex(self.ea))) # Get function detail self.typeInfo.get_func_details(self.funcInfo) # TODO: This seems to be creating false positives on 0 argument functions. #if self.funcInfo.empty(): # errStr = "Failed to retrieve function info for function %s" % self.funcName # raise RuntimeError(errStr) self.argNum = len(self.funcInfo) # Iterate function arguments for argIndex in xrange(0, self.argNum): argType = None # arg_type_info_t argLoc = None # argloc_info argName = None #else: # Input Argument argType = self.funcInfo.at(argIndex).type argLoc = self.funcInfo.at(argIndex).argloc argName = self.funcInfo.at(argIndex).name curArg = FuncArg(argType, argLoc, argIndex, argName, isGuessed) self.args.append(curArg) # Set return argument if not self.funcInfo.rettype.empty(): self.retArg = FuncArg(self.funcInfo.rettype, self.funcInfo.retloc, -1, "Ret_Arg", isGuessed)
def getArguments(self): """ Retrieve function arguments and populate the object`s args list. """ isGuessed = False # Is function prototype guessed # Get function type info if not idaapi.get_tinfo2(self.proto_ea, self.typeInfo): idaapi.guess_tinfo2(self.proto_ea, self.typeInfo) isGuessed = True if self.typeInfo.empty(): raise RuntimeError( "Failed to retrieve function type info for function %s at %s" % (self.funcName, hex(self.ea))) # Get function detail self.typeInfo.get_func_details(self.funcInfo) # TODO: This seems to be creating false positives on 0 argument functions. #if self.funcInfo.empty(): # errStr = "Failed to retrieve function info for function %s" % self.funcName # raise RuntimeError(errStr) self.argNum = len(self.funcInfo) # Iterate function arguments for argIndex in xrange(0, self.argNum): argType = None # arg_type_info_t argLoc = None # argloc_info argName = None #else: # Input Argument argType = self.funcInfo.at(argIndex).type argLoc = self.funcInfo.at(argIndex).argloc argName = self.funcInfo.at(argIndex).name curArg = FuncArg(argType, argLoc, argIndex, argName, isGuessed) self.args.append(curArg) # Set return argument if not self.funcInfo.rettype.empty(): self.retArg = FuncArg(self.funcInfo.rettype, self.funcInfo.retloc, -1, "Ret_Arg", isGuessed)