Esempio n. 1
0
    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)
Esempio n. 2
0
 def op_type_changed(self, ea):
     # TODO: Fix this when we received end function created event !
     func = idaapi.get_func(ea)
     if func is not None:
         self.addresses_to_process.add(ea)
         self.repo_manager.add_auto_comment(ea, "Operand type change")
     elif idaapi.is_member_id(ea):
         # this is a member id : hook already present (struc_member_renamed)
         pass
     elif not idc.isCode(idc.GetFlags(ea)):
         self.addresses_to_process.add(ea)
         self.repo_manager.add_auto_comment(ea, "Operand type change")
     else:
         logger.warning("op_type_changed at 0x%08X : code but not in a function : not implemented")
Esempio n. 3
0
    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
Esempio n. 4
0
 def ti_changed(self, ea):
     if idaapi.is_member_id(ea):
         # ti_changed might be called for struc members??
         return
     self.addresses_to_process.add(ea)
     self.repo_manager.add_auto_comment(ea, "Type info changed")