45#define IDPOPT_OK nullptr
46#define IDPOPT_BADKEY ((char*)1)
47#define IDPOPT_BADTYPE ((char*)2)
48#define IDPOPT_BADVALUE ((char*)3)
76#define IDPOPT_PRI_DEFAULT 1
77#define IDPOPT_PRI_HIGH 2
131#define IDPOPT_NUM_INT (0)
132#define IDPOPT_NUM_CHAR (1 << 24)
133#define IDPOPT_NUM_SHORT (2 << 24)
134#define IDPOPT_NUM_RANGE (1 << 26)
135#define IDPOPT_NUM_UNS (1 << 27)
137#define IDPOPT_BIT_UINT 0
138#define IDPOPT_BIT_UCHAR (1 << 24)
139#define IDPOPT_BIT_USHORT (2 << 24)
140#define IDPOPT_BIT_BOOL (3 << 24)
142#define IDPOPT_STR_QSTRING (1 << 24)
143#define IDPOPT_STR_LONG (1 << 25)
145#define IDPOPT_I64_RANGE (1 << 24)
146#define IDPOPT_I64_UNS (1 << 25)
148#define IDPOPT_CST_PARAMS (1 << 24)
150#define IDPOPT_MBROFF (1 << 18)
227 constexpr cfgopt_t(
const char *_n,
char *_p,
size_t _sz,
bool _long =
true)
231 :
name(_n),
ptr(_p),
flags(IDPOPT_STR | IDPOPT_STR_QSTRING | (_long ? IDPOPT_STR_LONG : 0)),
buf_size(0)
248 constexpr cfgopt_t(
const char *_n,
int *_p,
int _min,
int _max)
252 constexpr cfgopt_t(
const char *_n,
char *_p,
char _min,
char _max)
253 :
name(_n),
ptr(_p),
flags(IDPOPT_NUM | IDPOPT_NUM_CHAR | IDPOPT_NUM_RANGE),
num_range(_min, _max) {}
255 :
name(_n),
ptr(_p),
flags(IDPOPT_NUM | IDPOPT_NUM_UNS | IDPOPT_NUM_CHAR | IDPOPT_NUM_RANGE),
num_range(_min, _max) {}
256 constexpr cfgopt_t(
const char *_n,
short *_p,
short _min,
short _max)
257 :
name(_n),
ptr(_p),
flags(IDPOPT_NUM | IDPOPT_NUM_RANGE | IDPOPT_NUM_SHORT),
num_range(_min, _max) {}
259 :
name(_n),
ptr(_p),
flags(IDPOPT_NUM | IDPOPT_NUM_UNS | IDPOPT_NUM_RANGE | IDPOPT_NUM_SHORT),
num_range(_min, _max) {}
294 flags(IDPOPT_MBROFF | IDPOPT_STR | IDPOPT_STR_QSTRING | (_long ? IDPOPT_STR_LONG : 0)),
297#define CFGOPT_QS(nm, cfgt, cfgm, _long) \
298 cfgopt_t(nm, &cfgt::cfgm, qoffsetof(cfgt, cfgm), _long)
300#define CFGOPT_INNER_QS(nm, cfgt, cfgm, mt, mf, _long) \
301 cfgopt_t(nm, &mt::mf, qoffsetof(cfgt, cfgm) + qoffsetof(mt, mf), _long)
305 constexpr cfgopt_t(
const char *_n,
char * T:: *,
size_t _mbroff,
bool _long =
true)
308 flags(IDPOPT_MBROFF | IDPOPT_STR | (_long ? IDPOPT_STR_LONG : 0)),
314#define CTR_CFGOPT(ctrtype, ctrflags) \
316 constexpr cfgopt_t(const char *_n, ctrtype T:: *, size_t _mbroff) \
319 flags(IDPOPT_MBROFF|IDPOPT_NUM|ctrflags), \
330#define CFGOPT_N(nm, cfgt, cfgm) \
331 cfgopt_t(nm, &cfgt::cfgm, qoffsetof(cfgt, cfgm))
333#define CFGOPT_INNER_N(nm, cfgt, cfgm, mt, mf) \
334 cfgopt_t(nm, &mt::mf, qoffsetof(cfgt, cfgm) + qoffsetof(mt, mf))
338#define CTR_CFGOPT(ctrtype, ctrflags) \
340 constexpr cfgopt_t(const char *_n, ctrtype T:: *, size_t _mbroff, int64 _min, int64 _max) \
343 flags(IDPOPT_MBROFF|IDPOPT_NUM|IDPOPT_NUM_RANGE|ctrflags), \
344 num_range(_min, _max) \
354#define CFGOPT_R(nm, cfgt, cfgm, min, max) \
355 cfgopt_t(nm, &cfgt::cfgm, qoffsetof(cfgt, cfgm), min, max)
357#define CFGOPT_INNER_R(nm, cfgt, cfgm, mt, mf, min, max) \
358 cfgopt_t(nm, &mt::mf, qoffsetof(cfgt, cfgm) + qoffsetof(mt, mf), min, max)
362#define CTR_CFGOPT(ctrtype, ctrflags) \
364 constexpr cfgopt_t(const char *_n, ctrtype T:: *, size_t _mbroff, ctrtype _flags) \
367 flags(IDPOPT_MBROFF|IDPOPT_BIT|ctrflags), \
375#define CFGOPT_B(nm, cfgt, cfgm, _flags) \
376 cfgopt_t(nm, &cfgt::cfgm, qoffsetof(cfgt, cfgm), _flags)
378#define CFGOPT_INNER_B(nm, cfgt, cfgm, mt, mf, _flags) \
379 cfgopt_t(nm, &mt::mf, qoffsetof(cfgt, cfgm) + qoffsetof(mt, mf), _flags)
387 flags(IDPOPT_MBROFF|IDPOPT_I64),
394 flags(IDPOPT_MBROFF|IDPOPT_I64|IDPOPT_NUM_UNS),
400 constexpr cfgopt_t(
const char *_n, jvalue_t T:: *,
size_t _mbroff)
403 flags(IDPOPT_MBROFF | IDPOPT_JVL),
407#define CFGOPT_J(nm, cfgt, cfgm) \
408 cfgopt_t(nm, &cfgt::cfgm, qoffsetof(cfgt, cfgm))
415 flags(IDPOPT_MBROFF|IDPOPT_I64|IDPOPT_I64_RANGE),
422 flags(IDPOPT_MBROFF|IDPOPT_I64|IDPOPT_I64_UNS|IDPOPT_I64_RANGE),
438 int usign_bit)
const;
439 const char *
apply(
int vtype,
const void *vdata,
void *obj=
nullptr)
const
443 const char *
apply(lexer_t *lx,
int vtype,
const void *vdata,
void *obj=
nullptr)
const
482 const char *
const *defines =
nullptr,
483 size_t ndefines = 0);
491 const char *
const *defines =
nullptr,
493 void *obj =
nullptr);
496 const char *filename,
500 const char *
const *defines =
nullptr,
516 const char *filename,
520 const char *
const *defines =
nullptr,
534 const char *
const *defines =
nullptr,
Class to hold idc values.
Definition expr.hpp:315
idc_object_t * obj
Definition expr.hpp:341
qvector(void)
Definition pro.h:2328
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)
idaman const char *ida_export cfgopt_t__apply(const cfgopt_t *_this, int vtype, const void *vdata)
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)
Definition config.hpp:495
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.
Definition config.hpp:529
idaman const char *ida_export cfgopt_t__apply2(const cfgopt_t *_this, int vtype, const void *vdata, void *obj)
cfg_input_kind_t
Definition config.hpp:450
@ cik_string
Definition config.hpp:451
@ cik_filename
Definition config.hpp:452
@ cik_path
Definition config.hpp:453
const char *idaapi cfgopt_handler2_t(lexer_t *lx, const token_t &keyword, const token_t &value, int64 param1, int64 param2)
Definition config.hpp:113
const char *idaapi cfgopt_handler3_t(lexer_t *lx, const token_t &keyword, const token_t &value, int64 param1, int64 param2, void *obj)
Definition config.hpp:121
idaman const char *ida_export cfgopt_t__apply3(const cfgopt_t *_this, lexer_t *lx, int vtype, const void *vdata, void *obj)
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.
Definition config.hpp:515
DECLARE_TYPE_AS_MOVABLE(cfgopt_set_t)
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 parse_config_value(idc_value_t *out, lexer_t *lx, const token_t &value)
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.
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.
Definition config.hpp:61
const char *idaapi cfgopt_handler_t(lexer_t *lx, const token_t &keyword, const token_t &value)
Definition config.hpp:107
void idaapi config_changed_cb_t(const cfgopt_t &opt, int vtype, const void *vdata)
Definition config.hpp:541
idaman bool ida_export get_config_value(jvalue_t *out, const char *key)
Get json value from ida.cfg.
unsigned __int64 uint64
Definition llong.hpp:13
__int64 int64
Definition llong.hpp:14
unsigned int uint32
unsigned 32 bit value
Definition pro.h:348
unsigned char uchar
unsigned 8 bit value
Definition pro.h:337
unsigned int uint
unsigned 32 bit value
Definition pro.h:339
unsigned short ushort
unsigned 16 bit value
Definition pro.h:338
_qstring< char > qstring
regular string
Definition pro.h:3694
Definition config.hpp:569
void * obj
Definition config.hpp:573
config_changed_cb_t * cb
Definition config.hpp:572
const cfgopt_t * opts
Definition config.hpp:570
size_t nopts
Definition config.hpp:571
Definition config.hpp:576
Definition config.hpp:206
int64 maxval
Definition config.hpp:209
constexpr num_range_t(int64 _min, int64 _max)
Definition config.hpp:207
int64 minval
Definition config.hpp:208
Definition config.hpp:212
int64 p1
Definition config.hpp:214
constexpr params_t(int64 _p1, int64 _p2)
Definition config.hpp:213
int64 p2
Definition config.hpp:215
Definition config.hpp:194
constexpr cfgopt_t(const char *_n, jvalue_t T::*, size_t _mbroff)
Definition config.hpp:400
constexpr cfgopt_t(const char *_n, qstring T::*, size_t _mbroff, bool _long=true)
Definition config.hpp:291
constexpr cfgopt_t(const char *_n, int *_p, int _min, int _max)
Definition config.hpp:248
constexpr cfgopt_t(const char *_n, uint *_p)
Definition config.hpp:237
bool is_mbroff() const
Definition config.hpp:432
size_t mbroff
Definition config.hpp:199
constexpr cfgopt_t(const char *_n, uint *_p, uint _min, uint _max)
Definition config.hpp:250
constexpr cfgopt_t(const char *_n, int64 *_p)
Definition config.hpp:268
constexpr cfgopt_t(const char *_n, int64 *_p, int64 _min, int64 _max)
Definition config.hpp:271
constexpr cfgopt_t(const char *_n, bool *_p, bool _flags)
Definition config.hpp:262
constexpr cfgopt_t(const char *_n, ushort *_p, ushort _min, ushort _max)
Definition config.hpp:258
constexpr cfgopt_t(const char *_n, jvalue_t *_p)
Definition config.hpp:284
constexpr cfgopt_t(const char *_n, short *_p)
Definition config.hpp:243
size_t buf_size
Definition config.hpp:219
CTR_CFGOPT(uchar, IDPOPT_BIT_UCHAR)
int type() const
Definition config.hpp:430
constexpr cfgopt_t(const char *_n, char *_p, char _min, char _max)
Definition config.hpp:252
bool get_number(int64 *out, lexer_t *lx, const token_t &_t, int range_bit, int usign_bit) const
cfgopt_handler2_t * hnd2
Definition config.hpp:201
constexpr cfgopt_t(const char *_n, qstring *_p, bool _long=true)
Definition config.hpp:230
constexpr cfgopt_t(const char *_n, int64 T::*, size_t _mbroff)
Definition config.hpp:384
const char * name
Definition config.hpp:195
constexpr cfgopt_t(const char *_n, uint64 *_p, uint64 _min, uint64 _max)
Definition config.hpp:273
constexpr cfgopt_t(const char *_n, uint64 T::*, size_t _mbroff)
Definition config.hpp:391
cfgopt_handler_t * hnd
Definition config.hpp:200
constexpr cfgopt_t(const char *_n, uchar *_p)
Definition config.hpp:241
constexpr cfgopt_t(const char *_n, cfgopt_handler3_t *_p, int64 _p1=0, int64 _p2=0)
Definition config.hpp:427
constexpr cfgopt_t(const char *_n, uint32 *_p, uint32 _flags)
Definition config.hpp:265
constexpr cfgopt_t(const char *_n, uchar *_p, uchar _min, uchar _max)
Definition config.hpp:254
params_t params
Definition config.hpp:222
constexpr cfgopt_t(const char *_n, char *_p)
Definition config.hpp:239
uint32 bit_flags
Definition config.hpp:221
CTR_CFGOPT(ushort, IDPOPT_BIT_USHORT)
constexpr cfgopt_t(const char *_n, uint64 *_p)
Definition config.hpp:269
constexpr cfgopt_t(const char *_n, short *_p, short _min, short _max)
Definition config.hpp:256
constexpr cfgopt_t(const char *_n, cfgopt_handler2_t *_p, int64 _p1=0, int64 _p2=0)
Definition config.hpp:280
cfgopt_handler3_t * hnd3
Definition config.hpp:202
constexpr cfgopt_t(const char *_n, uint64 T::*, size_t _mbroff, uint64 _min, uint64 _max)
Definition config.hpp:419
constexpr cfgopt_t(const char *_n, cfgopt_handler_t *_p)
Definition config.hpp:277
const char * apply(int vtype, const void *vdata, void *obj=nullptr) const
Definition config.hpp:439
int flags
Definition config.hpp:204
constexpr cfgopt_t(const char *_n, int64 T::*, size_t _mbroff, int64 _min, int64 _max)
Definition config.hpp:412
constexpr cfgopt_t(const char *_n, ushort *_p)
Definition config.hpp:245
constexpr cfgopt_t(const char *_n, ushort *_p, ushort _flags)
Definition config.hpp:264
void * ptr
Definition config.hpp:198
constexpr cfgopt_t(const char *_n, uchar *_p, uchar _flags)
Definition config.hpp:263
CTR_CFGOPT(bool, IDPOPT_BIT_BOOL)
CTR_CFGOPT(int, 0) CTR_CFGOPT(uint
const char * apply(lexer_t *lx, int vtype, const void *vdata, void *obj=nullptr) const
Definition config.hpp:443
constexpr cfgopt_t(const char *_n, int *_p)
Definition config.hpp:235
void * mbroff_obj
Definition config.hpp:223
constexpr cfgopt_t(const char *_n, char *_p, size_t _sz, bool _long=true)
Definition config.hpp:227
int qualifier() const
Definition config.hpp:431
constexpr cfgopt_t(const char *_n, char *T::*, size_t _mbroff, bool _long=true)
Definition config.hpp:305
num_range_t num_range
Definition config.hpp:220
Parser token.
Definition lex.hpp:48