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-2025 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
36
43#define NALT_ENUM uval_t(-2)
44#define NALT_WIDE uval_t(-1)
45#define NALT_SWITCH 1
46//#define NALT_OBASE1 2 // offset base 2
47#define NALT_STRUCT 3
48//#define NALT_SEENF 4 // 'seen' flag (used in structures)
49//#define NALT_OOBASE0 5 // outer offset base 1
50//#define NALT_OOBASE1 6 // outer offset base 2
51//#define NALT_XREFPOS 7 // saved xref address in the xrefs window
52#define NALT_AFLAGS 8
53#define NALT_LINNUM 9
54#define NALT_ABSBASE 10
55#define NALT_ENUM0 11
56#define NALT_ENUM1 12
57//#define NALT_STROFF0 13 // struct offset, struct id for the first operand
58//#define NALT_STROFF1 14 // struct offset, struct id for the second operand
59#define NALT_PURGE 15
60#define NALT_STRTYPE 16
61#define NALT_ALIGN 17
63//#define NALT_HIGH0 18 // linear address of byte referenced by
64// // high 16 bits of an offset (FF_0HIGH)
65//#define NALT_HIGH1 19 // linear address of byte referenced by
66// // high 16 bits of an offset (FF_1HIGH)
67#define NALT_COLOR 20
69
76#define NSUP_CMT 0
77#define NSUP_REPCMT 1
78#define NSUP_FOP1 2
79#define NSUP_FOP2 3
80#define NSUP_JINFO 4
81#define NSUP_ARRAY 5
82#define NSUP_OMFGRP 6
83#define NSUP_FOP3 7
84#define NSUP_SWITCH 8
85#define NSUP_REF0 9
86#define NSUP_REF1 10
87#define NSUP_REF2 11
88#define NSUP_OREF0 12
89#define NSUP_OREF1 13
90#define NSUP_OREF2 14
91#define NSUP_STROFF0 15
92#define NSUP_STROFF1 16
93#define NSUP_SEGTRANS 17
94#define NSUP_FOP4 18
95#define NSUP_FOP5 19
96#define NSUP_FOP6 20
97#define NSUP_REF3 21
98#define NSUP_REF4 22
99#define NSUP_REF5 23
100#define NSUP_OREF3 24
101#define NSUP_OREF4 25
102#define NSUP_OREF5 26
103#define NSUP_XREFPOS 27
104#define NSUP_CUSTDT 28
105#define NSUP_GROUPS 29
106#define NSUP_ARGEAS 30
107#define NSUP_FOP7 31
108#define NSUP_FOP8 32
109#define NSUP_REF6 33
110#define NSUP_REF7 34
111#define NSUP_OREF6 35
112#define NSUP_OREF7 36
113#define NSUP_EX_FLAGS 37
114
115// values E_PREV..E_NEXT+1000 are reserved (1000..2000..3000 decimal)
116
119#define NSUP_POINTS 0x1000
120
123#define NSUP_MANUAL 0x2000
124
127#define NSUP_TYPEINFO 0x3000
128
131#define NSUP_REGVAR 0x4000
132
135#define NSUP_LLABEL 0x5000
136
139#define NSUP_REGARG 0x6000
140
143#define NSUP_FTAILS 0x7000
144
147#define NSUP_GROUP 0x8000
148
151#define NSUP_OPTYPES 0x9000
152
155#define NSUP_ORIGFMD 0x109000
156
159#define NSUP_FRAME 0x10A000
160
162
166#define NALT_CREF_TO 'X'
167#define NALT_CREF_FROM 'x'
168#define NALT_DREF_TO 'D'
169#define NALT_DREF_FROM 'd'
171
175#define NSUP_GR_INFO 'g'
176#define NALT_GR_LAYX 'p'
177#define NSUP_GR_LAYT 'l'
179
181#define PATCH_TAG 'P'
182
185#define IDB_DESKTOPS_NODE_NAME "$ desktops"
187#define IDB_DESKTOPS_TAG 'S'
188#define IDB_DESKTOPS_TIMESTAMP nodeidx_t(-1)
191
192
194
195idaman nodeidx_t ida_export ea2node(ea_t ea);
196idaman ea_t ida_export node2ea(nodeidx_t ndx);
197idaman nodeidx_t ida_export end_ea2node(ea_t ea);
198inline netnode getnode(ea_t ea) { return netnode(ea2node(ea)); }
199
200//--------------------------------------------------------------------------
201// C O N V E N I E N C E F U N C T I O N S
202//--------------------------------------------------------------------------
203
208
209idaman tid_t ida_export get_strid(ea_t ea);
210
212
218{
220 uchar type; // the type of xref (::cref_t & ::dref_t)
221 xrefpos_t(ea_t ea_ = BADADDR, uchar type_ = 0) : ea(ea_), type(type_) {}
222 bool is_valid() const { return ea != BADADDR; }
223};
224
225idaman ssize_t ida_export get_xrefpos(xrefpos_t *out, ea_t ea);
226idaman void ida_export set_xrefpos(ea_t ea, const xrefpos_t *in);
227inline void idaapi del_xrefpos(ea_t ea) { getnode(ea).supdel(NSUP_XREFPOS); }
228
230
237#define AFL_LINNUM 0x00000001
238#define AFL_USERSP 0x00000002
239#define AFL_PUBNAM 0x00000004
240#define AFL_WEAKNAM 0x00000008
241#define AFL_HIDDEN 0x00000010
242#define AFL_MANUAL 0x00000020
243#define AFL_NOBRD 0x00000040
244#define AFL_ZSTROFF 0x00000080
249#define AFL_BNOT0 0x00000100
250#define AFL_BNOT1 0x00000200
251#define AFL_LIB 0x00000400
254#define AFL_TI 0x00000800
255#define AFL_TI0 0x00001000
256#define AFL_TI1 0x00002000
257#define AFL_LNAME 0x00004000
258#define AFL_TILCMT 0x00008000
259#define AFL_LZERO0 0x00010000
260#define AFL_LZERO1 0x00020000
261#define AFL_COLORED 0x00040000
262#define AFL_TERSESTR 0x00080000
263#define AFL_SIGN0 0x00100000
264#define AFL_SIGN1 0x00200000
265#define AFL_NORET 0x00400000
268#define AFL_FIXEDSPD 0x00800000
270#define AFL_ALIGNFLOW 0x01000000
271#define AFL_USERTI 0x02000000
274#define AFL_RETFP 0x04000000
275#define AFL_USEMODSP 0x08000000
277#define AFL_NOTCODE 0x10000000
278#define AFL_NOTPROC 0x20000000
279#define AFL_TYPE_GUESSED 0xC2000000
280#define AFL_IDA_GUESSED 0x00000000
281#define AFL_HR_GUESSED_FUNC 0x40000000
282#define AFL_HR_GUESSED_DATA 0x80000000
283#define AFL_HR_DETERMINED 0xC0000000
285
290
291idaman void ida_export set_aflags(ea_t ea, aflags_t flags);
292idaman void ida_export upd_abits(ea_t ea, aflags_t clr_bits, aflags_t set_bits);
293idaman void ida_export set_abits(ea_t ea, aflags_t bits);
294idaman void ida_export clr_abits(ea_t ea, aflags_t bits);
295idaman aflags_t ida_export get_aflags(ea_t ea);
296idaman void ida_export del_aflags(ea_t ea);
297
298inline constexpr bool has_aflag_linnum(aflags_t flags) { return (flags & AFL_LINNUM) != 0; }
299inline constexpr bool is_aflag_usersp(aflags_t flags) { return (flags & AFL_USERSP) != 0; }
300inline constexpr bool is_aflag_public_name(aflags_t flags) { return (flags & AFL_PUBNAM) != 0; }
301inline constexpr bool is_aflag_weak_name(aflags_t flags) { return (flags & AFL_WEAKNAM) != 0; }
302inline constexpr bool is_aflag_hidden_item(aflags_t flags) { return (flags & AFL_HIDDEN) != 0; }
303inline constexpr bool is_aflag_manual_insn(aflags_t flags) { return (flags & AFL_MANUAL) != 0; }
304inline constexpr bool is_aflag_hidden_border(aflags_t flags) { return (flags & AFL_NOBRD) != 0; }
305inline constexpr bool is_aflag_zstroff(aflags_t flags) { return (flags & AFL_ZSTROFF) != 0; }
306inline constexpr bool is_aflag__bnot0(aflags_t flags) { return (flags & AFL_BNOT0) != 0; }
307inline constexpr bool is_aflag__bnot1(aflags_t flags) { return (flags & AFL_BNOT1) != 0; }
308inline constexpr bool is_aflag_libitem(aflags_t flags) { return (flags & AFL_LIB) != 0; }
309inline constexpr bool has_aflag_ti(aflags_t flags) { return (flags & AFL_TI) != 0; }
310inline constexpr bool has_aflag_ti0(aflags_t flags) { return (flags & AFL_TI0) != 0; }
311inline constexpr bool has_aflag_ti1(aflags_t flags) { return (flags & AFL_TI1) != 0; }
312inline constexpr bool has_aflag_lname(aflags_t flags) { return (flags & AFL_LNAME) != 0; }
313inline constexpr bool is_aflag_tilcmt(aflags_t flags) { return (flags & AFL_TILCMT) != 0; }
314inline constexpr bool is_aflag_lzero0(aflags_t flags) { return (flags & AFL_LZERO0) != 0; }
315inline constexpr bool is_aflag_lzero1(aflags_t flags) { return (flags & AFL_LZERO1) != 0; }
316inline constexpr bool is_aflag_colored_item(aflags_t flags) { return (flags & AFL_COLORED) != 0; }
317inline constexpr bool is_aflag_terse_struc(aflags_t flags) { return (flags & AFL_TERSESTR) != 0; }
318inline constexpr bool is_aflag__invsign0(aflags_t flags) { return (flags & AFL_SIGN0) != 0; }
319inline constexpr bool is_aflag__invsign1(aflags_t flags) { return (flags & AFL_SIGN1) != 0; }
320inline constexpr bool is_aflag_noret(aflags_t flags) { return (flags & AFL_NORET) != 0; }
321inline constexpr bool is_aflag_fixed_spd(aflags_t flags) { return (flags & AFL_FIXEDSPD) != 0; }
322inline constexpr bool is_aflag_align_flow(aflags_t flags) { return (flags & AFL_ALIGNFLOW)!= 0; }
323inline constexpr bool is_aflag_userti(aflags_t flags) { return (flags & AFL_USERTI) != 0; }
324inline constexpr bool is_aflag_retfp(aflags_t flags) { return (flags & AFL_RETFP) != 0; }
325inline constexpr bool uses_aflag_modsp(aflags_t flags) { return (flags & AFL_USEMODSP) != 0; }
326inline constexpr bool is_aflag_notcode(aflags_t flags) { return (flags & AFL_NOTCODE) != 0; }
327inline constexpr bool is_aflag_notproc(aflags_t flags) { return (flags & AFL_NOTPROC) != 0; }
328inline constexpr bool is_aflag_type_guessed_by_ida(aflags_t flags) { return (flags & AFL_TYPE_GUESSED) == AFL_IDA_GUESSED; }
329inline constexpr bool is_aflag_func_guessed_by_hexrays(aflags_t flags) { return (flags & AFL_TYPE_GUESSED) == AFL_HR_GUESSED_FUNC; }
330inline constexpr bool is_aflag_data_guessed_by_hexrays(aflags_t flags) { return (flags & AFL_TYPE_GUESSED) == AFL_HR_GUESSED_DATA; }
331inline constexpr bool is_aflag_type_determined_by_hexrays(aflags_t flags) { return (flags & AFL_TYPE_GUESSED) == AFL_HR_DETERMINED; }
332inline constexpr bool is_aflag_type_guessed_by_hexrays(aflags_t flags)
333{
334 return (flags & AFL_TYPE_GUESSED) == AFL_HR_GUESSED_FUNC
335 || (flags & AFL_TYPE_GUESSED) == AFL_HR_GUESSED_DATA
336 || (flags & AFL_TYPE_GUESSED) == AFL_HR_DETERMINED;
337}
338
339inline bool is_hidden_item(ea_t ea) { return is_aflag_hidden_item(get_aflags(ea)); }
340inline void hide_item(ea_t ea) { set_abits(ea, AFL_HIDDEN); }
341inline void unhide_item(ea_t ea) { clr_abits(ea, AFL_HIDDEN); }
342
344inline void hide_border(ea_t ea) { set_abits(ea, AFL_NOBRD); }
345inline void unhide_border(ea_t ea) { clr_abits(ea, AFL_NOBRD); }
346
347inline bool uses_modsp(ea_t ea) { return uses_aflag_modsp(get_aflags(ea)); }
348inline void set_usemodsp(ea_t ea) { set_abits(ea, AFL_USEMODSP); }
349inline void clr_usemodsp(ea_t ea) { clr_abits(ea, AFL_USEMODSP); }
350
351inline bool is_zstroff(ea_t ea) { return is_aflag_zstroff(get_aflags(ea)); }
352inline void set_zstroff(ea_t ea) { set_abits(ea, AFL_ZSTROFF); }
353inline void clr_zstroff(ea_t ea) { clr_abits(ea, AFL_ZSTROFF); }
354
355inline bool is__bnot0(ea_t ea) { return is_aflag__bnot0(get_aflags(ea)); }
356inline void set__bnot0(ea_t ea) { set_abits(ea, AFL_BNOT0); }
357inline void clr__bnot0(ea_t ea) { clr_abits(ea, AFL_BNOT0); }
358
359inline bool is__bnot1(ea_t ea) { return is_aflag__bnot1(get_aflags(ea)); }
360inline void set__bnot1(ea_t ea) { set_abits(ea, AFL_BNOT1); }
361inline void clr__bnot1(ea_t ea) { clr_abits(ea, AFL_BNOT1); }
362
363inline bool is_libitem(ea_t ea) { return is_aflag_libitem(get_aflags(ea)); }
364inline void set_libitem(ea_t ea) { set_abits(ea, AFL_LIB); }
365inline void clr_libitem(ea_t ea) { clr_abits(ea, AFL_LIB); }
366
367inline bool has_ti(ea_t ea) { return has_aflag_ti(get_aflags(ea)); }
368inline void set_has_ti(ea_t ea) { set_abits(ea, AFL_TI); }
369inline void clr_has_ti(ea_t ea) { clr_abits(ea, AFL_TI); }
370
371inline bool has_ti0(ea_t ea) { return has_aflag_ti0(get_aflags(ea)); }
372inline void set_has_ti0(ea_t ea) { set_abits(ea, AFL_TI0); }
373inline void clr_has_ti0(ea_t ea) { clr_abits(ea, AFL_TI0); }
374
375inline bool has_ti1(ea_t ea) { return has_aflag_ti1(get_aflags(ea)); }
376inline void set_has_ti1(ea_t ea) { set_abits(ea, AFL_TI1); }
377inline void clr_has_ti1(ea_t ea) { clr_abits(ea, AFL_TI1); }
378
379inline bool has_lname(ea_t ea) { return has_aflag_lname(get_aflags(ea)); }
380inline void set_has_lname(ea_t ea) { set_abits(ea, AFL_LNAME); }
381inline void clr_has_lname(ea_t ea) { clr_abits(ea, AFL_LNAME); }
382
383inline bool is_tilcmt(ea_t ea) { return is_aflag_tilcmt(get_aflags(ea)); }
384inline void set_tilcmt(ea_t ea) { set_abits(ea, AFL_TILCMT); }
385inline void clr_tilcmt(ea_t ea) { clr_abits(ea, AFL_TILCMT); }
386
387inline bool is_usersp(ea_t ea) { return is_aflag_usersp(get_aflags(ea)); }
388inline void set_usersp(ea_t ea) { set_abits(ea, AFL_USERSP); }
389inline void clr_usersp(ea_t ea) { clr_abits(ea, AFL_USERSP); }
390
391inline bool is_lzero0(ea_t ea) { return is_aflag_lzero0(get_aflags(ea)); }
392inline void set_lzero0(ea_t ea) { set_abits(ea, AFL_LZERO0); }
393inline void clr_lzero0(ea_t ea) { clr_abits(ea, AFL_LZERO0); }
394
395inline bool is_lzero1(ea_t ea) { return is_aflag_lzero1(get_aflags(ea)); }
396inline void set_lzero1(ea_t ea) { set_abits(ea, AFL_LZERO1); }
397inline void clr_lzero1(ea_t ea) { clr_abits(ea, AFL_LZERO1); }
398
399inline bool is_colored_item(ea_t ea) { return is_aflag_colored_item(get_aflags(ea)); }
400inline void set_colored_item(ea_t ea) { set_abits(ea, AFL_COLORED); } // use set_item_color()
401inline void clr_colored_item(ea_t ea) { clr_abits(ea, AFL_COLORED); } // use del_item_color()
402
403inline bool is_terse_struc(ea_t ea) { return is_aflag_terse_struc(get_aflags(ea)); }
404inline void set_terse_struc(ea_t ea) { set_abits(ea, AFL_TERSESTR); }
405inline void clr_terse_struc(ea_t ea) { clr_abits(ea, AFL_TERSESTR); }
406
407inline bool is__invsign0(ea_t ea) { return is_aflag__invsign0(get_aflags(ea)); }
408inline void set__invsign0(ea_t ea) { set_abits(ea, AFL_SIGN0); }
409inline void clr__invsign0(ea_t ea) { clr_abits(ea, AFL_SIGN0); }
410
411inline bool is__invsign1(ea_t ea) { return is_aflag__invsign1(get_aflags(ea)); }
412inline void set__invsign1(ea_t ea) { set_abits(ea, AFL_SIGN1); }
413inline void clr__invsign1(ea_t ea) { clr_abits(ea, AFL_SIGN1); }
414
415inline bool is_noret(ea_t ea) { return is_aflag_noret(get_aflags(ea)); }
416inline void set_noret(ea_t ea) { set_abits(ea, AFL_NORET); }
417inline void clr_noret(ea_t ea) { clr_abits(ea, AFL_NORET); }
418
419inline bool is_fixed_spd(ea_t ea) { return is_aflag_fixed_spd(get_aflags(ea)); }
420inline void set_fixed_spd(ea_t ea) { set_abits(ea, AFL_FIXEDSPD); }
421inline void clr_fixed_spd(ea_t ea) { clr_abits(ea, AFL_FIXEDSPD); }
422
423inline bool is_align_flow(ea_t ea) { return is_aflag_align_flow(get_aflags(ea)); }
424inline void set_align_flow(ea_t ea) { set_abits(ea, AFL_ALIGNFLOW); }
425inline void clr_align_flow(ea_t ea) { clr_abits(ea, AFL_ALIGNFLOW); }
426
427inline bool is_userti(ea_t ea) { return is_aflag_userti(get_aflags(ea)); }
428inline void set_userti(ea_t ea) { upd_abits(ea, AFL_TYPE_GUESSED, AFL_USERTI); }
429inline void clr_userti(ea_t ea) { clr_abits(ea, AFL_TYPE_GUESSED); } // use set_ida_guessed_type()
430
431inline bool is_retfp(ea_t ea) { return is_aflag_retfp(get_aflags(ea)); }
432inline void set_retfp(ea_t ea) { set_abits(ea, AFL_RETFP); }
433inline void clr_retfp(ea_t ea) { clr_abits(ea, AFL_RETFP); }
434
435inline bool is_notproc(ea_t ea) { return is_aflag_notproc(get_aflags(ea)); }
436inline void set_notproc(ea_t ea) { set_abits(ea, AFL_NOTPROC); }
437inline void clr_notproc(ea_t ea) { clr_abits(ea, AFL_NOTPROC); }
438
444
445inline void set_type_guessed_by_ida(ea_t ea) { upd_abits(ea, AFL_TYPE_GUESSED, AFL_IDA_GUESSED); }
446inline void set_func_guessed_by_hexrays(ea_t ea) { upd_abits(ea, AFL_TYPE_GUESSED, AFL_HR_GUESSED_FUNC); }
447inline void set_data_guessed_by_hexrays(ea_t ea) { upd_abits(ea, AFL_TYPE_GUESSED, AFL_HR_GUESSED_DATA); }
448inline void set_type_determined_by_hexrays(ea_t ea) { upd_abits(ea, AFL_TYPE_GUESSED, AFL_HR_DETERMINED); }
450
452idaman void ida_export set_notcode(ea_t ea);
453
455inline void clr_notcode(ea_t ea) { clr_abits(ea, AFL_NOTCODE); }
456
458inline bool is_notcode(ea_t ea) { return is_aflag_notcode(get_aflags(ea)); }
459
460
462
463inline void set_visible_item(ea_t ea, bool visible)
464{
465 if ( visible )
466 unhide_item(ea);
467 else
468 hide_item(ea);
469}
470
472
473inline bool is_visible_item(ea_t ea) { return !is_hidden_item(ea); }
474
475
477
479{
480 return (inf_get_cmtflg() & SCF_SHHID_ITEM) != 0 || is_visible_item(ea);
481}
482
483
487idaman void ida_export set_source_linnum(ea_t ea, uval_t lnnum);
488idaman uval_t ida_export get_source_linnum(ea_t ea);
489idaman void ida_export del_source_linnum(ea_t ea);
491
496{
497 ea_t x;
498 return getnode(ea).supval(NALT_ABSBASE, &x, sizeof(x), atag) > 0 ? ea_t(x-1) : ea_t(-1);
499}
500inline void set_absbase(ea_t ea, ea_t x)
501{
502 x++;
503 getnode(ea).supset(NALT_ABSBASE, &x, sizeof(x), atag);
504}
505inline void del_absbase(ea_t ea) { getnode(ea).supdel(NALT_ABSBASE, atag); }
507
513idaman ea_t ida_export get_ind_purged(ea_t ea);
514inline void set_ind_purged(ea_t ea, ea_t x)
515{
516 x++;
517 getnode(ea).supset(NALT_PURGE, &x, sizeof(x), atag);
518}
519inline void del_ind_purged(ea_t ea) { getnode(ea).supdel(NALT_PURGE, atag); }
521
525idaman uint32 ida_export get_str_type(ea_t ea);
526idaman void ida_export set_str_type(ea_t ea, uint32 x);
527idaman void ida_export del_str_type(ea_t ea);
529
530// Number of bytes per "units" in a string. E.g., ASCII, Windows-1252,
531// UTF-8 all take up one byte per unit, while UTF-16 variations take 2 and
532// UTF-32 variations take 4.
533// (Note that an "unit" in this context is not necessarily a character,
534// since UTF-8-encoded characters can be encoded in up to 4 bytes,
535// and UTF-16-encoded characters can be encoded in up to 2 bytes.)
536#define STRWIDTH_1B 0
537#define STRWIDTH_2B 1
538#define STRWIDTH_4B 2
539#define STRWIDTH_MASK 0x03
540
541// The string layout; how the string is laid out in data.
542#define STRLYT_TERMCHR 0
543#define STRLYT_PASCAL1 1
544#define STRLYT_PASCAL2 2
545#define STRLYT_PASCAL4 3
546#define STRLYT_MASK 0xFC
547#define STRLYT_SHIFT 2
548
549
554#define STRTYPE_TERMCHR (STRWIDTH_1B|STRLYT_TERMCHR<<STRLYT_SHIFT)
556#define STRTYPE_C STRTYPE_TERMCHR
558#define STRTYPE_C_16 (STRWIDTH_2B|STRLYT_TERMCHR<<STRLYT_SHIFT)
560#define STRTYPE_C_32 (STRWIDTH_4B|STRLYT_TERMCHR<<STRLYT_SHIFT)
562#define STRTYPE_PASCAL (STRWIDTH_1B|STRLYT_PASCAL1<<STRLYT_SHIFT)
564#define STRTYPE_PASCAL_16 (STRWIDTH_2B|STRLYT_PASCAL1<<STRLYT_SHIFT)
566#define STRTYPE_PASCAL_32 (STRWIDTH_4B|STRLYT_PASCAL1<<STRLYT_SHIFT)
568#define STRTYPE_LEN2 (STRWIDTH_1B|STRLYT_PASCAL2<<STRLYT_SHIFT)
570#define STRTYPE_LEN2_16 (STRWIDTH_2B|STRLYT_PASCAL2<<STRLYT_SHIFT)
572#define STRTYPE_LEN2_32 (STRWIDTH_4B|STRLYT_PASCAL2<<STRLYT_SHIFT)
574#define STRTYPE_LEN4 (STRWIDTH_1B|STRLYT_PASCAL4<<STRLYT_SHIFT)
576#define STRTYPE_LEN4_16 (STRWIDTH_2B|STRLYT_PASCAL4<<STRLYT_SHIFT)
578#define STRTYPE_LEN4_32 (STRWIDTH_4B|STRLYT_PASCAL4<<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);
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}
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}
636
637#define STRENC_DEFAULT 0x00
638#define STRENC_NONE 0xFF
639
644inline uint32 get_alignment(ea_t ea)
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); }
655///@}
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
666//-------------------------------------------------------------------------
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};
691idaman ssize_t ida_export get_array_parameters(array_parameters_t *out, ea_t ea);
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); }
696//--------------------------------------------------------------------------
698struct switch_info_t
702
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
761 int get_jtable_element_size(void) const
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 }
792 int get_vtable_element_size(void) const
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;
838 ea_t jumps = BADADDR;
839 union
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; }
850 ea_t elbase = 0;
851
852 int regnum = -1;
854 op_dtype_t regdtype = 0;
856 int get_jtable_size(void) const { return is_indirect() ? jcases : ncases; }
858 {
859 if ( is_indirect() )
861 else
862 ncases = uint16(size);
864 void set_elbase(ea_t base)
866 elbase = base;
867 flags |= SWI_ELBASE;
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 {
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);
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
893 uval_t custom = 0;
894
895 enum { SWITCH_INFO_VERSION = 2 };
897 int get_version() const { return (flags & SWI_VERSION) == 0 ? 1 : version; }
898
899 // version 2
900 ea_t expr_ea = BADADDR;
903 eavec_t marks;
905 switch_info_t() : flags(SWI_VERSION), lowcase(0) {}
906 void clear() { *this = switch_info_t(); }
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);
919
920inline ea_t get_switch_parent(ea_t ea)
921{
922 ea_t x;
923 return getnode(ea).supval(NALT_SWITCH, &x, sizeof(x), atag) > 0 ? ea_t(x-1) : ea_t(-1);
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); }
931///@}
932
937{
938 int16 dtid;
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);
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); }
958
958///@}
959
960typedef uchar reftype_t;
962
966
972const reftype_t
973 V695_REF_OFF8 = 0,
974 REF_OFF16 = 1,
975 REF_OFF32 = 2,
976 REF_LOW8 = 3,
977 REF_LOW16 = 4,
978 REF_HIGH8 = 5,
979 REF_HIGH16 = 6,
980 V695_REF_VHIGH = 7,
981 V695_REF_VLOW = 8,
982 REF_OFF64 = 9,
983 REF_OFF8 = 10,
995idaman reftype_t ida_export get_reftype_by_size(size_t size);
996
998struct refinfo_t
999{
1000 ea_t target;
1001 ea_t base;
1002 adiff_t tdelta;
1003 uint32 flags;
1007#define REFINFO_TYPE 0x000F
1009#define REFINFO_RVAOFF 0x0010
1012#define REFINFO_PASTEND 0x0020
1015#define REFINFO_CUSTOM 0x0040
1019#define REFINFO_NOBASE 0x0080
1023#define REFINFO_SUBTRACT 0x0100
1024#define REFINFO_SIGNEDOP 0x0200
1025#define REFINFO_NO_ZEROS 0x0400
1026#define REFINFO_NO_ONES 0x0800
1027#define REFINFO_SELFREF 0x1000
1030
1031 reftype_t type(void) const
1032 {
1033 return reftype_t(flags & (REFINFO_TYPE | REFINFO_CUSTOM));
1034 }
1035
1036 bool is_target_optional() const
1037 {
1038 reftype_t rt = flags & (REFINFO_TYPE | REFINFO_CUSTOM);
1039 return is_reftype_target_optional(rt);
1040 }
1041
1042 bool no_base_xref(void) const { return (flags & REFINFO_NOBASE) != 0; }
1043 bool is_pastend(void) const { return (flags & REFINFO_PASTEND) != 0; }
1044 bool is_rvaoff(void) const { return (flags & REFINFO_RVAOFF) != 0; }
1045 bool is_custom(void) const { return (flags & REFINFO_CUSTOM) != 0; }
1046 bool is_subtract(void) const { return (flags & REFINFO_SUBTRACT) != 0; }
1047 bool is_signed(void) const { return (flags & REFINFO_SIGNEDOP) != 0; }
1048 bool is_no_zeros(void) const { return (flags & REFINFO_NO_ZEROS) != 0; }
1049 bool is_no_ones(void) const { return (flags & REFINFO_NO_ONES) != 0; }
1050 bool is_selfref(void) const { return (flags & REFINFO_SELFREF) != 0; }
1051
1052 // RT can include REFINFO_CUSTOM bit
1055 flags &= ~(REFINFO_TYPE | REFINFO_CUSTOM);
1056 flags |= rt;
1059 // init the structure with some default values
1060 // reft_and_flags should be REF_xxx optionally ORed with some REFINFO_xxx flags
1061 void init(uint32 reft_and_flags, ea_t _base = 0, ea_t _target = BADADDR, adiff_t _tdelta = 0)
1062 {
1063 flags = reft_and_flags;
1064 base = _base;
1065 target = _target;
1066 tdelta = _tdelta;
1067 }
1068
1069 // internal use
1070#ifndef SWIG
1071 bool _require_base() const { return !is_rvaoff() && !is_selfref(); }
1073#endif
1074};
1075
1080{
1081 int32 cbsize;
1082 const char *name;
1083 const char *desc;
1084 int props;
1086
1088#define RHF_TGTOPT 0x0001
1090///@}
1091
1092 // this callback prepares the full offset expression in buf and
1093 // returns 1 if it is a simple expression or 2 if it is a complex one.
1094 // Or this callback checks the compliance of opval and fullvalue,
1095 // and possibly updates values of target and fullvalue,
1096 // and prepares the format,
1097 // and returns 3 to continue standard processing with updated values.
1098 // Or this callback just prepares the format and returns 4 to continue.
1099 // It returns 0 in the case of error.
1100 // It is guaranteed that before calling this callback, the
1101 // calc_reference_data() callback is always called.
1102 int (idaapi *gen_expr)(
1103 qstring *buf,
1104 qstring *format, // buffer for the format (if retcode>=3)
1105 ea_t ea,
1106 int opnum,
1107 const refinfo_t &ri,
1108 ea_t from,
1109 adiff_t *opval, // the output value is not used
1110 ea_t *target, // the target prepared by calc_reference_data()
1111 ea_t *fullvalue,
1112 int getn_flags);
1114 // this callback replaces calc_target.
1115 // It calculates target and base,
1116 // and calculates an internal variable fullvalue,
1117 // and checks the compliance of opval and fullvalue,
1118 // and returns the success flag.
1124 adiff_t opval);
1125
1126 // just custom format
1127 void (idaapi *get_format)(qstring *format);
1128
1129#ifndef SWIG
1131#endif
1136
1137idaman int ida_export register_custom_refinfo(const custom_refinfo_handler_t *crh);
1139
1142idaman bool ida_export unregister_custom_refinfo(int crid);
1143
1144
1146
1147idaman int ida_export find_custom_refinfo(const char *name);
1149
1151
1152idaman const custom_refinfo_handler_t *ida_export get_custom_refinfo(int crid);
1154
1156
1158 const refinfo_t &ri)
1159{
1160 return ri.is_custom() ? get_custom_refinfo(ri.type()) : nullptr;
1161}
1162
1163// inline implementaion
1165{
1166 if ( (type & REFINFO_CUSTOM) != 0 )
1167 {
1169 if ( cfh == nullptr )
1170 return false;
1171 return (cfh->props & RHF_TGTOPT) != 0;
1172 }
1173 switch ( type )
1174 {
1176 case REF_OFF16:
1177 case REF_OFF32:
1178 case REF_OFF64:
1179 return true;
1180 }
1181 return false;
1182}
1183
1184
1186
1187struct refinfo_desc_t
1188{
1189 uint32 type;
1191 const char *name;
1192 const char *desc;
1193};
1196idaman void ida_export get_refinfo_descs(refinfo_desc_vec_t *descs);
1197
1199#define MAXSTRUCPATH 32
1205
1208 int len;
1209 tid_t ids[MAXSTRUCPATH]; // for union member ids
1210 adiff_t delta;
1211#ifndef SWIG
1213#endif
1214};
1215
1218{
1221#ifndef SWIG
1224 COMPARE_FIELDS(tid);
1225 COMPARE_FIELDS(serial);
1226 return 0;
1227 }
1228#endif
1229};
1232union opinfo_t
1234 refinfo_t ri;
1235 tid_t tid;
1236 strpath_t path;
1237 int32 strtype;
1240#ifndef SWIG
1241 int compare_opinfos(const opinfo_t &r, flags64_t flag, int n) const;
1242#endif
1244
1245//-------------------------------------------------------------------------
1249 uint32 unused = 0; // not used anymore, use flags64 instead (kept for backward compat)
1250 opinfo_t ti; // new operand type
1251#define POF_VALID_TI 0x1 // is operand type initialized?
1252#define POF_VALID_AFLAGS 0x2 // internal
1253#define POF_IS_F64 0x4 // internal
1254 uchar features; // features this instance holds
1255 int suspop = 0; // out: will be set by print_operand()
1256 aflags_t aflags = 0; // additional aflags
1257 flags64_t flags = 0; // new operand representation flags
1259 printop_t() : features(POF_IS_F64) { memset(&ti, 0, sizeof(ti)); }
1260 bool is_ti_initialized() const { return (features & POF_VALID_TI) != 0; }
1261 void set_ti_initialized(bool v=true) { setflag(features, POF_VALID_TI, v); }
1262 bool is_aflags_initialized() const { return (features & POF_VALID_AFLAGS) != 0; }
1263 void set_aflags_initialized(bool v=true) { setflag(features, POF_VALID_AFLAGS, v); }
1264 bool is_f64() const { return (features & POF_IS_F64) != 0; }
1266 const opinfo_t *get_ti() const { return is_ti_initialized() ? &ti : nullptr; }
1274idaman bool ida_export set_refinfo_ex(ea_t ea, int n, const refinfo_t *ri);
1275idaman bool ida_export set_refinfo(
1276 ea_t ea,
1277 int n,
1279 ea_t target=BADADDR,
1280 ea_t base=0,
1281 adiff_t tdelta=0);
1282idaman bool ida_export get_refinfo(refinfo_t *ri, ea_t ea, int n);
1283idaman bool ida_export del_refinfo(ea_t ea, int n);
1286//--------------------------------------------------------------------------
1295idaman void ida_export write_struc_path(ea_t ea, int idx, const tid_t *path, int plen, adiff_t delta);
1296idaman int ida_export read_struc_path(tid_t *path, adiff_t *delta, ea_t ea, int idx); // returns plen
1298
1300
1301
1302//--------------------------------------------------------------------------
1303// type information (ti) storage
1304// up to 256 operands are supported for ti.
1305
1308class tinfo_t;
1309
1314idaman bool ida_export get_tinfo(tinfo_t *tif, ea_t ea);
1315idaman bool ida_export set_tinfo(ea_t ea, const tinfo_t *tif);
1316inline void idaapi del_tinfo(ea_t ea) { set_tinfo(ea, nullptr); }
1322idaman bool ida_export get_op_tinfo(tinfo_t *tif, ea_t ea, int n);
1323idaman bool ida_export set_op_tinfo(ea_t ea, int n, const tinfo_t *tif);
1324inline void idaapi del_op_tinfo(ea_t ea, int n) { set_op_tinfo(ea, n, nullptr); }
1327//------------------------------------------------------------------------//
1330
1331// supvals
1332#define RIDX_FILE_FORMAT_NAME 1
1333#define RIDX_SELECTORS 2
1334#define RIDX_GROUPS 64
1335#define RIDX_H_PATH 65
1336#define RIDX_C_MACROS 66
1337#define RIDX_SMALL_IDC_OLD 67
1338#define RIDX_NOTEPAD 68
1339#define RIDX_INCLUDE 1100
1340#define RIDX_SMALL_IDC 1200
1341#define RIDX_DUALOP_GRAPH 1300
1342#define RIDX_DUALOP_TEXT 1301
1343#define RIDX_MD5 1302
1344#define RIDX_IDA_VERSION 1303
1345
1346#define RIDX_STR_ENCODINGS 1305
1347#define RIDX_SRCDBG_PATHS 1306
1348#define RIDX_DBG_BINPATHS 1328
1349#define RIDX_SHA256 1349
1350#define RIDX_ABINAME 1350
1351#define RIDX_ARCHIVE_PATH 1351
1352#define RIDX_PROBLEMS 1352
1353#define RIDX_SRCDBG_UNDESIRED 1353
1354
1355// altvals
1356#define RIDX_ALT_VERSION uval_t(-1)
1357#define RIDX_ALT_CTIME uval_t(-2)
1358#define RIDX_ALT_ELAPSED uval_t(-3)
1359#define RIDX_ALT_NOPENS uval_t(-4)
1360#define RIDX_ALT_CRC32 uval_t(-5)
1361#define RIDX_ALT_IMAGEBASE uval_t(-6)
1362#define RIDX_ALT_IDSNODE uval_t(-7)
1363#define RIDX_ALT_FSIZE uval_t(-8)
1364#define RIDX_ALT_OUTFILEENC uval_t(-9)
1366
1367//---------------------------------------------------------------------------
1369idaman ssize_t ida_export get_root_filename(char *buf, size_t bufsize);
1370
1372idaman ssize_t ida_export dbg_get_input_path(char *buf, size_t bufsize);
1373
1374// The following functions should eventually be replaced by exported functions
1375#ifndef __KERNEL__
1377inline ssize_t idaapi get_input_file_path(char *buf, size_t bufsize)
1378{
1381
1383inline void set_root_filename(const char *file) { setinf_buf(INF_INPUT_FILE_PATH, file); }
1384
1386inline size_t idaapi retrieve_input_file_size(void) { return getinf(INF_FSIZE); }
1387
1388/// Get input file crc32 stored in the database.
1389/// it can be used to check that the input file has not been changed.
1390inline uint32 idaapi retrieve_input_file_crc32(void) { return uint32(getinf(INF_CRC32)); }
1391
1392
1393inline bool idaapi retrieve_input_file_md5(uchar hash[16]) { return getinf_buf(INF_MD5, hash, 16) == 16; }
1396inline bool idaapi retrieve_input_file_sha256(uchar hash[32]) { return getinf_buf(INF_SHA256, hash, 32) == 32; }
1399inline ssize_t idaapi get_asm_inc_file(qstring *buf) { return getinf_str(buf, INF_INCLUDE); }
1400
1402inline bool idaapi set_asm_inc_file(const char *file) { return setinf_buf(INF_INCLUDE, file); }
1403
1405inline ea_t idaapi get_imagebase(void) { return getinf(INF_IMAGEBASE); }
1406
1408inline void idaapi set_imagebase(ea_t base) { setinf(INF_IMAGEBASE, base); }
1409
1411inline netnode idaapi get_ids_modnode(void) { return getinf(INF_IDSNODE); }
1412
1414inline void idaapi set_ids_modnode(netnode id) { setinf(INF_IDSNODE, id); }
1415
1417inline ssize_t idaapi get_archive_path(qstring *out) { return getinf_str(out, INF_ARCHIVE_PATH); }
1418
1420inline bool set_archive_path(const char *file) { return setinf_buf(INF_ARCHIVE_PATH, file); }
1421
1423inline ssize_t idaapi get_loader_format_name(qstring *out) { return getinf_str(out, INF_FILE_FORMAT_NAME); }
1424
1426inline void set_loader_format_name(const char *name) { setinf_buf(INF_FILE_FORMAT_NAME, name); }
1427
1429inline ssize_t idaapi get_initial_ida_version(qstring *out) { return getinf_str(out, INF_IDA_VERSION); }
1430
1432inline ssize_t idaapi get_ida_notepad_text(qstring *out) { return getinf_str(out, INF_NOTEPAD); }
1433
1435inline void idaapi set_ida_notepad_text(const char *text, size_t size=0) { setinf_buf(INF_NOTEPAD, text, size); }
1436
1438inline ssize_t idaapi get_srcdbg_paths(qstring *out) { return getinf_str(out, INF_SRCDBG_PATHS); }
1439
1441inline void idaapi set_srcdbg_paths(const char *paths) { setinf_buf(INF_SRCDBG_PATHS, paths); }
1442
1444inline ssize_t idaapi get_srcdbg_undesired_paths(qstring *out) { return getinf_str(out, INF_SRCDBG_UNDESIRED); }
1445
1447inline void idaapi set_srcdbg_undesired_paths(const char *paths) { setinf_buf(INF_SRCDBG_UNDESIRED, paths); }
1448
1450inline ushort idaapi get_initial_idb_version() { return getinf(INF_INITIAL_VERSION); }
1451
1453inline time_t idaapi get_idb_ctime() { return getinf(INF_CTIME); }
1454
1456inline size_t idaapi get_elapsed_secs() { return getinf(INF_ELAPSED); }
1457
1459inline size_t idaapi get_idb_nopens() { return getinf(INF_NOPENS); }
1460
1461#endif
1462
1463//---------------------------------------------------------------------------
1472
1473idaman int ida_export get_encoding_qty();
1474
1475
1480
1481idaman const char *ida_export get_encoding_name(int idx);
1482
1483
1488
1489idaman int ida_export add_encoding(const char *encname);
1490
1491
1497
1498idaman bool ida_export del_encoding(int idx);
1499
1507
1508idaman bool ida_export rename_encoding(int idx, const char *encname);
1510
1511#define BPU_1B 1
1512#define BPU_2B 2
1513#define BPU_4B 4
1514
1520idaman int ida_export get_encoding_bpu(int idx);
1521
1522
1526idaman int ida_export get_encoding_bpu_by_name(const char *encname);
1527
1528
1529//-------------------------------------------------------------------------
1530inline int get_strtype_bpu(int32 strtype)
1532 int w = get_str_type_code(strtype) & STRWIDTH_MASK;
1533 return w == STRWIDTH_2B ? BPU_2B
1534 : w == STRWIDTH_4B ? BPU_4B
1535 : BPU_1B;
1536}
1542idaman int ida_export get_default_encoding_idx(int bpu);
1543
1544
1548
1549idaman bool ida_export set_default_encoding_idx(int bpu, int idx);
1550
1551
1555
1556inline const char *idaapi encoding_from_strtype(int32 strtype)
1557{
1558 uchar enc = get_str_encoding_idx(strtype);
1559 if ( enc == STRENC_DEFAULT )
1561 return get_encoding_name(enc);
1562}
1563
1564
1568idaman int ida_export get_outfile_encoding_idx();
1569
1570
1574
1575idaman bool ida_export set_outfile_encoding_idx(int idx);
1576
1577
1580//------------------------------------------------------------------------//
1583
1585
1586idaman uint ida_export get_import_module_qty();
1587
1588
1592
1593idaman bool ida_export get_import_module_name(qstring *buf, int mod_index);
1594
1595
1603
1604typedef int idaapi import_enum_cb_t(ea_t ea, const char *name, uval_t ord, void *param);
1605
1606
1611
1612idaman int ida_export enum_import_names(int mod_index, import_enum_cb_t *callback, void *param=nullptr);
1613
1614
1616
1617idaman void ida_export delete_imports(void);
1619
1620
1622
1623idaman int ida_export validate_idb_names(bool do_repair);
1624
1625
1626#define GOTEA_NODE_NAME "$ got"
1627#define GOTEA_NODE_IDX 0
1629//--------------------------------------------------------------------------
1630// Set address of .got section
1631inline void set_gotea(ea_t gotea)
1632{
1633 netnode n;
1634 n.create(GOTEA_NODE_NAME);
1635 n.altset(GOTEA_NODE_IDX, ea2node(gotea)+1);
1636}
1637
1638//--------------------------------------------------------------------------
1639// Get address of .got section
1640inline ea_t get_gotea(void)
1641{
1642 netnode n(GOTEA_NODE_NAME);
1643 return exist(n) ? node2ea(n.altval(GOTEA_NODE_IDX) - 1) : BADADDR;
1644}
1645
1646
1647#ifndef BYTES_SOURCE // undefined bit masks so no one can use them directly
1648#undef AFL_LINNUM
1649#undef AFL_USERSP
1650#undef AFL_PUBNAM
1651#undef AFL_WEAKNAM
1652#undef AFL_HIDDEN
1653#undef AFL_MANUAL
1654#undef AFL_NOBRD
1655#undef AFL_ZSTROFF
1656#undef AFL_BNOT0
1657#undef AFL_BNOT1
1658#undef AFL_LIB
1659#undef AFL_TI
1660#undef AFL_TI0
1661#undef AFL_TI1
1662#undef AFL_LNAME
1663#undef AFL_TILCMT
1664#undef AFL_LZERO0
1665#undef AFL_LZERO1
1666#undef AFL_COLORED
1667#undef AFL_TERSESTR
1668#undef AFL_SIGN0
1669#undef AFL_SIGN1
1670#undef AFL_NORET
1671#undef AFL_FIXEDSPD
1672#undef NALT_ENUM
1673#undef NALT_WIDE
1674#undef NALT_SWITCH
1675//#undef NALT_STRUCT
1676#undef NALT_XREFPOS
1677#undef NALT_AFLAGS
1678#undef NALT_LINNUM
1679#undef NALT_ABSBASE
1680//#undef NALT_ENUM0
1681//#undef NALT_ENUM1
1682#undef NALT_PURGE
1683#undef NALT_STRTYPE
1684#undef NALT_ALIGN
1685#undef NALT_COLOR
1686#undef NSUP_CMT
1687#undef NSUP_REPCMT
1688#undef NSUP_FOP1
1689#undef NSUP_FOP2
1690#undef NSUP_JINFO
1691#undef NSUP_ARRAY
1692#undef NSUP_OMFGRP
1693#undef NSUP_FOP3
1694#undef NSUP_SWITCH
1695#undef NSUP_REF0
1696#undef NSUP_REF1
1697#undef NSUP_REF2
1698#undef NSUP_OREF0
1699#undef NSUP_OREF1
1700#undef NSUP_OREF2
1701#undef NSUP_STROFF0
1702#undef NSUP_STROFF1
1703#undef NSUP_SEGTRANS
1704#undef NSUP_FOP4
1705#undef NSUP_FOP5
1706#undef NSUP_FOP6
1707#undef NSUP_FOP7
1708#undef NSUP_FOP8
1709#undef NSUP_REF3
1710#undef NSUP_REF4
1711#undef NSUP_REF5
1712#undef NSUP_REF6
1713#undef NSUP_REF7
1714#undef NSUP_OREF3
1715#undef NSUP_OREF4
1716#undef NSUP_OREF5
1717#undef NSUP_OREF6
1718#undef NSUP_OREF7
1719#undef NSUP_MANUAL
1720#undef NSUP_FTAILS
1721#undef NSUP_GROUP
1722#endif
1723
1724#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:2250
Primary mechanism for managing type information.
Definition typeinf.hpp:3046
const char * name
Definition typeinf.hpp:3211
const uchar atag
Array of altvals.
Definition netnode.hpp:126
int code
Definition fpro.h:88
idaman size_t n
Definition pro.h:997
const reftype_t V695_REF_OFF8
reserved
Definition nalt.hpp:984
const reftype_t REF_HIGH16
high 16bits of 32bit offset
Definition nalt.hpp:990
const reftype_t V695_REF_VHIGH
obsolete
Definition nalt.hpp:991
const reftype_t REF_OFF8
8bit full offset
Definition nalt.hpp:994
const reftype_t REF_HIGH8
high 8bits of 16bit offset
Definition nalt.hpp:989
const reftype_t REF_LOW8
low 8bits of 16bit offset
Definition nalt.hpp:987
const reftype_t REF_OFF32
32bit full offset
Definition nalt.hpp:986
const reftype_t REF_LOW16
low 16bits of 32bit offset
Definition nalt.hpp:988
const reftype_t REF_OFF64
64bit full offset
Definition nalt.hpp:993
const reftype_t REF_OFF16
16bit full offset
Definition nalt.hpp:985
const reftype_t V695_REF_VLOW
obsolete
Definition nalt.hpp:992
const reftype_t REF_LAST
Definition nalt.hpp:995
const tinfo_t & type
Definition hexrays.hpp:7301
Contains the inf structure definition and some functions common to the whole IDA project.
@ INF_INCLUDE
assembler include file name
Definition ida.hpp:515
@ INF_INPUT_FILE_PATH
Definition ida.hpp:540
@ INF_SRCDBG_UNDESIRED
user-closed source files, occupies 20 indexes
Definition ida.hpp:530
@ INF_SHA256
SHA256 of the input file.
Definition ida.hpp:522
@ INF_IMAGEBASE
image base
Definition ida.hpp:536
@ INF_FILE_FORMAT_NAME
file format name for loader modules
Definition ida.hpp:511
@ INF_CTIME
database creation timestamp
Definition ida.hpp:532
@ INF_SRCDBG_PATHS
source debug paths, occupies 20 indexes
Definition ida.hpp:529
@ INF_MD5
MD5 of the input file.
Definition ida.hpp:518
@ INF_FSIZE
input file size
Definition ida.hpp:538
@ INF_IDA_VERSION
version of ida which created the database
Definition ida.hpp:519
@ INF_INITIAL_VERSION
initial version of database
Definition ida.hpp:531
@ INF_NOTEPAD
notepad blob, occupies 1000 indexes (1MB of text)
Definition ida.hpp:528
@ INF_NOPENS
how many times the database is opened
Definition ida.hpp:534
@ INF_CRC32
input file crc32
Definition ida.hpp:535
@ INF_ELAPSED
seconds database stayed open
Definition ida.hpp:533
@ INF_ARCHIVE_PATH
archive file path
Definition ida.hpp:524
@ INF_IDSNODE
ids modnode id (for import_module)
Definition ida.hpp:537
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:889
uval_t uval_t
Definition kernwin.hpp:1878
idaman size_t len
Definition kernwin.hpp:1356
asize_t size
Definition kernwin.hpp:6339
void set_switch_parent(ea_t ea, ea_t x)
Definition nalt.hpp:936
bool idaapi set_asm_inc_file(const char *file)
Set name of the include file.
Definition nalt.hpp:1413
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:365
void set_type_guessed_by_ida(ea_t ea)
Definition nalt.hpp:445
constexpr bool is_aflag_hidden_border(aflags_t flags)
Definition nalt.hpp:304
void idaapi del_tinfo(ea_t ea)
Definition nalt.hpp:1327
bool uses_modsp(ea_t ea)
Definition nalt.hpp:347
void set_has_lname(ea_t ea)
Definition nalt.hpp:380
constexpr bool is_aflag_usersp(aflags_t flags)
Definition nalt.hpp:299
void clr_tilcmt(ea_t ea)
Definition nalt.hpp:385
size_t idaapi get_elapsed_secs()
Get seconds database stayed open.
Definition nalt.hpp:1467
bool is__invsign1(ea_t ea)
Definition nalt.hpp:411
size_t idaapi retrieve_input_file_size(void)
Get size of input file in bytes.
Definition nalt.hpp:1397
void set_has_ti0(ea_t ea)
Definition nalt.hpp:372
constexpr bool is_aflag_data_guessed_by_hexrays(aflags_t flags)
Definition nalt.hpp:330
void set_gotea(ea_t gotea)
Definition nalt.hpp:1642
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:1422
DECLARE_TYPE_AS_MOVABLE(refinfo_desc_t)
constexpr bool is_aflag_align_flow(aflags_t flags)
Definition nalt.hpp:322
bool is_libitem(ea_t ea)
Definition nalt.hpp:363
bool is_data_guessed_by_hexrays(ea_t ea)
Definition nalt.hpp:441
constexpr bool uses_aflag_modsp(aflags_t flags)
Definition nalt.hpp:325
void set_noret(ea_t ea)
Definition nalt.hpp:416
idaman bool ida_export get_tinfo(tinfo_t *tif, ea_t ea)
bool is__bnot0(ea_t ea)
Definition nalt.hpp:355
void set_retfp(ea_t ea)
Definition nalt.hpp:432
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:361
constexpr bool is_aflag__invsign0(aflags_t flags)
Definition nalt.hpp:318
idaman bool ida_export set_tinfo(ea_t ea, const tinfo_t *tif)
void set_usemodsp(ea_t ea)
Definition nalt.hpp:348
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:1440
void set__invsign0(ea_t ea)
Definition nalt.hpp:408
void clr_colored_item(ea_t ea)
Definition nalt.hpp:401
bool is_func_guessed_by_hexrays(ea_t ea)
Definition nalt.hpp:440
ssize_t idaapi get_input_file_path(char *buf, size_t bufsize)
Get full path of the input file.
Definition nalt.hpp:1388
bool is_tilcmt(ea_t ea)
Definition nalt.hpp:383
void del_switch_parent(ea_t ea)
Definition nalt.hpp:941
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:388
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:655
idaman int ida_export add_encoding(const char *encname)
Add a new encoding (e.g.
void set__bnot0(ea_t ea)
Definition nalt.hpp:356
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:478
constexpr bool is_aflag_tilcmt(aflags_t flags)
Definition nalt.hpp:313
bool is_userti(ea_t ea)
Definition nalt.hpp:427
qvector< refinfo_desc_t > refinfo_desc_vec_t
Definition nalt.hpp:1206
constexpr bool has_aflag_lname(aflags_t flags)
Definition nalt.hpp:312
void set_alignment(ea_t ea, uint32 x)
Definition nalt.hpp:660
void clr_has_ti(ea_t ea)
Definition nalt.hpp:369
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:1615
void idaapi set_srcdbg_undesired_paths(const char *paths)
Set user-closed source files.
Definition nalt.hpp:1458
bool is_hidden_item(ea_t ea)
Definition nalt.hpp:339
constexpr bool is_aflag_fixed_spd(aflags_t flags)
Definition nalt.hpp:321
void set_libitem(ea_t ea)
Definition nalt.hpp:364
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:495
THREAD_SAFE size_t get_str_type_prefix_length(int32 strtype)
Definition nalt.hpp:627
void clr_notproc(ea_t ea)
Definition nalt.hpp:437
void hide_border(ea_t ea)
Definition nalt.hpp:344
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:340
void set_visible_item(ea_t ea, bool visible)
Change visibility of item at given ea.
Definition nalt.hpp:463
void set__invsign1(ea_t ea)
Definition nalt.hpp:412
bool is_hidden_border(ea_t ea)
Definition nalt.hpp:343
void set_loader_format_name(const char *name)
Set file format name for loader modules.
Definition nalt.hpp:1437
void idaapi set_imagebase(ea_t base)
Set image base address.
Definition nalt.hpp:1419
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:387
void idaapi del_op_tinfo(ea_t ea, int n)
Definition nalt.hpp:1335
void set_root_filename(const char *file)
Set full path of the input file.
Definition nalt.hpp:1394
idaman void ida_export set_str_type(ea_t ea, uint32 x)
bool is_type_guessed_by_ida(ea_t ea)
Definition nalt.hpp:439
bool has_ti0(ea_t ea)
Definition nalt.hpp:371
void set_ind_purged(ea_t ea, ea_t x)
Definition nalt.hpp:514
idaman int ida_export get_encoding_qty()
Get total number of encodings (counted from 0)
bool has_lname(ea_t ea)
Definition nalt.hpp:379
bool has_ti(ea_t ea)
Definition nalt.hpp:367
const custom_refinfo_handler_t *idaapi get_custom_refinfo_handler(const refinfo_t &ri)
Get refinfo handler.
Definition nalt.hpp:1168
ea_t get_switch_parent(ea_t ea)
Definition nalt.hpp:931
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:424
constexpr bool is_aflag_noret(aflags_t flags)
Definition nalt.hpp:320
bool is_notcode(ea_t ea)
Is the address marked as not-code?
Definition nalt.hpp:458
constexpr bool is_aflag__invsign1(aflags_t flags)
Definition nalt.hpp:319
void clr_has_ti0(ea_t ea)
Definition nalt.hpp:373
constexpr bool is_aflag_type_guessed_by_ida(aflags_t flags)
Definition nalt.hpp:328
constexpr bool is_aflag_userti(aflags_t flags)
Definition nalt.hpp:323
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:608
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:341
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:1461
void idaapi set_srcdbg_paths(const char *paths)
Set source debug paths.
Definition nalt.hpp:1452
void clr_noret(ea_t ea)
Definition nalt.hpp:417
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:368
bool is_lzero0(ea_t ea)
Definition nalt.hpp:391
bool is_terse_struc(ea_t ea)
Definition nalt.hpp:403
void clr_notcode(ea_t ea)
Clear not-code mark.
Definition nalt.hpp:455
void set_lzero1(ea_t ea)
Definition nalt.hpp:396
void set_lzero0(ea_t ea)
Definition nalt.hpp:392
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:595
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:665
idaman void ida_export set_switch_info(ea_t ea, const switch_info_t &in)
void set_notproc(ea_t ea)
Definition nalt.hpp:436
void clr__bnot0(ea_t ea)
Definition nalt.hpp:357
void clr_has_ti1(ea_t ea)
Definition nalt.hpp:377
ea_t get_gotea(void)
Definition nalt.hpp:1651
void clr_terse_struc(ea_t ea)
Definition nalt.hpp:405
uchar type_t
In serialized form, a type is represented by a byte sequence.
Definition nalt.hpp:1317
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:603
idaman void ida_export set_array_parameters(ea_t ea, const array_parameters_t *in)
int get_strtype_bpu(int32 strtype)
Definition nalt.hpp:1541
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:349
void set_has_ti1(ea_t ea)
Definition nalt.hpp:376
void set_func_guessed_by_hexrays(ea_t ea)
Definition nalt.hpp:446
constexpr bool is_aflag_public_name(aflags_t flags)
Definition nalt.hpp:300
uint32 idaapi retrieve_input_file_crc32(void)
Get input file crc32 stored in the database.
Definition nalt.hpp:1401
flags_t aflags_t
Definition nalt.hpp:289
uchar p_list
several p_string's
Definition nalt.hpp:1318
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:407
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:1443
void clr_lzero0(ea_t ea)
Definition nalt.hpp:393
bool is_zstroff(ea_t ea)
Definition nalt.hpp:351
ssize_t idaapi get_srcdbg_paths(qstring *out)
Get source debug paths.
Definition nalt.hpp:1449
void clr_has_lname(ea_t ea)
Definition nalt.hpp:381
void set_absbase(ea_t ea, ea_t x)
Definition nalt.hpp:500
constexpr bool is_aflag_colored_item(aflags_t flags)
Definition nalt.hpp:316
ssize_t idaapi get_srcdbg_undesired_paths(qstring *out)
Get user-closed source files.
Definition nalt.hpp:1455
void clr_usersp(ea_t ea)
Definition nalt.hpp:389
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:309
bool set_archive_path(const char *file)
Set archive file path from which input file was extracted.
Definition nalt.hpp:1431
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:1175
void set_type_determined_by_hexrays(ea_t ea)
Definition nalt.hpp:448
void clr_fixed_spd(ea_t ea)
Definition nalt.hpp:421
bool is_fixed_spd(ea_t ea)
Definition nalt.hpp:419
constexpr bool has_aflag_linnum(aflags_t flags)
Definition nalt.hpp:298
void clr_retfp(ea_t ea)
Definition nalt.hpp:433
idaman void ida_export del_switch_info(ea_t ea)
constexpr bool is_aflag_zstroff(aflags_t flags)
Definition nalt.hpp:305
void clr_lzero1(ea_t ea)
Definition nalt.hpp:397
void set_data_guessed_by_hexrays(ea_t ea)
Definition nalt.hpp:447
bool is_noret(ea_t ea)
Definition nalt.hpp:415
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:352
idaman void ida_export get_refinfo_descs(refinfo_desc_vec_t *descs)
bool is_retfp(ea_t ea)
Definition nalt.hpp:431
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:1434
bool is_align_flow(ea_t ea)
Definition nalt.hpp:423
uchar reftype_t
see Types of references
Definition nalt.hpp:971
netnode getnode(ea_t ea)
Definition nalt.hpp:198
constexpr bool is_aflag_type_guessed_by_hexrays(aflags_t flags)
Definition nalt.hpp:332
bool is_colored_item(ea_t ea)
Definition nalt.hpp:399
void clr__invsign0(ea_t ea)
Definition nalt.hpp:409
void clr_userti(ea_t ea)
Definition nalt.hpp:429
constexpr bool is_aflag_notcode(aflags_t flags)
Definition nalt.hpp:326
constexpr bool has_aflag_ti0(aflags_t flags)
Definition nalt.hpp:310
void del_absbase(ea_t ea)
Definition nalt.hpp:505
void set_tilcmt(ea_t ea)
Definition nalt.hpp:384
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:1407
constexpr bool is_aflag_weak_name(aflags_t flags)
Definition nalt.hpp:301
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:302
void idaapi del_custom_data_type_ids(ea_t ea)
Definition nalt.hpp:968
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:443
void idaapi set_ids_modnode(netnode id)
Set ids modnode.
Definition nalt.hpp:1425
bool is_notproc(ea_t ea)
Definition nalt.hpp:435
size_t idaapi get_idb_nopens()
Get number of times the database is opened.
Definition nalt.hpp:1470
void set_colored_item(ea_t ea)
Definition nalt.hpp:400
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:314
void set__bnot1(ea_t ea)
Definition nalt.hpp:360
constexpr bool is_aflag_libitem(aflags_t flags)
Definition nalt.hpp:308
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:227
void set_userti(ea_t ea)
Definition nalt.hpp:428
THREAD_SAFE uchar idaapi get_str_encoding_idx(int32 strtype)
Get index of the string encoding for this string.
Definition nalt.hpp:601
ssize_t idaapi get_asm_inc_file(qstring *buf)
Get name of the include file.
Definition nalt.hpp:1410
THREAD_SAFE char get_str_term1(int32 strtype)
Definition nalt.hpp:596
void unhide_border(ea_t ea)
Definition nalt.hpp:345
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:621
idaman void ida_export set_aflags(ea_t ea, aflags_t flags)
void clr_align_flow(ea_t ea)
Definition nalt.hpp:425
constexpr bool is_aflag__bnot1(aflags_t flags)
Definition nalt.hpp:307
constexpr bool is_aflag_func_guessed_by_hexrays(aflags_t flags)
Definition nalt.hpp:329
bool has_ti1(ea_t ea)
Definition nalt.hpp:375
constexpr bool is_aflag_type_determined_by_hexrays(aflags_t flags)
Definition nalt.hpp:331
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:473
void clr__invsign1(ea_t ea)
Definition nalt.hpp:413
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:1446
bool idaapi retrieve_input_file_md5(uchar hash[16])
Get input file md5.
Definition nalt.hpp:1404
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:1428
const char *idaapi encoding_from_strtype(int32 strtype)
Get encoding name for this strtype.
Definition nalt.hpp:1567
idaman void ida_export set_source_linnum(ea_t ea, uval_t lnnum)
void set_fixed_spd(ea_t ea)
Definition nalt.hpp:420
constexpr bool is_aflag_manual_insn(aflags_t flags)
Definition nalt.hpp:303
bool is_type_determined_by_hexrays(ea_t ea)
Definition nalt.hpp:442
THREAD_SAFE char get_str_term2(int32 strtype)
Definition nalt.hpp:597
constexpr bool is_aflag_terse_struc(aflags_t flags)
Definition nalt.hpp:317
constexpr bool is_aflag_notproc(aflags_t flags)
Definition nalt.hpp:327
void idaapi del_array_parameters(ea_t ea)
Definition nalt.hpp:704
void clr_zstroff(ea_t ea)
Definition nalt.hpp:353
constexpr bool has_aflag_ti1(aflags_t flags)
Definition nalt.hpp:311
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:324
time_t idaapi get_idb_ctime()
Get database creation timestamp.
Definition nalt.hpp:1464
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:306
void set_terse_struc(ea_t ea)
Definition nalt.hpp:404
constexpr bool is_aflag_lzero1(aflags_t flags)
Definition nalt.hpp:315
ea_t idaapi get_imagebase(void)
Get image base address.
Definition nalt.hpp:1416
bool is__bnot1(ea_t ea)
Definition nalt.hpp:359
void del_ind_purged(ea_t ea)
Definition nalt.hpp:519
idaman void ida_export set_item_color(ea_t ea, bgcolor_t color)
bool is_lzero1(ea_t ea)
Definition nalt.hpp:395
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:346
int bool
Definition pro.h:329
unsigned int uint32
unsigned 32 bit value
Definition pro.h:348
uint32 bgcolor_t
background color in RGB
Definition pro.h:5012
uint8 op_dtype_t
Definition pro.h:460
adiff_t sval_t
signed value used by the processor.
Definition pro.h:446
short int16
signed 16 bit value
Definition pro.h:345
int64 adiff_t
Definition pro.h:424
uint64 ea_t
Definition pro.h:421
uint32 flags_t
32-bit flags for each address
Definition pro.h:5008
int int32
signed 32 bit value
Definition pro.h:347
unsigned char uchar
unsigned 8 bit value
Definition pro.h:337
idaman size_t bufsize
Definition pro.h:600
unsigned int uint
unsigned 32 bit value
Definition pro.h:339
qvector< ea_t > eavec_t
vector of addresses
Definition pro.h:2764
uint64 flags64_t
64-bit flags for each address
Definition pro.h:5009
ptrdiff_t ssize_t
Signed size_t - used to check for size overflows when the counter becomes negative.
Definition pro.h:381
unsigned short ushort
unsigned 16 bit value
Definition pro.h:338
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:1381
void idaapi setflag(T &where, U bit, bool cnd)
Set a 'bit' in 'where' if 'value' if not zero.
Definition pro.h:1527
ea_t tid_t
type id (for enums, structs, etc)
Definition pro.h:5010
_qstring< char > qstring
regular string
Definition pro.h:3694
Definition nalt.hpp:682
bool is_default() const
Definition nalt.hpp:700
int32 flags
Definition nalt.hpp:683
int32 lineitems
number of items on a line
Definition nalt.hpp:694
int32 alignment
-1 - don't align.
Definition nalt.hpp:695
array_parameters_t(int32 _f=AP_ALLOWDUPS, int32 _l=0, int32 _a=-1)
Definition nalt.hpp:699
Definition nalt.hpp:948
int16 fids[UA_MAXOP]
data format ids
Definition nalt.hpp:950
void set(tid_t tid)
Definition nalt.hpp:952
int16 dtid
data type id
Definition nalt.hpp:949
DECLARE_COMPARISONS(custom_data_type_ids_t)
tid_t get_dtid() const
Definition nalt.hpp:958
Manage a custom refinfo type Custom refinfos are usually used to handle custom fixups,...
Definition nalt.hpp:1091
qstring ea_t int const refinfo_t ea_t adiff_t ea_t * target
Definition nalt.hpp:1121
int32 cbsize
size of this structure
Definition nalt.hpp:1092
qstring ea_t int const refinfo_t & ri
Definition nalt.hpp:1118
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:1122
int(idaapi *gen_expr)(qstring *buf
qstring * format
Definition nalt.hpp:1115
ea_t * base
Definition nalt.hpp:1132
qstring ea_t int const refinfo_t ea_t from
Definition nalt.hpp:1119
int props
properties (currently 0)
Definition nalt.hpp:1095
const char * desc
Refinfo description to use in Ctrl-R dialog.
Definition nalt.hpp:1094
qstring ea_t int const refinfo_t ea_t adiff_t ea_t ea_t int getn_flags
Definition nalt.hpp:1123
qstring ea_t int opnum
Definition nalt.hpp:1117
qstring ea_t ea
Definition nalt.hpp:1116
qstring ea_t int const refinfo_t ea_t adiff_t * opval
Definition nalt.hpp:1120
const char * name
Format name, must be unique.
Definition nalt.hpp:1093
See opinfo_t::ec.
Definition nalt.hpp:1229
tid_t tid
Definition nalt.hpp:1230
DECLARE_COMPARISONS(enum_const_t)
Definition nalt.hpp:1233
uchar serial
Definition nalt.hpp:1231
Definition nalt.hpp:1259
bool is_aflags_initialized() const
Definition nalt.hpp:1273
aflags_t aflags
Definition nalt.hpp:1267
uchar features
Definition nalt.hpp:1265
flags64_t flags
Definition nalt.hpp:1268
bool is_f64() const
Definition nalt.hpp:1275
int suspop
Definition nalt.hpp:1266
printop_t()
Definition nalt.hpp:1270
const opinfo_t * get_ti() const
Definition nalt.hpp:1277
uint32 unused
Definition nalt.hpp:1260
void set_ti_initialized(bool v=true)
Definition nalt.hpp:1272
opinfo_t ti
Definition nalt.hpp:1261
bool is_ti_initialized() const
Definition nalt.hpp:1271
void set_aflags_initialized(bool v=true)
Definition nalt.hpp:1274
Base class for an range.
Definition range.hpp:35
Get descriptions of all standard and custom refinfo types.
Definition nalt.hpp:1199
uint32 type
Refinfo type, see Reference info flags Custom refinfo has REFINFO_CUSTOM bit.
Definition nalt.hpp:1200
const char * name
Refinfo name.
Definition nalt.hpp:1202
const char * desc
Refinfo description to use in Ctrl-R dialog.
Definition nalt.hpp:1203
Information about a reference.
Definition nalt.hpp:1010
bool _require_base() const
Definition nalt.hpp:1082
adiff_t tdelta
offset from the target
Definition nalt.hpp:1013
bool is_custom(void) const
Definition nalt.hpp:1056
bool is_signed(void) const
Definition nalt.hpp:1058
ea_t target
reference target (BADADDR-none)
Definition nalt.hpp:1011
bool is_selfref(void) const
Definition nalt.hpp:1061
DECLARE_COMPARISONS(refinfo_t)
bool no_base_xref(void) const
Definition nalt.hpp:1053
bool is_no_zeros(void) const
Definition nalt.hpp:1059
ea_t base
base of reference (may be BADADDR)
Definition nalt.hpp:1012
bool is_rvaoff(void) const
Definition nalt.hpp:1055
bool is_no_ones(void) const
Definition nalt.hpp:1060
bool is_target_optional() const
< is_reftype_target_optional()
Definition nalt.hpp:1047
void init(uint32 reft_and_flags, ea_t _base=0, ea_t _target=BADADDR, adiff_t _tdelta=0)
Definition nalt.hpp:1072
reftype_t type(void) const
Definition nalt.hpp:1042
bool is_pastend(void) const
Definition nalt.hpp:1054
bool is_subtract(void) const
Definition nalt.hpp:1057
uint32 flags
Reference info flags
Definition nalt.hpp:1014
void set_type(reftype_t rt)
Definition nalt.hpp:1064
Information for structure offsets.
Definition nalt.hpp:1218
adiff_t delta
Definition nalt.hpp:1221
tid_t ids[MAXSTRUCPATH]
Definition nalt.hpp:1220
DECLARE_COMPARISONS(strpath_t)
Information about a switch statement.
Definition nalt.hpp:710
op_dtype_t regdtype
size of the switch expression register as dtype
Definition nalt.hpp:865
void clear()
Definition nalt.hpp:917
ea_t jumps
jump table start address
Definition nalt.hpp:849
int jcases
number of entries in the jump table (SWI_INDIRECT)
Definition nalt.hpp:857
int get_jtable_size(void) const
Definition nalt.hpp:867
bool has_default(void) const
Definition nalt.hpp:835
ea_t expr_ea
the address before that the switch expression is in REGNUM.
Definition nalt.hpp:911
bool has_elbase(void) const
Definition nalt.hpp:836
ea_t values
values table address (if SWI_SPARSE is set)
Definition nalt.hpp:852
bool is_sparse(void) const
Definition nalt.hpp:837
sval_t get_lowcase(void) const
Definition nalt.hpp:860
void set_elbase(ea_t base)
Definition nalt.hpp:875
int regnum
the switch expression as a value of the REGNUM register before the instruction at EXPR_EA.
Definition nalt.hpp:863
void set_jtable_element_size(int size)
Definition nalt.hpp:783
bool get_jrange_vrange(range_t *jrange=nullptr, range_t *vrange=nullptr) const
get separate parts of the switch
Definition nalt.hpp:884
bool use_std_table(void) const
Definition nalt.hpp:842
bool is_nolowcase(void) const
Definition nalt.hpp:841
void set_jtable_size(int size)
Definition nalt.hpp:868
void set_shift(int shift)
See SWI_SHIFT_MASK.
Definition nalt.hpp:766
void set_expr(int r, op_dtype_t dt)
Definition nalt.hpp:881
ea_t elbase
element base
Definition nalt.hpp:861
ea_t defjump
default jump address (BADADDR if no default case)
Definition nalt.hpp:855
uval_t custom
information for custom tables (filled and used by modules)
Definition nalt.hpp:904
int get_vtable_element_size(void) const
Definition nalt.hpp:803
int get_shift(void) const
See SWI_SHIFT_MASK.
Definition nalt.hpp:763
bool is_subtract(void) const
Definition nalt.hpp:840
ea_t startea
start of the switch idiom
Definition nalt.hpp:856
bool is_custom(void) const
Definition nalt.hpp:838
ushort ncases
number of cases (excluding default)
Definition nalt.hpp:848
sval_t ind_lowcase
Definition nalt.hpp:859
void set_vtable_element_size(int size)
Definition nalt.hpp:814
bool is_indirect(void) const
Definition nalt.hpp:839
bool is_user_defined() const
Definition nalt.hpp:843
switch_info_t()
Definition nalt.hpp:916
uval_t lowcase
the lowest value in cases
Definition nalt.hpp:853
int get_jtable_element_size(void) const
Definition nalt.hpp:772
int get_version() const
Definition nalt.hpp:908
eavec_t marks
the insns marked as IM_SWITCH. They are used to delete the switch.
Definition nalt.hpp:914
@ SWITCH_INFO_VERSION
Definition nalt.hpp:906
uint32 flags
Switch info flags
Definition nalt.hpp:711
int version
Definition nalt.hpp:907
Definition nalt.hpp:218
uchar type
Definition nalt.hpp:220
ea_t ea
Definition nalt.hpp:219
xrefpos_t(ea_t ea_=BADADDR, uchar type_=0)
Definition nalt.hpp:221
bool is_valid() const
Definition nalt.hpp:222
Additional information about an operand type.
Definition nalt.hpp:1244
refinfo_t ri
for offset members
Definition nalt.hpp:1245
int32 strtype
for strings (String type codes)
Definition nalt.hpp:1248
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:1250
strpath_t path
for stroff
Definition nalt.hpp:1247
enum_const_t ec
for enums
Definition nalt.hpp:1249