36#define IDA_SDK_VERSION 940
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__)
60#define BADMEMSIZE 0x7FFFFFFFFFFFFFFFull
62#define BADMEMSIZE 0x7FFFFFFFu
66#define ENUM_SIZE(t) : t
70#define _CRT_DECLARE_NONSTDC_NAMES 1
93# define WIN32_LEAN_AND_MEAN
101# include <sys/stat.h>
108# include <initializer_list>
111#include <sys/types.h>
116#define STL_SUPPORT_PRESENT
123#if defined(__cplusplus) || defined(SWIG)
124#define EXTERNC extern "C"
125#define C_INCLUDE EXTERNC \
128#define C_INCLUDE_END }
134#define INLINE __inline
142#define SMAXSTR QSTRINGIZE(MAXSTR)
146#define NT_CDECL __cdecl
163#define PACKED_ALIGNED(al)
164#define AS_STRFTIME(format_idx)
165#define AS_PRINTF(format_idx, varg_idx)
166#define AS_SCANF(format_idx, varg_idx)
167#define WARN_UNUSED_RESULT
168#elif defined(__GNUC__)
169#define DEPRECATED __attribute__((deprecated))
170#define NORETURN __attribute__((noreturn))
171#define PACKED __attribute__((__packed__))
172#define PACKED_ALIGNED(al) __attribute__((__packed__)) __attribute__((__aligned__(al)))
173#define AS_STRFTIME(format_idx) __attribute__((format(strftime, format_idx, 0)))
174#define AS_PRINTF(format_idx, varg_idx) __attribute__((format(printf, format_idx, varg_idx)))
175#define AS_SCANF(format_idx, varg_idx) __attribute__((format(scanf, format_idx, varg_idx)))
176#define WARN_UNUSED_RESULT __attribute__((__warn_unused_result__))
178#define DEPRECATED __declspec(deprecated)
179#define NORETURN __declspec(noreturn)
181#define PACKED_ALIGNED(al)
182#define AS_STRFTIME(format_idx)
183#define AS_PRINTF(format_idx, varg_idx)
184#define AS_SCANF(format_idx, varg_idx)
185#define WARN_UNUSED_RESULT _Check_return_
190#if defined(__GNUC__) && !defined(SWIG) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 402
191#define GCC_DIAG_JOINSTR(x,y) _QSTRINGIZE(x ## y)
192# define GCC_DIAG_DO_PRAGMA(x) _Pragma (#x)
193# define GCC_DIAG_PRAGMA(x) GCC_DIAG_DO_PRAGMA(GCC diagnostic x)
194# if (((__GNUC__ * 100) + __GNUC_MINOR__) >= 406) || defined(__clang__)
195# define GCC_DIAG_OFF(x) GCC_DIAG_PRAGMA(push) \
196 GCC_DIAG_PRAGMA(ignored GCC_DIAG_JOINSTR(-W,x))
197# define GCC_DIAG_ON(x) GCC_DIAG_PRAGMA(pop)
199# define GCC_DIAG_OFF(x) GCC_DIAG_PRAGMA(ignored GCC_DIAG_JOINSTR(-W,x))
200# define GCC_DIAG_ON(x) GCC_DIAG_PRAGMA(warning GCC_DIAG_JOINSTR(-W,x))
203# define GCC_DIAG_OFF(x)
204# define GCC_DIAG_ON(x)
207#if defined(_MSC_VER) && !defined(SWIG)
208# define MSC_DIAG_OFF(x) __pragma(warning(push)) \
209 __pragma(warning(disable : x))
210# define MSC_DIAG_ON(x) __pragma(warning(pop))
212# define MSC_DIAG_OFF(x)
213# define MSC_DIAG_ON(x)
217#if defined(__clang__) || defined (__GNUC__)
218# define DISABLE_ASAN __attribute__((no_sanitize_address))
223#if defined(DONT_DEPRECATE)
236#define qnotused(x) (void)x
239# define NONNULL _Nonnull
245#if defined(__clang__) || defined(__GNUC__)
246# define QUNUSED __attribute__((unused))
253#define va_argi(va, type) ((type)va_arg(va, int))
255#define va_argi(va, type) va_arg(va, type)
259#define CONST_CAST(x) const_cast<x>
260#define _QSTRINGIZE(x) #x
261#define QSTRINGIZE(x) _QSTRINGIZE(x)
275 #define ida_export_data
276 #define ida_module_data
282 #define ida_export ida_export
283 #define ida_export_data ida_export_data
284 #define ida_module_data
288 #define idaapi __stdcall
289 #define ida_export idaapi
290 #ifdef __CODE_CHECKER__
292 #define idaman EXTERNC __declspec(dllexport)
294 #define idaman EXTERNC
296 #if defined(__KERNEL__)
297 #define ida_export_data
298 #define ida_module_data
300 #define ida_export_data __declspec(dllimport)
301 #define ida_module_data __declspec(dllexport)
304#elif defined(__UNIX__)
307 #define idaman EXTERNC __attribute__((visibility("default")))
308 #define ida_local __attribute__((visibility("hidden")))
311 #define idaman EXTERNC __attribute__ ((visibility("default")))
312 #define ida_local __attribute__((visibility("hidden")))
314 #define idaman EXTERNC
319 #define ida_export_data
320 #define ida_module_data
340#if !defined(__LINUX__) || defined(__cplusplus)
359INLINE
int64 qatoll(
const char *nptr) {
return nptr !=
nullptr ? atoll(nptr) :0; }
360#elif defined(_MSC_VER)
361INLINE
int64 qatoll(
const char *nptr) {
return nptr !=
nullptr ? _atoi64(nptr) :0; }
363INLINE
int64 qatoll(
const char *nptr) {
return nptr !=
nullptr ? atol(nptr) : 0; }
368#define strtoull _strtoui64
376#elif defined(__GNUC__)
384#if !defined(_SSIZE_T_DEFINED) && !defined(__ssize_t_defined) && !defined(__GNUC__)
392#if defined(__GNUC__) && !defined(__MINGW32__)
397#elif defined(_MSC_VER) && _MSC_VER >= 1900
402#elif defined(_MSC_VER) || defined(__MINGW32__)
406 #define FMT_ZX "I64X"
407 #define FMT_ZS "I64d"
414 #error "unknown compiler"
429 #define FMT_EA FMT_64
431 #define SVAL_MIN LLONG_MIN
432 #define SVAL_MAX LLONG_MAX
434 #define SVAL_MIN _I64_MIN
435 #define SVAL_MAX _I64_MAX
442 #define SVAL_MIN INT_MIN
443 #define SVAL_MAX INT_MAX
487#define DEFARG(decl, val) decl = val
489#define DEFARG(decl, val) decl
493#define BADADDR ea_t(-1)
494#define BADSEL sel_t(-1)
495#define BADADDR32 ea32_t(-1)
496#define BADADDR64 ea64_t(-1)
528 return ((
qtime64_t)(secs) << 32) | usecs;
559idaman THREAD_SAFE
bool ida_export
qlocaltime(
struct tm *_tm, time_t
t);
575idaman
bool ida_export
qgmtime(
struct tm *_tm, time_t
t);
588idaman time_t ida_export
qtimegm(
const struct tm *ptm);
611idaman
AS_STRFTIME(3) THREAD_SAFE
size_t ida_export qstrftime64(
620idaman THREAD_SAFE
void ida_export
qsleep(
int milliseconds);
641idaman THREAD_SAFE
bool ida_export
gen_rand_buf(
void *buffer,
size_t bufsz);
644#define qoff64_t int64
667# define for if(0); else for
669# pragma warning(disable : 4200)
670# if _MSC_VER >= 1921 && _MSC_VER < 1924
671# pragma function(memmove)
678#define fileno _fileno
679#define getcwd _getcwd
680#define memicmp _memicmp
695#define eFileTooLarge 4
711#define ZZZ msg("%s:%d\n", __FILE__, __LINE__)
713# define BPT __builtin_trap()
714#elif defined(_MSC_VER)
715# define BPT __debugbreak()
716# ifdef __CODE_CHECKER__
722#ifdef __CODE_CHECKER__
723#define CASSERT(cnd) static_assert((cnd), "")
725#define CASSERT(cnd) static_assert((cnd), QSTRINGIZE(cnd))
731#ifdef __CODE_CHECKER__
732#define INTERR(code) interr(code)
734#define INTERR(code) do { if ( under_debugger ) BPT; interr(code); } while(1)
737#define QASSERT(code, cond) do if ( !(cond) ) INTERR(code); while (0)
738#define QBUFCHECK(buf, size, src) ida_fill_buffer(buf, size, src, __FILE__, __LINE__)
742# define TB_QASSERT(Code, Expr) QASSERT(Code, Expr)
743# define TB_INTERR(Code) INTERR(Code)
744# define TB_CCHECK(expr) if ( !(expr) ) warning("Coherency check failed at %s:%d: " #expr, __FILE__, __LINE__)
745# define TB_INTERR_OR_RETURN(code, ...) INTERR(code)
747# define TB_QASSERT(Code, Expr)
748# define TB_INTERR(Code)
749# define TB_CCHECK(expr) if ( !(expr) ) msg("Coherency check failed: " #expr "\n")
750# define TB_INTERR_OR_RETURN(code, ...) return __VA_ARGS__
753#define INTERR_EXC_FMT "Internal error %d occurred when running a script. Either\n" \
754 " - the script misused the IDA API, or\n" \
755 " - there is a logic error in IDA\n" \
756 "Please check the script first.\n" \
757 "If it appears correct, send a bug report to <support@hex-rays.com>.\n" \
758 "In any case we strongly recommend you to restart IDA as soon as possible."
777idaman THREAD_SAFE
void *ida_export
qrealloc(
void *alloc,
size_t newsize);
778idaman THREAD_SAFE
void *ida_export
qcalloc(
size_t nitems,
size_t itemsize);
779idaman THREAD_SAFE
void ida_export
qfree(
void *alloc);
780idaman THREAD_SAFE
char *ida_export
qstrdup(
const char *
string);
781#define qnew(t) ((t*)qalloc(sizeof(t)))
783#define qnewarray(t,n) use_qalloc_array
805# define qnumber(arr) ( \
806 0 * sizeof(reinterpret_cast<const ::qnumber_check_type *>(arr)) \
807 + 0 * sizeof(::qnumber_check_type::check_type((arr), &(arr))) \
808 + sizeof(arr) / sizeof((arr)[0]) )
813 template <
typename T>
817#elif defined(_MSC_VER) && !defined(__CODE_CHECKER__)
818# define qnumber(array) _countof(array)
820# define qnumber(array) (sizeof(array)/sizeof(array[0]))
824#define qoffsetof offsetof
828#if defined(__GNUC__) && !defined(__X86__) && !(defined(__clang__) && defined(__ARM__))
830 #define set_vva(va2, vp) va_copy(va2, *(va_list*)va_arg(vp, void*))
833 #define va_copy(dst, src) dst = src
835 #if defined(__clang__)
836 #define set_vva(va2, vp) va2 = va_arg(vp, va_list)
838 #define set_vva(va2, vp) va_copy(va2, va_arg(vp, va_list))
842#if defined(__LINUX__) && defined(__ARM__)
843# define NULL_VA_LIST() va_list()
845# define NULL_VA_LIST() nullptr
856#if defined(__GNUC__) && !defined(_WIN32)
857idaman THREAD_SAFE
int ida_export
memicmp(
const void *x,
const void *y,
size_t size);
865#define strnicmp strncasecmp
866#define stricmp strcasecmp
867#elif defined(_MSC_VER)
868#define strnicmp _strnicmp
869#define stricmp _stricmp
879idaman THREAD_SAFE
char *ida_export
strrpl(
char *str,
int char1,
int char2);
883INLINE THREAD_SAFE
char *
tail(
char *str) {
return strchr(str,
'\0'); }
886inline THREAD_SAFE
const char *
tail(
const char *str) {
return strchr(str,
'\0'); }
894idaman THREAD_SAFE
char *ida_export
qstrncpy(
char *dst,
const char *src,
size_t dstsize);
900idaman THREAD_SAFE
char *ida_export
qstpncpy(
char *dst,
const char *src,
size_t dstsize);
906idaman THREAD_SAFE
char *ida_export
qstrncat(
char *dst,
const char *src,
size_t dstsize);
911idaman THREAD_SAFE
char *ida_export
qstrtok(
char *s,
const char *delim,
char **save_ptr);
916idaman THREAD_SAFE
char *ida_export
qstrlwr(
char *str);
921idaman THREAD_SAFE
char *ida_export
qstrupr(
char *str);
929idaman THREAD_SAFE
const char *ida_export
stristr(
const char *s1,
const char *s2);
934inline char *idaapi
stristr(
char *s1,
const char *s2) {
return CONST_CAST(
char *)(
stristr((
const char *)s1, s2)); }
941INLINE THREAD_SAFE
bool ida_local
qisascii(
char c) {
return (c & ~0x7f) == 0; }
954INLINE THREAD_SAFE
int ida_local
qtolower(
char c) {
return tolower((
uchar)(c)); }
956INLINE THREAD_SAFE
int ida_local
qtoupper(
char c) {
return toupper((
uchar)(c)); }
959#if !defined(USE_DANGEROUS_FUNCTIONS) && !defined(__CODE_CHECKER__)
961#define strcpy dont_use_strcpy
962#define stpcpy dont_use_stpcpy
963#define strncpy dont_use_strncpy
964#define strcat dont_use_strcat
965#define strncat dont_use_strncat
966#define gets dont_use_gets
967#define sprintf dont_use_sprintf
968#define snprintf dont_use_snprintf
969#define wsprintfA dont_use_wsprintf
972#define strcmpi dont_use_strcmpi
973#define strncmpi dont_use_strncmpi
974#define getenv dont_use_getenv
975#define setenv dont_use_setenv
976#define putenv dont_use_putenv
977#define strtok dont_use_strtok
980#define strlwr dont_use_strlwr
981#define strupr dont_use_strupr
982#define waitid dont_use_waitid
983#define waitpid dont_use_waitpid
1000idaman
AS_PRINTF(3, 4) THREAD_SAFE
int ida_export qsnprintf(
char *buffer,
size_t n, const
char *
format, ...);
1001idaman
AS_SCANF (2, 3) THREAD_SAFE
int ida_export qsscanf(const
char *input, const
char *
format, ...);
1002idaman
AS_PRINTF(3, 0) THREAD_SAFE
int ida_export qvsnprintf(
char *buffer,
size_t n, const
char *
format, va_list
va);
1003idaman
AS_SCANF (2, 0) THREAD_SAFE
int ida_export qvsscanf(const
char *input, const
char *
format, va_list
va);
1004idaman
AS_PRINTF(3, 4) THREAD_SAFE
int ida_export append_snprintf(
char *buf, const
char *
end, const
char *
format, ...);
1035#define QMAXPATH PATH_MAX
1036#define QMAXFILE PATH_MAX
1064idaman
int ida_export
qchdir(
const char *path);
1099idaman THREAD_SAFE
char *ida_export
qsplitfile(
char *file,
char **base,
char **ext);
1110idaman THREAD_SAFE
const char *ida_export
qbasename(
const char *path);
1120idaman THREAD_SAFE
char *ida_export
qmake_full_path(
char *dst,
size_t dstsize,
const char *src);
1138#if defined(__UNIX__)
1139#define DELIMITER ":"
1141#define DELIMITER ";"
1190 return ::qstrncpy(buf, file,
bufsize);
1224#define WPM_EXPLICIT_DOT 0x01
1235idaman
int ida_export
regex_match(
const char *str,
const char *pattern,
bool sense_case);
1241#if !defined(__NT__) && !defined(_MSC_VER)
1251#if !defined(S_ISREG) && defined(S_IFMT) && defined(S_IFREG)
1252 #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
1254#if !defined(S_ISDIR) && defined(S_IFMT) && defined(S_IFDIR)
1255 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
1264idaman THREAD_SAFE
int ida_export
qopen(
const char *file,
int mode);
1269idaman THREAD_SAFE
int ida_export
qopen_shared(
const char *file,
int mode,
int share_mode);
1274idaman THREAD_SAFE
int ida_export
qcreate(
const char *file,
int stat);
1276idaman THREAD_SAFE
int ida_export
qread(
int h,
void *buf,
size_t n);
1277idaman THREAD_SAFE
int ida_export
qwrite(
int h,
const void *buf,
size_t n);
1278idaman THREAD_SAFE qoff64_t ida_export
qtell(
int h);
1279idaman THREAD_SAFE qoff64_t ida_export
qseek(
int h,
int64 offset,
int whence);
1280idaman THREAD_SAFE
int ida_export
qclose(
int h);
1281idaman THREAD_SAFE
int ida_export
qdup(
int h);
1282idaman THREAD_SAFE
int ida_export
qfsync(
int h);
1311idaman THREAD_SAFE
int ida_export
qmkdir(
const char *file,
int mode);
1319idaman THREAD_SAFE
int ida_export
qrmdir(
const char *file);
1328idaman THREAD_SAFE
bool ida_export
qisdir(
const char *file);
1336idaman THREAD_SAFE
int ida_export
qtouchfile(
const char *file_name);
1341idaman THREAD_SAFE
void ida_export
qatexit(
void (idaapi *func)(
void));
1346idaman THREAD_SAFE
void ida_export
del_qatexit(
void (idaapi*func)(
void));
1357#define qmin(a,b) ((a) < (b)? (a): (b))
1358#define qmax(a,b) ((a) > (b)? (a): (b))
1360template <
class T> T
qabs(T x) {
return x < 0 ? -x : x; }
1362int qabs(
int x) {
return x < 0 ? -x : x; }
1369 return (bitmap[bit/8] & (1<<(bit&7))) != 0;
1374 uchar *p = bitmap + bit/8;
1375 *p = (
uchar)(*p | (1<<(bit&7)));
1380 uchar *p = bitmap + bit/8;
1381 *p = (
uchar)(*p & ~(1<<(bit&7)));
1387 for ( bit =
low; bit <
high; ++bit )
1394 for ( bit =
low; bit <
high; ++bit )
1400 memset(bitmap, 0xFF,
nbits/8);
1401 if ( (
nbits & 7) != 0 )
1404 *p |= ((1 << (
nbits&7))-1);
1410 memset(bitmap, 0,
nbits/8);
1411 if ( (
nbits & 7) != 0 )
1414 *p &= ~((1 << (
nbits&7))-1);
1437 return ((val - 1) & val) == 0;
1444 return r != 0 ? val + base - r : val;
1448 return val - val % base;
1464 return s1 != 0 && s2 != 0 && off2 <=
last(off1, s1) && off1 <=
last(off2, s2);
1469 return s1 != 0 && off2 >= off1 &&
last(off2, s2) <=
last(off1, s1);
1474 return s1 != 0 && off >= off1 && off <=
last(off1, s1);
1484template <
class T>
constexpr T
left_shift(
const T &value,
int shift)
1486 return shift >=
sizeof(T)*8 ? 0 : (value << shift);
1491 return shift >=
sizeof(T)*8 ? 0 : (value >> shift);
1496 return shift >=
sizeof(T)*8 ? (value >= 0 ? 0 : -1) : (value >> shift);
1502 const size_t nbits =
sizeof(T) * 8;
1514 const size_t nbits =
sizeof(T) * 8;
1530template<
class T,
class U>
void idaapi
setflag(T &where, U bit,
bool cnd)
1533 where = T(where | bit);
1535 where = T(where & ~T(bit));
1542 if ( elsize == 0 ||
count == 0 )
1544 return count <= ((T)(-1)) / elsize;
1551 return y >= 0 ? (U)y <= ((U)(-1)) - x : (U)(0-y) <= x;
1566 return b != 0 && !(a == minval && b == -1);
1571template <
typename T>
1576 if (
nbits >=
sizeof(T) * 8 )
1578 T signbit = T(1) << (
nbits - 1);
1579 T mask = (signbit << 1) - 1;
1580 if ( (v & signbit) != 0 )
1591# define OPERATOR_NEW(type, count) (is_mul_ok(size_t(count), sizeof(type)) \
1593 : (type *)qalloc_or_throw(BADMEMSIZE))
1595# define OPERATOR_NEW(type, count) new type[count]
1608#define MC2(c1, c2) ushort(((c2)<<8)|c1)
1609#define MC3(c1, c2, c3) uint32(((((c3)<<8)|(c2))<<8)|c1)
1610#define MC4(c1, c2, c3, c4) uint32(((((((c4)<<8)|(c3))<<8)|(c2))<<8)|c1)
1642#define read4bytes(h, res, mf) readbytes(h, res, 4, mf)
1643#define write2bytes(h, l, mf) writebytes(h, l, 2, mf)
1644#define write4bytes(h, l, mf) writebytes(h, l, 4, mf)
1654 {
return (x>>24) | (x<<24) | ((x>>8) & 0x0000FF00) | ((x<<8) & 0x00FF0000); }
1658 {
return ushort((x<<8) | (x>>8)); }
1662# define swap32(x) uint32((x>>24) | (x<<24) | ((x>>8) & 0x0000FF00) | ((x<<8) & 0x00FF0000))
1665# define swap16(x) ushort((x<<8) | (x>>8))
1671#define swapea swap64
1673#define swapea swap32
1681#define qhtonl(x) (x)
1682#define qntohl(x) (x)
1683#define qhtons(x) (x)
1684#define qntohs(x) (x)
1686#define qhtons(x) swap16(x)
1687#define qntohs(x) swap16(x)
1688#define qhtonl(x) swap32(x)
1689#define qntohl(x) swap32(x)
1721 static constexpr bool value = std::is_pod<T>::value;
1728template <
class T>
inline THREAD_SAFE
void qswap(T &a, T &b)
1732 "qswap() requires a movable or trivially-copyable type; use std::swap() for other types");
1733 char temp[
sizeof(T)];
1734 memcpy(temp, (
const void *) &a,
sizeof(T));
1735 memcpy((
void *) &a, (
const void *) &b,
sizeof(T));
1736 memcpy((
void *) &b, temp,
sizeof(T));
1765 const uchar *ptr = *pptr;
1823 const uchar *src = *pptr;
1824 const uchar *send = src + destsize;
1825 if ( send < src || send >
end )
1828 return memcpy(destbuf, src, destsize);
1845 const uchar *src = *pptr;
1847 if ( srcend < src || srcend >
end )
1850 if ( dst !=
nullptr )
1852 memcpy(dst, src,
size);
1868 const uchar *ret = *pptr;
1869 const uchar *rend = ret + objsize;
1870 if ( rend < ret || rend >
end )
1931 if ( buf ==
nullptr )
1933 size_t size = *pptr - (
const uchar *)buf;
1934 if (
size >= dstsize )
1936 memcpy(dst, buf,
size);
1974static constexpr int ea_packed_size =
sizeof(
ea_t) +
sizeof(
ea_t)/4;
1975static constexpr int dq_packed_size = 10;
1976static constexpr int dd_packed_size = 5;
1977static constexpr int dw_packed_size = 3;
1980inline THREAD_SAFE
int ds_packed_size(
const char *s) {
return s ?
int(strlen(s)+dd_packed_size) : 1; }
1985 return (first_byte & 0x80) == 0 ? 1
1986 : (first_byte & 0xC0) == 0xC0 ? 3
1993 return (first_byte & 0x80) == 0x00 ? 1
1994 : (first_byte & 0xC0) != 0xC0 ? 2
1995 : (first_byte & 0xE0) == 0xE0 ? 5
2012inline THREAD_SAFE
void *
extract_obj(T &v,
void *destbuf,
size_t destsize)
2014 if ( destsize == 0 )
2016 return v.read(destbuf, destsize) == destsize ? destbuf :
nullptr;
2022 uchar packed[dw_packed_size];
2024 int psize =
dw_size(packed[0]);
2026 const uchar *ptr = packed;
2033 uchar packed[dd_packed_size];
2035 int psize =
dd_size(packed[0]);
2037 const uchar *ptr = packed;
2063 if ( buf ==
nullptr )
2080 const uchar *ptr = *pptr;
2081 const uchar *str = ptr;
2085 while ( *ptr++ !=
'\0' );
2099#define APPCHAR(buf, end, chr) \
2102 char __chr = (chr); \
2103 QASSERT(518, (buf) < (end)); \
2105 if ( (buf) >= (end) ) \
2114#define APPZERO(buf, end) \
2117 QASSERT(519, (buf) < (end)); \
2122#define APPEND(buf, end, name) \
2125 QASSERT(520, (buf) < (end)); \
2126 const char *__ida_in = (name); \
2129 if ( (buf) == (end)-1 ) \
2134 if ( (*(buf) = *__ida_in++) == '\0' ) \
2158idaman THREAD_SAFE
void *ida_export
qvector_reserve(
void *vec,
void *old,
size_t cnt,
size_t elsize);
2160#if defined(__cplusplus)
2166 #define DEFINE_MEMORY_ALLOCATION_FUNCS()
2168 #define PLACEMENT_DELETE void operator delete(void *, void *) {}
2169 #define DEFINE_MEMORY_ALLOCATION_FUNCS() \
2170 void *operator new (size_t _s) { return qalloc_or_throw(_s); } \
2171 void *operator new[](size_t _s) { return qalloc_or_throw(_s); } \
2172 void *operator new(size_t , void *_v) { return _v; } \
2173 void operator delete (void *_blk) { qfree(_blk); } \
2174 void operator delete[](void *_blk) { qfree(_blk); } \
2179#define DECLARE_COMPARISON_OPERATORS(type) \
2180 bool operator==(const type &r) const { return compare(r) == 0; } \
2181 bool operator!=(const type &r) const { return compare(r) != 0; } \
2182 bool operator< (const type &r) const { return compare(r) < 0; } \
2183 bool operator> (const type &r) const { return compare(r) > 0; } \
2184 bool operator<=(const type &r) const { return compare(r) <= 0; } \
2185 bool operator>=(const type &r) const { return compare(r) >= 0; }
2189#define DECLARE_COMPARISONS(type) \
2190 DECLARE_COMPARISON_OPERATORS(type) \
2191 int compare(const type &r) const
2195#define DECLARE_TYPE_AS_MOVABLE(T) template <> struct ida_movable_type<T> { static constexpr bool value = true; }
2198template <
class T>
inline constexpr THREAD_SAFE
bool may_move_bytes(
void)
2211 if ( may_move_bytes<T>() )
2213 memmove((
void *) dst, (
const void *) src, cnt *
sizeof(T));
2220 new(dst) T(std::move(*src));
2234 if ( may_move_bytes<T>() )
2236 memmove((
void *) dst, (
const void *) src, cnt *
sizeof(T));
2247 new(dst) T(std::move(*src));
2269 size_t _newsize = x.n;
2274 copy_range(x, 0, _newsize);
2279 void copy_range(
const qvector<T> &x,
size_t from,
size_t _newsize)
2281 if constexpr ( std::is_trivially_copyable<T>::value )
2283 memcpy((
void *) (array + from), (
const void *) (x.array + from), (_newsize - from) *
sizeof(T));
2287 for (
size_t i = from; i < _newsize; i++ )
2288 new(array+i) T(x.array[i]);
2299 void _reallocate_array(
size_t new_alloc)
2301 if ( array ==
nullptr || new_alloc == 0 )
2303 if ( may_move_bytes<T>() )
2305 T *new_array = (T*)
qrealloc(array, new_alloc *
sizeof(T));
2306 if ( new_array !=
nullptr )
2314 T *new_array = (T*)
qalloc(new_alloc *
sizeof(T));
2315 if ( new_array !=
nullptr )
2325 void resize_less(
size_t _newsize)
2327 if ( !std::is_trivially_destructible<T>::value )
2330 for (
size_t i = _newsize; i < _size; i++ )
2334#ifdef TESTABLE_BUILD_DEBUG_CONTAINERS
2342 void resize_more_trivial(
size_t _newsize)
2345 if constexpr ( std::is_trivially_copyable<T>::value )
2347 memset((
void *) (array + n), 0, (_newsize - n) *
sizeof(T));
2351 for (
size_t i = n; i < _newsize; ++i )
2352 new (array + i) T();
2357 void resize_more(
size_t _newsize,
const T &x)
2360 for (
size_t i = n; i < _newsize; i++ )
2365 bool ref_within_range(
const T &x)
const
2367 const T *
const p = &x;
2368 return p >= array && p < array + alloc;
2381 array = x.array; x.array =
nullptr;
2383 alloc = x.alloc; x.alloc = 0;
2386 qvector(std::initializer_list<T> l) : array(nullptr), n(0), alloc(0)
2388 const size_t sz = l.size();
2395 if constexpr ( std::is_trivially_copyable<T>::value )
2397 memcpy((
void *) array, (
const void *) l.begin(), sz *
sizeof(T));
2401 static_assert(std::is_nothrow_copy_constructible<T>::value,
2402 "T must be nothrow-copy-constructible in order avoid potential memory leaks");
2403 const T *
const data = l.begin();
2404 for (
size_t idx = 0; idx < sz; ++idx )
2405 new (array + idx) T(data[idx]);
2414 if ( array !=
nullptr )
2424 TB_QASSERT(1907, !ref_within_range(x));
2427 new (array+n) T(std::move(val));
2434 bool aliasing = ref_within_range(x);
2435 TB_QASSERT(1977, !aliasing);
2444 T val(std::move(x));
2446 new (array+n) T(std::move(val));
2451 new (array+n) T(std::move(x));
2460 template <
typename... Args>
2466 new (array+n) T(std::forward<Args>(
args)...);
2487#ifdef TESTABLE_BUILD
2494 size_t size(
void)
const {
return n; }
2495 bool empty(
void)
const {
return n == 0; }
2498 const T &
at(
size_t _idx)
const {
return array[_idx]; }
2499 T &
at(
size_t _idx) {
return array[_idx]; }
2500 const T &
front(
void)
const {
return array[0]; }
2502 const T &
back(
void)
const {
return array[n-1]; }
2503 T &
back(
void) {
return array[n-1]; }
2512 if ( array !=
nullptr )
2530 array = m.array; m.array =
nullptr;
2532 alloc = m.alloc; m.alloc = 0;
2542#ifdef TESTABLE_BUILD
2543 QASSERT(1908, !ref_within_range(x));
2546 resize_less(_newsize);
2547 else if ( _newsize > n )
2549 if ( ref_within_range(x) )
2550 resize_more(_newsize, T(x));
2552 resize_more(_newsize, x);
2558 if ( std::is_trivially_constructible<T>::value
2559 && std::is_trivially_copyable<T>::value
2562 resize_more_trivial(_newsize);
2564 else if ( _newsize == n )
2568#if __cplusplus >= 201703
2569 else if constexpr ( std::is_default_constructible<T>::value )
2571 else if ( _newsize < n )
2572 resize_less(_newsize);
2574 QASSERT(3396,
false);
2583 CASSERT(std::is_trivially_constructible<T>::value);
2584 CASSERT(std::is_trivially_destructible<T>::value);
2592#ifdef TESTABLE_BUILD
2593 QASSERT(1909, !ref_within_range(x));
2597 new(array+n) T(std::move(val));
2609 if ( may_move_bytes<T>() )
2615 size_t old_alloc = alloc;
2617 size_t new_alloc = alloc;
2630 _reallocate_array(n);
2638 size_t alloc2 = alloc;
2672 for (
size_t i=0; i < n; i++ )
2673 if ( array[i] != r[i] )
2693#ifdef TESTABLE_BUILD
2694 QASSERT(1910, !ref_within_range(x));
2697 size_t idx = it - array;
2700 size_t rest =
end() - p;
2702 new(p) T(std::move(val));
2710#ifdef TESTABLE_BUILD
2711 QASSERT(1978, !ref_within_range(x));
2713 T val(std::forward<T>(x));
2714 size_t idx = it - array;
2717 size_t rest =
end() - p;
2719 new(p) T(std::move(val));
2731 size_t cnt = last - first;
2735 size_t idx = it - array;
2738 size_t rest =
end() - p;
2740 while ( first != last )
2755 size_t rest =
end() - it - 1;
2766 for ( T *p=first; p != last; ++p )
2768 size_t rest =
end() - last;
2877 pool_size = 4*1024*1024,
2878 pool_nelems = pool_size /
sizeof(T),
2883 CASSERT(
sizeof(T) >=
sizeof(
void *) && pool_nelems > 0);
2886 T *free_list =
nullptr;
2887 T *pool_ptr =
nullptr;
2888 T *pool_end =
nullptr;
2889 size_t live_objects = 0;
2892 void free_entire_pool()
2894 for ( T *p : pools )
2899 free_list =
nullptr;
2928 if ( free_list !=
nullptr )
2931 free_list = *(T**)ptr;
2935 if ( pool_ptr == pool_end )
2938 pool_end = pool_ptr + pool_nelems;
2939 pools.push_back(pool_ptr);
2953 *(T**)ptr = free_list;
2955 if ( --live_objects == 0 )
2981 if ( a.size() != b.size() )
2982 return a.size() > b.size() ? 1 : -1;
2983 for (
int i=0; i < a.size(); i++ )
3000 if ( ptr !=
nullptr && --ptr->refcnt == 0 )
3007 if ( ptr !=
nullptr )
3014 if ( ptr !=
nullptr )
3027 operator T *()
const
3064 virtual bool idaapi
next(
void) = 0;
3074inline THREAD_SAFE
size_t idaapi
qstrlen(
const char *s) {
return strlen(s); }
3075inline THREAD_SAFE
size_t idaapi
qstrlen(
const uchar *s) {
return strlen((
const char *)s); }
3087inline THREAD_SAFE
int idaapi
qstrcmp(
const char *s1,
const char *s2) {
return strcmp(s1, s2); }
3088inline THREAD_SAFE
int idaapi
qstrcmp(
const uchar *s1,
const uchar *s2) {
return strcmp((
const char *)s1, (
const char *)s2); }
3100inline THREAD_SAFE
int idaapi
qstrncmp(
const char *s1,
const char *s2,
size_t len) {
return strncmp(s1, s2,
len); }
3101inline THREAD_SAFE
int idaapi
qstrncmp(
const uchar *s1,
const uchar *s2,
size_t len) {
return strncmp((
const char *)s1, (
const char *)s2,
len); }
3109inline THREAD_SAFE
char *idaapi
qstrstr(
char *s1,
const char *s2) {
return strstr(s1, s2); }
3110inline THREAD_SAFE
const char *idaapi
qstrstr(
const char *s1,
const char *s2) {
return strstr(s1, s2); }
3118inline THREAD_SAFE
char *idaapi
qstrchr(
char *s1,
char c) {
return strchr(s1, c); }
3119inline THREAD_SAFE
const char *idaapi
qstrchr(
const char *s1,
char c) {
return strchr(s1, c); }
3131inline THREAD_SAFE
const char *idaapi
qstrrchr(
const char *s1,
char c) {
return strrchr(s1, c); }
3132inline THREAD_SAFE
char *idaapi
qstrrchr(
char *s1,
char c) {
return strrchr(s1, c); }
3142#define SSF_DROP_EMPTY 0x1
3146#define streq(s1, s2) (::qstrcmp((s1), (s2)) == 0)
3147#define strneq(s1, s2, count) (::qstrncmp((s1), (s2), (count)) == 0)
3148#define strieq(s1, s2) (stricmp((s1), (s2)) == 0)
3149#define strnieq(s1, s2, count) (strnicmp((s1), (s2), (count)) == 0)
3156template<
class q
char>
3160 void assign(
const qchar *ptr,
size_t len)
3163 memmove(body.begin(), ptr,
len*
sizeof(qchar));
3174 if ( ptr !=
nullptr )
3188 body.resize(
count+1, ch);
3199 size_t length(
void)
const {
size_t l = body.size();
return l ? l - 1 : 0; }
3200 size_t size(
void)
const {
return body.size(); }
3201 size_t capacity(
void)
const {
return body.capacity(); }
3209 size_t oldsize = body.size();
3210 if ( oldsize != 0 && s >= oldsize )
3211 body[oldsize-1] = c;
3212 body.resize(s+1, c);
3237 body.resize_noinit(
len);
3244 bool empty(
void)
const {
return body.size() <= 1; }
3248 static const qchar nullstr[] = { 0 };
3249 return body.empty() ? nullstr : &body[0];
3269 if (
this != &qstr )
3283 body = std::move(x.body);
3306 return ::qstrcmp(
c_str(), r.c_str());
3311 return ::qstrcmp(
c_str(), r) == 0;
3317 return ::qstrcmp(
c_str(), r) < 0;
3326 if ( ptr ==
nullptr )
3343 if ( ptr ==
nullptr )
3350 if ( l <
size_t(
len) )
3357 if ( !body.empty() || idx )
3359 static const qchar nullstr[] = { 0 };
3365 if ( !body.empty() || idx )
3367 static qchar nullstr[] = { 0 };
3370 const qchar &
at(
size_t idx)
const {
return body.at(idx); }
3371 qchar &
at(
size_t idx) {
return body.at(idx); }
3378 body.inject(s,
len);
3386 body.inject(s,
len);
3393 return len == 0 ?
'\0' : body[
len-1];
3403 const qchar *beg =
c_str();
3405 if ( ptr !=
nullptr )
3412 bool replace(
const qchar *what,
const qchar *with)
3416 const qchar *_start =
c_str();
3417 const qchar *last_pos = _start;
3421 if (
pos ==
nullptr )
3423 size_t n =
pos - last_pos;
3427 last_pos =
pos + len_what;
3430 if ( last_pos == _start )
3448 const qchar *beg =
c_str();
3450 if ( ptr !=
nullptr )
3463 const qchar *beg =
c_str();
3465 if ( ptr !=
nullptr )
3476 size_t endp = qmin(
length(),
n);
3487 if ( idx <
len && cnt != 0 )
3494 memmove(p2, p1, (
len-cnt)*
sizeof(qchar));
3497 body.resize_noinit(idx+1);
3508 body.resize_noinit(
len+2);
3513 memmove(p1+1, p1, (
len-idx)*
sizeof(qchar));
3526 body.resize_noinit(
len+addlen+1);
3527 body[
len+addlen] =
'\0';
3532 memmove(p2, p1, (
len-idx)*
sizeof(qchar));
3535 memmove(body.begin()+
len, str, addlen*
sizeof(qchar));
3541 if ( str !=
nullptr )
3544 insert(idx, str, addlen);
3553 body.resize_noinit(
len+
add+1);
3559 memmove(p2, p1, (
len-idx)*
sizeof(qchar));
3562 memcpy(body.begin()+
len, qstr.
begin(),
add*
sizeof(qchar));
3572 body.resize_noinit(
len+2);
3583 body.resize_noinit(
len+addlen+1);
3584 body[
len+addlen] =
'\0';
3585 memmove(body.begin()+
len, str, addlen*
sizeof(qchar));
3591 if ( str !=
nullptr )
3605 body.resize_noinit(
len+
add+1);
3607 memcpy(body.begin()+
len, qstr.
begin(),
add*
sizeof(qchar));
3620 body.resize_noinit(
len+
add+1);
3632 size_t add = ::qvsnprintf(
nullptr, 0,
format,
va);
3635 body.resize_noinit(
add+1);
3636 ::qvsnprintf(body.begin(),
add+1,
format, copy);
3678 size_t endp =
pos +
len + 1;
3679 if ( body.size() < endp )
3681 body.resize_noinit(endp);
3682 body[endp-1] =
'\0';
3684 memset(body.begin()+
pos, c,
len);
3702 while ( b <
e && *b == blank )
3704 if ( b > body.begin() )
3706 memmove(body.begin(), b,
sizeof(qchar)*(
e-b+1));
3715 if (
size() > minlen + 1 )
3717 iterator b = body.begin() + minlen;
3720 while (
e > b && *(
e-1) == blank )
3769 static constexpr size_t npos = (size_t) -1;
3789 const size_t FNV_BASIS = 0x811c9dc5;
3790 const size_t FNV_PRIME = 0x01000193;
3792 const size_t FNV_BASIS = 0xcbf29ce484222325;
3793 const size_t FNV_PRIME = 0x100000001b3;
3795 size_t sum = FNV_BASIS;
3811 const char *p =
begin();
3816 size_t rem = (psep !=
nullptr ? psep :
end) - p;
3817 if ( rem > 0 || (flags & SSF_DROP_EMPTY) == 0 )
3819 p = psep !=
nullptr ? psep + seplen :
end;
3830 size_t nparts = parts.
size();
3834 size_t total = (nparts - 1) * seplen;
3835 for (
const auto &one : parts )
3836 total += one.length();
3838 for (
const auto &one : parts )
3863 size_t cur_sz =
size();
3864 size_t new_sz = cur_sz + sz;
3865 if ( new_sz < cur_sz )
3866 new_sz = BADMEMSIZE;
3868 memcpy(
begin() + cur_sz, buf, sz);
3877 uchar packed[dw_packed_size];
3878 size_t len =
::pack_dw(packed, packed+
sizeof(packed), x) - packed;
3884 uchar packed[dd_packed_size];
3885 size_t len =
::pack_dd(packed, packed+
sizeof(packed), x) - packed;
3891 uchar packed[dq_packed_size];
3892 size_t len =
::pack_dq(packed, packed+
sizeof(packed), x) - packed;
3898 uchar packed[ea_packed_size];
3899 size_t len =
::pack_ea(packed, packed+
sizeof(packed), x) - packed;
3910 if ( ea == BADADDR )
3911 ea = 0xFFFFFFFFFFFFFFFFULL;
3920 size_t len = strlen(x);
3922 QASSERT(4,
len <= 0xFFFFFFFF);
3930 if ( str ==
nullptr )
3932 size_t len = strlen(str) + 1;
3948 QASSERT(5,
len <= 0xFFFFFFFF);
3974 for (
int i=0; i < nelems; i++ )
3989 size_t cur_sz =
size();
3990 size_t new_sz = cur_sz + sz;
3991 if ( new_sz < cur_sz )
3992 new_sz = BADMEMSIZE;
4010 for (
uchar c: *
this )
4012 ::qsnprintf(p,
end - p, upper_case ?
"%02X" :
"%02x", c);
4021 tohex(&buf, upper_case);
4030 const char *p = str.
begin();
4031 for (
uchar &c: *
this )
4034 if ( ::qsscanf(p,
"%02X", &b) != 1 || b > 0xFF )
4055 for (
size_t i = 0; i <
size(); ++i )
4066 for (
size_t i=0; i <
nbytes; i++ )
4076 for (
size_t i=0; i <
nbytes; i++, ++p )
4077 *p = (
uchar)(*p & ~b[i]);
4089#define RELOBJ_MASK 0xF
4094#define RELSIZE_CUST 15
4095#define RELOBJ_CNT 0x80
4111#define QLIST_DEFINED
4120 void fix_links(
size_t len)
4135 struct datanode_t :
public listnode_t
4154#define DEFINE_LIST_ITERATOR(iter, constness, cstr) \
4157 friend class qlist<T>; \
4158 constness listnode_t *cur; \
4159 iter(constness listnode_t *x) : cur(x) {} \
4161 typedef constness T value_type; \
4162 iter(void) : cur(nullptr) {} \
4163 iter(const iter &x) : cur(x.cur) {} \
4165 iter &operator=(const iter &x) { cur = x.cur; return *this; } \
4166 bool operator==(const iter &x) const { return cur == x.cur; } \
4167 bool operator!=(const iter &x) const { return cur != x.cur; } \
4168 constness T &operator*(void) const { return ((datanode_t*)cur)->data; } \
4169 constness T *operator->(void) const { return &(operator*()); } \
4170 iter &operator++(void) \
4175 iter operator++(int) \
4181 iter &operator--(void) \
4186 iter operator--(int) \
4197#define DEFINE_REVERSE_ITERATOR(riter, iter) \
4203 riter(const iter &x) : p(x) {} \
4204 typename iter::value_type &operator*(void) const { iter q=p; return *--q; } \
4205 typename iter::value_type *operator->(void) const { return &(operator*()); } \
4206 riter &operator++(void) { --p; return *this; } \
4207 riter operator++(int) { iter q=p; --p; return q; } \
4208 riter &operator--(void) { ++p; return *this; } \
4209 riter operator--(int) { iter q=p; ++p; return q; } \
4210 bool operator==(const riter &x) const { return p == x.p; } \
4211 bool operator!=(const riter &x) const { return p != x.p; } \
4215#undef DEFINE_LIST_ITERATOR
4216#undef DEFINE_REVERSE_ITERATOR
4223 insert(begin(), x.begin(), x.end());
4229 splice(begin(), x, x.begin(), x.end());
4236 DEFINE_MEMORY_ALLOCATION_FUNCS()
4243 iterator first1 = begin();
4244 iterator last1 =
end();
4247 while ( first1 != last1 && first2 != last2 )
4248 *first1++ = *first2++;
4249 if ( first2 == last2 )
4250 erase(first1, last1);
4252 insert(last1, first2, last2);
4262 splice(begin(), x, x.begin(), x.end());
4269 std::swap(node, x.node);
4270 std::swap(length, x.length);
4271 node.fix_links(length);
4272 x.node.fix_links(x.length);
4275 iterator begin(
void) {
return node.next; }
4276 iterator
end(
void) {
return &node; }
4277 bool empty(
void)
const {
return length == 0; }
4278 size_t size(
void)
const {
return length; }
4279 T &front(
void) {
return *begin(); }
4280 T &back(
void) {
return *(--
end()); }
4284 const T&front(
void)
const {
return *begin(); }
4285 const T&back(
void)
const {
return *(--
end()); }
4287 reverse_iterator rbegin() {
return reverse_iterator(
end()); }
4288 reverse_iterator rend() {
return reverse_iterator(begin()); }
4289 const_reverse_iterator rbegin()
const {
return const_reverse_iterator(
end()); }
4290 const_reverse_iterator rend()
const {
return const_reverse_iterator(begin()); }
4296 iterator insert(iterator p,
const T &x)
4299 new (&(tmp->data)) T(x);
4306 iterator insert(iterator p)
4309 new (&(tmp->data)) T();
4315 template <
class it2>
void insert(iterator p, it2 first, it2 last)
4317 while ( first != last )
4318 insert(p, *first++);
4321 void push_front(
const T &x) { insert(begin(), x); }
4323 void push_back(
const T &x) { insert(
end(), x); }
4327 iterator p = insert(
end());
4328 return ((datanode_t *)p.cur)->data;
4331 iterator erase(iterator p)
4333 listnode_t *q = p.cur->next;
4334 p.cur->prev->next = p.cur->next;
4335 p.cur->next->prev = p.cur->prev;
4336 ((datanode_t*)p.cur)->data.~T();
4342 void erase(iterator p1, iterator p2)
4348 void clear(
void) { erase(begin(),
end()); }
4350 void pop_front(
void) { erase(begin()); }
4352 void pop_back(
void) { iterator tmp =
end(); erase(--tmp); }
4354 void splice(iterator
pos,
qlist<T> &other, iterator first, iterator last)
4357 if ( first == last )
4360 listnode_t *first_node = first.cur;
4361 listnode_t *last_node =
last.cur->prev;
4364 size_t sublength = 1;
4367 if ( first == other.begin() && last == other.end() )
4369 sublength = other.length;
4373 listnode_t *curr_node = first_node;
4374 while ( curr_node != last_node )
4376 curr_node = curr_node->next;
4382 first_node->prev->next = last_node->next;
4383 last_node->next->prev = first_node->prev;
4384 other.length -= sublength;
4387 listnode_t *pos_node =
pos.cur;
4388 listnode_t *before_pos = pos_node->prev;
4389 before_pos->next = first_node;
4390 first_node->prev = before_pos;
4391 last_node->next = pos_node;
4392 pos_node->prev = last_node;
4393 length += sublength;
4398 if ( length != x.length )
4409 void linkin(iterator p, listnode_t *tmp)
4412 tmp->prev = p.cur->prev;
4413 p.cur->prev->next = tmp;
4444 for (
int i=0; i <
n; i++ )
4459 const size_t old_size = out->
size();
4467 if ( str ==
nullptr )
4469 out->
append(str, ((
char*)*pptr-str) - 1);
4498 return ::unpack_ds(&
ptr,
end, empty_null);
4507 return ::unpack_obj_inplace(&
ptr,
end, objsize);
4511 return ::unpack_buf_inplace(&
ptr,
end);
4515 return ::unpack_obj(obj, objsize, &
ptr,
end);
4519 return ::unpack_buf(&
ptr,
end);
4527 return ::unpack_bytevec(out, &
ptr,
end);
4529 #define SCALAR_TYPE(n) class T, typename std::enable_if<std::is_scalar<T>::value && sizeof(T) == n, int>::type = 0
4542 for (
size_t i = 0; i < cnt; i++ )
4549#define DECLARE_MEMORY_DESERIALIZER(name) \
4550 name(const void *p, size_t s) : memory_deserializer_t(p, s) {} \
4551 using memory_deserializer_t::unpack; \
4555 #define SCALAR_TYPE(n) class T, typename std::enable_if<std::is_scalar<T>::value && sizeof(T) == n, int>::type = 0
4566 for (
const auto &item: value )
4570#define DECLARE_MEMORY_SERIALIZER(name) \
4571 using memory_serializer_t::pack; \
4577template <
typename T>
4588template <
typename T>
4594template <
typename T>
4599template <
typename,
typename =
void>
4603template <
typename T>
4605 : std::true_type {};
4606template <class T, typename std::enable_if<has_compare_method<T>::value,
int>
::type = 0>
4609 return a.compare(b);
4611template <class T, typename std::enable_if<!has_compare_method<T>::value,
int>
::type = 0>
4612int compare(
const T &a,
const T &b)
4636template <
class T,
class U>
4637int compare(
const std::pair<T, U> &a,
const std::pair<T, U> &b)
4642 return compare(a.second, b.second);
4650 auto p = std::begin(l);
4651 auto pe = std::end(l);
4652 auto q = std::begin(r);
4653 auto qe = std::end(r);
4654 for ( ; p != pe && q != qe; ++p,++q )
4660 if ( p == pe && q != qe )
4662 if ( p != pe && q == qe )
4667#define COMPARE_POINTERS2(ptr, cmp) \
4670 if ( ptr != nullptr && r.ptr != nullptr ) \
4672 int _code = cmp(*ptr, *r.ptr); \
4676 else if ( r.ptr != nullptr ) \
4680 else if ( ptr != nullptr ) \
4686#define COMPARE_POINTERS(ptr) COMPARE_POINTERS2(ptr, ::compare)
4688#define COMPARE_FIELDS(fld) \
4691 int _code = ::compare(fld, r.fld); \
4697#define COMPARE_FIELDS_REV(fld) \
4700 int _code = ::compare(r.fld, fld); \
4705template <
class T,
class U>
4706int compare(
const std::map<T, U> &a,
const std::map<T, U> &b)
4712int compare(
const std::set<T> &a,
const std::set<T> &b)
4723 int mask = elsize - 1;
4733 int mask = elsize - 1;
4742#define DECLARE_UNCOPYABLE(T) \
4743 T(const T &) = delete; \
4744 T &operator=(const T &) = delete; \
4746 T &operator=(T &&) = delete;
4752#define IS_QSTRING(v) (std::is_base_of<qstring, std::remove_reference<decltype(v)>::type>::value)
4753#define IS_SIZEVEC_T(v) (std::is_base_of<sizevec_t, std::remove_reference<decltype(v)>::type>::value)
4754#define IS_QSTRVEC_T(v) (std::is_base_of<qstrvec_t, std::remove_reference<decltype(v)>::type>::value)
4763typedef struct qstring_tag
qstring;
4764typedef struct qwstring_tag
qwstring;
4801idaman THREAD_SAFE
char *ida_export
str2user(
char *dst,
const char *src,
size_t dstsize);
4802idaman THREAD_SAFE
char *ida_export
user2str(
char *dst,
const char *src,
size_t dstsize);
4803idaman THREAD_SAFE
char ida_export
back_char(
const char **p);
4866 return (0x10000 + (
wchar32_t(lead_surrogate & 0x3FF) << 10)) | (tail_surrogate & 0x3FF);
4873#define IDBDEC_ESCAPE 0x00000001
4879idaman THREAD_SAFE
bool ida_export
idb_utf8(
qstring *out,
const char *in,
int nsyms=-1,
int flags=0);
4897#define CP_UTF8 65001
4912 return (
wchar16_t(b0 & 0x1f) << 6) | (b1 & 0x3f);
4935#define BADCP wchar32_t(-1)
4963idaman THREAD_SAFE
size_t ida_export
skip_utf8(
const char **putf8,
size_t n);
4983idaman THREAD_SAFE
size_t ida_export
qustrlen(
const char *utf8);
4991idaman THREAD_SAFE
bool ida_export
qustrncpy(
char *dst,
const char *utf8,
size_t dstsize);
4996#define CP_BOM 0xFEFF
4997#define UTF8_BOM "\xEF\xBB\xBF"
4998#define UTF8_BOM_SZ (sizeof(UTF8_BOM) - 1)
5000#define UTF16LE_BOM "\xFF\xFE"
5001#define UTF16BE_BOM "\xFE\xFF"
5002#define UTF16_BOM_SZ (sizeof(UTF16LE_BOM) - 1)
5004#define UTF32LE_BOM "\xFF\xFE\x00\x00"
5005#define UTF32BE_BOM "\x00\x00\xFE\xFF"
5006#define UTF32_BOM_SZ (sizeof(UTF32LE_BOM) - 1)
5008#define CP_ELLIPSIS 0x2026
5009#define UTF8_ELLIPSIS "\xE2\x80\xA6"
5010#define UTF8_ELLIPSIS_SZ (sizeof(UTF8_ELLIPSIS) - 1)
5012#define CP_REPLCHAR 0xFFFD
5013#define UTF8_REPLCHAR "\xEF\xBF\xBD"
5014#define UTF8_REPLCHAR_SZ (sizeof(UTF8_REPLCHAR) - 1)
5028#define MAX_UTF8_SEQ_LEN (6 + 1 + 1)
5039#define CEF_RETERR 0x1
5055 const char *fromcode,
5057 const uchar *indata,
5059 DEFARG(
int flags,0));
5064 const char *fromcode,
5067 DEFARG(
int flags,0))
5074#define ENC_WIN1252 "windows-1252"
5075#define ENC_UTF8 "UTF-8"
5076#define ENC_MUTF8 "MUTF-8"
5077#define ENC_UTF16 "UTF-16"
5078#define ENC_UTF16LE "UTF-16LE"
5079#define ENC_UTF16BE "UTF-16BE"
5080#define ENC_UTF32 "UTF-32"
5081#define ENC_UTF32LE "UTF-32LE"
5082#define ENC_UTF32BE "UTF-32BE"
5087#define CP_UTF8 65001
5091#define CP_UTF16 1200
5095# ifndef INVALID_FILE_ATTRIBUTES
5096# define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
5098# ifndef BELOW_NORMAL_PRIORITY_CLASS
5099# define BELOW_NORMAL_PRIORITY_CLASS 0x00004000
5103#define SUBSTCHAR '_'
5110#define DEFCOLOR bgcolor_t(-1)
5127#define IOREDIR_INPUT 0x01
5128#define IOREDIR_OUTPUT 0x02
5129#define IOREDIR_APPEND 0x04
5130#define IOREDIR_QUOTED 0x08
5157 const char *cmdline,
5180 if ( argv !=
nullptr )
5182 for ( i = 0; i < argc; i++ )
5214# define DEFINE_CLIOPTS_T_HELPERS(decl) \
5215 decl void ida_export cliopts_t_add(cliopts_t &, const cliopt_t *, size_t); \
5216 decl int ida_export cliopts_t_apply(cliopts_t &, int, const char *[], void *); \
5217 decl const cliopt_t *ida_export cliopts_t_find_short(const cliopts_t &, char); \
5218 decl const cliopt_t *ida_export cliopts_t_find_long(const cliopts_t &, const char *); \
5219 decl NORETURN void ida_export cliopts_t_usage(const cliopts_t &, bool);
5221# define DEFINE_CLIOPTS_T_HELPERS(decl)
5223DEFINE_CLIOPTS_T_HELPERS(idaman)
5225struct cliopts_t :
public qvector<cliopt_t>
5230 usage_printer_t *printer;
5233 cliopts_t(usage_printer_t *_printer,
bool _print_usage = true)
5235 , print_usage(_print_usage)
5238 void add(
const cliopt_t *opts,
size_t nopts) { cliopts_t_add(*
this, opts, nopts); }
5239 int apply(
int argc,
const char *argv[],
void *ud=
nullptr) {
return cliopts_t_apply(*
this, argc, argv, ud); }
5240 const cliopt_t *find_short(
char shortname)
const {
return cliopts_t_find_short(*
this, shortname); }
5241 const cliopt_t *find_long(
const char *longname)
const {
return cliopts_t_find_long(*
this, longname); }
5242 void usage(
bool is_error=
true)
const {
return cliopts_t_usage(*
this, is_error); }
5245 DEFINE_CLIOPTS_T_HELPERS(
friend);
5248struct plugin_option_t;
5250# define DEFINE_PLUGIN_OPTION_T_HELPERS(decl) \
5251 decl bool ida_export plugin_option_t_get_bool(const plugin_option_t *, bool *, const char *, bool);
5253# define DEFINE_PLUGIN_OPTION_T_HELPERS(decl)
5260struct plugin_option_t
5264 const char *get_value(
const char *default_value)
const
5266 return value.
empty() ? default_value : value.
c_str();
5268 bool get_string(
qstring *out,
const char *desired_name,
const char *default_value)
const
5270 if ( name != desired_name )
5272 if ( out !=
nullptr )
5273 *out = get_value(default_value);
5276 bool get_bool(
bool *out,
const char *desired_name,
bool default_value)
const
5278 return plugin_option_t_get_bool(
this, out, desired_name, default_value);
5291 for (
const auto &one : *
this )
5292 if ( one.name == name )
5299 for (
size_t i = 0; i <
size(); ++i )
5301 if (
at(i).name == name )
5363 size_t cb =
sizeof(*this);
5368#define LP_NEW_CONSOLE 0x0001
5369#define LP_TRACE 0x0002
5370#define LP_PATH_WITH_ARGS 0x0004
5371#define LP_USE_SHELL 0x0008
5373#define LP_LAUNCH_32_BIT 0x0010
5374#define LP_LAUNCH_64_BIT 0x0020
5376#define LP_NO_ASLR 0x0040
5377#define LP_DETACH_TTY 0x0080
5378#define LP_HIDE_WINDOW 0x0100
5379#define LP_SUSPENDED 0x0200
5380#define LP_DETACHED 0x0400
5381#define LP_REPLACE_ENV 0x0800
5422idaman THREAD_SAFE
int ida_export
qwait_timed(
int *status,
int child,
int flags,
int timeout_ms);
5424#if defined(__UNIX__)
5426# define QWCONTINUED WCONTINUED
5428# define QWCONTINUED 8
5431# define QWNOHANG WNOHANG
5435inline THREAD_SAFE
int qwait(
int *status,
int child,
int flags)
5437 return qwait_timed(status, child, flags, (flags & QWNOHANG) != 0 ? 0 : -1);
5457 DEFARG(
int msecs,-1));
5496#define OPAQUE_HANDLE(n) typedef struct __ ## n {} *n
5498#define OPAQUE_HANDLE(n) typedef struct __ ## n { char __dummy; } *n
5546idaman THREAD_SAFE
bool ida_export
qsetenv(
const char *varname,
const char *value);
5547idaman THREAD_SAFE
bool ida_export
qgetenv(
const char *varname, DEFARG(
qstring *buf,
nullptr));
5556idaman THREAD_SAFE qsemaphore_t ida_export
qsem_create(
const char *name,
int init_count);
5557idaman THREAD_SAFE
bool ida_export
qsem_free(qsemaphore_t sem);
5558idaman THREAD_SAFE
bool ida_export
qsem_post(qsemaphore_t sem);
5559idaman 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:3158
void inject(qchar *s, size_t len)
Assign this qstring to an existing char *.
Definition pro.h:3376
_qstring & insert(size_t idx, const qchar *str, size_t addlen)
Insert a string into the qstring.
Definition pro.h:3523
_qstring & insert(size_t idx, const _qstring &qstr)
Same as insert(size_t, const qchar *), but takes a qstring parameter.
Definition pro.h:3549
void swap(_qstring< qchar > &r)
Swap contents of two qstrings. see qvector::swap()
Definition pro.h:3198
_qstring & append(const qchar *str, size_t addlen)
Append a string to the qstring.
Definition pro.h:3580
_qstring & operator+=(const _qstring &r)
Append another qstring using '+='.
Definition pro.h:3293
const qchar * const_iterator
Definition pro.h:3252
bool empty(void) const
Does the qstring have 0 non-null elements?
Definition pro.h:3244
_qstring & operator=(const qchar *str)
Allow assignment of qstrings using '='.
Definition pro.h:3258
_qstring(const qchar *ptr)
Constructor - creates a new qstring from an existing char *.
Definition pro.h:3172
_qstring operator+(const _qstring &r) const
Get result of appending two qstrings using '+'.
Definition pro.h:3298
_qstring & insert(const qchar *str)
Prepend the qstring with 'str'.
Definition pro.h:3566
_qstring & fill(qchar c, size_t len)
Clear contents of qstring and fill with 'c'.
Definition pro.h:3688
_qstring(const qchar *ptr, size_t len)
Constructor - creates a new qstring using first 'len' chars from 'ptr'.
Definition pro.h:3178
size_t rfind(qchar c, size_t pos=0) const
Search backwards for a character in the qstring.
Definition pro.h:3459
size_t find(qchar c, size_t pos=0) const
Find a character in the qstring.
Definition pro.h:3444
const_iterator begin(void) const
Get a const pointer to the beginning of the qstring.
Definition pro.h:3254
_qstring & insert(const _qstring &qstr)
Prepend the qstring with 'qstr'.
Definition pro.h:3567
_qstring & nowarn_sprnt(const char *format,...)
Definition pro.h:3662
_qstring & operator=(_qstring &&x) noexcept
Move assignment operator.
Definition pro.h:3281
void resize(size_t s, qchar c)
Resize to the given size.
Definition pro.h:3207
qchar * extract(void)
Extract C string from _qstring. Must qfree() it.
Definition pro.h:3373
const_iterator end(void) const
Get a const pointer to the end of the qstring (this is not the terminating zero)
Definition pro.h:3256
bool starts_with(const _qstring &str) const
Does the string start with the specified prefix?
Definition pro.h:3320
_qstring(_qstring &&x)
Move constructor.
Definition pro.h:3194
bool ends_with(const _qstring &str) const
Does the string end with the specified suffix?
Definition pro.h:3337
size_t size(void) const
Get number of chars in this qstring (including terminating zero)
Definition pro.h:3200
void qclear(void)
Clear qstring but do not free memory yet.
Definition pro.h:3243
iterator begin(void)
Get a pointer to the beginning of the qstring.
Definition pro.h:3253
_qstring & rtrim()
Remove all whitespace from the end of the qstring.
Definition pro.h:3727
GCC_DIAG_ON(format-nonliteral)
static constexpr size_t npos
Definition pro.h:3769
void push_back(qchar c)
Definition pro.h:3749
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:3676
qchar & at(size_t idx)
Retrieve char at index 'idx'.
Definition pro.h:3371
size_t capacity(void) const
Get number of chars this qstring can contain (including terminating zero)
Definition pro.h:3201
void remove_last(int cnt=1)
Definition pro.h:3228
_qstring< qchar > substr(size_t pos=0, size_t n=npos) const
Get a substring.
Definition pro.h:3474
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:3439
_qstring & operator=(const _qstring &qstr)
Definition pro.h:3267
const qchar & operator[](size_t idx) const
Retrieve char at index 'idx' using '[]'.
Definition pro.h:3355
size_t length(void) const
Get number of chars in this qstring (not including terminating zero)
Definition pro.h:3199
_qstring & insert(qchar c)
Prepend the qstring with 'c'.
Definition pro.h:3565
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:3363
_qstring(void)
Constructor.
Definition pro.h:3170
va_list va
Definition pro.h:3613
qchar * iterator
Definition pro.h:3251
size_t find(const qchar *str, size_t pos=0) const
Find a substring.
Definition pro.h:3399
_qstring & remove(size_t idx, size_t cnt)
Remove characters from the qstring.
Definition pro.h:3484
bool operator<(const qchar *r) const
Compare two qstrings using '<'. see qstrcmp()
Definition pro.h:3315
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:3255
_qstring & ltrim(qchar blank=' ')
Remove all instances of the specified char from the beginning of the qstring.
Definition pro.h:3696
_qstring & append(qchar c)
Append c to the end of the qstring.
Definition pro.h:3569
void reserve(size_t cnt)
Increase capacity the qstring. see qvector::reserve()
Definition pro.h:3241
void inject(qchar *s)
Same as to inject(qchar *, size_t), with len = strlen(s)
Definition pro.h:3381
_qstring & insert(size_t idx, qchar c)
Insert a character into the qstring.
Definition pro.h:3505
qchar value_type
Definition pro.h:3167
_qstring(const _qstring &r)
Copy constructor (if not declared, move constructor causes it to be deleted)
Definition pro.h:3196
_qstring & append(const qchar *str)
Same as append(const qchar *, size_t), but all chars in 'str' are appended.
Definition pro.h:3589
qchar last(void) const
Get the last qchar in the string (for concatenation checks)
Definition pro.h:3390
size_t add
Definition pro.h:3616
_qstring & trim2(qchar blank=' ')
Remove all instances of the specified char from both ends of the qstring.
Definition pro.h:3740
bool replace(const qchar *what, const qchar *with)
Replace all occurrences of 'what' with 'with'.
Definition pro.h:3412
void resize(size_t s)
Similar to resize(size_t, qchar) - but any extra space is filled with zeros.
Definition pro.h:3216
bool operator!=(const qchar *r) const
Test equality of a qstring and a const char* with '!='.
Definition pro.h:3313
_qstring(size_t count, qchar ch)
Constructor - constructs the string with 'count' copies of character 'ch'.
Definition pro.h:3184
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:3370
_qstring & append(const _qstring &qstr)
Same as append(const qchar *), but takes a qstring argument.
Definition pro.h:3599
bool starts_with(const qchar *ptr, ssize_t len=-1) const
Definition pro.h:3324
const qchar * c_str(void) const
Convert the qstring to a char *.
Definition pro.h:3246
bool operator==(const qchar *r) const
Test equality of a qstring and a const char* using '=='.
Definition pro.h:3309
_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:3539
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:3713
DECLARE_COMPARISONS(_qstring)
Definition pro.h:3304
void clear(void)
Clear qstring and free memory.
Definition pro.h:3242
bool ends_with(const qchar *ptr, ssize_t len=-1) const
Definition pro.h:3341
_qstring & operator+=(qchar c)
Append a char using '+='.
Definition pro.h:3288
Vector of bytes (use for dynamic memory)
Definition pro.h:3850
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:4072
void pack_bytevec(const bytevec_t &b)
Pack an object of size 'len' and append the result to the bytevec.
Definition pro.h:3954
bool fromhex(const qstring &str)
Initialize from a hexadecimal string It returns 'false' if the string is invalid.
Definition pro.h:4027
void tohex(qstring *out, bool upper_case=true) const
Append the hexadecimal representation of bytes to the string.
Definition pro.h:4004
void pack_eavec(ea_t ea, const eavec_t &vec)
Pack an eavec and append the result to the bytevec.
Definition pro.h:3969
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:3945
bool test_bit(size_t bit) const
Is the specified bit set in the bytevec?
Definition pro.h:4043
bytevec_t()
Constructor.
Definition pro.h:3853
void pack_str(const qstring &s)
Pack a string (zero-terminated) and append the result to the bytevec.
Definition pro.h:3936
bool all_zeros() const
Are all bits cleared?
Definition pro.h:4053
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:4061
void clear_bits(size_t low, size_t high)
Clear each bit between [low, high)
Definition pro.h:4080
bytevec_t & growfill(size_t sz, uchar filler=0)
Grow the bytevec and fill with a value.
Definition pro.h:3985
void pack_ea(ea_t x)
Pack an ea value and append the result to the bytevec.
Definition pro.h:3896
void inject(void *buf, size_t len)
See qvector::inject(T *, size_t)
Definition pro.h:3998
void pack_db(uint8 x)
Pack a byte and append the result to the bytevec.
Definition pro.h:3873
void set_bit(size_t bit)
Set the specified bit.
Definition pro.h:4045
void clear_bit(size_t bit)
Clear the specified bit.
Definition pro.h:4047
void set_all_bits(size_t nbits)
See set_all_bits(uchar *, size_t)
Definition pro.h:4049
void pack_dd(uint32 x)
Pack a dword and append the result to the bytevec.
Definition pro.h:3882
void set_bits(size_t low, size_t high)
Set each bit between [low, high)
Definition pro.h:4070
qstring tohex(bool upper_case=true) const
Produce a hexadecimal representation of bytes.
Definition pro.h:4018
void clear_all_bits(size_t nbits)
See clear_all_bits(uchar *, size_t)
Definition pro.h:4051
bytevec_t(const void *buf, size_t sz)
Constructor - fill bytevec with 'sz' bytes from 'buf'.
Definition pro.h:3855
void pack_dw(uint16 x)
Pack a word and append the result to the bytevec.
Definition pro.h:3875
bytevec_t & append(const void *buf, size_t sz)
Append bytes to the bytevec.
Definition pro.h:3859
void pack_ds(const char *x)
Pack a string (length+contents) and append the result to the bytevec.
Definition pro.h:3916
void pack_dq(uint64 x)
Pack a quadword and append the result to the bytevec.
Definition pro.h:3889
void pack_str(const char *str)
Pack a string (zero-terminated) and append the result to the bytevec.
Definition pro.h:3928
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:3907
pool_allocator_t(const pool_allocator_t &)
Definition pro.h:2915
T * allocate(size_t n)
Definition pro.h:2922
pool_allocator_t(const pool_allocator_t< U > &)
Definition pro.h:2914
pool_allocator_t & operator=(const pool_allocator_t &)
Definition pro.h:2916
bool operator==(const pool_allocator_t &r) const
Definition pro.h:2919
T value_type
Definition pro.h:2906
void deallocate(T *ptr, size_t n)
Definition pro.h:2945
pool_allocator_t & operator=(pool_allocator_t &&)=default
const T * const_pointer
Definition pro.h:2908
pool_allocator_t(pool_allocator_t &&)=default
T * pointer
Definition pro.h:2907
pool_allocator_t()
Definition pro.h:2913
const T & const_reference
Definition pro.h:2910
size_t size_type
Definition pro.h:2911
T & reference
Definition pro.h:2909
ptrdiff_t difference_type
Definition pro.h:2912
Interface class for iterator types.
Definition pro.h:3060
virtual T idaapi operator*(void)=0
source_item_ptr value_type
Definition pro.h:3062
virtual bool idaapi next(void)=0
virtual T get(void) new api
Definition pro.h:3066
virtual bool idaapi first(void)=0
Linked list Note: linked list is not movable!
Definition pro.h:4115
~qlist(void)
Destructor.
Definition pro.h:4232
const
Definition pro.h:4194
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
qlist(qlist &&x)
Constructor - moves the data from x
Definition pro.h:4226
const_iterator(const iterator &x)
Definition pro.h:4194
cinsn_t value_type
Definition pro.h:4151
const_iterator qlist(void)
Constructor.
Definition pro.h:4218
qlist(const qlist< T > &x)
Constructor - creates a qlist identical to 'x'.
Definition pro.h:4220
~qmutex_locker_t(void)
Definition pro.h:5578
qmutex_locker_t(qmutex_t _lock)
Definition pro.h:5577
virtual void idaapi release(void)=0
Call destructor.
int refcnt
counter
Definition pro.h:3046
qrefcnt_obj_t(void)
Constructor.
Definition pro.h:3048
void reset(void)
Definition pro.h:3022
qrefcnt_t & operator=(const qrefcnt_t &r)
Definition pro.h:3010
T & operator*() const
Definition pro.h:3035
qrefcnt_t(T *p)
Definition pro.h:3004
T * operator->() const
Definition pro.h:3031
~qrefcnt_t(void)
Definition pro.h:3018
qrefcnt_t(const qrefcnt_t &r)
Definition pro.h:3005
Reimplementation of stack class from STL.
Definition pro.h:2848
T pop(void)
Definition pro.h:2851
void push(const T &v)
Definition pro.h:2862
const T & top(void) const
Definition pro.h:2857
T & top(void)
Definition pro.h:2861
Reimplementation of vector class from STL.
Definition pro.h:2262
void reserve(size_t cnt)
Increase the capacity of the qvector.
Definition pro.h:2605
void clear(void)
Destroy all elements and free memory.
Definition pro.h:2510
DEFINE_MEMORY_ALLOCATION_FUNCS() void push_back(const T &x)
Append a new element to the end the qvector.
Definition pro.h:2420
void inject(T *s, size_t len)
Populate the qvector with dynamic memory.
Definition pro.h:2661
void resize_noinit(size_t _newsize)
Definition pro.h:2581
iterator erase(iterator first, iterator last)
Remove a subset of the qvector.
Definition pro.h:2764
const compiled_binpat_t * const_iterator
Definition pro.h:2681
bool del(const T &x)
Find an element and remove it.
Definition pro.h:2823
const T & operator[](size_t _idx) const
Allows use of typical c-style array indexing for qvectors.
Definition pro.h:2496
void emplace_back(Args &&... args)
Construct and append a new element to the end the qvector with a forwarding semantics.
Definition pro.h:2461
T & at(size_t _idx)
Get element at index '_idx'.
Definition pro.h:2499
~qvector(void)
Destructor.
Definition pro.h:2412
void swap(qvector< T > &r) noexcept
Replace all attributes of this qvector with that of 'r', and vice versa.
Definition pro.h:2634
void truncate(void)
Shrink the capacity down to the current number of elements.
Definition pro.h:2627
const_iterator find(const T &x) const
Find an element in the qvector.
Definition pro.h:2787
qvector(const qvector< T > &x)
Constructor - creates a new qvector identical to 'x'.
Definition pro.h:2376
bool empty(void) const
Does the qvector have 0 elements?
Definition pro.h:2495
iterator erase(iterator it)
Remove an element from the qvector.
Definition pro.h:2752
void qclear(void)
Destroy all elements but do not free memory.
Definition pro.h:2505
iterator end(void)
Get an iterator that points to the end of the qvector (NOT the last element)
Definition pro.h:2684
T & operator[](size_t _idx)
Allows use of typical c-style array indexing for qvectors.
Definition pro.h:2497
compiled_binpat_t value_type
Definition pro.h:2372
bool operator!=(const qvector< T > &r) const
Allow ability to test equality of two qvectors using '!='.
Definition pro.h:2678
iterator insert(iterator it, const T &x)
Insert an element into the qvector at a specified position.
Definition pro.h:2691
iterator insert(iterator it, T &&x)
Insert an element into the qvector with a move semantics.
Definition pro.h:2708
const_iterator begin(void) const
Get a const iterator that points to the first element in the qvector.
Definition pro.h:2685
void resize(size_t _newsize, const T &x)
Resize to the given size.
Definition pro.h:2540
const char * dstr(void) const
qvector< T > & operator=(const qvector< T > &x)
Allow assignment of one qvector to another using '='.
Definition pro.h:2519
const T & at(size_t _idx) const
Get element at index '_idx'.
Definition pro.h:2498
void add(T &&x)
Definition pro.h:2806
void add(const T &x)
Add an element to the end of the qvector.
Definition pro.h:2805
const T & back(void) const
Get the last element in the qvector.
Definition pro.h:2502
qvector(std::initializer_list< T > l)
Initializer list constructor.
Definition pro.h:2386
iterator find(const T &x)
Find an element in the qvector.
Definition pro.h:2777
qvector(void)
Constructor.
Definition pro.h:2374
T & back(void)
Get the last element in the qvector.
Definition pro.h:2503
T * extract(void)
Empty the qvector and return a pointer to it's contents.
Definition pro.h:2650
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:2590
const T & front(void) const
Get the first element in the qvector.
Definition pro.h:2500
bool operator==(const qvector< T > &r) const
Allow ability to test the equality of two qvectors using '=='.
Definition pro.h:2668
void pop_back(void)
Remove the last element in the qvector.
Definition pro.h:2482
iterator insert(iterator it, it2 first, it2 last)
Insert a several elements to the qvector at a specified position.
Definition pro.h:2729
T & push_back(void)
Append a new empty element to the end of the qvector.
Definition pro.h:2473
compiled_binpat_t * iterator
Definition pro.h:2680
iterator begin(void)
Get an iterator that points to the first element in the qvector.
Definition pro.h:2683
void push_back(compiled_binpat_t &&x)
Definition pro.h:2432
T & front(void)
Get the first element in the qvector.
Definition pro.h:2501
const_iterator end(void) const
Get a const iterator that points to the end of the qvector (NOT the last element)
Definition pro.h:2686
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:2602
void resize(size_t _newsize)
Same as resize(size_t, const T &), but extra space is filled with empty elements.
Definition pro.h:2556
size_t size(void) const
Get the number of elements in the qvector.
Definition pro.h:2494
ssize_t index(const T &x) const
Find index of the specified value or return -1.
Definition pro.h:2797
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:2813
qvector(qvector< T > &&x) noexcept
Move constructor.
Definition pro.h:2379
bool has(const T &x) const
Does the qvector contain x?
Definition pro.h:2809
qvector< T > & operator=(qvector< T > &&x) noexcept
Move assignment operator.
Definition pro.h:2526
CASSERT(sizeof(mapping_coords_t)==sizeof(int))
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:946
INLINE THREAD_SAFE bool ida_local qisupper(char c)
Definition pro.h:947
INLINE THREAD_SAFE bool ida_local qisdigit(char c)
Definition pro.h:949
INLINE THREAD_SAFE bool ida_local qisalnum(char c)
Definition pro.h:944
INLINE THREAD_SAFE bool ida_local qispunct(char c)
Definition pro.h:945
INLINE THREAD_SAFE bool ida_local qisalpha(char c)
Definition pro.h:943
INLINE THREAD_SAFE bool ida_local qisxdigit(char c)
Definition pro.h:950
INLINE THREAD_SAFE bool ida_local qisascii(char c)
Definition pro.h:941
INLINE THREAD_SAFE bool ida_local qisprint(char c)
Definition pro.h:948
INLINE THREAD_SAFE bool ida_local qisspace(char c)
Definition pro.h:942
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:1004
int code
Definition fpro.h:88
idaman size_t n
Definition pro.h:1000
THREAD_SAFE bool unpack_sleb128(T *res, const uchar **pptr, const uchar *end)
Definition pro.h:1964
THREAD_SAFE bool unpack_uleb128(T *res, const uchar **pptr, const uchar *end)
Definition pro.h:1957
GCC_DIAG_OFF(format-nonliteral)
cexpr_t * e
Definition hexrays.hpp:7705
const tinfo_t & type
Definition hexrays.hpp:7698
carglist_t * args
Definition hexrays.hpp:7720
idaman int64 size_t count
Definition kernwin.hpp:1399
int nbytes
Definition kernwin.hpp:3037
uval_t uval_t
Definition kernwin.hpp:1926
idaman int64 pos
Definition kernwin.hpp:1398
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:1389
asize_t size
Definition kernwin.hpp:6701
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:8332
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
ea_t ea64_t
Definition lumina.hpp:121
qvector< qstring > qstrvec_t
Definition lumina.hpp:831
Functions to work with intervals.
Definition pro.h:1455
THREAD_SAFE constexpr bool contains(uval_t off1, asize_t s1, uval_t off)
Does (off1,s1) contain off?
Definition pro.h:1472
THREAD_SAFE constexpr uval_t last(uval_t off, asize_t s)
max offset of the interval (assume s != 0)
Definition pro.h:1457
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:1467
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:1462
idaman size_t const char time_t t
Definition pro.h:606
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:564
THREAD_SAFE size_t idaapi qstrlen(const char *s)
Definition pro.h:3074
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:2012
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:2004
THREAD_SAFE bool idaapi has_file_ext(const char *file)
Does the given file name have an extension?
Definition pro.h:1168
unsigned short uint16
unsigned 16 bit value
Definition pro.h:350
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 (like 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:1013
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:333
unsigned int uint32
unsigned 32 bit value
Definition pro.h:352
THREAD_SAFE constexpr uint32 swap32(uint32 x)
Definition pro.h:1653
T qrotr(T value, size_t count)
Rotate right.
Definition pro.h:1512
idaman size_t ida_export round_up_power2(size_t x)
round up or down to a power of 2
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:2839
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:347
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:4863
constexpr bool is_utf8_head(char in)
Does this byte correspond to the head of a UTF-8 byte sequence?
Definition pro.h:4824
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:1562
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:1446
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:427
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:2060
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:788
constexpr T make_mask(int count)
Make a mask of 'count' bits.
Definition pro.h:1524
INLINE THREAD_SAFE int ida_local qtolower(char c)
Get lowercase equivalent of given char.
Definition pro.h:954
T align_up(T val, int elsize)
Align element up to nearest boundary.
Definition pro.h:4721
uint64 ea64_t
64-bit address, regardless of IDA bitness.
Definition pro.h:457
void shift_up(T *dst, T *src, size_t cnt)
Move data up in memory.
Definition pro.h:2232
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:1991
uint32 ea32_t
32-bit address, regardless of IDA bitness.
Definition pro.h:454
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:501
qvector< uval_t > uvalvec_t
vector of unsigned values
Definition pro.h:2836
uint32 wchar32_t
Definition pro.h:375
THREAD_SAFE uchar idaapi unpack_db(const uchar **pptr, const uchar *end)
Unpack a byte from a character string, pack_db()
Definition pro.h:1763
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:1817
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:1494
bool is_mul_ok(T count, T elsize)
Check that unsigned multiplication does not overflow.
Definition pro.h:1539
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:5109
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:1183
qvector< size_t > sizevec_t
vector of sizes
Definition pro.h:2841
uint8 op_dtype_t
Definition pro.h:464
adiff_t sval_t
signed value used by the processor.
Definition pro.h:450
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:349
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:1657
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:1360
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:4435
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:1782
int64 adiff_t
Definition pro.h:428
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:425
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:1863
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:1489
uint32 flags_t
32-bit flags for each address
Definition pro.h:5105
THREAD_SAFE uint32 extract_dd(T &v)
Definition pro.h:2031
int int32
signed 32 bit value
Definition pro.h:351
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:1500
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:503
wchar_t wchar16_t
Definition pro.h:374
idaman bool ida_export_data under_debugger
is IDA running under a debugger?
Definition pro.h:739
THREAD_SAFE bool unpack_bytevec(bytevec_t *out, const uchar **pptr, const uchar *end)
Definition pro.h:4451
std::unique_ptr< T, qfree_deleter_t< T > > qalloc_janitor_t
Definition pro.h:4595
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:341
tty_control_t
Teletype control.
Definition pro.h:5461
@ TCT_NOT_OWNER
Definition pro.h:5464
@ TCT_OWNER
Definition pro.h:5463
@ TCT_UNKNOWN
Definition pro.h:5462
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:526
const qhandle_t NULL_PIPE_HANDLE
Definition pro.h:5587
qvector< bool > boolvec_t
vector of bools
Definition pro.h:2840
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:2979
THREAD_SAFE void qswap(T &a, T &b)
Swap 2 objects of the same type using memory copies.
Definition pro.h:1728
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:3100
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:1983
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:1924
idaman size_t bufsize
Definition pro.h:604
INLINE THREAD_SAFE uint32 get_secs(qtime64_t t)
Get the 'seconds since the epoch' part of a qtime64_t.
Definition pro.h:508
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:795
uint64 sel_t
Definition pro.h:426
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:2078
qvector< channel_redir_t > channel_redirs_t
vector of channel_redir_t objects
Definition pro.h:5139
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:3118
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:3772
idaman THREAD_SAFE int ida_export readbytes(int h, uint32 *res, int size, bool mf)
Read up to 4 bytes (1, 2, or 4) from file.
idaman THREAD_SAFE int ida_export qread(int h, void *buf, size_t n)
Works the same as its counterpart from C library.
void shift_down(T *dst, T *src, size_t cnt)
Move data down in memory.
Definition pro.h:2209
qvector< plugin_option_t > plugin_option_vec_t
Definition pro.h:5285
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:1372
idaman size_t ida_export round_down_power2(size_t x)
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:1548
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:5492
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:1391
THREAD_SAFE uint64 extract_dq(T &v)
Definition pro.h:2042
constexpr bool is_lead_surrogate(wchar32_t wch)
Definition pro.h:4862
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:343
idaman THREAD_SAFE int ida_export qwrite(int h, const void *buf, size_t n)
Works the same as its counterpart from C library.
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:1753
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:2020
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:483
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 its counterpart from C library.
THREAD_SAFE const void *idaapi unpack_buf_inplace(const uchar **pptr, const uchar *end)
In-place version of unpack_buf().
Definition pro.h:1881
int error_t
Error code (errno)
Definition pro.h:462
INLINE THREAD_SAFE int ida_local qtoupper(char c)
Get uppercase equivalent of given char.
Definition pro.h:956
int lexcompare(const T &a, const T &b)
Standard lexical comparison.
Definition pro.h:2964
qvector< ea_t > eavec_t
vector of addresses
Definition pro.h:2838
uval_t inode_t
The inode_t type is the specialization specific inode number.
Definition pro.h:468
uint64 flags64_t
64-bit flags for each address
Definition pro.h:5106
void qvoid_t
Definition pro.h:4602
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:3109
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:5177
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 its counterpart from C library.
void * qhandle_t
MS Windows HANDLE.
Definition pro.h:5586
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:5199
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:3773
THREAD_SAFE constexpr wchar16_t utf8_wchar16(uchar b0, uchar b1)
Definition pro.h:4910
T round_up(T val, T base)
round up or down to an arbitrary number
Definition pro.h:1441
qvector< sval_t > svalvec_t
vector of signed values
Definition pro.h:2837
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:1378
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:4899
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:3131
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:580
INLINE THREAD_SAFE void idaapi set_all_bits(uchar *bitmap, size_t nbits)
Set first 'nbits' of 'bitmap'.
Definition pro.h:1398
bool is_udiv_ok(T, T b)
Check that unsigned division is permissible.
Definition pro.h:1555
ptrdiff_t ssize_t
Signed size_t - used to check for size overflows when the counter becomes negative.
Definition pro.h:385
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:484
INLINE THREAD_SAFE bool idaapi test_bit(const uchar *bitmap, size_t bit)
Test if 'bit' is set in 'bitmap'.
Definition pro.h:1367
THREAD_SAFE ea_t extract_ea(T &v)
Definition pro.h:2050
unsigned short ushort
unsigned 16 bit value
Definition pro.h:342
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:4731
INLINE THREAD_SAFE uint32 get_usecs(qtime64_t t)
Get the microseconds part of a qtime64_t.
Definition pro.h:516
idaman THREAD_SAFE int ida_export qdup(int h)
Works the same as its counterpart from C library.
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:5435
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:4904
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:5256
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:1384
THREAD_SAFE void * extract_array(T &v, size_t *sz, size_t maxsize)
Definition pro.h:2069
idaman THREAD_SAFE int ida_export qclose(int h)
Works the same as its counterpart from C library.
void idaapi setflag(T &where, U bit, bool cnd)
Set a 'bit' in 'where' if 'value' is not zero.
Definition pro.h:1530
ea_t tid_t
type id (for enums, structs, etc)
Definition pro.h:5107
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 its counterpart from C library.
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:359
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:4648
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:1840
unsigned char uint8
unsigned 8 bit value
Definition pro.h:348
THREAD_SAFE ea64_t unpack_ea64(const uchar **ptr, const uchar *end)
Unpack an ea value (always use 64-bit, use delta 1)
Definition pro.h:1803
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:4832
THREAD_SAFE int ds_packed_size(const char *s)
Definition pro.h:1980
THREAD_SAFE int idaapi qstrcmp(const char *s1, const char *s2)
Definition pro.h:3087
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:346
constexpr bool is_pow2(T val)
is power of 2? (or zero)
Definition pro.h:1435
INLINE THREAD_SAFE void idaapi clear_all_bits(uchar *bitmap, size_t nbits)
Clear first 'nbits' of 'bitmap'.
Definition pro.h:1408
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. Must call qthread_free() to free it!
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:1484
_qstring< char > qstring
regular string
Definition pro.h:3771
INLINE THREAD_SAFE char * tail(char *str)
Get tail of a string.
Definition pro.h:883
idaman THREAD_SAFE qoff64_t ida_export qtell(int h)
Works the same as its counterpart from C library.
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:4864
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:3775
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:4924
int compare(const T &a, const T &b)
Definition pro.h:4607
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:1793
void cliopt_poly_handler_t(int argc, const char **argv, void *ud)
Definition pro.h:5200
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.
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:1572
unsigned int
Definition pronet.h:99
constexpr bool operator!=(qpair< F, S > const &a, qpair< F, S > const &b)
Definition qpair.hpp:103
void swap(qpair< F, S > &a, qpair< F, S > &b) noexcept(noexcept(a.swap(b)))
Definition qpair.hpp:78
constexpr bool operator==(qpair< F, S > const &a, qpair< F, S > const &b)
Definition qpair.hpp:98
Tools for command line parsing.
Definition pro.h:5119
qstring file
file name to redirect to/from.
Definition pro.h:5121
int flags
i/o redirection flags
Definition pro.h:5123
int fd
channel number
Definition pro.h:5120
int start
begin of the redirection string in the command line
Definition pro.h:5136
bool is_append(void) const
Definition pro.h:5134
bool is_quoted(void) const
Definition pro.h:5135
bool is_input(void) const
Definition pro.h:5132
int length
length of the redirection string in the command line
Definition pro.h:5137
bool is_output(void) const
Definition pro.h:5133
int nargs
Definition pro.h:5207
const char * longname
Definition pro.h:5204
const char * help
Definition pro.h:5205
cliopt_handler_t * handler
Definition pro.h:5206
char shortname
Definition pro.h:5203
Template to compare any 2 values of the same type. Returns -1/0/1.
Definition pro.h:4600
static constexpr bool value
Definition pro.h:1721
Options for instant debugging.
Definition pro.h:5333
int event_id
event to trigger upon attaching
Definition pro.h:5340
qstring debmod
name of debugger module
Definition pro.h:5334
int pid
process to attach to (-1: ask the user)
Definition pro.h:5339
qstring host
remote hostname (if remote debugging)
Definition pro.h:5336
bool attach
should attach to a process?
Definition pro.h:5341
int port
port number for the remote debugger server
Definition pro.h:5338
qstring pass
password for the remote debugger server
Definition pro.h:5337
qstring env
config variables for debmod. example: DEFAULT_CPU=13;MAXPACKETSIZE=-1
Definition pro.h:5335
interr_exc_t(int _code)
Definition pro.h:764
int code
Definition pro.h:763
linput_t *& resource
Definition pro.h:4584
~janitor_t()
We provide no implementation for this function, you should provide specialized implementation yoursel...
janitor_t(T &r)
Constructor.
Definition pro.h:4580
Information for launching a process with IDA API Note: all string data such as paths (e....
Definition pro.h:5362
const char * args
command line arguments
Definition pro.h:5384
void * info
os specific info (on windows it points to PROCESS_INFORMATION) on unix, not used
Definition pro.h:5393
const char * path
file to run
Definition pro.h:5383
int flags
Launch process flags
Definition pro.h:5364
ssize_t in_handle
handle for stdin or -1
Definition pro.h:5385
char * env
zero separated environment variables that will be appended to the existing environment block (existin...
Definition pro.h:5388
ssize_t err_handle
handle for stderr or -1
Definition pro.h:5387
size_t cb
size of this structure
Definition pro.h:5363
const char * startdir
current directory for the new process
Definition pro.h:5392
ssize_t out_handle
handle for stdout or -1
Definition pro.h:5386
ea_t unpack_ea()
Definition pro.h:4490
void unpack(qvector< T > *out)
Definition pro.h:4537
bool unpack_ds_to_buf(char *buf, size_t bufsize)
Definition pro.h:4501
bool empty() const
Definition pro.h:4483
const uchar * ptr
Definition pro.h:4476
bool eof() const
Definition pro.h:4547
uint64 unpack_dq()
Definition pro.h:4489
const void * unpack_buf_inplace()
Definition pro.h:4509
const uchar * end
Definition pro.h:4477
ssize_t read(void *obj, size_t objsize)
Definition pro.h:4546
void unpack_eavec(eavec_t *vec, ea_t ea)
Definition pro.h:4521
uint16 unpack_dw()
Definition pro.h:4487
memory_deserializer_t(const uchar *p, const uchar *e)
Definition pro.h:4481
bool unpack_str(qstring *out)
Definition pro.h:4494
memory_deserializer_t(const bytevec_t &b)
Definition pro.h:4480
const void * unpack_obj_inplace(size_t objsize)
Definition pro.h:4505
const void * unpack_obj(void *obj, size_t objsize)
Definition pro.h:4513
uint8 unpack_db()
Definition pro.h:4486
void unpack(T *out)
Definition pro.h:4530
uint32 unpack_dd()
Definition pro.h:4488
bool advance(size_t s)
Definition pro.h:4485
memory_deserializer_t(const void *p, size_t s)
Definition pro.h:4482
void unpack(qstring *out)
Definition pro.h:4535
bool unpack_bytevec(bytevec_t *out)
Definition pro.h:4525
const void * unpack_buf()
Definition pro.h:4517
ea64_t unpack_ea64()
Definition pro.h:4491
size_t size() const
Definition pro.h:4484
const char * unpack_str()
Definition pro.h:4493
memory_deserializer_t(const qstring &s)
Definition pro.h:4479
char * unpack_ds(bool empty_null=false)
Definition pro.h:4496
void pack(T value)
Definition pro.h:4556
void pack(const qstring &value)
Definition pro.h:4561
void pack(const qvector< T > &value)
Definition pro.h:4563
const plugin_option_t * find(const qstring &name) const
Definition pro.h:5289
bool erase(const char *name)
Definition pro.h:5297
void operator()(T *ptr)
Definition pro.h:4591
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:648
qtime64_t qst_ctime
time of last status change
Definition pro.h:661
uint32 qst_nlink
number of hard links
Definition pro.h:652
uint32 qst_gid
group ID of owner
Definition pro.h:654
qtime64_t qst_atime
time of last access
Definition pro.h:659
uint32 qst_mode
protection
Definition pro.h:651
qtime64_t qst_mtime
time of last modification
Definition pro.h:660
int32 qst_blocks
number of 512B blocks allocated
Definition pro.h:658
qoff64_t qst_size
total size, in bytes
Definition pro.h:656
uint64 qst_rdev
device ID (if special file)
Definition pro.h:655
uint32 qst_ino
inode number
Definition pro.h:650
int32 qst_blksize
blocksize for file system I/O
Definition pro.h:657
uint32 qst_uid
user ID of owner
Definition pro.h:653
uint64 qst_dev
ID of device containing file.
Definition pro.h:649
Relocatable object.
Definition pro.h:4103
ea_t base
current base
Definition pro.h:4104
relobj_t(void)
Definition pro.h:4107
reloc_info_t ri
relocation info
Definition pro.h:4105
bool relocate(ea_t ea, bool mf)
mf=1:big endian
Definition pro.h:4108
Relocation information (relocatable objects - see relobj_t)
Definition pro.h:4085
size_t operator()(const _qstring< T > &str) const noexcept
Definition pro.h:3785