def enum_member_created(self, id, cid): ename = idaapi.get_enum_name(id) name = idaapi.get_enum_member_name(cid) value = idaapi.get_enum_member_value(cid) bmask = idaapi.get_enum_member_bmask(cid) self._send_event(EnumMemberCreatedEvent(ename, name, value, bmask)) return 0
def name(cls, mid): '''Return the name of the enumeration member `mid`.''' if not interface.node.is_identifier(mid): raise E.MemberNotFoundError( u"{:s}.name({:#x}) : Unable to locate member by the specified identifier." .format('.'.join([__name__, cls.__name__]), mid)) res = idaapi.get_enum_member_name(mid) return utils.string.of(res)
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 renaming_enum(self, id, is_enum, newname): extra = {} if is_enum: oldname = idaapi.get_enum_name(id) else: oldname = idaapi.get_enum_member_name(id) self._send_event(EnumRenamedEvent(oldname, newname, is_enum)) return 0
def add_magnumdb_entry(self, name, value): enum_id = self.ensure_magnumdb_enum_type() serial = 0 enum_memberid = idaapi.get_enum_member(enum_id, value, serial, 0) while enum_memberid != 0xffffffffffffffff: if idaapi.get_enum_member_name(enum_memberid) == name: return enum_memberid, serial serial += 1 enum_memberid = idaapi.get_enum_member(enum_id, value, serial, 0) if enum_memberid == 0xffffffffffffffff: enum_memberid = idaapi.add_enum_member(enum_id, name, value) return enum_memberid, serial
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 add_magnumdb_entry(self, name, value): enum_id = self.ensure_magnumdb_enum_type() # idaapi.add_enum_member accept only str (Py3) if type(name) == type(b''): name = name.decode('utf-8') serial = 0 enum_memberid = idaapi.get_enum_member(enum_id, value, serial, 0) while enum_memberid != 0xffffffffffffffff: if idaapi.get_enum_member_name(enum_memberid) == name: return enum_memberid, serial serial += 1 enum_memberid = idaapi.get_enum_member(enum_id, value, serial, 0) if enum_memberid == 0xffffffffffffffff: enum_memberid = idaapi.add_enum_member(enum_id, name, value) return enum_memberid, serial
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 name(self): """Get the member name.""" return idaapi.get_enum_member_name(self.cid)
def name(cls, mid): '''Return the name of the enumeration member `mid`.''' return idaapi.get_enum_member_name(mid)
def name(cls, mid): '''Return the name of the enumeration member `mid`.''' res = idaapi.get_enum_member_name(mid) return utils.string.of(res)
def name(identifier, name=None): '''Given a member id, fetch/set it's /name/''' if name is None: return idaapi.get_enum_member_name(identifier) return idaapi.set_enum_member_name(identifier, name)