IDA C++ SDK 9.2
Loading...
Searching...
No Matches
idcfuncs_t Struct Reference

Describes an array of IDC functions. More...

#include <expr.hpp>

Public Attributes

size_t qnty
 Number of functions.
ext_idcfunc_tfuncs
 Function table.
Indexes

Indexes into the 'f' array.

non-positive values mean that the function does not exist

int get_unkvar
 Retrieve value of an undeclared variable.
int set_unkvar
 Store a value to an undeclared variable.
int exec_resolved_func
 Execute resolved function.
int calc_sizeof
 Calculate sizeof(type).
int get_field_ea
 Get address of the specified field using the type information from the idb.

IDC Engine

IDC engine requires the following functions (all of them may be nullptr)

size_t bufsize
size_t ea_t ea
 error_t (idaapi *startup)(void)
 Start IDC engine. Called before executing any IDC code.
 error_t (idaapi *shutdown)(void)
 Stop IDC engine.
 void (idaapi *init_idc)(void)
 Initialize IDC engine.
 void (idaapi *term_idc)(void)
 Terminate IDC engine. Called once at the very end of work.
 bool (idaapi *is_database_open)(void)
 Is the database open?
 size_t (idaapi *ea2str)(char *buf
 Convert an address to a string.
 bool (idaapi *undeclared_variable_ok)(const char *name)
 Should a variable name be accepted without declaration?

Detailed Description

Describes an array of IDC functions.

Member Function Documentation

◆ error_t() [1/2]

idcfuncs_t::error_t ( idaapi * startup)

Start IDC engine. Called before executing any IDC code.

◆ error_t() [2/2]

idcfuncs_t::error_t ( idaapi * shutdown)

Stop IDC engine.

Called when all IDC engines finish. In other words, nested IDC engines do not call startup/shutdown.

◆ void() [1/2]

idcfuncs_t::void ( idaapi * init_idc)

Initialize IDC engine.

Called once at the very beginning of work. This callback may create additional IDC classes, methods, etc.

◆ void() [2/2]

idcfuncs_t::void ( idaapi * term_idc)

Terminate IDC engine. Called once at the very end of work.

◆ bool() [1/2]

idcfuncs_t::bool ( idaapi * is_database_open)

Is the database open?

(used for #EXTFUN_BASE functions). if this pointer is nullptr, #EXTFUN_BASE is not checked.

◆ size_t()

idcfuncs_t::size_t ( idaapi * ea2str)

Convert an address to a string.

if this pointer is nullptr, 'a' will be used.

◆ bool() [2/2]

idcfuncs_t::bool ( idaapi * undeclared_variable_ok) const

Should a variable name be accepted without declaration?

When the parser encounters an unrecognized variable, this callback is called. If it returns false, the parser generates the 'undefined variable' error else the parser generates code to call to a set or get function, depending on the current context. If this pointer is nullptr, undeclared variables won't be supported. However, if 'resolver' object is provided to the parser, it will be used to resolve such names to constants at the compilation time. This callback is used by IDA to handle processor register names.

Member Data Documentation

◆ qnty

size_t idcfuncs_t::qnty

Number of functions.

◆ funcs

ext_idcfunc_t* idcfuncs_t::funcs

Function table.

◆ bufsize

size_t idcfuncs_t::bufsize

◆ ea

size_t ea_t idcfuncs_t::ea

◆ get_unkvar

int idcfuncs_t::get_unkvar

Retrieve value of an undeclared variable.

Expected prototype: get(#VT_STR varname)

◆ set_unkvar

int idcfuncs_t::set_unkvar

Store a value to an undeclared variable.

Expected prototype: set(#VT_WILD new_value, #VT_STR varname)

◆ exec_resolved_func

int idcfuncs_t::exec_resolved_func

Execute resolved function.

If 'resolver' was used to resolve an unknown name to a constant in a function call context, such a call will be redirected here. Expected prototype: exec_resolved_func(#VT_LONG func, #VT_WILD typeinfo, ...) This callback is used in IDA for Appcall.

◆ calc_sizeof

int idcfuncs_t::calc_sizeof

Calculate sizeof(type).

This function is used by the interpreter to calculate sizeof() expressions. Please note that the 'type' argument is an IDC object of typeinfo class. Expected prototype: calc_sizeof(#VT_OBJ typeinfo) This callback requires support of the type system (available only in IDA kernel) It should not be used by standalone IDC interpreters.

◆ get_field_ea

int idcfuncs_t::get_field_ea

Get address of the specified field using the type information from the idb.

This function is used to resolve expressions like 'mystr.field' where mystr does not represent an IDC object but just a plain number. The number is interpreted as an address in the current idb. This function retrieves type information at this address and tried to find the specified 'field'. It returns the address of the 'field' in the idb. This callback should not be used by standalone IDC interpreters.


The documentation for this struct was generated from the following file: