C++ SDK Porting Guide from IDA 8.x to 9.0

IDA 9.0 API Changes and porting guide

Introduction

The largest change is the removal of two headers:

  • struct.hpp

  • enum.hpp

The functionalities for working with user-defined types are now available in typeinf.hpp (tinfo_t class).

struct.hpp

Removed classes

  • class member_t;

  • class struc_t;

struc_t is replaced by the notion of "user-defined type" (udt_type_data_t class) and member_t by dt member (udm_t class).

Removed APIs

  • get_struc_qty() Rough equivalent is get_ordinal_limit() or get_ordinal_count() but note that it also includes enums and typedefs.

  • get_first_struc_idx()

  • get_last_struc_idx()

  • get_prev_struc_idx()

  • get_next_struc_idx()

Local type ordinals always start at 1 (0 is invalid ordinal) and go up to get_ordinal_limit().

  • get_struc_idx(tid_t id)

  • get_struc_by_idx(uval_t idx)

enum.hpp

Enumerations are now manipulated via:

  • tinfo_t class

  • enum_type_data_t class

  • edm_t class. in typeinf.hpp

Removed APIs

  • get_enum_qty(void)

  • getn_enum(size_t idx)

  • get_enum_idx(enum_t id)

  • get_enum(const char *name)

  • is_bf(enum_t id)

  • is_enum_hidden(enum_t id)

  • set_enum_hidden(enum_t id, bool hidden)

  • is_enum_fromtil(enum_t id)

  • set_enum_fromtil(enum_t id, bool fromtil)

  • is_ghost_enum(enum_t id)

  • set_enum_ghost(enum_t id, bool ghost)

  • get_enum_name(qstring *out, enum_t id)

  • get_enum_name2(qstring *out, enum_t id, int flags=0)

  • get_enum_name(tid_t id, int flags=0)

  • get_enum_width(enum_t id)

  • set_enum_width(enum_t id, int width)

  • get_enum_cmt(qstring *buf, enum_t id, bool repeatable)

  • get_enum_size(enum_t id)

  • get_enum_flag(enum_t id)

  • get_enum_member_by_name(const char *name)

  • get_enum_member_value(const_t id)

  • get_enum_member_enum(const_t id)

  • get_enum_member_bmask(const_t id)

  • get_enum_member(enum_t id, uval_t value, int serial, bmask_t mask)

  • get_first_bmask(enum_t enum_id)

  • get_last_bmask(enum_t enum_id)

  • get_next_bmask(enum_t enum_id, bmask_t bmask\)

  • get_prev_bmask(enum_t enum_id, bmask_t bmask)

  • get_first_enum_member(enum_t id, bmask_t bmask=DEFMASK)

  • get_last_enum_member(enum_t id, bmask_t bmask=DEFMASK)

  • get_next_enum_member(enum_t id, uval_t value, bmask_t bmask=DEFMASK)

  • get_prev_enum_member(enum_t id, uval_t value, bmask_t bmask=DEFMASK)

  • get_enum_member_name(qstring *out, const_t id)

  • get_enum_member_cmt(qstring *buf, const_t id, bool repeatable)

  • get_first_serial_enum_member(uchar *out_serial, enum_t id, uval_t value, bmask_t bmask)

  • get_last_serial_enum_member(uchar *out_serial, enum_t id, uval_t value, bmask_t bmask)

  • get_next_serial_enum_member(uchar *in_out_serial, const_t first_cid)

  • get_prev_serial_enum_member(uchar *in_out_serial, const_t first_cid)

  • for_all_enum_members(enum_t id, enum_member_visitor_t &cv)

  • ida_export get_enum_member_serial(const_t cid)

  • get_enum_type_ordinal(enum_t id)

  • set_enum_type_ordinal(enum_t id, int32 ord)

  • add_enum(size_t idx, const char *name, flags64_t flag)

  • del_enum(enum_t id)

  • set_enum_idx(enum_t id, size_t idx)

  • set_enum_bf(enum_t id, bool bf)

  • set_enum_name(enum_t id, const char *name)

  • set_enum_cmt(enum_t id, const char *cmt, bool repeatable)

  • set_enum_flag(enum_t id, flags64_t flag)

  • add_enum_member(enum_t id, const char *name, uval_t value, bmask_t bmask=DEFMASK)

  • del_enum_member(enum_t id, uval_t value, uchar serial, bmask_t bmask)

  • set_enum_member_name(const_t id, const char *name)

  • set_enum_member_cmt(const_t id, const char *cmt, bool repeatable)

  • is_one_bit_mask(bmask_t mask)

  • set_bmask_name(enum_t id, bmask_t bmask, const char *name)

  • get_bmask_name(qstring *out, enum_t id, bmask_t bmask)

  • set_bmask_cmt(enum_t id, bmask_t bmask, const char *cmt, bool repeatable)

  • get_bmask_cmt(qstring *buf, enum_t id, bmask_t bmask, bool repeatable)

bytes.hpp

Added APIs

  • idaman ea_t ida_export find_binary(ea_t startea, ea_t endea, const char *ubinstr, int radix, int sflag, int strlits_encoding=0)

Modified APIs

In 8.4
In 9.0

idaman bool ida_export get_octet2(uchar *out, octet_generator_t *ogen)

idaman bool ida_export get_octet(uchar *out, octet_generator_t *ogen)

idaman bool ida_export op_enum(ea_t ea, int n, enum_t id, uchar serial=0)

idaman bool ida_export op_enum(ea_t ea, int n, tid_t id, uchar serial=0)

idaman enum_t ida_export get_enum_id(uchar *serial, ea_t ea, int n)

idaman tid_t ida_export get_enum_id(uchar *serial, ea_t ea, int n)

idaman ea_t ida_export bin_search3(size_t *out_matched_idx, ea_t start_ea, ea_t end_ea, const compiled_binpat_vec_t &data, int flags)

idaman ea_t ida_export bin_search(ea_t start_ea, ea_t end_ea, const compiled_binpat_vec_t &data, int flags, size_t *out_matched_idx=nullptr)

Removed APIs

  • bin_search2(ea_t start_ea, ea_t end_ea, const compiled_binpat_vec_t &data, int flags)

  • bin_search(ea_t, ea_t, const uchar *, const uchar *, size_t, int, int)

  • get_8bit(ea_t *ea, uint32 *v, int *nbit)

  • get_octet(ea_t *ea, uint64 *v, int *nbit)

  • free_chunk(ea_t bottom, asize_t size, int32 step)

dirtree.hpp