00001
00002
00003
00004
00005
00006
00007 #ifndef __HEXRAYS_HPP
00008 #define __HEXRAYS_HPP
00009
00010 #define CHECKED_BUILD
00011 #include <pro.h>
00012 #include <fpro.h>
00013 #include <windows.h>
00014 #include <ida.hpp>
00015 #include <idp.hpp>
00016 #include <ieee.h>
00017 #include <loader.hpp>
00018 #include <kernwin.hpp>
00019 #include <typeinf.hpp>
00020 #include <set>
00021 #include <map>
00022 #include <deque>
00023 #include <queue>
00024 #include <algorithm>
00025 #pragma pack(push, 4)
00026 #ifdef __VC__
00027 #pragma warning(push)
00028 #pragma warning(disable:4062) // enumerator 'x' in switch of enum 'y' is not handled
00029 #pragma warning(disable:4265) // virtual functions without virtual destructor
00030 #endif
00031
00032 #define hexapi ///< Public functions are marked with this keyword
00033
00034 class intseq_t;
00035 class mbl_array_t;
00036 struct vdui_t;
00037 struct hexrays_failure_t;
00038 struct mba_stats_t;
00039 struct mlist_t;
00040 typedef int mreg_t;
00041
00042 struct cfunc_t;
00043 struct citem_t;
00044 struct cexpr_t;
00045 struct cinsn_t;
00046 struct cblock_t;
00047 struct cswitch_t;
00048 struct carg_t;
00049 struct carglist_t;
00050
00051 typedef qvector<uchar> byteseq_t;
00052 typedef qvector<qstring> qstrvec_t;
00053
00054
00055 #define DECLARE_COMPARISON_OPERATORS(type) \
00056 bool operator==(const type &r) const { return compare(r) == 0; } \
00057 bool operator!=(const type &r) const { return compare(r) != 0; } \
00058 bool operator< (const type &r) const { return compare(r) < 0; } \
00059 bool operator> (const type &r) const { return compare(r) > 0; } \
00060 bool operator<=(const type &r) const { return compare(r) <= 0; } \
00061 bool operator>=(const type &r) const { return compare(r) >= 0; }
00062
00063
00064
00065 #define DECLARE_COMPARISONS(type) \
00066 DECLARE_COMPARISON_OPERATORS(type) \
00067 friend int compare(const type &a, const type &b) { return a.compare(b); } \
00068 int compare(const type &r) const
00069
00070
00071 struct operand_locator_t
00072 {
00073 ea_t ea;
00074 int opnum;
00075 operand_locator_t(void) {}
00076 operand_locator_t(ea_t _ea, int _opnum) : ea(_ea), opnum(_opnum) {}
00077 DECLARE_COMPARISONS(operand_locator_t);
00078 DEFINE_MEMORY_ALLOCATION_FUNCS()
00079 };
00080
00081
00082
00083
00084 struct number_format_t
00085 {
00086 DEFINE_MEMORY_ALLOCATION_FUNCS()
00087 flags_t flags;
00088 char opnum;
00089 char props;
00090
00091
00092
00093 #define NF_FIXED 0x01 ///< number format has been defined by the user
00094 #define NF_NEGDONE 0x02 ///< temporary internal bit: negation has been performed
00095 #define NF_NEGATE 0x08 ///< The user asked to negate the constant
00096
00097 uchar serial;
00098 char org_nbytes;
00099 qstring type_name;
00100
00101
00102 number_format_t(int _opnum=0)
00103 : flags(0), opnum(char(_opnum)), props(0), serial(0), org_nbytes(0) {}
00104
00105
00106 int getRadix(void) const { return ::getRadix(flags, opnum); }
00107
00108
00109 bool is_fixed(void) const { return props != 0; }
00110
00111 bool isHex(void) const { return ::isNum(flags, opnum) && getRadix() == 16; }
00112
00113 bool isDec(void) const { return ::isNum(flags, opnum) && getRadix() == 10; }
00114
00115 bool isOct(void) const { return ::isNum(flags, opnum) && getRadix() == 8; }
00116
00117 bool isEnum(void) const { return ::isEnum(flags, opnum); }
00118
00119 bool isChar(void) const { return ::isChar(flags, opnum); }
00120
00121 bool isStroff(void) const { return ::isStroff(flags, opnum); }
00122
00123 bool isNum(void) const { return !isEnum() && !isChar() && !isStroff(); }
00124
00125
00126 bool is_invsign(void) const { return is_signed_data(flags); }
00127 };
00128
00129
00130 typedef std::map<operand_locator_t, number_format_t> user_numforms_t;
00131
00132
00133
00134
00135 struct vd_printer_t
00136 {
00137 int hdrlines;
00138
00139
00140
00141
00142
00143
00144
00145 AS_PRINTF(3, 4) virtual int hexapi print(int indent, const char *format,...);
00146 AS_PRINTF(3, 0) int vprint(int indent, const char *format, va_list);
00147 DEFINE_MEMORY_ALLOCATION_FUNCS()
00148 };
00149
00150
00151 struct vc_printer_t : public vd_printer_t
00152 {
00153 const cfunc_t *func;
00154 char lastchar;
00155
00156 vc_printer_t(const cfunc_t *f) : func(f), lastchar(0) {}
00157
00158
00159 virtual bool idaapi oneliner(void) const { return false; }
00160 };
00161
00162
00163 struct file_printer_t : public vd_printer_t
00164 {
00165 FILE *fp;
00166
00167
00168
00169
00170
00171
00172 int print(int indent, const char *format, ...);
00173
00174 file_printer_t(FILE *_fp) : fp(_fp) {}
00175 };
00176
00177
00178 struct qstring_printer_t : public vc_printer_t
00179 {
00180 bool with_tags;
00181 qstring &s;
00182
00183 qstring_printer_t(const cfunc_t *f, qstring &_s, bool tags)
00184 : vc_printer_t(f), with_tags(tags), s(_s) {}
00185
00186
00187
00188
00189
00190
00191 AS_PRINTF(3, 4) int hexapi print(int indent, const char *format, ...);
00192 AS_PRINTF(3, 0) int vprint(int indent, const char *format, va_list);
00193 };
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209 const type_t *hexapi remove_typedef(const type_t *type, const p_list **fields=NULL);
00210
00211
00212
00213
00214
00215 bool hexapi is_type_correct(const type_t *ptr);
00216
00217
00218
00219
00220 bool hexapi is_type_integral(const type_t *type);
00221
00222
00223
00224
00225
00226
00227 bool hexapi is_type_small_struni(const type_t *ptr);
00228
00229
00230
00231 inline bool is_ptr_or_array(type_t t)
00232 {
00233 return is_type_ptr(t) || is_type_array(t);
00234 }
00235
00236
00237 inline bool is_paf(type_t t)
00238 {
00239 return is_ptr_or_array(t) || is_type_func(t);
00240 }
00241
00242
00243
00244 inline const type_t *skip_ptr_or_array_header(const type_t *t)
00245 {
00246 if ( is_type_ptr(*t) )
00247 return skip_ptr_type_header(t);
00248 else
00249 return skip_array_type_header(t);
00250 }
00251
00252
00253
00254
00255
00256 int hexapi partial_type_num(const type_t *type);
00257
00258
00259
00260
00261
00262
00263 type_t hexapi get_float_bit(int width);
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278 struct typestring : public qtype
00279 {
00280 const type_t *u_str(void) const
00281 {
00282 return (const type_t *)c_str();
00283 }
00284 typestring(void) {}
00285 typestring(const type_t *str) : qtype(str ? str : (type_t*)"")
00286 {
00287 }
00288 typestring(const type_t *str, int n) : qtype(str ? str : (type_t*)"", n)
00289 {
00290 }
00291 typestring(const qtype &str) : qtype(str)
00292 {
00293 }
00294 typestring(const qstring &str) : qtype((type_t *)str.c_str())
00295 {
00296 }
00297 const char *idaapi dstr(void) const;
00298 const char *idaapi dstr(const p_list *fields, const char *name=NULL) const;
00299 const char *idaapi dstr(const qtype &fields, const char *name=NULL) const
00300 { return dstr(fields.c_str(), name); }
00301 size_t hexapi print(char *buf, size_t bufsize) const;
00302 qstring multiprint(const p_list *fields, const char *name=NULL, int prflags=0) const;
00303 int size(void) const
00304 {
00305 return get_type_size0(idati, u_str());
00306 }
00307 int noarray_size(void) const;
00308 type_sign_t get_sign(void) const
00309 {
00310 return get_type_sign(idati, u_str());
00311 }
00312 bool hexapi change_sign(type_sign_t sign);
00313 cm_t hexapi get_cc(void) const;
00314 bool is_user_cc(void) const { return ::is_user_cc(get_cc()); }
00315 bool is_vararg(void) const { return ::is_vararg_cc(get_cc()); }
00316 typestring hexapi get_nth_arg(int n) const;
00317 DECLARE_COMPARISON_OPERATORS(typestring)
00318 int compare(const typestring &r) const { return typcmp(u_str(), r.u_str()); }
00319 bool common_type(const typestring &x);
00320 bool is_ptr_or_array(void) const
00321 {
00322 const type_t *t2 = resolve();
00323 return t2 != NULL && ::is_ptr_or_array(t2[0]);
00324 }
00325 bool remove_ptr_or_array(void)
00326 {
00327 const type_t *t2 = resolve();
00328 if ( t2 == NULL || !::is_ptr_or_array(t2[0]) )
00329 return false;
00330 t2 = skip_ptr_or_array_header(t2);
00331 *this = t2;
00332 return true;
00333 }
00334 bool is_paf(void) const
00335 {
00336 const type_t *t2 = resolve();
00337 return t2 != NULL && ::is_paf(t2[0]);
00338 }
00339 bool is_funcptr(void) const
00340 {
00341 if ( empty() )
00342 return false;
00343 const type_t *t2 = begin();
00344 if ( !is_type_ptr(*t2) )
00345 return false;
00346 t2 = skip_ptr_type_header(t2);
00347 return is_type_func(*t2);
00348 }
00349 bool is_ptr(void) const { const type_t *ptr = resolve(); return ptr != NULL && is_type_ptr(*ptr); }
00350 bool is_enum(void) const { const type_t *ptr = resolve(); return ptr != NULL && is_type_enum(*ptr); }
00351 bool is_func(void) const { const type_t *ptr = resolve(); return ptr != NULL && is_type_func(*ptr); }
00352 bool is_void(void) const { const type_t *ptr = resolve(); return ptr != NULL && is_type_void(*ptr); }
00353 bool is_array(void) const { const type_t *ptr = resolve(); return ptr != NULL && is_type_array(*ptr); }
00354 bool is_float(void) const { const type_t *ptr = resolve(); return ptr != NULL && is_type_float(*ptr); }
00355 bool is_union(void) const { const type_t *ptr = resolve(); return ptr != NULL && is_type_union(*ptr); }
00356 bool is_struct(void) const { const type_t *ptr = resolve(); return ptr != NULL && is_type_struct(*ptr); }
00357 bool is_struni(void) const { const type_t *ptr = resolve(); return ptr != NULL && is_type_struni(*ptr); }
00358 bool is_double(void) const { const type_t *ptr = resolve(); return ptr != NULL && is_type_double(*ptr); }
00359 bool is_ldouble(void) const { const type_t *ptr = resolve(); return ptr != NULL && is_type_ldouble(*ptr); }
00360 bool is_floating(void) const { const type_t *ptr = resolve(); return ptr != NULL && is_type_floating(*ptr); }
00361 bool is_correct(void) const { return empty() || is_type_correct(u_str()); }
00362 const type_t *resolve(void) const { return remove_typedef(u_str()); }
00363 const type_t *resolve_func_type(const p_list **fields=NULL) const;
00364 bool is_scalar(void) const { return is_type_scalar2(idati, u_str()); }
00365 bool is_small_struni(void) const { return is_type_small_struni(u_str()); }
00366 bool is_like_scalar(void) const
00367 {
00368 const type_t *ptr = resolve();
00369 return is_type_scalar2(idati, ptr) || is_type_small_struni(ptr);
00370 }
00371 bool is_pvoid(void) const
00372 {
00373 const type_t *ptr = resolve();
00374 if ( !is_type_ptr(*ptr) )
00375 return false;
00376 ptr = skip_ptr_type_header(ptr);
00377 if ( !is_restype_void(idati, ptr) )
00378 return false;
00379 return true;
00380 }
00381 bool is_partial_ptr(void) const
00382 {
00383 const type_t *ptr = u_str();
00384 if ( !is_type_ptr(*ptr) )
00385 return false;
00386 ptr = skip_ptr_type_header(ptr);
00387 if ( !is_type_partial(*ptr) )
00388 return false;
00389 return true;
00390 }
00391 bool is_well_defined(void) const
00392 {
00393 if ( empty() )
00394 return false;
00395 return !is_type_partial((*this)[0]);
00396 }
00397 bool requires_cot_ref(void) const
00398 {
00399
00400 const type_t *t2 = resolve();
00401 if ( t2 == NULL )
00402 return true;
00403 type_t t = *t2;
00404 return !is_type_array(t) && !is_type_func(t);
00405 }
00406 int partial_type_num(void) const { return ::partial_type_num(u_str()); }
00407 };
00408
00409
00410
00411
00412
00413
00414 typestring hexapi get_int_type_by_width_and_sign(int srcwidth, type_sign_t sign);
00415
00416
00417
00418
00419
00420
00421 typestring hexapi get_unk_type(int size);
00422
00423
00424
00425
00426
00427
00428
00429
00430 typestring hexapi dummy_ptrtype(int ptrsize, bool isfp);
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440 bool hexapi get_member_type(const member_t *mptr, typestring *type, qtype *fields=NULL);
00441
00442
00443
00444
00445
00446
00447
00448 typestring hexapi make_array(const type_t *type, int nelems);
00449
00450
00451
00452
00453
00454
00455
00456
00457 typestring hexapi make_pointer(const typestring &type);
00458
00459
00460
00461
00462
00463
00464
00465 typestring hexapi create_typedef(const char *name);
00466
00467
00468
00469
00470
00471
00472
00473
00474 typestring hexapi remove_pointer(const typestring &type);
00475
00476
00477
00478
00479
00480
00481 bool hexapi cnv_array_to_ptr(typestring &type);
00482
00483
00484
00485
00486
00487 struct meminfo_t
00488 {
00489 DEFINE_MEMORY_ALLOCATION_FUNCS()
00490 uval_t offset;
00491 int size;
00492 typestring type;
00493 typestring fields;
00494 qstring name;
00495 };
00496
00497 struct strtype_info_t : public qvector<meminfo_t>
00498 {
00499 type_t basetype;
00500 int N;
00501 bool hexapi create_from(const type_t *type, const p_list *fields, bool with_gaps);
00502 bool hexapi build_base_type(typestring *restype) const;
00503 bool hexapi build_udt_type(typestring *restype, typestring *resfields);
00504 int find_strmem(uval_t offset) const;
00505 };
00506
00507
00508
00509 inline mreg_t get_lvarloc_reg1(argloc_t location) { return is_reg2_argloc(location) ? get_argloc_r1(location) : location & ~ARGLOC_REG; }
00510 inline mreg_t get_lvarloc_reg2(argloc_t location) { return get_argloc_r2(location); }
00511
00512
00513 bool hexapi arglocs_overlap(argloc_t loc1, size_t w1, argloc_t loc2, size_t w2);
00514
00515
00516 struct lvar_locator_t
00517 {
00518 argloc_t location;
00519
00520
00521 ea_t defea;
00522
00523
00524 lvar_locator_t(void) : location(BAD_ARGLOC), defea(BADADDR) {}
00525 lvar_locator_t(argloc_t loc, ea_t ea) : location(loc), defea(ea) {}
00526
00527
00528
00529
00530 sval_t hexapi get_regnum(void) const;
00531
00532 bool is_reg_lvar(void) const { return is_reg_argloc(location); }
00533
00534 bool is_reg2_lvar(void) const { return is_reg2_argloc(location); }
00535
00536 bool is_stk_lvar(void) const { return !is_reg_argloc(location); }
00537
00538 mreg_t get_regloc1(void) const { return get_lvarloc_reg1(location); }
00539
00540 mreg_t get_regloc2(void) const { return get_lvarloc_reg2(location); }
00541 DECLARE_COMPARISONS(lvar_locator_t);
00542 DEFINE_MEMORY_ALLOCATION_FUNCS()
00543 };
00544
00545
00546 class lvar_t : public lvar_locator_t
00547 {
00548 friend class mbl_array_t;
00549 int flags;
00550
00551
00552
00553 #define CVAR_USED 0x0001 ///< is used in the code?
00554 #define CVAR_TYPE 0x0002 ///< the type is defined?
00555 #define CVAR_NAME 0x0004 ///< has nice name?
00556 #define CVAR_MREG 0x0008 ///< corresponding mregs were replaced?
00557 #define CVAR_NOWD 0x0010 ///< width is unknown
00558 #define CVAR_UNAME 0x0020 ///< user-defined name
00559 #define CVAR_UTYPE 0x0040 ///< user-defined type
00560 #define CVAR_RESULT 0x0080 ///< function result variable
00561 #define CVAR_ARG 0x0100 ///< function argument
00562 #define CVAR_FAKE 0x0200 ///< fake return variable
00563 #define CVAR_OVER 0x0400 ///< overlapping variable
00564 #define CVAR_FLOAT 0x0800 ///< used in a fpu insn
00565 #define CVAR_SPOILED 0x1000 ///< internal flag, do not use: spoiled var
00566 #define CVAR_MAPDST 0x2000 ///< other variables are mapped to this var
00567
00568
00569 public:
00570 qstring name;
00571
00572
00573 qstring cmt;
00574 typestring _type;
00575 int width;
00576 int defblk;
00577
00578 uint64 divisor;
00579
00580 lvar_t(void) : flags(CVAR_USED), width(0), defblk(-1), divisor(0) {}
00581 lvar_t(const qstring &n, uint32 l, ea_t e, const typestring &t, int w, int db)
00582 : lvar_locator_t(l, e), flags(CVAR_USED), name(n), _type(t), width(w),
00583 defblk(db), divisor(0) {}
00584 lvar_t(mreg_t reg, int width, const type_t *type, int nblock, ea_t defea);
00585
00586
00587 bool used(void) const { return (flags & CVAR_USED) != 0; }
00588
00589 bool typed(void) const { return (flags & CVAR_TYPE) != 0; }
00590
00591 bool mreg_done(void) const { return (flags & CVAR_MREG) != 0; }
00592
00593 bool has_nice_name(void) const { return (flags & CVAR_NAME) != 0; }
00594
00595 bool is_unknown_width(void) const { return (flags & CVAR_NOWD) != 0; }
00596
00597 bool has_user_info(void) const { return (flags & (CVAR_UNAME|CVAR_UTYPE)) != 0 || !cmt.empty(); }
00598
00599 bool has_user_name(void) const { return (flags & CVAR_UNAME) != 0; }
00600
00601 bool has_user_type(void) const { return (flags & CVAR_UTYPE) != 0; }
00602
00603 bool is_result_var(void) const { return (flags & CVAR_RESULT) != 0; }
00604
00605 bool is_arg_var(void) const { return (flags & CVAR_ARG) != 0; }
00606
00607 bool is_promoted_arg(void) const { return is_arg_var() && width < inf.cc.size_i; }
00608
00609 bool is_fake_var(void) const { return (flags & CVAR_FAKE) != 0; }
00610
00611 bool is_overlapped_var(void) const { return (flags & CVAR_OVER) != 0; }
00612
00613 bool is_floating_var(void) const { return (flags & CVAR_FLOAT) != 0; }
00614
00615 bool is_spoiled_var(void) const { return (flags & CVAR_SPOILED) != 0; }
00616
00617 bool is_mapdst_var(void) const { return (flags & CVAR_MAPDST) != 0; }
00618 void set_used(void) { flags |= CVAR_USED; }
00619 void clear_used(void) { flags &= ~CVAR_USED; }
00620 void set_typed(void) { flags |= CVAR_TYPE; }
00621 void set_non_typed(void) { flags &= ~CVAR_TYPE; }
00622 void clr_user_info(void) { flags &= ~(CVAR_UNAME|CVAR_UTYPE); }
00623 void set_user_name(void) { flags |= CVAR_NAME|CVAR_UNAME; }
00624 void set_user_type(void) { flags |= CVAR_TYPE|CVAR_UTYPE; }
00625 void clr_user_type(void) { flags &= ~CVAR_UTYPE; }
00626 void clr_user_name(void) { flags &= ~CVAR_UNAME; }
00627 void set_mreg_done(void) { flags |= CVAR_MREG; }
00628 void clr_mreg_done(void) { flags &= ~CVAR_MREG; }
00629 void set_unknown_width(void) { flags |= CVAR_NOWD; }
00630 void clr_unknown_width(void) { flags &= ~CVAR_NOWD; }
00631 void set_arg_var(void) { flags |= CVAR_ARG; }
00632 void clr_arg_var(void) { flags &= ~CVAR_ARG; }
00633 void set_fake_var(void) { flags |= CVAR_FAKE; }
00634 void clr_fake_var(void) { flags &= ~CVAR_FAKE; }
00635 void set_overlapped_var(void) { flags |= CVAR_OVER; }
00636 void clr_overlapped_var(void) { flags &= ~CVAR_OVER; }
00637 void set_floating_var(void) { flags |= CVAR_FLOAT; }
00638 void clr_floating_var(void) { flags &= ~CVAR_FLOAT; }
00639 void set_spoiled_var(void) { flags |= CVAR_SPOILED; }
00640 void clr_spoiled_var(void) { flags &= ~CVAR_SPOILED; }
00641 void set_mapdst_var(void) { flags |= CVAR_MAPDST; }
00642 void clr_mapdst_var(void) { flags &= ~CVAR_MAPDST; }
00643
00644 void set_reg_name(const char *n)
00645 {
00646 name = n;
00647 flags &= ~CVAR_USED;
00648 flags |= CVAR_NAME;
00649 }
00650
00651 bool has_common(const lvar_t &v) const
00652 {
00653 return arglocs_overlap(location, width, v.location, v.width);
00654 }
00655
00656 bool has_common_bit(argloc_t loc, asize_t width2) const
00657 {
00658 return arglocs_overlap(location, width, loc, width2);
00659 }
00660
00661 const typestring &type(void) const
00662 {
00663 return _type;
00664 }
00665
00666
00667 bool hexapi accepts_type(const typestring &t);
00668
00669 void force_lvar_type(const typestring &t)
00670 {
00671 _type = t;
00672 setflag(flags, CVAR_FLOAT, t.is_floating());
00673 }
00674
00675
00676 void hexapi set_lvar_type(const typestring &t);
00677
00678 void set_final_lvar_type(const typestring &t)
00679 {
00680 set_lvar_type(t);
00681 set_typed();
00682 }
00683
00684
00685
00686 void hexapi set_width(int w, bool is_float=false);
00687
00688 };
00689
00690
00691 struct lvars_t : public qvector<lvar_t>
00692 {
00693
00694
00695
00696
00697 int find_input_lvar(argloc_t argloc, int size) { return find_lvar(argloc, size, 0); }
00698
00699
00700
00701
00702
00703 int hexapi find_stkvar(int32 spoff, int width);
00704
00705
00706
00707
00708 lvar_t *hexapi find(const lvar_locator_t &ll);
00709
00710
00711
00712
00713
00714
00715
00716 int hexapi find_lvar(argloc_t location, int width, int defblk=-1);
00717 };
00718
00719
00720 struct lvar_saved_info_t
00721 {
00722 lvar_locator_t ll;
00723 qstring name;
00724 typestring type;
00725 qstring cmt;
00726 bool has_info(void) const { return !name.empty() || !type.empty() || !cmt.empty(); }
00727 };
00728
00729
00730 typedef std::map<lvar_locator_t, lvar_locator_t> lvar_mapping_t;
00731
00732
00733 struct user_lvar_visitor_t
00734 {
00735
00736
00737 int stkoff_delta;
00738
00739
00740 int flags;
00741
00742
00743
00744 #define ULV_PRECISE_DEFEA 0x0001 ///< Use precise defea's for lvar locations
00745
00746
00747
00748
00749
00750 virtual int idaapi handle_retrieved_info(const lvar_saved_info_t &lv) = 0;
00751
00752
00753
00754
00755 virtual int idaapi handle_retrieved_mapping(lvar_mapping_t &lm) = 0;
00756
00757
00758
00759
00760
00761 virtual int idaapi get_info_qty_for_saving(void) = 0;
00762
00763
00764
00765
00766
00767 virtual bool idaapi get_info_for_saving(lvar_saved_info_t *lv) = 0;
00768
00769
00770
00771
00772 virtual const lvar_mapping_t *idaapi get_info_mapping_for_saving(void) = 0;
00773 };
00774
00775
00776
00777
00778
00779
00780
00781 int hexapi restore_user_lvar_settings(ea_t func_ea, user_lvar_visitor_t &ulv);
00782
00783
00784
00785
00786
00787
00788
00789 void hexapi save_user_lvar_settings(ea_t func_ea, user_lvar_visitor_t &ulv);
00790
00791
00792
00793 struct fnumber_t
00794
00795 {
00796 uint16 fnum[6];
00797 int nbytes;
00798 operator uint16 *(void) { return fnum; }
00799 operator const uint16 *(void) const { return fnum; }
00800 size_t hexapi print(char *buf, size_t bufsize) const;
00801 DEFINE_MEMORY_ALLOCATION_FUNCS()
00802 DECLARE_COMPARISONS(fnumber_t)
00803 {
00804 return ecmp(fnum, r.fnum);
00805 }
00806 };
00807
00808
00809
00810 enum warnid_t
00811 {
00812 WARN_VARARG_REGS,
00813 WARN_ILL_PURGED,
00814 WARN_ILL_FUNCTYPE,
00815 WARN_VARARG_TCAL,
00816 WARN_VARARG_NOSTK,
00817 WARN_VARARG_MANY,
00818 WARN_ADDR_OUTARGS,
00819 WARN_DEP_UNK_CALLS,
00820 WARN_ILL_ELLIPSIS,
00821 WARN_GUESSED_TYPE,
00822 WARN_EXP_LINVAR,
00823 WARN_WIDEN_CHAINS,
00824 WARN_BAD_PURGED,
00825 WARN_CBUILD_LOOPS,
00826 WARN_NO_SAVE_REST,
00827 WARN_ODD_INPUT_REG,
00828 WARN_ODD_ADDR_USE,
00829 WARN_MUST_RET_FP,
00830 WARN_ILL_FPU_STACK,
00831 WARN_SELFREF_PROP,
00832 WARN_WOULD_OVERLAP,
00833 WARN_ARRAY_INARG,
00834 WARN_MAX_ARGS,
00835 WARN_BAD_FIELD_TYPE,
00836
00837 WARN_MAX,
00838 };
00839
00840
00841 struct hexwarn_t
00842 {
00843 ea_t ea;
00844 warnid_t id;
00845 qstring text;
00846 DECLARE_COMPARISONS(hexwarn_t)
00847 {
00848 if ( ea < r.ea )
00849 return -1;
00850 if ( ea > r.ea )
00851 return 1;
00852 if ( id < r.id )
00853 return -1;
00854 if ( id > r.id )
00855 return 1;
00856 return strcmp(text.c_str(), r.text.c_str());
00857 }
00858 };
00859 typedef qvector<hexwarn_t> hexwarns_t;
00860
00861
00862
00863
00864
00865 const char *hexapi get_hexrays_version(void);
00866
00867
00868
00869
00870
00871
00872
00873
00874
00875 vdui_t *hexapi open_pseudocode(ea_t ea, int new_window);
00876
00877
00878
00879
00880
00881
00882 bool hexapi close_pseudocode(TForm *f);
00883
00884
00885
00886
00887
00888
00889
00890
00891 cfunc_t *hexapi decompile(func_t *pfn, hexrays_failure_t *hf);
00892
00893
00894
00895
00896 #define VDRUN_NEWFILE 0x0000 ///< Create a new file or overwrite existing file
00897 #define VDRUN_APPEND 0x0001 ///< Create a new file or append to existing file
00898 #define VDRUN_ONLYNEW 0x0002 ///< Fail if output file already exists
00899 #define VDRUN_SILENT 0x0004 ///< Silent decompilation
00900 #define VDRUN_SENDIDB 0x0008 ///< Send problematic databases to hex-rays.com
00901 #define VDRUN_MAYSTOP 0x0010 ///< the user can cancel decompilation
00902 #define VDRUN_CMDLINE 0x0020 ///< called from ida's command line
00903 #define VDRUN_STATS 0x0040 ///< print statistics into vd_stats.txt
00904
00905
00906
00907
00908
00909
00910
00911
00912
00913
00914 bool hexapi decompile_many(const char *outfile, eavec_t *funcaddrs, int vdrun_flags);
00915
00916
00917
00918
00919
00920
00921 const char *hexapi micro_err_format(int code);
00922
00923
00924
00925 #define MERR_OK 0 ///< ok
00926 #define MERR_BLOCK 1 ///< no error, switch to new block
00927 #define MERR_INTERR (-1) ///< internal error
00928 #define MERR_INSN (-2) ///< can not convert to microcode
00929 #define MERR_MEM (-3) ///< not enough memory
00930 #define MERR_BADBLK (-4) ///< bad block found
00931 #define MERR_BADSP (-5) ///< positive sp value has been found
00932 #define MERR_PROLOG (-6) ///< prolog analysis failed
00933 #define MERR_SWITCH (-7) ///< wrong switch idiom
00934 #define MERR_EXCEPTION (-8) ///< exception analysis failed
00935 #define MERR_HUGESTACK (-9) ///< stack frame is too big
00936 #define MERR_LVARS (-10) ///< local variable allocation failed
00937 #define MERR_BITNESS (-11) ///< 16bit programs are not supported (yet)
00938 #define MERR_BADCALL (-12) ///< could not determine call arguments
00939 #define MERR_BADFRAME (-13) ///< function frame is wrong
00940 #define MERR_UNKTYPE (-14) ///< undefined type %s
00941 #define MERR_BADIDB (-15) ///< inconsistent database information
00942 #define MERR_SIZEOF (-16) ///< wrong basic type sizes in compiler settings
00943 #define MERR_REDO (-17) ///< redecompilation has been requested
00944 #define MERR_CANCELED (-18) ///< decompilation has been cancelled
00945 #define MERR_RECDEPTH (-19) ///< max recursion depth reached during lvar allocation
00946 #define MERR_OVERLAP (-20) ///< variables would overlap: %s
00947 #define MERR_PARTINIT (-21) ///< partially initialized variable %s
00948 #define MERR_COMPLEX (-22) ///< too complex function
00949 #define MERR_LICENSE (-23) ///< no license available
00950 #define MERR_MAX_ERR 23
00951 #define MERR_LOOP (-24) ///< internal code: redo last loop (never reported)
00952
00953
00954
00955 struct hexrays_failure_t
00956 {
00957 int code;
00958 ea_t errea;
00959 qstring str;
00960 hexrays_failure_t(void) : code(MERR_OK) {}
00961 hexrays_failure_t(int c, ea_t ea, const char *buf=NULL) : code(c), errea(ea), str(buf) {}
00962 hexrays_failure_t(int c, ea_t ea, const qstring &buf) : code(c), errea(ea), str(buf) {}
00963 qstring hexapi desc(void) const;
00964 DEFINE_MEMORY_ALLOCATION_FUNCS()
00965 };
00966
00967
00968 struct vd_failure_t : public std::exception
00969 {
00970 hexrays_failure_t hf;
00971 vd_failure_t(void) {}
00972 vd_failure_t(int code, ea_t ea, const char *buf=NULL) : hf(code, ea, buf) {}
00973 vd_failure_t(int code, ea_t ea, const qstring &buf) : hf(code, ea, buf) {}
00974 vd_failure_t(const hexrays_failure_t &_hf) : hf(_hf) {}
00975 qstring desc(void) const { return hf.desc(); }
00976 #ifdef __GNUC__
00977 ~vd_failure_t(void) throw() {}
00978 #endif
00979 DEFINE_MEMORY_ALLOCATION_FUNCS()
00980 };
00981
00982
00983 struct vd_interr_t : public vd_failure_t
00984 {
00985 vd_interr_t(ea_t ea, const qstring &buf) : vd_failure_t(MERR_INTERR, ea, buf) {}
00986 vd_interr_t(ea_t ea, const char *buf) : vd_failure_t(MERR_INTERR, ea, buf) {}
00987 };
00988
00989
00990
00991
00992
00993
00994
00995 void hexapi send_database(const hexrays_failure_t &err, bool silent);
00996
00997
00998
00999
01000 template <class T>
01001 int compare(const T &a, const T &b)
01002 {
01003 if ( a < b ) return -1;
01004 if ( a > b ) return 1;
01005 return 0;
01006 }
01007
01008 template <class T>
01009 int compare(const qvector<T> &a, const qvector<T> &b)
01010 {
01011 return compare_containers(a, b);
01012 }
01013
01014 template <class T>
01015 int compare(const qlist<T> &a, const qlist<T> &b)
01016 {
01017 return compare_containers(a, b);
01018 }
01019
01020 template <class T, class U>
01021 int compare(const std::pair<T, U> &a, const std::pair<T, U> &b)
01022 {
01023 int code = compare(a.first, b.first);
01024 if ( code != 0 )
01025 return code;
01026 return compare(a.second, b.second);
01027 }
01028
01029
01030 template <class T>
01031 int compare_containers(const T &l, const T &r)
01032 {
01033 typename T::const_iterator p = l.begin();
01034 typename T::const_iterator q = r.begin();
01035 for ( ; p != l.end() && q != r.end(); ++p,++q )
01036 {
01037 int code = compare(*p, *q);
01038 if ( code != 0 )
01039 return code;
01040 }
01041 if ( p == l.end() && q != r.end() ) return -1;
01042 if ( p != l.end() && q == r.end() ) return 1;
01043 return 0;
01044 }
01045
01046
01047
01048
01049 enum ctype_t
01050 {
01051 cot_empty = 0,
01052 cot_comma = 1,
01053 cot_asg = 2,
01054 cot_asgbor = 3,
01055 cot_asgxor = 4,
01056 cot_asgband = 5,
01057 cot_asgadd = 6,
01058 cot_asgsub = 7,
01059 cot_asgmul = 8,
01060 cot_asgsshr = 9,
01061 cot_asgushr = 10,
01062 cot_asgshl = 11,
01063 cot_asgsdiv = 12,
01064 cot_asgudiv = 13,
01065 cot_asgsmod = 14,
01066 cot_asgumod = 15,
01067 cot_tern = 16,
01068 cot_lor = 17,
01069 cot_land = 18,
01070 cot_bor = 19,
01071 cot_xor = 20,
01072 cot_band = 21,
01073 cot_eq = 22,
01074 cot_ne = 23,
01075 cot_sge = 24,
01076 cot_uge = 25,
01077 cot_sle = 26,
01078 cot_ule = 27,
01079 cot_sgt = 28,
01080 cot_ugt = 29,
01081 cot_slt = 30,
01082 cot_ult = 31,
01083 cot_sshr = 32,
01084 cot_ushr = 33,
01085 cot_shl = 34,
01086 cot_add = 35,
01087 cot_sub = 36,
01088 cot_mul = 37,
01089 cot_sdiv = 38,
01090 cot_udiv = 39,
01091 cot_smod = 40,
01092 cot_umod = 41,
01093 cot_fadd = 42,
01094 cot_fsub = 43,
01095 cot_fmul = 44,
01096 cot_fdiv = 45,
01097 cot_fneg = 46,
01098 cot_neg = 47,
01099 cot_cast = 48,
01100 cot_lnot = 49,
01101 cot_bnot = 50,
01102 cot_ptr = 51,
01103 cot_ref = 52,
01104 cot_postinc = 53,
01105 cot_postdec = 54,
01106 cot_preinc = 55,
01107 cot_predec = 56,
01108 cot_call = 57,
01109 cot_idx = 58,
01110 cot_memref = 59,
01111 cot_memptr = 60,
01112 cot_num = 61,
01113 cot_fnum = 62,
01114 cot_str = 63,
01115 cot_obj = 64,
01116 cot_var = 65,
01117 cot_insn = 66,
01118 cot_sizeof = 67,
01119 cot_helper = 68,
01120 cot_last = cot_helper,
01121 cit_empty = 69,
01122 cit_block = 70,
01123 cit_expr = 71,
01124 cit_if = 72,
01125 cit_for = 73,
01126 cit_while = 74,
01127 cit_do = 75,
01128 cit_switch = 76,
01129 cit_break = 77,
01130 cit_continue = 78,
01131 cit_return = 79,
01132 cit_goto = 80,
01133 cit_asm = 81,
01134 cit_end
01135 };
01136
01137
01138
01139
01140 const uchar
01141 FX_NONE = 0,
01142 FX_INFIX = 1,
01143 FX_PREFIX = 2,
01144 FX_POSTFIX = 3,
01145 FX_TERNARY = 4;
01146
01147
01148
01149
01150
01151 const uchar
01152 COI_RL = 0x00,
01153 COI_LR = 0x01,
01154 COI_INT = 0x02,
01155 COI_FP = 0x04,
01156 COI_SH = 0x08,
01157 COI_SGN = 0x10,
01158 COI_SBN = 0x20;
01159
01160
01161
01162 struct operator_info_t
01163 {
01164 DEFINE_MEMORY_ALLOCATION_FUNCS()
01165 const char *text;
01166 uchar precedence;
01167 uchar valency;
01168 uchar fixtype;
01169 uchar flags;
01170 };
01171
01172
01173
01174
01175 ctype_t hexapi negated_relation(ctype_t op);
01176
01177 type_sign_t hexapi get_op_signness(ctype_t op);
01178
01179 ctype_t hexapi asgop(ctype_t cop);
01180
01181
01182 ctype_t hexapi asgop_revert(ctype_t cop);
01183
01184 inline bool op_uses_x(ctype_t op) { return op >= cot_comma && op <= cot_memptr; }
01185
01186 inline bool op_uses_y(ctype_t op) { return (op >= cot_comma && op <= cot_fdiv) || op == cot_idx; }
01187
01188 inline bool op_uses_z(ctype_t op) { return op == cot_tern; }
01189
01190 inline bool is_binary(ctype_t op) { return op_uses_y(op) && op != cot_tern; }
01191
01192 inline bool is_unary(ctype_t op) { return op >= cot_fneg && op <= cot_predec; }
01193
01194 inline bool is_relational(ctype_t op) { return op >= cot_eq && op <= cot_ult; }
01195
01196 inline bool is_assignment(ctype_t op) { return op >= cot_asg && op <= cot_asgumod; }
01197
01198 inline bool accepts_udts(ctype_t op) { return op == cot_asg || op == cot_comma || op > cot_last; }
01199
01200 inline bool is_prepost(ctype_t op) { return op >= cot_postinc && op <= cot_predec; }
01201
01202 inline bool is_commutative(ctype_t op)
01203 {
01204 return op == cot_bor
01205 || op == cot_xor
01206 || op == cot_band
01207 || op == cot_add
01208 || op == cot_mul
01209 || op == cot_fadd
01210 || op == cot_fmul
01211 || op == cot_ne
01212 || op == cot_eq;
01213 }
01214
01215 inline bool is_additive(ctype_t op)
01216 {
01217 return op == cot_add
01218 || op == cot_sub
01219 || op == cot_fadd
01220 || op == cot_fsub;
01221 }
01222
01223 inline bool is_multiplicative(ctype_t op)
01224 {
01225 return op == cot_mul
01226 || op == cot_sdiv
01227 || op == cot_udiv
01228 || op == cot_fmul
01229 || op == cot_fdiv;
01230 }
01231
01232
01233 inline bool is_bitop(ctype_t op)
01234 {
01235 return op == cot_bor
01236 || op == cot_xor
01237 || op == cot_band
01238 || op == cot_bnot;
01239 }
01240
01241
01242 inline bool is_logical(ctype_t op)
01243 {
01244 return op == cot_lor
01245 || op == cot_land
01246 || op == cot_lnot;
01247 }
01248
01249
01250 inline bool is_loop(ctype_t op)
01251 {
01252 return op == cit_for
01253 || op == cit_while
01254 || op == cit_do;
01255 }
01256
01257 inline bool is_break_consumer(ctype_t op)
01258 {
01259 return is_loop(op) || op == cit_switch;
01260 }
01261
01262
01263 inline bool is_lvalue(ctype_t op)
01264 {
01265 return op == cot_ptr
01266 || op == cot_idx
01267 || op == cot_memref
01268 || op == cot_memptr
01269 || op == cot_obj
01270 || op == cot_var;
01271 }
01272
01273
01274 inline bool is_allowed_on_small_struni(ctype_t op)
01275 {
01276 return op == cit_return
01277 || op == cot_asg
01278 || op == cot_eq
01279 || op == cot_ne
01280 || op == cot_comma
01281 || (op > cot_last && op < cit_end);
01282 }
01283
01284
01285 struct cnumber_t
01286 {
01287 uint64 _value;
01288 number_format_t nf;
01289 cnumber_t(int _opnum=0) : nf(_opnum) {}
01290
01291
01292
01293
01294
01295 size_t hexapi print(char *buf, size_t bufsize, const type_t *type) const;
01296
01297
01298
01299
01300 uint64 hexapi value(const typestring &type) const;
01301
01302
01303
01304
01305
01306 void hexapi assign(uint64 v, int nbytes, type_sign_t sign);
01307
01308 DECLARE_COMPARISONS(cnumber_t);
01309 };
01310
01311
01312 struct var_ref_t
01313 {
01314 mbl_array_t *mba;
01315 int idx;
01316 DEFINE_MEMORY_ALLOCATION_FUNCS()
01317 DECLARE_COMPARISONS(var_ref_t);
01318 };
01319
01320
01321 typedef qvector<citem_t *> parents_t;
01322
01323
01324 struct ctree_visitor_t
01325 {
01326 DEFINE_MEMORY_ALLOCATION_FUNCS()
01327 int cv_flags;
01328
01329
01330
01331 #define CV_FAST 0x0000 ///< do not maintain parent information
01332 #define CV_PRUNE 0x0001 ///< this bit is set by visit...() to prune the walk
01333 #define CV_PARENTS 0x0002 ///< maintain parent information
01334 #define CV_POST 0x0004 ///< call the leave...() functions
01335 #define CV_RESTART 0x0008 ///< restart enumeration at the top expr (apply_to_exprs)
01336 #define CV_INSNS 0x0010 ///< visit only statements, prune all expressions
01337
01338
01339
01340
01341
01342
01343 bool maintain_parents(void) const { return (cv_flags & CV_PARENTS) != 0; }
01344
01345 bool must_prune(void) const { return (cv_flags & CV_PRUNE) != 0; }
01346
01347 bool must_restart(void) const { return (cv_flags & CV_RESTART) != 0; }
01348
01349 bool is_postorder(void) const { return (cv_flags & CV_POST) != 0; }
01350
01351 bool only_insns(void) const { return (cv_flags & CV_INSNS) != 0; }
01352
01353
01354 void prune_now(void) { cv_flags |= CV_PRUNE; }
01355
01356 void clr_prune(void) { cv_flags &= ~CV_PRUNE; }
01357
01358 void set_restart(void) { cv_flags |= CV_RESTART; }
01359
01360 void clr_restart(void) { cv_flags &= ~CV_RESTART; }
01361
01362 parents_t parents;
01363
01364
01365
01366
01367 ctree_visitor_t(int _flags) : cv_flags(_flags) {}
01368
01369
01370
01371
01372
01373
01374
01375 int hexapi apply_to(citem_t *item, citem_t *parent);
01376
01377
01378
01379
01380
01381
01382
01383 int hexapi apply_to_exprs(citem_t *item, citem_t *parent);
01384
01385
01386 cexpr_t *parent_expr(void) { return (cexpr_t *)parents.back(); }
01387
01388 cinsn_t *parent_insn(void) { return (cinsn_t *)parents.back(); }
01389
01390
01391
01392
01393
01394
01395
01396
01397
01398
01399 virtual int idaapi visit_insn(cinsn_t *) { return 0; }
01400
01401
01402
01403
01404
01405
01406
01407 virtual int idaapi visit_expr(cexpr_t *) { return 0; }
01408
01409
01410
01411
01412
01413
01414
01415 virtual int idaapi leave_insn(cinsn_t *) { return 0; }
01416
01417
01418
01419
01420
01421
01422
01423 virtual int idaapi leave_expr(cexpr_t *) { return 0; }
01424 };
01425
01426
01427 struct ctree_parentee_t : public ctree_visitor_t
01428 {
01429 ctree_parentee_t(bool post=false)
01430 : ctree_visitor_t((post ? CV_POST : 0)|CV_PARENTS) {}
01431
01432
01433
01434
01435
01436
01437
01438
01439
01440 bool hexapi recalc_parent_types(void);
01441 };
01442
01443
01444 struct cfunc_parentee_t : public ctree_parentee_t
01445 {
01446 cfunc_t *func;
01447 cfunc_parentee_t(cfunc_t *f, bool post=false)
01448 : ctree_parentee_t(post), func(f) {}
01449
01450
01451
01452
01453
01454
01455
01456
01457
01458
01459 bool hexapi calc_rvalue_type(const cexpr_t *e, typestring &target);
01460 };
01461
01462
01463
01464 enum ctree_maturity_t
01465 {
01466 CMAT_ZERO,
01467 CMAT_BUILT,
01468 CMAT_TRANS1,
01469 CMAT_NICE,
01470 CMAT_TRANS2,
01471 CMAT_CPA,
01472 CMAT_TRANS3,
01473 CMAT_CASTED,
01474 CMAT_FINAL,
01475 };
01476
01477
01478
01479
01480
01481
01482
01483
01484
01485
01486
01487
01488
01489
01490 enum item_preciser_t
01491 {
01492
01493 ITP_EMPTY,
01494 ITP_ARG1,
01495 ITP_ARG64=ITP_ARG1+63,
01496 ITP_BRACE1,
01497 ITP_INNER_LAST=ITP_BRACE1,
01498
01499 ITP_ASM,
01500 ITP_ELSE,
01501 ITP_DO,
01502 ITP_SEMI,
01503 ITP_CURLY1,
01504 ITP_CURLY2,
01505 ITP_BRACE2,
01506 ITP_COLON,
01507 ITP_BLOCK1,
01508
01509 ITP_BLOCK2,
01510
01511 ITP_SIGN = 0x40000000,
01512 ITP_CASE = 0x80000000
01513 };
01514
01515 struct treeloc_t
01516 {
01517 DEFINE_MEMORY_ALLOCATION_FUNCS()
01518 ea_t ea;
01519 item_preciser_t itp;
01520 bool operator < (const treeloc_t &r) const
01521 {
01522 return ea < r.ea
01523 || (ea == r.ea && itp < r.itp);
01524 }
01525 bool operator == (const treeloc_t &r) const
01526 {
01527 return ea == r.ea && itp == r.itp;
01528 }
01529 };
01530
01531
01532
01533
01534
01535
01536
01537 enum cmt_retrieval_type_t
01538 {
01539 RETRIEVE_ONCE,
01540 RETRIEVE_ALWAYS,
01541 };
01542
01543
01544
01545 struct citem_cmt_t : public qstring
01546 {
01547 mutable bool used;
01548 citem_cmt_t(void) {}
01549 citem_cmt_t(const char *s) : qstring(s) {}
01550 };
01551
01552
01553 typedef std::map<treeloc_t, citem_cmt_t> user_cmts_t;
01554
01555
01556
01557 struct citem_locator_t
01558 {
01559 ea_t ea;
01560 ctype_t op;
01561 citem_locator_t(void) {}
01562 citem_locator_t(ea_t _ea, ctype_t _op) : ea(_ea), op(_op) {}
01563 citem_locator_t(const citem_t *i);
01564 DECLARE_COMPARISONS(citem_locator_t);
01565 DEFINE_MEMORY_ALLOCATION_FUNCS()
01566 };
01567
01568
01569 typedef std::map<citem_locator_t, int32> user_iflags_t;
01570
01571
01572
01573
01574
01575 typedef std::map<ea_t, intvec_t> user_unions_t;
01576
01577
01578
01579
01580
01581
01582 struct citem_t
01583 {
01584 ea_t ea;
01585 ctype_t op;
01586 int label_num;
01587
01588
01589
01590
01591 citem_t(void) : ea(BADADDR), op(cot_empty), label_num(-1) {}
01592 citem_t(ctype_t o) : ea(BADADDR), op(o), label_num(-1) {}
01593
01594 void swap(citem_t &r)
01595 {
01596 std::swap(ea, r.ea);
01597 std::swap(op, r.op);
01598 std::swap(label_num, r.label_num);
01599 }
01600
01601 bool is_expr(void) const { return op <= cot_last; }
01602
01603 bool hexapi contains_label(void) const;
01604
01605
01606
01607
01608 const citem_t *hexapi find_parent_of(const citem_t *sitem) const;
01609 citem_t *find_parent_of(const citem_t *item)
01610 { return CONST_CAST(citem_t*)((CONST_CAST(const citem_t*)(this))->find_parent_of(item)); }
01611 size_t print1(char *buf, size_t bufsize, const cfunc_t *func) const;
01612 DEFINE_MEMORY_ALLOCATION_FUNCS()
01613 };
01614
01615
01616
01617 struct cexpr_t : public citem_t
01618 {
01619 union
01620 {
01621 cnumber_t *n;
01622 fnumber_t *fpc;
01623 struct
01624 {
01625 union
01626 {
01627 var_ref_t v;
01628 ea_t obj_ea;
01629 };
01630 int refwidth;
01631 };
01632 struct
01633 {
01634 cexpr_t *x;
01635 union
01636 {
01637 cexpr_t *y;
01638 carglist_t *a;
01639 uint32 m;
01640
01641 };
01642 union
01643 {
01644 cexpr_t *z;
01645 int ptrsize;
01646 };
01647 };
01648 cinsn_t *insn;
01649
01650 char *helper;
01651 char *string;
01652 };
01653 typestring type;
01654 int exflags;
01655
01656
01657
01658 #define EXFL_CPADONE 0x0001 ///< pointer arithmetic correction done
01659 #define EXFL_LVALUE 0x0002 ///< expression is lvalue even if it doesn't look like it
01660 #define EXFL_FPOP 0x0004 ///< floating point operation
01661 #define EXFL_ALONE 0x0008 ///< standalone helper
01662 #define EXFL_ALL 0x000F ///< all currently defined bits
01663
01664
01665 bool cpadone(void) const { return (exflags & EXFL_CPADONE) != 0; }
01666 bool is_odd_lvalue(void) const { return (exflags & EXFL_LVALUE) != 0; }
01667 bool is_fpop(void) const { return (exflags & EXFL_FPOP) != 0; }
01668
01669
01670 void set_cpadone(void) { exflags |= EXFL_CPADONE; }
01671
01672 cexpr_t(void) : x(NULL), y(NULL), z(NULL), exflags(0) {}
01673 cexpr_t(ctype_t cop, cexpr_t *_x) : citem_t(cop), x(_x), y(NULL), z(NULL), exflags(0) {}
01674 cexpr_t(ctype_t cop, cexpr_t *_x, cexpr_t *_y) : citem_t(cop), x(_x), y(_y), z(NULL), exflags(0) {}
01675 cexpr_t(ctype_t cop, cexpr_t *_x, cexpr_t *_y, cexpr_t *_z) : citem_t(cop), x(_x), y(_y), z(_z), exflags(0) {}
01676 cexpr_t(mbl_array_t *mba, const lvar_t &v);
01677 cexpr_t(const cexpr_t &r) : citem_t() { *this = r; }
01678 void swap(cexpr_t &r) { qswap(*this, r); }
01679 cexpr_t &operator=(const cexpr_t &r) { return assign(r); }
01680 cexpr_t &hexapi assign(const cexpr_t &r);
01681 DECLARE_COMPARISONS(cexpr_t);
01682 ~cexpr_t(void) { cleanup(); }
01683
01684
01685
01686
01687
01688 void hexapi replace_by(cexpr_t *r);
01689
01690
01691
01692 void hexapi cleanup(void);
01693
01694
01695
01696
01697
01698 void hexapi put_number(cfunc_t *func, uint64 v, int nbytes, type_sign_t sign=no_sign);
01699
01700
01701
01702
01703
01704
01705 size_t hexapi print1(char *buf, size_t bufsize, const cfunc_t *func) const;
01706
01707
01708
01709
01710
01711 void hexapi calc_type(bool recursive);
01712
01713
01714
01715
01716
01717
01718 bool hexapi equal_effect(const cexpr_t &r) const;
01719
01720
01721
01722
01723 bool hexapi is_child_of(const citem_t *parent) const;
01724
01725
01726
01727
01728 bool hexapi contains_operator(ctype_t needed_op) const;
01729
01730
01731 bool contains_expr(const cexpr_t *e) const;
01732
01733 bool contains_comma(void) const { return contains_operator(cot_comma); }
01734
01735 bool contains_insn(void) const { return contains_operator(cot_insn); }
01736
01737 bool contains_insn_or_label(void) const { return contains_insn() || contains_label(); }
01738
01739 bool contains_comma_or_insn_or_label(void) const { return contains_comma() || contains_insn_or_label(); }
01740
01741
01742 bool is_nice_expr(void) const { return !contains_comma_or_insn_or_label(); }
01743
01744
01745 bool is_nice_cond(void) const { return is_nice_expr() && is_type_bool(type[0]); }
01746
01747
01748 bool is_call_object_of(const citem_t *parent) const { return parent != NULL && parent->op == cot_call && ((cexpr_t*)parent)->x == this; }
01749
01750 type_sign_t get_type_sign(void) const { return ::get_type_sign(idati, type.u_str()); }
01751
01752 bool is_type_unsigned(void) const { return ::is_type_unsigned(idati, type.u_str()); }
01753
01754 bool is_type_signed(void) const { return ::is_type_signed(idati, type.u_str()); }
01755
01756
01757 int hexapi get_nbits(int pbits) const;
01758
01759
01760
01761 bool hexapi requires_lvalue(const cexpr_t *child) const;
01762
01763
01764 bool hexapi has_side_effects(void) const;
01765
01766
01767 uint64 numval(void) const
01768 {
01769 QASSERT(50071, op == cot_num);
01770 return n->value(type);
01771 }
01772
01773 bool is_const_value(uint64 v) const
01774 {
01775 return op == cot_num && numval() == v;
01776 }
01777
01778 bool is_negative_const(void) const
01779 {
01780 return op == cot_num && int64(numval()) < 0;
01781 }
01782
01783 bool is_non_zero_const(void) const
01784 {
01785 return op == cot_num && numval() != 0;
01786 }
01787
01788 bool is_zero_const(void) const { return is_const_value(0); }
01789
01790
01791
01792 bool get_const_value(uint64 *np) const
01793 {
01794 if ( op == cot_num )
01795 {
01796 if ( np != NULL )
01797 *np = numval();
01798 return true;
01799 }
01800 return false;
01801 }
01802
01803 bool maybe_ptr(void) const
01804 {
01805 uint64 v;
01806 if ( get_const_value(&v)
01807 && (ea_t(v) != v || !isEnabled((ea_t)v)) )
01808 return false;
01809 return true;
01810 }
01811
01812 cexpr_t *get_ptr_or_array(void)
01813 {
01814 if ( x->type.is_ptr_or_array() ) return x;
01815 if ( y->type.is_ptr_or_array() ) return y;
01816 return NULL;
01817 }
01818
01819 const cexpr_t *find_op(ctype_t op) const
01820 {
01821 if ( x->op == op ) return x;
01822 if ( y->op == op ) return y;
01823 return NULL;
01824 }
01825 cexpr_t *find_op(ctype_t op) { return (cexpr_t *)((const cexpr_t *)this)->find_op(op); }
01826
01827
01828 const cexpr_t *find_num_op(void) const { return find_op(cot_num); }
01829 cexpr_t *find_num_op(void) { return find_op(cot_num); }
01830
01831
01832
01833 const cexpr_t *theother(const cexpr_t *what) const { return what == x ? y : x; }
01834 cexpr_t *theother(const cexpr_t *what) { return what == x ? y : x; }
01835
01836
01837 bool get_1num_op(cexpr_t **o1, cexpr_t **o2);
01838 bool get_1num_op(const cexpr_t **o1, const cexpr_t **o2) const;
01839
01840 };
01841
01842
01843
01844 struct ceinsn_t
01845 {
01846 DEFINE_MEMORY_ALLOCATION_FUNCS()
01847 cexpr_t expr;
01848 };
01849
01850
01851 enum use_curly_t
01852 {
01853 CALC_CURLY_BRACES,
01854 NO_CURLY_BRACES,
01855 USE_CURLY_BRACES,
01856 };
01857
01858
01859 struct cif_t : public ceinsn_t
01860 {
01861 cinsn_t *ithen;
01862 cinsn_t *ielse;
01863 cif_t(void) : ithen(NULL), ielse(NULL) {}
01864 cif_t(const cif_t &r) : ceinsn_t(), ithen(NULL), ielse(NULL) { *this = r; }
01865 cif_t &operator=(const cif_t &r) { return assign(r); }
01866 cif_t &hexapi assign(const cif_t &r);
01867 DECLARE_COMPARISONS(cif_t);
01868 ~cif_t(void) { cleanup(); }
01869 void cleanup(void);
01870 };
01871
01872
01873 struct cloop_t : public ceinsn_t
01874 {
01875 cinsn_t *body;
01876 cloop_t(void) : body(NULL) {}
01877 cloop_t(cinsn_t *b) : body(b) {}
01878 cloop_t(const cloop_t &r) : ceinsn_t(), body(NULL) { *this = r; }
01879 cloop_t &operator=(const cloop_t &r) { return assign(r); }
01880 cloop_t &hexapi assign(const cloop_t &r);
01881 ~cloop_t(void) { cleanup(); }
01882 void cleanup(void);
01883 };
01884
01885
01886 struct cfor_t : public cloop_t
01887 {
01888 cexpr_t init;
01889 cexpr_t step;
01890 DECLARE_COMPARISONS(cfor_t);
01891 };
01892
01893
01894 struct cwhile_t : public cloop_t
01895 {
01896 DECLARE_COMPARISONS(cwhile_t);
01897 };
01898
01899
01900 struct cdo_t : public cloop_t
01901 {
01902 DECLARE_COMPARISONS(cdo_t);
01903 };
01904
01905
01906 struct creturn_t : public ceinsn_t
01907 {
01908 DECLARE_COMPARISONS(creturn_t);
01909 };
01910
01911
01912 struct cgoto_t
01913 {
01914 int label_num;
01915 DECLARE_COMPARISONS(cgoto_t);
01916 DEFINE_MEMORY_ALLOCATION_FUNCS()
01917 void print(const citem_t *parent, int indent, vc_printer_t &vp) const;
01918 };
01919
01920
01921 struct casm_t : public eavec_t
01922 {
01923 casm_t(ea_t ea) { push_back(ea); }
01924 casm_t(const casm_t &r) : eavec_t(eavec_t(r)) {}
01925 DECLARE_COMPARISONS(casm_t);
01926 void print(const citem_t *parent, int indent, vc_printer_t &vp) const;
01927 bool one_insn(void) const { return size() == 1; }
01928 void genasm(ea_t ea, char *buf, size_t bufsize) const;
01929 };
01930
01931
01932 typedef qvector<cinsn_t *> cinsnptrvec_t;
01933
01934
01935
01936 struct cinsn_t : public citem_t
01937 {
01938 union
01939 {
01940 cblock_t *cblock;
01941 cexpr_t *cexpr;
01942 cif_t *cif;
01943 cfor_t *cfor;
01944 cwhile_t *cwhile;
01945 cdo_t *cdo;
01946 cswitch_t *cswitch;
01947 creturn_t *creturn;
01948 cgoto_t *cgoto;
01949 casm_t *casm;
01950 };
01951
01952 cinsn_t(void) : citem_t(cit_empty) {}
01953 cinsn_t(const cinsn_t &r) : citem_t(cit_empty) { *this = r; }
01954 void swap(cinsn_t &r) { citem_t::swap(r); std::swap(cblock, r.cblock); }
01955 cinsn_t &operator=(const cinsn_t &r) { return assign(r); }
01956 cinsn_t &hexapi assign(const cinsn_t &r);
01957 DECLARE_COMPARISONS(cinsn_t);
01958 ~cinsn_t(void) { cleanup(); }
01959
01960
01961
01962
01963
01964 void hexapi replace_by(cinsn_t *r);
01965
01966
01967
01968 void hexapi cleanup(void);
01969
01970
01971 void zero(void) { op = cit_empty; cblock=NULL; }
01972
01973
01974
01975
01976 cinsn_t &hexapi new_insn(ea_t ea);
01977
01978
01979
01980
01981 cif_t &hexapi create_if(cexpr_t *cnd);
01982
01983
01984
01985
01986
01987 void hexapi print(int indent, vc_printer_t &vp, use_curly_t use_curly=CALC_CURLY_BRACES) const;
01988
01989
01990
01991
01992
01993
01994
01995 size_t hexapi print1(char *buf, size_t bufsize, const cfunc_t *func) const;
01996
01997
01998
01999 bool hexapi is_ordinary_flow(void) const;
02000
02001
02002
02003
02004 bool hexapi contains_insn(ctype_t type) const;
02005
02006
02007
02008
02009
02010
02011
02012
02013 bool hexapi collect_free_breaks(cinsnptrvec_t *breaks);
02014
02015
02016
02017
02018
02019
02020
02021
02022 bool hexapi collect_free_continues(cinsnptrvec_t *continues);
02023
02024
02025 bool contains_free_break(void) const { return CONST_CAST(cinsn_t*)(this)->collect_free_breaks(NULL); }
02026
02027 bool contains_free_continue(void) const { return CONST_CAST(cinsn_t*)(this)->collect_free_continues(NULL); }
02028
02029 };
02030
02031
02032 struct cblock_t : public qlist<cinsn_t>
02033 {
02034 int remove_gotos(intseq_t &used_labels, int break_target, int continue_target, int next_num);
02035 bool use_curly_braces(void) const;
02036 iterator find(const cinsn_t *insn);
02037 DECLARE_COMPARISONS(cblock_t);
02038 };
02039
02040
02041 struct carg_t : public cexpr_t
02042 {
02043 bool is_vararg;
02044 typestring formal_type;
02045 void consume_cexpr(cexpr_t *e)
02046 {
02047 qswap(*(cexpr_t*)this, *e);
02048 delete e;
02049 }
02050 carg_t(void) : is_vararg(false) {}
02051 DECLARE_COMPARISONS(carg_t)
02052 {
02053 return cexpr_t::compare(r);
02054 }
02055 };
02056
02057
02058 struct carglist_t : public qvector<carg_t>
02059 {
02060 typestring functype;
02061 carglist_t(void) {}
02062 carglist_t(const typestring &ftype) : functype(ftype) {}
02063 DECLARE_COMPARISONS(carglist_t);
02064 size_t print(char *buf, size_t bufsize, const cfunc_t *func) const;
02065 int print(int curpos, vc_printer_t &vp) const;
02066 };
02067
02068
02069 struct ccase_t : public cinsn_t
02070 {
02071 qvector<uint64> values;
02072
02073 DECLARE_COMPARISONS(ccase_t);
02074 void print(const cinsn_t *parent, int indent, vc_printer_t &vp) const;
02075 bool set_insn(const cinsn_t *i);
02076 size_t size(void) const { return values.size(); }
02077 const uint64 &value(int i) const { return values[i]; }
02078 };
02079
02080
02081 struct ccases_t : public qvector<ccase_t>
02082 {
02083 DECLARE_COMPARISONS(ccases_t);
02084 void print(const cinsn_t *parent, int indent, vc_printer_t &vp) const;
02085 int find_value(uint64 v) const;
02086 };
02087
02088
02089 struct cswitch_t : public ceinsn_t
02090 {
02091 cnumber_t mvnf;
02092 ccases_t cases;
02093 DECLARE_COMPARISONS(cswitch_t);
02094 };
02095
02096
02097
02098 enum cursor_item_type_t
02099 {
02100 VDI_NONE,
02101 VDI_EXPR,
02102 VDI_LVAR,
02103 VDI_FUNC,
02104 VDI_TAIL,
02105 };
02106
02107
02108
02109 struct ctree_item_t
02110 {
02111 DEFINE_MEMORY_ALLOCATION_FUNCS()
02112 cursor_item_type_t citype;
02113 union
02114 {
02115 citem_t *it;
02116 cexpr_t *e;
02117 cinsn_t *i;
02118 lvar_t *l;
02119 cfunc_t *f;
02120 treeloc_t loc;
02121 };
02122 void verify(const mbl_array_t *mba) const;
02123
02124
02125
02126
02127
02128
02129
02130
02131 member_t *hexapi get_memptr(struc_t **p_sptr=NULL) const;
02132
02133
02134
02135
02136
02137
02138 lvar_t *hexapi get_lvar(void) const;
02139
02140
02141
02142
02143
02144
02145 ea_t hexapi get_ea(void) const;
02146
02147
02148
02149
02150
02151 int hexapi get_label_num(void) const;
02152
02153
02154 bool is_citem(void) const { return citype == VDI_EXPR; }
02155
02156
02157 bool has_label(void) const { return get_label_num() != -1; }
02158 };
02159
02160
02161 enum allow_unused_labels_t
02162 {
02163 FORBID_UNUSED_LABELS = 0,
02164 ALLOW_UNUSED_LABELS = 1,
02165 };
02166
02167 typedef std::map<int, qstring> user_labels_t;
02168
02169
02170
02171
02172
02173
02174
02175
02176
02177 cexpr_t *hexapi lnot(cexpr_t *e);
02178
02179
02180
02181
02182 cinsn_t *hexapi new_block(void);
02183
02184
02185
02186
02187
02188
02189
02190
02191
02192
02193
02194
02195
02196 AS_PRINTF(3, 0) cexpr_t *hexapi vcreate_helper(bool standalone, const typestring &type, const char *format, va_list va);
02197
02198
02199 AS_PRINTF(3, 4) inline cexpr_t *create_helper(bool standalone, const typestring &type, const char *format, ...)
02200 {
02201 va_list va;
02202 va_start(va, format);
02203 cexpr_t *e = vcreate_helper(standalone, type, format, va);
02204 va_end(va);
02205 return e;
02206 }
02207
02208
02209
02210
02211
02212
02213
02214
02215
02216
02217
02218 AS_PRINTF(3, 0) cexpr_t *hexapi vcall_helper(const typestring &rettype, carglist_t *args, const char *format, va_list va);
02219
02220
02221 AS_PRINTF(3, 4) inline cexpr_t *call_helper(
02222 const typestring &rettype,
02223 carglist_t *args,
02224 const char *format, ...)
02225 {
02226 va_list va;
02227 va_start(va, format);
02228 cexpr_t *e = vcall_helper(rettype, args, format, va);
02229 va_end(va);
02230 return e;
02231 }
02232
02233
02234
02235
02236
02237
02238 cexpr_t *hexapi make_num(uint64 n, int opnum=0, type_sign_t sign=no_sign);
02239
02240
02241
02242
02243
02244
02245 cexpr_t *hexapi make_ref(cexpr_t *e);
02246
02247
02248
02249
02250
02251
02252
02253
02254
02255
02256 cexpr_t *hexapi dereference(cexpr_t *e, int ptrsize, bool is_float=false);
02257
02258
02259
02260
02261
02262
02263 void hexapi save_user_labels(ea_t func_ea, const user_labels_t *user_labels);
02264
02265
02266
02267
02268
02269
02270 void hexapi save_user_cmts(ea_t func_ea, const user_cmts_t *user_cmts);
02271
02272
02273
02274
02275
02276 void hexapi save_user_numforms(ea_t func_ea, const user_numforms_t *numforms);
02277
02278
02279
02280
02281
02282
02283 void hexapi save_user_iflags(ea_t func_ea, const user_iflags_t *iflags);
02284
02285
02286
02287
02288
02289
02290 void hexapi save_user_unions(ea_t func_ea, const user_unions_t *unions);
02291
02292
02293
02294
02295
02296
02297
02298 user_labels_t *hexapi restore_user_labels(ea_t func_ea);
02299
02300
02301
02302
02303
02304
02305
02306 user_cmts_t *hexapi restore_user_cmts(ea_t func_ea);
02307
02308
02309
02310
02311
02312
02313
02314 user_numforms_t *hexapi restore_user_numforms(ea_t func_ea);
02315
02316
02317
02318
02319
02320
02321
02322 user_iflags_t *hexapi restore_user_iflags(ea_t func_ea);
02323
02324
02325
02326
02327
02328
02329
02330 user_unions_t *hexapi restore_user_unions(ea_t func_ea);
02331
02332
02333
02334
02335 struct cfunc_t
02336 {
02337 ea_t entry_ea;
02338 mbl_array_t *mba;
02339 cinsn_t body;
02340 intseq_t &rgas;
02341 intseq_t &stas;
02342 ctree_maturity_t maturity;
02343
02344
02345 user_labels_t *user_labels;
02346 user_cmts_t *user_cmts;
02347 user_numforms_t *numforms;
02348 user_iflags_t *user_iflags;
02349 user_unions_t *user_unions;
02350
02351
02352 #define CIT_COLLAPSED 0x0001 ///< display element in collapsed form
02353
02354
02355 public:
02356 cfunc_t(mbl_array_t *mba);
02357 ~cfunc_t(void) { cleanup(); }
02358 DEFINE_MEMORY_ALLOCATION_FUNCS()
02359
02360
02361
02362 void hexapi build_c_tree(void);
02363
02364
02365
02366
02367
02368
02369 void hexapi verify(allow_unused_labels_t aul, bool even_without_debugger) const;
02370
02371
02372
02373
02374
02375 size_t hexapi print_dcl(char *buf, int bufsize) const;
02376
02377
02378
02379 void hexapi print_func(vc_printer_t &vp) const;
02380
02381
02382
02383
02384
02385 bool hexapi get_func_type(typestring &type, qtype &fields) const;
02386
02387
02388
02389
02390
02391
02392
02393 lvars_t *hexapi get_lvars(void);
02394
02395
02396
02397
02398 citem_t *hexapi find_label(int label);
02399
02400
02401
02402
02403 void hexapi remove_unused_labels(void);
02404
02405
02406
02407
02408
02409 const char *hexapi get_user_cmt(const treeloc_t &loc, cmt_retrieval_type_t rt) const;
02410
02411
02412
02413
02414
02415
02416 void hexapi set_user_cmt(const treeloc_t &loc, const char *cmt);
02417
02418
02419
02420
02421 int32 hexapi get_user_iflags(const citem_locator_t &loc) const;
02422
02423
02424
02425
02426 void hexapi set_user_iflags(const citem_locator_t &loc, int32 iflags);
02427
02428
02429 bool hexapi has_orphan_cmts(void) const;
02430
02431
02432
02433 int hexapi del_orphan_cmts(void);
02434
02435
02436
02437
02438
02439 bool hexapi get_user_union_selection(ea_t ea, intvec_t *path);
02440
02441
02442
02443
02444
02445 void hexapi set_user_union_selection(ea_t ea, const intvec_t &path);
02446
02447
02448 void save_user_labels(void) const { ::save_user_labels(entry_ea, user_labels); }
02449
02450 void save_user_cmts(void) const { ::save_user_cmts(entry_ea, user_cmts); }
02451
02452 void save_user_numforms(void) const { ::save_user_numforms(entry_ea, numforms); }
02453
02454 void save_user_iflags(void) const { ::save_user_iflags(entry_ea, user_iflags); }
02455
02456 void save_user_unions(void) const { ::save_user_unions(entry_ea, user_unions); }
02457
02458
02459
02460
02461
02462
02463
02464
02465
02466
02467 bool hexapi get_line_item(const char *line, int x, bool is_ctree_line, ctree_item_t *head, ctree_item_t *item, ctree_item_t *tail);
02468
02469
02470
02471 hexwarns_t &hexapi get_warnings(void);
02472
02473 bool hexapi gather_derefs(int varidx, strtype_info_t *strinfo=NULL) const;
02474 private:
02475
02476
02477 void hexapi cleanup(void);
02478 };
02479
02480
02481
02482 inline void cif_t::cleanup(void) { delete ithen; delete ielse; }
02483 inline void cloop_t::cleanup(void) { delete body; }
02484
02485
02486
02487
02488
02489
02490
02491 inline size_t citem_t::print1(char *buf, size_t bufsize, const cfunc_t *func) const
02492 {
02493 if ( is_expr() )
02494 return ((cexpr_t*)this)->print1(buf, bufsize, func);
02495 else
02496 return ((cinsn_t*)this)->print1(buf, bufsize, func);
02497 }
02498
02499
02500
02501
02502 inline bool cexpr_t::get_1num_op(cexpr_t **o1, cexpr_t **o2)
02503 {
02504 if ( x->op == cot_num )
02505 {
02506 *o1 = x;
02507 *o2 = y;
02508 }
02509 else
02510 {
02511 if ( y->op != cot_num )
02512 return false;
02513 *o1 = y;
02514 *o2 = x;
02515 }
02516 return true;
02517 }
02518
02519 inline bool cexpr_t::get_1num_op(const cexpr_t **o1, const cexpr_t **o2) const
02520 {
02521 return CONST_CAST(cexpr_t*)(this)->get_1num_op(
02522 CONST_CAST(cexpr_t**)(o1),
02523 CONST_CAST(cexpr_t**)(o2));
02524 }
02525
02526 inline citem_locator_t::citem_locator_t(const citem_t *i) : ea(i->ea), op(i->op)
02527 {
02528 }
02529
02530 const char *hexapi get_ctype_name(ctype_t op);
02531 qstring hexapi create_field_name(const typestring &type, uval_t offset=BADADDR);
02532 typestring hexapi dummy_plist_for(const type_t *ptr);
02533 typestring hexapi make_dt(int n);
02534 typedef void *hexdsp_t(int code, ...);
02535 const int HEXRAYS_API_MAGIC1 = 0xC001C0DE;
02536 const int HEXRAYS_API_MAGIC2 = 0xBE37BABE;
02537
02538
02539
02540
02541
02542 enum hexrays_event_t
02543 {
02544
02545
02546 hxe_flowchart,
02547
02548
02549 hxe_prolog,
02550
02551
02552
02553
02554 hxe_preoptimized,
02555
02556
02557 hxe_locopt,
02558
02559
02560 hxe_prealloc,
02561
02562
02563
02564
02565
02566 hxe_glbopt,
02567
02568
02569 hxe_structural,
02570
02571
02572 hxe_maturity,
02573
02574
02575
02576 hxe_interr,
02577
02578
02579 hxe_combine,
02580
02581
02582
02583
02584
02585 hxe_print_func,
02586
02587
02588
02589
02590
02591
02592 hxe_open_pseudocode=100,
02593
02594
02595
02596 hxe_switch_pseudocode,
02597
02598
02599
02600
02601 hxe_refresh_pseudocode,
02602
02603
02604
02605 hxe_close_pseudocode,
02606
02607
02608 hxe_keyboard,
02609
02610
02611
02612
02613
02614 hxe_right_click,
02615
02616
02617 hxe_double_click,
02618
02619
02620
02621
02622 hxe_curpos,
02623
02624
02625
02626 hxe_create_hint,
02627
02628
02629
02630
02631
02632
02633
02634
02635
02636 hxe_text_ready,
02637
02638
02639
02640
02641
02642 };
02643
02644
02645
02646
02647
02648
02649
02650
02651
02652 typedef int idaapi hexrays_cb_t(void *ud, hexrays_event_t event, va_list va);
02653
02654
02655
02656
02657
02658
02659
02660 bool hexapi install_hexrays_callback(hexrays_cb_t *callback, void *ud);
02661
02662
02663
02664
02665
02666
02667
02668 int hexapi remove_hexrays_callback(hexrays_cb_t *callback, void *ud);
02669
02670
02671
02672
02673
02674
02675
02676
02677
02678 enum input_device_t
02679 {
02680 USE_KEYBOARD = 0,
02681 USE_MOUSE = 1,
02682 };
02683
02684
02685
02686
02687 struct ctext_position_t
02688 {
02689 int lnnum;
02690 int x;
02691 int y;
02692
02693
02694 bool in_ctree(int hdrlines) const { return lnnum >= hdrlines; }
02695
02696 DECLARE_COMPARISONS(ctext_position_t)
02697 {
02698 if ( lnnum < r.lnnum ) return -1;
02699 if ( lnnum > r.lnnum ) return 1;
02700 if ( x < r.x ) return -1;
02701 if ( x > r.x ) return 1;
02702 return 0;
02703 }
02704 };
02705
02706
02707
02708
02709 struct history_item_t : public ctext_position_t
02710 {
02711 ea_t ea;
02712 };
02713
02714
02715 typedef qstack<history_item_t> history_t;
02716
02717
02718 typedef int cmt_type_t;
02719 const cmt_type_t
02720 CMT_NONE = 0x0000,
02721 CMT_TAIL = 0x0001,
02722 CMT_BLOCK1 = 0x0002,
02723 CMT_BLOCK2 = 0x0004,
02724 CMT_LVAR = 0x0008,
02725 CMT_FUNC = 0x0010,
02726 CMT_ALL = 0x001F;
02727
02728
02729
02730 struct vdui_t
02731 {
02732 TForm *form;
02733
02734 int flags;
02735
02736
02737
02738 #define VDUI_VISIBLE 0x0001 ///< is visible?
02739 #define VDUI_VALID 0x0002 ///< is valid?
02740 #define VDUI_LOCKED 0x0004 ///< is locked?
02741
02742
02743
02744
02745 bool visible(void) const { return (flags & VDUI_VISIBLE) != 0; }
02746
02747
02748 bool valid(void) const { return (flags & VDUI_VALID) != 0; }
02749
02750
02751 bool locked(void) const { return (flags & VDUI_LOCKED) != 0; }
02752 void set_visible(bool v) { setflag(flags, VDUI_VISIBLE, v); }
02753 void set_valid(bool v) { setflag(flags, VDUI_VALID, v); }
02754 void set_locked(bool v) { setflag(flags, VDUI_LOCKED, v); }
02755
02756 int view_idx;
02757
02758 TCustomControl *microview;
02759 TCustomControl *ct;
02760 TCustomControl *cv;
02761
02762 mbl_array_t *mba;
02763 cfunc_t *cfunc;
02764 strvec_t sv;
02765 int hdrlines;
02766 int code;
02767
02768
02769 ctext_position_t cpos;
02770 ctree_item_t head;
02771 ctree_item_t item;
02772 ctree_item_t tail;
02773
02774
02775 history_t history;
02776
02777
02778
02779
02780
02781
02782
02783
02784
02785 void __fastcall hexapi refresh_view(bool redo_mba);
02786
02787
02788
02789
02790
02791 void __fastcall hexapi refresh_ctext(bool activate=true);
02792
02793
02794
02795
02796
02797
02798
02799 void hexapi switch_to(cfunc_t *f);
02800
02801
02802
02803
02804 bool in_ctree(void) const { return cpos.in_ctree(hdrlines); }
02805
02806
02807
02808
02809 cnumber_t *hexapi get_number(void) const;
02810
02811
02812
02813 void __fastcall hexapi clear(void);
02814
02815
02816
02817
02818
02819 bool __fastcall hexapi refresh_cpos(input_device_t idv);
02820
02821
02822
02823
02824
02825
02826 bool __fastcall hexapi get_current_item(input_device_t idv);
02827
02828
02829
02830
02831
02832 bool __fastcall hexapi ui_rename_lvar(lvar_t *v);
02833
02834
02835
02836
02837
02838
02839
02840 bool __fastcall hexapi rename_lvar(lvar_t *v, const char *name, bool is_user_name);
02841
02842
02843
02844
02845
02846
02847 bool __fastcall hexapi ui_set_lvar_type(lvar_t *v);
02848
02849
02850
02851
02852
02853
02854 bool __fastcall hexapi set_lvar_type(lvar_t *v, const typestring &type);
02855
02856
02857
02858
02859
02860
02861 bool __fastcall hexapi ui_edit_lvar_cmt(lvar_t *v);
02862
02863
02864
02865
02866
02867
02868 bool __fastcall hexapi set_lvar_cmt(lvar_t *v, const char *cmt);
02869
02870
02871
02872
02873
02874 bool __fastcall hexapi ui_map_lvar(lvar_t *v);
02875
02876
02877
02878
02879
02880
02881 bool __fastcall hexapi ui_unmap_lvar(lvar_t *v);
02882
02883
02884
02885
02886
02887
02888
02889 bool __fastcall hexapi map_lvar(lvar_t *from, lvar_t *to);
02890
02891
02892
02893
02894
02895
02896
02897 bool __fastcall hexapi set_strmem_type(struc_t *sptr, member_t *mptr);
02898
02899
02900
02901
02902
02903
02904
02905 bool __fastcall hexapi rename_strmem(struc_t *sptr, member_t *mptr);
02906
02907
02908
02909
02910
02911
02912 bool __fastcall hexapi set_global_type(ea_t ea);
02913
02914
02915
02916
02917
02918
02919 bool __fastcall hexapi rename_global(ea_t ea);
02920
02921
02922
02923
02924
02925
02926 bool __fastcall hexapi rename_label(int label);
02927
02928
02929
02930
02931
02932
02933
02934
02935 bool __fastcall hexapi jump_enter(input_device_t idv, bool new_window);
02936
02937
02938
02939
02940
02941
02942 bool __fastcall hexapi ctree_to_disasm(void);
02943
02944
02945
02946
02947 bool __fastcall hexapi push_current_location(input_device_t idv);
02948
02949
02950
02951 bool __fastcall hexapi pop_current_location(void);
02952
02953
02954
02955
02956
02957
02958
02959
02960
02961 cmt_type_t __fastcall hexapi calc_cmt_type(size_t lnnum, cmt_type_t cmttype) const;
02962
02963
02964
02965
02966
02967
02968 bool __fastcall hexapi edit_cmt(const treeloc_t &loc);
02969
02970
02971
02972
02973
02974 bool __fastcall hexapi edit_func_cmt(void);
02975
02976
02977
02978
02979 bool __fastcall hexapi del_orphan_cmts(void);
02980
02981
02982
02983
02984
02985
02986 bool __fastcall hexapi set_num_radix(int base);
02987
02988
02989
02990
02991
02992 bool __fastcall hexapi set_num_enum(void);
02993
02994
02995
02996
02997 bool __fastcall hexapi set_num_stroff(void);
02998
02999
03000
03001
03002 bool __fastcall hexapi invert_sign(void);
03003
03004
03005
03006
03007 bool __fastcall hexapi collapse_item(bool hide);
03008
03009
03010
03011
03012 bool __fastcall hexapi split_item(bool split);
03013
03014
03015
03016
03017
03018
03019 bool __fastcall hexapi set_vargloc_end(ea_t ea, argloc_t ida_argloc);
03020
03021 };
03022
03023 #ifndef NO_OBSOLETE_FUNCS
03024 #define number_locator_t operand_locator_t
03025 #endif
03026
03027
03028
03029
03030
03031
03032
03033
03034 typedef void *hexdsp_t(int code, ...);
03035
03036
03037
03038 extern hexdsp_t *hexdsp;
03039
03040
03041 enum hexcall_t
03042 {
03043 hx_user_cmts_begin,
03044 hx_user_cmts_end,
03045 hx_user_cmts_next,
03046 hx_user_cmts_prev,
03047 hx_user_cmts_first,
03048 hx_user_cmts_second,
03049 hx_user_cmts_find,
03050 hx_user_cmts_insert,
03051 hx_user_cmts_erase,
03052 hx_user_cmts_clear,
03053 hx_user_cmts_size,
03054 hx_user_cmts_free,
03055 hx_user_numforms_begin,
03056 hx_user_numforms_end,
03057 hx_user_numforms_next,
03058 hx_user_numforms_prev,
03059 hx_user_numforms_first,
03060 hx_user_numforms_second,
03061 hx_user_numforms_find,
03062 hx_user_numforms_insert,
03063 hx_user_numforms_erase,
03064 hx_user_numforms_clear,
03065 hx_user_numforms_size,
03066 hx_user_numforms_free,
03067 hx_user_iflags_begin,
03068 hx_user_iflags_end,
03069 hx_user_iflags_next,
03070 hx_user_iflags_prev,
03071 hx_user_iflags_first,
03072 hx_user_iflags_second,
03073 hx_user_iflags_find,
03074 hx_user_iflags_insert,
03075 hx_user_iflags_erase,
03076 hx_user_iflags_clear,
03077 hx_user_iflags_size,
03078 hx_user_iflags_free,
03079 hx_user_labels_begin,
03080 hx_user_labels_end,
03081 hx_user_labels_next,
03082 hx_user_labels_prev,
03083 hx_user_labels_first,
03084 hx_user_labels_second,
03085 hx_user_labels_find,
03086 hx_user_labels_insert,
03087 hx_user_labels_erase,
03088 hx_user_labels_clear,
03089 hx_user_labels_size,
03090 hx_user_labels_free,
03091 hx_operand_locator_t_compare,
03092 hx_vd_printer_t_print,
03093 hx_qstring_printer_t_print,
03094 hx_remove_typedef,
03095 hx_is_type_correct,
03096 hx_is_type_integral,
03097 hx_is_type_small_struni,
03098 hx_partial_type_num,
03099 hx_get_float_bit,
03100 hx_typestring_print,
03101 hx_typestring_change_sign,
03102 hx_typestring_get_cc,
03103 hx_typestring_get_nth_arg,
03104 hx_get_int_type_by_width_and_sign,
03105 hx_get_unk_type,
03106 hx_get_member_type,
03107 hx_make_array,
03108 hx_make_pointer,
03109 hx_create_typedef,
03110 hx_remove_pointer,
03111 hx_cnv_array_to_ptr,
03112 hx_strtype_info_t_build_base_type,
03113 hx_strtype_info_t_build_udt_type,
03114 hx_arglocs_overlap,
03115 hx_lvar_locator_t_get_regnum,
03116 hx_lvar_locator_t_compare,
03117 hx_lvar_t_accepts_type,
03118 hx_lvar_t_set_lvar_type,
03119 hx_lvar_t_set_width,
03120 hx_lvars_t_find_stkvar,
03121 hx_lvars_t_find,
03122 hx_lvars_t_find_lvar,
03123 hx_restore_user_lvar_settings,
03124 hx_save_user_lvar_settings,
03125 hx_fnumber_t_print,
03126 hx_get_hexrays_version,
03127 hx_open_pseudocode,
03128 hx_close_pseudocode,
03129 hx_decompile,
03130 hx_decompile_many,
03131 hx_micro_err_format,
03132 hx_hexrays_failure_t_desc,
03133 hx_send_database,
03134 hx_negated_relation,
03135 hx_get_op_signness,
03136 hx_asgop,
03137 hx_asgop_revert,
03138 hx_cnumber_t_print,
03139 hx_cnumber_t_value,
03140 hx_cnumber_t_assign,
03141 hx_cnumber_t_compare,
03142 hx_var_ref_t_compare,
03143 hx_ctree_visitor_t_apply_to,
03144 hx_ctree_visitor_t_apply_to_exprs,
03145 hx_ctree_parentee_t_recalc_parent_types,
03146 hx_cfunc_parentee_t_calc_rvalue_type,
03147 hx_citem_locator_t_compare,
03148 hx_citem_t_contains_label,
03149 hx_citem_t_find_parent_of,
03150 hx_cexpr_t_assign,
03151 hx_cexpr_t_compare,
03152 hx_cexpr_t_replace_by,
03153 hx_cexpr_t_cleanup,
03154 hx_cexpr_t_put_number,
03155 hx_cexpr_t_print1,
03156 hx_cexpr_t_calc_type,
03157 hx_cexpr_t_equal_effect,
03158 hx_cexpr_t_is_child_of,
03159 hx_cexpr_t_contains_operator,
03160 hx_cexpr_t_get_nbits,
03161 hx_cexpr_t_requires_lvalue,
03162 hx_cexpr_t_has_side_effects,
03163 hx_cif_t_assign,
03164 hx_cif_t_compare,
03165 hx_cloop_t_assign,
03166 hx_cfor_t_compare,
03167 hx_cwhile_t_compare,
03168 hx_cdo_t_compare,
03169 hx_creturn_t_compare,
03170 hx_cgoto_t_compare,
03171 hx_casm_t_compare,
03172 hx_cinsn_t_assign,
03173 hx_cinsn_t_compare,
03174 hx_cinsn_t_replace_by,
03175 hx_cinsn_t_cleanup,
03176 hx_cinsn_t_new_insn,
03177 hx_cinsn_t_create_if,
03178 hx_cinsn_t_print,
03179 hx_cinsn_t_print1,
03180 hx_cinsn_t_is_ordinary_flow,
03181 hx_cinsn_t_contains_insn,
03182 hx_cinsn_t_collect_free_breaks,
03183 hx_cinsn_t_collect_free_continues,
03184 hx_cblock_t_compare,
03185 hx_carglist_t_compare,
03186 hx_ccase_t_compare,
03187 hx_ccases_t_compare,
03188 hx_cswitch_t_compare,
03189 hx_ctree_item_t_get_memptr,
03190 hx_ctree_item_t_get_lvar,
03191 hx_ctree_item_t_get_ea,
03192 hx_ctree_item_t_get_label_num,
03193 hx_lnot,
03194 hx_new_block,
03195 hx_vcreate_helper,
03196 hx_vcall_helper,
03197 hx_make_num,
03198 hx_make_ref,
03199 hx_dereference,
03200 hx_save_user_labels,
03201 hx_save_user_cmts,
03202 hx_save_user_numforms,
03203 hx_save_user_iflags,
03204 hx_restore_user_labels,
03205 hx_restore_user_cmts,
03206 hx_restore_user_numforms,
03207 hx_restore_user_iflags,
03208 hx_cfunc_t_build_c_tree,
03209 hx_cfunc_t_verify,
03210 hx_cfunc_t_print_dcl,
03211 hx_cfunc_t_print_func,
03212 hx_cfunc_t_get_func_type,
03213 hx_cfunc_t_get_lvars,
03214 hx_cfunc_t_find_label,
03215 hx_cfunc_t_remove_unused_labels,
03216 hx_cfunc_t_get_user_cmt,
03217 hx_cfunc_t_set_user_cmt,
03218 hx_cfunc_t_get_user_iflags,
03219 hx_cfunc_t_set_user_iflags,
03220 hx_cfunc_t_has_orphan_cmts,
03221 hx_cfunc_t_del_orphan_cmts,
03222 hx_cfunc_t_get_line_item,
03223 hx_cfunc_t_get_warnings,
03224 hx_cfunc_t_gather_derefs,
03225 hx_cfunc_t_cleanup,
03226 hx_get_ctype_name,
03227 hx_install_hexrays_callback,
03228 hx_remove_hexrays_callback,
03229 hx_vdui_t_refresh_view,
03230 hx_vdui_t_refresh_ctext,
03231 hx_vdui_t_switch_to,
03232 hx_vdui_t_get_number,
03233 hx_vdui_t_clear,
03234 hx_vdui_t_refresh_cpos,
03235 hx_vdui_t_get_current_item,
03236 hx_vdui_t_ui_rename_lvar,
03237 hx_vdui_t_rename_lvar,
03238 hx_vdui_t_ui_set_lvar_type,
03239 hx_vdui_t_set_lvar_type,
03240 hx_vdui_t_edit_lvar_cmt,
03241 hx_vdui_t_set_lvar_cmt,
03242 hx_vdui_t_set_strmem_type,
03243 hx_vdui_t_rename_strmem,
03244 hx_vdui_t_set_global_type,
03245 hx_vdui_t_rename_global,
03246 hx_vdui_t_rename_label,
03247 hx_vdui_t_jump_enter,
03248 hx_vdui_t_ctree_to_disasm,
03249 hx_vdui_t_push_current_location,
03250 hx_vdui_t_pop_current_location,
03251 hx_vdui_t_calc_cmt_type,
03252 hx_vdui_t_edit_cmt,
03253 hx_vdui_t_edit_func_cmt,
03254 hx_vdui_t_del_orphan_cmts,
03255 hx_vdui_t_set_num_radix,
03256 hx_vdui_t_set_num_enum,
03257 hx_vdui_t_set_num_stroff,
03258 hx_vdui_t_invert_sign,
03259 hx_vdui_t_collapse_item,
03260 hx_vdui_t_split_item,
03261 hx_vdui_t_set_vargloc_end,
03262 hx_lvar_mapping_begin,
03263 hx_lvar_mapping_end,
03264 hx_lvar_mapping_next,
03265 hx_lvar_mapping_prev,
03266 hx_lvar_mapping_first,
03267 hx_lvar_mapping_second,
03268 hx_lvar_mapping_find,
03269 hx_lvar_mapping_insert,
03270 hx_lvar_mapping_erase,
03271 hx_lvar_mapping_clear,
03272 hx_lvar_mapping_size,
03273 hx_lvar_mapping_free,
03274 hx_user_unions_begin,
03275 hx_user_unions_end,
03276 hx_user_unions_next,
03277 hx_user_unions_prev,
03278 hx_user_unions_first,
03279 hx_user_unions_second,
03280 hx_user_unions_find,
03281 hx_user_unions_insert,
03282 hx_user_unions_erase,
03283 hx_user_unions_clear,
03284 hx_user_unions_size,
03285 hx_user_unions_free,
03286 hx_strtype_info_t_create_from,
03287 hx_save_user_unions,
03288 hx_restore_user_unions,
03289 hx_cfunc_t_get_user_union_selection,
03290 hx_cfunc_t_set_user_union_selection,
03291 hx_vdui_t_ui_edit_lvar_cmt,
03292 hx_vdui_t_ui_map_lvar,
03293 hx_vdui_t_ui_unmap_lvar,
03294 hx_vdui_t_map_lvar,
03295 hx_dummy_ptrtype,
03296 hx_create_field_name,
03297 hx_dummy_plist_for,
03298 hx_make_dt,
03299 };
03300
03301 typedef int32 iterator_word;
03302
03303
03304
03305
03306
03307
03308
03309
03310
03311 inline bool init_hexrays_plugin(int flags=0)
03312 {
03313 return callui(ui_clearbreak, HEXRAYS_API_MAGIC1, HEXRAYS_API_MAGIC2, &hexdsp, flags).i == HEXRAYS_API_MAGIC1;
03314 }
03315
03316
03317
03318
03319 inline void term_hexrays_plugin(void)
03320 {
03321 }
03322
03323
03324 struct user_numforms_iterator_t
03325 {
03326 iterator_word x;
03327 bool operator==(const user_numforms_iterator_t &p) const { return x == p.x; }
03328 bool operator!=(const user_numforms_iterator_t &p) const { return x != p.x; }
03329 };
03330
03331
03332
03333 inline user_numforms_iterator_t user_numforms_begin(const user_numforms_t *map)
03334 {
03335 user_numforms_iterator_t p;
03336 hexdsp(hx_user_numforms_begin, &p, map);
03337 return p;
03338 }
03339
03340
03341
03342 inline user_numforms_iterator_t user_numforms_end(const user_numforms_t *map)
03343 {
03344 user_numforms_iterator_t p;
03345 hexdsp(hx_user_numforms_end, &p, map);
03346 return p;
03347 }
03348
03349
03350
03351 inline user_numforms_iterator_t user_numforms_next(user_numforms_iterator_t p)
03352 {
03353 hexdsp(hx_user_numforms_next, &p);
03354 return p;
03355 }
03356
03357
03358
03359 inline user_numforms_iterator_t user_numforms_prev(user_numforms_iterator_t p)
03360 {
03361 hexdsp(hx_user_numforms_prev, &p);
03362 return p;
03363 }
03364
03365
03366
03367 inline const operand_locator_t &user_numforms_first(user_numforms_iterator_t p)
03368 {
03369 return *(operand_locator_t *)hexdsp(hx_user_numforms_first, &p);
03370 }
03371
03372
03373
03374 inline number_format_t &user_numforms_second(user_numforms_iterator_t p)
03375 {
03376 return *(number_format_t *)hexdsp(hx_user_numforms_second, &p);
03377 }
03378
03379
03380
03381 inline user_numforms_iterator_t user_numforms_find(const user_numforms_t *map, const operand_locator_t &key)
03382 {
03383 user_numforms_iterator_t p;
03384 hexdsp(hx_user_numforms_find, &p, map, &key);
03385 return p;
03386 }
03387
03388
03389
03390 inline user_numforms_iterator_t user_numforms_insert(user_numforms_t *map, const operand_locator_t &key, const number_format_t &val)
03391 {
03392 user_numforms_iterator_t p;
03393 hexdsp(hx_user_numforms_insert, &p, map, &key, &val);
03394 return p;
03395 }
03396
03397
03398
03399 inline void user_numforms_erase(user_numforms_t *map, user_numforms_iterator_t p)
03400 {
03401 hexdsp(hx_user_numforms_erase, map, &p);
03402 }
03403
03404
03405
03406 inline void user_numforms_clear(user_numforms_t *map)
03407 {
03408 hexdsp(hx_user_numforms_clear, map);
03409 }
03410
03411
03412
03413 inline size_t user_numforms_size(user_numforms_t *map)
03414 {
03415 return (size_t)hexdsp(hx_user_numforms_size, map);
03416 }
03417
03418
03419
03420 inline void user_numforms_free(user_numforms_t *map)
03421 {
03422 hexdsp(hx_user_numforms_free, map);
03423 }
03424
03425
03426 struct lvar_mapping_iterator_t
03427 {
03428 iterator_word x;
03429 bool operator==(const lvar_mapping_iterator_t &p) const { return x == p.x; }
03430 bool operator!=(const lvar_mapping_iterator_t &p) const { return x != p.x; }
03431 };
03432
03433
03434
03435 inline lvar_mapping_iterator_t lvar_mapping_begin(const lvar_mapping_t *map)
03436 {
03437 lvar_mapping_iterator_t p;
03438 hexdsp(hx_lvar_mapping_begin, &p, map);
03439 return p;
03440 }
03441
03442
03443
03444 inline lvar_mapping_iterator_t lvar_mapping_end(const lvar_mapping_t *map)
03445 {
03446 lvar_mapping_iterator_t p;
03447 hexdsp(hx_lvar_mapping_end, &p, map);
03448 return p;
03449 }
03450
03451
03452
03453 inline lvar_mapping_iterator_t lvar_mapping_next(lvar_mapping_iterator_t p)
03454 {
03455 hexdsp(hx_lvar_mapping_next, &p);
03456 return p;
03457 }
03458
03459
03460
03461 inline lvar_mapping_iterator_t lvar_mapping_prev(lvar_mapping_iterator_t p)
03462 {
03463 hexdsp(hx_lvar_mapping_prev, &p);
03464 return p;
03465 }
03466
03467
03468
03469 inline const lvar_locator_t &lvar_mapping_first(lvar_mapping_iterator_t p)
03470 {
03471 return *(lvar_locator_t *)hexdsp(hx_lvar_mapping_first, &p);
03472 }
03473
03474
03475
03476 inline lvar_locator_t &lvar_mapping_second(lvar_mapping_iterator_t p)
03477 {
03478 return *(lvar_locator_t *)hexdsp(hx_lvar_mapping_second, &p);
03479 }
03480
03481
03482
03483 inline lvar_mapping_iterator_t lvar_mapping_find(const lvar_mapping_t *map, const lvar_locator_t &key)
03484 {
03485 lvar_mapping_iterator_t p;
03486 hexdsp(hx_lvar_mapping_find, &p, map, &key);
03487 return p;
03488 }
03489
03490
03491
03492 inline lvar_mapping_iterator_t lvar_mapping_insert(lvar_mapping_t *map, const lvar_locator_t &key, const lvar_locator_t &val)
03493 {
03494 lvar_mapping_iterator_t p;
03495 hexdsp(hx_lvar_mapping_insert, &p, map, &key, &val);
03496 return p;
03497 }
03498
03499
03500
03501 inline void lvar_mapping_erase(lvar_mapping_t *map, lvar_mapping_iterator_t p)
03502 {
03503 hexdsp(hx_lvar_mapping_erase, map, &p);
03504 }
03505
03506
03507
03508 inline void lvar_mapping_clear(lvar_mapping_t *map)
03509 {
03510 hexdsp(hx_lvar_mapping_clear, map);
03511 }
03512
03513
03514
03515 inline size_t lvar_mapping_size(lvar_mapping_t *map)
03516 {
03517 return (size_t)hexdsp(hx_lvar_mapping_size, map);
03518 }
03519
03520
03521
03522 inline void lvar_mapping_free(lvar_mapping_t *map)
03523 {
03524 hexdsp(hx_lvar_mapping_free, map);
03525 }
03526
03527
03528 struct user_cmts_iterator_t
03529 {
03530 iterator_word x;
03531 bool operator==(const user_cmts_iterator_t &p) const { return x == p.x; }
03532 bool operator!=(const user_cmts_iterator_t &p) const { return x != p.x; }
03533 };
03534
03535
03536
03537 inline user_cmts_iterator_t user_cmts_begin(const user_cmts_t *map)
03538 {
03539 user_cmts_iterator_t p;
03540 hexdsp(hx_user_cmts_begin, &p, map);
03541 return p;
03542 }
03543
03544
03545
03546 inline user_cmts_iterator_t user_cmts_end(const user_cmts_t *map)
03547 {
03548 user_cmts_iterator_t p;
03549 hexdsp(hx_user_cmts_end, &p, map);
03550 return p;
03551 }
03552
03553
03554
03555 inline user_cmts_iterator_t user_cmts_next(user_cmts_iterator_t p)
03556 {
03557 hexdsp(hx_user_cmts_next, &p);
03558 return p;
03559 }
03560
03561
03562
03563 inline user_cmts_iterator_t user_cmts_prev(user_cmts_iterator_t p)
03564 {
03565 hexdsp(hx_user_cmts_prev, &p);
03566 return p;
03567 }
03568
03569
03570
03571 inline const treeloc_t &user_cmts_first(user_cmts_iterator_t p)
03572 {
03573 return *(treeloc_t *)hexdsp(hx_user_cmts_first, &p);
03574 }
03575
03576
03577
03578 inline citem_cmt_t &user_cmts_second(user_cmts_iterator_t p)
03579 {
03580 return *(citem_cmt_t *)hexdsp(hx_user_cmts_second, &p);
03581 }
03582
03583
03584
03585 inline user_cmts_iterator_t user_cmts_find(const user_cmts_t *map, const treeloc_t &key)
03586 {
03587 user_cmts_iterator_t p;
03588 hexdsp(hx_user_cmts_find, &p, map, &key);
03589 return p;
03590 }
03591
03592
03593
03594 inline user_cmts_iterator_t user_cmts_insert(user_cmts_t *map, const treeloc_t &key, const citem_cmt_t &val)
03595 {
03596 user_cmts_iterator_t p;
03597 hexdsp(hx_user_cmts_insert, &p, map, &key, &val);
03598 return p;
03599 }
03600
03601
03602
03603 inline void user_cmts_erase(user_cmts_t *map, user_cmts_iterator_t p)
03604 {
03605 hexdsp(hx_user_cmts_erase, map, &p);
03606 }
03607
03608
03609
03610 inline void user_cmts_clear(user_cmts_t *map)
03611 {
03612 hexdsp(hx_user_cmts_clear, map);
03613 }
03614
03615
03616
03617 inline size_t user_cmts_size(user_cmts_t *map)
03618 {
03619 return (size_t)hexdsp(hx_user_cmts_size, map);
03620 }
03621
03622
03623
03624 inline void user_cmts_free(user_cmts_t *map)
03625 {
03626 hexdsp(hx_user_cmts_free, map);
03627 }
03628
03629
03630 struct user_iflags_iterator_t
03631 {
03632 iterator_word x;
03633 bool operator==(const user_iflags_iterator_t &p) const { return x == p.x; }
03634 bool operator!=(const user_iflags_iterator_t &p) const { return x != p.x; }
03635 };
03636
03637
03638
03639 inline user_iflags_iterator_t user_iflags_begin(const user_iflags_t *map)
03640 {
03641 user_iflags_iterator_t p;
03642 hexdsp(hx_user_iflags_begin, &p, map);
03643 return p;
03644 }
03645
03646
03647
03648 inline user_iflags_iterator_t user_iflags_end(const user_iflags_t *map)
03649 {
03650 user_iflags_iterator_t p;
03651 hexdsp(hx_user_iflags_end, &p, map);
03652 return p;
03653 }
03654
03655
03656
03657 inline user_iflags_iterator_t user_iflags_next(user_iflags_iterator_t p)
03658 {
03659 hexdsp(hx_user_iflags_next, &p);
03660 return p;
03661 }
03662
03663
03664
03665 inline user_iflags_iterator_t user_iflags_prev(user_iflags_iterator_t p)
03666 {
03667 hexdsp(hx_user_iflags_prev, &p);
03668 return p;
03669 }
03670
03671
03672
03673 inline const citem_locator_t &user_iflags_first(user_iflags_iterator_t p)
03674 {
03675 return *(citem_locator_t *)hexdsp(hx_user_iflags_first, &p);
03676 }
03677
03678
03679
03680 inline int32 &user_iflags_second(user_iflags_iterator_t p)
03681 {
03682 return *(int32 *)hexdsp(hx_user_iflags_second, &p);
03683 }
03684
03685
03686
03687 inline user_iflags_iterator_t user_iflags_find(const user_iflags_t *map, const citem_locator_t &key)
03688 {
03689 user_iflags_iterator_t p;
03690 hexdsp(hx_user_iflags_find, &p, map, &key);
03691 return p;
03692 }
03693
03694
03695
03696 inline user_iflags_iterator_t user_iflags_insert(user_iflags_t *map, const citem_locator_t &key, const int32 &val)
03697 {
03698 user_iflags_iterator_t p;
03699 hexdsp(hx_user_iflags_insert, &p, map, &key, &val);
03700 return p;
03701 }
03702
03703
03704
03705 inline void user_iflags_erase(user_iflags_t *map, user_iflags_iterator_t p)
03706 {
03707 hexdsp(hx_user_iflags_erase, map, &p);
03708 }
03709
03710
03711
03712 inline void user_iflags_clear(user_iflags_t *map)
03713 {
03714 hexdsp(hx_user_iflags_clear, map);
03715 }
03716
03717
03718
03719 inline size_t user_iflags_size(user_iflags_t *map)
03720 {
03721 return (size_t)hexdsp(hx_user_iflags_size, map);
03722 }
03723
03724
03725
03726 inline void user_iflags_free(user_iflags_t *map)
03727 {
03728 hexdsp(hx_user_iflags_free, map);
03729 }
03730
03731
03732 struct user_unions_iterator_t
03733 {
03734 iterator_word x;
03735 bool operator==(const user_unions_iterator_t &p) const { return x == p.x; }
03736 bool operator!=(const user_unions_iterator_t &p) const { return x != p.x; }
03737 };
03738
03739
03740
03741 inline user_unions_iterator_t user_unions_begin(const user_unions_t *map)
03742 {
03743 user_unions_iterator_t p;
03744 hexdsp(hx_user_unions_begin, &p, map);
03745 return p;
03746 }
03747
03748
03749
03750 inline user_unions_iterator_t user_unions_end(const user_unions_t *map)
03751 {
03752 user_unions_iterator_t p;
03753 hexdsp(hx_user_unions_end, &p, map);
03754 return p;
03755 }
03756
03757
03758
03759 inline user_unions_iterator_t user_unions_next(user_unions_iterator_t p)
03760 {
03761 hexdsp(hx_user_unions_next, &p);
03762 return p;
03763 }
03764
03765
03766
03767 inline user_unions_iterator_t user_unions_prev(user_unions_iterator_t p)
03768 {
03769 hexdsp(hx_user_unions_prev, &p);
03770 return p;
03771 }
03772
03773
03774
03775 inline const ea_t &user_unions_first(user_unions_iterator_t p)
03776 {
03777 return *(ea_t *)hexdsp(hx_user_unions_first, &p);
03778 }
03779
03780
03781
03782 inline intvec_t &user_unions_second(user_unions_iterator_t p)
03783 {
03784 return *(intvec_t *)hexdsp(hx_user_unions_second, &p);
03785 }
03786
03787
03788
03789 inline user_unions_iterator_t user_unions_find(const user_unions_t *map, const ea_t &key)
03790 {
03791 user_unions_iterator_t p;
03792 hexdsp(hx_user_unions_find, &p, map, &key);
03793 return p;
03794 }
03795
03796
03797
03798 inline user_unions_iterator_t user_unions_insert(user_unions_t *map, const ea_t &key, const intvec_t &val)
03799 {
03800 user_unions_iterator_t p;
03801 hexdsp(hx_user_unions_insert, &p, map, &key, &val);
03802 return p;
03803 }
03804
03805
03806
03807 inline void user_unions_erase(user_unions_t *map, user_unions_iterator_t p)
03808 {
03809 hexdsp(hx_user_unions_erase, map, &p);
03810 }
03811
03812
03813
03814 inline void user_unions_clear(user_unions_t *map)
03815 {
03816 hexdsp(hx_user_unions_clear, map);
03817 }
03818
03819
03820
03821 inline size_t user_unions_size(user_unions_t *map)
03822 {
03823 return (size_t)hexdsp(hx_user_unions_size, map);
03824 }
03825
03826
03827
03828 inline void user_unions_free(user_unions_t *map)
03829 {
03830 hexdsp(hx_user_unions_free, map);
03831 }
03832
03833
03834 struct user_labels_iterator_t
03835 {
03836 iterator_word x;
03837 bool operator==(const user_labels_iterator_t &p) const { return x == p.x; }
03838 bool operator!=(const user_labels_iterator_t &p) const { return x != p.x; }
03839 };
03840
03841
03842
03843 inline user_labels_iterator_t user_labels_begin(const user_labels_t *map)
03844 {
03845 user_labels_iterator_t p;
03846 hexdsp(hx_user_labels_begin, &p, map);
03847 return p;
03848 }
03849
03850
03851
03852 inline user_labels_iterator_t user_labels_end(const user_labels_t *map)
03853 {
03854 user_labels_iterator_t p;
03855 hexdsp(hx_user_labels_end, &p, map);
03856 return p;
03857 }
03858
03859
03860
03861 inline user_labels_iterator_t user_labels_next(user_labels_iterator_t p)
03862 {
03863 hexdsp(hx_user_labels_next, &p);
03864 return p;
03865 }
03866
03867
03868
03869 inline user_labels_iterator_t user_labels_prev(user_labels_iterator_t p)
03870 {
03871 hexdsp(hx_user_labels_prev, &p);
03872 return p;
03873 }
03874
03875
03876
03877 inline const int &user_labels_first(user_labels_iterator_t p)
03878 {
03879 return *(int *)hexdsp(hx_user_labels_first, &p);
03880 }
03881
03882
03883
03884 inline qstring &user_labels_second(user_labels_iterator_t p)
03885 {
03886 return *(qstring *)hexdsp(hx_user_labels_second, &p);
03887 }
03888
03889
03890
03891 inline user_labels_iterator_t user_labels_find(const user_labels_t *map, const int &key)
03892 {
03893 user_labels_iterator_t p;
03894 hexdsp(hx_user_labels_find, &p, map, &key);
03895 return p;
03896 }
03897
03898
03899
03900 inline user_labels_iterator_t user_labels_insert(user_labels_t *map, const int &key, const qstring &val)
03901 {
03902 user_labels_iterator_t p;
03903 hexdsp(hx_user_labels_insert, &p, map, &key, &val);
03904 return p;
03905 }
03906
03907
03908
03909 inline void user_labels_erase(user_labels_t *map, user_labels_iterator_t p)
03910 {
03911 hexdsp(hx_user_labels_erase, map, &p);
03912 }
03913
03914
03915
03916 inline void user_labels_clear(user_labels_t *map)
03917 {
03918 hexdsp(hx_user_labels_clear, map);
03919 }
03920
03921
03922
03923 inline size_t user_labels_size(user_labels_t *map)
03924 {
03925 return (size_t)hexdsp(hx_user_labels_size, map);
03926 }
03927
03928
03929
03930 inline void user_labels_free(user_labels_t *map)
03931 {
03932 hexdsp(hx_user_labels_free, map);
03933 }
03934
03935
03936 inline int operand_locator_t::compare(const operand_locator_t &r) const
03937 {
03938 return (int)hexdsp(hx_operand_locator_t_compare, this, &r);
03939 }
03940
03941
03942 inline AS_PRINTF(3, 4) int vd_printer_t::print(int indent, const char *format, ...)
03943 {
03944 va_list va;
03945 va_start(va, format);
03946 int retval = (int)hexdsp(hx_vd_printer_t_print, this, indent, format, va);
03947 va_end(va);
03948 return retval;
03949 }
03950
03951
03952 inline AS_PRINTF(3, 4) int qstring_printer_t::print(int indent, const char *format, ...)
03953 {
03954 va_list va;
03955 va_start(va, format);
03956 int retval = (int)hexdsp(hx_qstring_printer_t_print, this, indent, format, va);
03957 va_end(va);
03958 return retval;
03959 }
03960
03961
03962 inline const type_t *remove_typedef(const type_t *type, const p_list **fields)
03963 {
03964 return (const type_t *)hexdsp(hx_remove_typedef, type, fields);
03965 }
03966
03967
03968 inline bool is_type_correct(const type_t *ptr)
03969 {
03970 return (bool)(size_t)hexdsp(hx_is_type_correct, ptr);
03971 }
03972
03973
03974 inline bool is_type_integral(const type_t *type)
03975 {
03976 return (bool)(size_t)hexdsp(hx_is_type_integral, type);
03977 }
03978
03979
03980 inline bool is_type_small_struni(const type_t *ptr)
03981 {
03982 return (bool)(size_t)hexdsp(hx_is_type_small_struni, ptr);
03983 }
03984
03985
03986 inline int partial_type_num(const type_t *type)
03987 {
03988 return (int)hexdsp(hx_partial_type_num, type);
03989 }
03990
03991
03992 inline type_t get_float_bit(int width)
03993 {
03994 return (type_t)(size_t)hexdsp(hx_get_float_bit, width);
03995 }
03996
03997
03998 inline size_t typestring::print(char *buf, size_t bufsize) const
03999 {
04000 return (size_t)hexdsp(hx_typestring_print, this, buf, bufsize);
04001 }
04002
04003
04004 inline bool typestring::change_sign(type_sign_t sign)
04005 {
04006 return (bool)(size_t)hexdsp(hx_typestring_change_sign, this, sign);
04007 }
04008
04009
04010 inline cm_t typestring::get_cc(void) const
04011 {
04012 return (cm_t)(size_t)hexdsp(hx_typestring_get_cc, this);
04013 }
04014
04015
04016 inline typestring typestring::get_nth_arg(int n) const
04017 {
04018 typestring retval;
04019 hexdsp(hx_typestring_get_nth_arg, &retval, this, n);
04020 return retval;
04021 }
04022
04023
04024 inline typestring get_int_type_by_width_and_sign(int srcwidth, type_sign_t sign)
04025 {
04026 typestring retval;
04027 hexdsp(hx_get_int_type_by_width_and_sign, &retval, srcwidth, sign);
04028 return retval;
04029 }
04030
04031
04032 inline typestring get_unk_type(int size)
04033 {
04034 typestring retval;
04035 hexdsp(hx_get_unk_type, &retval, size);
04036 return retval;
04037 }
04038
04039
04040 inline typestring dummy_ptrtype(int ptrsize, bool isfp)
04041 {
04042 typestring retval;
04043 hexdsp(hx_dummy_ptrtype, &retval, ptrsize, isfp);
04044 return retval;
04045 }
04046
04047
04048 inline bool get_member_type(const member_t *mptr, typestring *type, qtype *fields)
04049 {
04050 return (bool)(size_t)hexdsp(hx_get_member_type, mptr, type, fields);
04051 }
04052
04053
04054 inline typestring make_array(const type_t *type, int nelems)
04055 {
04056 typestring retval;
04057 hexdsp(hx_make_array, &retval, type, nelems);
04058 return retval;
04059 }
04060
04061
04062 inline typestring make_pointer(const typestring &type)
04063 {
04064 typestring retval;
04065 hexdsp(hx_make_pointer, &retval, &type);
04066 return retval;
04067 }
04068
04069
04070 inline typestring create_typedef(const char *name)
04071 {
04072 typestring retval;
04073 hexdsp(hx_create_typedef, &retval, name);
04074 return retval;
04075 }
04076
04077
04078 inline typestring remove_pointer(const typestring &type)
04079 {
04080 typestring retval;
04081 hexdsp(hx_remove_pointer, &retval, &type);
04082 return retval;
04083 }
04084
04085
04086 inline bool cnv_array_to_ptr(typestring &type)
04087 {
04088 return (bool)(size_t)hexdsp(hx_cnv_array_to_ptr, &type);
04089 }
04090
04091
04092 inline bool strtype_info_t::create_from(const type_t *type, const p_list *fields, bool with_gaps)
04093 {
04094 return (bool)(size_t)hexdsp(hx_strtype_info_t_create_from, this, type, fields, with_gaps);
04095 }
04096
04097
04098 inline bool strtype_info_t::build_base_type(typestring *restype) const
04099 {
04100 return (bool)(size_t)hexdsp(hx_strtype_info_t_build_base_type, this, restype);
04101 }
04102
04103
04104 inline bool strtype_info_t::build_udt_type(typestring *restype, typestring *resfields)
04105 {
04106 return (bool)(size_t)hexdsp(hx_strtype_info_t_build_udt_type, this, restype, resfields);
04107 }
04108
04109
04110 inline bool arglocs_overlap(argloc_t loc1, size_t w1, argloc_t loc2, size_t w2)
04111 {
04112 return (bool)(size_t)hexdsp(hx_arglocs_overlap, loc1, w1, loc2, w2);
04113 }
04114
04115
04116 inline sval_t lvar_locator_t::get_regnum(void) const
04117 {
04118 return (sval_t)hexdsp(hx_lvar_locator_t_get_regnum, this);
04119 }
04120
04121
04122 inline int lvar_locator_t::compare(const lvar_locator_t &r) const
04123 {
04124 return (int)hexdsp(hx_lvar_locator_t_compare, this, &r);
04125 }
04126
04127
04128 inline bool lvar_t::accepts_type(const typestring &t)
04129 {
04130 return (bool)(size_t)hexdsp(hx_lvar_t_accepts_type, this, &t);
04131 }
04132
04133
04134 inline void lvar_t::set_lvar_type(const typestring &t)
04135 {
04136 hexdsp(hx_lvar_t_set_lvar_type, this, &t);
04137 }
04138
04139
04140 inline void lvar_t::set_width(int w, bool is_float)
04141 {
04142 hexdsp(hx_lvar_t_set_width, this, w, is_float);
04143 }
04144
04145
04146 inline int lvars_t::find_stkvar(int32 spoff, int width)
04147 {
04148 return (int)hexdsp(hx_lvars_t_find_stkvar, this, spoff, width);
04149 }
04150
04151
04152 inline lvar_t *lvars_t::find(const lvar_locator_t &ll)
04153 {
04154 return (lvar_t *)hexdsp(hx_lvars_t_find, this, &ll);
04155 }
04156
04157
04158 inline int lvars_t::find_lvar(argloc_t location, int width, int defblk)
04159 {
04160 return (int)hexdsp(hx_lvars_t_find_lvar, this, location, width, defblk);
04161 }
04162
04163
04164 inline int restore_user_lvar_settings(ea_t func_ea, user_lvar_visitor_t &ulv)
04165 {
04166 return (int)hexdsp(hx_restore_user_lvar_settings, func_ea, &ulv);
04167 }
04168
04169
04170 inline void save_user_lvar_settings(ea_t func_ea, user_lvar_visitor_t &ulv)
04171 {
04172 hexdsp(hx_save_user_lvar_settings, func_ea, &ulv);
04173 }
04174
04175
04176 inline size_t fnumber_t::print(char *buf, size_t bufsize) const
04177 {
04178 return (size_t)hexdsp(hx_fnumber_t_print, this, buf, bufsize);
04179 }
04180
04181
04182 inline const char *get_hexrays_version(void)
04183 {
04184 return (const char *)hexdsp(hx_get_hexrays_version);
04185 }
04186
04187
04188 inline vdui_t *open_pseudocode(ea_t ea, int new_window)
04189 {
04190 return (vdui_t *)hexdsp(hx_open_pseudocode, ea, new_window);
04191 }
04192
04193
04194 inline bool close_pseudocode(TForm *f)
04195 {
04196 return (bool)(size_t)hexdsp(hx_close_pseudocode, f);
04197 }
04198
04199
04200 inline cfunc_t *decompile(func_t *pfn, hexrays_failure_t *hf)
04201 {
04202 return (cfunc_t *)hexdsp(hx_decompile, pfn, hf);
04203 }
04204
04205
04206 inline bool decompile_many(const char *outfile, eavec_t *funcaddrs, int vdrun_flags)
04207 {
04208 return (bool)(size_t)hexdsp(hx_decompile_many, outfile, funcaddrs, vdrun_flags);
04209 }
04210
04211
04212 inline const char *micro_err_format(int code)
04213 {
04214 return (const char *)hexdsp(hx_micro_err_format, code);
04215 }
04216
04217
04218 inline qstring hexrays_failure_t::desc(void) const
04219 {
04220 qstring retval;
04221 hexdsp(hx_hexrays_failure_t_desc, &retval, this);
04222 return retval;
04223 }
04224
04225
04226 inline void send_database(const hexrays_failure_t &err, bool silent)
04227 {
04228 hexdsp(hx_send_database, &err, silent);
04229 }
04230
04231
04232 inline ctype_t negated_relation(ctype_t op)
04233 {
04234 return (ctype_t)(size_t)hexdsp(hx_negated_relation, op);
04235 }
04236
04237
04238 inline type_sign_t get_op_signness(ctype_t op)
04239 {
04240 return (type_sign_t)hexdsp(hx_get_op_signness, op);
04241 }
04242
04243
04244 inline ctype_t asgop(ctype_t cop)
04245 {
04246 return (ctype_t)(size_t)hexdsp(hx_asgop, cop);
04247 }
04248
04249
04250 inline ctype_t asgop_revert(ctype_t cop)
04251 {
04252 return (ctype_t)(size_t)hexdsp(hx_asgop_revert, cop);
04253 }
04254
04255
04256 inline size_t cnumber_t::print(char *buf, size_t bufsize, const type_t *type) const
04257 {
04258 return (size_t)hexdsp(hx_cnumber_t_print, this, buf, bufsize, type);
04259 }
04260
04261
04262 inline uint64 cnumber_t::value(const typestring &type) const
04263 {
04264 uint64 retval;
04265 hexdsp(hx_cnumber_t_value, &retval, this, &type);
04266 return retval;
04267 }
04268
04269
04270 inline void cnumber_t::assign(uint64 v, int nbytes, type_sign_t sign)
04271 {
04272 hexdsp(hx_cnumber_t_assign, this, &v, nbytes, sign);
04273 }
04274
04275
04276 inline int cnumber_t::compare(const cnumber_t &r) const
04277 {
04278 return (int)hexdsp(hx_cnumber_t_compare, this, &r);
04279 }
04280
04281
04282 inline int var_ref_t::compare(const var_ref_t &r) const
04283 {
04284 return (int)hexdsp(hx_var_ref_t_compare, this, &r);
04285 }
04286
04287
04288 inline int ctree_visitor_t::apply_to(citem_t *item, citem_t *parent)
04289 {
04290 return (int)hexdsp(hx_ctree_visitor_t_apply_to, this, item, parent);
04291 }
04292
04293
04294 inline int ctree_visitor_t::apply_to_exprs(citem_t *item, citem_t *parent)
04295 {
04296 return (int)hexdsp(hx_ctree_visitor_t_apply_to_exprs, this, item, parent);
04297 }
04298
04299
04300 inline bool ctree_parentee_t::recalc_parent_types(void)
04301 {
04302 return (bool)(size_t)hexdsp(hx_ctree_parentee_t_recalc_parent_types, this);
04303 }
04304
04305
04306 inline bool cfunc_parentee_t::calc_rvalue_type(const cexpr_t *e, typestring &target)
04307 {
04308 return (bool)(size_t)hexdsp(hx_cfunc_parentee_t_calc_rvalue_type, this, e, &target);
04309 }
04310
04311
04312 inline int citem_locator_t::compare(const citem_locator_t &r) const
04313 {
04314 return (int)hexdsp(hx_citem_locator_t_compare, this, &r);
04315 }
04316
04317
04318 inline bool citem_t::contains_label(void) const
04319 {
04320 return (bool)(size_t)hexdsp(hx_citem_t_contains_label, this);
04321 }
04322
04323
04324 inline const citem_t *citem_t::find_parent_of(const citem_t *sitem) const
04325 {
04326 return (const citem_t *)hexdsp(hx_citem_t_find_parent_of, this, sitem);
04327 }
04328
04329
04330 inline cexpr_t &cexpr_t::assign(const cexpr_t &r)
04331 {
04332 return *(cexpr_t *)hexdsp(hx_cexpr_t_assign, this, &r);
04333 }
04334
04335
04336 inline int cexpr_t::compare(const cexpr_t &r) const
04337 {
04338 return (int)hexdsp(hx_cexpr_t_compare, this, &r);
04339 }
04340
04341
04342 inline void cexpr_t::replace_by(cexpr_t *r)
04343 {
04344 hexdsp(hx_cexpr_t_replace_by, this, r);
04345 }
04346
04347
04348 inline void cexpr_t::cleanup(void)
04349 {
04350 hexdsp(hx_cexpr_t_cleanup, this);
04351 }
04352
04353
04354 inline void cexpr_t::put_number(cfunc_t *func, uint64 v, int nbytes, type_sign_t sign)
04355 {
04356 hexdsp(hx_cexpr_t_put_number, this, func, &v, nbytes, sign);
04357 }
04358
04359
04360 inline size_t cexpr_t::print1(char *buf, size_t bufsize, const cfunc_t *func) const
04361 {
04362 return (size_t)hexdsp(hx_cexpr_t_print1, this, buf, bufsize, func);
04363 }
04364
04365
04366 inline void cexpr_t::calc_type(bool recursive)
04367 {
04368 hexdsp(hx_cexpr_t_calc_type, this, recursive);
04369 }
04370
04371
04372 inline bool cexpr_t::equal_effect(const cexpr_t &r) const
04373 {
04374 return (bool)(size_t)hexdsp(hx_cexpr_t_equal_effect, this, &r);
04375 }
04376
04377
04378 inline bool cexpr_t::is_child_of(const citem_t *parent) const
04379 {
04380 return (bool)(size_t)hexdsp(hx_cexpr_t_is_child_of, this, parent);
04381 }
04382
04383
04384 inline bool cexpr_t::contains_operator(ctype_t needed_op) const
04385 {
04386 return (bool)(size_t)hexdsp(hx_cexpr_t_contains_operator, this, needed_op);
04387 }
04388
04389
04390 inline int cexpr_t::get_nbits(int pbits) const
04391 {
04392 return (int)hexdsp(hx_cexpr_t_get_nbits, this, pbits);
04393 }
04394
04395
04396 inline bool cexpr_t::requires_lvalue(const cexpr_t *child) const
04397 {
04398 return (bool)(size_t)hexdsp(hx_cexpr_t_requires_lvalue, this, child);
04399 }
04400
04401
04402 inline bool cexpr_t::has_side_effects(void) const
04403 {
04404 return (bool)(size_t)hexdsp(hx_cexpr_t_has_side_effects, this);
04405 }
04406
04407
04408 inline cif_t &cif_t::assign(const cif_t &r)
04409 {
04410 return *(cif_t *)hexdsp(hx_cif_t_assign, this, &r);
04411 }
04412
04413
04414 inline int cif_t::compare(const cif_t &r) const
04415 {
04416 return (int)hexdsp(hx_cif_t_compare, this, &r);
04417 }
04418
04419
04420 inline cloop_t &cloop_t::assign(const cloop_t &r)
04421 {
04422 return *(cloop_t *)hexdsp(hx_cloop_t_assign, this, &r);
04423 }
04424
04425
04426 inline int cfor_t::compare(const cfor_t &r) const
04427 {
04428 return (int)hexdsp(hx_cfor_t_compare, this, &r);
04429 }
04430
04431
04432 inline int cwhile_t::compare(const cwhile_t &r) const
04433 {
04434 return (int)hexdsp(hx_cwhile_t_compare, this, &r);
04435 }
04436
04437
04438 inline int cdo_t::compare(const cdo_t &r) const
04439 {
04440 return (int)hexdsp(hx_cdo_t_compare, this, &r);
04441 }
04442
04443
04444 inline int creturn_t::compare(const creturn_t &r) const
04445 {
04446 return (int)hexdsp(hx_creturn_t_compare, this, &r);
04447 }
04448
04449
04450 inline int cgoto_t::compare(const cgoto_t &r) const
04451 {
04452 return (int)hexdsp(hx_cgoto_t_compare, this, &r);
04453 }
04454
04455
04456 inline int casm_t::compare(const casm_t &r) const
04457 {
04458 return (int)hexdsp(hx_casm_t_compare, this, &r);
04459 }
04460
04461
04462 inline cinsn_t &cinsn_t::assign(const cinsn_t &r)
04463 {
04464 return *(cinsn_t *)hexdsp(hx_cinsn_t_assign, this, &r);
04465 }
04466
04467
04468 inline int cinsn_t::compare(const cinsn_t &r) const
04469 {
04470 return (int)hexdsp(hx_cinsn_t_compare, this, &r);
04471 }
04472
04473
04474 inline void cinsn_t::replace_by(cinsn_t *r)
04475 {
04476 hexdsp(hx_cinsn_t_replace_by, this, r);
04477 }
04478
04479
04480 inline void cinsn_t::cleanup(void)
04481 {
04482 hexdsp(hx_cinsn_t_cleanup, this);
04483 }
04484
04485
04486 inline cinsn_t &cinsn_t::new_insn(ea_t ea)
04487 {
04488 return *(cinsn_t *)hexdsp(hx_cinsn_t_new_insn, this, ea);
04489 }
04490
04491
04492 inline cif_t &cinsn_t::create_if(cexpr_t *cnd)
04493 {
04494 return *(cif_t *)hexdsp(hx_cinsn_t_create_if, this, cnd);
04495 }
04496
04497
04498 inline void cinsn_t::print(int indent, vc_printer_t &vp, use_curly_t use_curly) const
04499 {
04500 hexdsp(hx_cinsn_t_print, this, indent, &vp, use_curly);
04501 }
04502
04503
04504 inline size_t cinsn_t::print1(char *buf, size_t bufsize, const cfunc_t *func) const
04505 {
04506 return (size_t)hexdsp(hx_cinsn_t_print1, this, buf, bufsize, func);
04507 }
04508
04509
04510 inline bool cinsn_t::is_ordinary_flow(void) const
04511 {
04512 return (bool)(size_t)hexdsp(hx_cinsn_t_is_ordinary_flow, this);
04513 }
04514
04515
04516 inline bool cinsn_t::contains_insn(ctype_t type) const
04517 {
04518 return (bool)(size_t)hexdsp(hx_cinsn_t_contains_insn, this, type);
04519 }
04520
04521
04522 inline bool cinsn_t::collect_free_breaks(cinsnptrvec_t *breaks)
04523 {
04524 return (bool)(size_t)hexdsp(hx_cinsn_t_collect_free_breaks, this, breaks);
04525 }
04526
04527
04528 inline bool cinsn_t::collect_free_continues(cinsnptrvec_t *continues)
04529 {
04530 return (bool)(size_t)hexdsp(hx_cinsn_t_collect_free_continues, this, continues);
04531 }
04532
04533
04534 inline int cblock_t::compare(const cblock_t &r) const
04535 {
04536 return (int)hexdsp(hx_cblock_t_compare, this, &r);
04537 }
04538
04539
04540 inline int carglist_t::compare(const carglist_t &r) const
04541 {
04542 return (int)hexdsp(hx_carglist_t_compare, this, &r);
04543 }
04544
04545
04546 inline int ccase_t::compare(const ccase_t &r) const
04547 {
04548 return (int)hexdsp(hx_ccase_t_compare, this, &r);
04549 }
04550
04551
04552 inline int ccases_t::compare(const ccases_t &r) const
04553 {
04554 return (int)hexdsp(hx_ccases_t_compare, this, &r);
04555 }
04556
04557
04558 inline int cswitch_t::compare(const cswitch_t &r) const
04559 {
04560 return (int)hexdsp(hx_cswitch_t_compare, this, &r);
04561 }
04562
04563
04564 inline member_t *ctree_item_t::get_memptr(struc_t **p_sptr) const
04565 {
04566 return (member_t *)hexdsp(hx_ctree_item_t_get_memptr, this, p_sptr);
04567 }
04568
04569
04570 inline lvar_t *ctree_item_t::get_lvar(void) const
04571 {
04572 return (lvar_t *)hexdsp(hx_ctree_item_t_get_lvar, this);
04573 }
04574
04575
04576 inline ea_t ctree_item_t::get_ea(void) const
04577 {
04578 return (ea_t)hexdsp(hx_ctree_item_t_get_ea, this);
04579 }
04580
04581
04582 inline int ctree_item_t::get_label_num(void) const
04583 {
04584 return (int)hexdsp(hx_ctree_item_t_get_label_num, this);
04585 }
04586
04587
04588 inline cexpr_t *lnot(cexpr_t *e)
04589 {
04590 return (cexpr_t *)hexdsp(hx_lnot, e);
04591 }
04592
04593
04594 inline cinsn_t *new_block(void)
04595 {
04596 return (cinsn_t *)hexdsp(hx_new_block);
04597 }
04598
04599
04600 inline AS_PRINTF(3, 0) cexpr_t *vcreate_helper(bool standalone, const typestring &type, const char *format, va_list va)
04601 {
04602 return (cexpr_t *)hexdsp(hx_vcreate_helper, standalone, &type, format, va);
04603 }
04604
04605
04606 inline AS_PRINTF(3, 0) cexpr_t *vcall_helper(const typestring &rettype, carglist_t *args, const char *format, va_list va)
04607 {
04608 return (cexpr_t *)hexdsp(hx_vcall_helper, &rettype, args, format, va);
04609 }
04610
04611
04612 inline cexpr_t *make_num(uint64 n, int opnum, type_sign_t sign)
04613 {
04614 return (cexpr_t *)hexdsp(hx_make_num, &n, opnum, sign);
04615 }
04616
04617
04618 inline cexpr_t *make_ref(cexpr_t *e)
04619 {
04620 return (cexpr_t *)hexdsp(hx_make_ref, e);
04621 }
04622
04623
04624 inline cexpr_t *dereference(cexpr_t *e, int ptrsize, bool is_float)
04625 {
04626 return (cexpr_t *)hexdsp(hx_dereference, e, ptrsize, is_float);
04627 }
04628
04629
04630 inline void save_user_labels(ea_t func_ea, const user_labels_t *user_labels)
04631 {
04632 hexdsp(hx_save_user_labels, func_ea, user_labels);
04633 }
04634
04635
04636 inline void save_user_cmts(ea_t func_ea, const user_cmts_t *user_cmts)
04637 {
04638 hexdsp(hx_save_user_cmts, func_ea, user_cmts);
04639 }
04640
04641
04642 inline void save_user_numforms(ea_t func_ea, const user_numforms_t *numforms)
04643 {
04644 hexdsp(hx_save_user_numforms, func_ea, numforms);
04645 }
04646
04647
04648 inline void save_user_iflags(ea_t func_ea, const user_iflags_t *iflags)
04649 {
04650 hexdsp(hx_save_user_iflags, func_ea, iflags);
04651 }
04652
04653
04654 inline void save_user_unions(ea_t func_ea, const user_unions_t *unions)
04655 {
04656 hexdsp(hx_save_user_unions, func_ea, unions);
04657 }
04658
04659
04660 inline user_labels_t *restore_user_labels(ea_t func_ea)
04661 {
04662 return (user_labels_t *)hexdsp(hx_restore_user_labels, func_ea);
04663 }
04664
04665
04666 inline user_cmts_t *restore_user_cmts(ea_t func_ea)
04667 {
04668 return (user_cmts_t *)hexdsp(hx_restore_user_cmts, func_ea);
04669 }
04670
04671
04672 inline user_numforms_t *restore_user_numforms(ea_t func_ea)
04673 {
04674 return (user_numforms_t *)hexdsp(hx_restore_user_numforms, func_ea);
04675 }
04676
04677
04678 inline user_iflags_t *restore_user_iflags(ea_t func_ea)
04679 {
04680 return (user_iflags_t *)hexdsp(hx_restore_user_iflags, func_ea);
04681 }
04682
04683
04684 inline user_unions_t *restore_user_unions(ea_t func_ea)
04685 {
04686 return (user_unions_t *)hexdsp(hx_restore_user_unions, func_ea);
04687 }
04688
04689
04690 inline void cfunc_t::build_c_tree(void)
04691 {
04692 hexdsp(hx_cfunc_t_build_c_tree, this);
04693 }
04694
04695
04696 inline void cfunc_t::verify(allow_unused_labels_t aul, bool even_without_debugger) const
04697 {
04698 hexdsp(hx_cfunc_t_verify, this, aul, even_without_debugger);
04699 }
04700
04701
04702 inline size_t cfunc_t::print_dcl(char *buf, int bufsize) const
04703 {
04704 return (size_t)hexdsp(hx_cfunc_t_print_dcl, this, buf, bufsize);
04705 }
04706
04707
04708 inline void cfunc_t::print_func(vc_printer_t &vp) const
04709 {
04710 hexdsp(hx_cfunc_t_print_func, this, &vp);
04711 }
04712
04713
04714 inline bool cfunc_t::get_func_type(typestring &type, qtype &fields) const
04715 {
04716 return (bool)(size_t)hexdsp(hx_cfunc_t_get_func_type, this, &type, &fields);
04717 }
04718
04719
04720 inline lvars_t *cfunc_t::get_lvars(void)
04721 {
04722 return (lvars_t *)hexdsp(hx_cfunc_t_get_lvars, this);
04723 }
04724
04725
04726 inline citem_t *cfunc_t::find_label(int label)
04727 {
04728 return (citem_t *)hexdsp(hx_cfunc_t_find_label, this, label);
04729 }
04730
04731
04732 inline void cfunc_t::remove_unused_labels(void)
04733 {
04734 hexdsp(hx_cfunc_t_remove_unused_labels, this);
04735 }
04736
04737
04738 inline const char *cfunc_t::get_user_cmt(const treeloc_t &loc, cmt_retrieval_type_t rt) const
04739 {
04740 return (const char *)hexdsp(hx_cfunc_t_get_user_cmt, this, &loc, rt);
04741 }
04742
04743
04744 inline void cfunc_t::set_user_cmt(const treeloc_t &loc, const char *cmt)
04745 {
04746 hexdsp(hx_cfunc_t_set_user_cmt, this, &loc, cmt);
04747 }
04748
04749
04750 inline int32 cfunc_t::get_user_iflags(const citem_locator_t &loc) const
04751 {
04752 return (int32)hexdsp(hx_cfunc_t_get_user_iflags, this, &loc);
04753 }
04754
04755
04756 inline void cfunc_t::set_user_iflags(const citem_locator_t &loc, int32 iflags)
04757 {
04758 hexdsp(hx_cfunc_t_set_user_iflags, this, &loc, iflags);
04759 }
04760
04761
04762 inline bool cfunc_t::has_orphan_cmts(void) const
04763 {
04764 return (bool)(size_t)hexdsp(hx_cfunc_t_has_orphan_cmts, this);
04765 }
04766
04767
04768 inline int cfunc_t::del_orphan_cmts(void)
04769 {
04770 return (int)hexdsp(hx_cfunc_t_del_orphan_cmts, this);
04771 }
04772
04773
04774 inline bool cfunc_t::get_user_union_selection(ea_t ea, intvec_t *path)
04775 {
04776 return (bool)(size_t)hexdsp(hx_cfunc_t_get_user_union_selection, this, ea, path);
04777 }
04778
04779
04780 inline void cfunc_t::set_user_union_selection(ea_t ea, const intvec_t &path)
04781 {
04782 hexdsp(hx_cfunc_t_set_user_union_selection, this, ea, &path);
04783 }
04784
04785
04786 inline bool cfunc_t::get_line_item(const char *line, int x, bool is_ctree_line, ctree_item_t *head, ctree_item_t *item, ctree_item_t *tail)
04787 {
04788 return (bool)(size_t)hexdsp(hx_cfunc_t_get_line_item, this, line, x, is_ctree_line, head, item, tail);
04789 }
04790
04791
04792 inline hexwarns_t &cfunc_t::get_warnings(void)
04793 {
04794 return *(hexwarns_t *)hexdsp(hx_cfunc_t_get_warnings, this);
04795 }
04796
04797
04798 inline bool cfunc_t::gather_derefs(int varidx, strtype_info_t *strinfo) const
04799 {
04800 return (bool)(size_t)hexdsp(hx_cfunc_t_gather_derefs, this, varidx, strinfo);
04801 }
04802
04803
04804 inline void cfunc_t::cleanup(void)
04805 {
04806 hexdsp(hx_cfunc_t_cleanup, this);
04807 }
04808
04809
04810 inline const char *get_ctype_name(ctype_t op)
04811 {
04812 return (const char *)hexdsp(hx_get_ctype_name, op);
04813 }
04814
04815
04816 inline qstring create_field_name(const typestring &type, uval_t offset)
04817 {
04818 qstring retval;
04819 hexdsp(hx_create_field_name, &retval, &type, offset);
04820 return retval;
04821 }
04822
04823
04824 inline typestring dummy_plist_for(const type_t *ptr)
04825 {
04826 typestring retval;
04827 hexdsp(hx_dummy_plist_for, &retval, ptr);
04828 return retval;
04829 }
04830
04831
04832 inline typestring make_dt(int n)
04833 {
04834 typestring retval;
04835 hexdsp(hx_make_dt, &retval, n);
04836 return retval;
04837 }
04838
04839
04840 inline bool install_hexrays_callback(hexrays_cb_t *callback, void *ud)
04841 {
04842 return (bool)(size_t)hexdsp(hx_install_hexrays_callback, callback, ud);
04843 }
04844
04845
04846 inline int remove_hexrays_callback(hexrays_cb_t *callback, void *ud)
04847 {
04848 return (int)hexdsp(hx_remove_hexrays_callback, callback, ud);
04849 }
04850
04851
04852 inline void __fastcall vdui_t::refresh_view(bool redo_mba)
04853 {
04854 hexdsp(hx_vdui_t_refresh_view, this, redo_mba);
04855 }
04856
04857
04858 inline void __fastcall vdui_t::refresh_ctext(bool activate)
04859 {
04860 hexdsp(hx_vdui_t_refresh_ctext, this, activate);
04861 }
04862
04863
04864 inline void vdui_t::switch_to(cfunc_t *f)
04865 {
04866 hexdsp(hx_vdui_t_switch_to, this, f);
04867 }
04868
04869
04870 inline cnumber_t *vdui_t::get_number(void) const
04871 {
04872 return (cnumber_t *)hexdsp(hx_vdui_t_get_number, this);
04873 }
04874
04875
04876 inline void __fastcall vdui_t::clear(void)
04877 {
04878 hexdsp(hx_vdui_t_clear, this);
04879 }
04880
04881
04882 inline bool __fastcall vdui_t::refresh_cpos(input_device_t idv)
04883 {
04884 return (bool)(size_t)hexdsp(hx_vdui_t_refresh_cpos, this, idv);
04885 }
04886
04887
04888 inline bool __fastcall vdui_t::get_current_item(input_device_t idv)
04889 {
04890 return (bool)(size_t)hexdsp(hx_vdui_t_get_current_item, this, idv);
04891 }
04892
04893
04894 inline bool __fastcall vdui_t::ui_rename_lvar(lvar_t *v)
04895 {
04896 return (bool)(size_t)hexdsp(hx_vdui_t_ui_rename_lvar, this, v);
04897 }
04898
04899
04900 inline bool __fastcall vdui_t::rename_lvar(lvar_t *v, const char *name, bool is_user_name)
04901 {
04902 return (bool)(size_t)hexdsp(hx_vdui_t_rename_lvar, this, v, name, is_user_name);
04903 }
04904
04905
04906 inline bool __fastcall vdui_t::ui_set_lvar_type(lvar_t *v)
04907 {
04908 return (bool)(size_t)hexdsp(hx_vdui_t_ui_set_lvar_type, this, v);
04909 }
04910
04911
04912 inline bool __fastcall vdui_t::set_lvar_type(lvar_t *v, const typestring &type)
04913 {
04914 return (bool)(size_t)hexdsp(hx_vdui_t_set_lvar_type, this, v, &type);
04915 }
04916
04917
04918 inline bool __fastcall vdui_t::ui_edit_lvar_cmt(lvar_t *v)
04919 {
04920 return (bool)(size_t)hexdsp(hx_vdui_t_ui_edit_lvar_cmt, this, v);
04921 }
04922
04923
04924 inline bool __fastcall vdui_t::set_lvar_cmt(lvar_t *v, const char *cmt)
04925 {
04926 return (bool)(size_t)hexdsp(hx_vdui_t_set_lvar_cmt, this, v, cmt);
04927 }
04928
04929
04930 inline bool __fastcall vdui_t::ui_map_lvar(lvar_t *v)
04931 {
04932 return (bool)(size_t)hexdsp(hx_vdui_t_ui_map_lvar, this, v);
04933 }
04934
04935
04936 inline bool __fastcall vdui_t::ui_unmap_lvar(lvar_t *v)
04937 {
04938 return (bool)(size_t)hexdsp(hx_vdui_t_ui_unmap_lvar, this, v);
04939 }
04940
04941
04942 inline bool __fastcall vdui_t::map_lvar(lvar_t *from, lvar_t *to)
04943 {
04944 return (bool)(size_t)hexdsp(hx_vdui_t_map_lvar, this, from, to);
04945 }
04946
04947
04948 inline bool __fastcall vdui_t::set_strmem_type(struc_t *sptr, member_t *mptr)
04949 {
04950 return (bool)(size_t)hexdsp(hx_vdui_t_set_strmem_type, this, sptr, mptr);
04951 }
04952
04953
04954 inline bool __fastcall vdui_t::rename_strmem(struc_t *sptr, member_t *mptr)
04955 {
04956 return (bool)(size_t)hexdsp(hx_vdui_t_rename_strmem, this, sptr, mptr);
04957 }
04958
04959
04960 inline bool __fastcall vdui_t::set_global_type(ea_t ea)
04961 {
04962 return (bool)(size_t)hexdsp(hx_vdui_t_set_global_type, this, ea);
04963 }
04964
04965
04966 inline bool __fastcall vdui_t::rename_global(ea_t ea)
04967 {
04968 return (bool)(size_t)hexdsp(hx_vdui_t_rename_global, this, ea);
04969 }
04970
04971
04972 inline bool __fastcall vdui_t::rename_label(int label)
04973 {
04974 return (bool)(size_t)hexdsp(hx_vdui_t_rename_label, this, label);
04975 }
04976
04977
04978 inline bool __fastcall vdui_t::jump_enter(input_device_t idv, bool new_window)
04979 {
04980 return (bool)(size_t)hexdsp(hx_vdui_t_jump_enter, this, idv, new_window);
04981 }
04982
04983
04984 inline bool __fastcall vdui_t::ctree_to_disasm(void)
04985 {
04986 return (bool)(size_t)hexdsp(hx_vdui_t_ctree_to_disasm, this);
04987 }
04988
04989
04990 inline bool __fastcall vdui_t::push_current_location(input_device_t idv)
04991 {
04992 return (bool)(size_t)hexdsp(hx_vdui_t_push_current_location, this, idv);
04993 }
04994
04995
04996 inline bool __fastcall vdui_t::pop_current_location(void)
04997 {
04998 return (bool)(size_t)hexdsp(hx_vdui_t_pop_current_location, this);
04999 }
05000
05001
05002 inline cmt_type_t __fastcall vdui_t::calc_cmt_type(size_t lnnum, cmt_type_t cmttype) const
05003 {
05004 return (cmt_type_t)hexdsp(hx_vdui_t_calc_cmt_type, this, lnnum, cmttype);
05005 }
05006
05007
05008 inline bool __fastcall vdui_t::edit_cmt(const treeloc_t &loc)
05009 {
05010 return (bool)(size_t)hexdsp(hx_vdui_t_edit_cmt, this, &loc);
05011 }
05012
05013
05014 inline bool __fastcall vdui_t::edit_func_cmt(void)
05015 {
05016 return (bool)(size_t)hexdsp(hx_vdui_t_edit_func_cmt, this);
05017 }
05018
05019
05020 inline bool __fastcall vdui_t::del_orphan_cmts(void)
05021 {
05022 return (bool)(size_t)hexdsp(hx_vdui_t_del_orphan_cmts, this);
05023 }
05024
05025
05026 inline bool __fastcall vdui_t::set_num_radix(int base)
05027 {
05028 return (bool)(size_t)hexdsp(hx_vdui_t_set_num_radix, this, base);
05029 }
05030
05031
05032 inline bool __fastcall vdui_t::set_num_enum(void)
05033 {
05034 return (bool)(size_t)hexdsp(hx_vdui_t_set_num_enum, this);
05035 }
05036
05037
05038 inline bool __fastcall vdui_t::set_num_stroff(void)
05039 {
05040 return (bool)(size_t)hexdsp(hx_vdui_t_set_num_stroff, this);
05041 }
05042
05043
05044 inline bool __fastcall vdui_t::invert_sign(void)
05045 {
05046 return (bool)(size_t)hexdsp(hx_vdui_t_invert_sign, this);
05047 }
05048
05049
05050 inline bool __fastcall vdui_t::collapse_item(bool hide)
05051 {
05052 return (bool)(size_t)hexdsp(hx_vdui_t_collapse_item, this, hide);
05053 }
05054
05055
05056 inline bool __fastcall vdui_t::split_item(bool split)
05057 {
05058 return (bool)(size_t)hexdsp(hx_vdui_t_split_item, this, split);
05059 }
05060
05061
05062 inline bool __fastcall vdui_t::set_vargloc_end(ea_t ea, argloc_t ida_argloc)
05063 {
05064 return (bool)(size_t)hexdsp(hx_vdui_t_set_vargloc_end, this, ea, ida_argloc);
05065 }
05066
05067 #ifdef __VC__
05068 #pragma warning(pop)
05069 #endif
05070 #pragma pack(pop)
05071 #endif