IDA C++ SDK 9.2
Loading...
Searching...
No Matches
nalt.hpp
Go to the documentation of this file.
1/*
2 * Interactive disassembler (IDA).
3 * Copyright (c) 1990-2026 Hex-Rays
4 * ALL RIGHTS RESERVED.
5 *
6 */
7
8#ifndef NALT_HPP
9#define NALT_HPP
10
11#include <ida.hpp>
12#include <netnode.hpp>
13
35
42#define NALT_ENUM uval_t(-2)
43#define NALT_WIDE uval_t(-1)
44#define NALT_SWITCH 1
45//#define NALT_OBASE1 2 // offset base 2
46#define NALT_STRUCT 3
47//#define NALT_SEENF 4 // 'seen' flag (used in structures)
48//#define NALT_OOBASE0 5 // outer offset base 1
49//#define NALT_OOBASE1 6 // outer offset base 2
50//#define NALT_XREFPOS 7 // saved xref address in the xrefs window
51#define NALT_AFLAGS 8
52#define NALT_LINNUM 9
53#define NALT_ABSBASE 10
54#define NALT_ENUM0 11
55#define NALT_ENUM1 12
56//#define NALT_STROFF0 13 // struct offset, struct id for the first operand
57//#define NALT_STROFF1 14 // struct offset, struct id for the second operand
58#define NALT_PURGE 15
59#define NALT_STRTYPE 16
60#define NALT_ALIGN 17
62//#define NALT_HIGH0 18 // linear address of byte referenced by
63// // high 16 bits of an offset (FF_0HIGH)
64//#define NALT_HIGH1 19 // linear address of byte referenced by
65// // high 16 bits of an offset (FF_1HIGH)
66#define NALT_COLOR 20
68
75#define NSUP_CMT 0
76#define NSUP_REPCMT 1
77#define NSUP_FOP1 2
78#define NSUP_FOP2 3
79#define NSUP_JINFO 4
80#define NSUP_ARRAY 5
81#define NSUP_OMFGRP 6
82#define NSUP_FOP3 7
83#define NSUP_SWITCH 8
84#define NSUP_REF0 9
85#define NSUP_REF1 10
86#define NSUP_REF2 11
87#define NSUP_OREF0 12
88#define NSUP_OREF1 13
89#define NSUP_OREF2 14
90#define NSUP_STROFF0 15
91#define NSUP_STROFF1 16
92#define NSUP_SEGTRANS 17
93#define NSUP_FOP4 18
94#define NSUP_FOP5 19
95#define NSUP_FOP6 20
96#define NSUP_REF3 21
97#define NSUP_REF4 22
98#define NSUP_REF5 23
99#define NSUP_OREF3 24
100#define NSUP_OREF4 25
101#define NSUP_OREF5 26
102#define NSUP_XREFPOS 27
103#define NSUP_CUSTDT 28
104#define NSUP_GROUPS 29
105#define NSUP_ARGEAS 30
106#define NSUP_FOP7 31
107#define NSUP_FOP8 32
108#define NSUP_REF6 33
109#define NSUP_REF7 34
110#define NSUP_OREF6 35
111#define NSUP_OREF7 36
112#define NSUP_EX_FLAGS 37
113
114// values E_PREV..E_NEXT+1000 are reserved (1000..2000..3000 decimal)
115
118#define NSUP_POINTS 0x1000
119
122#define NSUP_MANUAL 0x2000
123
126#define NSUP_TYPEINFO 0x3000
127
130#define NSUP_REGVAR 0x4000
131
134#define NSUP_LLABEL 0x5000
135
138#define NSUP_REGARG 0x6000
139
142#define NSUP_FTAILS 0x7000
143
146#define NSUP_GROUP 0x8000
147
150#define NSUP_OPTYPES 0x9000
151
154#define NSUP_ORIGFMD 0x109000
155
158#define NSUP_FRAME 0x10A000
159
161
165#define NALT_CREF_TO 'X'
166#define NALT_CREF_FROM 'x'
167#define NALT_DREF_TO 'D'
168#define NALT_DREF_FROM 'd'
170
174#define NSUP_GR_INFO 'g'
175#define NALT_GR_LAYX 'p'
176#define NSUP_GR_LAYT 'l'
178
180#define PATCH_TAG 'P'
181
184#define IDB_DESKTOPS_NODE_NAME "$ desktops"
186#define IDB_DESKTOPS_TAG 'S'
187#define IDB_DESKTOPS_TIMESTAMP nodeidx_t(-1)
190
191
193
194idaman nodeidx_t ida_export ea2node(ea_t ea);
195idaman ea_t ida_export node2ea(nodeidx_t ndx);
196idaman nodeidx_t ida_export end_ea2node(ea_t ea);
197inline netnode getnode(ea_t ea) { return netnode(ea2node(ea)); }
198
199//--------------------------------------------------------------------------
200// C O N V E N I E N C E F U N C T I O N S
201//--------------------------------------------------------------------------
202
207
208idaman tid_t ida_export get_strid(ea_t ea);
209
211
217{
219 uchar type; // the xref type (::cref_t or ::dref_t)
220 xrefpos_t(ea_t ea_ = BADADDR, uchar type_ = 0) : ea(ea_), type(type_) {}
221 bool is_valid() const { return ea != BADADDR; }
222};
223
224idaman ssize_t ida_export get_xrefpos(xrefpos_t *out, ea_t ea);
225idaman void ida_export set_xrefpos(ea_t ea, const xrefpos_t *in);
226inline void idaapi del_xrefpos(ea_t ea) { getnode(ea).supdel(NSUP_XREFPOS); }
227
229
236#define AFL_LINNUM 0x00000001
237#define AFL_USERSP 0x00000002
238#define AFL_PUBNAM 0x00000004
239#define AFL_WEAKNAM 0x00000008
240#define AFL_HIDDEN 0x00000010
241#define AFL_MANUAL 0x00000020
242#define AFL_NOBRD 0x00000040
243#define AFL_ZSTROFF 0x00000080
248#define AFL_BNOT0 0x00000100
249#define AFL_BNOT1 0x00000200
250#define AFL_LIB 0x00000400
253#define AFL_TI 0x00000800
254#define AFL_TI0 0x00001000
255#define AFL_TI1 0x00002000
256#define AFL_LNAME 0x00004000
257#define AFL_TILCMT 0x00008000
258#define AFL_LZERO0 0x00010000
259#define AFL_LZERO1 0x00020000
260#define AFL_COLORED 0x00040000
261#define AFL_TERSESTR 0x00080000
262#define AFL_SIGN0 0x00100000
263#define AFL_SIGN1 0x00200000
264#define AFL_NORET 0x00400000
267#define AFL_FIXEDSPD 0x00800000
269#define AFL_ALIGNFLOW 0x01000000
270#define AFL_USERTI 0x02000000
273#define AFL_RETFP 0x04000000
274#define AFL_USEMODSP 0x08000000
276#define AFL_NOTCODE 0x10000000
277#define AFL_NOTPROC 0x20000000
278#define AFL_TYPE_GUESSED 0xC2000000
279#define AFL_IDA_GUESSED 0x00000000
280#define AFL_HR_GUESSED_FUNC 0x40000000
281#define AFL_HR_GUESSED_DATA 0x80000000
282#define AFL_HR_DETERMINED 0xC0000000
284
289
290idaman void ida_export set_aflags(ea_t ea, aflags_t flags);
291idaman void ida_export upd_abits(ea_t ea, aflags_t clr_bits, aflags_t set_bits);
292idaman void ida_export set_abits(ea_t ea, aflags_t bits);
293idaman void ida_export clr_abits(ea_t ea, aflags_t bits);
294idaman aflags_t ida_export get_aflags(ea_t ea);
295idaman void ida_export del_aflags(ea_t ea);
296
297inline constexpr bool has_aflag_linnum(aflags_t flags) { return (flags & AFL_LINNUM) != 0; }
298inline constexpr bool is_aflag_usersp(aflags_t flags) { return (flags & AFL_USERSP) != 0; }
299inline constexpr bool is_aflag_public_name(aflags_t flags) { return (flags & AFL_PUBNAM) != 0; }
300inline constexpr bool is_aflag_weak_name(aflags_t flags) { return (flags & AFL_WEAKNAM) != 0; }
301inline constexpr bool is_aflag_hidden_item(aflags_t flags) { return (flags & AFL_HIDDEN) != 0; }
302inline constexpr bool is_aflag_manual_insn(aflags_t flags) { return (flags & AFL_MANUAL) != 0; }
303inline constexpr bool is_aflag_hidden_border(aflags_t flags) { return (flags & AFL_NOBRD) != 0; }
304inline constexpr bool is_aflag_zstroff(aflags_t flags) { return (flags & AFL_ZSTROFF) != 0; }
305inline constexpr bool is_aflag__bnot0(aflags_t flags) { return (flags & AFL_BNOT0) != 0; }
306inline constexpr bool is_aflag__bnot1(aflags_t flags) { return (flags & AFL_BNOT1) != 0; }
307inline constexpr bool is_aflag_libitem(aflags_t flags) { return (flags & AFL_LIB) != 0; }
308inline constexpr bool has_aflag_ti(aflags_t flags) { return (flags & AFL_TI) != 0; }
309inline constexpr bool has_aflag_ti0(aflags_t flags) { return (flags & AFL_TI0) != 0; }
310inline constexpr bool has_aflag_ti1(aflags_t flags) { return (flags & AFL_TI1) != 0; }
311inline constexpr bool has_aflag_lname(aflags_t flags) { return (flags & AFL_LNAME) != 0; }
312inline constexpr bool is_aflag_tilcmt(aflags_t flags) { return (flags & AFL_TILCMT) != 0; }
313inline constexpr bool is_aflag_lzero0(aflags_t flags) { return (flags & AFL_LZERO0) != 0; }
314inline constexpr bool is_aflag_lzero1(aflags_t flags) { return (flags & AFL_LZERO1) != 0; }
315inline constexpr bool is_aflag_colored_item(aflags_t flags) { return (flags & AFL_COLORED) != 0; }
316inline constexpr bool is_aflag_terse_struc(aflags_t flags) { return (flags & AFL_TERSESTR) != 0; }
317inline constexpr bool is_aflag__invsign0(aflags_t flags) { return (flags & AFL_SIGN0) != 0; }
318inline constexpr bool is_aflag__invsign1(aflags_t flags) { return (flags & AFL_SIGN1) != 0; }
319inline constexpr bool is_aflag_noret(aflags_t flags) { return (flags & AFL_NORET) != 0; }
320inline constexpr bool is_aflag_fixed_spd(aflags_t flags) { return (flags & AFL_FIXEDSPD) != 0; }
321inline constexpr bool is_aflag_align_flow(aflags_t flags) { return (flags & AFL_ALIGNFLOW)!= 0; }
322inline constexpr bool is_aflag_userti(aflags_t flags) { return (flags & AFL_USERTI) != 0; }
323inline constexpr bool is_aflag_retfp(aflags_t flags) { return (flags & AFL_RETFP) != 0; }
324inline constexpr bool uses_aflag_modsp(aflags_t flags) { return (flags & AFL_USEMODSP) != 0; }
325inline constexpr bool is_aflag_notcode(aflags_t flags) { return (flags & AFL_NOTCODE) != 0; }
326inline constexpr bool is_aflag_notproc(aflags_t flags) { return (flags & AFL_NOTPROC) != 0; }
327inline constexpr bool is_aflag_type_guessed_by_ida(aflags_t flags) { return (flags & AFL_TYPE_GUESSED) == AFL_IDA_GUESSED; }
328inline constexpr bool is_aflag_func_guessed_by_hexrays(aflags_t flags) { return (flags & AFL_TYPE_GUESSED) == AFL_HR_GUESSED_FUNC; }
329inline constexpr bool is_aflag_data_guessed_by_hexrays(aflags_t flags) { return (flags & AFL_TYPE_GUESSED) == AFL_HR_GUESSED_DATA; }
330inline constexpr bool is_aflag_type_determined_by_hexrays(aflags_t flags) { return (flags & AFL_TYPE_GUESSED) == AFL_HR_DETERMINED; }
331inline constexpr bool is_aflag_type_guessed_by_hexrays(aflags_t flags)
332{
333 return (flags & AFL_TYPE_GUESSED) == AFL_HR_GUESSED_FUNC
334 || (flags & AFL_TYPE_GUESSED) == AFL_HR_GUESSED_DATA
335 || (flags & AFL_TYPE_GUESSED) == AFL_HR_DETERMINED;
336}
337
338inline bool is_hidden_item(ea_t ea) { return is_aflag_hidden_item(get_aflags(ea)); }
339inline void hide_item(ea_t ea) { set_abits(ea, AFL_HIDDEN); }
340inline void unhide_item(ea_t ea) { clr_abits(ea, AFL_HIDDEN); }
341
343inline void hide_border(ea_t ea) { set_abits(ea, AFL_NOBRD); }
344inline void unhide_border(ea_t ea) { clr_abits(ea, AFL_NOBRD); }
345
346inline bool uses_modsp(ea_t ea) { return uses_aflag_modsp(get_aflags(ea)); }
347inline void set_usemodsp(ea_t ea) { set_abits(ea, AFL_USEMODSP); }
348inline void clr_usemodsp(ea_t ea) { clr_abits(ea, AFL_USEMODSP); }
349
350inline bool is_zstroff(ea_t ea) { return is_aflag_zstroff(get_aflags(ea)); }
351inline void set_zstroff(ea_t ea) { set_abits(ea, AFL_ZSTROFF); }
352inline void clr_zstroff(ea_t ea) { clr_abits(ea, AFL_ZSTROFF); }
353
354inline bool is__bnot0(ea_t ea) { return is_aflag__bnot0(get_aflags(ea)); }
355inline void set__bnot0(ea_t ea) { set_abits(ea, AFL_BNOT0); }
356inline void clr__bnot0(ea_t ea) { clr_abits(ea, AFL_BNOT0); }
357
358inline bool is__bnot1(ea_t ea) { return is_aflag__bnot1(get_aflags(ea)); }
359inline void set__bnot1(ea_t ea) { set_abits(ea, AFL_BNOT1); }
360inline void clr__bnot1(ea_t ea) { clr_abits(ea, AFL_BNOT1); }
361
362inline bool is_libitem(ea_t ea) { return is_aflag_libitem(get_aflags(ea)); }
363inline void set_libitem(ea_t ea) { set_abits(ea, AFL_LIB); }
364inline void clr_libitem(ea_t ea) { clr_abits(ea, AFL_LIB); }
365
366inline bool has_ti(ea_t ea) { return has_aflag_ti(get_aflags(ea)); }
367inline void set_has_ti(ea_t ea) { set_abits(ea, AFL_TI); }
368inline void clr_has_ti(ea_t ea) { clr_abits(ea, AFL_TI); }
369
370inline bool has_ti0(ea_t ea) { return has_aflag_ti0(get_aflags(ea)); }
371inline void set_has_ti0(ea_t ea) { set_abits(ea, AFL_TI0); }
372inline void clr_has_ti0(ea_t ea) { clr_abits(ea, AFL_TI0); }
373
374inline bool has_ti1(ea_t ea) { return has_aflag_ti1(get_aflags(ea)); }
375inline void set_has_ti1(ea_t ea) { set_abits(ea, AFL_TI1); }
376inline void clr_has_ti1(ea_t ea) { clr_abits(ea, AFL_TI1); }
377
378inline bool has_lname(ea_t ea) { return has_aflag_lname(get_aflags(ea)); }
379inline void set_has_lname(ea_t ea) { set_abits(ea, AFL_LNAME); }
380inline void clr_has_lname(ea_t ea) { clr_abits(ea, AFL_LNAME); }
381
382inline bool is_tilcmt(ea_t ea) { return is_aflag_tilcmt(get_aflags(ea)); }
383inline void set_tilcmt(ea_t ea) { set_abits(ea, AFL_TILCMT); }
384inline void clr_tilcmt(ea_t ea) { clr_abits(ea, AFL_TILCMT); }
385
386inline bool is_usersp(ea_t ea) { return is_aflag_usersp(get_aflags(ea)); }
387inline void set_usersp(ea_t ea) { set_abits(ea, AFL_USERSP); }
388inline void clr_usersp(ea_t ea) { clr_abits(ea, AFL_USERSP); }
389
390inline bool is_lzero0(ea_t ea) { return is_aflag_lzero0(get_aflags(ea)); }
391inline void set_lzero0(ea_t ea) { set_abits(ea, AFL_LZERO0); }
392inline void clr_lzero0(ea_t ea) { clr_abits(ea, AFL_LZERO0); }
393
394inline bool is_lzero1(ea_t ea) { return is_aflag_lzero1(get_aflags(ea)); }
395inline void set_lzero1(ea_t ea) { set_abits(ea, AFL_LZERO1); }
396inline void clr_lzero1(ea_t ea) { clr_abits(ea, AFL_LZERO1); }
397
398inline bool is_colored_item(ea_t ea) { return is_aflag_colored_item(get_aflags(ea)); }
399inline void set_colored_item(ea_t ea) { set_abits(ea, AFL_COLORED); } // use set_item_color()
400inline void clr_colored_item(ea_t ea) { clr_abits(ea, AFL_COLORED); } // use del_item_color()
401
402inline bool is_terse_struc(ea_t ea) { return is_aflag_terse_struc(get_aflags(ea)); }
403inline void set_terse_struc(ea_t ea) { set_abits(ea, AFL_TERSESTR); }
404inline void clr_terse_struc(ea_t ea) { clr_abits(ea, AFL_TERSESTR); }
405
406inline bool is__invsign0(ea_t ea) { return is_aflag__invsign0(get_aflags(ea)); }
407inline void set__invsign0(ea_t ea) { set_abits(ea, AFL_SIGN0); }
408inline void clr__invsign0(ea_t ea) { clr_abits(ea, AFL_SIGN0); }
409
410inline bool is__invsign1(ea_t ea) { return is_aflag__invsign1(get_aflags(ea)); }
411inline void set__invsign1(ea_t ea) { set_abits(ea, AFL_SIGN1); }
412inline void clr__invsign1(ea_t ea) { clr_abits(ea, AFL_SIGN1); }
413
414inline bool is_noret(ea_t ea) { return is_aflag_noret(get_aflags(ea)); }
415inline void set_noret(ea_t ea) { set_abits(ea, AFL_NORET); }
416inline void clr_noret(ea_t ea) { clr_abits(ea, AFL_NORET); }
417
418inline bool is_fixed_spd(ea_t ea) { return is_aflag_fixed_spd(get_aflags(ea)); }
419inline void set_fixed_spd(ea_t ea) { set_abits(ea, AFL_FIXEDSPD); }
420inline void clr_fixed_spd(ea_t ea) { clr_abits(ea, AFL_FIXEDSPD); }
421
422inline bool is_align_flow(ea_t ea) { return is_aflag_align_flow(get_aflags(ea)); }
423inline void set_align_flow(ea_t ea) { set_abits(ea, AFL_ALIGNFLOW); }
424inline void clr_align_flow(ea_t ea) { clr_abits(ea, AFL_ALIGNFLOW); }
425
426inline bool is_userti(ea_t ea) { return is_aflag_userti(get_aflags(ea)); }
427inline void set_userti(ea_t ea) { upd_abits(ea, AFL_TYPE_GUESSED, AFL_USERTI); }
428inline void clr_userti(ea_t ea) { clr_abits(ea, AFL_TYPE_GUESSED); } // use set_ida_guessed_type()
429
430inline bool is_retfp(ea_t ea) { return is_aflag_retfp(get_aflags(ea)); }
431inline void set_retfp(ea_t ea) { set_abits(ea, AFL_RETFP); }
432inline void clr_retfp(ea_t ea) { clr_abits(ea, AFL_RETFP); }
433
434inline bool is_notproc(ea_t ea) { return is_aflag_notproc(get_aflags(ea)); }
435inline void set_notproc(ea_t ea) { set_abits(ea, AFL_NOTPROC); }
436inline void clr_notproc(ea_t ea) { clr_abits(ea, AFL_NOTPROC); }
437
443
444inline void set_type_guessed_by_ida(ea_t ea) { upd_abits(ea, AFL_TYPE_GUESSED, AFL_IDA_GUESSED); }
445inline void set_func_guessed_by_hexrays(ea_t ea) { upd_abits(ea, AFL_TYPE_GUESSED, AFL_HR_GUESSED_FUNC); }
446inline void set_data_guessed_by_hexrays(ea_t ea) { upd_abits(ea, AFL_TYPE_GUESSED, AFL_HR_GUESSED_DATA); }
447inline void set_type_determined_by_hexrays(ea_t ea) { upd_abits(ea, AFL_TYPE_GUESSED, AFL_HR_DETERMINED); }
449
451idaman void ida_export set_notcode(ea_t ea);
452
454inline void clr_notcode(ea_t ea) { clr_abits(ea, AFL_NOTCODE); }
455
457inline bool is_notcode(ea_t ea) { return is_aflag_notcode(get_aflags(ea)); }
458
459
461
462inline void set_visible_item(ea_t ea, bool visible)
463{
464 if ( visible )
465 unhide_item(ea);
466 else
467 hide_item(ea);
468}
469
471
472inline bool is_visible_item(ea_t ea) { return !is_hidden_item(ea); }
473
474
476
478{
479 return (inf_get_cmtflg() & SCF_SHHID_ITEM) != 0 || is_visible_item(ea);
480}
481
482
486idaman void ida_export set_source_linnum(ea_t ea, uval_t lnnum);
487idaman uval_t ida_export get_source_linnum(ea_t ea);
488idaman void ida_export del_source_linnum(ea_t ea);
490
495{
496 ea_t x;
497 return getnode(ea).supval(NALT_ABSBASE, &x, sizeof(x), atag) > 0 ? ea_t(x-1) : ea_t(-1);
498}
499inline void set_absbase(ea_t ea, ea_t x)
500{
501 x++;
502 getnode(ea).supset(NALT_ABSBASE, &x, sizeof(x), atag);
503}
504inline void del_absbase(ea_t ea) { getnode(ea).supdel(NALT_ABSBASE, atag); }
506
512idaman ea_t ida_export get_ind_purged(ea_t ea);
513inline void set_ind_purged(ea_t ea, ea_t x)
514{
515 x++;
516 getnode(ea).supset(NALT_PURGE, &x, sizeof(x), atag);
517}
518inline void del_ind_purged(ea_t ea) { getnode(ea).supdel(NALT_PURGE, atag); }
520
524idaman uint32 ida_export get_str_type(ea_t ea);
525idaman void ida_export set_str_type(ea_t ea, uint32 x);
526idaman void ida_export del_str_type(ea_t ea);
528
529// Number of bytes per "units" in a string. E.g., ASCII, Windows-1252,
530// UTF-8 all take up one byte per unit, while UTF-16 variations take 2 and
531// UTF-32 variations take 4.
532// (Note that an "unit" in this context is not necessarily a character,
533// since UTF-8-encoded characters can be encoded in up to 4 bytes,
534// and UTF-16-encoded characters can be encoded in up to 2 bytes.)
535#define STRWIDTH_1B 0
536#define STRWIDTH_2B 1
537#define STRWIDTH_4B 2
538#define STRWIDTH_MASK 0x03
539
540// The string layout; how the string is laid out in data.
541#define STRLYT_TERMCHR 0
542#define STRLYT_PASCAL1 1
543#define STRLYT_PASCAL2 2
544#define STRLYT_PASCAL4 3
545#define STRLYT_DECOMP 4
546#define STRLYT_MASK 0xFC
547#define STRLYT_SHIFT 2
548
549
552#define STRTYPE_TERMCHR (STRWIDTH_1B|STRLYT_TERMCHR<<STRLYT_SHIFT)
554#define STRTYPE_C STRTYPE_TERMCHR
556#define STRTYPE_C_16 (STRWIDTH_2B|STRLYT_TERMCHR<<STRLYT_SHIFT)
558#define STRTYPE_C_32 (STRWIDTH_4B|STRLYT_TERMCHR<<STRLYT_SHIFT)
560#define STRTYPE_PASCAL (STRWIDTH_1B|STRLYT_PASCAL1<<STRLYT_SHIFT)
562#define STRTYPE_PASCAL_16 (STRWIDTH_2B|STRLYT_PASCAL1<<STRLYT_SHIFT)
564#define STRTYPE_PASCAL_32 (STRWIDTH_4B|STRLYT_PASCAL1<<STRLYT_SHIFT)
566#define STRTYPE_LEN2 (STRWIDTH_1B|STRLYT_PASCAL2<<STRLYT_SHIFT)
568#define STRTYPE_LEN2_16 (STRWIDTH_2B|STRLYT_PASCAL2<<STRLYT_SHIFT)
570#define STRTYPE_LEN2_32 (STRWIDTH_4B|STRLYT_PASCAL2<<STRLYT_SHIFT)
572#define STRTYPE_LEN4 (STRWIDTH_1B|STRLYT_PASCAL4<<STRLYT_SHIFT)
574#define STRTYPE_LEN4_16 (STRWIDTH_2B|STRLYT_PASCAL4<<STRLYT_SHIFT)
576#define STRTYPE_LEN4_32 (STRWIDTH_4B|STRLYT_PASCAL4<<STRLYT_SHIFT)
578#define STRTYPE_DECOMP (STRWIDTH_1B|STRLYT_DECOMP<<STRLYT_SHIFT)
580
584inline THREAD_SAFE uchar idaapi get_str_type_code(int32 strtype) { return uchar(strtype); }
585inline THREAD_SAFE char get_str_term1(int32 strtype) { return char(strtype>>8); }
586inline THREAD_SAFE char get_str_term2(int32 strtype) { return char(strtype>>16); }
587 // if the second termination character is
588 // '\0', then it doesn't exist.
590inline THREAD_SAFE uchar idaapi get_str_encoding_idx(int32 strtype) { return uchar(strtype>>24); }
592inline THREAD_SAFE int32 set_str_encoding_idx(int32 strtype, int encoding_idx)
593{
594 return (strtype & 0xFFFFFF) | ((uchar)encoding_idx << 24);
595}
596
597inline THREAD_SAFE int32 make_str_type(
598 uchar type_code,
599 int encoding_idx,
600 uchar term1 = 0,
601 uchar term2 = 0)
602{
603 return type_code
604 | (term1 << 8)
605 | (term2 << 16)
606 | ((uchar)encoding_idx << 24);
607}
608
609
610inline THREAD_SAFE bool is_pascal(int32 strtype)
611{
612 int lyt = get_str_type_code(strtype) >> STRLYT_SHIFT;
613 return lyt >= STRLYT_PASCAL1 && lyt <= STRLYT_PASCAL4;
614}
615
616inline THREAD_SAFE size_t get_str_type_prefix_length(int32 strtype)
617{
618 switch ( get_str_type_code(strtype) )
619 {
620 case STRTYPE_LEN4_32:
621 case STRTYPE_LEN4_16:
622 case STRTYPE_LEN4:
623 return 4;
624 case STRTYPE_LEN2_32:
625 case STRTYPE_LEN2_16:
626 case STRTYPE_LEN2:
627 return 2;
628 case STRTYPE_PASCAL_32:
629 case STRTYPE_PASCAL_16:
630 case STRTYPE_PASCAL:
631 return 1;
632 }
633 return 0;
634}
635
636
637#define STRENC_DEFAULT 0x00
638#define STRENC_NONE 0xFF
639
645{
646 uint32 x;
647 return getnode(ea).supval(NALT_ALIGN, &x, sizeof(x), atag) > 0 ? uint32(x-1) : uint32(-1);
648}
649inline void set_alignment(ea_t ea, uint32 x)
650{
651 x++;
652 getnode(ea).supset(NALT_ALIGN, &x, sizeof(x), atag);
653}
654inline void del_alignment(ea_t ea) { getnode(ea).supdel(NALT_ALIGN, atag); }
656
657
660idaman void ida_export set_item_color(ea_t ea, bgcolor_t color);
661idaman bgcolor_t ida_export get_item_color(ea_t ea); // returns DEFCOLOR if no color
662idaman bool ida_export del_item_color(ea_t ea);
664
665
666//-------------------------------------------------------------------------
671{
673#define AP_ALLOWDUPS 0x00000001
674#define AP_SIGNED 0x00000002
675#define AP_INDEX 0x00000004
676#define AP_ARRAY 0x00000008
677#define AP_IDXBASEMASK 0x000000F0
678#define AP_IDXDEC 0x00000000
679#define AP_IDXHEX 0x00000010
680#define AP_IDXOCT 0x00000020
681#define AP_IDXBIN 0x00000030
682
687
688 array_parameters_t(int32 _f=AP_ALLOWDUPS, int32 _l=0, int32 _a=-1) : flags(_f), lineitems(_l), alignment(_a) {}
689 bool is_default() const { return flags == AP_ALLOWDUPS && lineitems == 0 && alignment == -1; }
690};
692idaman void ida_export set_array_parameters(ea_t ea, const array_parameters_t *in);
693inline void idaapi del_array_parameters(ea_t ea) { getnode(ea).supdel(NSUP_ARRAY); }
695
696//--------------------------------------------------------------------------
699{
704#define SWI_SPARSE 0x00000001
706#define SWI_V32 0x00000002
707#define SWI_J32 0x00000004
708#define SWI_VSPLIT 0x00000008
709#define SWI_USER 0x00000010
710#define SWI_DEF_IN_TBL 0x00000020
719#define SWI_JMP_INV 0x00000040
721#define SWI_SHIFT_MASK 0x00000180
722#define SWI_ELBASE 0x00000200
724#define SWI_JSIZE 0x00000400
725#define SWI_VSIZE 0x00000800
726#define SWI_SEPARATE 0x00001000
727#define SWI_SIGNED 0x00002000
728#define SWI_CUSTOM 0x00004000
732//#define SWI_EXTENDED 0x00008000 ///< reserved
733#define SWI_INDIRECT 0x00010000
735#define SWI_SUBTRACT 0x00020000
736#define SWI_HXNOLOWCASE 0x00040000
737#define SWI_STDTBL 0x00080000
740#define SWI_DEFRET 0x00100000
741#define SWI_SELFREL 0x00200000
742#define SWI_JMPINSN 0x00400000
747#define SWI_VERSION 0x00800000
749
752 int get_shift(void) const { return ((flags & SWI_SHIFT_MASK) >> 7); }
753
755 void set_shift(int shift)
756 {
757 flags &= ~SWI_SHIFT_MASK;
758 flags |= ((shift & 3) << 7);
759 }
760
762 { // this brain damaged logic is needed for compatibility with old versions
763 int code = flags & (SWI_J32|SWI_JSIZE);
764 if ( code == 0 )
765 return 2;
766 if ( code == SWI_J32 )
767 return 4;
768 if ( code == SWI_JSIZE )
769 return 1;
770 return 8;
771 }
773 {
774 flags &= ~(SWI_J32|SWI_JSIZE);
775 switch ( size )
776 {
777 case 4:
778 flags |= SWI_J32;
779 break;
780 case 1:
781 flags |= SWI_JSIZE;
782 break;
783 case 8:
784 flags |= SWI_J32|SWI_JSIZE;
785 break;
786 case 2:
787 break;
788 default:
789 INTERR(1297);
790 }
791 }
793 {
794 int code = flags & (SWI_V32|SWI_VSIZE);
795 if ( code == 0 )
796 return 2;
797 if ( code == SWI_V32 )
798 return 4;
799 if ( code == SWI_VSIZE )
800 return 1;
801 return 8;
802 }
804 {
805 flags &= ~(SWI_V32|SWI_VSIZE);
806 switch ( size )
807 {
808 case 4:
809 flags |= SWI_V32;
810 break;
811 case 1:
812 flags |= SWI_VSIZE;
813 break;
814 case 8:
815 flags |= SWI_V32|SWI_VSIZE;
816 break;
817 case 2:
818 break;
819 default:
820 INTERR(1298);
821 }
822 }
823
824 bool has_default(void) const { return defjump != BADADDR; }
825 bool has_elbase(void) const { return (flags & SWI_ELBASE) != 0; }
826 bool is_sparse(void) const { return (flags & SWI_SPARSE) != 0; }
827 bool is_custom(void) const { return (flags & SWI_CUSTOM) != 0; }
828 bool is_indirect(void) const { return (flags & SWI_INDIRECT) != 0; }
829 bool is_subtract(void) const { return (flags & SWI_SUBTRACT) != 0; }
830 bool is_nolowcase(void) const { return (flags & SWI_HXNOLOWCASE) != 0; }
831 bool use_std_table(void) const { return !is_custom() || (flags & SWI_STDTBL) != 0; }
832 bool is_user_defined() const
833 {
834 return get_version() >= 2 && (flags & SWI_USER) != 0;
835 }
836
838 ea_t jumps = BADADDR;
839 union
840 {
843 };
844 ea_t defjump = BADADDR;
845 ea_t startea = BADADDR;
846 int jcases = 0;
847
849 sval_t get_lowcase(void) const { return is_indirect() ? ind_lowcase : lowcase; }
851
852 int regnum = -1;
855
856 int get_jtable_size(void) const { return is_indirect() ? jcases : ncases; }
858 {
859 if ( is_indirect() )
860 jcases = size;
861 else
862 ncases = uint16(size);
863 }
864 void set_elbase(ea_t base)
865 {
866 elbase = base;
867 flags |= SWI_ELBASE;
868 }
869
870 void set_expr(int r, op_dtype_t dt) { regnum = r; regdtype = dt; }
871
873 bool get_jrange_vrange(range_t *jrange = nullptr, range_t *vrange = nullptr) const
874 {
875 if ( !use_std_table() )
876 return false;
877 if ( jrange != nullptr )
878 {
879 int n = get_jtable_size();
880 if ( (flags & SWI_DEF_IN_TBL) != 0 )
881 ++n;
882 int jsize = get_jtable_element_size();
883 *jrange = range_t(jumps, jumps + jsize * n);
884 }
885 if ( vrange != nullptr && is_sparse() )
886 {
887 int vsize = get_vtable_element_size();
888 *vrange = range_t(values, values + vsize * ncases);
889 }
890 return true;
891 }
892
894
897 int get_version() const { return (flags & SWI_VERSION) == 0 ? 1 : version; }
898
899 // version 2
900 ea_t expr_ea = BADADDR;
904
905 switch_info_t() : flags(SWI_VERSION), lowcase(0) {}
906 void clear() { *this = switch_info_t(); }
907};
908
912idaman ssize_t ida_export get_switch_info(switch_info_t *out, ea_t ea);
913idaman void ida_export set_switch_info(ea_t ea, const switch_info_t &in);
914idaman void ida_export del_switch_info(ea_t ea);
916
921{
922 ea_t x;
923 return getnode(ea).supval(NALT_SWITCH, &x, sizeof(x), atag) > 0 ? ea_t(x-1) : ea_t(-1);
924}
925inline void set_switch_parent(ea_t ea, ea_t x)
926{
927 x++;
928 getnode(ea).supset(NALT_SWITCH, &x, sizeof(x), atag);
929}
930inline void del_switch_parent(ea_t ea) { getnode(ea).supdel(NALT_SWITCH, atag); }
932
937{
939 int16 fids[UA_MAXOP];
940
941 void set(tid_t tid)
942 {
943 memset(fids, -1, sizeof(fids));
944 dtid = uint16(tid);
945 fids[0] = uint16(tid >> 16);
946 }
948 {
949 return uint16(dtid) | (uint16(-1) << 16);
950 }
951#ifndef SWIG
953#endif
954};
955idaman int ida_export get_custom_data_type_ids(custom_data_type_ids_t *cdis, ea_t ea);
956idaman void ida_export set_custom_data_type_ids(ea_t ea, const custom_data_type_ids_t *cdis);
957inline void idaapi del_custom_data_type_ids(ea_t ea) { getnode(ea).supdel(NSUP_CUSTDT); }
959
972const reftype_t
983 REF_OFF8 = 10,
988
990
992
996
997idaman reftype_t ida_export get_reftype_by_size(size_t size);
998
1001{
1009#define REFINFO_TYPE 0x000F
1011#define REFINFO_RVAOFF 0x0010
1014#define REFINFO_PASTEND 0x0020
1017#define REFINFO_CUSTOM 0x0040
1021#define REFINFO_NOBASE 0x0080
1025#define REFINFO_SUBTRACT 0x0100
1026#define REFINFO_SIGNEDOP 0x0200
1027#define REFINFO_IGNZERO 0x0400
1028#define REFINFO_NO_ZEROS REFINFO_IGNZERO
1029#define REFINFO_NO_ONES 0x0800
1030#define REFINFO_SELFREF 0x1000
1032#define REFINFO_USER 0x2000
1034
1035 reftype_t type(void) const
1036 {
1037 return reftype_t(flags & (REFINFO_TYPE | REFINFO_CUSTOM));
1038 }
1039
1041 {
1042 reftype_t rt = flags & (REFINFO_TYPE | REFINFO_CUSTOM);
1043 return is_reftype_target_optional(rt);
1044 }
1045
1046 bool no_base_xref(void) const { return (flags & REFINFO_NOBASE) != 0; }
1047 bool is_pastend(void) const { return (flags & REFINFO_PASTEND) != 0; }
1048 bool is_rvaoff(void) const { return (flags & REFINFO_RVAOFF) != 0; }
1049 bool is_custom(void) const { return (flags & REFINFO_CUSTOM) != 0; }
1050 bool is_subtract(void) const { return (flags & REFINFO_SUBTRACT) != 0; }
1051 bool is_signed(void) const { return (flags & REFINFO_SIGNEDOP) != 0; }
1052 bool is_ignore_zero(void) const { return (flags & REFINFO_IGNZERO) != 0; }
1053 bool is_no_zeros(void) const { return is_ignore_zero(); }
1054 bool is_no_ones(void) const { return (flags & REFINFO_NO_ONES) != 0; }
1055 bool is_selfref(void) const { return (flags & REFINFO_SELFREF) != 0; }
1056 bool is_user(void) const { return (flags & REFINFO_USER) != 0; }
1057
1058 // RT can include REFINFO_CUSTOM bit
1060 {
1061 flags &= ~(REFINFO_TYPE | REFINFO_CUSTOM);
1062 flags |= rt;
1063 }
1064
1065 // init the structure with some default values
1066 // reft_and_flags should be REF_xxx optionally ORed with some REFINFO_xxx flags
1067 void init(uint32 reft_and_flags, ea_t _base = 0, ea_t _target = BADADDR, adiff_t _tdelta = 0)
1068 {
1069 flags = reft_and_flags;
1070 base = _base;
1071 target = _target;
1072 tdelta = _tdelta;
1073 }
1074
1075 // internal use
1076#ifndef SWIG
1077 bool _require_base() const { return !is_rvaoff() && !is_selfref(); }
1079#endif
1080};
1081
1086{
1088 const char *name;
1089 const char *desc;
1090 int props;
1094#define RHF_TGTOPT 0x0001
1097
1098 // this callback prepares the full offset expression in buf and
1099 // returns 1 if it is a simple expression or 2 if it is a complex one.
1100 // Or this callback checks the compliance of opval and fullvalue,
1101 // and possibly updates values of target and fullvalue,
1102 // and prepares the format,
1103 // and returns 3 to continue standard processing with updated values.
1104 // Or this callback just prepares the format and returns 4 to continue.
1105 // It returns 0 in the case of error.
1106 // It is guaranteed that before calling this callback, the
1107 // calc_reference_data() callback is always called.
1108 int (idaapi *gen_expr)(
1109 qstring *buf,
1110 qstring *format, // buffer for the format (if retcode>=3)
1115 adiff_t *opval, // the output value is not used
1116 ea_t *target, // the target prepared by calc_reference_data()
1119
1120 // this callback replaces calc_target.
1121 // It calculates target and base,
1122 // and calculates an internal variable fullvalue,
1123 // and checks the compliance of opval and fullvalue,
1124 // and returns the success flag.
1126 ea_t *target,
1131
1132 // just custom format
1133 void (idaapi *get_format)(qstring *format);
1134
1135#ifndef SWIG
1137#endif
1138};
1139
1140
1142
1143idaman int ida_export register_custom_refinfo(const custom_refinfo_handler_t *crh);
1144
1145
1147
1148idaman bool ida_export unregister_custom_refinfo(int crid);
1149
1150
1152
1153idaman int ida_export find_custom_refinfo(const char *name);
1154
1155
1157
1158idaman const custom_refinfo_handler_t *ida_export get_custom_refinfo(int crid);
1159
1160
1162
1164 const refinfo_t &ri)
1165{
1166 return ri.is_custom() ? get_custom_refinfo(ri.type()) : nullptr;
1167}
1168
1169// inline implementation
1171{
1172 if ( (type & REFINFO_CUSTOM) != 0 )
1173 {
1175 if ( cfh == nullptr )
1176 return false;
1177 return (cfh->props & RHF_TGTOPT) != 0;
1178 }
1179 switch ( type )
1180 {
1181 case REF_OFF8:
1182 case REF_OFF16:
1183 case REF_OFF32:
1184 case REF_OFF64:
1185 return true;
1186 }
1187 return false;
1188}
1189
1190
1192
1194{
1197 const char *name;
1198 const char *desc;
1199};
1202idaman void ida_export get_refinfo_descs(refinfo_desc_vec_t *descs);
1203
1204
1205#define MAXSTRUCPATH 32
1206
1213{
1214 int len;
1215 tid_t ids[MAXSTRUCPATH]; // for union member ids
1217#ifndef SWIG
1219#endif
1220};
1221
1224{
1227#ifndef SWIG
1229 {
1230 COMPARE_FIELDS(tid);
1231 COMPARE_FIELDS(serial);
1232 return 0;
1233 }
1234#endif
1235};
1236
1250
1251//-------------------------------------------------------------------------
1252
1254{
1255 uint32 unused = 0; // not used anymore, use flags64 instead (kept for backward compat)
1256 opinfo_t ti; // new operand type
1257#define POF_VALID_TI 0x1 // is operand type initialized?
1258#define POF_VALID_AFLAGS 0x2 // internal
1259#define POF_IS_F64 0x4 // internal
1260 uchar features; // features this instance holds
1261 int suspop = 0; // out: will be set by print_operand()
1262 aflags_t aflags = 0; // additional aflags
1263 flags64_t flags = 0; // new operand representation flags
1264
1265 printop_t() : features(POF_IS_F64) { memset(&ti, 0, sizeof(ti)); }
1266 bool is_ti_initialized() const { return (features & POF_VALID_TI) != 0; }
1267 void set_ti_initialized(bool v=true) { setflag(features, POF_VALID_TI, v); }
1268 bool is_aflags_initialized() const { return (features & POF_VALID_AFLAGS) != 0; }
1269 void set_aflags_initialized(bool v=true) { setflag(features, POF_VALID_AFLAGS, v); }
1270 bool is_f64() const { return (features & POF_IS_F64) != 0; }
1271
1272 const opinfo_t *get_ti() const { return is_ti_initialized() ? &ti : nullptr; }
1273};
1274
1280idaman bool ida_export set_refinfo_ex(ea_t ea, int n, const refinfo_t *ri);
1281idaman bool ida_export set_refinfo(
1282 ea_t ea,
1283 int n,
1285 ea_t target=BADADDR,
1286 ea_t base=0,
1287 adiff_t tdelta=0);
1288idaman bool ida_export get_refinfo(refinfo_t *ri, ea_t ea, int n);
1289idaman bool ida_export del_refinfo(ea_t ea, int n);
1291
1292//--------------------------------------------------------------------------
1301idaman void ida_export write_struc_path(ea_t ea, int idx, const tid_t *path, int plen, adiff_t delta);
1302idaman int ida_export read_struc_path(tid_t *path, adiff_t *delta, ea_t ea, int idx); // returns plen
1304
1306
1307
1308//--------------------------------------------------------------------------
1309// type information (ti) storage
1310// up to 256 operands are supported for ti.
1311
1314class tinfo_t;
1315
1320idaman bool ida_export get_tinfo(tinfo_t *tif, ea_t ea);
1321idaman bool ida_export set_tinfo(ea_t ea, const tinfo_t *tif);
1322inline void idaapi del_tinfo(ea_t ea) { set_tinfo(ea, nullptr); }
1324
1328idaman bool ida_export get_op_tinfo(tinfo_t *tif, ea_t ea, int n);
1329idaman bool ida_export set_op_tinfo(ea_t ea, int n, const tinfo_t *tif);
1330inline void idaapi del_op_tinfo(ea_t ea, int n) { set_op_tinfo(ea, n, nullptr); }
1332
1333//------------------------------------------------------------------------//
1336
1337// supvals
1338#define RIDX_FILE_FORMAT_NAME 1
1339#define RIDX_SELECTORS 2
1340#define RIDX_GROUPS 64
1341#define RIDX_H_PATH 65
1342#define RIDX_C_MACROS 66
1343#define RIDX_SMALL_IDC_OLD 67
1344#define RIDX_NOTEPAD 68
1345#define RIDX_INCLUDE 1100
1346#define RIDX_SMALL_IDC 1200
1347#define RIDX_DUALOP_GRAPH 1300
1348#define RIDX_DUALOP_TEXT 1301
1349#define RIDX_MD5 1302
1350#define RIDX_IDA_VERSION 1303
1351
1352#define RIDX_STR_ENCODINGS 1305
1353#define RIDX_SRCDBG_PATHS 1306
1354#define RIDX_DBG_BINPATHS 1328
1355#define RIDX_SHA256 1349
1356#define RIDX_ABINAME 1350
1357#define RIDX_ARCHIVE_PATH 1351
1358#define RIDX_PROBLEMS 1352
1359#define RIDX_SRCDBG_UNDESIRED 1353
1360
1361// altvals
1362#define RIDX_ALT_VERSION uval_t(-1)
1363#define RIDX_ALT_CTIME uval_t(-2)
1364#define RIDX_ALT_ELAPSED uval_t(-3)
1365#define RIDX_ALT_NOPENS uval_t(-4)
1366#define RIDX_ALT_CRC32 uval_t(-5)
1367#define RIDX_ALT_IMAGEBASE uval_t(-6)
1368#define RIDX_ALT_IDSNODE uval_t(-7)
1369#define RIDX_ALT_FSIZE uval_t(-8)
1370#define RIDX_ALT_OUTFILEENC uval_t(-9)
1372
1373//---------------------------------------------------------------------------
1375idaman ssize_t ida_export get_root_filename(char *buf, size_t bufsize);
1376
1378idaman ssize_t ida_export dbg_get_input_path(char *buf, size_t bufsize);
1379
1380// The following functions should eventually be replaced by exported functions
1381#ifndef __KERNEL__
1383inline ssize_t idaapi get_input_file_path(char *buf, size_t bufsize)
1384{
1386}
1387
1389inline void set_root_filename(const char *file) { setinf_buf(INF_INPUT_FILE_PATH, file); }
1390
1392inline size_t idaapi retrieve_input_file_size(void) { return getinf(INF_FSIZE); }
1393
1396inline uint32 idaapi retrieve_input_file_crc32(void) { return uint32(getinf(INF_CRC32)); }
1397
1399inline bool idaapi retrieve_input_file_md5(uchar hash[16]) { return getinf_buf(INF_MD5, hash, 16) == 16; }
1400
1402inline bool idaapi retrieve_input_file_sha256(uchar hash[32]) { return getinf_buf(INF_SHA256, hash, 32) == 32; }
1403
1405inline ssize_t idaapi get_asm_inc_file(qstring *buf) { return getinf_str(buf, INF_INCLUDE); }
1406
1408inline bool idaapi set_asm_inc_file(const char *file) { return setinf_buf(INF_INCLUDE, file); }
1409
1411inline ea_t idaapi get_imagebase(void) { return getinf(INF_IMAGEBASE); }
1412
1414inline void idaapi set_imagebase(ea_t base) { setinf(INF_IMAGEBASE, base); }
1415
1417inline netnode idaapi get_ids_modnode(void) { return getinf(INF_IDSNODE); }
1418
1420inline void idaapi set_ids_modnode(netnode id) { setinf(INF_IDSNODE, id); }
1421
1423inline ssize_t idaapi get_archive_path(qstring *out) { return getinf_str(out, INF_ARCHIVE_PATH); }
1424
1426inline bool set_archive_path(const char *file) { return setinf_buf(INF_ARCHIVE_PATH, file); }
1427
1430
1433
1436
1438inline ssize_t idaapi get_ida_notepad_text(qstring *out) { return getinf_str(out, INF_NOTEPAD); }
1439
1441inline void idaapi set_ida_notepad_text(const char *text, size_t size=0) { setinf_buf(INF_NOTEPAD, text, size); }
1442
1444inline ssize_t idaapi get_srcdbg_paths(qstring *out) { return getinf_str(out, INF_SRCDBG_PATHS); }
1445
1447inline void idaapi set_srcdbg_paths(const char *paths) { setinf_buf(INF_SRCDBG_PATHS, paths); }
1448
1451
1453inline void idaapi set_srcdbg_undesired_paths(const char *paths) { setinf_buf(INF_SRCDBG_UNDESIRED, paths); }
1454
1457
1459inline time_t idaapi get_idb_ctime() { return getinf(INF_CTIME); }
1460
1462inline size_t idaapi get_elapsed_secs() { return getinf(INF_ELAPSED); }
1463
1465inline size_t idaapi get_idb_nopens() { return getinf(INF_NOPENS); }
1466
1467#endif
1468
1469//---------------------------------------------------------------------------
1476
1478
1479idaman int ida_export get_encoding_qty();
1480
1481
1486
1487idaman const char *ida_export get_encoding_name(int idx);
1488
1489
1494
1495idaman int ida_export add_encoding(const char *encname);
1496
1497
1503
1504idaman bool ida_export del_encoding(int idx);
1505
1506
1513
1514idaman bool ida_export rename_encoding(int idx, const char *encname);
1515
1516
1517#define BPU_1B 1
1518#define BPU_2B 2
1519#define BPU_4B 4
1520
1525
1526idaman int ida_export get_encoding_bpu(int idx);
1527
1528
1532idaman int ida_export get_encoding_bpu_by_name(const char *encname);
1533
1534
1535//-------------------------------------------------------------------------
1536inline int get_strtype_bpu(int32 strtype)
1537{
1538 int w = get_str_type_code(strtype) & STRWIDTH_MASK;
1539 return w == STRWIDTH_2B ? BPU_2B
1540 : w == STRWIDTH_4B ? BPU_4B
1541 : BPU_1B;
1542}
1543
1547
1548idaman int ida_export get_default_encoding_idx(int bpu);
1549
1550
1554
1555idaman bool ida_export set_default_encoding_idx(int bpu, int idx);
1556
1557
1561
1562inline const char *idaapi encoding_from_strtype(int32 strtype)
1563{
1564 uchar enc = get_str_encoding_idx(strtype);
1565 if ( enc == STRENC_DEFAULT )
1567 return get_encoding_name(enc);
1568}
1569
1570
1573
1574idaman int ida_export get_outfile_encoding_idx();
1575
1576
1580
1581idaman bool ida_export set_outfile_encoding_idx(int idx);
1582
1583
1585
1586//------------------------------------------------------------------------//
1589
1591
1592idaman uint ida_export get_import_module_qty();
1593
1594
1598
1599idaman bool ida_export get_import_module_name(qstring *buf, int mod_index);
1600
1601
1609
1610typedef int idaapi import_enum_cb_t(ea_t ea, const char *name, uval_t ord, void *param);
1611
1612
1617
1618idaman int ida_export enum_import_names(int mod_index, import_enum_cb_t *callback, void *param=nullptr);
1619
1620
1622
1623idaman void ida_export delete_imports(void);
1624
1629
1636
1637idaman bool ida_export get_import_entry(import_entry_t *entry, ea_t ea);
1638
1640
1641
1643
1644idaman int ida_export validate_idb_names(bool do_repair);
1645
1646
1647#define GOTEA_NODE_NAME "$ got"
1648#define GOTEA_NODE_IDX 0
1649
1650//--------------------------------------------------------------------------
1651// Set address of .got section
1652inline void set_gotea(ea_t gotea)
1653{
1654 netnode n;
1655 n.create(GOTEA_NODE_NAME);
1656 n.altset(GOTEA_NODE_IDX, ea2node(gotea)+1);
1657}
1658
1659//--------------------------------------------------------------------------
1660// Get address of .got section
1661inline ea_t get_gotea(void)
1662{
1663 netnode n(GOTEA_NODE_NAME);
1664 return exist(n) ? node2ea(n.altval(GOTEA_NODE_IDX) - 1) : BADADDR;
1665}
1666
1667
1668#ifndef IDA_KERNEL_PRIVATE_NALT_ACCESS // undefined bit masks so no one can use them directly
1669#undef AFL_LINNUM
1670#undef AFL_USERSP
1671#undef AFL_PUBNAM
1672#undef AFL_WEAKNAM
1673#undef AFL_HIDDEN
1674#undef AFL_MANUAL
1675#undef AFL_NOBRD
1676#undef AFL_ZSTROFF
1677#undef AFL_BNOT0
1678#undef AFL_BNOT1
1679#undef AFL_LIB
1680#undef AFL_TI
1681#undef AFL_TI0
1682#undef AFL_TI1
1683#undef AFL_LNAME
1684#undef AFL_TILCMT
1685#undef AFL_LZERO0
1686#undef AFL_LZERO1
1687#undef AFL_COLORED
1688#undef AFL_TERSESTR
1689#undef AFL_SIGN0
1690#undef AFL_SIGN1
1691#undef AFL_NORET
1692#undef AFL_FIXEDSPD
1693#undef NALT_ENUM
1694#undef NALT_WIDE
1695#undef NALT_SWITCH
1696//#undef NALT_STRUCT
1697#undef NALT_XREFPOS
1698#undef NALT_AFLAGS
1699#undef NALT_LINNUM
1700#undef NALT_ABSBASE
1701//#undef NALT_ENUM0
1702//#undef NALT_ENUM1
1703#undef NALT_PURGE
1704#undef NALT_STRTYPE
1705#undef NALT_ALIGN
1706#undef NALT_COLOR
1707#undef NSUP_CMT
1708#undef NSUP_REPCMT
1709#undef NSUP_FOP1
1710#undef NSUP_FOP2
1711#undef NSUP_JINFO
1712#undef NSUP_ARRAY
1713#undef NSUP_OMFGRP
1714#undef NSUP_FOP3
1715#undef NSUP_SWITCH
1716#undef NSUP_REF0
1717#undef NSUP_REF1
1718#undef NSUP_REF2
1719#undef NSUP_OREF0
1720#undef NSUP_OREF1
1721#undef NSUP_OREF2
1722#undef NSUP_STROFF0
1723#undef NSUP_STROFF1
1724#undef NSUP_SEGTRANS
1725#undef NSUP_FOP4
1726#undef NSUP_FOP5
1727#undef NSUP_FOP6
1728#undef NSUP_FOP7
1729#undef NSUP_FOP8
1730#undef NSUP_REF3
1731#undef NSUP_REF4
1732#undef NSUP_REF5
1733#undef NSUP_REF6
1734#undef NSUP_REF7
1735#undef NSUP_OREF3
1736#undef NSUP_OREF4
1737#undef NSUP_OREF5
1738#undef NSUP_OREF6
1739#undef NSUP_OREF7
1740#undef NSUP_MANUAL
1741#undef NSUP_FTAILS
1742#undef NSUP_GROUP
1743#endif // !IDA_KERNEL_PRIVATE_NALT_ACCESS
1744#endif // NALT_HPP
Definition of the IDA database node.
Definition netnode.hpp:241
bool supdel(nodeidx_t alt, uchar tag=stag)
Delete supval element.
Definition netnode.hpp:686
ssize_t supval(nodeidx_t alt, void *buf, size_t bufsize, uchar tag=stag) const
Get value of the specified supval array element.
Definition netnode.hpp:631
bool supset(nodeidx_t alt, const void *value, size_t length=0, uchar tag=stag)
Set value of supval array element.
Definition netnode.hpp:676
Reimplementation of vector class from STL.
Definition pro.h:2262
Primary mechanism for managing type information.
Definition typeinf.hpp:3077
const char * name
Definition typeinf.hpp:3244
const uchar atag
Array of altvals.
Definition netnode.hpp:126
int code
Definition fpro.h:88
idaman size_t n
Definition pro.h:1000
const reftype_t V695_REF_OFF8
reserved
Definition nalt.hpp:973
const reftype_t REF_HIGH16
high 16 bits of 32-bit offset
Definition nalt.hpp:979
const reftype_t V695_REF_VHIGH
obsolete
Definition nalt.hpp:980
const reftype_t REF_OFF8
8-bit full offset
Definition nalt.hpp:983
const reftype_t REF_HIGH8
high 8 bits of 16-bit offset
Definition nalt.hpp:978
const reftype_t REF_LOW8
low 8 bits of 16-bit offset
Definition nalt.hpp:976
const reftype_t REF_OFF32
32-bit full offset
Definition nalt.hpp:975
const reftype_t REF_LOW16
low 16 bits of 32-bit offset
Definition nalt.hpp:977
const reftype_t REF_OFF64
64-bit full offset
Definition nalt.hpp:982
const reftype_t REF_OFF16
16-bit full offset
Definition nalt.hpp:974
const reftype_t V695_REF_VLOW
obsolete
Definition nalt.hpp:981
const reftype_t REF_LOW32
low 32 bits of 64-bit offset
Definition nalt.hpp:984
const reftype_t REF_LAST
Definition nalt.hpp:986
const reftype_t REF_HIGH32
high 32 bits of 64-bit offset
Definition nalt.hpp:985
const tinfo_t & type
Definition hexrays.hpp:7698
Contains the inf structure definition and some functions common to the whole IDA project.
@ INF_INCLUDE
assembler include file name
Definition ida.hpp:522
@ INF_INPUT_FILE_PATH
Definition ida.hpp:547
@ INF_SRCDBG_UNDESIRED
user-closed source files, occupies 20 indexes
Definition ida.hpp:537
@ INF_SHA256
SHA256 of the input file.
Definition ida.hpp:529
@ INF_IMAGEBASE
image base
Definition ida.hpp:543
@ INF_FILE_FORMAT_NAME
file format name for loader modules
Definition ida.hpp:518
@ INF_CTIME
database creation timestamp
Definition ida.hpp:539
@ INF_SRCDBG_PATHS
source debug paths, occupies 20 indexes
Definition ida.hpp:536
@ INF_MD5
MD5 of the input file.
Definition ida.hpp:525
@ INF_FSIZE
input file size
Definition ida.hpp:545
@ INF_IDA_VERSION
version of ida which created the database
Definition ida.hpp:526
@ INF_INITIAL_VERSION
initial version of database
Definition ida.hpp:538
@ INF_NOTEPAD
notepad blob, occupies 1000 indexes (1MB of text)
Definition ida.hpp:535
@ INF_NOPENS
how many times the database is opened
Definition ida.hpp:541
@ INF_CRC32
input file crc32
Definition ida.hpp:542
@ INF_ELAPSED
seconds database stayed open
Definition ida.hpp:540
@ INF_ARCHIVE_PATH
archive file path
Definition ida.hpp:531
@ INF_IDSNODE
ids modnode id (for import_module)
Definition ida.hpp:544
idaman size_t ida_export getinf(inftag_t tag)
Get program specific information (a scalar value)
idaman ssize_t ida_export getinf_buf(inftag_t tag, void *buf, size_t bufsize)
Get program specific information (a non-scalar value)
idaman bool ida_export setinf(inftag_t tag, ssize_t value)
Set program specific information.
idaman ssize_t ida_export getinf_str(qstring *buf, inftag_t tag)
Get program specific information (a non-scalar value)
idaman bool ida_export setinf_buf(inftag_t tag, const void *buf, size_t bufsize=0)
Set program specific information.
uchar inf_get_cmtflg()
Definition ida.hpp:905
uval_t uval_t
Definition kernwin.hpp:1926
asize_t size
Definition kernwin.hpp:6701
void set_switch_parent(ea_t ea, ea_t x)
Definition nalt.hpp:925
bool idaapi set_asm_inc_file(const char *file)
Set name of the include file.
Definition nalt.hpp:1408
idaman void ida_export write_struc_path(ea_t ea, int idx, const tid_t *path, int plen, adiff_t delta)
idaman void ida_export delete_imports(void)
Delete all imported modules information.
void clr_libitem(ea_t ea)
Definition nalt.hpp:364
void set_type_guessed_by_ida(ea_t ea)
Definition nalt.hpp:444
constexpr bool is_aflag_hidden_border(aflags_t flags)
Definition nalt.hpp:303
void idaapi del_tinfo(ea_t ea)
Definition nalt.hpp:1322
bool uses_modsp(ea_t ea)
Definition nalt.hpp:346
void set_has_lname(ea_t ea)
Definition nalt.hpp:379
constexpr bool is_aflag_usersp(aflags_t flags)
Definition nalt.hpp:298
void clr_tilcmt(ea_t ea)
Definition nalt.hpp:384
size_t idaapi get_elapsed_secs()
Get seconds database stayed open.
Definition nalt.hpp:1462
bool is__invsign1(ea_t ea)
Definition nalt.hpp:410
size_t idaapi retrieve_input_file_size(void)
Get size of input file in bytes.
Definition nalt.hpp:1392
void set_has_ti0(ea_t ea)
Definition nalt.hpp:371
constexpr bool is_aflag_data_guessed_by_hexrays(aflags_t flags)
Definition nalt.hpp:329
void set_gotea(ea_t gotea)
Definition nalt.hpp:1652
idaman bool ida_export set_outfile_encoding_idx(int idx)
set encoding to be used when producing files
netnode idaapi get_ids_modnode(void)
Get ids modnode.
Definition nalt.hpp:1417
DECLARE_TYPE_AS_MOVABLE(refinfo_desc_t)
constexpr bool is_aflag_align_flow(aflags_t flags)
Definition nalt.hpp:321
bool is_libitem(ea_t ea)
Definition nalt.hpp:362
bool is_data_guessed_by_hexrays(ea_t ea)
Definition nalt.hpp:440
constexpr bool uses_aflag_modsp(aflags_t flags)
Definition nalt.hpp:324
void set_noret(ea_t ea)
Definition nalt.hpp:415
idaman bool ida_export get_tinfo(tinfo_t *tif, ea_t ea)
bool is__bnot0(ea_t ea)
Definition nalt.hpp:354
void set_retfp(ea_t ea)
Definition nalt.hpp:431
idaman int ida_export enum_import_names(int mod_index, import_enum_cb_t *callback, void *param=nullptr)
Enumerate imports from specific module.
void clr__bnot1(ea_t ea)
Definition nalt.hpp:360
constexpr bool is_aflag__invsign0(aflags_t flags)
Definition nalt.hpp:317
idaman bool ida_export set_tinfo(ea_t ea, const tinfo_t *tif)
void set_usemodsp(ea_t ea)
Definition nalt.hpp:347
ssize_t idaapi get_initial_ida_version(qstring *out)
Get version of ida which created the database (string format like "7.5")
Definition nalt.hpp:1435
void set__invsign0(ea_t ea)
Definition nalt.hpp:407
void clr_colored_item(ea_t ea)
Definition nalt.hpp:400
bool is_func_guessed_by_hexrays(ea_t ea)
Definition nalt.hpp:439
ssize_t idaapi get_input_file_path(char *buf, size_t bufsize)
Get full path of the input file.
Definition nalt.hpp:1383
bool is_tilcmt(ea_t ea)
Definition nalt.hpp:382
void del_switch_parent(ea_t ea)
Definition nalt.hpp:930
idaman int ida_export get_custom_data_type_ids(custom_data_type_ids_t *cdis, ea_t ea)
idaman nodeidx_t ida_export ea2node(ea_t ea)
Get netnode for the specified address.
void set_usersp(ea_t ea)
Definition nalt.hpp:387
idaman nodeidx_t ida_export end_ea2node(ea_t ea)
idaman bool ida_export set_op_tinfo(ea_t ea, int n, const tinfo_t *tif)
uint32 get_alignment(ea_t ea)
Definition nalt.hpp:644
idaman int ida_export add_encoding(const char *encname)
Add a new encoding (e.g.
void set__bnot0(ea_t ea)
Definition nalt.hpp:355
idaman void ida_export set_xrefpos(ea_t ea, const xrefpos_t *in)
idaman int ida_export get_outfile_encoding_idx()
Get the index of the encoding used when producing files.
bool is_finally_visible_item(ea_t ea)
Is instruction visible?
Definition nalt.hpp:477
constexpr bool is_aflag_tilcmt(aflags_t flags)
Definition nalt.hpp:312
bool is_userti(ea_t ea)
Definition nalt.hpp:426
qvector< refinfo_desc_t > refinfo_desc_vec_t
Definition nalt.hpp:1201
constexpr bool has_aflag_lname(aflags_t flags)
Definition nalt.hpp:311
void set_alignment(ea_t ea, uint32 x)
Definition nalt.hpp:649
void clr_has_ti(ea_t ea)
Definition nalt.hpp:368
idaman uval_t ida_export get_source_linnum(ea_t ea)
int idaapi import_enum_cb_t(ea_t ea, const char *name, uval_t ord, void *param)
Callback for enumerating imports.
Definition nalt.hpp:1610
void idaapi set_srcdbg_undesired_paths(const char *paths)
Set user-closed source files.
Definition nalt.hpp:1453
bool is_hidden_item(ea_t ea)
Definition nalt.hpp:338
constexpr bool is_aflag_fixed_spd(aflags_t flags)
Definition nalt.hpp:320
void set_libitem(ea_t ea)
Definition nalt.hpp:363
idaman bool ida_export get_op_tinfo(tinfo_t *tif, ea_t ea, int n)
ea_t get_absbase(ea_t ea)
Definition nalt.hpp:494
THREAD_SAFE size_t get_str_type_prefix_length(int32 strtype)
Definition nalt.hpp:616
void clr_notproc(ea_t ea)
Definition nalt.hpp:436
void hide_border(ea_t ea)
Definition nalt.hpp:343
idaman reftype_t ida_export get_reftype_by_size(size_t size)
Get REF_... constant from size Supported sizes: 1,2,4,8,16 For other sizes returns reftype_t(-1)
idaman bool ida_export set_default_encoding_idx(int bpu, int idx)
Set default encoding for a string type.
idaman int ida_export get_default_encoding_idx(int bpu)
Get default encoding index for a specific string type.
idaman ssize_t ida_export get_xrefpos(xrefpos_t *out, ea_t ea)
void hide_item(ea_t ea)
Definition nalt.hpp:339
void set_visible_item(ea_t ea, bool visible)
Change visibility of item at given ea.
Definition nalt.hpp:462
void set__invsign1(ea_t ea)
Definition nalt.hpp:411
bool is_hidden_border(ea_t ea)
Definition nalt.hpp:342
void set_loader_format_name(const char *name)
Set file format name for loader modules.
Definition nalt.hpp:1432
void idaapi set_imagebase(ea_t base)
Set image base address.
Definition nalt.hpp:1414
idaman void ida_export clr_abits(ea_t ea, aflags_t bits)
idaman void ida_export upd_abits(ea_t ea, aflags_t clr_bits, aflags_t set_bits)
bool is_usersp(ea_t ea)
Definition nalt.hpp:386
void idaapi del_op_tinfo(ea_t ea, int n)
Definition nalt.hpp:1330
void set_root_filename(const char *file)
Set full path of the input file.
Definition nalt.hpp:1389
idaman void ida_export set_str_type(ea_t ea, uint32 x)
bool is_type_guessed_by_ida(ea_t ea)
Definition nalt.hpp:438
bool has_ti0(ea_t ea)
Definition nalt.hpp:370
void set_ind_purged(ea_t ea, ea_t x)
Definition nalt.hpp:513
idaman int ida_export get_encoding_qty()
Get total number of encodings (counted from 0)
bool has_lname(ea_t ea)
Definition nalt.hpp:378
bool has_ti(ea_t ea)
Definition nalt.hpp:366
const custom_refinfo_handler_t *idaapi get_custom_refinfo_handler(const refinfo_t &ri)
Get refinfo handler.
Definition nalt.hpp:1163
ea_t get_switch_parent(ea_t ea)
Definition nalt.hpp:920
idaman bool ida_export get_import_module_name(qstring *buf, int mod_index)
Get import module name.
idaman aflags_t ida_export get_aflags(ea_t ea)
void set_align_flow(ea_t ea)
Definition nalt.hpp:423
constexpr bool is_aflag_noret(aflags_t flags)
Definition nalt.hpp:319
bool is_notcode(ea_t ea)
Is the address marked as not-code?
Definition nalt.hpp:457
constexpr bool is_aflag__invsign1(aflags_t flags)
Definition nalt.hpp:318
void clr_has_ti0(ea_t ea)
Definition nalt.hpp:372
constexpr bool is_aflag_type_guessed_by_ida(aflags_t flags)
Definition nalt.hpp:327
constexpr bool is_aflag_userti(aflags_t flags)
Definition nalt.hpp:322
THREAD_SAFE int32 make_str_type(uchar type_code, int encoding_idx, uchar term1=0, uchar term2=0)
Get string type for a string in the given encoding.
Definition nalt.hpp:597
idaman void ida_export set_notcode(ea_t ea)
Mark address so that it cannot be converted to instruction.
void unhide_item(ea_t ea)
Definition nalt.hpp:340
idaman bool ida_export get_import_entry(import_entry_t *entry, ea_t ea)
idaman uint32 ida_export get_str_type(ea_t ea)
ushort idaapi get_initial_idb_version()
Get initial version of the database (numeric format like 700)
Definition nalt.hpp:1456
void idaapi set_srcdbg_paths(const char *paths)
Set source debug paths.
Definition nalt.hpp:1447
void clr_noret(ea_t ea)
Definition nalt.hpp:416
idaman tid_t ida_export get_strid(ea_t ea)
idaman ssize_t ida_export dbg_get_input_path(char *buf, size_t bufsize)
Get debugger input file name/path (see LFLG_DBG_NOPATH)
void set_has_ti(ea_t ea)
Definition nalt.hpp:367
bool is_lzero0(ea_t ea)
Definition nalt.hpp:390
bool is_terse_struc(ea_t ea)
Definition nalt.hpp:402
void clr_notcode(ea_t ea)
Clear not-code mark.
Definition nalt.hpp:454
void set_lzero1(ea_t ea)
Definition nalt.hpp:395
void set_lzero0(ea_t ea)
Definition nalt.hpp:391
idaman int ida_export read_struc_path(tid_t *path, adiff_t *delta, ea_t ea, int idx)
THREAD_SAFE uchar idaapi get_str_type_code(int32 strtype)
Definition nalt.hpp:584
idaman const custom_refinfo_handler_t *ida_export get_custom_refinfo(int crid)
Get definition of a registered custom refinfo type.
void del_alignment(ea_t ea)
Definition nalt.hpp:654
idaman void ida_export set_switch_info(ea_t ea, const switch_info_t &in)
void set_notproc(ea_t ea)
Definition nalt.hpp:435
void clr__bnot0(ea_t ea)
Definition nalt.hpp:356
void clr_has_ti1(ea_t ea)
Definition nalt.hpp:376
ea_t get_gotea(void)
Definition nalt.hpp:1661
void clr_terse_struc(ea_t ea)
Definition nalt.hpp:404
uchar type_t
In serialized form, a type is represented by a byte sequence.
Definition nalt.hpp:1312
THREAD_SAFE int32 set_str_encoding_idx(int32 strtype, int encoding_idx)
Set index of the string encoding in the string type.
Definition nalt.hpp:592
idaman void ida_export set_array_parameters(ea_t ea, const array_parameters_t *in)
int get_strtype_bpu(int32 strtype)
Definition nalt.hpp:1536
idaman int ida_export find_custom_refinfo(const char *name)
Get id of a custom refinfo type.
void clr_usemodsp(ea_t ea)
Definition nalt.hpp:348
void set_has_ti1(ea_t ea)
Definition nalt.hpp:375
void set_func_guessed_by_hexrays(ea_t ea)
Definition nalt.hpp:445
constexpr bool is_aflag_public_name(aflags_t flags)
Definition nalt.hpp:299
uint32 idaapi retrieve_input_file_crc32(void)
Get input file crc32 stored in the database.
Definition nalt.hpp:1396
flags_t aflags_t
Definition nalt.hpp:288
uchar p_list
several p_string's
Definition nalt.hpp:1313
idaman bgcolor_t ida_export get_item_color(ea_t ea)
idaman bool ida_export unregister_custom_refinfo(int crid)
Unregister a new custom refinfo type.
bool is__invsign0(ea_t ea)
Definition nalt.hpp:406
idaman int ida_export get_encoding_bpu_by_name(const char *encname)
Get the amount of bytes per unit for the given encoding.
idaman bool ida_export set_refinfo(ea_t ea, int n, reftype_t type, ea_t target=BADADDR, ea_t base=0, adiff_t tdelta=0)
ssize_t idaapi get_ida_notepad_text(qstring *out)
Get notepad text.
Definition nalt.hpp:1438
void clr_lzero0(ea_t ea)
Definition nalt.hpp:392
bool is_zstroff(ea_t ea)
Definition nalt.hpp:350
ssize_t idaapi get_srcdbg_paths(qstring *out)
Get source debug paths.
Definition nalt.hpp:1444
void clr_has_lname(ea_t ea)
Definition nalt.hpp:380
void set_absbase(ea_t ea, ea_t x)
Definition nalt.hpp:499
constexpr bool is_aflag_colored_item(aflags_t flags)
Definition nalt.hpp:315
ssize_t idaapi get_srcdbg_undesired_paths(qstring *out)
Get user-closed source files.
Definition nalt.hpp:1450
void clr_usersp(ea_t ea)
Definition nalt.hpp:388
idaman void ida_export set_custom_data_type_ids(ea_t ea, const custom_data_type_ids_t *cdis)
constexpr bool has_aflag_ti(aflags_t flags)
Definition nalt.hpp:308
bool set_archive_path(const char *file)
Set archive file path from which input file was extracted.
Definition nalt.hpp:1426
idaman int ida_export register_custom_refinfo(const custom_refinfo_handler_t *crh)
Register a new custom refinfo type.
bool is_reftype_target_optional(reftype_t type)
Can the target be calculated using operand value?
Definition nalt.hpp:1170
void set_type_determined_by_hexrays(ea_t ea)
Definition nalt.hpp:447
void clr_fixed_spd(ea_t ea)
Definition nalt.hpp:420
bool is_fixed_spd(ea_t ea)
Definition nalt.hpp:418
constexpr bool has_aflag_linnum(aflags_t flags)
Definition nalt.hpp:297
void clr_retfp(ea_t ea)
Definition nalt.hpp:432
idaman void ida_export del_switch_info(ea_t ea)
constexpr bool is_aflag_zstroff(aflags_t flags)
Definition nalt.hpp:304
void clr_lzero1(ea_t ea)
Definition nalt.hpp:396
void set_data_guessed_by_hexrays(ea_t ea)
Definition nalt.hpp:446
bool is_noret(ea_t ea)
Definition nalt.hpp:414
idaman bool ida_export set_refinfo_ex(ea_t ea, int n, const refinfo_t *ri)
void set_zstroff(ea_t ea)
Definition nalt.hpp:351
idaman void ida_export get_refinfo_descs(refinfo_desc_vec_t *descs)
bool is_retfp(ea_t ea)
Definition nalt.hpp:430
idaman void ida_export del_aflags(ea_t ea)
idaman bool ida_export del_item_color(ea_t ea)
ssize_t idaapi get_loader_format_name(qstring *out)
Get file format name for loader modules.
Definition nalt.hpp:1429
bool is_align_flow(ea_t ea)
Definition nalt.hpp:422
uchar reftype_t
see Types of references
Definition nalt.hpp:960
netnode getnode(ea_t ea)
Definition nalt.hpp:197
constexpr bool is_aflag_type_guessed_by_hexrays(aflags_t flags)
Definition nalt.hpp:331
bool is_colored_item(ea_t ea)
Definition nalt.hpp:398
void clr__invsign0(ea_t ea)
Definition nalt.hpp:408
void clr_userti(ea_t ea)
Definition nalt.hpp:428
constexpr bool is_aflag_notcode(aflags_t flags)
Definition nalt.hpp:325
constexpr bool has_aflag_ti0(aflags_t flags)
Definition nalt.hpp:309
void del_absbase(ea_t ea)
Definition nalt.hpp:504
void set_tilcmt(ea_t ea)
Definition nalt.hpp:383
idaman void ida_export del_source_linnum(ea_t ea)
idaman bool ida_export get_refinfo(refinfo_t *ri, ea_t ea, int n)
bool idaapi retrieve_input_file_sha256(uchar hash[32])
Get input file sha256.
Definition nalt.hpp:1402
constexpr bool is_aflag_weak_name(aflags_t flags)
Definition nalt.hpp:300
idaman bool ida_export rename_encoding(int idx, const char *encname)
Change name for an encoding The number of bytes per unit (BPU) of the new encoding must match this nu...
constexpr bool is_aflag_hidden_item(aflags_t flags)
Definition nalt.hpp:301
void idaapi del_custom_data_type_ids(ea_t ea)
Definition nalt.hpp:957
idaman int ida_export get_encoding_bpu(int idx)
Get the amount of bytes per unit (e.g., 2 for UTF-16, 4 for UTF-32) for the encoding with the given i...
bool is_type_guessed_by_hexrays(ea_t ea)
Definition nalt.hpp:442
void idaapi set_ids_modnode(netnode id)
Set ids modnode.
Definition nalt.hpp:1420
bool is_notproc(ea_t ea)
Definition nalt.hpp:434
size_t idaapi get_idb_nopens()
Get number of times the database is opened.
Definition nalt.hpp:1465
void set_colored_item(ea_t ea)
Definition nalt.hpp:399
idaman ssize_t ida_export get_root_filename(char *buf, size_t bufsize)
Get file name only of the input file.
constexpr bool is_aflag_lzero0(aflags_t flags)
Definition nalt.hpp:313
void set__bnot1(ea_t ea)
Definition nalt.hpp:359
constexpr bool is_aflag_libitem(aflags_t flags)
Definition nalt.hpp:307
idaman uint ida_export get_import_module_qty()
Get number of import modules.
idaman void ida_export del_str_type(ea_t ea)
idaman ea_t ida_export node2ea(nodeidx_t ndx)
void idaapi del_xrefpos(ea_t ea)
Definition nalt.hpp:226
void set_userti(ea_t ea)
Definition nalt.hpp:427
THREAD_SAFE uchar idaapi get_str_encoding_idx(int32 strtype)
Get index of the string encoding for this string.
Definition nalt.hpp:590
ssize_t idaapi get_asm_inc_file(qstring *buf)
Get name of the include file.
Definition nalt.hpp:1405
THREAD_SAFE char get_str_term1(int32 strtype)
Definition nalt.hpp:585
void unhide_border(ea_t ea)
Definition nalt.hpp:344
idaman bool ida_export del_encoding(int idx)
Delete an encoding The encoding is not actually removed because its index may be used in strtype.
THREAD_SAFE bool is_pascal(int32 strtype)
Definition nalt.hpp:610
idaman void ida_export set_aflags(ea_t ea, aflags_t flags)
void clr_align_flow(ea_t ea)
Definition nalt.hpp:424
constexpr bool is_aflag__bnot1(aflags_t flags)
Definition nalt.hpp:306
constexpr bool is_aflag_func_guessed_by_hexrays(aflags_t flags)
Definition nalt.hpp:328
bool has_ti1(ea_t ea)
Definition nalt.hpp:374
constexpr bool is_aflag_type_determined_by_hexrays(aflags_t flags)
Definition nalt.hpp:330
idaman ea_t ida_export get_ind_purged(ea_t ea)
bool is_visible_item(ea_t ea)
Test visibility of item at given ea.
Definition nalt.hpp:472
void clr__invsign1(ea_t ea)
Definition nalt.hpp:412
idaman bool ida_export del_refinfo(ea_t ea, int n)
void idaapi set_ida_notepad_text(const char *text, size_t size=0)
Set notepad text.
Definition nalt.hpp:1441
bool idaapi retrieve_input_file_md5(uchar hash[16])
Get input file md5.
Definition nalt.hpp:1399
idaman ssize_t ida_export get_switch_info(switch_info_t *out, ea_t ea)
idaman ssize_t ida_export get_array_parameters(array_parameters_t *out, ea_t ea)
ssize_t idaapi get_archive_path(qstring *out)
Get archive file path from which input file was extracted.
Definition nalt.hpp:1423
const char *idaapi encoding_from_strtype(int32 strtype)
Get encoding name for this strtype.
Definition nalt.hpp:1562
idaman void ida_export set_source_linnum(ea_t ea, uval_t lnnum)
void set_fixed_spd(ea_t ea)
Definition nalt.hpp:419
constexpr bool is_aflag_manual_insn(aflags_t flags)
Definition nalt.hpp:302
bool is_type_determined_by_hexrays(ea_t ea)
Definition nalt.hpp:441
THREAD_SAFE char get_str_term2(int32 strtype)
Definition nalt.hpp:586
constexpr bool is_aflag_terse_struc(aflags_t flags)
Definition nalt.hpp:316
constexpr bool is_aflag_notproc(aflags_t flags)
Definition nalt.hpp:326
void idaapi del_array_parameters(ea_t ea)
Definition nalt.hpp:693
void clr_zstroff(ea_t ea)
Definition nalt.hpp:352
constexpr bool has_aflag_ti1(aflags_t flags)
Definition nalt.hpp:310
idaman void ida_export set_abits(ea_t ea, aflags_t bits)
idaman int ida_export validate_idb_names(bool do_repair)
Check consistency of name records, return number of bad ones.
constexpr bool is_aflag_retfp(aflags_t flags)
Definition nalt.hpp:323
time_t idaapi get_idb_ctime()
Get database creation timestamp.
Definition nalt.hpp:1459
idaman const char *ida_export get_encoding_name(int idx)
Get encoding name for specific index (1-based).
constexpr bool is_aflag__bnot0(aflags_t flags)
Definition nalt.hpp:305
void set_terse_struc(ea_t ea)
Definition nalt.hpp:403
constexpr bool is_aflag_lzero1(aflags_t flags)
Definition nalt.hpp:314
ea_t idaapi get_imagebase(void)
Get image base address.
Definition nalt.hpp:1411
bool is__bnot1(ea_t ea)
Definition nalt.hpp:358
void del_ind_purged(ea_t ea)
Definition nalt.hpp:518
idaman void ida_export set_item_color(ea_t ea, bgcolor_t color)
bool is_lzero1(ea_t ea)
Definition nalt.hpp:394
Functions that provide the lowest level public interface to the database. Namely, we use Btree....
nodeidx64_t nodeidx_t
Definition netnode.hpp:114
idaman bool ida_export calc_reference_data(ea_t *target, ea_t *base, ea_t from, const refinfo_t &ri, adiff_t opval)
Calculate the target and base addresses of an offset expression.
unsigned short uint16
unsigned 16 bit value
Definition pro.h:350
unsigned int uint32
unsigned 32 bit value
Definition pro.h:352
uint32 bgcolor_t
background color in RGB
Definition pro.h:5109
uint8 op_dtype_t
Definition pro.h:464
adiff_t sval_t
signed value used by the processor.
Definition pro.h:450
short int16
signed 16 bit value
Definition pro.h:349
int64 adiff_t
Definition pro.h:428
uint64 ea_t
Definition pro.h:425
uint32 flags_t
32-bit flags for each address
Definition pro.h:5105
int int32
signed 32 bit value
Definition pro.h:351
unsigned char uchar
unsigned 8 bit value
Definition pro.h:341
idaman size_t bufsize
Definition pro.h:604
unsigned int uint
unsigned 32 bit value
Definition pro.h:343
qvector< ea_t > eavec_t
vector of addresses
Definition pro.h:2838
uint64 flags64_t
64-bit flags for each address
Definition pro.h:5106
ptrdiff_t ssize_t
Signed size_t - used to check for size overflows when the counter becomes negative.
Definition pro.h:385
unsigned short ushort
unsigned 16 bit value
Definition pro.h:342
INLINE THREAD_SAFE void idaapi set_bits(uchar *bitmap, size_t low, size_t high)
Set bits between [low, high) in 'bitmap'.
Definition pro.h:1384
void idaapi setflag(T &where, U bit, bool cnd)
Set a 'bit' in 'where' if 'value' is not zero.
Definition pro.h:1530
ea_t tid_t
type id (for enums, structs, etc)
Definition pro.h:5107
_qstring< char > qstring
regular string
Definition pro.h:3771
Definition nalt.hpp:671
bool is_default() const
Definition nalt.hpp:689
int32 flags
Definition nalt.hpp:672
int32 lineitems
number of items on a line
Definition nalt.hpp:683
int32 alignment
-1 - don't align.
Definition nalt.hpp:684
array_parameters_t(int32 _f=AP_ALLOWDUPS, int32 _l=0, int32 _a=-1)
Definition nalt.hpp:688
Definition nalt.hpp:937
int16 fids[UA_MAXOP]
data format ids
Definition nalt.hpp:939
void set(tid_t tid)
Definition nalt.hpp:941
int16 dtid
data type id
Definition nalt.hpp:938
DECLARE_COMPARISONS(custom_data_type_ids_t)
tid_t get_dtid() const
Definition nalt.hpp:947
Manage a custom refinfo type Custom refinfos are usually used to handle custom fixups,...
Definition nalt.hpp:1086
qstring ea_t int const refinfo_t ea_t adiff_t ea_t * target
Definition nalt.hpp:1116
int32 cbsize
size of this structure
Definition nalt.hpp:1087
qstring ea_t int const refinfo_t & ri
Definition nalt.hpp:1113
void(idaapi *get_format)(qstring *format)
DECLARE_COMPARISONS(custom_refinfo_handler_t)
qstring ea_t int const refinfo_t ea_t adiff_t ea_t ea_t * fullvalue
Definition nalt.hpp:1117
bool(idaapi *calc_reference_data)(ea_t *target
int(idaapi *gen_expr)(qstring *buf
qstring * format
Definition nalt.hpp:1110
ea_t * base
Definition nalt.hpp:1127
qstring ea_t int const refinfo_t ea_t from
Definition nalt.hpp:1114
int props
properties (currently 0)
Definition nalt.hpp:1090
const char * desc
Description shown in the Ctrl-R dialog.
Definition nalt.hpp:1089
qstring ea_t int const refinfo_t ea_t adiff_t ea_t ea_t int getn_flags
Definition nalt.hpp:1118
qstring ea_t int opnum
Definition nalt.hpp:1112
qstring ea_t ea
Definition nalt.hpp:1111
qstring ea_t int const refinfo_t ea_t adiff_t * opval
Definition nalt.hpp:1115
const char * name
Format name, must be unique.
Definition nalt.hpp:1088
See opinfo_t::ec.
Definition nalt.hpp:1224
tid_t tid
Definition nalt.hpp:1225
DECLARE_COMPARISONS(enum_const_t)
Definition nalt.hpp:1228
uchar serial
Definition nalt.hpp:1226
Get import module entry for EA.
Definition nalt.hpp:1631
qstring name
name of import entry (may be empty)
Definition nalt.hpp:1632
qvector< uval_t > ordinals
import ordinals (may be empty)
Definition nalt.hpp:1633
int mod_index
module
Definition nalt.hpp:1634
bool is_aflags_initialized() const
Definition nalt.hpp:1268
aflags_t aflags
Definition nalt.hpp:1262
uchar features
Definition nalt.hpp:1260
flags64_t flags
Definition nalt.hpp:1263
bool is_f64() const
Definition nalt.hpp:1270
int suspop
Definition nalt.hpp:1261
printop_t()
Definition nalt.hpp:1265
const opinfo_t * get_ti() const
Definition nalt.hpp:1272
uint32 unused
Definition nalt.hpp:1255
void set_ti_initialized(bool v=true)
Definition nalt.hpp:1267
opinfo_t ti
Definition nalt.hpp:1256
bool is_ti_initialized() const
Definition nalt.hpp:1266
void set_aflags_initialized(bool v=true)
Definition nalt.hpp:1269
Base class for an range.
Definition range.hpp:35
Get descriptions of all standard and custom refinfo types.
Definition nalt.hpp:1194
uint32 type
Refinfo type, see Reference info flags Custom refinfo has REFINFO_CUSTOM bit.
Definition nalt.hpp:1195
const char * name
Refinfo name.
Definition nalt.hpp:1197
const char * desc
Refinfo description to use in Ctrl-R dialog.
Definition nalt.hpp:1198
Information about a reference.
Definition nalt.hpp:1001
bool _require_base() const
Definition nalt.hpp:1077
adiff_t tdelta
offset from the target
Definition nalt.hpp:1004
bool is_ignore_zero(void) const
Definition nalt.hpp:1052
bool is_custom(void) const
Definition nalt.hpp:1049
bool is_signed(void) const
Definition nalt.hpp:1051
bool is_user(void) const
Definition nalt.hpp:1056
ea_t target
reference target (BADADDR-none)
Definition nalt.hpp:1002
bool is_selfref(void) const
Definition nalt.hpp:1055
DECLARE_COMPARISONS(refinfo_t)
bool no_base_xref(void) const
Definition nalt.hpp:1046
bool is_no_zeros(void) const
deprecated alias for is_ignore_zero()
Definition nalt.hpp:1053
ea_t base
base of reference (may be BADADDR)
Definition nalt.hpp:1003
bool is_rvaoff(void) const
Definition nalt.hpp:1048
bool is_no_ones(void) const
Definition nalt.hpp:1054
bool is_target_optional() const
< is_reftype_target_optional()
Definition nalt.hpp:1040
void init(uint32 reft_and_flags, ea_t _base=0, ea_t _target=BADADDR, adiff_t _tdelta=0)
Definition nalt.hpp:1067
reftype_t type(void) const
Definition nalt.hpp:1035
bool is_pastend(void) const
Definition nalt.hpp:1047
bool is_subtract(void) const
Definition nalt.hpp:1050
uint32 flags
Reference info flags
Definition nalt.hpp:1005
void set_type(reftype_t rt)
Definition nalt.hpp:1059
Information for structure offsets.
Definition nalt.hpp:1213
adiff_t delta
Definition nalt.hpp:1216
tid_t ids[MAXSTRUCPATH]
Definition nalt.hpp:1215
DECLARE_COMPARISONS(strpath_t)
int len
Definition nalt.hpp:1214
Information about a switch statement.
Definition nalt.hpp:699
op_dtype_t regdtype
size of the switch expression register as dtype
Definition nalt.hpp:854
void clear()
Definition nalt.hpp:906
ea_t jumps
jump table start address
Definition nalt.hpp:838
int jcases
number of entries in the jump table (SWI_INDIRECT)
Definition nalt.hpp:846
int get_jtable_size(void) const
Definition nalt.hpp:856
bool has_default(void) const
Definition nalt.hpp:824
ea_t expr_ea
the address before that the switch expression is in REGNUM.
Definition nalt.hpp:900
bool has_elbase(void) const
Definition nalt.hpp:825
ea_t values
values table address (if SWI_SPARSE is set)
Definition nalt.hpp:841
bool is_sparse(void) const
Definition nalt.hpp:826
sval_t get_lowcase(void) const
Definition nalt.hpp:849
void set_elbase(ea_t base)
Definition nalt.hpp:864
int regnum
the switch expression as a value of the REGNUM register before the instruction at EXPR_EA.
Definition nalt.hpp:852
void set_jtable_element_size(int size)
Definition nalt.hpp:772
bool get_jrange_vrange(range_t *jrange=nullptr, range_t *vrange=nullptr) const
get separate parts of the switch
Definition nalt.hpp:873
bool use_std_table(void) const
Definition nalt.hpp:831
bool is_nolowcase(void) const
Definition nalt.hpp:830
void set_jtable_size(int size)
Definition nalt.hpp:857
void set_shift(int shift)
See SWI_SHIFT_MASK.
Definition nalt.hpp:755
void set_expr(int r, op_dtype_t dt)
Definition nalt.hpp:870
ea_t elbase
element base
Definition nalt.hpp:850
ea_t defjump
default jump address (BADADDR if no default case)
Definition nalt.hpp:844
uval_t custom
information for custom tables (filled and used by modules)
Definition nalt.hpp:893
int get_vtable_element_size(void) const
Definition nalt.hpp:792
int get_shift(void) const
See SWI_SHIFT_MASK.
Definition nalt.hpp:752
bool is_subtract(void) const
Definition nalt.hpp:829
ea_t startea
start of the switch idiom
Definition nalt.hpp:845
bool is_custom(void) const
Definition nalt.hpp:827
ushort ncases
number of cases (excluding default)
Definition nalt.hpp:837
sval_t ind_lowcase
Definition nalt.hpp:848
void set_vtable_element_size(int size)
Definition nalt.hpp:803
bool is_indirect(void) const
Definition nalt.hpp:828
bool is_user_defined() const
Definition nalt.hpp:832
switch_info_t()
Definition nalt.hpp:905
uval_t lowcase
the lowest value in cases
Definition nalt.hpp:842
int get_jtable_element_size(void) const
Definition nalt.hpp:761
int get_version() const
Definition nalt.hpp:897
eavec_t marks
the insns marked as IM_SWITCH. They are used to delete the switch.
Definition nalt.hpp:903
@ SWITCH_INFO_VERSION
Definition nalt.hpp:895
uint32 flags
Switch info flags
Definition nalt.hpp:700
int version
Definition nalt.hpp:896
Definition nalt.hpp:217
uchar type
Definition nalt.hpp:219
ea_t ea
Definition nalt.hpp:218
xrefpos_t(ea_t ea_=BADADDR, uchar type_=0)
Definition nalt.hpp:220
bool is_valid() const
Definition nalt.hpp:221
Additional information about an operand type.
Definition nalt.hpp:1239
refinfo_t ri
for offset members
Definition nalt.hpp:1240
int32 strtype
for strings (String type codes)
Definition nalt.hpp:1243
int compare_opinfos(const opinfo_t &r, flags64_t flag, int n) const
custom_data_type_ids_t cd
for custom data
Definition nalt.hpp:1245
tid_t tid
for struct, etc. members
Definition nalt.hpp:1241
strpath_t path
for stroff
Definition nalt.hpp:1242
enum_const_t ec
for enums
Definition nalt.hpp:1244