我们从Python开源项目中,提取了以下7个代码示例,用于说明如何使用idc.GetLongPrm()。
def init_demangled_names(*args): """ Creates dictionary of demangled names => address, that will be used further at double click on methods got from symbols. """ demangled_names.clear() for address, name in idautils.Names(): short_name = idc.Demangle(name, idc.GetLongPrm(idc.INF_SHORT_DN)) if short_name: demangled_names[short_name.split('(')[0]] = address - idaapi.get_imagebase() # Names can have templates and should be transformed before creating local type name = re.sub(r'[<>]', '_t_', name) # Thunk functions with name like "[thunk]:CWarmupHostProvider::Release`adjustor{8}'" result = re.search(r"(\[thunk\]:)?([^`]*)(.*\{(\d+)}.*)?", short_name) name, adjustor = result.group(2), result.group(4) if adjustor: demangled_names[name + "_adj_" + adjustor] = address - idaapi.get_imagebase() print "[DEBUG] Demangled names have been initialized"
def demangle(name, strip_arg_types=False): def strip_args(name): if strip_arg_types is True: return name.split("(", 1)[0] else: return name demangled = idc.Demangle(name, idc.GetLongPrm(idc.INF_LONG_DN)) if demangled is not None: return strip_args(demangled) # The names in RTTI are not mangled normally, so try prepending # the '_Z' demangled = idc.Demangle("_Z" + name, idc.GetLongPrm(idc.INF_LONG_DN)) if demangled is not None: return strip_args(demangled) return strip_args(name)
def demangle(self, name): '''Demangle name.''' mask = idc.GetLongPrm(idc.INF_SHORT_DN) demangled = idc.Demangle(name, mask) if demangled is None: return name return demangled
def __init__(self): super(FunctionsPlus, self).__init__() if idc.GetLongPrm(idc.INF_PROCNAME).lower() != 'metapc': print "Functions+ warning: not tested in this configuration" self.cols = Cols()
def _feature_ClsorInstMethod(self,f_ea): ''' prior feature: Null ''' func_name = idaapi.get_func_name(f_ea) disable_mask = idc.GetLongPrm(idc.INF_LONG_DN) prototype = idaapi.demangle_name(func_name, disable_mask) if not prototype: return 0 elif '__thiscall' in prototype: return 1 else: return 0
def _demangle(name, short=True): dtype = idc.INF_LONG_DN if short: dtype = idc.INF_SHORT_DN tmp = idc.Demangle(name, idc.GetLongPrm(dtype)) if tmp: name = tmp name = name.replace('__', '::') return name
def is_vtable_name(name): demangled = idc.Demangle(name, idc.GetLongPrm(idc.INF_LONG_DN)) if demangled is not None and demangled.startswith("`vtable for"): return True return False