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

Modified APIs

In 8.4
In 9.0

idaman bool ida_export dirtree_get_abspath_by_cursor2(qstring *out, const dirtree_impl_t *d, const dirtree_cursor_t &cursor, uint32 name_flags)

idaman bool ida_export dirtree_get_abspath_by_cursor(qstring *out, const dirtree_impl_t *d, const dirtree_cursor_t &cursor, uint32 name_flags)

diskio.hpp

Modified APIs

In 8.4
In 9.0

idaman THREAD_SAFE int ida_export enumerate_files2(char *answer, size_t answer_size, const char *path, const char *fname, file_enumerator_t &fv)

idaman THREAD_SAFE int ida_export enumerate_files(char *answer, size_t answer_size, const char *path, const char *fname, file_enumerator_t &fv)

Removed APIs

  • ecreate(const char *file)

  • eclose(FILE *fp)

  • eread(FILE *fp, void *buf, size_t size)

  • ewrite(FILE *fp, const void *buf, size_t size)

  • eseek(FILE *fp, qoff64_t pos)

  • enumerate_files(char *answer, size_t answer_size, const char *path, const char *fname, int (idaapi*func)(const char *file,void *ud), void *ud=nullptr)

err.h

Removed APIs

  • qerrcode(int new_code=-1)

expr.hpp

Modified APIs

In 8.4
In 9.0

bool extlang_t::(idaapi *compile_file)(const char *file, qstring *errbuf)

bool extlang_t::(idaapi *compile_file)(const char *file, const char *requested_namespace, qstring *errbuf)

frame.hpp

Added APIs

  • idaman bool ida_export add_frame_member(const func_t *pfn, const char *name, uval_t offset, const tinfo_t &tif, const struct value_repr_t *repr=nullptr, uint etf_flags=0)

  • THREAD_SAFE bool is_anonymous_member_name(const char *name)

  • THREAD_SAFE bool is_dummy_member_name(const char *name)

  • idaman bool ida_export is_special_frame_member(tid_t tid)

  • idaman bool ida_export set_frame_member_type(const func_t *pfn, uval_t offset, const tinfo_t &tif, const struct value_repr_t *repr=nullptr, uint etf_flags=0)

  • idaman bool ida_export delete_frame_members(const func_t *pfn, uval_t start_offset, uval_t end_offset)

  • idaman sval_t ida_export calc_frame_offset(func_t *pfn, sval_t off, const insn_t *insn = nullptr, const op_t *op = nullptr)

Modified PIs

In 8.4
In 9.0

idaman struc_t *ida_export get_frame(const func_t *pfn)

idaman bool ida_export get_func_frame(tinfo_t *out, const func_t *pfn)

idaman bool ida_export define_stkvar(func_t *pfn, const char *name, sval_t off, flags64_t flags, const opinfo_t *ti, asize_t nbytes)

idaman bool ida_export define_stkvar(func_t *pfn, const char *name, sval_t off, const tinfo_t &tif, const struct value_repr_t *repr=nullptr)

idaman void ida_export build_stkvar_xrefs(xreflist_t *out, func_t *pfn, const member_t *mptr)

idaman void ida_export build_stkvar_xrefs(xreflist_t *out, func_t *pfn, uval_t start_offset, uval_t end_offset)

Removed APIs

  • get_frame_member_by_id(qstring *out_mname, struc_t **out_fptr, tid_t mid)

  • get_stkvar(sval_t *actval, const insn_t &insn, const op_t &x, sval_t v) See get_stkvar in ida_typeinf.tinfo_t

  • get_min_spd_ea(func_t *pfn)

  • delete_unreferenced_stkvars(func_t *pfn)

  • delete_wrong_stkvar_ops(func_t *pfn)

funcs.hpp

Added APIs

  • bool func_item_iterator_t::set_ea(ea_t _ea)

Removed APIs

  • save_signatures(void)

  • invalidate_sp_analysis(func_t *pfn)

  • invalidate_sp_analysis(ea_t ea)

gdl.hpp

Added classes/structures

  • struct edge_t

  • class node_ordering_t

hexrays.hpp

Added classes/structures

  • class control_graph_t

  • class edge_mapper_t

  • class node_bitset_t