IDA C++ SDK 9.2
Loading...
Searching...
No Matches
config.hpp File Reference

Go to the source code of this file.

Classes

struct  cfgopt_t
struct  cfgopt_t::num_range_t
struct  cfgopt_t::params_t
struct  cfgopt_set_t
struct  cfgopt_set_vec_t

Typedefs

typedef const char *idaapi set_options_t(const char *keyword, int value_type, const void *value, bool idb_loaded)
 Callback - called when a config directive is processed in IDA.
typedef const char *idaapi cfgopt_handler_t(lexer_t *lx, const token_t &keyword, const token_t &value)
typedef const char *idaapi cfgopt_handler2_t(lexer_t *lx, const token_t &keyword, const token_t &value, int64 param1, int64 param2)
typedef const char *idaapi cfgopt_handler3_t(lexer_t *lx, const token_t &keyword, const token_t &value, int64 param1, int64 param2, void *obj)
typedef void idaapi config_changed_cb_t(const cfgopt_t &opt, int vtype, const void *vdata)

Enumerations

enum  cfg_input_kind_t { cik_string = 0 , cik_filename , cik_path }

Functions

idaman bool ida_export parse_config_value (idc_value_t *out, lexer_t *lx, const token_t &value)
idaman const char *ida_export cfgopt_t__apply (const cfgopt_t *_this, int vtype, const void *vdata)
idaman const char *ida_export cfgopt_t__apply2 (const cfgopt_t *_this, int vtype, const void *vdata, void *obj)
idaman const char *ida_export cfgopt_t__apply3 (const cfgopt_t *_this, lexer_t *lx, int vtype, const void *vdata, void *obj)
idaman bool ida_export read_config (const char *input, cfg_input_kind_t input_kind, const cfgopt_t opts[], size_t nopts, cfgopt_handler_t *defhdlr, const char *const *defines=nullptr, size_t ndefines=0)
 Parse the input, and apply options.
idaman bool ida_export read_config2 (const char *input, cfg_input_kind_t input_kind, const cfgopt_t opts[], size_t nopts, cfgopt_handler_t *defhdlr, const char *const *defines=nullptr, size_t ndefines=0, void *obj=nullptr)
bool read_config_file2 (const char *filename, const cfgopt_t opts[], size_t nopts, cfgopt_handler_t *defhdlr, const char *const *defines=nullptr, size_t ndefines=0, void *obj=nullptr)
bool read_config_file (const char *filename, const cfgopt_t opts[], size_t nopts, cfgopt_handler_t *defhdlr, const char *const *defines=nullptr, size_t ndefines=0)
 Search for all IDA system files with the given name.
bool read_config_string (const char *string, const cfgopt_t opts[], size_t nopts, cfgopt_handler_t *defhdlr, const char *const *defines=nullptr, size_t ndefines=0)
 For each directive in 'string', the same processing as that of read_config will be performed.
idaman bool ida_export register_cfgopts (const cfgopt_t opts[], size_t nopts, config_changed_cb_t cb=nullptr, void *obj=nullptr)
 Register array of config options.
idaman bool ida_export get_config_value (jvalue_t *out, const char *key)
 Get json value from ida.cfg.
 DECLARE_TYPE_AS_MOVABLE (cfgopt_set_t)

Typedef Documentation

◆ set_options_t

typedef const char *idaapi set_options_t(const char *keyword, int value_type, const void *value, bool idb_loaded)

Callback - called when a config directive is processed in IDA.

Also see read_config_file() and processor_t::set_idp_options

Parameters
keywordkeyword encountered in IDA.CFG/user config file. if nullptr, then an interactive dialog form should be displayed
value_typetype of value of the keyword - one of Option value types
valuepointer to value
idb_loadedtrue if the ev_oldfile/ev_newfile events have been generated?
Returns
one of Option result codes, otherwise a pointer to an error message

◆ cfgopt_handler_t

typedef const char *idaapi cfgopt_handler_t(lexer_t *lx, const token_t &keyword, const token_t &value)

◆ cfgopt_handler2_t

typedef const char *idaapi cfgopt_handler2_t(lexer_t *lx, const token_t &keyword, const token_t &value, int64 param1, int64 param2)

◆ cfgopt_handler3_t

typedef const char *idaapi cfgopt_handler3_t(lexer_t *lx, const token_t &keyword, const token_t &value, int64 param1, int64 param2, void *obj)

◆ config_changed_cb_t

typedef void idaapi config_changed_cb_t(const cfgopt_t &opt, int vtype, const void *vdata)

Enumeration Type Documentation

◆ cfg_input_kind_t

Enumerator
cik_string 
cik_filename 
cik_path 

Function Documentation

◆ parse_config_value()

idaman bool ida_export parse_config_value ( idc_value_t * out,
lexer_t * lx,
const token_t & value )

◆ cfgopt_t__apply()

idaman const char *ida_export cfgopt_t__apply ( const cfgopt_t * _this,
int vtype,
const void * vdata )

◆ cfgopt_t__apply2()

idaman const char *ida_export cfgopt_t__apply2 ( const cfgopt_t * _this,
int vtype,
const void * vdata,
void * obj )

◆ cfgopt_t__apply3()

idaman const char *ida_export cfgopt_t__apply3 ( const cfgopt_t * _this,
lexer_t * lx,
int vtype,
const void * vdata,
void * obj )

◆ read_config()

idaman bool ida_export read_config ( const char * input,
cfg_input_kind_t input_kind,
const cfgopt_t opts[],
size_t nopts,
cfgopt_handler_t * defhdlr,
const char *const * defines = nullptr,
size_t ndefines = 0 )

Parse the input, and apply options.

Parameters
inputinput file name, or string
input_kindis input a string, filename or file path
optsoptions destcriptions
noptsthe number of entries present in the 'opts' array
defhdlra handler to be called, if a directive couldn't be found in 'opts'
definesa list of preprocessor identifiers to define (so it is possible to use #ifdef checks in the file.) NB: the actual identifier defined by the parser will be surrounded with double underscores (e.g., passing 'FOO' will result in 'FOO' being defined) Additionally, the parser will also define a similar macro with the current processor name (e.g., ARM)
ndefinesthe number of defines in the list
objsee cfgopt_t constructor based on the offset of a structure member
Returns
true if parsing finished without errors, false if there was a syntax error, callback returned an error, or no file was found at all.

◆ read_config2()

idaman bool ida_export read_config2 ( const char * input,
cfg_input_kind_t input_kind,
const cfgopt_t opts[],
size_t nopts,
cfgopt_handler_t * defhdlr,
const char *const * defines = nullptr,
size_t ndefines = 0,
void * obj = nullptr )

◆ read_config_file2()

bool read_config_file2 ( const char * filename,
const cfgopt_t opts[],
size_t nopts,
cfgopt_handler_t * defhdlr,
const char *const * defines = nullptr,
size_t ndefines = 0,
void * obj = nullptr )
inline

◆ read_config_file()

bool read_config_file ( const char * filename,
const cfgopt_t opts[],
size_t nopts,
cfgopt_handler_t * defhdlr,
const char *const * defines = nullptr,
size_t ndefines = 0 )
inline

Search for all IDA system files with the given name.

This function will search, in that order, for the following files:

  1. IDADIR%/cfg/<file>
  2. for each directory 'ONEDIR' in IDAUSR%: ONEDIR%/cfg/<file>

For each directive in each of those files, the same processing as that of read_config will be performed.

◆ read_config_string()

bool read_config_string ( const char * string,
const cfgopt_t opts[],
size_t nopts,
cfgopt_handler_t * defhdlr,
const char *const * defines = nullptr,
size_t ndefines = 0 )
inline

For each directive in 'string', the same processing as that of read_config will be performed.

◆ register_cfgopts()

idaman bool ida_export register_cfgopts ( const cfgopt_t opts[],
size_t nopts,
config_changed_cb_t cb = nullptr,
void * obj = nullptr )

Register array of config options.

This function can be used by a plugin to register the config options. After registering an option, it becomes usable by the process_config_directive() function.

Parameters
optsarray of config options
noptsnumber of options to install. 0 means uninstall
cbcallback that will be invoked upon changing a config option
objsee cfgopt_t constructor based on the offset of a structure member
Returns
success

◆ get_config_value()

idaman bool ida_export get_config_value ( jvalue_t * out,
const char * key )

Get json value from ida.cfg.

Parameters
outreturned json value
keyconfiguration key
Returns
success

◆ DECLARE_TYPE_AS_MOVABLE()

DECLARE_TYPE_AS_MOVABLE ( cfgopt_set_t )