def renamed(self, ea, new_name, local_name): if LOG_IDP_EVENTS: self.debug_event("Renamed at 0x%08x with' %s'" % (ea, new_name)) if idaapi.is_member_id(ea): # this is a member id : hook already present (struc_member_renamed) pass elif idaapi.get_struc(ea) is not None: # this is a struc id : hook already present (struc_renamed) pass elif idaapi.get_enum_idx(ea) != idc.BADADDR: # this is an enum id : hook already present (enum_renamed) BUT NOT CALLED # (IDA BUG) hooks.idb.enum_renamed(ea) elif idaapi.get_enum_idx( idaapi.get_enum_member_enum(ea)) != idc.BADADDR: # this is an enum member id enum_id = idaapi.get_enum_member_enum(ea) hooks.idb.enum_member_renamed(enum_id, ea) else: self.pre_hook() # when we rename stackframe member, ea is member id # this case is supported by struc_member_renamed event try: old_name = hooks.current_rename_infos[ea] del hooks.current_rename_infos[ea] except KeyError: old_name = None hooks.ida.rename(ea, new_name, old_name=old_name) return hooks.idp.ev_rename(ea, new_name)
def __init__(self, cid, val): self.cid = cid self.name = idaapi.get_enum_member_name(cid) self.parent = idaapi.get_enum_member_enum( cid ) #yes, this could totally be passed in. Avoid premature optimization!!! self.flags = idaapi.get_enum_flag(self.parent) self.val = value.value_node(val, self.flags)
def rename(self, ea, new_name): """ This function only records information about the element *before* it is renamed """ if idaapi.is_member_id(ea): name = idaapi.get_member_fullname(ea) elif idaapi.get_struc(ea) is not None: name = idaapi.get_struc_name(ea) elif idaapi.get_enum_idx(ea) != idc.BADADDR: name = idaapi.get_enum_name(ea) elif idaapi.get_enum_idx(idaapi.get_enum_member_enum(ea)) != idc.BADADDR: # this is an enum member id enum_id = idaapi.get_enum_member_enum(ea) name = idaapi.get_enum_name(enum_id) + "." + idaapi.get_enum_member_name(ea) else: name = idc.Name(ea) hooks.current_rename_infos[ea] = name return 0
def __init__(self, cid, val): self.cid = cid self.name = idaapi.get_enum_member_name(cid) self.parent = idaapi.get_enum_member_enum(cid) #yes, this could totally be passed in. Avoid premature optimization!!! self.flags = idaapi.get_enum_flag(self.parent) self.val = value.value_node(val, self.flags)
def parent(cls, mid): '''Return the id of the enumeration that owns the member `mid`.''' return idaapi.get_enum_member_enum(mid)
def parent(self): """Get the enum holding the member.""" return Enum(eid=idaapi.get_enum_member_enum(self.cid))
def parent(identifier): '''Given a member id, return the enum id that is associated with it''' return idaapi.get_enum_member_enum(identifier)