State-of-the-art binary code analysis tools
ida.hpp File Reference

Detailed Description

Contains the ::inf structure definition and some functions common to the whole IDA project.

The ::inf structure is saved in the database and contains information specific to the current program being disassembled. Initially it is filled with values from ida.cfg.

Although it is not a good idea to change values in ::inf structure (because you will overwrite values taken from ida.cfg), you are allowed to do it if you feel it necessary.

Classes

struct  compiler_info_t
 Information about the target compiler. More...
 
struct  idainfo
 
struct  post_event_visitor_t
 Implements action to take when the event was processed by the notification callback (i.e. More...
 

Functions

bool is_filetype_like_binary (filetype_t ft)
 Is unstructured input file?
 
 CASSERT (sizeof(idainfo)==200)
 
idaman size_t ida_export getinf (inftag_t tag)
 get program specific information (a scalar value) More...
 
idaman ssize_t ida_export getinf_buf (inftag_t tag, void *buf, size_t bufsize)
 get program specific information (a non-scalar value) More...
 
idaman ssize_t ida_export getinf_str (qstring *buf, inftag_t tag)
 get program specific information (a non-scalar value) More...
 
idaman bool ida_export getinf_flag (inftag_t tag, uint32 flag)
 get a flag value More...
 
idaman bool ida_export setinf (inftag_t tag, ssize_t value)
 set program specific information More...
 
idaman bool ida_export setinf_buf (inftag_t tag, const void *buf, size_t bufsize=0)
 set program specific information More...
 
idaman bool ida_export setinf_flag (inftag_t tag, uint32 flag, bool value=true)
 set a flag value More...
 
idaman bool ida_export delinf (inftag_t tag)
 undefine a program specific information More...
 
ushort inf_get_version ()
 
bool inf_set_version (ushort _v)
 
ushort inf_get_genflags ()
 
bool inf_set_genflags (ushort _v)
 
bool inf_is_auto_enabled (void)
 
bool inf_set_auto_enabled (bool _v=true)
 
bool inf_use_allasm (void)
 
bool inf_set_use_allasm (bool _v=true)
 
bool inf_loading_idc (void)
 
bool inf_set_loading_idc (bool _v=true)
 
bool inf_no_store_user_info (void)
 
bool inf_set_no_store_user_info (bool _v=true)
 
bool inf_readonly_idb (void)
 
bool inf_set_readonly_idb (bool _v=true)
 
bool inf_check_manual_ops (void)
 
bool inf_set_check_manual_ops (bool _v=true)
 
bool inf_allow_non_matched_ops (void)
 
bool inf_set_allow_non_matched_ops (bool _v=true)
 
bool inf_is_graph_view (void)
 
bool inf_set_graph_view (bool _v=true)
 
uint32 inf_get_lflags ()
 
bool inf_set_lflags (uint32 _v)
 
bool inf_decode_fpp (void)
 
bool inf_set_decode_fpp (bool _v=true)
 
bool inf_is_32bit_or_higher (void)
 
bool inf_is_32bit_exactly (void)
 
bool inf_set_32bit (bool _v=true)
 
bool inf_is_16bit (void)
 
bool inf_is_64bit (void)
 
bool inf_set_64bit (bool _v=true)
 
bool inf_is_dll (void)
 
bool inf_set_dll (bool _v=true)
 
bool inf_is_flat_off32 (void)
 
bool inf_set_flat_off32 (bool _v=true)
 
bool inf_is_be (void)
 
bool inf_set_be (bool _v=true)
 
bool inf_is_wide_high_byte_first (void)
 
bool inf_set_wide_high_byte_first (bool _v=true)
 
bool inf_dbg_no_store_path (void)
 
bool inf_set_dbg_no_store_path (bool _v=true)
 
bool inf_is_snapshot (void)
 
bool inf_set_snapshot (bool _v=true)
 
bool inf_pack_idb (void)
 
bool inf_set_pack_idb (bool _v=true)
 
bool inf_compress_idb (void)
 
bool inf_set_compress_idb (bool _v=true)
 
bool inf_is_kernel_mode (void)
 
bool inf_set_kernel_mode (bool _v=true)
 
uint inf_get_app_bitness (void)
 
uint32 inf_get_database_change_count ()
 
bool inf_set_database_change_count (uint32 _v)
 
filetype_t inf_get_filetype ()
 
bool inf_set_filetype (filetype_t _v)
 
ushort inf_get_ostype ()
 
bool inf_set_ostype (ushort _v)
 
ushort inf_get_apptype ()
 
bool inf_set_apptype (ushort _v)
 
uchar inf_get_asmtype ()
 
bool inf_set_asmtype (uchar _v)
 
uchar inf_get_specsegs ()
 
bool inf_set_specsegs (uchar _v)
 
uint32 inf_get_af ()
 
bool inf_set_af (uint32 _v)
 
bool inf_trace_flow (void)
 
bool inf_set_trace_flow (bool _v=true)
 
bool inf_mark_code (void)
 
bool inf_set_mark_code (bool _v=true)
 
bool inf_create_jump_tables (void)
 
bool inf_set_create_jump_tables (bool _v=true)
 
bool inf_noflow_to_data (void)
 
bool inf_set_noflow_to_data (bool _v=true)
 
bool inf_create_all_xrefs (void)
 
bool inf_set_create_all_xrefs (bool _v=true)
 
bool inf_del_no_xref_insns (void)
 
bool inf_set_del_no_xref_insns (bool _v=true)
 
bool inf_create_func_from_ptr (void)
 
bool inf_set_create_func_from_ptr (bool _v=true)
 
bool inf_create_func_from_call (void)
 
bool inf_set_create_func_from_call (bool _v=true)
 
bool inf_create_func_tails (void)
 
bool inf_set_create_func_tails (bool _v=true)
 
bool inf_should_create_stkvars (void)
 
bool inf_set_should_create_stkvars (bool _v=true)
 
bool inf_propagate_stkargs (void)
 
bool inf_set_propagate_stkargs (bool _v=true)
 
bool inf_propagate_regargs (void)
 
bool inf_set_propagate_regargs (bool _v=true)
 
bool inf_should_trace_sp (void)
 
bool inf_set_should_trace_sp (bool _v=true)
 
bool inf_full_sp_ana (void)
 
bool inf_set_full_sp_ana (bool _v=true)
 
bool inf_noret_ana (void)
 
bool inf_set_noret_ana (bool _v=true)
 
bool inf_guess_func_type (void)
 
bool inf_set_guess_func_type (bool _v=true)
 
bool inf_truncate_on_del (void)
 
bool inf_set_truncate_on_del (bool _v=true)
 
bool inf_create_strlit_on_xref (void)
 
bool inf_set_create_strlit_on_xref (bool _v=true)
 
bool inf_check_unicode_strlits (void)
 
bool inf_set_check_unicode_strlits (bool _v=true)
 
bool inf_create_off_using_fixup (void)
 
bool inf_set_create_off_using_fixup (bool _v=true)
 
bool inf_create_off_on_dref (void)
 
bool inf_set_create_off_on_dref (bool _v=true)
 
bool inf_op_offset (void)
 
bool inf_set_op_offset (bool _v=true)
 
bool inf_data_offset (void)
 
bool inf_set_data_offset (bool _v=true)
 
bool inf_use_flirt (void)
 
bool inf_set_use_flirt (bool _v=true)
 
bool inf_append_sigcmt (void)
 
bool inf_set_append_sigcmt (bool _v=true)
 
bool inf_allow_sigmulti (void)
 
bool inf_set_allow_sigmulti (bool _v=true)
 
bool inf_hide_libfuncs (void)
 
bool inf_set_hide_libfuncs (bool _v=true)
 
bool inf_rename_jumpfunc (void)
 
bool inf_set_rename_jumpfunc (bool _v=true)
 
bool inf_rename_nullsub (void)
 
bool inf_set_rename_nullsub (bool _v=true)
 
bool inf_coagulate_data (void)
 
bool inf_set_coagulate_data (bool _v=true)
 
bool inf_coagulate_code (void)
 
bool inf_set_coagulate_code (bool _v=true)
 
bool inf_final_pass (void)
 
bool inf_set_final_pass (bool _v=true)
 
uint32 inf_get_af2 ()
 
bool inf_set_af2 (uint32 _v)
 
bool inf_handle_eh (void)
 
bool inf_set_handle_eh (bool _v=true)
 
bool inf_handle_rtti (void)
 
bool inf_set_handle_rtti (bool _v=true)
 
bool inf_macros_enabled (void)
 
bool inf_set_macros_enabled (bool _v=true)
 
uval_t inf_get_baseaddr ()
 
bool inf_set_baseaddr (uval_t _v)
 
sel_t inf_get_start_ss ()
 
bool inf_set_start_ss (sel_t _v)
 
sel_t inf_get_start_cs ()
 
bool inf_set_start_cs (sel_t _v)
 
ea_t inf_get_start_ip ()
 
bool inf_set_start_ip (ea_t _v)
 
ea_t inf_get_start_ea ()
 
bool inf_set_start_ea (ea_t _v)
 
ea_t inf_get_start_sp ()
 
bool inf_set_start_sp (ea_t _v)
 
ea_t inf_get_main ()
 
bool inf_set_main (ea_t _v)
 
ea_t inf_get_min_ea ()
 
bool inf_set_min_ea (ea_t _v)
 
ea_t inf_get_max_ea ()
 
bool inf_set_max_ea (ea_t _v)
 
ea_t inf_get_omin_ea ()
 
bool inf_set_omin_ea (ea_t _v)
 
ea_t inf_get_omax_ea ()
 
bool inf_set_omax_ea (ea_t _v)
 
ea_t inf_get_lowoff ()
 
bool inf_set_lowoff (ea_t _v)
 
ea_t inf_get_highoff ()
 
bool inf_set_highoff (ea_t _v)
 
uval_t inf_get_maxref ()
 
bool inf_set_maxref (uval_t _v)
 
sval_t inf_get_netdelta ()
 
bool inf_set_netdelta (sval_t _v)
 
uchar inf_get_xrefnum ()
 
bool inf_set_xrefnum (uchar _v)
 
uchar inf_get_type_xrefnum ()
 
bool inf_set_type_xrefnum (uchar _v)
 
uchar inf_get_refcmtnum ()
 
bool inf_set_refcmtnum (uchar _v)
 
uchar inf_get_xrefflag ()
 
bool inf_set_xrefflag (uchar _v)
 
bool inf_show_xref_seg (void)
 
bool inf_set_show_xref_seg (bool _v=true)
 
bool inf_show_xref_tmarks (void)
 
bool inf_set_show_xref_tmarks (bool _v=true)
 
bool inf_show_xref_fncoff (void)
 
bool inf_set_show_xref_fncoff (bool _v=true)
 
bool inf_show_xref_val (void)
 
bool inf_set_show_xref_val (bool _v=true)
 
ushort inf_get_max_autoname_len ()
 
bool inf_set_max_autoname_len (ushort _v)
 
char inf_get_nametype ()
 
bool inf_set_nametype (char _v)
 
uint32 inf_get_short_demnames ()
 
bool inf_set_short_demnames (uint32 _v)
 
uint32 inf_get_long_demnames ()
 
bool inf_set_long_demnames (uint32 _v)
 
uchar inf_get_demnames ()
 
bool inf_set_demnames (uchar _v)
 
uchar inf_get_listnames ()
 
bool inf_set_listnames (uchar _v)
 
uchar inf_get_indent ()
 
bool inf_set_indent (uchar _v)
 
uchar inf_get_comment ()
 
bool inf_set_comment (uchar _v)
 
ushort inf_get_margin ()
 
bool inf_set_margin (ushort _v)
 
ushort inf_get_lenxref ()
 
bool inf_set_lenxref (ushort _v)
 
uint32 inf_get_outflags ()
 
bool inf_set_outflags (uint32 _v)
 
bool inf_show_void (void)
 
bool inf_set_show_void (bool _v=true)
 
bool inf_show_auto (void)
 
bool inf_set_show_auto (bool _v=true)
 
bool inf_gen_null (void)
 
bool inf_set_gen_null (bool _v=true)
 
bool inf_show_line_pref (void)
 
bool inf_set_show_line_pref (bool _v=true)
 
bool inf_line_pref_with_seg (void)
 
bool inf_set_line_pref_with_seg (bool _v=true)
 
bool inf_gen_lzero (void)
 
bool inf_set_gen_lzero (bool _v=true)
 
bool inf_gen_org (void)
 
bool inf_set_gen_org (bool _v=true)
 
bool inf_gen_assume (void)
 
bool inf_set_gen_assume (bool _v=true)
 
bool inf_gen_tryblks (void)
 
bool inf_set_gen_tryblks (bool _v=true)
 
uchar inf_get_cmtflg ()
 
bool inf_set_cmtflg (uchar _v)
 
bool inf_show_repeatables (void)
 
bool inf_set_show_repeatables (bool _v=true)
 
bool inf_show_all_comments (void)
 
bool inf_set_show_all_comments (bool _v=true)
 
bool inf_hide_comments (void)
 
bool inf_set_hide_comments (bool _v=true)
 
bool inf_show_src_linnum (void)
 
bool inf_set_show_src_linnum (bool _v=true)
 
bool inf_test_mode (void)
 
bool inf_show_hidden_insns (void)
 
bool inf_set_show_hidden_insns (bool _v=true)
 
bool inf_show_hidden_funcs (void)
 
bool inf_set_show_hidden_funcs (bool _v=true)
 
bool inf_show_hidden_segms (void)
 
bool inf_set_show_hidden_segms (bool _v=true)
 
uchar inf_get_limiter ()
 
bool inf_set_limiter (uchar _v)
 
bool inf_is_limiter_thin (void)
 
bool inf_set_limiter_thin (bool _v=true)
 
bool inf_is_limiter_thick (void)
 
bool inf_set_limiter_thick (bool _v=true)
 
bool inf_is_limiter_empty (void)
 
bool inf_set_limiter_empty (bool _v=true)
 
short inf_get_bin_prefix_size ()
 
bool inf_set_bin_prefix_size (short _v)
 
uchar inf_get_prefflag ()
 
bool inf_set_prefflag (uchar _v)
 
bool inf_prefix_show_segaddr (void)
 
bool inf_set_prefix_show_segaddr (bool _v=true)
 
bool inf_prefix_show_funcoff (void)
 
bool inf_set_prefix_show_funcoff (bool _v=true)
 
bool inf_prefix_show_stack (void)
 
bool inf_set_prefix_show_stack (bool _v=true)
 
bool inf_prefix_truncate_opcode_bytes (void)
 
bool inf_set_prefix_truncate_opcode_bytes (bool _v=true)
 
uchar inf_get_strlit_flags ()
 
bool inf_set_strlit_flags (uchar _v)
 
bool inf_strlit_names (void)
 
bool inf_set_strlit_names (bool _v=true)
 
bool inf_strlit_name_bit (void)
 
bool inf_set_strlit_name_bit (bool _v=true)
 
bool inf_strlit_serial_names (void)
 
bool inf_set_strlit_serial_names (bool _v=true)
 
bool inf_unicode_strlits (void)
 
bool inf_set_unicode_strlits (bool _v=true)
 
bool inf_strlit_autocmt (void)
 
bool inf_set_strlit_autocmt (bool _v=true)
 
bool inf_strlit_savecase (void)
 
bool inf_set_strlit_savecase (bool _v=true)
 
uchar inf_get_strlit_break ()
 
bool inf_set_strlit_break (uchar _v)
 
char inf_get_strlit_zeroes ()
 
bool inf_set_strlit_zeroes (char _v)
 
int32 inf_get_strtype ()
 
bool inf_set_strtype (int32 _v)
 
uval_t inf_get_strlit_sernum ()
 
bool inf_set_strlit_sernum (uval_t _v)
 
uval_t inf_get_datatypes ()
 
bool inf_set_datatypes (uval_t _v)
 
uint32 inf_get_abibits ()
 
bool inf_set_abibits (uint32 _v)
 
bool inf_is_mem_aligned4 (void)
 
bool inf_set_mem_aligned4 (bool _v=true)
 
bool inf_pack_stkargs (void)
 
bool inf_set_pack_stkargs (bool _v=true)
 
bool inf_big_arg_align (void)
 
bool inf_set_big_arg_align (bool _v=true)
 
bool inf_stack_ldbl (void)
 
bool inf_set_stack_ldbl (bool _v=true)
 
bool inf_stack_varargs (void)
 
bool inf_set_stack_varargs (bool _v=true)
 
bool inf_is_hard_float (void)
 
bool inf_set_hard_float (bool _v=true)
 
bool inf_abi_set_by_user (void)
 
bool inf_set_abi_set_by_user (bool _v=true)
 
bool inf_use_gcc_layout (void)
 
bool inf_set_use_gcc_layout (bool _v=true)
 
bool inf_map_stkargs (void)
 
bool inf_set_map_stkargs (bool _v=true)
 
bool inf_huge_arg_align (void)
 
bool inf_set_huge_arg_align (bool _v=true)
 
bool inf_explicit_stkoffs (void)
 
bool inf_set_explicit_stkoffs (bool _v=true)
 
uint32 inf_get_appcall_options ()
 
bool inf_set_appcall_options (uint32 _v)
 
ea_t inf_get_privrange_start_ea ()
 
bool inf_set_privrange_start_ea (ea_t _v)
 
ea_t inf_get_privrange_end_ea ()
 
bool inf_set_privrange_end_ea (ea_t _v)
 
comp_t inf_get_cc_id ()
 
bool inf_set_cc_id (comp_t _v)
 
cm_t inf_get_cc_cm ()
 
bool inf_set_cc_cm (cm_t _v)
 
uchar inf_get_cc_size_i ()
 
bool inf_set_cc_size_i (uchar _v)
 
uchar inf_get_cc_size_b ()
 
bool inf_set_cc_size_b (uchar _v)
 
uchar inf_get_cc_size_e ()
 
bool inf_set_cc_size_e (uchar _v)
 
uchar inf_get_cc_defalign ()
 
bool inf_set_cc_defalign (uchar _v)
 
uchar inf_get_cc_size_s ()
 
bool inf_set_cc_size_s (uchar _v)
 
uchar inf_get_cc_size_l ()
 
bool inf_set_cc_size_l (uchar _v)
 
uchar inf_get_cc_size_ll ()
 
bool inf_set_cc_size_ll (uchar _v)
 
uchar inf_get_cc_size_ldbl ()
 
bool inf_set_cc_size_ldbl (uchar _v)
 
bool inf_get_procname (char *buf, size_t bufsize=IDAINFO_PROCNAME_SIZE)
 
qstring inf_get_procname ()
 
bool inf_set_procname (const char *_v, size_t len=size_t(-1))
 
bool inf_get_strlit_pref (char *buf, size_t bufsize=IDAINFO_STRLIT_PREF_SIZE)
 
qstring inf_get_strlit_pref ()
 
bool inf_set_strlit_pref (const char *_v, size_t len=size_t(-1))
 
bool inf_get_cc (compiler_info_t *out)
 
bool inf_set_cc (const compiler_info_t &_v)
 
bool inf_get_privrange (range_t *out)
 
bool inf_set_privrange (const range_t &_v)
 
range_t inf_get_privrange ()
 
ushort inf_get_af_low ()
 Get/set low/high 16bit halves of inf.af.
 
void inf_set_af_low (ushort saf)
 
ushort inf_get_af_high ()
 
void inf_set_af_high (ushort saf2)
 
ushort inf_get_af2_low ()
 Get/set low 16bit half of inf.af2.
 
void inf_set_af2_low (ushort saf)
 
int inf_get_pack_mode ()
 
int inf_set_pack_mode (int pack_mode)
 
void inf_inc_database_change_count (int cnt=1)
 
uchar inf_get_demname_form (void)
 Get DEMNAM_MASK bits of #demnames.
 
uval_t inf_postinc_strlit_sernum (uval_t cnt=1)
 
bool inf_like_binary (void)
 
int calc_default_idaplace_flags (void)
 Get default disassembly line options.
 
ea_t idaapi to_ea (sel_t reg_cs, uval_t reg_ip)
 Convert (sel,off) value to a linear address.
 
idaman bool ida_export hook_to_notification_point (hook_type_t hook_type, hook_cb_t *cb, void *user_data=NULL)
 Register a callback for a class of events in IDA.
 
idaman int ida_export unhook_from_notification_point (hook_type_t hook_type, hook_cb_t *cb, void *user_data=NULL)
 Unregister a callback (also see hook_to_notification_point()). More...
 
idaman ssize_t ida_export invoke_callbacks (hook_type_t hook_type, int notification_code, va_list va)
 Generate event notification. More...
 
idaman bool ida_export register_post_event_visitor (hook_type_t hook_type, post_event_visitor_t *visitor, const plugmod_t *owner)
 Register the post-event visitor. More...
 
idaman bool ida_export unregister_post_event_visitor (hook_type_t hook_type, post_event_visitor_t *visitor)
 Unregister the post-event visitor. More...
 
idaman ssize_t ida_export get_dbctx_id ()
 Get the current database context ID. More...
 
idaman size_t ida_export get_dbctx_qty ()
 Get number of database contexts. More...
 
idaman struct dbctx_t *ida_export switch_dbctx (size_t idx)
 Switch to the database with the provided context ID. More...
 

Macros

#define EA64_ALIGN(n)
 
#define IDAINFO_TAG_SIZE   3
 The database parameters. More...
 
#define IDAINFO_PROCNAME_SIZE   16
 
#define IDAINFO_STRLIT_PREF_SIZE   16
 
#define INFFL_AUTO   0x01
 Autoanalysis is enabled?
 
#define INFFL_ALLASM   0x02
 may use constructs not supported by More...
 
#define INFFL_LOADIDC   0x04
 loading an idc file that contains database info
 
#define INFFL_NOUSER   0x08
 do not store user info in the database
 
#define INFFL_READONLY   0x10
 (internal) temporary interdiction to modify the database
 
#define INFFL_CHKOPS   0x20
 check manual operands? (unused)
 
#define INFFL_NMOPS   0x40
 allow non-matched operands? (unused)
 
#define INFFL_GRAPH_VIEW   0x80
 currently using graph options ( text_options_t::graph)
 
#define LFLG_PC_FPP   0x00000001
 decode floating point processor instructions?
 
#define LFLG_PC_FLAT   0x00000002
 32-bit program (or higher)?
 
#define LFLG_64BIT   0x00000004
 64-bit program?
 
#define LFLG_IS_DLL   0x00000008
 Is dynamic library?
 
#define LFLG_FLAT_OFF32   0x00000010
 treat REF_OFF32 as 32-bit offset for 16bit segments (otherwise try SEG16:OFF16)
 
#define LFLG_MSF   0x00000020
 Byte order: is MSB first?
 
#define LFLG_WIDE_HBF   0x00000040
 Bit order of wide bytes: high byte first? More...
 
#define LFLG_DBG_NOPATH   0x00000080
 do not store input full path in debugger process options
 
#define LFLG_SNAPSHOT   0x00000100
 memory snapshot was taken?
 
#define LFLG_PACK   0x00000200
 pack the database?
 
#define LFLG_COMPRESS   0x00000400
 compress the database?
 
#define LFLG_KERNMODE   0x00000800
 is kernel mode binary?
 
#define IDB_UNPACKED   0
 leave database components unpacked
 
#define IDB_PACKED   1
 pack database components into .idb
 
#define IDB_COMPRESSED   2
 compress & pack database components
 
#define AF_CODE   0x00000001
 Trace execution flow.
 
#define AF_MARKCODE   0x00000002
 Mark typical code sequences as code.
 
#define AF_JUMPTBL   0x00000004
 Locate and create jump tables.
 
#define AF_PURDAT   0x00000008
 Control flow to data segment is ignored.
 
#define AF_USED   0x00000010
 Analyze and create all xrefs.
 
#define AF_UNK   0x00000020
 Delete instructions with no xrefs.
 
#define AF_PROCPTR   0x00000040
 Create function if data xref data->code32 exists.
 
#define AF_PROC   0x00000080
 Create functions if call is present.
 
#define AF_FTAIL   0x00000100
 Create function tails.
 
#define AF_LVAR   0x00000200
 Create stack variables.
 
#define AF_STKARG   0x00000400
 Propagate stack argument information.
 
#define AF_REGARG   0x00000800
 Propagate register argument information.
 
#define AF_TRACE   0x00001000
 Trace stack pointer.
 
#define AF_VERSP   0x00002000
 Perform full SP-analysis. ( processor_t::verify_sp)
 
#define AF_ANORET   0x00004000
 Perform 'no-return' analysis.
 
#define AF_MEMFUNC   0x00008000
 Try to guess member function types.
 
#define AF_TRFUNC   0x00010000
 Truncate functions upon code deletion.
 
#define AF_STRLIT   0x00020000
 Create string literal if data xref exists.
 
#define AF_CHKUNI   0x00040000
 Check for unicode strings.
 
#define AF_FIXUP   0x00080000
 Create offsets and segments using fixup info.
 
#define AF_DREFOFF   0x00100000
 Create offset if data xref to seg32 exists.
 
#define AF_IMMOFF   0x00200000
 Convert 32bit instruction operand to offset.
 
#define AF_DATOFF   0x00400000
 Automatically convert data to offsets.
 
#define AF_FLIRT   0x00800000
 Use flirt signatures.
 
#define AF_SIGCMT   0x01000000
 Append a signature name comment for recognized anonymous library functions.
 
#define AF_SIGMLT   0x02000000
 Allow recognition of several copies of the same function.
 
#define AF_HFLIRT   0x04000000
 Automatically hide library functions.
 
#define AF_JFUNC   0x08000000
 Rename jump functions as j_...
 
#define AF_NULLSUB   0x10000000
 Rename empty functions as nullsub_...
 
#define AF_DODATA   0x20000000
 Coagulate data segs at the final pass.
 
#define AF_DOCODE   0x40000000
 Coagulate code segs at the final pass.
 
#define AF_FINAL   0x80000000
 Final pass of analysis.
 
#define AF2_DOEH   0x00000001
 Handle EH information.
 
#define AF2_DORTTI   0x00000002
 Handle RTTI information.
 
#define AF2_MACRO   0x00000004
 Try to combine several instructions. More...
 
#define SW_SEGXRF   0x01
 show segments in xrefs?
 
#define SW_XRFMRK   0x02
 show xref type marks?
 
#define SW_XRFFNC   0x04
 show function offsets?
 
#define SW_XRFVAL   0x08
 show xref values? (otherwise-"...")
 
#define NM_REL_OFF   0
 
#define NM_PTR_OFF   1
 
#define NM_NAM_OFF   2
 
#define NM_REL_EA   3
 
#define NM_PTR_EA   4
 
#define NM_NAM_EA   5
 
#define NM_EA   6
 
#define NM_EA4   7
 
#define NM_EA8   8
 
#define NM_SHORT   9
 
#define NM_SERIAL   10
 
#define DEMNAM_MASK   3
 mask for name form
 
#define DEMNAM_CMNT   0
 display demangled names as comments
 
#define DEMNAM_NAME   1
 display demangled names as regular names
 
#define DEMNAM_NONE   2
 don't display demangled names
 
#define DEMNAM_GCC3   4
 assume gcc3 names (valid for gnu compiler)
 
#define DEMNAM_FIRST   8
 override type info
 
#define LN_NORMAL   0x01
 include normal names
 
#define LN_PUBLIC   0x02
 include public names
 
#define LN_AUTO   0x04
 include autogenerated names
 
#define LN_WEAK   0x08
 include weak names
 
#define OFLG_SHOW_VOID   0x002
 Display void marks?
 
#define OFLG_SHOW_AUTO   0x004
 Display autoanalysis indicator?
 
#define OFLG_GEN_NULL   0x010
 Generate empty lines?
 
#define OFLG_SHOW_PREF   0x020
 Show line prefixes?
 
#define OFLG_PREF_SEG   0x040
 line prefixes with segment name?
 
#define OFLG_LZERO   0x080
 generate leading zeroes in numbers
 
#define OFLG_GEN_ORG   0x100
 Generate 'org' directives?
 
#define OFLG_GEN_ASSUME   0x200
 Generate 'assume' directives?
 
#define OFLG_GEN_TRYBLKS   0x400
 Generate try/catch directives?
 
#define SCF_RPTCMT   0x01
 show repeatable comments?
 
#define SCF_ALLCMT   0x02
 comment all lines?
 
#define SCF_NOCMT   0x04
 no comments at all
 
#define SCF_LINNUM   0x08
 show source line numbers
 
#define SCF_TESTMODE   0x10
 testida.idc is running
 
#define SCF_SHHID_ITEM   0x20
 show hidden instructions
 
#define SCF_SHHID_FUNC   0x40
 show hidden functions
 
#define SCF_SHHID_SEGM   0x80
 show hidden segments
 
#define LMT_THIN   0x01
 thin borders
 
#define LMT_THICK   0x02
 thick borders
 
#define LMT_EMPTY   0x04
 empty lines at the end of basic blocks
 
#define PREF_SEGADR   0x01
 show segment addresses?
 
#define PREF_FNCOFF   0x02
 show function offsets?
 
#define PREF_STACK   0x04
 show stack pointer?
 
#define PREF_PFXTRUNC   0x08
 truncate instruction bytes if they would need more than 1 line
 
#define STRF_GEN   0x01
 generate names?
 
#define STRF_AUTO   0x02
 names have 'autogenerated' bit?
 
#define STRF_SERIAL   0x04
 generate serial names?
 
#define STRF_UNICODE   0x08
 unicode strings are present?
 
#define STRF_COMMENT   0x10
 generate auto comment for string references?
 
#define STRF_SAVECASE   0x20
 preserve case of strings for identifiers
 
#define ABI_8ALIGN4   0x00000001
 4 byte alignment for 8byte scalars (__int64/double) inside structures?
 
#define ABI_PACK_STKARGS   0x00000002
 do not align stack arguments to stack slots
 
#define ABI_BIGARG_ALIGN   0x00000004
 use natural type alignment for argument if the alignment exceeds native word size More...
 
#define ABI_STACK_LDBL   0x00000008
 long double arguments are passed on stack
 
#define ABI_STACK_VARARGS   0x00000010
 varargs are always passed on stack (even when there are free registers)
 
#define ABI_HARD_FLOAT   0x00000020
 use the floating-point register set
 
#define ABI_SET_BY_USER   0x00000040
 compiler/abi were set by user flag and require SETCOMP_BY_USER flag to be changed
 
#define ABI_GCC_LAYOUT   0x00000080
 use gcc layout for udts (used for mingw)
 
#define ABI_MAP_STKARGS   0x00000100
 register arguments are mapped to stack area (and consume stack slots)
 
#define ABI_HUGEARG_ALIGN   0x00000200
 use natural type alignment for an argument More...
 
#define ABI_EXPLICIT_STKOFFS   0x00400
 stack locations of function arguments are More...
 
#define UA_MAXOP   8
 max number of operands allowed for an instruction
 
#define MAXADDR   0xFF000000L
 
#define IDB_EXT32   "idb"
 
#define IDB_EXT64   "i64"
 
#define IDB_EXT   IDB_EXT32
 

Typedefs

typedef uchar comp_t
 target compiler id
 
typedef uchar cm_t
 calling convention and memory model
 
typedef ssize_t idaapi hook_cb_t(void *user_data, int notification_code, va_list va)
 Callback provided to hook_to_notification_point(). More...
 

Enumerations

enum  filetype_t {
  f_EXE_old, f_COM_old, f_BIN, f_DRV,
  f_WIN, f_HEX, f_MEX, f_LX,
  f_LE, f_NLM, f_COFF, f_PE,
  f_OMF, f_SREC, f_ZIP, f_OMFLIB,
  f_AR, f_LOADER, f_ELF, f_W32RUN,
  f_AOUT, f_PRC, f_EXE, f_COM,
  f_AIXAR, f_MACHO, f_PSXOBJ
}
 Known input file formats (kept in idainfo::filetype): More...
 
enum  storage_type_t { STT_CUR = -1, STT_VA = 0, STT_MM = 1, STT_DBG = 2 }
 Storage types for flag bits. More...
 
enum  inftag_t {
  INF_VERSION = 0, INF_PROCNAME = 1, INF_GENFLAGS = 2, INF_LFLAGS = 3,
  INF_DATABASE_CHANGE_COUNT = 4, INF_FILETYPE = 5, INF_OSTYPE = 6, INF_APPTYPE = 7,
  INF_ASMTYPE = 8, INF_SPECSEGS = 9, INF_AF = 10, INF_AF2 = 11,
  INF_BASEADDR = 12, INF_START_SS = 13, INF_START_CS = 14, INF_START_IP = 15,
  INF_START_EA = 16, INF_START_SP = 17, INF_MAIN = 18, INF_MIN_EA = 19,
  INF_MAX_EA = 20, INF_OMIN_EA = 21, INF_OMAX_EA = 22, INF_LOWOFF = 23,
  INF_HIGHOFF = 24, INF_MAXREF = 25, INF_PRIVRANGE = 26, INF_PRIVRANGE_START_EA = 27,
  INF_PRIVRANGE_END_EA = 28, INF_NETDELTA = 29, INF_XREFNUM = 30, INF_TYPE_XREFNUM = 31,
  INF_REFCMTNUM = 32, INF_XREFFLAG = 33, INF_MAX_AUTONAME_LEN = 34, INF_NAMETYPE = 35,
  INF_SHORT_DEMNAMES = 36, INF_LONG_DEMNAMES = 37, INF_DEMNAMES = 38, INF_LISTNAMES = 39,
  INF_INDENT = 40, INF_COMMENT = 41, INF_MARGIN = 42, INF_LENXREF = 43,
  INF_OUTFLAGS = 44, INF_CMTFLG = 45, INF_LIMITER = 46, INF_BIN_PREFIX_SIZE = 47,
  INF_PREFFLAG = 48, INF_STRLIT_FLAGS = 49, INF_STRLIT_BREAK = 50, INF_STRLIT_ZEROES = 51,
  INF_STRTYPE = 52, INF_STRLIT_PREF = 53, INF_STRLIT_SERNUM = 54, INF_DATATYPES = 55,
  INF_CC = 56, INF_CC_ID = 57, INF_CC_CM = 58, INF_CC_SIZE_I = 59,
  INF_CC_SIZE_B = 60, INF_CC_SIZE_E = 61, INF_CC_DEFALIGN = 62, INF_CC_SIZE_S = 63,
  INF_CC_SIZE_L = 64, INF_CC_SIZE_LL = 65, INF_CC_SIZE_LDBL = 66, INF_ABIBITS = 67,
  INF_APPCALL_OPTIONS = 68, INF_FILE_FORMAT_NAME = 69, INF_GROUPS = 70, INF_H_PATH = 71,
  INF_C_MACROS = 72, INF_INCLUDE = 73, INF_DUALOP_GRAPH = 74, INF_DUALOP_TEXT = 75,
  INF_MD5 = 76, INF_IDA_VERSION = 77, INF_STR_ENCODINGS = 78, INF_DBG_BINPATHS = 79,
  INF_SHA256 = 80, INF_ABINAME = 81, INF_ARCHIVE_PATH = 82, INF_PROBLEMS = 83,
  INF_SELECTORS = 84, INF_NOTEPAD = 85, INF_SRCDBG_PATHS = 86, INF_SRCDBG_UNDESIRED = 87,
  INF_INITIAL_VERSION = 88, INF_CTIME = 89, INF_ELAPSED = 90, INF_NOPENS = 91,
  INF_CRC32 = 92, INF_IMAGEBASE = 93, INF_IDSNODE = 94, INF_FSIZE = 95,
  INF_OUTFILEENC = 96, INF_INPUT_FILE_PATH = 97, INF_LAST = 98
}
 
enum  hook_type_t {
  HT_IDP, HT_UI, HT_DBG, HT_IDB,
  HT_DEV, HT_VIEW, HT_OUTPUT, HT_GRAPH,
  HT_IDD, HT_LAST
}
 Types of events that be hooked to with hook_to_notification_point() More...
 

Macro Definition Documentation

◆ IDAINFO_TAG_SIZE

#define IDAINFO_TAG_SIZE   3

The database parameters.

This structure is kept in the ida database. It contains the essential parameters for the current program

Typedef Documentation

◆ hook_cb_t

typedef ssize_t idaapi hook_cb_t(void *user_data, int notification_code, va_list va)

Callback provided to hook_to_notification_point().

A plugin can hook to a notification point and receive notifications of all major events in IDA. The callback function will be called for each event.

Parameters
user_datadata supplied in call to hook_to_notification_point()
notification_codeprocessor_t::event_t or ui_notification_t or debugger_t::event_t, depending on the hook type
vaadditional parameters supplied with the notification. see the event descriptions for information
Return values
0ok, the event should be processed further
!=0the event is blocked and should be discarded. in the case of processor modules, the returned value is used as the return value of processor_t::notify()

Enumeration Type Documentation

◆ filetype_t

enum filetype_t

Known input file formats (kept in idainfo::filetype):

Enumerator
f_EXE_old 

MS DOS EXE File.

f_COM_old 

MS DOS COM File.

f_BIN 

Binary File.

f_DRV 

MS DOS Driver.

f_WIN 

New Executable (NE)

f_HEX 

Intel Hex Object File.

f_MEX 

MOS Technology Hex Object File.

f_LX 

Linear Executable (LX)

f_LE 

Linear Executable (LE)

f_NLM 

Netware Loadable Module (NLM)

f_COFF 

Common Object File Format (COFF)

f_PE 

Portable Executable (PE)

f_OMF 

Object Module Format.

f_SREC 

R-records.

f_ZIP 

ZIP file (this file is never loaded to IDA database)

f_OMFLIB 

Library of OMF Modules.

f_AR 

ar library

f_LOADER 

file is loaded using LOADER DLL

f_ELF 

Executable and Linkable Format (ELF)

f_W32RUN 

Watcom DOS32 Extender (W32RUN)

f_AOUT 

Linux a.out (AOUT)

f_PRC 

PalmPilot program file.

f_EXE 

MS DOS EXE File.

f_COM 

MS DOS COM File.

f_AIXAR 

AIX ar library.

f_MACHO 

Mac OS X.

f_PSXOBJ 

Sony Playstation PSX object file.

◆ storage_type_t

Storage types for flag bits.

Enumerator
STT_CUR 

use current storage type (may be used only as a function argument)

STT_VA 

regular storage: virtual arrays, an explicit flag for each byte

STT_MM 

memory map: sparse storage. useful for huge objects

STT_DBG 

memory map: temporary debugger storage. used internally

◆ inftag_t

enum inftag_t
Enumerator
INF_FILE_FORMAT_NAME 

file format name for loader modules

INF_GROUPS 

segment group information (see init_groups())

INF_H_PATH 

C header path.

INF_C_MACROS 

C predefined macros.

INF_INCLUDE 

assembler include file name

INF_DUALOP_GRAPH 

Graph text representation options.

INF_DUALOP_TEXT 

Text text representation options.

INF_MD5 

MD5 of the input file.

INF_IDA_VERSION 

version of ida which created the database

INF_STR_ENCODINGS 

a list of encodings for the program strings

INF_DBG_BINPATHS 

unused (20 indexes)

INF_SHA256 

SHA256 of the input file.

INF_ABINAME 

ABI name (processor specific)

INF_ARCHIVE_PATH 

archive file path

INF_PROBLEMS 

problem lists

INF_SELECTORS 

2..63 are for selector_t blob (see init_selectors())

INF_NOTEPAD 

notepad blob, occupies 1000 indexes (1MB of text)

INF_SRCDBG_PATHS 

source debug paths, occupies 20 indexes

INF_SRCDBG_UNDESIRED 

user-closed source files, occupies 20 indexes

INF_INITIAL_VERSION 

initial version of database

INF_CTIME 

database creation timestamp

INF_ELAPSED 

seconds database stayed open

INF_NOPENS 

how many times the database is opened

INF_CRC32 

input file crc32

INF_IMAGEBASE 

image base

INF_IDSNODE 

ids modnode id (for import_module)

INF_FSIZE 

input file size

INF_OUTFILEENC 

output file encoding index

◆ hook_type_t

Types of events that be hooked to with hook_to_notification_point()

Enumerator
HT_IDP 

Hook to the processor module.

The callback will receive all processor_t::event_t events.

HT_UI 

Hook to the user interface.

The callback will receive all ui_notification_t events.

HT_DBG 

Hook to the debugger.

The callback will receive all dbg_notification_t events.

HT_IDB 

Hook to the database events.

These events are separated from the HT_IDP group to speed things up (there are too many plugins and modules hooking to the HT_IDP). Some essential events are still generated in th HT_IDP group: make_code, make_data This list is not exhaustive. A common trait of all events in this group: the kernel does not expect any reaction to the event and does not check the return code. For event names, see idb_event.

HT_DEV 

Internal debugger events.

Not stable and undocumented for the moment

HT_VIEW 

Custom/IDA views notifications.

Refer to view_notification_t for notification codes

HT_OUTPUT 

Output window notifications.

Refer to msg_notification_t (view_notification_t)

HT_GRAPH 

Handling graph operations (graph_notification_t)

HT_IDD 

Hook to the debugger plugin.

The callback will receive all debugger_t::event_t events.

Function Documentation

◆ getinf()

idaman size_t ida_export getinf ( inftag_t  tag)

get program specific information (a scalar value)

Parameters
tagone of inftag_t constants
Returns
the requested info. if wrong tag is specified, return 0

◆ getinf_buf()

idaman ssize_t ida_export getinf_buf ( inftag_t  tag,
void *  buf,
size_t  bufsize 
)

get program specific information (a non-scalar value)

Parameters
tagone of inftag_t constants
bufoutput buffer
bufsizesize of the output buffer
Returns
number of bytes stored in the buffer (<0 - not defined)

◆ getinf_str()

idaman ssize_t ida_export getinf_str ( qstring buf,
inftag_t  tag 
)

get program specific information (a non-scalar value)

Parameters
tagone of inftag_t constants
bufoutput buffer
Returns
number of bytes stored in the buffer (<0 - not defined)

◆ getinf_flag()

idaman bool ida_export getinf_flag ( inftag_t  tag,
uint32  flag 
)

get a flag value

Parameters
tagone of inftag_t constants
flaga flag in the field
Returns
whether the flag is set

◆ setinf()

idaman bool ida_export setinf ( inftag_t  tag,
ssize_t  value 
)

set program specific information

Parameters
tagone of inftag_t constants
Returns
success

◆ setinf_buf()

idaman bool ida_export setinf_buf ( inftag_t  tag,
const void *  buf,
size_t  bufsize = 0 
)

set program specific information

Parameters
tagone of inftag_t constants
bufptr to new value
bufsizesize of the new value, calculated as strlen(buf)+1 if not specified
Returns
success

◆ setinf_flag()

idaman bool ida_export setinf_flag ( inftag_t  tag,
uint32  flag,
bool  value = true 
)

set a flag value

Parameters
tagone of inftag_t constants
flaga flag in the field
valuewhether to set, or clear the flag
Returns
the previous value

◆ delinf()

idaman bool ida_export delinf ( inftag_t  tag)

undefine a program specific information

Parameters
tagone of inftag_t constants
Returns
success

◆ unhook_from_notification_point()

idaman int ida_export unhook_from_notification_point ( hook_type_t  hook_type,
hook_cb_t cb,
void *  user_data = NULL 
)

Unregister a callback (also see hook_to_notification_point()).

A plugin should unhook before being unloaded (preferably in its termination function). If different callbacks have the same callback function pointer and user_data is not NULL, only the callback whose associated user defined data matches will be removed.

Returns
number of unhooked functions.

◆ invoke_callbacks()

idaman ssize_t ida_export invoke_callbacks ( hook_type_t  hook_type,
int  notification_code,
va_list  va 
)

Generate event notification.

Parameters
hook_typehook type
notification_codeevent code
vaadditional arguments
Returns
!=0: event processed

◆ register_post_event_visitor()

idaman bool ida_export register_post_event_visitor ( hook_type_t  hook_type,
post_event_visitor_t visitor,
const plugmod_t owner 
)

Register the post-event visitor.

The kernel will not take ownership, nor delete the VISITOR instance. Therefore, it's up to the plugin to handle it. In addition, the post_event_visitor_t will be automatically unregistered when the owner plugin is unloaded from memory.

Parameters
hook_typehook type
visitorpost-event visitor
ownerthe owner plugin of the post_event_visitor_t type
Returns
success

◆ unregister_post_event_visitor()

idaman bool ida_export unregister_post_event_visitor ( hook_type_t  hook_type,
post_event_visitor_t visitor 
)

Unregister the post-event visitor.

Parameters
hook_typehook type
visitorpost-event visitor
Returns
success

◆ get_dbctx_id()

idaman ssize_t ida_export get_dbctx_id ( )

Get the current database context ID.

Returns
the database context ID, or -1 if no current database

◆ get_dbctx_qty()

idaman size_t ida_export get_dbctx_qty ( )

Get number of database contexts.

Returns
number of database contexts

◆ switch_dbctx()

idaman struct dbctx_t* ida_export switch_dbctx ( size_t  idx)

Switch to the database with the provided context ID.

Parameters
idxthe index of the database to switch to
Returns
the current dbctx_t instance or nullptr