Module ida_enum
[frames] | no frames]

Module ida_enum

IDA Plugin SDK API wrapper: enum

Classes
  enum_member_visitor_t
Proxy of C++ enum_member_visitor_t class
Functions
size_t
get_enum_qty()
Get number of declared 'enum_t' types.
enum_t
getn_enum(n)
Get enum by its ordinal number (0..n).
uval_t
get_enum_idx(id)
Get serial number of enum.
enum_t
get_enum(name)
Get enum by name.
bool
is_bf(id)
Is enum a bitfield? (otherwise - plain enum, no bitmasks except for 'DEFMASK' are allowed)
bool
is_enum_hidden(id)
Is enum collapsed?
bool
set_enum_hidden(id, hidden)
Collapse enum.
bool
is_enum_fromtil(id)
Does enum come from type library?
bool
set_enum_fromtil(id, fromtil)
Specify that enum comes from a type library.
bool
is_ghost_enum(id)
Is a ghost copy of a local type?
bool
set_enum_ghost(id, ghost)
Specify that enum is a ghost copy of a local type.
ssize_t
get_enum_name(id)
Get name of enum.
size_t
get_enum_width(id)
Get the width of a enum element allowed values: 0 (unspecified),1,2,4,8,16,32,64
bool
set_enum_width(id, width)
See comment for 'get_enum_width()'
ssize_t
get_enum_cmt(id, repeatable)
Get enum comment.
size_t
get_enum_size(id)
Get the number of the members of the enum.
flags_t
get_enum_flag(id)
Get flags determining the representation of the enum.
const_t
get_enum_member_by_name(name)
Get a reference to an enum member by its name.
uval_t
get_enum_member_value(id)
Get value of an enum member.
enum_t
get_enum_member_enum(id)
Get the parent enum of an enum member.
bmask_t
get_enum_member_bmask(id)
Get bitmask of an enum member.
const_t
get_enum_member(id, value, serial, mask)
Find an enum member by enum, value and bitmaskif serial -1, return a member with any serial
bmask_t
get_first_bmask(id)
Get first bitmask in the enum (bitfield)
bmask_t
get_last_bmask(id)
Get last bitmask in the enum (bitfield)
bmask_t
get_next_bmask(id, bmask)
Get next bitmask in the enum (bitfield)
bmask_t
get_prev_bmask(id, bmask)
Get prev bitmask in the enum (bitfield)
uval_t
get_first_enum_member(id, bmask=(bmask_t(-1)))
uval_t
get_last_enum_member(id, bmask=(bmask_t(-1)))
uval_t
get_next_enum_member(id, value, bmask=(bmask_t(-1)))
uval_t
get_prev_enum_member(id, value, bmask=(bmask_t(-1)))
ssize_t
get_enum_member_name(id)
Get name of an enum member by const_t.
ssize_t
get_enum_member_cmt(id, repeatable)
Get enum member's comment.
const_t
get_first_serial_enum_member(id, value, bmask)
const_t
get_last_serial_enum_member(id, value, bmask)
const_t
get_next_serial_enum_member(in_out_serial, first_cid)
const_t
get_prev_serial_enum_member(in_out_serial, first_cid)
int
for_all_enum_members(id, cv)
Visit all members of a given enum.
uchar
get_enum_member_serial(cid)
Get serial number of an enum member.
int32
get_enum_type_ordinal(id)
Get corresponding type ordinal number.
 
set_enum_type_ordinal(id, ord)
Set corresponding type ordinal number.
enum_t
add_enum(idx, name, flag)
Add new enum type.if idx== 'BADADDR' then add as the last idxif name==NULL then generate a unique name "enum_%d"
 
del_enum(id)
Delete an enum type.
bool
set_enum_idx(id, idx)
Set serial number of enum.
bool
set_enum_bf(id, bf)
Set 'bitfield' bit of enum (i.e.
bool
set_enum_name(id, name)
Set name of enum type.
bool
set_enum_cmt(id, cmt, repeatable)
Set comment for enum type.
bool
set_enum_flag(id, flag)
Set data representation flags.
int
add_enum_member(id, name, value, bmask=(bmask_t(-1)))
Add member to enum type.
bool
del_enum_member(id, value, serial, bmask)
Delete member of enum type.
bool
set_enum_member_name(id, name)
Set name of enum member.
bool
set_enum_member_cmt(id, cmt, repeatable)
Set comment for enum member.
bool
is_one_bit_mask(mask)
Is bitmask one bit?
bool
set_bmask_name(id, bmask, name)
ssize_t
get_bmask_name(id, bmask)
bool
set_bmask_cmt(id, bmask, cmt, repeatable)
ssize_t
get_bmask_cmt(id, bmask, repeatable)
Variables
  DEFMASK = 4294967295
default bitmask
  cvar = _ida_enum.cvar
  MAX_ENUM_SERIAL = 255
  ENUM_MEMBER_ERROR_NAME = 1
already have member with this name (bad name)
  ENUM_MEMBER_ERROR_VALUE = 2
already have 256 members with this value
  ENUM_MEMBER_ERROR_ENUM = 3
bad enum id
  ENUM_MEMBER_ERROR_MASK = 4
bad bmask
  ENUM_MEMBER_ERROR_ILLV = 5
bad bmask and value combination (~bmask & value != 0)
  __package__ = None
Function Details

getn_enum(n)

 

Get enum by its ordinal number (0..n).

Parameters:
  • n, (C++ - size_t)
Returns: enum_t

get_enum_idx(id)

 

Get serial number of enum. The serial number determines the place of the enum in the enum window.

Parameters:
  • id, (C++ - enum_t)
Returns: uval_t

get_enum(name)

 

Get enum by name.

Parameters:
  • name, (C++ - const char *)
Returns: enum_t

is_bf(id)

 

Is enum a bitfield? (otherwise - plain enum, no bitmasks except for 'DEFMASK' are allowed)

Parameters:
  • id, (C++ - enum_t)
Returns: bool

is_enum_hidden(id)

 

Is enum collapsed?

Parameters:
  • id, (C++ - enum_t)
Returns: bool

set_enum_hidden(id, hidden)

 

Collapse enum.

Parameters:
  • id, (C++ - enum_t)
  • hidden, (C++ - bool)
Returns: bool

is_enum_fromtil(id)

 

Does enum come from type library?

Parameters:
  • id, (C++ - enum_t)
Returns: bool

set_enum_fromtil(id, fromtil)

 

Specify that enum comes from a type library.

Parameters:
  • id, (C++ - enum_t)
  • fromtil, (C++ - bool)
Returns: bool

is_ghost_enum(id)

 

Is a ghost copy of a local type?

Parameters:
  • id, (C++ - enum_t)
Returns: bool

set_enum_ghost(id, ghost)

 

Specify that enum is a ghost copy of a local type.

Parameters:
  • id, (C++ - enum_t)
  • ghost, (C++ - bool)
Returns: bool

get_enum_name(id)

 

Get name of enum.

Parameters:
  • id, (C++ - enum_t)
Returns: ssize_t

get_enum_width(id)

 

Get the width of a enum element allowed values: 0 (unspecified),1,2,4,8,16,32,64

Parameters:
  • id, (C++ - enum_t)
Returns: size_t

set_enum_width(id, width)

 

See comment for 'get_enum_width()'

Parameters:
  • id, (C++ - enum_t)
  • width, (C++ - int)
Returns: bool

get_enum_cmt(id, repeatable)

 

Get enum comment.

Parameters:
  • id, (C++ - enum_t)
  • repeatable, (C++ - bool)
Returns: ssize_t

get_enum_size(id)

 

Get the number of the members of the enum.

Parameters:
  • id, (C++ - enum_t)
Returns: size_t

get_enum_flag(id)

 

Get flags determining the representation of the enum. (currently they define the numeric base: octal, decimal, hex, bin) and signness.

Parameters:
  • id, (C++ - enum_t)
Returns: flags_t

get_enum_member_by_name(name)

 

Get a reference to an enum member by its name.

Parameters:
  • name, (C++ - const char *)
Returns: const_t

get_enum_member_value(id)

 

Get value of an enum member.

Parameters:
  • id, (C++ - const_t)
Returns: uval_t

get_enum_member_enum(id)

 

Get the parent enum of an enum member.

Parameters:
  • id, (C++ - const_t)
Returns: enum_t

get_enum_member_bmask(id)

 

Get bitmask of an enum member.

Parameters:
  • id, (C++ - const_t)
Returns: bmask_t

get_enum_member(id, value, serial, mask)

 

Find an enum member by enum, value and bitmaskif serial -1, return a member with any serial

Parameters:
  • id, (C++ - enum_t)
  • value, (C++ - uval_t)
  • serial, (C++ - int)
  • mask, (C++ - bmask_t)
Returns: const_t

get_first_bmask(id)

 

Get first bitmask in the enum (bitfield)

Parameters:
  • id, (C++ - enum_t)
Returns: bmask_t
the smallest bitmask for enum, or DEFMASK

get_last_bmask(id)

 

Get last bitmask in the enum (bitfield)

Parameters:
  • id, (C++ - enum_t)
Returns: bmask_t
the biggest bitmask for enum, or DEFMASK

get_next_bmask(id, bmask)

 

Get next bitmask in the enum (bitfield)

Parameters:
  • id, (C++ - enum_t)
  • bmask, (C++ - bmask_t)
Returns: bmask_t
value of a bitmask with value higher than the specified value, or DEFMASK

get_prev_bmask(id, bmask)

 

Get prev bitmask in the enum (bitfield)

Parameters:
  • id, (C++ - enum_t)
  • bmask, (C++ - bmask_t)
Returns: bmask_t
value of a bitmask with value lower than the specified value, or DEFMASK

get_enum_member_name(id)

 

Get name of an enum member by const_t.

Parameters:
  • id, (C++ - const_t)
Returns: ssize_t

get_enum_member_cmt(id, repeatable)

 

Get enum member's comment.

Parameters:
  • id, (C++ - const_t)
  • repeatable, (C++ - bool)
Returns: ssize_t

for_all_enum_members(id, cv)

 

Visit all members of a given enum.

Parameters:
  • id, (C++ - enum_t)
  • cv, (C++ - enum_member_visitor_t &)
Returns: int

get_enum_member_serial(cid)

 

Get serial number of an enum member.

Parameters:
  • cid, (C++ - const_t)
Returns: uchar

get_enum_type_ordinal(id)

 

Get corresponding type ordinal number.

Parameters:
  • id, (C++ - enum_t)
Returns: int32

set_enum_type_ordinal(id, ord)

 

Set corresponding type ordinal number.

Parameters:
  • id, (C++ - enum_t)
  • ord, (C++ - int32)

add_enum(idx, name, flag)

 

Add new enum type.if idx== 'BADADDR' then add as the last idxif name==NULL then generate a unique name "enum_%d"

Parameters:
  • idx, (C++ - size_t)
  • name, (C++ - const char *)
  • flag, (C++ - flags_t)
Returns: enum_t

del_enum(id)

 

Delete an enum type.

Parameters:
  • id, (C++ - enum_t)

set_enum_idx(id, idx)

 

Set serial number of enum. Also see 'get_enum_idx()' .

Parameters:
  • id, (C++ - enum_t)
  • idx, (C++ - size_t)
Returns: bool

set_enum_bf(id, bf)

 

Set 'bitfield' bit of enum (i.e. convert it to a bitfield)

Parameters:
  • id, (C++ - enum_t)
  • bf, (C++ - bool)
Returns: bool

set_enum_name(id, name)

 

Set name of enum type.

Parameters:
  • id, (C++ - enum_t)
  • name, (C++ - const char *)
Returns: bool

set_enum_cmt(id, cmt, repeatable)

 

Set comment for enum type.

Parameters:
  • id, (C++ - enum_t)
  • cmt, (C++ - const char *)
  • repeatable, (C++ - bool)
Returns: bool

set_enum_flag(id, flag)

 

Set data representation flags.

Parameters:
  • id, (C++ - enum_t)
  • flag, (C++ - flags_t)
Returns: bool

add_enum_member(id, name, value, bmask=(bmask_t(-1)))

 

Add member to enum type.

Parameters:
  • id, (C++ - enum_t)
  • name, (C++ - const char *)
  • value, (C++ - uval_t)
  • bmask, (C++ - bmask_t)
Returns: int
0 if ok, otherwise one of Add enum member result codes

del_enum_member(id, value, serial, bmask)

 

Delete member of enum type.

Parameters:
  • id, (C++ - enum_t)
  • value, (C++ - uval_t)
  • serial, (C++ - uchar)
  • bmask, (C++ - bmask_t)
Returns: bool

set_enum_member_name(id, name)

 

Set name of enum member.

Parameters:
  • id, (C++ - const_t)
  • name, (C++ - const char *)
Returns: bool

set_enum_member_cmt(id, cmt, repeatable)

 

Set comment for enum member.

Parameters:
  • id, (C++ - const_t)
  • cmt, (C++ - const char *)
  • repeatable, (C++ - bool)
Returns: bool

is_one_bit_mask(mask)

 

Is bitmask one bit?

Parameters:
  • mask, (C++ - bmask_t)
Returns: bool