36#define IDA_SDK_VERSION 920
39#if !defined(__NT__) && !defined(__LINUX__) && !defined(__MAC__)
42# elif defined(__APPLE__)
44# elif defined(__linux__)
47# error "Please define one of: __NT__, __LINUX__, __MAC__"
52#if defined(__LINUX__) || defined(__MAC__)
58#define BADMEMSIZE 0x7FFFFFFFFFFFFFFFull
60#define BADMEMSIZE 0x7FFFFFFFu
64#define ENUM_SIZE(t) : t
68#define _CRT_DECLARE_NONSTDC_NAMES 1
90# define WIN32_LEAN_AND_MEAN
107#include <sys/types.h>
112#define STL_SUPPORT_PRESENT
119#if defined(__cplusplus) || defined(SWIG)
120#define EXTERNC extern "C"
121#define C_INCLUDE EXTERNC \
124#define C_INCLUDE_END }
130#define INLINE __inline
138#define SMAXSTR QSTRINGIZE(MAXSTR)
142#define NT_CDECL __cdecl
159#define PACKED_ALIGNED(al)
160#define AS_STRFTIME(format_idx)
161#define AS_PRINTF(format_idx, varg_idx)
162#define AS_SCANF(format_idx, varg_idx)
163#define WARN_UNUSED_RESULT
164#elif defined(__GNUC__)
165#define DEPRECATED __attribute__((deprecated))
166#define NORETURN __attribute__((noreturn))
167#define PACKED __attribute__((__packed__))
168#define PACKED_ALIGNED(al) __attribute__((__packed__)) __attribute__((__aligned__(al)))
169#define AS_STRFTIME(format_idx) __attribute__((format(strftime, format_idx, 0)))
170#define AS_PRINTF(format_idx, varg_idx) __attribute__((format(printf, format_idx, varg_idx)))
171#define AS_SCANF(format_idx, varg_idx) __attribute__((format(scanf, format_idx, varg_idx)))
172#define WARN_UNUSED_RESULT __attribute__((__warn_unused_result__))
174#define DEPRECATED __declspec(deprecated)
175#define NORETURN __declspec(noreturn)
177#define PACKED_ALIGNED(al)
178#define AS_STRFTIME(format_idx)
179#define AS_PRINTF(format_idx, varg_idx)
180#define AS_SCANF(format_idx, varg_idx)
181#define WARN_UNUSED_RESULT _Check_return_
186#if defined(__GNUC__) && !defined(SWIG) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 402
187#define GCC_DIAG_JOINSTR(x,y) _QSTRINGIZE(x ## y)
188# define GCC_DIAG_DO_PRAGMA(x) _Pragma (#x)
189# define GCC_DIAG_PRAGMA(x) GCC_DIAG_DO_PRAGMA(GCC diagnostic x)
190# if (((__GNUC__ * 100) + __GNUC_MINOR__) >= 406) || defined(__clang__)
191# define GCC_DIAG_OFF(x) GCC_DIAG_PRAGMA(push) \
192 GCC_DIAG_PRAGMA(ignored GCC_DIAG_JOINSTR(-W,x))
193# define GCC_DIAG_ON(x) GCC_DIAG_PRAGMA(pop)
195# define GCC_DIAG_OFF(x) GCC_DIAG_PRAGMA(ignored GCC_DIAG_JOINSTR(-W,x))
196# define GCC_DIAG_ON(x) GCC_DIAG_PRAGMA(warning GCC_DIAG_JOINSTR(-W,x))
199# define GCC_DIAG_OFF(x)
200# define GCC_DIAG_ON(x)
203#if defined(_MSC_VER) && !defined(SWIG)
204# define MSC_DIAG_OFF(x) __pragma(warning(push)) \
205 __pragma(warning(disable : x))
206# define MSC_DIAG_ON(x) __pragma(warning(pop))
208# define MSC_DIAG_OFF(x)
209# define MSC_DIAG_ON(x)
213#if defined(__clang__) || defined (__GNUC__)
214# define DISABLE_ASAN __attribute__((no_sanitize_address))
219#if defined(DONT_DEPRECATE)
232#define qnotused(x) (void)x
235# define NONNULL _Nonnull
241#if defined(__clang__) || defined(__GNUC__)
242# define QUNUSED __attribute__((unused))
249#define va_argi(va, type) ((type)va_arg(va, int))
251#define va_argi(va, type) va_arg(va, type)
255#define CONST_CAST(x) const_cast<x>
256#define _QSTRINGIZE(x) #x
257#define QSTRINGIZE(x) _QSTRINGIZE(x)
271 #define ida_export_data
272 #define ida_module_data
278 #define ida_export ida_export
279 #define ida_export_data ida_export_data
280 #define ida_module_data
284 #define idaapi __stdcall
285 #define ida_export idaapi
286 #ifdef __CODE_CHECKER__
288 #define idaman EXTERNC __declspec(dllexport)
290 #define idaman EXTERNC
292 #if defined(__KERNEL__)
293 #define ida_export_data
294 #define ida_module_data
296 #define ida_export_data __declspec(dllimport)
297 #define ida_module_data __declspec(dllexport)
300#elif defined(__UNIX__)
303 #define idaman EXTERNC __attribute__((visibility("default")))
304 #define ida_local __attribute__((visibility("hidden")))
307 #define idaman EXTERNC __attribute__ ((visibility("default")))
308 #define ida_local __attribute__((visibility("hidden")))
310 #define idaman EXTERNC
315 #define ida_export_data
316 #define ida_module_data
336#if !defined(__LINUX__) || defined(__cplusplus)
355INLINE
int64 qatoll(
const char *nptr) {
return nptr !=
nullptr ? atoll(nptr) :0; }
356#elif defined(_MSC_VER)
357INLINE
int64 qatoll(
const char *nptr) {
return nptr !=
nullptr ? _atoi64(nptr) :0; }
359INLINE
int64 qatoll(
const char *nptr) {
return nptr !=
nullptr ? atol(nptr) : 0; }
364#define strtoull _strtoui64
372#elif defined(__GNUC__)
380#if !defined(_SSIZE_T_DEFINED) && !defined(__ssize_t_defined) && !defined(__GNUC__)
388#if defined(__GNUC__) && !defined(__MINGW32__)
393#elif defined(_MSC_VER) && _MSC_VER >= 1900
398#elif defined(_MSC_VER) || defined(__MINGW32__)
402 #define FMT_ZX "I64X"
403 #define FMT_ZS "I64d"
410 #error "unknown compiler"
425 #define FMT_EA FMT_64
427 #define SVAL_MIN LLONG_MIN
428 #define SVAL_MAX LLONG_MAX
430 #define SVAL_MIN _I64_MIN
431 #define SVAL_MAX _I64_MAX
438 #define SVAL_MIN INT_MIN
439 #define SVAL_MAX INT_MAX
483#define DEFARG(decl, val) decl = val
485#define DEFARG(decl, val) decl
489#define BADADDR ea_t(-1)
490#define BADSEL sel_t(-1)
491#define BADADDR32 ea32_t(-1)
492#define BADADDR64 ea64_t(-1)
524 return ((
qtime64_t)(secs) << 32) | usecs;
555idaman THREAD_SAFE
bool ida_export
qlocaltime(
struct tm *_tm, time_t
t);
571idaman
bool ida_export
qgmtime(
struct tm *_tm, time_t
t);
584idaman time_t ida_export
qtimegm(
const struct tm *ptm);
607idaman
AS_STRFTIME(3) THREAD_SAFE
size_t ida_export qstrftime64(
616idaman THREAD_SAFE
void ida_export
qsleep(
int milliseconds);
637idaman THREAD_SAFE
bool ida_export
gen_rand_buf(
void *buffer,
size_t bufsz);
640#define qoff64_t int64
663# define for if(0); else for
665# pragma warning(disable : 4200)
666# if _MSC_VER >= 1921 && _MSC_VER < 1924
667# pragma function(memmove)
674#define fileno _fileno
675#define getcwd _getcwd
676#define memicmp _memicmp
691#define eFileTooLarge 4
707#define ZZZ msg("%s:%d\n", __FILE__, __LINE__)
709# define BPT __builtin_trap()
710#elif defined(_MSC_VER)
711# define BPT __debugbreak()
712# ifdef __CODE_CHECKER__
718#ifdef __CODE_CHECKER__
719#define CASSERT(cnd) static_assert((cnd), "")
721#define CASSERT(cnd) static_assert((cnd), QSTRINGIZE(cnd))
727#ifdef __CODE_CHECKER__
728#define INTERR(code) interr(code)
730#define INTERR(code) do { if ( under_debugger ) BPT; interr(code); } while(1)
733#define QASSERT(code, cond) do if ( !(cond) ) INTERR(code); while (0)
734#define QBUFCHECK(buf, size, src) ida_fill_buffer(buf, size, src, __FILE__, __LINE__)
738# define TB_QASSERT(Code, Expr) QASSERT(Code, Expr)
739# define TB_INTERR(Code) INTERR(Code)
740# define TB_CCHECK(expr) if ( !(expr) ) warning("Coherency check failed at %s:%d: " #expr, __FILE__, __LINE__)
741# define TB_INTERR_OR_RETURN(code, ...) INTERR(code)
743# define TB_QASSERT(Code, Expr)
744# define TB_INTERR(Code)
745# define TB_CCHECK(expr) if ( !(expr) ) msg("Coherency check failed: " #expr "\n")
746# define TB_INTERR_OR_RETURN(code, ...) return __VA_ARGS__
749#define INTERR_EXC_FMT "Internal error %d occurred when running a script. Either\n" \
750 " - the script misused the IDA API, or\n" \
751 " - there is a logic error in IDA\n" \
752 "Please check the script first.\n" \
753 "If it appears correct, send a bug report to <support@hex-rays.com>.\n" \
754 "In any case we strongly recommend you to restart IDA as soon as possible."
773idaman THREAD_SAFE
void *ida_export
qrealloc(
void *alloc,
size_t newsize);
774idaman THREAD_SAFE
void *ida_export
qcalloc(
size_t nitems,
size_t itemsize);
775idaman THREAD_SAFE
void ida_export
qfree(
void *alloc);
776idaman THREAD_SAFE
char *ida_export
qstrdup(
const char *
string);
777#define qnew(t) ((t*)qalloc(sizeof(t)))
779#define qnewarray(t,n) use_qalloc_array
801# define qnumber(arr) ( \
802 0 * sizeof(reinterpret_cast<const ::qnumber_check_type *>(arr)) \
803 + 0 * sizeof(::qnumber_check_type::check_type((arr), &(arr))) \
804 + sizeof(arr) / sizeof((arr)[0]) )
809 template <
typename T>
813#elif defined(_MSC_VER) && !defined(__CODE_CHECKER__)
814# define qnumber(array) _countof(array)
816# define qnumber(array) (sizeof(array)/sizeof(array[0]))
820#define qoffsetof offsetof
824#if defined(__GNUC__) && !defined(__X86__) && !(defined(__clang__) && defined(__ARM__))
826 #define set_vva(va2, vp) va_copy(va2, *(va_list*)va_arg(vp, void*))
829 #define va_copy(dst, src) dst = src
831 #if defined(__clang__)
832 #define set_vva(va2, vp) va2 = va_arg(vp, va_list)
834 #define set_vva(va2, vp) va_copy(va2, va_arg(vp, va_list))
838#if defined(__LINUX__) && defined(__ARM__)
839# define NULL_VA_LIST() va_list()
841# define NULL_VA_LIST() nullptr
852#if defined(__GNUC__) && !defined(_WIN32)
853idaman THREAD_SAFE
int ida_export
memicmp(
const void *x,
const void *y,
size_t size);
861#define strnicmp strncasecmp
862#define stricmp strcasecmp
863#elif defined(_MSC_VER)
864#define strnicmp _strnicmp
865#define stricmp _stricmp
875idaman THREAD_SAFE
char *ida_export
strrpl(
char *str,
int char1,
int char2);
879INLINE THREAD_SAFE
char *
tail(
char *str) {
return strchr(str,
'\0'); }
882inline THREAD_SAFE
const char *
tail(
const char *str) {
return strchr(str,
'\0'); }
890idaman THREAD_SAFE
char *ida_export
qstrncpy(
char *dst,
const char *src,
size_t dstsize);
896idaman THREAD_SAFE
char *ida_export
qstpncpy(
char *dst,
const char *src,
size_t dstsize);
902idaman THREAD_SAFE
char *ida_export
qstrncat(
char *dst,
const char *src,
size_t dstsize);
907idaman THREAD_SAFE
char *ida_export
qstrtok(
char *s,
const char *delim,
char **save_ptr);
912idaman THREAD_SAFE
char *ida_export
qstrlwr(
char *str);
917idaman THREAD_SAFE
char *ida_export
qstrupr(
char *str);
925idaman THREAD_SAFE
const char *ida_export
stristr(
const char *s1,
const char *s2);
930inline char *idaapi
stristr(
char *s1,
const char *s2) {
return CONST_CAST(
char *)(
stristr((
const char *)s1, s2)); }
937INLINE THREAD_SAFE
bool ida_local
qisascii(
char c) {
return (c & ~0x7f) == 0; }
950INLINE THREAD_SAFE
int ida_local
qtolower(
char c) {
return tolower((
uchar)(c)); }
952INLINE THREAD_SAFE
int ida_local
qtoupper(
char c) {
return toupper((
uchar)(c)); }
955#if !defined(USE_DANGEROUS_FUNCTIONS) && !defined(__CODE_CHECKER__)
957#define strcpy dont_use_strcpy
958#define stpcpy dont_use_stpcpy
959#define strncpy dont_use_strncpy
960#define strcat dont_use_strcat
961#define strncat dont_use_strncat
962#define gets dont_use_gets
963#define sprintf dont_use_sprintf
964#define snprintf dont_use_snprintf
965#define wsprintfA dont_use_wsprintf
968#define strcmpi dont_use_strcmpi
969#define strncmpi dont_use_strncmpi
970#define getenv dont_use_getenv
971#define setenv dont_use_setenv
972#define putenv dont_use_putenv
973#define strtok dont_use_strrok
976#define strlwr dont_use_strlwr
977#define strupr dont_use_strupr
978#define waitid dont_use_waitid
979#define waitpid dont_use_waitpid
980#define wait dont_use_wait
997idaman
AS_PRINTF(3, 4) THREAD_SAFE
int ida_export qsnprintf(
char *buffer,
size_t n, const
char *
format, ...);
998idaman
AS_SCANF (2, 3) THREAD_SAFE
int ida_export qsscanf(const
char *input, const
char *
format, ...);
999idaman
AS_PRINTF(3, 0) THREAD_SAFE
int ida_export qvsnprintf(
char *buffer,
size_t n, const
char *
format, va_list
va);
1000idaman
AS_SCANF (2, 0) THREAD_SAFE
int ida_export qvsscanf(const
char *input, const
char *
format, va_list
va);
1001idaman
AS_PRINTF(3, 4) THREAD_SAFE
int ida_export append_snprintf(
char *buf, const
char *
end, const
char *
format, ...);
1032#define QMAXPATH PATH_MAX
1033#define QMAXFILE PATH_MAX
1061idaman
int ida_export
qchdir(
const char *path);
1096idaman THREAD_SAFE
char *ida_export
qsplitfile(
char *file,
char **base,
char **ext);
1107idaman THREAD_SAFE
const char *ida_export
qbasename(
const char *path);
1117idaman THREAD_SAFE
char *ida_export
qmake_full_path(
char *dst,
size_t dstsize,
const char *src);
1135#if defined(__UNIX__)
1136#define DELIMITER ":"
1138#define DELIMITER ";"
1187 return ::qstrncpy(buf, file,
bufsize);
1221#define WPM_EXPLICIT_DOT 0x01
1232idaman
int ida_export
regex_match(
const char *str,
const char *pattern,
bool sense_case);
1238#if !defined(__NT__) && !defined(_MSC_VER)
1248#if !defined(S_ISREG) && defined(S_IFMT) && defined(S_IFREG)
1249 #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
1251#if !defined(S_ISDIR) && defined(S_IFMT) && defined(S_IFDIR)
1252 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
1261idaman THREAD_SAFE
int ida_export
qopen(
const char *file,
int mode);
1266idaman THREAD_SAFE
int ida_export
qopen_shared(
const char *file,
int mode,
int share_mode);
1271idaman THREAD_SAFE
int ida_export
qcreate(
const char *file,
int stat);
1273idaman THREAD_SAFE
int ida_export
qread(
int h,
void *buf,
size_t n);
1274idaman THREAD_SAFE
int ida_export
qwrite(
int h,
const void *buf,
size_t n);
1275idaman THREAD_SAFE qoff64_t ida_export
qtell(
int h);
1276idaman THREAD_SAFE qoff64_t ida_export
qseek(
int h,
int64 offset,
int whence);
1277idaman THREAD_SAFE
int ida_export
qclose(
int h);
1278idaman THREAD_SAFE
int ida_export
qdup(
int h);
1279idaman THREAD_SAFE
int ida_export
qfsync(
int h);
1308idaman THREAD_SAFE
int ida_export
qmkdir(
const char *file,
int mode);
1316idaman THREAD_SAFE
int ida_export
qrmdir(
const char *file);
1325idaman THREAD_SAFE
bool ida_export
qisdir(
const char *file);
1333idaman THREAD_SAFE
int ida_export
qtouchfile(
const char *file_name);
1338idaman THREAD_SAFE
void ida_export
qatexit(
void (idaapi *func)(
void));
1343idaman THREAD_SAFE
void ida_export
del_qatexit(
void (idaapi*func)(
void));
1354#define qmin(a,b) ((a) < (b)? (a): (b))
1355#define qmax(a,b) ((a) > (b)? (a): (b))
1357template <
class T> T
qabs(T x) {
return x < 0 ? -x : x; }
1359int qabs(
int x) {
return x < 0 ? -x : x; }
1366 return (bitmap[bit/8] & (1<<(bit&7))) != 0;
1371 uchar *p = bitmap + bit/8;
1372 *p = (
uchar)(*p | (1<<(bit&7)));
1377 uchar *p = bitmap + bit/8;
1378 *p = (
uchar)(*p & ~(1<<(bit&7)));
1384 for ( bit =
low; bit <
high; ++bit )
1391 for ( bit =
low; bit <
high; ++bit )
1397 memset(bitmap, 0xFF,
nbits/8);
1398 if ( (
nbits & 7) != 0 )
1401 *p |= ((1 << (
nbits&7))-1);
1407 memset(bitmap, 0,
nbits/8);
1408 if ( (
nbits & 7) != 0 )
1411 *p &= ~((1 << (
nbits&7))-1);
1434 return ((val - 1) & val) == 0;
1441 return r != 0 ? val + base - r : val;
1445 return val - val % base;
1461 return s1 != 0 && s2 != 0 && off2 <=
last(off1, s1) && off1 <=
last(off2, s2);
1466 return s1 != 0 && off2 >= off1 &&
last(off2, s2) <=
last(off1, s1);
1471 return s1 != 0 && off >= off1 && off <=
last(off1, s1);
1481template <
class T>
constexpr T
left_shift(
const T &value,
int shift)
1483 return shift >=
sizeof(T)*8 ? 0 : (value << shift);
1488 return shift >=
sizeof(T)*8 ? 0 : (value >> shift);
1493 return shift >=
sizeof(T)*8 ? (value >= 0 ? 0 : -1) : (value >> shift);
1499 const size_t nbits =
sizeof(T) * 8;
1511 const size_t nbits =
sizeof(T) * 8;
1527template<
class T,
class U>
void idaapi
setflag(T &where, U bit,
bool cnd)
1530 where = T(where | bit);
1532 where = T(where & ~T(bit));
1539 if ( elsize == 0 ||
count == 0 )
1541 return count <= ((T)(-1)) / elsize;
1548 return y >= 0 ? y <= ((U)(-1)) - x : (0-y) <= x;
1563 return b != 0 && !(a == minval && b == -1);
1568template <
typename T>
1573 if (
nbits >=
sizeof(T) * 8 )
1575 T signbit = T(1) << (
nbits - 1);
1576 T mask = (signbit << 1) - 1;
1577 if ( (v & signbit) != 0 )
1588# define OPERATOR_NEW(type, count) (is_mul_ok(size_t(count), sizeof(type)) \
1590 : (type *)qalloc_or_throw(BADMEMSIZE))
1592# define OPERATOR_NEW(type, count) new type[count]
1605#define MC2(c1, c2) ushort(((c2)<<8)|c1)
1606#define MC3(c1, c2, c3) uint32(((((c3)<<8)|(c2))<<8)|c1)
1607#define MC4(c1, c2, c3, c4) uint32(((((((c4)<<8)|(c3))<<8)|(c2))<<8)|c1)
1639#define read4bytes(h, res, mf) readbytes(h, res, 4, mf)
1640#define write2bytes(h, l, mf) writebytes(h, l, 2, mf)
1641#define write4bytes(h, l, mf) writebytes(h, l, 4, mf)
1651 {
return (x>>24) | (x<<24) | ((x>>8) & 0x0000FF00) | ((x<<8) & 0x00FF0000); }
1655 {
return ushort((x<<8) | (x>>8)); }
1659# define swap32(x) uint32((x>>24) | (x<<24) | ((x>>8) & 0x0000FF00) | ((x<<8) & 0x00FF0000))
1662# define swap16(x) ushort((x<<8) | (x>>8))
1668#define swapea swap64
1670#define swapea swap32
1678#define qhtonl(x) (x)
1679#define qntohl(x) (x)
1680#define qhtons(x) (x)
1681#define qntohs(x) (x)
1683#define qhtons(x) swap16(x)
1684#define qntohs(x) swap16(x)
1685#define qhtonl(x) swap32(x)
1686#define qntohl(x) swap32(x)
1715template <
class T>
inline THREAD_SAFE
void qswap(T &a, T &b)
1717 char temp[
sizeof(T)];
1718 memcpy(&temp, &a,
sizeof(T));
1719 memcpy(&a, &b,
sizeof(T));
1720 memcpy(&b, &temp,
sizeof(T));
1749 const uchar *ptr = *pptr;
1807 const uchar *src = *pptr;
1808 const uchar *send = src + destsize;
1809 if ( send < src || send >
end )
1812 return memcpy(destbuf, src, destsize);
1829 const uchar *src = *pptr;
1831 if ( srcend < src || srcend >
end )
1834 if ( dst !=
nullptr )
1836 memcpy(dst, src,
size);
1852 const uchar *ret = *pptr;
1853 const uchar *rend = ret + objsize;
1854 if ( rend < ret || rend >
end )
1915 if ( buf ==
nullptr )
1917 size_t size = *pptr - (
const uchar *)buf;
1918 if (
size >= dstsize )
1920 memcpy(dst, buf,
size);
1958static constexpr int ea_packed_size =
sizeof(
ea_t) +
sizeof(
ea_t)/4;
1959static constexpr int dq_packed_size = 10;
1960static constexpr int dd_packed_size = 5;
1961static constexpr int dw_packed_size = 3;
1964inline THREAD_SAFE
int ds_packed_size(
const char *s) {
return s ? int(strlen(s)+dd_packed_size) : 1; }
1969 return (first_byte & 0x80) == 0 ? 1
1970 : (first_byte & 0xC0) == 0xC0 ? 3
1977 return (first_byte & 0x80) == 0x00 ? 1
1978 : (first_byte & 0xC0) != 0xC0 ? 2
1979 : (first_byte & 0xE0) == 0xE0 ? 5
1996inline THREAD_SAFE
void *
extract_obj(T &v,
void *destbuf,
size_t destsize)
1998 if ( destsize == 0 )
2000 return v.read(destbuf, destsize) == destsize ? destbuf :
nullptr;
2006 uchar packed[dw_packed_size];
2008 int psize =
dw_size(packed[0]);
2010 const uchar *ptr = packed;
2017 uchar packed[dd_packed_size];
2019 int psize =
dd_size(packed[0]);
2021 const uchar *ptr = packed;
2047 if ( buf ==
nullptr )
2064 const uchar *ptr = *pptr;
2065 const uchar *str = ptr;
2069 while ( *ptr++ !=
'\0' );
2083#define APPCHAR(buf, end, chr) \
2086 char __chr = (chr); \
2087 QASSERT(518, (buf) < (end)); \
2089 if ( (buf) >= (end) ) \
2098#define APPZERO(buf, end) \
2101 QASSERT(519, (buf) < (end)); \
2106#define APPEND(buf, end, name) \
2109 QASSERT(520, (buf) < (end)); \
2110 const char *__ida_in = (name); \
2113 if ( (buf) == (end)-1 ) \
2118 if ( (*(buf) = *__ida_in++) == '\0' ) \
2142idaman THREAD_SAFE
void *ida_export
qvector_reserve(
void *vec,
void *old,
size_t cnt,
size_t elsize);
2144#if defined(__cplusplus)
2150 #define DEFINE_MEMORY_ALLOCATION_FUNCS()
2152 #define PLACEMENT_DELETE void operator delete(void *, void *) {}
2153 #define DEFINE_MEMORY_ALLOCATION_FUNCS() \
2154 void *operator new (size_t _s) { return qalloc_or_throw(_s); } \
2155 void *operator new[](size_t _s) { return qalloc_or_throw(_s); } \
2156 void *operator new(size_t , void *_v) { return _v; } \
2157 void operator delete (void *_blk) { qfree(_blk); } \
2158 void operator delete[](void *_blk) { qfree(_blk); } \
2163#define DECLARE_COMPARISON_OPERATORS(type) \
2164 bool operator==(const type &r) const { return compare(r) == 0; } \
2165 bool operator!=(const type &r) const { return compare(r) != 0; } \
2166 bool operator< (const type &r) const { return compare(r) < 0; } \
2167 bool operator> (const type &r) const { return compare(r) > 0; } \
2168 bool operator<=(const type &r) const { return compare(r) <= 0; } \
2169 bool operator>=(const type &r) const { return compare(r) >= 0; }
2173#define DECLARE_COMPARISONS(type) \
2174 DECLARE_COMPARISON_OPERATORS(type) \
2175 int compare(const type &r) const
2181template <
class T>
struct ida_movable_type
2183 static constexpr bool value = std::is_pod<T>::value;
2185#define DECLARE_TYPE_AS_MOVABLE(T) template <> struct ida_movable_type<T> { static constexpr bool value = true; }
2186template <
class T>
inline constexpr THREAD_SAFE
bool may_move_bytes(
void)
2188 return ida_movable_type<T>::value;
2199 if ( may_move_bytes<T>() )
2201 memmove(dst, src, cnt*
sizeof(T));
2208 new(dst) T(std::move(*src));
2222 if ( may_move_bytes<T>() )
2224 memmove(dst, src, cnt*
sizeof(T));
2235 new(dst) T(std::move(*src));
2257 size_t _newsize = x.n;
2262 copy_range(x, 0, _newsize);
2267 void copy_range(
const qvector<T> &x,
size_t from,
size_t _newsize)
2269 if ( std::is_trivially_copyable<T>::value )
2271 memcpy(array + from, x.array + from, (_newsize-from)*
sizeof(T));
2275 for (
size_t i = from; i < _newsize; i++ )
2276 new(array+i) T(x.array[i]);
2287 void resize_less(
size_t _newsize)
2289 if ( !std::is_trivially_destructible<T>::value )
2292 for (
size_t i = _newsize; i < _size; i++ )
2296#ifdef TESTABLE_BUILD
2304 void resize_more_trivial(
size_t _newsize)
2307 memset(array+n, 0, (_newsize-n)*
sizeof(T));
2311 void resize_more(
size_t _newsize,
const T &x)
2314 for (
size_t i = n; i < _newsize; i++ )
2319 bool ref_within_range(
const T &x)
const
2321 const T *
const p = &x;
2322 return p >= array && p < array + alloc;
2335 array = x.array; x.array =
nullptr;
2337 alloc = x.alloc; x.alloc = 0;
2343 if ( array !=
nullptr )
2353 TB_QASSERT(1907, !ref_within_range(x));
2356 new (array+n) T(std::move(val));
2363 bool aliasing = ref_within_range(x);
2364 TB_QASSERT(1977, !aliasing);
2373 T val(std::move(x));
2375 new (array+n) T(std::move(val));
2380 new (array+n) T(std::move(x));
2389 template <
typename... Args>
2395 new (array+n) T(std::forward<Args>(
args)...);
2416#ifdef TESTABLE_BUILD
2423 size_t size(
void)
const {
return n; }
2424 bool empty(
void)
const {
return n == 0; }
2427 const T &
at(
size_t _idx)
const {
return array[_idx]; }
2428 T &
at(
size_t _idx) {
return array[_idx]; }
2429 const T &
front(
void)
const {
return array[0]; }
2431 const T &
back(
void)
const {
return array[n-1]; }
2432 T &
back(
void) {
return array[n-1]; }
2441 if ( array !=
nullptr )
2459 array = m.array; m.array =
nullptr;
2461 alloc = m.alloc; m.alloc = 0;
2471#ifdef TESTABLE_BUILD
2472 QASSERT(1908, !ref_within_range(x));
2475 resize_less(_newsize);
2476 else if ( _newsize > n )
2478 if ( ref_within_range(x) )
2479 resize_more(_newsize, T(x));
2481 resize_more(_newsize, x);
2487 if ( std::is_trivially_constructible<T>::value && _newsize > n )
2488 resize_more_trivial(_newsize);
2489 else if ( _newsize == n )
2491#if __cplusplus >= 201703
2492 else if constexpr ( std::is_default_constructible<T>::value )
2494 else if ( _newsize < n )
2495 resize_less(_newsize);
2497 QASSERT(3396,
false);
2506 CASSERT(std::is_trivially_constructible<T>::value);
2507 CASSERT(std::is_trivially_destructible<T>::value);
2515#ifdef TESTABLE_BUILD
2516 QASSERT(1909, !ref_within_range(x));
2520 new(array+n) T(std::move(val));
2532 if ( may_move_bytes<T>() )
2538 size_t old_alloc = alloc;
2540 size_t new_alloc = alloc;
2554 array = (T*)
qrealloc(array, n*
sizeof(T));
2564 size_t alloc2 = alloc;
2598 for (
size_t i=0; i < n; i++ )
2599 if ( array[i] != r[i] )
2619#ifdef TESTABLE_BUILD
2620 QASSERT(1910, !ref_within_range(x));
2623 size_t idx = it - array;
2626 size_t rest =
end() - p;
2628 new(p) T(std::move(val));
2636#ifdef TESTABLE_BUILD
2637 QASSERT(1978, !ref_within_range(x));
2639 T val(std::forward<T>(x));
2640 size_t idx = it - array;
2643 size_t rest =
end() - p;
2645 new(p) T(std::move(val));
2657 size_t cnt = last - first;
2661 size_t idx = it - array;
2664 size_t rest =
end() - p;
2666 while ( first != last )
2681 size_t rest =
end() - it - 1;
2692 for ( T *p=first; p != last; ++p )
2694 size_t rest =
end() - last;
2803 pool_size = 4*1024*1024,
2804 pool_nelems = pool_size /
sizeof(T),
2809 CASSERT(
sizeof(T) >=
sizeof(
void *) && pool_nelems > 0);
2812 T *free_list =
nullptr;
2813 T *pool_ptr =
nullptr;
2814 T *pool_end =
nullptr;
2815 size_t live_objects = 0;
2818 void free_entire_pool()
2820 for ( T *p : pools )
2823 free_list =
nullptr;
2852 if ( free_list !=
nullptr )
2855 free_list = *(T**)ptr;
2859 if ( pool_ptr == pool_end )
2862 pool_end = pool_ptr + pool_nelems;
2863 pools.push_back(pool_ptr);
2877 *(T**)ptr = free_list;
2879 if ( --live_objects == 0 )
2905 if ( a.size() != b.size() )
2906 return a.size() > b.size() ? 1 : -1;
2907 for (
int i=0; i < a.size(); i++ )
2924 if ( ptr !=
nullptr && --ptr->refcnt == 0 )
2931 if ( ptr !=
nullptr )
2938 if ( ptr !=
nullptr )
2951 operator T *()
const
2988 virtual bool idaapi
next(
void) = 0;
2998inline THREAD_SAFE
size_t idaapi
qstrlen(
const char *s) {
return strlen(s); }
2999inline THREAD_SAFE
size_t idaapi
qstrlen(
const uchar *s) {
return strlen((
const char *)s); }
3011inline THREAD_SAFE
int idaapi
qstrcmp(
const char *s1,
const char *s2) {
return strcmp(s1, s2); }
3012inline THREAD_SAFE
int idaapi
qstrcmp(
const uchar *s1,
const uchar *s2) {
return strcmp((
const char *)s1, (
const char *)s2); }
3024inline THREAD_SAFE
int idaapi
qstrncmp(
const char *s1,
const char *s2,
size_t len) {
return strncmp(s1, s2,
len); }
3025inline THREAD_SAFE
int idaapi
qstrncmp(
const uchar *s1,
const uchar *s2,
size_t len) {
return strncmp((
const char *)s1, (
const char *)s2,
len); }
3033inline THREAD_SAFE
char *idaapi
qstrstr(
char *s1,
const char *s2) {
return strstr(s1, s2); }
3034inline THREAD_SAFE
const char *idaapi
qstrstr(
const char *s1,
const char *s2) {
return strstr(s1, s2); }
3042inline THREAD_SAFE
char *idaapi
qstrchr(
char *s1,
char c) {
return strchr(s1, c); }
3043inline THREAD_SAFE
const char *idaapi
qstrchr(
const char *s1,
char c) {
return strchr(s1, c); }
3055inline THREAD_SAFE
const char *idaapi
qstrrchr(
const char *s1,
char c) {
return strrchr(s1, c); }
3056inline THREAD_SAFE
char *idaapi
qstrrchr(
char *s1,
char c) {
return strrchr(s1, c); }
3066#define SSF_DROP_EMPTY 0x1
3070#define streq(s1, s2) (::qstrcmp((s1), (s2)) == 0)
3071#define strneq(s1, s2, count) (::qstrncmp((s1), (s2), (count)) == 0)
3072#define strieq(s1, s2) (stricmp((s1), (s2)) == 0)
3073#define strnieq(s1, s2, count) (strnicmp((s1), (s2), (count)) == 0)
3080template<
class q
char>
3084 void assign(
const qchar *ptr,
size_t len)
3087 memmove(body.begin(), ptr,
len*
sizeof(qchar));
3098 if ( ptr !=
nullptr )
3112 body.resize(
count+1, ch);
3123 size_t length(
void)
const {
size_t l = body.size();
return l ? l - 1 : 0; }
3124 size_t size(
void)
const {
return body.size(); }
3125 size_t capacity(
void)
const {
return body.capacity(); }
3133 size_t oldsize = body.size();
3134 if ( oldsize != 0 && s >= oldsize )
3135 body[oldsize-1] = c;
3136 body.resize(s+1, c);
3161 body.resize_noinit(
len);
3168 bool empty(
void)
const {
return body.size() <= 1; }
3172 static const qchar nullstr[] = { 0 };
3173 return body.empty() ? nullstr : &body[0];
3193 if (
this != &qstr )
3207 body = std::move(x.body);
3230 return ::qstrcmp(
c_str(), r.c_str());
3235 return ::qstrcmp(
c_str(), r) == 0;
3241 return ::qstrcmp(
c_str(), r) < 0;
3250 if ( ptr ==
nullptr )
3267 if ( ptr ==
nullptr )
3281 if ( !body.empty() || idx )
3283 static const qchar nullstr[] = { 0 };
3289 if ( !body.empty() || idx )
3291 static qchar nullstr[] = { 0 };
3294 const qchar &
at(
size_t idx)
const {
return body.at(idx); }
3295 qchar &
at(
size_t idx) {
return body.at(idx); }
3302 body.inject(s,
len);
3310 body.inject(s,
len);
3317 return len == 0 ?
'\0' : body[
len-1];
3327 const qchar *beg =
c_str();
3329 if ( ptr !=
nullptr )
3336 bool replace(
const qchar *what,
const qchar *with)
3340 const qchar *_start =
c_str();
3341 const qchar *last_pos = _start;
3345 if (
pos ==
nullptr )
3347 size_t n =
pos - last_pos;
3351 last_pos =
pos + len_what;
3354 if ( last_pos == _start )
3372 const qchar *beg =
c_str();
3374 if ( ptr !=
nullptr )
3387 const qchar *beg =
c_str();
3389 if ( ptr !=
nullptr )
3400 size_t endp = qmin(
length(),
n);
3411 if ( idx <
len && cnt != 0 )
3418 memmove(p2, p1, (
len-cnt)*
sizeof(qchar));
3421 body.resize_noinit(idx+1);
3432 body.resize_noinit(
len+2);
3437 memmove(p1+1, p1, (
len-idx)*
sizeof(qchar));
3450 body.resize_noinit(
len+addlen+1);
3451 body[
len+addlen] =
'\0';
3456 memmove(p2, p1, (
len-idx)*
sizeof(qchar));
3459 memmove(body.begin()+
len, str, addlen*
sizeof(qchar));
3465 if ( str !=
nullptr )
3468 insert(idx, str, addlen);
3477 body.resize_noinit(
len+
add+1);
3483 memmove(p2, p1, (
len-idx)*
sizeof(qchar));
3486 memcpy(body.begin()+
len, qstr.
begin(),
add*
sizeof(qchar));
3496 body.resize_noinit(
len+2);
3507 body.resize_noinit(
len+addlen+1);
3508 body[
len+addlen] =
'\0';
3509 memmove(body.begin()+
len, str, addlen*
sizeof(qchar));
3515 if ( str !=
nullptr )
3529 body.resize_noinit(
len+
add+1);
3531 memcpy(body.begin()+
len, qstr.
begin(),
add*
sizeof(qchar));
3544 body.resize_noinit(
len+
add+1);
3556 size_t add = ::qvsnprintf(
nullptr, 0,
format,
va);
3559 body.resize_noinit(
add+1);
3560 ::qvsnprintf(body.begin(),
add+1,
format, copy);
3602 size_t endp =
pos +
len + 1;
3603 if ( body.size() < endp )
3605 body.resize_noinit(endp);
3606 body[endp-1] =
'\0';
3608 memset(body.begin()+
pos, c,
len);
3626 while ( b <
e && *b == blank )
3628 if ( b > body.begin() )
3630 memmove(body.begin(), b,
sizeof(qchar)*(
e-b+1));
3639 if (
size() > minlen + 1 )
3641 iterator b = body.begin() + minlen;
3644 while (
e > b && *(
e-1) == blank )
3692 static constexpr size_t npos = (size_t) -1;
3712 const size_t FNV_BASIS = 0x811c9dc5;
3713 const size_t FNV_PRIME = 0x01000193;
3715 const size_t FNV_BASIS = 0xcbf29ce484222325;
3716 const size_t FNV_PRIME = 0x100000001b3;
3718 size_t sum = FNV_BASIS;
3734 const char *p =
begin();
3739 size_t rem = (psep !=
nullptr ? psep :
end) - p;
3740 if ( rem > 0 || (flags & SSF_DROP_EMPTY) == 0 )
3742 p = psep !=
nullptr ? psep + seplen :
end;
3745 if (
ends_with(sep, seplen) && (flags & SSF_DROP_EMPTY) == 0 )
3753 size_t nparts = parts.
size();
3757 size_t total = (nparts - 1) * seplen;
3758 for (
const auto &one : parts )
3759 total += one.length();
3761 for (
const auto &one : parts )
3786 size_t cur_sz =
size();
3787 size_t new_sz = cur_sz + sz;
3788 if ( new_sz < cur_sz )
3789 new_sz = BADMEMSIZE;
3791 memcpy(
begin() + cur_sz, buf, sz);
3800 uchar packed[dw_packed_size];
3801 size_t len =
::pack_dw(packed, packed+
sizeof(packed), x) - packed;
3807 uchar packed[dd_packed_size];
3808 size_t len =
::pack_dd(packed, packed+
sizeof(packed), x) - packed;
3814 uchar packed[dq_packed_size];
3815 size_t len =
::pack_dq(packed, packed+
sizeof(packed), x) - packed;
3821 uchar packed[ea_packed_size];
3822 size_t len =
::pack_ea(packed, packed+
sizeof(packed), x) - packed;
3833 if ( ea == BADADDR )
3834 ea = 0xFFFFFFFFFFFFFFFFULL;
3843 size_t len = strlen(x);
3845 QASSERT(4,
len <= 0xFFFFFFFF);
3853 if ( str ==
nullptr )
3855 size_t len = strlen(str) + 1;
3871 QASSERT(5,
len <= 0xFFFFFFFF);
3894 int nelems = vec.
size();
3897 for (
int i=0; i < nelems; i++ )
3912 size_t cur_sz =
size();
3913 size_t new_sz = cur_sz + sz;
3914 if ( new_sz < cur_sz )
3915 new_sz = BADMEMSIZE;
3933 for (
uchar c: *
this )
3935 ::qsnprintf(p,
end - p, upper_case ?
"%02X" :
"%02x", c);
3944 tohex(&buf, upper_case);
3953 const char *p = str.
begin();
3954 for (
uchar &c: *
this )
3957 if ( ::qsscanf(p,
"%02X", &b) != 1 || b > 0xFF )
3978 for (
size_t i = 0; i <
size(); ++i )
3989 for (
size_t i=0; i <
nbytes; i++ )
3999 for (
size_t i=0; i <
nbytes; i++, ++p )
4000 *p = (
uchar)(*p & ~b[i]);
4012#define RELOBJ_MASK 0xF
4017#define RELSIZE_CUST 15
4018#define RELOBJ_CNT 0x80
4034#define QLIST_DEFINED
4043 void fix_links(
size_t len)
4058 struct datanode_t :
public listnode_t
4077#define DEFINE_LIST_ITERATOR(iter, constness, cstr) \
4080 friend class qlist<T>; \
4081 constness listnode_t *cur; \
4082 iter(constness listnode_t *x) : cur(x) {} \
4084 typedef constness T value_type; \
4085 iter(void) : cur(nullptr) {} \
4086 iter(const iter &x) : cur(x.cur) {} \
4088 iter &operator=(const iter &x) { cur = x.cur; return *this; } \
4089 bool operator==(const iter &x) const { return cur == x.cur; } \
4090 bool operator!=(const iter &x) const { return cur != x.cur; } \
4091 constness T &operator*(void) const { return ((datanode_t*)cur)->data; } \
4092 constness T *operator->(void) const { return &(operator*()); } \
4093 iter &operator++(void) \
4098 iter operator++(int) \
4104 iter &operator--(void) \
4109 iter operator--(int) \
4120#define DEFINE_REVERSE_ITERATOR(riter, iter) \
4126 riter(const iter &x) : p(x) {} \
4127 typename iter::value_type &operator*(void) const { iter q=p; return *--q; } \
4128 typename iter::value_type *operator->(void) const { return &(operator*()); } \
4129 riter &operator++(void) { --p; return *this; } \
4130 riter operator++(int) { iter q=p; --p; return q; } \
4131 riter &operator--(void) { ++p; return *this; } \
4132 riter operator--(int) { iter q=p; ++p; return q; } \
4133 bool operator==(const riter &x) const { return p == x.p; } \
4134 bool operator!=(const riter &x) const { return p != x.p; } \
4138#undef DEFINE_LIST_ITERATOR
4139#undef DEFINE_REVERSE_ITERATOR
4146 insert(begin(), x.begin(), x.end());
4153 DEFINE_MEMORY_ALLOCATION_FUNCS()
4160 iterator first1 = begin();
4161 iterator last1 =
end();
4164 while ( first1 != last1 && first2 != last2 )
4165 *first1++ = *first2++;
4166 if ( first2 == last2 )
4167 erase(first1, last1);
4169 insert(last1, first2, last2);
4176 std::swap(node, x.node);
4177 std::swap(length, x.length);
4178 node.fix_links(length);
4179 x.node.fix_links(x.length);
4182 iterator begin(
void) {
return node.next; }
4183 iterator
end(
void) {
return &node; }
4184 bool empty(
void)
const {
return length == 0; }
4185 size_t size(
void)
const {
return length; }
4186 T &front(
void) {
return *begin(); }
4187 T &back(
void) {
return *(--
end()); }
4191 const T&front(
void)
const {
return *begin(); }
4192 const T&back(
void)
const {
return *(--
end()); }
4194 reverse_iterator rbegin() {
return reverse_iterator(
end()); }
4195 reverse_iterator rend() {
return reverse_iterator(begin()); }
4196 const_reverse_iterator rbegin()
const {
return const_reverse_iterator(
end()); }
4197 const_reverse_iterator rend()
const {
return const_reverse_iterator(begin()); }
4203 iterator insert(iterator p,
const T &x)
4206 new (&(tmp->data)) T(x);
4213 iterator insert(iterator p)
4216 new (&(tmp->data)) T();
4222 template <
class it2>
void insert(iterator p, it2 first, it2 last)
4224 while ( first != last )
4225 insert(p, *first++);
4228 void push_front(
const T &x) { insert(begin(), x); }
4230 void push_back(
const T &x) { insert(
end(), x); }
4234 iterator p = insert(
end());
4235 return ((datanode_t *)p.cur)->data;
4238 iterator erase(iterator p)
4240 listnode_t *q = p.cur->next;
4241 p.cur->prev->next = p.cur->next;
4242 p.cur->next->prev = p.cur->prev;
4243 ((datanode_t*)p.cur)->data.~T();
4249 void erase(iterator p1, iterator p2)
4255 void clear(
void) { erase(begin(),
end()); }
4257 void pop_front(
void) { erase(begin()); }
4259 void pop_back(
void) { iterator tmp =
end(); erase(--tmp); }
4261 void splice(iterator
pos,
qlist<T> &other, iterator first, iterator last)
4264 if ( first == last )
4267 listnode_t *first_node = first.cur;
4268 listnode_t *last_node =
last.cur->prev;
4271 size_t sublength = 1;
4274 if ( first == other.begin() && last == other.end() )
4276 sublength = other.length;
4280 listnode_t *curr_node = first_node;
4281 while ( curr_node != last_node )
4283 curr_node = curr_node->next;
4289 first_node->prev->next = last_node->next;
4290 last_node->next->prev = first_node->prev;
4291 other.length -= sublength;
4294 listnode_t *pos_node =
pos.cur;
4295 listnode_t *before_pos = pos_node->prev;
4296 before_pos->next = first_node;
4297 first_node->prev = before_pos;
4298 last_node->next = pos_node;
4299 pos_node->prev = last_node;
4300 length += sublength;
4303 bool operator==(
const qlist<T> &x)
const
4305 if ( length != x.length )
4314 bool operator!=(
const qlist<T> &x)
const {
return !(*
this == x); }
4316 void linkin(iterator p, listnode_t *tmp)
4319 tmp->prev = p.cur->prev;
4320 p.cur->prev->next = tmp;
4328template <
class T>
struct ida_movable_type<
qvector<T> > {
static constexpr bool value =
true; };
4329template <
class T>
struct ida_movable_type<
_qstring<T> > {
static constexpr bool value =
true; };
4330template <
class T>
struct ida_movable_type<
qlist<T> > {
static constexpr bool value =
false; };
4331template <
class T>
struct ida_movable_type<
qiterator<T> > {
static constexpr bool value =
true; };
4351 for (
int i=0; i <
n; i++ )
4366 const size_t old_size = out->
size();
4374 if ( str ==
nullptr )
4376 out->
append(str, ((
char*)*pptr-str) - 1);
4405 return ::unpack_ds(&
ptr,
end, empty_null);
4414 return ::unpack_obj_inplace(&
ptr,
end, objsize);
4418 return ::unpack_buf_inplace(&
ptr,
end);
4422 return ::unpack_obj(obj, objsize, &
ptr,
end);
4426 return ::unpack_buf(&
ptr,
end);
4434 return ::unpack_bytevec(out, &
ptr,
end);
4436 #define SCALAR_TYPE(n) class T, typename std::enable_if<std::is_scalar<T>::value && sizeof(T) == n, int>::type = 0
4449 for (
size_t i = 0; i < cnt; i++ )
4456#define DECLARE_MEMORY_DESERIALIZER(name) \
4457 name(const void *p, size_t s) : memory_deserializer_t(p, s) {} \
4458 using memory_deserializer_t::unpack; \
4462 #define SCALAR_TYPE(n) class T, typename std::enable_if<std::is_scalar<T>::value && sizeof(T) == n, int>::type = 0
4473 for (
const auto &item: value )
4477#define DECLARE_MEMORY_SERIALIZER(name) \
4478 using memory_serializer_t::pack; \
4484template <
typename T>
4495template <
typename T>
4501template <
typename T>
4506template <
typename,
typename =
void>
4510template <
typename T>
4512 : std::true_type {};
4513template <class T, typename std::enable_if<has_compare_method<T>::value,
int>
::type = 0>
4516 return a.compare(b);
4518template <class T, typename std::enable_if<!has_compare_method<T>::value,
int>
::type = 0>
4519int compare(
const T &a,
const T &b)
4543template <
class T,
class U>
4544int compare(
const std::pair<T, U> &a,
const std::pair<T, U> &b)
4549 return compare(a.second, b.second);
4557 auto p = std::begin(l);
4558 auto pe = std::end(l);
4559 auto q = std::begin(r);
4560 auto qe = std::end(r);
4561 for ( ; p != pe && q != qe; ++p,++q )
4567 if ( p == pe && q != qe )
4569 if ( p != pe && q == qe )
4574#define COMPARE_POINTERS2(ptr, cmp) \
4577 if ( ptr != nullptr && r.ptr != nullptr ) \
4579 int _code = cmp(*ptr, *r.ptr); \
4583 else if ( r.ptr != nullptr ) \
4587 else if ( ptr != nullptr ) \
4593#define COMPARE_POINTERS(ptr) COMPARE_POINTERS2(ptr, ::compare)
4595#define COMPARE_FIELDS(fld) \
4598 int _code = ::compare(fld, r.fld); \
4604#define COMPARE_FIELDS_REV(fld) \
4607 int _code = ::compare(r.fld, fld); \
4612template <
class T,
class U>
4613int compare(
const std::map<T, U> &a,
const std::map<T, U> &b)
4619int compare(
const std::set<T> &a,
const std::set<T> &b)
4630 int mask = elsize - 1;
4640 int mask = elsize - 1;
4649#define DECLARE_UNCOPYABLE(T) T &operator=(const T &); T(const T &);
4655#define IS_QSTRING(v) (std::is_base_of<qstring, std::remove_reference<decltype(v)>::type>::value)
4656#define IS_SIZEVEC_T(v) (std::is_base_of<sizevec_t, std::remove_reference<decltype(v)>::type>::value)
4657#define IS_QSTRVEC_T(v) (std::is_base_of<qstrvec_t, std::remove_reference<decltype(v)>::type>::value)
4666typedef struct qstring_tag
qstring;
4667typedef struct qwstring_tag
qwstring;
4704idaman THREAD_SAFE
char *ida_export
str2user(
char *dst,
const char *src,
size_t dstsize);
4705idaman THREAD_SAFE
char *ida_export
user2str(
char *dst,
const char *src,
size_t dstsize);
4706idaman THREAD_SAFE
char ida_export
back_char(
const char **p);
4769 return (0x10000 + (
wchar32_t(lead_surrogate & 0x3FF) << 10)) | (tail_surrogate & 0x3FF);
4776#define IDBDEC_ESCAPE 0x00000001
4782idaman THREAD_SAFE
bool ida_export
idb_utf8(
qstring *out,
const char *in,
int nsyms=-1,
int flags=0);
4800#define CP_UTF8 65001
4815 return (
wchar16_t(b0 & 0x1f) << 6) | (b1 & 0x3f);
4838#define BADCP wchar32_t(-1)
4866idaman THREAD_SAFE
size_t ida_export
skip_utf8(
const char **putf8,
size_t n);
4886idaman THREAD_SAFE
size_t ida_export
qustrlen(
const char *utf8);
4894idaman THREAD_SAFE
bool ida_export
qustrncpy(
char *dst,
const char *utf8,
size_t dstsize);
4899#define CP_BOM 0xFEFF
4900#define UTF8_BOM "\xEF\xBB\xBF"
4901#define UTF8_BOM_SZ (sizeof(UTF8_BOM) - 1)
4903#define UTF16LE_BOM "\xFF\xFE"
4904#define UTF16BE_BOM "\xFE\xFF"
4905#define UTF16_BOM_SZ (sizeof(UTF16LE_BOM) - 1)
4907#define UTF32LE_BOM "\xFF\xFE\x00\x00"
4908#define UTF32BE_BOM "\x00\x00\xFE\xFF"
4909#define UTF32_BOM_SZ (sizeof(UTF32LE_BOM) - 1)
4911#define CP_ELLIPSIS 0x2026
4912#define UTF8_ELLIPSIS "\xE2\x80\xA6"
4913#define UTF8_ELLIPSIS_SZ (sizeof(UTF8_ELLIPSIS) - 1)
4915#define CP_REPLCHAR 0xFFFD
4916#define UTF8_REPLCHAR "\xEF\xBF\xBD"
4917#define UTF8_REPLCHAR_SZ (sizeof(UTF8_REPLCHAR) - 1)
4931#define MAX_UTF8_SEQ_LEN (6 + 1 + 1)
4942#define CEF_RETERR 0x1
4958 const char *fromcode,
4960 const uchar *indata,
4962 DEFARG(
int flags,0));
4967 const char *fromcode,
4970 DEFARG(
int flags,0))
4977#define ENC_WIN1252 "windows-1252"
4978#define ENC_UTF8 "UTF-8"
4979#define ENC_MUTF8 "MUTF-8"
4980#define ENC_UTF16 "UTF-16"
4981#define ENC_UTF16LE "UTF-16LE"
4982#define ENC_UTF16BE "UTF-16BE"
4983#define ENC_UTF32 "UTF-32"
4984#define ENC_UTF32LE "UTF-32LE"
4985#define ENC_UTF32BE "UTF-32BE"
4990#define CP_UTF8 65001
4994#define CP_UTF16 1200
4998# ifndef INVALID_FILE_ATTRIBUTES
4999# define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
5001# ifndef BELOW_NORMAL_PRIORITY_CLASS
5002# define BELOW_NORMAL_PRIORITY_CLASS 0x00004000
5006#define SUBSTCHAR '_'
5013#define DEFCOLOR bgcolor_t(-1)
5030#define IOREDIR_INPUT 0x01
5031#define IOREDIR_OUTPUT 0x02
5032#define IOREDIR_APPEND 0x04
5033#define IOREDIR_QUOTED 0x08
5060 const char *cmdline,
5083 if ( argv !=
nullptr )
5085 for ( i = 0; i < argc; i++ )
5117# define DEFINE_CLIOPTS_T_HELPERS(decl) \
5118 decl void ida_export cliopts_t_add(cliopts_t &, const cliopt_t *, size_t); \
5119 decl int ida_export cliopts_t_apply(cliopts_t &, int, const char *[], void *); \
5120 decl const cliopt_t *ida_export cliopts_t_find_short(const cliopts_t &, char); \
5121 decl const cliopt_t *ida_export cliopts_t_find_long(const cliopts_t &, const char *); \
5122 decl NORETURN void ida_export cliopts_t_usage(const cliopts_t &, bool);
5124# define DEFINE_CLIOPTS_T_HELPERS(decl)
5126DEFINE_CLIOPTS_T_HELPERS(idaman)
5128struct cliopts_t :
public qvector<cliopt_t>
5133 usage_printer_t *printer;
5136 cliopts_t(usage_printer_t *_printer,
bool _print_usage = true)
5138 , print_usage(_print_usage)
5141 void add(
const cliopt_t *opts,
size_t nopts) { cliopts_t_add(*
this, opts, nopts); }
5142 int apply(
int argc,
const char *argv[],
void *ud=
nullptr) {
return cliopts_t_apply(*
this, argc, argv, ud); }
5143 const cliopt_t *find_short(
char shortname)
const {
return cliopts_t_find_short(*
this, shortname); }
5144 const cliopt_t *find_long(
const char *longname)
const {
return cliopts_t_find_long(*
this, longname); }
5145 void usage(
bool is_error=
true)
const {
return cliopts_t_usage(*
this, is_error); }
5148 DEFINE_CLIOPTS_T_HELPERS(
friend);
5151struct plugin_option_t;
5153# define DEFINE_PLUGIN_OPTION_T_HELPERS(decl) \
5154 decl bool ida_export plugin_option_t_get_bool(const plugin_option_t *, bool *, const char *, bool);
5156# define DEFINE_PLUGIN_OPTION_T_HELPERS(decl)
5163struct plugin_option_t
5167 const char *get_value(
const char *default_value)
const
5169 return value.
empty() ? default_value : value.
c_str();
5171 bool get_string(
qstring *out,
const char *desired_name,
const char *default_value)
const
5173 if ( name != desired_name )
5175 if ( out !=
nullptr )
5176 *out = get_value(default_value);
5179 bool get_bool(
bool *out,
const char *desired_name,
bool default_value)
const
5181 return plugin_option_t_get_bool(
this, out, desired_name, default_value);
5194 for (
const auto &one : *
this )
5195 if ( one.name == name )
5202 for (
size_t i = 0; i <
size(); ++i )
5204 if (
at(i).name == name )
5266 size_t cb =
sizeof(*this);
5271#define LP_NEW_CONSOLE 0x0001
5272#define LP_TRACE 0x0002
5273#define LP_PATH_WITH_ARGS 0x0004
5274#define LP_USE_SHELL 0x0008
5276#define LP_LAUNCH_32_BIT 0x0010
5277#define LP_LAUNCH_64_BIT 0x0020
5279#define LP_NO_ASLR 0x0040
5280#define LP_DETACH_TTY 0x0080
5281#define LP_HIDE_WINDOW 0x0100
5282#define LP_SUSPENDED 0x0200
5283#define LP_DETACHED 0x0400
5284#define LP_REPLACE_ENV 0x0800
5325idaman THREAD_SAFE
int ida_export
qwait_timed(
int *status,
int child,
int flags,
int timeout_ms);
5327#if defined(__UNIX__)
5329# define QWCONTINUED WCONTINUED
5331# define QWCONTINUED 8
5334# define QWNOHANG WNOHANG
5338inline THREAD_SAFE
int qwait(
int *status,
int child,
int flags)
5340 return qwait_timed(status, child, flags, (flags & QWNOHANG) != 0 ? 0 : -1);
5360 DEFARG(
int msecs,-1));
5399#define OPAQUE_HANDLE(n) typedef struct __ ## n {} *n
5401#define OPAQUE_HANDLE(n) typedef struct __ ## n { char __dummy; } *n
5449idaman THREAD_SAFE
bool ida_export
qsetenv(
const char *varname,
const char *value);
5450idaman THREAD_SAFE
bool ida_export
qgetenv(
const char *varname, DEFARG(
qstring *buf,
nullptr));
5459idaman THREAD_SAFE qsemaphore_t ida_export
qsem_create(
const char *name,
int init_count);
5460idaman THREAD_SAFE
bool ida_export
qsem_free(qsemaphore_t sem);
5461idaman THREAD_SAFE
bool ida_export
qsem_post(qsemaphore_t sem);
5462idaman THREAD_SAFE
bool ida_export
qsem_wait(qsemaphore_t sem,
int timeout_ms);
idaman int ida_export nbits(ea_t ea)
Get number of bits in a byte at the given address.
Reimplementation of the string class from STL.
Definition pro.h:3082
void inject(qchar *s, size_t len)
Assign this qstring to an existing char *.
Definition pro.h:3300
_qstring & insert(size_t idx, const qchar *str, size_t addlen)
Insert a string into the qstring.
Definition pro.h:3447
_qstring & insert(size_t idx, const _qstring &qstr)
Same as insert(size_t, const qchar *), but takes a qstring parameter.
Definition pro.h:3473
void swap(_qstring< qchar > &r)
Swap contents of two qstrings. see qvector::swap()
Definition pro.h:3122
_qstring & append(const qchar *str, size_t addlen)
Append a string to the qstring.
Definition pro.h:3504
_qstring & operator+=(const _qstring &r)
Append another qstring using '+='.
Definition pro.h:3217
const qchar * const_iterator
Definition pro.h:3176
bool empty(void) const
Does the qstring have 0 non-null elements?
Definition pro.h:3168
_qstring & operator=(const qchar *str)
Allow assignment of qstrings using '='.
Definition pro.h:3182
_qstring(const qchar *ptr)
Constructor - creates a new qstring from an existing char *.
Definition pro.h:3096
_qstring operator+(const _qstring &r) const
Get result of appending two qstrings using '+'.
Definition pro.h:3222
_qstring & insert(const qchar *str)
Prepend the qstring with 'str'.
Definition pro.h:3490
_qstring & fill(qchar c, size_t len)
Clear contents of qstring and fill with 'c'.
Definition pro.h:3612
_qstring(const qchar *ptr, size_t len)
Constructor - creates a new qstring using first 'len' chars from 'ptr'.
Definition pro.h:3102
size_t rfind(qchar c, size_t pos=0) const
Search backwards for a character in the qstring.
Definition pro.h:3383
size_t find(qchar c, size_t pos=0) const
Find a character in the qstring.
Definition pro.h:3368
const_iterator begin(void) const
Get a const pointer to the beginning of the qstring.
Definition pro.h:3178
_qstring & insert(const _qstring &qstr)
Prepend the qstring with 'qstr'.
Definition pro.h:3491
_qstring & nowarn_sprnt(const char *format,...)
Definition pro.h:3586
_qstring & operator=(_qstring &&x) noexcept
Move assignment operator.
Definition pro.h:3205
void resize(size_t s, qchar c)
Resize to the given size.
Definition pro.h:3131
qchar * extract(void)
Extract C string from _qstring. Must qfree() it.
Definition pro.h:3297
const_iterator end(void) const
Get a const pointer to the end of the qstring (this is not the terminating zero)
Definition pro.h:3180
bool starts_with(const _qstring &str) const
Does the string start with the specified prefix?
Definition pro.h:3244
_qstring(_qstring &&x)
Move constructor.
Definition pro.h:3118
bool ends_with(const _qstring &str) const
Does the string end with the specified suffix?
Definition pro.h:3261
size_t size(void) const
Get number of chars in this qstring (including terminating zero)
Definition pro.h:3124
void qclear(void)
Clear qstring but do not free memory yet.
Definition pro.h:3167
iterator begin(void)
Get a pointer to the beginning of the qstring.
Definition pro.h:3177
_qstring & rtrim()
Remove all whitespace from the end of the qstring.
Definition pro.h:3651
GCC_DIAG_ON(format-nonliteral)
static constexpr size_t npos
Definition pro.h:3692
void push_back(qchar c)
Definition pro.h:3673
AS_PRINTF(2, 0) _qstring &vsprnt(const char *format
Replace qstring with the result of qvsnprintf()
AS_PRINTF(2, 3) _qstring &sprnt(const char *format
Replace qstring with the result of qsnprintf()
AS_PRINTF(2, 0) _qstring &cat_vsprnt(const char *format
Append result of qvsnprintf() to qstring.
_qstring & fill(size_t pos, qchar c, size_t len)
Fill qstring with a character.
Definition pro.h:3600
qchar & at(size_t idx)
Retrieve char at index 'idx'.
Definition pro.h:3295
size_t capacity(void) const
Get number of chars this qstring can contain (including terminating zero)
Definition pro.h:3125
void remove_last(int cnt=1)
Definition pro.h:3152
_qstring< qchar > substr(size_t pos=0, size_t n=npos) const
Get a substring.
Definition pro.h:3398
size_t find(const _qstring &str, size_t pos=0) const
Same as find(const qchar *, size_t), but takes a qstring parameter.
Definition pro.h:3363
_qstring & operator=(const _qstring &qstr)
Definition pro.h:3191
const qchar & operator[](size_t idx) const
Retrieve char at index 'idx' using '[]'.
Definition pro.h:3279
size_t length(void) const
Get number of chars in this qstring (not including terminating zero)
Definition pro.h:3123
_qstring & insert(qchar c)
Prepend the qstring with 'c'.
Definition pro.h:3489
void split(qvector< _qstring< qchar > > *out, const qchar *sep, uint32 flags=0) const
Split a string on SEP, appending the parts to OUT.
qchar & operator[](size_t idx)
Retrieve char at index 'idx' using '[]'.
Definition pro.h:3287
_qstring(void)
Constructor.
Definition pro.h:3094
va_list va
Definition pro.h:3537
qchar * iterator
Definition pro.h:3175
size_t find(const qchar *str, size_t pos=0) const
Find a substring.
Definition pro.h:3323
_qstring & remove(size_t idx, size_t cnt)
Remove characters from the qstring.
Definition pro.h:3408
bool operator<(const qchar *r) const
Compare two qstrings using '<'. see qstrcmp()
Definition pro.h:3239
static _qstring< qchar > join(const qvector< _qstring< qchar > > &parts, const qchar *sep)
Join the provided parts into a single string with each element separated by SEP.
iterator end(void)
Get a pointer to the end of the qstring (this is not the terminating zero)
Definition pro.h:3179
_qstring & ltrim(qchar blank=' ')
Remove all instances of the specified char from the beginning of the qstring.
Definition pro.h:3620
_qstring & append(qchar c)
Append c to the end of the qstring.
Definition pro.h:3493
void reserve(size_t cnt)
Increase capacity the qstring. see qvector::reserve()
Definition pro.h:3165
void inject(qchar *s)
Same as to inject(qchar *, size_t), with len = strlen(s)
Definition pro.h:3305
_qstring & insert(size_t idx, qchar c)
Insert a character into the qstring.
Definition pro.h:3429
qchar value_type
Definition pro.h:3091
_qstring(const _qstring &r)
Copy constructor (if not declared, move constructor causes it to be deleted)
Definition pro.h:3120
_qstring & append(const qchar *str)
Same as append(const qchar *, size_t), but all chars in 'str' are appended.
Definition pro.h:3513
qchar last(void) const
Get the last qchar in the string (for concatenation checks)
Definition pro.h:3314
size_t add
Definition pro.h:3540
_qstring & trim2(qchar blank=' ')
Remove all instances of the specified char from both ends of the qstring.
Definition pro.h:3664
bool replace(const qchar *what, const qchar *with)
Replace all occurrences of 'what' with 'with'.
Definition pro.h:3336
void resize(size_t s)
Similar to resize(size_t, qchar) - but any extra space is filled with zeroes.
Definition pro.h:3140
bool operator!=(const qchar *r) const
Test equality of a qstring and a const char* with '!='.
Definition pro.h:3237
_qstring(size_t count, qchar ch)
Constructor - constructs the string with 'count' copies of character 'ch'.
Definition pro.h:3108
AS_PRINTF(2, 3) _qstring &cat_sprnt(const char *format
Append result of qsnprintf() to qstring.
const qchar & at(size_t idx) const
Retrieve const char at index 'idx'.
Definition pro.h:3294
_qstring & append(const _qstring &qstr)
Same as append(const qchar *), but takes a qstring argument.
Definition pro.h:3523
bool starts_with(const qchar *ptr, ssize_t len=-1) const
Definition pro.h:3248
const qchar * c_str(void) const
Convert the qstring to a char *.
Definition pro.h:3170
bool operator==(const qchar *r) const
Test equality of a qstring and a const char* using '=='.
Definition pro.h:3233
_qstring & insert(size_t idx, const qchar *str)
Same as insert(size_t, const qchar *, size_t), but all chars in str are inserted.
Definition pro.h:3463
GCC_DIAG_OFF(format-nonliteral)
Replace qstring with the result of qsnprintf()
_qstring & rtrim(qchar blank, size_t minlen=0)
Remove all instances of the specified char from the end of the qstring.
Definition pro.h:3637
DECLARE_COMPARISONS(_qstring)
Definition pro.h:3228
void clear(void)
Clear qstring and free memory.
Definition pro.h:3166
bool ends_with(const qchar *ptr, ssize_t len=-1) const
Definition pro.h:3265
_qstring & operator+=(qchar c)
Append a char using '+='.
Definition pro.h:3212
Vector of bytes (use for dynamic memory)
Definition pro.h:3773
void clear_bits(const bytevec_t &b)
For each bit that is set in 'b', the clear the corresponding bit in this bytevec.
Definition pro.h:3995
void pack_bytevec(const bytevec_t &b)
Pack an object of size 'len' and append the result to the bytevec.
Definition pro.h:3877
bool fromhex(const qstring &str)
Initialize from a hexadecimal string It returns 'false' if the string is invalid.
Definition pro.h:3950
void tohex(qstring *out, bool upper_case=true) const
Append the hexadecimal representation of bytes to the string.
Definition pro.h:3927
void pack_eavec(ea_t ea, const eavec_t &vec)
Pack an eavec and append the result to the bytevec.
Definition pro.h:3892
void pack_buf(const void *buf, size_t len)
Pack an object of size 'len' and append the result to the bytevec.
Definition pro.h:3868
bool test_bit(size_t bit) const
Is the specified bit set in the bytevec?
Definition pro.h:3966
bytevec_t()
Constructor.
Definition pro.h:3776
void pack_str(const qstring &s)
Pack a string (zero-terminated) and append the result to the bytevec.
Definition pro.h:3859
bool all_zeros() const
Are all bits cleared?
Definition pro.h:3976
void set_bits(const bytevec_t &b)
For each bit that is set in 'b', set the corresponding bit in this bytevec.
Definition pro.h:3984
void clear_bits(size_t low, size_t high)
Clear each bit between [low, high)
Definition pro.h:4003
bytevec_t & growfill(size_t sz, uchar filler=0)
Grow the bytevec and fill with a value.
Definition pro.h:3908
void pack_ea(ea_t x)
Pack an ea value and append the result to the bytevec.
Definition pro.h:3819
void inject(void *buf, size_t len)
See qvector::inject(T *, size_t)
Definition pro.h:3921
void pack_db(uint8 x)
Pack a byte and append the result to the bytevec.
Definition pro.h:3796
void set_bit(size_t bit)
Set the specified bit.
Definition pro.h:3968
void clear_bit(size_t bit)
Clear the specified bit.
Definition pro.h:3970
void set_all_bits(size_t nbits)
See set_all_bits(uchar *, size_t)
Definition pro.h:3972
void pack_dd(uint32 x)
Pack a dword and append the result to the bytevec.
Definition pro.h:3805
void set_bits(size_t low, size_t high)
Set each bit between [low, high)
Definition pro.h:3993
qstring tohex(bool upper_case=true) const
Produce a hexadecimal representation of bytes.
Definition pro.h:3941
void clear_all_bits(size_t nbits)
See clear_all_bits(uchar *, size_t)
Definition pro.h:3974
bytevec_t(const void *buf, size_t sz)
Constructor - fill bytevec with 'sz' bytes from 'buf'.
Definition pro.h:3778
void pack_dw(uint16 x)
Pack a word and append the result to the bytevec.
Definition pro.h:3798
bytevec_t & append(const void *buf, size_t sz)
Append bytes to the bytevec.
Definition pro.h:3782
void pack_ds(const char *x)
Pack a string (length+contents) and append the result to the bytevec.
Definition pro.h:3839
void pack_dq(uint64 x)
Pack a quadword and append the result to the bytevec.
Definition pro.h:3812
void pack_str(const char *str)
Pack a string (zero-terminated) and append the result to the bytevec.
Definition pro.h:3851
void pack_ea64(ea64_t ea)
Pack an ea value (64bits) and append the result to the bytevec We pass ea_t as a 64-bit quantity (to ...
Definition pro.h:3830
pool_allocator_t(const pool_allocator_t &)
Definition pro.h:2839
T * allocate(size_t n)
Definition pro.h:2846
pool_allocator_t(const pool_allocator_t< U > &)
Definition pro.h:2838
pool_allocator_t & operator=(const pool_allocator_t &)
Definition pro.h:2840
bool operator==(const pool_allocator_t &r) const
Definition pro.h:2843
T value_type
Definition pro.h:2830
void deallocate(T *ptr, size_t n)
Definition pro.h:2869
pool_allocator_t & operator=(pool_allocator_t &&)=default
const T * const_pointer
Definition pro.h:2832
pool_allocator_t(pool_allocator_t &&)=default
T * pointer
Definition pro.h:2831
pool_allocator_t()
Definition pro.h:2837
const T & const_reference
Definition pro.h:2834
size_t size_type
Definition pro.h:2835
T & reference
Definition pro.h:2833
ptrdiff_t difference_type
Definition pro.h:2836
Interface class for iterator types.
Definition pro.h:2984
virtual T idaapi operator*(void)=0
source_item_ptr value_type
Definition pro.h:2986
virtual bool idaapi next(void)=0
virtual T get(void) new api
Definition pro.h:2990
virtual bool idaapi first(void)=0
Linked list Note: linked list is not movable!
Definition pro.h:4038
~qlist(void)
Destructor.
Definition pro.h:4149
const
Definition pro.h:4117
DEFINE_REVERSE_ITERATOR(reverse_iterator, iterator) DEFINE_REVERSE_ITERATOR(const_reverse_iterator
DEFINE_LIST_ITERATOR(iterator,, friend class const_iterator;) DEFINE_LIST_ITERATOR(const_iterator
const_iterator(const iterator &x)
Definition pro.h:4117
cinsn_t value_type
Definition pro.h:4074
const_iterator qlist(void)
Constructor.
Definition pro.h:4141
qlist(const qlist< T > &x)
Constructor - creates a qlist identical to 'x'.
Definition pro.h:4143
~qmutex_locker_t(void)
Definition pro.h:5481
qmutex_locker_t(qmutex_t _lock)
Definition pro.h:5480
virtual void idaapi release(void)=0
Call destructor.
int refcnt
counter
Definition pro.h:2970
qrefcnt_obj_t(void)
Constructor.
Definition pro.h:2972
void reset(void)
Definition pro.h:2946
qrefcnt_t & operator=(const qrefcnt_t &r)
Definition pro.h:2934
T & operator*() const
Definition pro.h:2959
qrefcnt_t(T *p)
Definition pro.h:2928
T * operator->() const
Definition pro.h:2955
~qrefcnt_t(void)
Definition pro.h:2942
qrefcnt_t(const qrefcnt_t &r)
Definition pro.h:2929
Reimplementation of stack class from STL.
Definition pro.h:2774
T pop(void)
Definition pro.h:2777
void push(const T &v)
Definition pro.h:2788
const T & top(void) const
Definition pro.h:2783
T & top(void)
Definition pro.h:2787
Reimplementation of vector class from STL.
Definition pro.h:2250
void reserve(size_t cnt)
Increase the capacity of the qvector.
Definition pro.h:2528
void clear(void)
Destroy all elements and free memory.
Definition pro.h:2439
DEFINE_MEMORY_ALLOCATION_FUNCS() void push_back(const T &x)
Append a new element to the end the qvector.
Definition pro.h:2349
void inject(T *s, size_t len)
Populate the qvector with dynamic memory.
Definition pro.h:2587
void resize_noinit(size_t _newsize)
Definition pro.h:2504
iterator erase(iterator first, iterator last)
Remove a subset of the qvector.
Definition pro.h:2690
const compiled_binpat_t * const_iterator
Definition pro.h:2607
bool del(const T &x)
Find an element and remove it.
Definition pro.h:2749
const T & operator[](size_t _idx) const
Allows use of typical c-style array indexing for qvectors.
Definition pro.h:2425
void emplace_back(Args &&... args)
Construct and append a new element to the end the qvector with a forwarding semantics.
Definition pro.h:2390
T & at(size_t _idx)
Get element at index '_idx'.
Definition pro.h:2428
~qvector(void)
Destructor.
Definition pro.h:2341
void swap(qvector< T > &r) noexcept
Replace all attributes of this qvector with that of 'r', and vice versa.
Definition pro.h:2560
void truncate(void)
Shrink the capacity down to the current number of elements.
Definition pro.h:2550
const_iterator find(const T &x) const
Find an element in the qvector.
Definition pro.h:2713
qvector(const qvector< T > &x)
Constructor - creates a new qvector identical to 'x'.
Definition pro.h:2330
bool empty(void) const
Does the qvector have 0 elements?
Definition pro.h:2424
iterator erase(iterator it)
Remove an element from the qvector.
Definition pro.h:2678
void qclear(void)
Destroy all elements but do not free memory.
Definition pro.h:2434
iterator end(void)
Get an iterator that points to the end of the qvector (NOT the last element)
Definition pro.h:2610
T & operator[](size_t _idx)
Allows use of typical c-style array indexing for qvectors.
Definition pro.h:2426
compiled_binpat_t value_type
Definition pro.h:2326
bool operator!=(const qvector< T > &r) const
Allow ability to test equality of two qvectors using '!='.
Definition pro.h:2604
iterator insert(iterator it, const T &x)
Insert an element into the qvector at a specified position.
Definition pro.h:2617
iterator insert(iterator it, T &&x)
Insert an element into the qvector with a move semantics.
Definition pro.h:2634
const_iterator begin(void) const
Get a const iterator that points to the first element in the qvector.
Definition pro.h:2611
void resize(size_t _newsize, const T &x)
Resize to the given size.
Definition pro.h:2469
const char * dstr(void) const
qvector< T > & operator=(const qvector< T > &x)
Allow assignment of one qvector to another using '='.
Definition pro.h:2448
const T & at(size_t _idx) const
Get element at index '_idx'.
Definition pro.h:2427
void add(T &&x)
Definition pro.h:2732
void add(const T &x)
Add an element to the end of the qvector.
Definition pro.h:2731
const T & back(void) const
Get the last element in the qvector.
Definition pro.h:2431
iterator find(const T &x)
Find an element in the qvector.
Definition pro.h:2703
qvector(void)
Constructor.
Definition pro.h:2328
T & back(void)
Get the last element in the qvector.
Definition pro.h:2432
T * extract(void)
Empty the qvector and return a pointer to it's contents.
Definition pro.h:2576
void grow(const T &x=T())
Add an element to the end of the qvector, which will be a new T() if x is not given.
Definition pro.h:2513
const T & front(void) const
Get the first element in the qvector.
Definition pro.h:2429
bool operator==(const qvector< T > &r) const
Allow ability to test the equality of two qvectors using '=='.
Definition pro.h:2594
void pop_back(void)
Remove the last element in the qvector.
Definition pro.h:2411
iterator insert(iterator it, it2 first, it2 last)
Insert a several elements to the qvector at a specified position.
Definition pro.h:2655
T & push_back(void)
Append a new empty element to the end of the qvector.
Definition pro.h:2402
compiled_binpat_t * iterator
Definition pro.h:2606
iterator begin(void)
Get an iterator that points to the first element in the qvector.
Definition pro.h:2609
void push_back(compiled_binpat_t &&x)
Definition pro.h:2361
T & front(void)
Get the first element in the qvector.
Definition pro.h:2430
const_iterator end(void) const
Get a const iterator that points to the end of the qvector (NOT the last element)
Definition pro.h:2612
friend void *ida_export qvector_reserve(void *vec, void *old, size_t cnt, size_t elsize)
Change capacity of given qvector.
size_t capacity(void) const
Get the number of elements that this qvector can contain - not the same as the number of elements cur...
Definition pro.h:2525
void resize(size_t _newsize)
Same as resize(size_t, const T &), but extra space is filled with empty elements.
Definition pro.h:2485
size_t size(void) const
Get the number of elements in the qvector.
Definition pro.h:2423
ssize_t index(const T &x) const
Find index of the specified value or return -1.
Definition pro.h:2723
bool add_unique(const T &x)
Add an element to the end of the qvector - only if it isn't already present.
Definition pro.h:2739
qvector(qvector< T > &&x) noexcept
Move constructor.
Definition pro.h:2333
bool has(const T &x) const
Does the qvector contain x?
Definition pro.h:2735
qvector< T > & operator=(qvector< T > &&x) noexcept
Move assignment operator.
Definition pro.h:2455
idaman THREAD_SAFE char *ida_export user2str(char *dst, const char *src, size_t dstsize)
Make an internal representation.
idaman THREAD_SAFE char *ida_export str2user(char *dst, const char *src, size_t dstsize)
Make a user representation.
idaman THREAD_SAFE void ida_export user2qstr(qstring *dst, const qstring &src)
see user2str()
idaman THREAD_SAFE char ida_export back_char(const char **p)
Translate char after '\'.
idaman THREAD_SAFE void ida_export qstr2user(qstring *dst, const char *src, int nsyms=-1)
see str2user()
INLINE THREAD_SAFE bool ida_local qislower(char c)
Definition pro.h:942
INLINE THREAD_SAFE bool ida_local qisupper(char c)
Definition pro.h:943
INLINE THREAD_SAFE bool ida_local qisdigit(char c)
Definition pro.h:945
INLINE THREAD_SAFE bool ida_local qisalnum(char c)
Definition pro.h:940
INLINE THREAD_SAFE bool ida_local qispunct(char c)
Definition pro.h:941
INLINE THREAD_SAFE bool ida_local qisalpha(char c)
Definition pro.h:939
INLINE THREAD_SAFE bool ida_local qisxdigit(char c)
Definition pro.h:946
INLINE THREAD_SAFE bool ida_local qisascii(char c)
Definition pro.h:937
INLINE THREAD_SAFE bool ida_local qisprint(char c)
Definition pro.h:944
INLINE THREAD_SAFE bool ida_local qisspace(char c)
Definition pro.h:938
idaman THREAD_SAFE va_list va
See qsscanf()
Definition err.h:21
idaman THREAD_SAFE AS_SCANF(2, 0) int ida_export qvfscanf(FILE *fp
idaman AS_PRINTF(3, 4) THREAD_SAFE int ida_export qsnprintf(char *buffer
idaman THREAD_SAFE const char * format
Definition fpro.h:78
idaman THREAD_SAFE AS_PRINTF(1, 0) void ida_export vqperror(const char *format
Print error message to stderr (analog of perror)
THREAD_SAFE va_start(va, format)
idaman const char * end
Definition pro.h:1001
int code
Definition fpro.h:88
idaman size_t n
Definition pro.h:997
THREAD_SAFE bool unpack_sleb128(T *res, const uchar **pptr, const uchar *end)
Definition pro.h:1948
THREAD_SAFE bool unpack_uleb128(T *res, const uchar **pptr, const uchar *end)
Definition pro.h:1941
GCC_DIAG_OFF(format-nonliteral)
cexpr_t * e
Definition hexrays.hpp:7308
const tinfo_t & type
Definition hexrays.hpp:7301
carglist_t * args
Definition hexrays.hpp:7323
CASSERT(sizeof(asm_t)==416)
idaman int64 size_t count
Definition kernwin.hpp:1366
int nbytes
Definition kernwin.hpp:2861
uval_t uval_t
Definition kernwin.hpp:1878
idaman int64 pos
Definition kernwin.hpp:1365
idaman callui_t ida_export_data(idaapi *callui)(ui_notification_t what
Pointer to the user-interface dispatcher function.
idaman size_t len
Definition kernwin.hpp:1356
asize_t size
Definition kernwin.hpp:6339
void(idaapi *range_marker)(ea_t ea
Pointer to range marker function (for idaviews and hexviews) This pointer is initialized by setup_ran...
bool result
Definition kernwin.hpp:7890
constexpr uint32 low(const uint64 &x)
Definition llong.hpp:24
unsigned __int64 uint64
Definition llong.hpp:13
constexpr uint64 make_uint64(uint32 ll, int32 hh)
Definition llong.hpp:23
constexpr uint32 high(const uint64 &x)
Definition llong.hpp:25
__int64 int64
Definition llong.hpp:14
Functions to work with intervals.
Definition pro.h:1452
THREAD_SAFE constexpr bool contains(uval_t off1, asize_t s1, uval_t off)
Does (off1,s1) contain off?
Definition pro.h:1469
THREAD_SAFE constexpr uval_t last(uval_t off, asize_t s)
max offset of the interval (assume s != 0)
Definition pro.h:1454
THREAD_SAFE constexpr bool includes(uval_t off1, asize_t s1, uval_t off2, asize_t s2)
Does (off1,s1) include (off2,s2)?
Definition pro.h:1464
THREAD_SAFE constexpr bool overlap(uval_t off1, asize_t s1, uval_t off2, asize_t s2)
Do (off1,s1) and (off2,s2) overlap?
Definition pro.h:1459
idaman size_t const char time_t t
Definition pro.h:602
INLINE THREAD_SAFE bool qlocaltime64(struct tm *_tm, qtime64_t t)
Same as qlocaltime(struct tm *, time_t), but accepts a 64-bit time value.
Definition pro.h:560
THREAD_SAFE size_t idaapi qstrlen(const char *s)
Definition pro.h:2998
idaman THREAD_SAFE qtime64_t ida_export qtime64(void)
Get the current time with microsecond resolution (in fact the resolution is worse on windows)
idaman THREAD_SAFE int ida_export get_logical_core_count()
Get the total CPU logical core count.
idaman THREAD_SAFE char *ida_export unpack_ds(const uchar **pptr, const uchar *end, bool empty_null)
Unpack a string.
THREAD_SAFE void * extract_obj(T &v, void *destbuf, size_t destsize)
Definition pro.h:1996
idaman THREAD_SAFE int ida_export memicmp(const void *x, const void *y, size_t size)
idaman THREAD_SAFE void *ida_export qvector_reserve(void *vec, void *old, size_t cnt, size_t elsize)
Change capacity of given qvector.
THREAD_SAFE uchar extract_db(T &v)
Definition pro.h:1988
THREAD_SAFE bool idaapi has_file_ext(const char *file)
Does the given file name have an extension?
Definition pro.h:1165
unsigned short uint16
unsigned 16 bit value
Definition pro.h:346
idaman THREAD_SAFE int ida_export qstat(const char *path, struct qstatbuf *buf)
Get file status.
idaman THREAD_SAFE void *ida_export launch_process(const launch_process_params_t &lpp, qstring *errbuf=nullptr)
Launch the specified process in parallel.
idaman THREAD_SAFE enum tty_control_t ida_export is_control_tty(int fd)
Check if the current process is the owner of the TTY specified by 'fd' (typically an opened descripto...
idaman THREAD_SAFE uint64 ida_export get_nsec_stamp(void)
High resolution timer.
idaman int ida_export bitcountr_zero(uint64 x)
count the number of consecutive trailing zero bits (line C++20 std::countr_zero())
idaman THREAD_SAFE bool ida_export qsetenv(const char *varname, const char *value)
Thread safe function to work with the environment.
idaman THREAD_SAFE int ida_export qchsize(int h, uint64 fsize)
Change file size.
INLINE int nowarn_qsnprintf(char *buf, size_t size, const char *format,...)
Definition pro.h:1010
idaman THREAD_SAFE bool ida_export is_valid_utf8(const char *in)
Does byte sequence consist of valid UTF-8-encoded codepoints?
idaman THREAD_SAFE uchar *ida_export pack_ds(uchar *ptr, uchar *end, const char *x, size_t len=0)
Pack a string.
int bool
Definition pro.h:329
unsigned int uint32
unsigned 32 bit value
Definition pro.h:348
THREAD_SAFE constexpr uint32 swap32(uint32 x)
Definition pro.h:1650
T qrotr(T value, size_t count)
Rotate right.
Definition pro.h:1509
idaman THREAD_SAFE bool ida_export is_main_thread(void)
Are we running in the main thread?
qvector< int > intvec_t
vector of integers
Definition pro.h:2765
idaman void ida_export build_plugin_options(qstring *out, const plugin_options_t &opts, const char *optname=nullptr)
Build the plugin options, suitable for IDA command line of the form <name1>=<value1>:....
signed char sint8
signed 8 bit value
Definition pro.h:343
idaman THREAD_SAFE bool ida_export qctime(char *buf, size_t bufsize, qtime32_t t)
Converts calendar time into a string.
idaman THREAD_SAFE int ida_export qcreate(const char *file, int stat)
Create new file with O_RDWR, sets qerrno.
idaman THREAD_SAFE const char *ida_export qbasename(const char *path)
Get the file name part of the given path.
idaman THREAD_SAFE char *ida_export vqmakepath(char *buf, size_t bufsize, const char *s1, va_list)
See qmakepath()
idaman THREAD_SAFE bool ida_export qustrncpy(char *dst, const char *utf8, size_t dstsize)
A safer strncpy - makes sure that there is a terminating zero.
idaman THREAD_SAFE bool ida_export qgetenv(const char *varname, DEFARG(qstring *buf, nullptr))
Thread safe function to work with the environment.
constexpr bool is_tail_surrogate(wchar32_t wch)
Definition pro.h:4766
constexpr bool is_utf8_head(char in)
Does this byte correspond to the head of a UTF-8 byte sequence?
Definition pro.h:4727
char ** expand_argv(int *p_argc, int argc, const char *const argv[])
Copy and expand command line arguments.
idaman THREAD_SAFE int ida_export get_physical_core_count()
Get the total CPU physical core count.
idaman THREAD_SAFE char *ida_export qstpncpy(char *dst, const char *src, size_t dstsize)
A safer stpncpy - returns pointer to the end of the destination nb: ssize_t(dstsize) must be > 0.
bool is_sdiv_ok(T a, T b)
Check that signed division is permissible.
Definition pro.h:1559
idaman THREAD_SAFE bool ida_export sanitize_file_name(char *name, size_t namesize)
Sanitize the file name.
T round_down(T val, T base)
Definition pro.h:1443
idaman int ida_export regex_match(const char *str, const char *pattern, bool sense_case)
Match a string with a regular expression.
idaman THREAD_SAFE char *ida_export qmake_full_path(char *dst, size_t dstsize, const char *src)
Convert relative path to absolute path.
uint64 asize_t
Definition pro.h:423
idaman THREAD_SAFE void ida_export qdetach_tty(void)
If the current terminal is the controlling terminal of the calling process, give up this controlling ...
THREAD_SAFE void * extract_buf(T &v, size_t size)
Definition pro.h:2044
idaman THREAD_SAFE int ida_export qwait_timed(int *status, int child, int flags, int timeout_ms)
Wait for state changes in a child process (UNIX only).
idaman THREAD_SAFE int ida_export term_process(void *handle)
Forcibly terminate a running process.
idaman THREAD_SAFE int ida_export qwait_for_handles(int *idx, const qhandle_t *handles, int n, uint32 write_bitmask, int timeout_ms)
Wait for file/socket/pipe handles.
idaman THREAD_SAFE bool ida_export qsem_post(qsemaphore_t sem)
Unlock a semaphore.
idaman THREAD_SAFE const char *ida_export get_file_ext(const char *file)
Get pointer to extension of file name.
idaman THREAD_SAFE size_t ida_export parse_command_line(qstrvec_t *args, channel_redirs_t *redirs, const char *cmdline, int flags)
Parse a space separated string (escaping with backslash is supported).
idaman THREAD_SAFE uint32 ida_export calc_crc32(uint32 crc, const void *buf, size_t len)
Calculate CRC32 (polynom 0xEDB88320, zlib compatible).
idaman THREAD_SAFE size_t ida_export skip_utf8(const char **putf8, size_t n)
Advance by n codepoints into the UTF-8 buffer.
T * qalloc_array(size_t n)
Use this class to avoid integer overflows when allocating arrays.
Definition pro.h:784
constexpr T make_mask(int count)
Make a mask of 'count' bits.
Definition pro.h:1521
INLINE THREAD_SAFE int ida_local qtolower(char c)
Get lowercase equivalent of given char.
Definition pro.h:950
T align_up(T val, int elsize)
Align element up to nearest boundary.
Definition pro.h:4628
uint64 ea64_t
64-bit address, regardless of IDA bitness.
Definition pro.h:453
void shift_up(T *dst, T *src, size_t cnt)
Move data up in memory.
Definition pro.h:2220
idaman THREAD_SAFE char *ida_export qstrtok(char *s, const char *delim, char **save_ptr)
Thread-safe version of strtok.
THREAD_SAFE constexpr int dd_size(uchar first_byte)
Definition pro.h:1975
uint32 ea32_t
32-bit address, regardless of IDA bitness.
Definition pro.h:450
idaman THREAD_SAFE bool ida_export get_login_name(qstring *out)
Get the user name for the current desktop session.
int32 qtime32_t
we use our own time type because time_t can be 32-bit or 64-bit depending on the compiler
Definition pro.h:497
qvector< uval_t > uvalvec_t
vector of unsigned values
Definition pro.h:2762
uint32 wchar32_t
Definition pro.h:371
THREAD_SAFE uchar idaapi unpack_db(const uchar **pptr, const uchar *end)
Unpack a byte from a character string, pack_db()
Definition pro.h:1747
idaman THREAD_SAFE void *ida_export qcalloc(size_t nitems, size_t itemsize)
System independent calloc.
idaman THREAD_SAFE char *ida_export qstrupr(char *str)
Convert the string to uppercase.
THREAD_SAFE void *idaapi unpack_obj(void *destbuf, size_t destsize, const uchar **pptr, const uchar *end)
Unpack an object of a known size.
Definition pro.h:1801
constexpr T right_sshift(const T &value, int shift)
Shift by the amount exceeding the operand size*8 is undefined by the standard.
Definition pro.h:1491
bool is_mul_ok(T count, T elsize)
Check that unsigned multiplication does not overflow.
Definition pro.h:1536
idaman THREAD_SAFE bool ida_export base64_encode(qstring *output, const void *input, size_t size)
Encode base64.
uint32 bgcolor_t
background color in RGB
Definition pro.h:5012
THREAD_SAFE char *idaapi make_file_ext(char *buf, size_t bufsize, const char *file, const char *ext)
Set file name extension if none exists.
Definition pro.h:1180
qvector< size_t > sizevec_t
vector of sizes
Definition pro.h:2767
uint8 op_dtype_t
Definition pro.h:460
adiff_t sval_t
signed value used by the processor.
Definition pro.h:446
idaman THREAD_SAFE bool ida_export qctime_utc(char *buf, size_t bufsize, qtime32_t t)
Converts calendar time into a string using Coordinated Universal Time (UTC).
short int16
signed 16 bit value
Definition pro.h:345
idaman THREAD_SAFE void ida_export swap_value(void *dst, const void *src, int size)
Swap endianness of a given value in memory.
THREAD_SAFE constexpr ushort swap16(ushort x)
Definition pro.h:1654
idaman THREAD_SAFE char *ida_export qstrncpy(char *dst, const char *src, size_t dstsize)
A safer strncpy - makes sure that there is a terminating zero.
T qabs(T x)
Definition pro.h:1357
idaman THREAD_SAFE void *ida_export qrealloc(void *alloc, size_t newsize)
System independent realloc.
idaman THREAD_SAFE void ida_export reloc_value(void *value, int size, adiff_t delta, bool mf)
idaman THREAD_SAFE bool ida_export set_interr_throws(bool enable)
THREAD_SAFE void unpack_eavec(eavec_t *vec, ea_t ea, const uchar **ptr, const uchar *end)
Unpack a vector of ea values.
Definition pro.h:4342
idaman THREAD_SAFE bool ida_export qfileexist(const char *file)
Does the given file exist?
idaman THREAD_SAFE int ida_export read2bytes(int h, uint16 *res, bool mf)
Read a 2 byte entity from a file.
THREAD_SAFE uchar * pack_ea(uchar *ptr, uchar *end, ea_t ea)
Pack an ea value into a character string, see pack_dd()/pack_dq()
Definition pro.h:1766
int64 adiff_t
Definition pro.h:424
idaman AS_STRFTIME(3) THREAD_SAFE size_t ida_export qstrftime(char *buf
Get string representation of a time_t (local time) Copies into 'buf' the content of 'format',...
NORETURN void __debugbreak(void)
idaman THREAD_SAFE void ida_export qsleep(int milliseconds)
Suspend execution for given number of milliseconds.
uint64 ea_t
Definition pro.h:421
idaman THREAD_SAFE NORETURN void ida_export qexit(int code)
Call qatexit functions, shut down UI and kernel, and exit.
THREAD_SAFE const void *idaapi unpack_obj_inplace(const uchar **pptr, const uchar *end, size_t objsize)
In-place version of unpack_obj().
Definition pro.h:1847
constexpr T right_ushift(const T &value, int shift)
Shift by the amount exceeding the operand size*8 is undefined by the standard.
Definition pro.h:1486
uint32 flags_t
32-bit flags for each address
Definition pro.h:5008
THREAD_SAFE uint32 extract_dd(T &v)
Definition pro.h:2015
int int32
signed 32 bit value
Definition pro.h:347
idaman int ida_export bitcount(uint64 x)
count the number of non-zero bits (the population count)
idaman THREAD_SAFE uint64 ida_export unpack_dq(const uchar **pptr, const uchar *end)
unpack a quadword, see unpack_db()
GCC_DIAG_ON(format-nonliteral)
idaman THREAD_SAFE bool ida_export qsem_free(qsemaphore_t sem)
Free a semaphore.
T qrotl(T value, size_t count)
Rotate left.
Definition pro.h:1497
idaman THREAD_SAFE void ida_export qcontrol_tty(void)
Make the current terminal the controlling terminal of the calling process.
idaman THREAD_SAFE bool ida_export qthread_same(qthread_t q)
Is the current thread the same as 'q'?
uint64 qtime64_t
64-bit time value expressed as seconds and microseconds since the Epoch
Definition pro.h:499
wchar_t wchar16_t
Definition pro.h:370
idaman bool ida_export_data under_debugger
is IDA running under a debugger?
Definition pro.h:735
THREAD_SAFE bool unpack_bytevec(bytevec_t *out, const uchar **pptr, const uchar *end)
Definition pro.h:4358
std::unique_ptr< T, qfree_deleter_t< T > > qalloc_janitor_t
Definition pro.h:4502
idaman THREAD_SAFE bool ida_export qthread_equal(qthread_t q1, qthread_t q2)
Are two threads equal?
idaman THREAD_SAFE void *ida_export qalloc_or_throw(size_t size)
qalloc() 'size' bytes, and throw a "not enough memory" error if failed
idaman time_t ida_export qtimegm(const struct tm *ptm)
idaman THREAD_SAFE int ida_export writebytes(int h, uint32 l, int size, bool mf)
Write at most 4 bytes to file.
unsigned char uchar
unsigned 8 bit value
Definition pro.h:337
tty_control_t
Teletype control.
Definition pro.h:5364
@ TCT_NOT_OWNER
Definition pro.h:5367
@ TCT_OWNER
Definition pro.h:5366
@ TCT_UNKNOWN
Definition pro.h:5365
INLINE THREAD_SAFE qtime64_t make_qtime64(uint32 secs, DEFARG(int32 usecs, 0))
Get a qtime64_t instance from a seconds value and microseconds value.
Definition pro.h:522
const qhandle_t NULL_PIPE_HANDLE
Definition pro.h:5490
qvector< bool > boolvec_t
vector of bools
Definition pro.h:2766
idaman THREAD_SAFE void ida_export qfree(void *alloc)
System independent free.
idaman THREAD_SAFE ushort ida_export unpack_dw(const uchar **pptr, const uchar *end)
unpack a word, see unpack_db()
idaman THREAD_SAFE uint64 ida_export qfilesize(const char *fname)
Get the file size.
int lexcompare_vectors(const T &a, const T &b)
Lexical comparison of two vectors.
Definition pro.h:2903
THREAD_SAFE void qswap(T &a, T &b)
Swap 2 objects of the same type using memory copies.
Definition pro.h:1715
idaman THREAD_SAFE bool ida_export prev_utf8_char(wchar32_t *out_cp, const char **p, const char *begin)
Get the UTF-8 character from string, before 'p'.
idaman THREAD_SAFE void ida_export del_qatexit(void(idaapi *func)(void))
Remove a previously added exit-time function.
idaman THREAD_SAFE char *ida_export strrpl(char *str, int char1, int char2)
Replace all occurrences of a character within a string.
THREAD_SAFE int idaapi qstrncmp(const char *s1, const char *s2, size_t len)
Definition pro.h:3024
idaman THREAD_SAFE char *ida_export qstrdup(const char *string)
System independent strdup.
THREAD_SAFE constexpr int dw_size(uchar first_byte)
Definition pro.h:1967
idaman bool ida_export parse_dbgopts(struct instant_dbgopts_t *ido, const char *r_switch)
Parse the -r command line switch (for instant debugging).
THREAD_SAFE bool unpack_ds_to_buf(char *dst, size_t dstsize, const uchar **pptr, const uchar *end)
Unpack a string.
Definition pro.h:1908
idaman size_t bufsize
Definition pro.h:600
INLINE THREAD_SAFE uint32 get_secs(qtime64_t t)
Get the 'seconds since the epoch' part of a qtime64_t.
Definition pro.h:504
idaman THREAD_SAFE bool ida_export qmutex_unlock(qmutex_t m)
Unlock a mutex.
T * qrealloc_array(T *ptr, size_t n)
Use this class to avoid integer overflows when allocating arrays.
Definition pro.h:791
uint64 sel_t
Definition pro.h:422
idaman THREAD_SAFE size_t ida_export qustrlen(const char *utf8)
idaman THREAD_SAFE qsemaphore_t ida_export qsem_create(const char *name, int init_count)
Create a new semaphore.
const char * unpack_str(const uchar **pptr, const uchar *end)
Definition pro.h:2062
qvector< channel_redir_t > channel_redirs_t
vector of channel_redir_t objects
Definition pro.h:5042
idaman THREAD_SAFE char *ida_export qmakefile(char *buf, size_t bufsize, const char *base, const char *ext)
Construct filename from base name and extension.
THREAD_SAFE char *idaapi qstrchr(char *s1, char c)
Definition pro.h:3042
idaman THREAD_SAFE void *ida_export qrealloc_or_throw(void *ptr, size_t size)
qrealloc() 'ptr' by 'size', and throw a "not enough memory" error if failed
_qstring< uchar > qtype
type string
Definition pro.h:3695
idaman THREAD_SAFE int ida_export readbytes(int h, uint32 *res, int size, bool mf)
Read at most 4 bytes from file.
idaman THREAD_SAFE int ida_export qread(int h, void *buf, size_t n)
Works the same as it's counterpart from Clib.
void shift_down(T *dst, T *src, size_t cnt)
Move data down in memory.
Definition pro.h:2197
qvector< plugin_option_t > plugin_option_vec_t
Definition pro.h:5188
idaman THREAD_SAFE bool ida_export search_path(char *buf, size_t bufsize, const char *file, bool search_cwd)
Search for a file in the PATH environment variable or the current directory.
INLINE THREAD_SAFE void idaapi set_bit(uchar *bitmap, size_t bit)
Set 'bit' in 'bitmap'.
Definition pro.h:1369
idaman bool ida_export is_cvt64()
is IDA converting IDB into I64?
idaman THREAD_SAFE uint32 ida_export unpack_dd(const uchar **pptr, const uchar *end)
unpack a double word, see unpack_db()
bool is_add_ok(U x, T y)
Check that unsigned or unsigned+signed addition does not overflow.
Definition pro.h:1545
idaman THREAD_SAFE bool ida_export qpipe_read_n(qhandle_t handle, bytevec_t *out_bytes, size_t n)
Read a specific amount of bytes from a pipe.
int idaapi qthread_cb_t(void *ud)
THREADS.
Definition pro.h:5395
idaman THREAD_SAFE int ida_export qfstat(int fd, struct qstatbuf *buf)
idaman THREAD_SAFE bool ida_export qmutex_free(qmutex_t m)
Free a mutex.
idaman THREAD_SAFE bool ida_export qmutex_lock(qmutex_t m)
Lock a mutex.
idaman THREAD_SAFE wchar32_t ida_export get_utf8_char(const char **pptr)
Read one UTF-8 character from string. if error, return BADCP.
INLINE THREAD_SAFE void idaapi clear_bits(uchar *bitmap, size_t low, size_t high)
Clear bits between [low, high) in 'bitmap'.
Definition pro.h:1388
THREAD_SAFE uint64 extract_dq(T &v)
Definition pro.h:2026
constexpr bool is_lead_surrogate(wchar32_t wch)
Definition pro.h:4765
bool wildcard_path_match(const char *name, const char *_pattern, int flags=0)
Match a path against a pattern.
idaman int ida_export qchdir(const char *path)
Change the current working directory.
unsigned int uint
unsigned 32 bit value
Definition pro.h:339
idaman THREAD_SAFE int ida_export qwrite(int h, const void *buf, size_t n)
Works the same as it's counterpart from Clib.
idaman THREAD_SAFE ssize_t ida_export put_utf8_char(char *out, wchar32_t cp)
Encode the codepoint into a UTF-8 byte sequence, and add terminating zero.
idaman THREAD_SAFE uint64 ida_export qfilelength(int h)
Get file length in bytes.
THREAD_SAFE uchar *idaapi pack_db(uchar *ptr, uchar *end, uchar x)
Pack a byte into a character string.
Definition pro.h:1737
idaman THREAD_SAFE bool ida_export gen_rand_buf(void *buffer, size_t bufsz)
Generate a random buffer.
idaman THREAD_SAFE int ida_export qmkdir(const char *file, int mode)
Create an empty directory.
THREAD_SAFE uint16 extract_dw(T &v)
Definition pro.h:2004
idaman THREAD_SAFE uchar *ida_export pack_dq(uchar *ptr, uchar *end, uint64 x)
pack a quadword, see pack_db()
size_t diffpos_t
Definition pro.h:479
idaman THREAD_SAFE uint32 ida_export calc_file_crc32(class linput_t *fp)
Calculate an input source CRC32.
idaman THREAD_SAFE bool ida_export qisdir(const char *file)
Does the given path specify a directory?
idaman THREAD_SAFE qoff64_t ida_export qseek(int h, int64 offset, int whence)
Works the same as it's counterpart from Clib.
THREAD_SAFE const void *idaapi unpack_buf_inplace(const uchar **pptr, const uchar *end)
In-place version of unpack_buf().
Definition pro.h:1865
int error_t
Error code (errno)
Definition pro.h:458
INLINE THREAD_SAFE int ida_local qtoupper(char c)
Get uppercase equivalent of given char.
Definition pro.h:952
int lexcompare(const T &a, const T &b)
Standard lexical comparison.
Definition pro.h:2888
qvector< ea_t > eavec_t
vector of addresses
Definition pro.h:2764
uval_t inode_t
The inode_t type is the specialization specific inode number.
Definition pro.h:464
uint64 flags64_t
64-bit flags for each address
Definition pro.h:5009
void qvoid_t
Definition pro.h:4509
idaman THREAD_SAFE bool ida_export qlocaltime(struct tm *_tm, time_t t)
Converts a time value to a tm structure (local time)
bool wildcard_match(const char *name, const char *pattern)
Match a name against a pattern.
THREAD_SAFE char *idaapi qstrstr(char *s1, const char *s2)
Definition pro.h:3033
idaman THREAD_SAFE bool ida_export qthread_join(qthread_t q)
Wait a thread until it terminates.
INLINE void free_argv(int argc, char **argv)
Free 'argc' elements of 'argv'.
Definition pro.h:5080
idaman THREAD_SAFE qmutex_t ida_export qmutex_create(void)
Create a new mutex.
idaman THREAD_SAFE int ida_export qfsync(int h)
Works the same as it's counterpart from Clib.
void * qhandle_t
MS Windows HANDLE.
Definition pro.h:5489
idaman THREAD_SAFE error_t ida_export set_qerrno(error_t code)
Set qerrno.
void cliopt_handler_t(const char *value, void *ud)
Definition pro.h:5102
idaman THREAD_SAFE int ida_export check_process_exit(void *handle, int *exit_code, DEFARG(int msecs,-1))
Check whether process has terminated or not.
_qstring< wchar16_t > qwstring
unicode string
Definition pro.h:3696
idaman uint32 ida_export round_down_power2(uint32 x)
THREAD_SAFE constexpr wchar16_t utf8_wchar16(uchar b0, uchar b1)
Definition pro.h:4813
T round_up(T val, T base)
round up or down to an arbitrary number
Definition pro.h:1438
qvector< sval_t > svalvec_t
vector of signed values
Definition pro.h:2763
DECLARE_TYPE_AS_MOVABLE(cliopt_t)
INLINE THREAD_SAFE void idaapi clear_bit(uchar *bitmap, size_t bit)
Clear 'bit' in 'bitmap'.
Definition pro.h:1375
idaman THREAD_SAFE char *ida_export qstrlwr(char *str)
Convert the string to lowercase.
INLINE THREAD_SAFE bool acp_utf8(qstring *out, const char *in)
Definition pro.h:4802
idaman THREAD_SAFE char *ida_export qmakepath(char *buf, size_t bufsize, const char *s1,...)
Construct a path from a null-terminated sequence of strings.
idaman THREAD_SAFE bool ida_export base64_decode(bytevec_t *output, const char *input, size_t size)
Decode base64.
THREAD_SAFE const char *idaapi qstrrchr(const char *s1, char c)
Definition pro.h:3055
idaman THREAD_SAFE char *ida_export qsplitfile(char *file, char **base, char **ext)
Split filename into base name and extension.
INLINE THREAD_SAFE bool qgmtime64(struct tm *_tm, qtime64_t t)
Same as qgmtime(struct tm *, time_t), but accepts a 64-bit time value.
Definition pro.h:576
INLINE THREAD_SAFE void idaapi set_all_bits(uchar *bitmap, size_t nbits)
Set first 'nbits' of 'bitmap'.
Definition pro.h:1395
bool is_udiv_ok(T, T b)
Check that unsigned division is permissible.
Definition pro.h:1552
ptrdiff_t ssize_t
Signed size_t - used to check for size overflows when the counter becomes negative.
Definition pro.h:381
idaman uint64 ida_export extend_sign(uint64 v, int nbytes, bool sign_extend)
Sign-, or zero-extend the value 'v' to occupy 64 bits.
constexpr diffpos_t BADDIFF
Definition pro.h:480
INLINE THREAD_SAFE bool idaapi test_bit(const uchar *bitmap, size_t bit)
Test if 'bit' is set in 'bitmap'.
Definition pro.h:1364
THREAD_SAFE ea_t extract_ea(T &v)
Definition pro.h:2034
unsigned short ushort
unsigned 16 bit value
Definition pro.h:338
idaman THREAD_SAFE ssize_t ida_export qpipe_read(qhandle_t handle, void *buf, size_t size)
Read from a pipe.
T align_down(T val, int elsize)
Align element down to nearest boundary.
Definition pro.h:4638
INLINE THREAD_SAFE uint32 get_usecs(qtime64_t t)
Get the microseconds part of a qtime64_t.
Definition pro.h:512
idaman THREAD_SAFE int ida_export qdup(int h)
Works the same as it's counterpart from Clib.
idaman THREAD_SAFE bool ida_export replace_tabs(qstring *out, const char *str, int tabsize)
Convert tabulations to spaces.
idaman bool ida_export parse_plugin_options(plugin_options_t *opts, const char *optstring)
Parse plugin options from IDA command line specified by -O<plugin_name>:<optstring> Note such options...
THREAD_SAFE int qwait(int *status, int child, int flags)
Definition pro.h:5338
idaman THREAD_SAFE bool ida_export idb_utf8(qstring *out, const char *in, int nsyms=-1, int flags=0)
IDB default C string encoding -> UTF-8.
idaman THREAD_SAFE uchar *ida_export pack_dd(uchar *ptr, uchar *end, uint32 x)
pack a double word, see pack_db()
idaman THREAD_SAFE bool ida_export change_codepage(qstring *out, const char *in, int incp, int outcp)
Definition pro.h:4807
idaman THREAD_SAFE const char *ida_export stristr(const char *s1, const char *s2)
Find one string in another (Case insensitive analog of strstr()).
idaman bool ida_export quote_cmdline_arg(qstring *arg)
Quote a command line argument if it contains escape characters.
idaman THREAD_SAFE bool ida_export qsem_wait(qsemaphore_t sem, int timeout_ms)
Lock and decrement a semaphore. timeout = -1 means block indefinitely.
idaman THREAD_SAFE int ida_export qopen_shared(const char *file, int mode, int share_mode)
Open file with given sharing_mode (use O_RDONLY, O_WRONLY, O_RDWR flags), sets qerrno.
idaman THREAD_SAFE bool ida_export qthread_kill(qthread_t q)
Forcefully kill a thread (calls pthread_cancel under unix)
idaman THREAD_SAFE uval_t ida_export rotate_left(uval_t x, int count, size_t bits, size_t offset)
Rotate left - can be used to rotate a value to the right if the count is negative.
idaman THREAD_SAFE void *ida_export qalloc(size_t size)
System independent malloc.
idaman THREAD_SAFE int ida_export qpipe_create(qhandle_t handles[2])
Create a pipe.
idaman THREAD_SAFE int ida_export get_available_core_count()
Get the number of logical CPU cores available to the current process if supported by the OS.
DEFINE_PLUGIN_OPTION_T_HELPERS(idaman) struct plugin_option_t
Named option, supports two kinds of options: string option: <name>=bool option: <name>=[on|off].
Definition pro.h:5159
idaman void *ida_export pipe_process(qhandle_t *read_handle, qhandle_t *write_handle, launch_process_params_t *lpp, qstring *errbuf=nullptr)
Launch a process and establish 2-way comminucation with it.
INLINE THREAD_SAFE void idaapi set_bits(uchar *bitmap, size_t low, size_t high)
Set bits between [low, high) in 'bitmap'.
Definition pro.h:1381
THREAD_SAFE void * extract_array(T &v, size_t *sz, size_t maxsize)
Definition pro.h:2053
idaman uint32 ida_export round_up_power2(uint32 x)
round up or down to a power of 2
idaman THREAD_SAFE int ida_export qclose(int h)
Works the same as it's counterpart from Clib.
void idaapi setflag(T &where, U bit, bool cnd)
Set a 'bit' in 'where' if 'value' if not zero.
Definition pro.h:1527
ea_t tid_t
type id (for enums, structs, etc)
Definition pro.h:5010
idaman THREAD_SAFE bool ida_export utf16_utf8(qstring *out, const wchar16_t *in, int nsyms=-1)
UTF-16 -> UTF-8.
idaman THREAD_SAFE bool ida_export relocate_relobj(struct relobj_t *_relobj, ea_t ea, bool mf)
idaman THREAD_SAFE void *ida_export memrev(void *buf, ssize_t size)
Reverse memory block.
idaman THREAD_SAFE int ida_export qopen(const char *file, int mode)
Works the same as it's counterpart from Clib.
idaman THREAD_SAFE void ida_export qatexit(void(idaapi *func)(void))
Add a function to be called at exit time.
idaman THREAD_SAFE char *ida_export qstrncat(char *dst, const char *src, size_t dstsize)
A safer strncat - accepts the size of the 'dst' as 'dstsize' and returns dst nb: ssize_t(dstsize) mus...
INLINE int64 qatoll(const char *nptr)
Definition pro.h:355
int compare_containers(const T &l, const T &r)
Template to compare any 2 containers of the same type. Returns -1/0/1.
Definition pro.h:4555
THREAD_SAFE void *idaapi unpack_buf(const uchar **pptr, const uchar *end)
Unpack an object of an unknown size (packed with append_buf()).
Definition pro.h:1824
unsigned char uint8
unsigned 8 bit value
Definition pro.h:344
THREAD_SAFE ea64_t unpack_ea64(const uchar **ptr, const uchar *end)
Unpack an ea value (always use 64bit, use delta 1)
Definition pro.h:1787
idaman THREAD_SAFE qthread_t ida_export qthread_self(void)
Get current thread. Must call qthread_free() to free it!
idaman THREAD_SAFE bool ida_export utf8_utf16(qwstring *out, const char *in, int nsyms=-1)
UTF-8 -> UTF-16.
constexpr bool is_utf8_tail(char in)
Does this byte correspond to the tail of a UTF-8 byte sequence?
Definition pro.h:4735
THREAD_SAFE int ds_packed_size(const char *s)
Definition pro.h:1964
THREAD_SAFE int idaapi qstrcmp(const char *s1, const char *s2)
Definition pro.h:3011
idaman THREAD_SAFE bool ida_export qdirname(char *buf, size_t bufsize, const char *path)
Get the directory part of the path.
idaman THREAD_SAFE ssize_t ida_export qpipe_write(qhandle_t handle, const void *buf, size_t size)
Write to a pipe.
char int8
signed 8 bit value
Definition pro.h:342
constexpr bool is_pow2(T val)
is power of 2? (or zero)
Definition pro.h:1432
INLINE THREAD_SAFE void idaapi clear_all_bits(uchar *bitmap, size_t nbits)
Clear first 'nbits' of 'bitmap'.
Definition pro.h:1405
idaman ssize_t ida_export convert_encoding(bytevec_t *out, const char *fromcode, const char *tocode, const uchar *indata, ssize_t insize, DEFARG(int flags, 0))
Convert data from encoding fromcode into tocode.
idaman THREAD_SAFE NORETURN void ida_export interr(int code)
Show internal error message and terminate execution.
idaman THREAD_SAFE int ida_export qtouchfile(const char *file_name)
touch: set access and modification times of the file to the current time
idaman THREAD_SAFE uchar *ida_export pack_dw(uchar *ptr, uchar *end, uint16 x)
pack a word, see pack_db()
idaman THREAD_SAFE qthread_t ida_export qthread_create(qthread_cb_t *thread_cb, void *ud)
Create a thread and return a thread handle.
idaman THREAD_SAFE bool ida_export unpack_xleb128(void *res, int nbits, bool is_signed, const uchar **pptr, const uchar *end)
Unpack an LEB128 encoded (DWARF-3 style) signed/unsigned value.
constexpr T left_shift(const T &value, int shift)
Shift by the amount exceeding the operand size*8 is undefined by the standard.
Definition pro.h:1481
_qstring< char > qstring
regular string
Definition pro.h:3694
INLINE THREAD_SAFE char * tail(char *str)
Get tail of a string.
Definition pro.h:879
idaman THREAD_SAFE qoff64_t ida_export qtell(int h)
Works the same as it's counterpart from Clib.
idaman THREAD_SAFE error_t ida_export get_qerrno(void)
Get qerrno.
idaman void ida_export qgetcwd(char *buf, size_t bufsize)
Get the current working directory.
idaman THREAD_SAFE bool ida_export is_cp_graphical(wchar32_t cp)
Is the provided codepoint graphical?
idaman int ida_export log2ceil(uint64 d64)
calculate ceil(log2(d64)) or floor(log2(d64)), it returns 0 if d64 == 0
constexpr wchar32_t utf16_surrogates_to_cp(wchar16_t lead_surrogate, wchar16_t tail_surrogate)
Definition pro.h:4767
idaman THREAD_SAFE bool ida_export qisabspath(const char *file)
Is the file name absolute (not relative to the current dir?)
qvector< qwstring > qwstrvec_t
vector of unicode strings
Definition pro.h:3698
idaman THREAD_SAFE int ida_export qpipe_close(qhandle_t handle)
Close a pipe.
THREAD_SAFE constexpr wchar32_t utf8_wchar32(uchar b0, uchar b1, uchar b2, uchar b3)
Definition pro.h:4827
int compare(const T &a, const T &b)
Definition pro.h:4514
idaman THREAD_SAFE int ida_export qrmdir(const char *file)
Delete a directory.
THREAD_SAFE ea_t unpack_ea(const uchar **ptr, const uchar *end)
Unpack an ea value, see unpack_dd()/unpack_dq()
Definition pro.h:1777
void cliopt_poly_handler_t(int argc, const char **argv, void *ud)
Definition pro.h:5103
idaman bool ida_export qgmtime(struct tm *_tm, time_t t)
Converts a time value to a tm structure (UTC time)
idaman THREAD_SAFE char *ida_export set_file_ext(char *outbuf, size_t bufsize, const char *file, const char *ext)
Set file name extension unconditionally.
qvector< qstring > qstrvec_t
vector of strings
Definition pro.h:3697
idaman int ida_export log2floor(uint64 d64)
idaman THREAD_SAFE void ida_export qthread_free(qthread_t q)
Free a thread resource (does not kill the thread) (calls pthread_detach under unix)
THREAD_SAFE constexpr T extend_sign_bits(T v, int nbits)
Sign, or zero-extend V depending on the high bit of V.
Definition pro.h:1569
Tools for command line parsing.
Definition pro.h:5022
qstring file
file name to redirect to/from.
Definition pro.h:5024
int flags
i/o redirection flags
Definition pro.h:5026
int fd
channel number
Definition pro.h:5023
int start
begin of the redirection string in the command line
Definition pro.h:5039
bool is_append(void) const
Definition pro.h:5037
bool is_quoted(void) const
Definition pro.h:5038
bool is_input(void) const
Definition pro.h:5035
int length
length of the redirection string in the command line
Definition pro.h:5040
bool is_output(void) const
Definition pro.h:5036
int nargs
Definition pro.h:5110
const char * longname
Definition pro.h:5107
const char * help
Definition pro.h:5108
cliopt_handler_t * handler
Definition pro.h:5109
char shortname
Definition pro.h:5106
Template to compare any 2 values of the same type. Returns -1/0/1.
Definition pro.h:4507
Options for instant debugging.
Definition pro.h:5236
int event_id
event to trigger upon attaching
Definition pro.h:5243
qstring debmod
name of debugger module
Definition pro.h:5237
int pid
process to attach to (-1: ask the user)
Definition pro.h:5242
qstring host
remote hostname (if remote debugging)
Definition pro.h:5239
bool attach
should attach to a process?
Definition pro.h:5244
int port
port number for the remote debugger server
Definition pro.h:5241
qstring pass
password for the remote debugger server
Definition pro.h:5240
qstring env
config variables for debmod. example: DEFAULT_CPU=13;MAXPACKETSIZE=-1
Definition pro.h:5238
interr_exc_t(int _code)
Definition pro.h:760
int code
Definition pro.h:759
linput_t *& resource
Definition pro.h:4491
~janitor_t()
We provide no implementation for this function, you should provide specialized implementation yoursel...
janitor_t(T &r)
Constructor.
Definition pro.h:4487
Information for launching a process with IDA API Note: all string data such as paths (e....
Definition pro.h:5265
const char * args
command line arguments
Definition pro.h:5287
void * info
os specific info (on windows it points to PROCESS_INFORMATION) on unix, not used
Definition pro.h:5296
const char * path
file to run
Definition pro.h:5286
int flags
Launch process flags
Definition pro.h:5267
ssize_t in_handle
handle for stdin or -1
Definition pro.h:5288
char * env
zero separated environment variables that will be appended to the existing environment block (existin...
Definition pro.h:5291
ssize_t err_handle
handle for stderr or -1
Definition pro.h:5290
size_t cb
size of this structure
Definition pro.h:5266
const char * startdir
current directory for the new process
Definition pro.h:5295
ssize_t out_handle
handle for stdout or -1
Definition pro.h:5289
ea_t unpack_ea()
Definition pro.h:4397
void unpack(qvector< T > *out)
Definition pro.h:4444
bool unpack_ds_to_buf(char *buf, size_t bufsize)
Definition pro.h:4408
bool empty() const
Definition pro.h:4390
const uchar * ptr
Definition pro.h:4383
bool eof() const
Definition pro.h:4454
uint64 unpack_dq()
Definition pro.h:4396
const void * unpack_buf_inplace()
Definition pro.h:4416
const uchar * end
Definition pro.h:4384
ssize_t read(void *obj, size_t objsize)
Definition pro.h:4453
void unpack_eavec(eavec_t *vec, ea_t ea)
Definition pro.h:4428
uint16 unpack_dw()
Definition pro.h:4394
memory_deserializer_t(const uchar *p, const uchar *e)
Definition pro.h:4388
bool unpack_str(qstring *out)
Definition pro.h:4401
memory_deserializer_t(const bytevec_t &b)
Definition pro.h:4387
const void * unpack_obj_inplace(size_t objsize)
Definition pro.h:4412
const void * unpack_obj(void *obj, size_t objsize)
Definition pro.h:4420
uint8 unpack_db()
Definition pro.h:4393
void unpack(T *out)
Definition pro.h:4437
uint32 unpack_dd()
Definition pro.h:4395
bool advance(size_t s)
Definition pro.h:4392
memory_deserializer_t(const void *p, size_t s)
Definition pro.h:4389
void unpack(qstring *out)
Definition pro.h:4442
bool unpack_bytevec(bytevec_t *out)
Definition pro.h:4432
const void * unpack_buf()
Definition pro.h:4424
ea64_t unpack_ea64()
Definition pro.h:4398
size_t size() const
Definition pro.h:4391
const char * unpack_str()
Definition pro.h:4400
memory_deserializer_t(const qstring &s)
Definition pro.h:4386
char * unpack_ds(bool empty_null=false)
Definition pro.h:4403
void pack(T value)
Definition pro.h:4463
void pack(const qstring &value)
Definition pro.h:4468
void pack(const qvector< T > &value)
Definition pro.h:4470
const plugin_option_t * find(const qstring &name) const
Definition pro.h:5192
bool erase(const char *name)
Definition pro.h:5200
void operator()(T *ptr)
Definition pro.h:4498
static is_array check_type(const void *, const void *)
static is_pointer check_type(const T *, const T *const *)
Describes miscellaneous file attributes.
Definition pro.h:644
qtime64_t qst_ctime
time of last status change
Definition pro.h:657
uint32 qst_nlink
number of hard links
Definition pro.h:648
uint32 qst_gid
group ID of owner
Definition pro.h:650
qtime64_t qst_atime
time of last access
Definition pro.h:655
uint32 qst_mode
protection
Definition pro.h:647
qtime64_t qst_mtime
time of last modification
Definition pro.h:656
int32 qst_blocks
number of 512B blocks allocated
Definition pro.h:654
qoff64_t qst_size
total size, in bytes
Definition pro.h:652
uint64 qst_rdev
device ID (if special file)
Definition pro.h:651
uint32 qst_ino
inode number
Definition pro.h:646
int32 qst_blksize
blocksize for file system I/O
Definition pro.h:653
uint32 qst_uid
user ID of owner
Definition pro.h:649
uint64 qst_dev
ID of device containing file.
Definition pro.h:645
Relocatable object.
Definition pro.h:4026
ea_t base
current base
Definition pro.h:4027
relobj_t(void)
Definition pro.h:4030
reloc_info_t ri
relocation info
Definition pro.h:4028
bool relocate(ea_t ea, bool mf)
mf=1:big endian
Definition pro.h:4031
Relocation information (relocatable objects - see relobj_t)
Definition pro.h:4008
size_t operator()(const _qstring< T > &str) const noexcept
Definition pro.h:3708