Ejemplo n.º 1
0
def set_enum(bs_enum: Enum):
    _enum = ida_enum.get_enum(bs_enum.name)
    if not _enum:
        return False

    ida_enum.del_enum(_enum)
    enum_id = ida_enum.add_enum(ida_enum.get_enum_qty(), bs_enum.name, 0)

    if enum_id is None:
        l.warning(f"IDA failed to create a new enum with {bs_enum.name}")
        return False

    for member_name, value in bs_enum.members.items():
        ida_enum.add_enum_member(enum_id, member_name, value)

    return True
Ejemplo n.º 2
0
    def delete(arg):
        """
            Static method allowing to delete an enum by its name or its id.

            :parm arg: String representing the name of the enum or id (int)
                representing the enum in IDA or a :class:`BipEnum` object (in
                that case the object will not be valid after that).
            :raise ValueError: If the argument is invalid.
        """
        if isinstance(arg, (str, unicode)):
            eid = ida_enum.get_enum(arg)
            if eid == idc.BADADDR:
                raise ValueError("Enum {} does not exist".format(arg))
        elif isinstance(arg, (int, long)):
            eid = arg
        elif isinstance(arg, BipEnum):
            eid = arg._eid
        else:
            raise ValueError("Invalid argument")
        ida_enum.del_enum(eid)
Ejemplo n.º 3
0
 def __call__(self):
     ida_enum.del_enum(ida_enum.get_enum(Event.encode(self.ename)))
Ejemplo n.º 4
0
 def __call__(self):
     ida_enum.del_enum(ida_enum.get_enum(self.ename))
Ejemplo n.º 5
0
 def implement(self):
     id_of_enum = ida_enum.get_enum(str(self._id))
     ida_enum.del_enum(id_of_enum)
Ejemplo n.º 6
0
	def implement(self):
		ida_enum.del_enum(self._id)