Module index

Module ida_enum

IDA Plugin SDK API wrapper: enum

Global variables

var DEFMASK
default bitmask
var ENFL_REGEX
apply regular expressions to beautify the name
var ENUM_MEMBER_ERROR_ENUM
bad enum id
var ENUM_MEMBER_ERROR_ILLV
bad bmask and value combination (~bmask & value != 0)
var ENUM_MEMBER_ERROR_MASK
bad bmask
var ENUM_MEMBER_ERROR_NAME
already have member with this name (bad name)
var ENUM_MEMBER_ERROR_VALUE
already have 256 members with this value
var MAX_ENUM_SERIAL
MAX_ENUM_SERIAL = 255

Functions

def add_enum(*args) ‑> enum_t
Add new enum type.if idx== 'BADADDR' then add as the last idxif name==NULL then generate a unique name "enum_%d"
add_enum(idx, name, flag) -> enum_t
idx (C++: size_t)
name (C++: const char *)
flag (C++: flags_t)
def add_enum_member(*args) ‑> int
Add member to enum type.
add_enum_member(id, name, value, bmask=(bmask_t(-1))) -> int
id (C++: enum_t)
name (C++: const char *)
value (C++: uval_t)
bmask (C++: bmask_t)
return: 0 if ok, otherwise one of Add enum member result codes
def del_enum(*args) ‑> void
Delete an enum type.
del_enum(id)
id (C++: enum_t)
def del_enum_member(*args) ‑> bool
Delete member of enum type.
del_enum_member(id, value, serial, bmask) -> bool
id (C++: enum_t)
value (C++: uval_t)
serial (C++: uchar)
bmask (C++: bmask_t)
def for_all_enum_members(*args) ‑> int
Visit all members of a given enum.
for_all_enum_members(id, cv) -> int
id (C++: enum_t)
cv (C++: enum_member_visitor_t &)
def get_bmask_cmt(*args) ‑> qstring *
get_bmask_cmt(id, bmask, repeatable) -> str
id (C++: enum_t)
bmask (C++: bmask_t)
repeatable (C++: bool)
def get_bmask_name(*args) ‑> qstring *
get_bmask_name(id, bmask) -> str
id (C++: enum_t)
bmask (C++: bmask_t)
def get_enum(*args) ‑> enum_t
Get enum by name.
get_enum(name) -> enum_t
name (C++: const char *)
def get_enum_cmt(*args) ‑> qstring *
Get enum comment.
get_enum_cmt(id, repeatable) -> str
id (C++: enum_t)
repeatable (C++: bool)
def get_enum_flag(*args) ‑> flags_t
Get flags determining the representation of the enum. (currently they define the numeric base: octal, decimal, hex, bin) and signness.
get_enum_flag(id) -> flags_t
id (C++: enum_t)
def get_enum_idx(*args) ‑> uval_t
Get the index in the list of enums.
get_enum_idx(id) -> uval_t
id (C++: enum_t)
def get_enum_member(*args) ‑> const_t
Find an enum member by enum, value and bitmaskif serial -1, return a member with any serial
get_enum_member(id, value, serial, mask) -> const_t
id (C++: enum_t)
value (C++: uval_t)
serial (C++: int)
mask (C++: bmask_t)
def get_enum_member_bmask(*args) ‑> bmask_t
Get bitmask of an enum member.
get_enum_member_bmask(id) -> bmask_t
id (C++: const_t)
def get_enum_member_by_name(*args) ‑> const_t
Get a reference to an enum member by its name.
get_enum_member_by_name(name) -> const_t
name (C++: const char *)
def get_enum_member_cmt(*args) ‑> qstring *
Get enum member's comment.
get_enum_member_cmt(id, repeatable) -> str
id (C++: const_t)
repeatable (C++: bool)
def get_enum_member_enum(*args) ‑> enum_t
Get the parent enum of an enum member.
get_enum_member_enum(id) -> enum_t
id (C++: const_t)
def get_enum_member_name(*args) ‑> qstring *
Get name of an enum member by const_t.
get_enum_member_name(id) -> str
id (C++: const_t)
def get_enum_member_serial(*args) ‑> uchar
Get serial number of an enum member.
get_enum_member_serial(cid) -> uchar
cid (C++: const_t)
def get_enum_member_value(*args) ‑> uval_t
Get value of an enum member.
get_enum_member_value(id) -> uval_t
id (C++: const_t)
def get_enum_name(*args) ‑> qstring *
Get name of enum.
get_enum_name(id) -> str
id (C++: enum_t)
def get_enum_name2(*args) ‑> qstring *
Get name of enum
get_enum_name2(id, flags=0) -> str
id: enum id (C++: enum_t)
flags: Enum name flags (C++: int)
def get_enum_qty(*args) ‑> size_t
Get number of declared 'enum_t' types.
def get_enum_size(*args) ‑> size_t
Get the number of the members of the enum.
get_enum_size(id) -> size_t
id (C++: enum_t)
def get_enum_type_ordinal(*args) ‑> int32
Get corresponding type ordinal number.
get_enum_type_ordinal(id) -> int32
id (C++: enum_t)
def get_enum_width(*args) ‑> size_t
Get the width of a enum element allowed values: 0 (unspecified),1,2,4,8,16,32,64
get_enum_width(id) -> size_t
id (C++: enum_t)
def get_first_bmask(*args) ‑> bmask_t
Get first bitmask in the enum (bitfield)
get_first_bmask(id) -> bmask_t
id (C++: enum_t)
return: the smallest bitmask for enum, or DEFMASK
def get_first_enum_member(*args) ‑> uval_t
get_first_enum_member(id, bmask=(bmask_t(-1))) -> uval_t
id (C++: enum_t)
bmask (C++: bmask_t)
def get_first_serial_enum_member(*args) ‑> uchar *
get_first_serial_enum_member(id, value, bmask) -> const_t
id (C++: enum_t)
value (C++: uval_t)
bmask (C++: bmask_t)
def get_last_bmask(*args) ‑> bmask_t
Get last bitmask in the enum (bitfield)
get_last_bmask(id) -> bmask_t
id (C++: enum_t)
return: the biggest bitmask for enum, or DEFMASK
def get_last_enum_member(*args) ‑> uval_t
get_last_enum_member(id, bmask=(bmask_t(-1))) -> uval_t
id (C++: enum_t)
bmask (C++: bmask_t)
def get_last_serial_enum_member(*args) ‑> uchar *
get_last_serial_enum_member(id, value, bmask) -> const_t
id (C++: enum_t)
value (C++: uval_t)
bmask (C++: bmask_t)
def get_next_bmask(*args) ‑> bmask_t
Get next bitmask in the enum (bitfield)
get_next_bmask(id, bmask) -> bmask_t
id (C++: enum_t)
bmask (C++: bmask_t)
return: value of a bitmask with value higher than the specified
value, or DEFMASK
def get_next_enum_member(*args) ‑> uval_t
get_next_enum_member(id, value, bmask=(bmask_t(-1))) -> uval_t
id (C++: enum_t)
value (C++: uval_t)
bmask (C++: bmask_t)
def get_next_serial_enum_member(*args) ‑> uchar *
get_next_serial_enum_member(in_out_serial, first_cid) -> const_t
in_out_serial (C++: uchar *)
first_cid (C++: const_t)
def get_prev_bmask(*args) ‑> bmask_t
Get prev bitmask in the enum (bitfield)
get_prev_bmask(id, bmask) -> bmask_t
id (C++: enum_t)
bmask (C++: bmask_t)
return: value of a bitmask with value lower than the specified value,
or DEFMASK
def get_prev_enum_member(*args) ‑> uval_t
get_prev_enum_member(id, value, bmask=(bmask_t(-1))) -> uval_t
id (C++: enum_t)
value (C++: uval_t)
bmask (C++: bmask_t)
def get_prev_serial_enum_member(*args) ‑> uchar *
get_prev_serial_enum_member(in_out_serial, first_cid) -> const_t
in_out_serial (C++: uchar *)
first_cid (C++: const_t)
def getn_enum(*args) ‑> enum_t
Get enum by its index in the list of enums (0.. 'get_enum_qty()' -1).
getn_enum(idx) -> enum_t
idx (C++: size_t)
def is_bf(*args) ‑> bool
Is enum a bitfield? (otherwise - plain enum, no bitmasks except for 'DEFMASK' are allowed)
is_bf(id) -> bool
id (C++: enum_t)
def is_enum_fromtil(*args) ‑> bool
Does enum come from type library?
is_enum_fromtil(id) -> bool
id (C++: enum_t)
def is_enum_hidden(*args) ‑> bool
Is enum collapsed?
is_enum_hidden(id) -> bool
id (C++: enum_t)
def is_ghost_enum(*args) ‑> bool
Is a ghost copy of a local type?
is_ghost_enum(id) -> bool
id (C++: enum_t)
def is_one_bit_mask(*args) ‑> bool
Is bitmask one bit?
is_one_bit_mask(mask) -> bool
mask (C++: bmask_t)
def set_bmask_cmt(*args) ‑> bool
set_bmask_cmt(id, bmask, cmt, repeatable) -> bool
id (C++: enum_t)
bmask (C++: bmask_t)
cmt (C++: const char *)
repeatable (C++: bool)
def set_bmask_name(*args) ‑> bool
set_bmask_name(id, bmask, name) -> bool
id (C++: enum_t)
bmask (C++: bmask_t)
name (C++: const char *)
def set_enum_bf(*args) ‑> bool
Set 'bitfield' bit of enum (i.e. convert it to a bitfield)
set_enum_bf(id, bf) -> bool
id (C++: enum_t)
bf (C++: bool)
def set_enum_cmt(*args) ‑> bool
Set comment for enum type.
set_enum_cmt(id, cmt, repeatable) -> bool
id (C++: enum_t)
cmt (C++: const char *)
repeatable (C++: bool)
def set_enum_flag(*args) ‑> bool
Set data representation flags.
set_enum_flag(id, flag) -> bool
id (C++: enum_t)
flag (C++: flags_t)
def set_enum_fromtil(*args) ‑> bool
Specify that enum comes from a type library.
set_enum_fromtil(id, fromtil) -> bool
id (C++: enum_t)
fromtil (C++: bool)
def set_enum_ghost(*args) ‑> bool
Specify that enum is a ghost copy of a local type.
set_enum_ghost(id, ghost) -> bool
id (C++: enum_t)
ghost (C++: bool)
def set_enum_hidden(*args) ‑> bool
Collapse enum.
set_enum_hidden(id, hidden) -> bool
id (C++: enum_t)
hidden (C++: bool)
def set_enum_idx(*args) ‑> bool
Set serial number of enum. Also see 'get_enum_idx()' .
set_enum_idx(id, idx) -> bool
id (C++: enum_t)
idx (C++: size_t)
def set_enum_member_cmt(*args) ‑> bool
Set comment for enum member.
set_enum_member_cmt(id, cmt, repeatable) -> bool
id (C++: const_t)
cmt (C++: const char *)
repeatable (C++: bool)
def set_enum_member_name(*args) ‑> bool
Set name of enum member.
set_enum_member_name(id, name) -> bool
id (C++: const_t)
name (C++: const char *)
def set_enum_name(*args) ‑> bool
Set name of enum type.
set_enum_name(id, name) -> bool
id (C++: enum_t)
name (C++: const char *)
def set_enum_type_ordinal(*args) ‑> void
Set corresponding type ordinal number.
set_enum_type_ordinal(id, ord)
id (C++: enum_t)
ord (C++: int32)
def set_enum_width(*args) ‑> bool
See comment for 'get_enum_width()'
set_enum_width(id, width) -> bool
id (C++: enum_t)
width (C++: int)

Classes

class enum_member_visitor_t (*args)
Proxy of C++ enum_member_visitor_t class.
__init__(self) -> enum_member_visitor_t
self: PyObject *

Methods

def visit_enum_member(self, *args) ‑> int
Implements action to take when enum member is visited.
visit_enum_member(self, cid, value) -> int
cid (C++: const_t)
value (C++: uval_t)
return: nonzero to stop the iteration