Introduced custom integer types

This commit is contained in:
Joel Höner 2017-11-25 01:35:22 +01:00
parent 066e7f359d
commit cf24ee010a
27 changed files with 448 additions and 453 deletions

View File

@ -32,6 +32,7 @@
#include <errno.h>
#include <time.h>
#include <Zydis/Zydis.h>
#include <inttypes.h>
#if defined(ZYDIS_WINDOWS)
# include <Windows.h>

View File

@ -35,48 +35,44 @@
#include <Zydis/Defines.h>
/* ============================================================================================== */
/* Integral types */
/* Integer types */
/* ============================================================================================== */
// Fixed width integer types.
#if defined(ZYDIS_WINKERNEL)
# if !defined(ZYDIS_MSVC)
# error "Windows kernel drivers are only supported with MSVC"
# endif
typedef unsigned __int8 uint8_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int64 uint64_t;
typedef __int8 int8_t;
typedef __int16 int16_t;
typedef __int32 int32_t;
typedef __int64 int64_t;
# define UINT8_MAX (255)
# define UINT16_MAX (65535U)
# define UINT32_MAX (4294967295UL)
# define UINT64_MAX (18446744073709551615ULL)
# define INT8_MAX (127)
# define INT8_MIN (-128)
# define INT16_MAX (32767)
# define INT16_MIN (-32767-1)
# define INT32_MIN (-2147483647L-1)
# define INT32_MAX (2147483647L)
# define INT64_MIN (-9223372036854775807LL-1)
# define INT64_MAX (9223372036854775807LL)
# define PRIX8 "hhX"
# define PRIX16 "hX"
# define PRIX32 "X"
# define PRIX64 "llX"
#else
#if !defined(ZYDIS_NO_LIBC)
// LibC present, use stdint types.
# include <stdint.h>
# include <inttypes.h>
typedef uint8_t ZydisU8;
typedef uint16_t ZydisU16;
typedef uint32_t ZydisU32;
typedef uint64_t ZydisU64;
typedef int8_t ZydisI8;
typedef int16_t ZydisI16;
typedef int32_t ZydisI32;
typedef int64_t ZydisI64;
#else
// No LibC, roll our own int sizes ...
# if defined(ZYDIS_MSVC)
typedef unsigned __int8 ZydisU8;
typedef unsigned __int16 ZydisU16;
typedef unsigned __int32 ZydisU32;
typedef unsigned __int64 ZydisU64;
typedef __int8 ZydisI8;
typedef __int16 ZydisI16;
typedef __int32 ZydisI32;
typedef __int64 ZydisI64;
# else
# error "Unsupported compiler for NO_LIBC mode."
# endif
#endif
// size_t, ptrdiff_t
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#if ZYDIS_WORD_SIZE == 32
typedef ZydisU32 ZydisUSize;
typedef ZydisI32 ZydisISize;
#elif ZYDIS_WORD_SIZE == 64
typedef ZydisU64 ZydisUSize;
typedef ZydisI64 ZydisISize;
#else
# error "Unsupported word size."
#endif
/* ============================================================================================== */
@ -93,8 +89,4 @@ typedef uint8_t ZydisBool;
/* ============================================================================================== */
#ifdef __cplusplus
}
#endif
#endif /* ZYDIS_COMMONTYPES_H */

View File

@ -52,7 +52,7 @@ extern "C" {
/**
* @brief Defines the @c ZydisDecoderMode datatype.
*/
typedef uint8_t ZydisDecoderMode;
typedef ZydisU8 ZydisDecoderMode;
/**
* @brief Values that represent decoder-modes.
@ -187,7 +187,7 @@ ZYDIS_EXPORT ZydisStatus ZydisDecoderEnableMode(ZydisDecoder* decoder, ZydisDeco
* @return A zydis status code.
*/
ZYDIS_EXPORT ZydisStatus ZydisDecoderDecodeBuffer(const ZydisDecoder* decoder,
const void* buffer, size_t bufferLen, uint64_t instructionPointer,
const void* buffer, ZydisUSize bufferLen, ZydisU64 instructionPointer,
ZydisDecodedInstruction* instruction);
/* ============================================================================================== */

View File

@ -53,7 +53,7 @@ extern "C" {
/**
* @brief Defines the @c ZydisMemoryOperandType datatype.
*/
typedef uint8_t ZydisMemoryOperandType;
typedef ZydisU8 ZydisMemoryOperandType;
/**
* @brief Values that represent memory-operand types.
@ -90,7 +90,7 @@ typedef struct ZydisDecodedOperand_
/**
* @brief The operand-id.
*/
uint8_t id;
ZydisU8 id;
/**
* @brief The type of the operand.
*/
@ -110,7 +110,7 @@ typedef struct ZydisDecodedOperand_
/**
* @brief The logical size of the operand (in bits).
*/
uint16_t size;
ZydisU16 size;
/**
* @brief The element-type.
*/
@ -122,7 +122,7 @@ typedef struct ZydisDecodedOperand_
/**
* @brief The number of elements.
*/
uint16_t elementCount;
ZydisU16 elementCount;
/**
* @brief Extended info for register-operands.
*/
@ -158,7 +158,7 @@ typedef struct ZydisDecodedOperand_
/**
* @brief The scale factor.
*/
uint8_t scale;
ZydisU8 scale;
/**
* @brief Extended info for memory-operands with displacement.
*/
@ -171,7 +171,7 @@ typedef struct ZydisDecodedOperand_
/**
* @brief The displacement value
*/
int64_t value;
ZydisI64 value;
} disp;
} mem;
/**
@ -179,8 +179,8 @@ typedef struct ZydisDecodedOperand_
*/
struct
{
uint16_t segment;
uint32_t offset;
ZydisU16 segment;
ZydisU32 offset;
} ptr;
/**
* @brief Extended info for immediate-operands.
@ -201,8 +201,8 @@ typedef struct ZydisDecodedOperand_
*/
union
{
uint64_t u;
int64_t s;
ZydisU64 u;
ZydisI64 s;
} value;
} imm;
} ZydisDecodedOperand;
@ -220,7 +220,7 @@ typedef struct ZydisDecodedOperand_
/**
* @brief Defines the @c ZydisInstructionAttributes datatype.
*/
typedef uint64_t ZydisInstructionAttributes;
typedef ZydisU64 ZydisInstructionAttributes;
/**
* @brief The instruction has the ModRM byte.
@ -403,12 +403,12 @@ typedef uint64_t ZydisInstructionAttributes;
/**
* @brief Defines the @c ZydisCPUFlag datatype.
*/
typedef uint8_t ZydisCPUFlag;
typedef ZydisU8 ZydisCPUFlag;
/**
* @brief Defines the @c ZydisCPUFlagMask datatype.
*/
typedef uint32_t ZydisCPUFlagMask;
typedef ZydisU32 ZydisCPUFlagMask;
/**
* @brief Values that represent CPU-flags.
@ -508,7 +508,7 @@ enum ZydisCPUFlags
/**
* @brief Defines the @c ZydisCPUFlagAction datatype.
*/
typedef uint8_t ZydisCPUFlagAction;
typedef ZydisU8 ZydisCPUFlagAction;
/**
* @brief Values that represent CPU-flag actions.
@ -534,7 +534,7 @@ enum ZydisCPUFlagActions
/**
* @brief Defines the @c ZydisExceptionClass datatype.
*/
typedef uint8_t ZydisExceptionClass;
typedef ZydisU8 ZydisExceptionClass;
/**
* @brief Values that represent exception-classes.
@ -595,7 +595,7 @@ enum ZydisExceptionClasses
/**
* @brief Defines the @c ZydisVectorLength datatype.
*/
typedef uint16_t ZydisVectorLength;
typedef ZydisU16 ZydisVectorLength;
/**
* @brief Values that represent vector-lengths.
@ -619,7 +619,7 @@ enum ZydisVectorLengths
/**
* @brief Defines the @c ZydisMaskMode datatype.
*/
typedef uint8_t ZydisMaskMode;
typedef ZydisU8 ZydisMaskMode;
/**
* @brief Values that represent AVX mask-modes.
@ -649,7 +649,7 @@ enum ZydisMaskModes
/**
* @brief Defines the @c ZydisBroadcastMode datatype.
*/
typedef uint8_t ZydisBroadcastMode;
typedef ZydisU8 ZydisBroadcastMode;
/**
* @brief Values that represent AVX broadcast-modes.
@ -682,7 +682,7 @@ enum ZydisBroadcastModes
/**
* @brief Defines the @c ZydisRoundingMode datatype.
*/
typedef uint8_t ZydisRoundingMode;
typedef ZydisU8 ZydisRoundingMode;
/**
* @brief Values that represent AVX rounding-modes.
@ -719,7 +719,7 @@ enum ZydisRoundingModes
/**
* @brief Defines the @c ZydisSwizzleMode datatype.
*/
typedef uint8_t ZydisSwizzleMode;
typedef ZydisU8 ZydisSwizzleMode;
/**
* @brief Values that represent swizzle-modes.
@ -748,7 +748,7 @@ enum ZydisSwizzleModes
/**
* @brief Defines the @c ZydisConversionMode datatype.
*/
typedef uint8_t ZydisConversionMode;
typedef ZydisU8 ZydisConversionMode;
/**
* @brief Values that represent conversion-modes.
@ -787,11 +787,11 @@ typedef struct ZydisDecodedInstruction_
/**
* @brief The length of the decoded instruction.
*/
uint8_t length;
ZydisU8 length;
/**
* @brief The raw bytes of the decoded instruction.
*/
uint8_t data[ZYDIS_MAX_INSTRUCTION_LENGTH];
ZydisU8 data[ZYDIS_MAX_INSTRUCTION_LENGTH];
/**
* @brief The instruction-encoding (default, 3DNow, VEX, EVEX, XOP).
*/
@ -803,23 +803,23 @@ typedef struct ZydisDecodedInstruction_
/**
* @brief The instruction-opcode.
*/
uint8_t opcode;
ZydisU8 opcode;
/**
* @brief The stack width.
*/
uint8_t stackWidth;
ZydisU8 stackWidth;
/**
* @brief The effective operand width.
*/
uint8_t operandWidth;
ZydisU8 operandWidth;
/**
* @brief The effective address width.
*/
uint8_t addressWidth;
ZydisU8 addressWidth;
/**
* @brief The number of instruction-operands.
*/
uint8_t operandCount;
ZydisU8 operandCount;
/**
* @brief Detailed info for all instruction operands.
*/
@ -832,14 +832,14 @@ typedef struct ZydisDecodedInstruction_
* @brief The instruction address points at the current instruction (relative to the
* initial instruction pointer).
*/
uint64_t instrAddress;
ZydisU64 instrAddress;
/**
* @brief The instruction pointer points at the address of the next instruction (relative
* to the initial instruction pointer).
*
* This field is used to properly format relative instructions.
*/
uint64_t instrPointer;
ZydisU64 instrPointer;
/**
* @brief Information about accessed CPU flags.
*/
@ -969,19 +969,19 @@ typedef struct ZydisDecodedInstruction_
*/
struct
{
uint8_t data[ZYDIS_MAX_INSTRUCTION_LENGTH - 1];
uint8_t count;
uint8_t hasF0;
uint8_t hasF3;
uint8_t hasF2;
uint8_t has2E;
uint8_t has36;
uint8_t has3E;
uint8_t has26;
uint8_t has64;
uint8_t has65;
uint8_t has66;
uint8_t has67;
ZydisU8 data[ZYDIS_MAX_INSTRUCTION_LENGTH - 1];
ZydisU8 count;
ZydisU8 hasF0;
ZydisU8 hasF3;
ZydisU8 hasF2;
ZydisU8 has2E;
ZydisU8 has36;
ZydisU8 has3E;
ZydisU8 has26;
ZydisU8 has64;
ZydisU8 has65;
ZydisU8 has66;
ZydisU8 has67;
} prefixes;
/**
* @brief Detailed info about the REX-prefix.
@ -995,23 +995,23 @@ typedef struct ZydisDecodedInstruction_
/**
* @brief The raw bytes of the prefix.
*/
uint8_t data[1];
ZydisU8 data[1];
/**
* @brief 64-bit operand-size promotion.
*/
uint8_t W;
ZydisU8 W;
/**
* @brief Extension of the ModRM.reg field.
*/
uint8_t R;
ZydisU8 R;
/**
* @brief Extension of the SIB.index field.
*/
uint8_t X;
ZydisU8 X;
/**
* @brief Extension of the ModRM.rm, SIB.base, or opcode.reg field.
*/
uint8_t B;
ZydisU8 B;
} rex;
/**
* @brief Detailed info about the XOP-prefix.
@ -1025,39 +1025,39 @@ typedef struct ZydisDecodedInstruction_
/**
* @brief The raw bytes of the prefix.
*/
uint8_t data[3];
ZydisU8 data[3];
/**
* @brief Extension of the ModRM.reg field (inverted).
*/
uint8_t R;
ZydisU8 R;
/**
* @brief Extension of the SIB.index field (inverted).
*/
uint8_t X;
ZydisU8 X;
/**
* @brief Extension of the ModRM.rm, SIB.base, or opcode.reg field (inverted).
*/
uint8_t B;
ZydisU8 B;
/**
* @brief Opcode-map specifier.
*/
uint8_t m_mmmm;
ZydisU8 m_mmmm;
/**
* @brief 64-bit operand-size promotion or opcode-extension.
*/
uint8_t W;
ZydisU8 W;
/**
* @brief NDS register specifier (inverted).
*/
uint8_t vvvv;
ZydisU8 vvvv;
/**
* @brief Vector-length specifier.
*/
uint8_t L;
ZydisU8 L;
/**
* @brief Compressed legacy prefix.
*/
uint8_t pp;
ZydisU8 pp;
} xop;
/**
* @brief Detailed info about the VEX-prefix.
@ -1071,39 +1071,39 @@ typedef struct ZydisDecodedInstruction_
/**
* @brief The raw bytes of the prefix.
*/
uint8_t data[3];
ZydisU8 data[3];
/**
* @brief Extension of the ModRM.reg field (inverted).
*/
uint8_t R;
ZydisU8 R;
/**
* @brief Extension of the SIB.index field (inverted).
*/
uint8_t X;
ZydisU8 X;
/**
* @brief Extension of the ModRM.rm, SIB.base, or opcode.reg field (inverted).
*/
uint8_t B;
ZydisU8 B;
/**
* @brief Opcode-map specifier.
*/
uint8_t m_mmmm;
ZydisU8 m_mmmm;
/**
* @brief 64-bit operand-size promotion or opcode-extension.
*/
uint8_t W;
ZydisU8 W;
/**
* @brief NDS register specifier (inverted).
*/
uint8_t vvvv;
ZydisU8 vvvv;
/**
* @brief Vector-length specifier.
*/
uint8_t L;
ZydisU8 L;
/**
* @brief Compressed legacy prefix.
*/
uint8_t pp;
ZydisU8 pp;
} vex;
/**
* @brief Detailed info about the EVEX-prefix.
@ -1117,63 +1117,63 @@ typedef struct ZydisDecodedInstruction_
/**
* @brief The raw bytes of the prefix.
*/
uint8_t data[4];
ZydisU8 data[4];
/**
* @brief Extension of the ModRM.reg field (inverted).
*/
uint8_t R;
ZydisU8 R;
/**
* @brief Extension of the SIB.index/vidx field (inverted).
*/
uint8_t X;
ZydisU8 X;
/**
* @brief Extension of the ModRM.rm or SIB.base field (inverted).
*/
uint8_t B;
ZydisU8 B;
/**
* @brief High-16 register specifier modifier (inverted).
*/
uint8_t R2;
ZydisU8 R2;
/**
* @brief Opcode-map specifier.
*/
uint8_t mm;
ZydisU8 mm;
/**
* @brief 64-bit operand-size promotion or opcode-extension.
*/
uint8_t W;
ZydisU8 W;
/**
* @brief NDS register specifier (inverted).
*/
uint8_t vvvv;
ZydisU8 vvvv;
/**
* @brief Compressed legacy prefix.
*/
uint8_t pp;
ZydisU8 pp;
/**
* @brief Zeroing/Merging.
*/
uint8_t z;
ZydisU8 z;
/**
* @brief Vector-length specifier or rounding-control (most significant bit).
*/
uint8_t L2;
ZydisU8 L2;
/**
* @brief Vector-length specifier or rounding-control (least significant bit).
*/
uint8_t L;
ZydisU8 L;
/**
* @brief Broadcast/RC/SAE Context.
*/
uint8_t b;
ZydisU8 b;
/**
* @brief High-16 NDS/VIDX register specifier.
*/
uint8_t V2;
ZydisU8 V2;
/**
* @brief Embedded opmask register specifier.
*/
uint8_t aaa;
ZydisU8 aaa;
} evex;
/**
* @brief Detailed info about the MVEX-prefix.
@ -1187,55 +1187,55 @@ typedef struct ZydisDecodedInstruction_
/**
* @brief The raw bytes of the prefix.
*/
uint8_t data[4];
ZydisU8 data[4];
/**
* @brief Extension of the ModRM.reg field (inverted).
*/
uint8_t R;
ZydisU8 R;
/**
* @brief Extension of the SIB.index/vidx field (inverted).
*/
uint8_t X;
ZydisU8 X;
/**
* @brief Extension of the ModRM.rm or SIB.base field (inverted).
*/
uint8_t B;
ZydisU8 B;
/**
* @brief High-16 register specifier modifier (inverted).
*/
uint8_t R2;
ZydisU8 R2;
/**
* @brief Opcode-map specifier.
*/
uint8_t mmmm;
ZydisU8 mmmm;
/**
* @brief 64-bit operand-size promotion or opcode-extension.
*/
uint8_t W;
ZydisU8 W;
/**
* @brief NDS register specifier (inverted).
*/
uint8_t vvvv;
ZydisU8 vvvv;
/**
* @brief Compressed legacy prefix.
*/
uint8_t pp;
ZydisU8 pp;
/**
* @brief Non-temporal/eviction hint.
*/
uint8_t E;
ZydisU8 E;
/**
* @brief Swizzle/broadcast/up-convert/down-convert/static-rounding controls.
*/
uint8_t SSS;
ZydisU8 SSS;
/**
* @brief High-16 NDS/VIDX register specifier.
*/
uint8_t V2;
ZydisU8 V2;
/**
* @brief Embedded opmask register specifier.
*/
uint8_t kkk;
ZydisU8 kkk;
} mvex;
/**
* @brief Detailed info about the ModRM-byte.
@ -1243,10 +1243,10 @@ typedef struct ZydisDecodedInstruction_
struct
{
ZydisBool isDecoded;
uint8_t data[1];
uint8_t mod;
uint8_t reg;
uint8_t rm;
ZydisU8 data[1];
ZydisU8 mod;
ZydisU8 reg;
ZydisU8 rm;
} modrm;
/**
* @brief Detailed info about the SIB-byte.
@ -1254,10 +1254,10 @@ typedef struct ZydisDecodedInstruction_
struct
{
ZydisBool isDecoded;
uint8_t data[1];
uint8_t scale;
uint8_t index;
uint8_t base;
ZydisU8 data[1];
ZydisU8 scale;
ZydisU8 index;
ZydisU8 base;
} sib;
/**
* @brief Detailed info about displacement-bytes.
@ -1267,16 +1267,16 @@ typedef struct ZydisDecodedInstruction_
/**
* @brief The displacement value
*/
int64_t value;
ZydisI64 value;
/**
* @brief The physical displacement size, in bits.
*/
uint8_t size;
ZydisU8 size;
/**
* @brief The offset of the displacement data, relative to the beginning of the
* instruction, in bytes.
*/
uint8_t offset;
ZydisU8 offset;
} disp;
/**
* @brief Detailed info about immediate-bytes.
@ -1297,18 +1297,18 @@ typedef struct ZydisDecodedInstruction_
*/
union
{
uint64_t u;
int64_t s;
ZydisU64 u;
ZydisI64 s;
} value;
/**
* @brief The physical immediate size, in bits.
*/
uint8_t size;
ZydisU8 size;
/**
* @brief The offset of the immediate data, relative to the beginning of the
* instruction, in bytes.
*/
uint8_t offset;
ZydisU8 offset;
} imm[2];
} raw;
} ZydisDecodedInstruction;

View File

@ -81,8 +81,10 @@
#if defined (_M_AMD64) || defined (__x86_64__)
# define ZYDIS_X64
# define ZYDIS_WORD_SIZE 64
#elif defined (_M_IX86) || defined (__i386__)
# define ZYDIS_X86
# define ZYDIS_WORD_SIZE 32
#else
# error "Unsupported architecture detected"
#endif
@ -121,7 +123,7 @@
/* Debugging and optimization macros */
/* ============================================================================================== */
#if defined(ZYDIS_WINKERNEL)
#if defined(ZYDIS_NO_LIBC)
# define ZYDIS_ASSERT(condition)
#else
# include <assert.h>
@ -149,7 +151,7 @@
# else
# define ZYDIS_UNREACHABLE
# endif
#elif defined(ZYDIS_WINKERNEL)
#elif defined(ZYDIS_NO_LIBC)
# define ZYDIS_UNREACHABLE
#else
# include <stdlib.h>

View File

@ -51,7 +51,7 @@ extern "C" {
/**
* @brief Defines the @c ZydisFormatterStyle datatype.
*/
typedef uint8_t ZydisFormatterStyle;
typedef ZydisU8 ZydisFormatterStyle;
/**
* @brief Values that represent formatter-styles.
@ -75,7 +75,7 @@ enum ZydisFormatterStyles
/**
* @brief Defines the @c ZydisFormatterProperty datatype.
*/
typedef uint8_t ZydisFormatterProperty;
typedef ZydisU8 ZydisFormatterProperty;
/**
* @brief Values that represent formatter-properties.
@ -282,7 +282,7 @@ enum ZydisImmediateFormat
/**
* @brief Defines the @c ZydisFormatterHookType datatype.
*/
typedef uint8_t ZydisFormatterHookType;
typedef ZydisU8 ZydisFormatterHookType;
/**
* @brief Values that represent formatter hook-types.
@ -374,7 +374,7 @@ enum ZydisFormatterHookTypes
/**
* @brief Defines the @c ZydisDecoratorType datatype.
*/
typedef uint8_t ZydisDecoratorType;
typedef ZydisU8 ZydisDecoratorType;
/**
* @brief Values that represent decorator-types.
@ -434,7 +434,7 @@ typedef ZydisStatus (*ZydisFormatterNotifyFunc)(const ZydisFormatter* formatter,
* @c ZYDIS_FORMATTER_HOOK_PRINT_PREFIXES and @c ZYDIS_FORMATTER_HOOK_PRINT_MNEMONIC hook-types.
*/
typedef ZydisStatus (*ZydisFormatterFormatFunc)(const ZydisFormatter* formatter,
char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction, void* userData);
char** buffer, ZydisUSize bufferLen, const ZydisDecodedInstruction* instruction, void* userData);
/**
* @brief Defines the @c ZydisFormatterFormatOperandFunc function pointer.
@ -471,7 +471,7 @@ typedef ZydisStatus (*ZydisFormatterFormatFunc)(const ZydisFormatter* formatter,
* hook-types.
*/
typedef ZydisStatus (*ZydisFormatterFormatOperandFunc)(const ZydisFormatter* formatter,
char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction,
char** buffer, ZydisUSize bufferLen, const ZydisDecodedInstruction* instruction,
const ZydisDecodedOperand* operand, void* userData);
/**
@ -494,8 +494,8 @@ typedef ZydisStatus (*ZydisFormatterFormatOperandFunc)(const ZydisFormatter* for
* This function type is used for the @c ZYDIS_FORMATTER_HOOK_PRINT_ADDRESS hook-type.
*/
typedef ZydisStatus (*ZydisFormatterFormatAddressFunc)(const ZydisFormatter* formatter,
char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction,
const ZydisDecodedOperand* operand, uint64_t address, void* userData);
char** buffer, ZydisUSize bufferLen, const ZydisDecodedInstruction* instruction,
const ZydisDecodedOperand* operand, ZydisU64 address, void* userData);
/**
* @brief Defines the @c ZydisFormatterFormatDecoratorFunc function pointer.
@ -520,7 +520,7 @@ typedef ZydisStatus (*ZydisFormatterFormatAddressFunc)(const ZydisFormatter* for
* This function type is used for the @c ZYDIS_FORMATTER_HOOK_PRINT_DECORATOR hook-type.
*/
typedef ZydisStatus (*ZydisFormatterFormatDecoratorFunc)(const ZydisFormatter* formatter,
char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction,
char** buffer, ZydisUSize bufferLen, const ZydisDecodedInstruction* instruction,
const ZydisDecodedOperand* operand, ZydisDecoratorType type, void* userData);
/* ---------------------------------------------------------------------------------------------- */
@ -532,18 +532,18 @@ typedef ZydisStatus (*ZydisFormatterFormatDecoratorFunc)(const ZydisFormatter* f
*/
struct ZydisFormatter_
{
uint8_t letterCase;
ZydisU8 letterCase;
ZydisBool forceSegments;
ZydisBool forceOperandSize;
uint8_t addressFormat;
uint8_t displacementFormat;
uint8_t immediateFormat;
ZydisU8 addressFormat;
ZydisU8 displacementFormat;
ZydisU8 immediateFormat;
ZydisBool hexUppercase;
char* hexPrefix;
char* hexSuffix;
uint8_t hexPaddingAddress;
uint8_t hexPaddingDisplacement;
uint8_t hexPaddingImmediate;
ZydisU8 hexPaddingAddress;
ZydisU8 hexPaddingDisplacement;
ZydisU8 hexPaddingImmediate;
ZydisFormatterNotifyFunc funcPre;
ZydisFormatterNotifyFunc funcPost;
ZydisFormatterFormatFunc funcFormatInstruction;
@ -587,7 +587,7 @@ ZYDIS_EXPORT ZydisStatus ZydisFormatterInit(ZydisFormatter* formatter, ZydisForm
* @return A zydis status code.
*/
ZYDIS_EXPORT ZydisStatus ZydisFormatterSetProperty(ZydisFormatter* formatter,
ZydisFormatterProperty property, uintptr_t value);
ZydisFormatterProperty property, ZydisUSize value);
/**
* @brief Replaces a formatter function with a custom callback and/or retrieves the currently
@ -617,7 +617,7 @@ ZYDIS_EXPORT ZydisStatus ZydisFormatterSetHook(ZydisFormatter* formatter,
* @return A zydis status code.
*/
ZYDIS_EXPORT ZydisStatus ZydisFormatterFormatInstruction(const ZydisFormatter* formatter,
const ZydisDecodedInstruction* instruction, char* buffer, size_t bufferLen);
const ZydisDecodedInstruction* instruction, char* buffer, ZydisUSize bufferLen);
/**
* @brief Formats the given instruction and writes it into the output buffer.
@ -632,7 +632,7 @@ ZYDIS_EXPORT ZydisStatus ZydisFormatterFormatInstruction(const ZydisFormatter* f
* @return A zydis status code.
*/
ZYDIS_EXPORT ZydisStatus ZydisFormatterFormatInstructionEx(const ZydisFormatter* formatter,
const ZydisDecodedInstruction* instruction, char* buffer, size_t bufferLen, void* userData);
const ZydisDecodedInstruction* instruction, char* buffer, ZydisUSize bufferLen, void* userData);
/* ============================================================================================== */

View File

@ -1,7 +1,7 @@
/**
* @brief Defines the `ZydisISAExt` datatype.
*/
typedef uint8_t ZydisISAExt;
typedef ZydisU8 ZydisISAExt;
/**
* @brief Values that represent `ZydisISAExt` elements.

View File

@ -1,7 +1,7 @@
/**
* @brief Defines the `ZydisISASet` datatype.
*/
typedef uint8_t ZydisISASet;
typedef ZydisU8 ZydisISASet;
/**
* @brief Values that represent `ZydisISASet` elements.

View File

@ -1,7 +1,7 @@
/**
* @brief Defines the `ZydisInstructionCategory` datatype.
*/
typedef uint8_t ZydisInstructionCategory;
typedef ZydisU8 ZydisInstructionCategory;
/**
* @brief Values that represent `ZydisInstructionCategory` elements.

View File

@ -1,7 +1,7 @@
/**
* @brief Defines the `ZydisMnemonic` datatype.
*/
typedef uint16_t ZydisMnemonic;
typedef ZydisU16 ZydisMnemonic;
/**
* @brief Values that represent `ZydisMnemonic` elements.

View File

@ -51,7 +51,7 @@ extern "C" {
/**
* @brief Defines the @c ZydisRegister datatype.
*/
typedef uint8_t ZydisRegister;
typedef ZydisU8 ZydisRegister;
/**
* @brief Values that represent zydis registers.
@ -161,7 +161,7 @@ enum ZydisRegisters
/**
* @brief Defines the @c ZydisRegisterClass datatype.
*/
typedef uint8_t ZydisRegisterClass;
typedef ZydisU8 ZydisRegisterClass;
/**
* @brief Values that represent zydis register-classes.
@ -250,7 +250,7 @@ enum ZydisRegisterClasses
/**
* @brief Defines the @c ZydisRegisterWidth datatype.
*/
typedef uint16_t ZydisRegisterWidth;
typedef ZydisU16 ZydisRegisterWidth;
/* ---------------------------------------------------------------------------------------------- */
@ -267,7 +267,7 @@ typedef uint16_t ZydisRegisterWidth;
* @return The register specified by the @c registerClass and the @c id or @c ZYDIS_REGISTER_NONE,
* if an invalid parameter was passed.
*/
ZYDIS_EXPORT ZydisRegister ZydisRegisterEncode(ZydisRegisterClass registerClass, uint8_t id);
ZYDIS_EXPORT ZydisRegister ZydisRegisterEncode(ZydisRegisterClass registerClass, ZydisU8 id);
/**
* @brief Returns the id of the specified register.
@ -276,7 +276,7 @@ ZYDIS_EXPORT ZydisRegister ZydisRegisterEncode(ZydisRegisterClass registerClass,
*
* @return The id of the specified register, or -1 if an invalid parameter was passed.
*/
ZYDIS_EXPORT int16_t ZydisRegisterGetId(ZydisRegister reg);
ZYDIS_EXPORT ZydisI16 ZydisRegisterGetId(ZydisRegister reg);
/**
* @brief Returns the register-class of the specified register.

View File

@ -62,7 +62,7 @@ extern "C" {
/**
* @brief Defines the @c ZydisMachineMode datatype.
*/
typedef uint8_t ZydisMachineMode;
typedef ZydisU8 ZydisMachineMode;
/**
* @brief Values that represent machine modes.
@ -107,7 +107,7 @@ enum ZydisMachineModes
/**
* @brief Defines the @c ZydisAddressWidth datatype.
*/
typedef uint8_t ZydisAddressWidth;
typedef ZydisU8 ZydisAddressWidth;
/**
* @brief Values that represent address widths.
@ -128,7 +128,7 @@ enum ZydisAddressWidths
/**
* @brief Defines the @c ZydisElementType datatype.
*/
typedef uint8_t ZydisElementType;
typedef ZydisU8 ZydisElementType;
/**
* @brief Values that represent element-types.
@ -150,7 +150,7 @@ enum ZydisElementTypes
/**
* @brief Defines the @c ZydisElementSize datatype.
*/
typedef uint16_t ZydisElementSize;
typedef ZydisU16 ZydisElementSize;
/* ---------------------------------------------------------------------------------------------- */
/* Operand type */
@ -159,7 +159,7 @@ typedef uint16_t ZydisElementSize;
/**
* @brief Defines the @c ZydisOperandType datatype.
*/
typedef uint8_t ZydisOperandType;
typedef ZydisU8 ZydisOperandType;
/**
* @brief Values that represent operand-types.
@ -199,7 +199,7 @@ enum ZydisOperandTypes
/**
* @brief Defines the @c ZydisOperandEncoding datatype.
*/
typedef uint8_t ZydisOperandEncoding;
typedef ZydisU8 ZydisOperandEncoding;
/**
* @brief Values that represent operand-encodings.
@ -251,7 +251,7 @@ enum ZydisOperandEncodings
/**
* @brief Defines the @c ZydisOperandVisibility datatype.
*/
typedef uint8_t ZydisOperandVisibility;
typedef ZydisU8 ZydisOperandVisibility;
/**
* @brief Values that represent operand-visibilities.
@ -284,7 +284,7 @@ enum ZydisOperandVisibilities
/**
* @brief Defines the @c ZydisOperandAction datatype.
*/
typedef uint8_t ZydisOperandAction;
typedef ZydisU8 ZydisOperandAction;
/**
* @brief Values that represent operand-actions.
@ -347,7 +347,7 @@ enum ZydisOperandActions
/**
* @brief Defines the @c ZydisInstructionEncoding datatype.
*/
typedef uint8_t ZydisInstructionEncoding;
typedef ZydisU8 ZydisInstructionEncoding;
/**
* @brief Values that represent instruction-encodings.
@ -392,7 +392,7 @@ enum ZydisInstructionEncodings
/**
* @brief Defines the @c ZydisOpcodeMap map.
*/
typedef uint8_t ZydisOpcodeMap;
typedef ZydisU8 ZydisOpcodeMap;
/**
* @brief Values that represent opcode-maps.

View File

@ -45,7 +45,7 @@ extern "C" {
/**
* @brief Defines the @c ZydisStatus datatype.
*/
typedef uint32_t ZydisStatus;
typedef ZydisU32 ZydisStatus;
/**
* @brief Values that represent a zydis status-codes.

View File

@ -60,7 +60,7 @@ extern "C" {
* - The displacement needs to get truncated and zero extended
*/
ZYDIS_EXPORT ZydisStatus ZydisCalcAbsoluteAddress(const ZydisDecodedInstruction* instruction,
const ZydisDecodedOperand* operand, uint64_t* address);
const ZydisDecodedOperand* operand, ZydisU64* address);
/* ============================================================================================== */
/* Flags */

View File

@ -59,7 +59,7 @@ extern "C" {
/**
* @brief A macro that defines the zydis version.
*/
#define ZYDIS_VERSION (uint64_t)0x0002000000000000
#define ZYDIS_VERSION (ZydisU64)0x0002000000000000
/* ---------------------------------------------------------------------------------------------- */
/* Helper macros */
@ -70,28 +70,28 @@ extern "C" {
*
* @param version The zydis version value
*/
#define ZYDIS_VERSION_MAJOR(version) (uint16_t)((version & 0xFFFF000000000000) >> 48)
#define ZYDIS_VERSION_MAJOR(version) (ZydisU16)((version & 0xFFFF000000000000) >> 48)
/**
* @brief Extracts the minor-part of the zydis version.
*
* @param version The zydis version value
*/
#define ZYDIS_VERSION_MINOR(version) (uint16_t)((version & 0x0000FFFF00000000) >> 32)
#define ZYDIS_VERSION_MINOR(version) (ZydisU16)((version & 0x0000FFFF00000000) >> 32)
/**
* @brief Extracts the patch-part of the zydis version.
*
* @param version The zydis version value
*/
#define ZYDIS_VERSION_PATCH(version) (uint16_t)((version & 0x00000000FFFF0000) >> 16)
#define ZYDIS_VERSION_PATCH(version) (ZydisU16)((version & 0x00000000FFFF0000) >> 16)
/**
* @brief Extracts the build-part of the zydis version.
*
* @param version The zydis version value
*/
#define ZYDIS_VERSION_BUILD(version) (uint16_t)(version & 0x000000000000FFFF)
#define ZYDIS_VERSION_BUILD(version) (ZydisU16)(version & 0x000000000000FFFF)
/* ---------------------------------------------------------------------------------------------- */
@ -102,7 +102,7 @@ extern "C" {
/**
* @brief Defines the @c ZydisFeature datatype.
*/
typedef uint8_t ZydisFeature;
typedef ZydisU8 ZydisFeature;
/**
* @brief Values that represent zydis features.
@ -125,7 +125,7 @@ enum ZydisFeatures
* Use the macros provided in this file to extract the major, minor, patch and build part from the
* returned version value.
*/
ZYDIS_EXPORT uint64_t ZydisGetVersion();
ZYDIS_EXPORT ZydisU64 ZydisGetVersion();
/**
* @brief Checks, if the specified feature is enabled in the current zydis library instance.

View File

@ -51,15 +51,15 @@ typedef struct ZydisDecoderContext_
/**
* @brief The input buffer.
*/
const uint8_t* buffer;
const ZydisU8* buffer;
/**
* @brief The input buffer length.
*/
size_t bufferLen;
ZydisUSize bufferLen;
/**
* @brief Contains the last (significant) segment prefix.
*/
uint8_t lastSegmentPrefix;
ZydisU8 lastSegmentPrefix;
/**
* @brief Contains the prefix that should be treated as the mandatory-prefix, if the current
* instruction needs one.
@ -67,37 +67,37 @@ typedef struct ZydisDecoderContext_
* The last 0xF3/0xF2 prefix has precedence over previous ones and 0xF3/0xF2 in
* general has precedence over 0x66.
*/
uint8_t mandatoryCandidate;
ZydisU8 mandatoryCandidate;
uint8_t prefixes[ZYDIS_MAX_INSTRUCTION_LENGTH];
ZydisU8 prefixes[ZYDIS_MAX_INSTRUCTION_LENGTH];
/**
* @brief Contains the effective operand-size index.
*
* 0 = 16 bit, 1 = 32 bit, 2 = 64 bit
*/
uint8_t eoszIndex;
ZydisU8 eoszIndex;
/**
* @brief Contains the effective address-size index.
*
* 0 = 16 bit, 1 = 32 bit, 2 = 64 bit
*/
uint8_t easzIndex;
ZydisU8 easzIndex;
/**
* @brief Contains some cached REX/XOP/VEX/EVEX/MVEX values to provide uniform access.
*/
struct
{
uint8_t W;
uint8_t R;
uint8_t X;
uint8_t B;
uint8_t L;
uint8_t LL;
uint8_t R2;
uint8_t V2;
uint8_t v_vvvv;
uint8_t mask;
ZydisU8 W;
ZydisU8 R;
ZydisU8 X;
ZydisU8 B;
ZydisU8 L;
ZydisU8 LL;
ZydisU8 R2;
ZydisU8 V2;
ZydisU8 v_vvvv;
ZydisU8 mask;
} cache;
/**
* @brief Internal EVEX-specific information.
@ -111,7 +111,7 @@ typedef struct ZydisDecoderContext_
/**
* @brief The EVEX element-size.
*/
uint8_t elementSize;
ZydisU8 elementSize;
} evex;
/**
* @brief Internal MVEX-specific information.
@ -126,7 +126,7 @@ typedef struct ZydisDecoderContext_
/**
* @brief The scale factor for EVEX/MVEX compressed 8-bit displacement values.
*/
uint8_t cd8scale;
ZydisU8 cd8scale;
} ZydisDecoderContext;
/* ---------------------------------------------------------------------------------------------- */
@ -136,7 +136,7 @@ typedef struct ZydisDecoderContext_
/**
* @brief Defines the @c ZydisRegisterEncoding struct.
*/
typedef uint8_t ZydisRegisterEncoding;
typedef ZydisU8 ZydisRegisterEncoding;
/**
* @brief Values that represent register-encodings.
@ -224,7 +224,7 @@ enum ZydisRegisterEncodings
* data is available.
*/
static ZydisStatus ZydisInputPeek(ZydisDecoderContext* context,
ZydisDecodedInstruction* instruction, uint8_t* value)
ZydisDecodedInstruction* instruction, ZydisU8* value)
{
ZYDIS_ASSERT(context);
ZYDIS_ASSERT(instruction);
@ -278,7 +278,7 @@ static void ZydisInputSkip(ZydisDecoderContext* context, ZydisDecodedInstruction
* This function acts like a subsequent call of @c ZydisInputPeek and @c ZydisInputSkip.
*/
static ZydisStatus ZydisInputNext(ZydisDecoderContext* context,
ZydisDecodedInstruction* instruction, uint8_t* value)
ZydisDecodedInstruction* instruction, ZydisU8* value)
{
ZYDIS_ASSERT(context);
ZYDIS_ASSERT(instruction);
@ -315,7 +315,7 @@ static ZydisStatus ZydisInputNext(ZydisDecoderContext* context,
* This function acts like a subsequent call of @c ZydisInputPeek and @c ZydisInputSkip.
*/
static ZydisStatus ZydisInputNextBytes(ZydisDecoderContext* context,
ZydisDecodedInstruction* instruction, uint8_t* value, uint8_t numberOfBytes)
ZydisDecodedInstruction* instruction, ZydisU8* value, ZydisU8 numberOfBytes)
{
ZYDIS_ASSERT(context);
ZYDIS_ASSERT(instruction);
@ -353,7 +353,7 @@ static ZydisStatus ZydisInputNextBytes(ZydisDecoderContext* context,
* @param data The REX byte.
*/
static void ZydisDecodeREX(ZydisDecoderContext* context, ZydisDecodedInstruction* instruction,
uint8_t data)
ZydisU8 data)
{
ZYDIS_ASSERT(instruction);
ZYDIS_ASSERT((data & 0xF0) == 0x40);
@ -383,7 +383,7 @@ static void ZydisDecodeREX(ZydisDecoderContext* context, ZydisDecodedInstruction
* @return A zydis status code.
*/
static ZydisStatus ZydisDecodeXOP(ZydisDecoderContext* context,
ZydisDecodedInstruction* instruction, uint8_t data[3])
ZydisDecodedInstruction* instruction, ZydisU8 data[3])
{
ZYDIS_ASSERT(instruction);
ZYDIS_ASSERT(data[0] == 0x8F);
@ -432,7 +432,7 @@ static ZydisStatus ZydisDecodeXOP(ZydisDecoderContext* context,
* @return A zydis status code.
*/
static ZydisStatus ZydisDecodeVEX(ZydisDecoderContext* context,
ZydisDecodedInstruction* instruction, uint8_t data[3])
ZydisDecodedInstruction* instruction, ZydisU8 data[3])
{
ZYDIS_ASSERT(instruction);
ZYDIS_ASSERT((data[0] == 0xC4) || (data[0] == 0xC5));
@ -503,7 +503,7 @@ static ZydisStatus ZydisDecodeVEX(ZydisDecoderContext* context,
* @return A zydis status code.
*/
static ZydisStatus ZydisDecodeEVEX(ZydisDecoderContext* context,
ZydisDecodedInstruction* instruction, uint8_t data[4])
ZydisDecodedInstruction* instruction, ZydisU8 data[4])
{
ZYDIS_ASSERT(instruction);
ZYDIS_ASSERT(data[0] == 0x62);
@ -588,7 +588,7 @@ static ZydisStatus ZydisDecodeEVEX(ZydisDecoderContext* context,
* @return A zydis status code.
*/
static ZydisStatus ZydisDecodeMVEX(ZydisDecoderContext* context,
ZydisDecodedInstruction* instruction, uint8_t data[4])
ZydisDecodedInstruction* instruction, ZydisU8 data[4])
{
ZYDIS_ASSERT(instruction);
ZYDIS_ASSERT(data[0] == 0x62);
@ -643,7 +643,7 @@ static ZydisStatus ZydisDecodeMVEX(ZydisDecoderContext* context,
* @param instruction A pointer to the @c ZydisDecodedInstruction struct.
* @param data The modrm byte.
*/
static void ZydisDecodeModRM(ZydisDecodedInstruction* instruction, uint8_t data)
static void ZydisDecodeModRM(ZydisDecodedInstruction* instruction, ZydisU8 data)
{
ZYDIS_ASSERT(instruction);
@ -661,7 +661,7 @@ static void ZydisDecodeModRM(ZydisDecodedInstruction* instruction, uint8_t data)
* @param instruction A pointer to the @c ZydisDecodedInstruction struct
* @param data The sib byte.
*/
static void ZydisDecodeSIB(ZydisDecodedInstruction* instruction, uint8_t data)
static void ZydisDecodeSIB(ZydisDecodedInstruction* instruction, ZydisU8 data)
{
ZYDIS_ASSERT(instruction);
ZYDIS_ASSERT(instruction->raw.modrm.isDecoded);
@ -687,7 +687,7 @@ static void ZydisDecodeSIB(ZydisDecodedInstruction* instruction, uint8_t data)
* @return A zydis status code.
*/
static ZydisStatus ZydisReadDisplacement(ZydisDecoderContext* context,
ZydisDecodedInstruction* instruction, uint8_t size)
ZydisDecodedInstruction* instruction, ZydisU8 size)
{
ZYDIS_ASSERT(context);
ZYDIS_ASSERT(instruction);
@ -700,30 +700,30 @@ static ZydisStatus ZydisReadDisplacement(ZydisDecoderContext* context,
{
case 8:
{
uint8_t value;
ZydisU8 value;
ZYDIS_CHECK(ZydisInputNext(context, instruction, &value));
instruction->raw.disp.value = *(int8_t*)&value;
instruction->raw.disp.value = *(ZydisI8*)&value;
break;
}
case 16:
{
uint16_t value;
ZYDIS_CHECK(ZydisInputNextBytes(context, instruction, (uint8_t*)&value, 2));
instruction->raw.disp.value = *(int16_t*)&value;
ZydisU16 value;
ZYDIS_CHECK(ZydisInputNextBytes(context, instruction, (ZydisU8*)&value, 2));
instruction->raw.disp.value = *(ZydisI16*)&value;
break;
}
case 32:
{
uint32_t value;
ZYDIS_CHECK(ZydisInputNextBytes(context, instruction, (uint8_t*)&value, 4));
instruction->raw.disp.value = *(int32_t*)&value;
ZydisU32 value;
ZYDIS_CHECK(ZydisInputNextBytes(context, instruction, (ZydisU8*)&value, 4));
instruction->raw.disp.value = *(ZydisI32*)&value;
break;
}
case 64:
{
uint64_t value;
ZYDIS_CHECK(ZydisInputNextBytes(context, instruction, (uint8_t*)&value, 8));
instruction->raw.disp.value = *(int64_t*)&value;
ZydisU64 value;
ZYDIS_CHECK(ZydisInputNextBytes(context, instruction, (ZydisU8*)&value, 8));
instruction->raw.disp.value = *(ZydisI64*)&value;
break;
}
default:
@ -748,7 +748,7 @@ static ZydisStatus ZydisReadDisplacement(ZydisDecoderContext* context,
* @return A zydis status code.
*/
static ZydisStatus ZydisReadImmediate(ZydisDecoderContext* context,
ZydisDecodedInstruction* instruction, uint8_t id, uint8_t size, ZydisBool isSigned,
ZydisDecodedInstruction* instruction, ZydisU8 id, ZydisU8 size, ZydisBool isSigned,
ZydisBool isRelative)
{
ZYDIS_ASSERT(context);
@ -765,11 +765,11 @@ static ZydisStatus ZydisReadImmediate(ZydisDecoderContext* context,
{
case 8:
{
uint8_t value;
ZydisU8 value;
ZYDIS_CHECK(ZydisInputNext(context, instruction, &value));
if (isSigned)
{
instruction->raw.imm[id].value.s = (int8_t)value;
instruction->raw.imm[id].value.s = (ZydisI8)value;
} else
{
instruction->raw.imm[id].value.u = value;
@ -778,11 +778,11 @@ static ZydisStatus ZydisReadImmediate(ZydisDecoderContext* context,
}
case 16:
{
uint16_t value;
ZYDIS_CHECK(ZydisInputNextBytes(context, instruction, (uint8_t*)&value, 2));
ZydisU16 value;
ZYDIS_CHECK(ZydisInputNextBytes(context, instruction, (ZydisU8*)&value, 2));
if (isSigned)
{
instruction->raw.imm[id].value.s = (int16_t)value;
instruction->raw.imm[id].value.s = (ZydisI16)value;
} else
{
instruction->raw.imm[id].value.u = value;
@ -791,11 +791,11 @@ static ZydisStatus ZydisReadImmediate(ZydisDecoderContext* context,
}
case 32:
{
uint32_t value;
ZYDIS_CHECK(ZydisInputNextBytes(context, instruction, (uint8_t*)&value, 4));
ZydisU32 value;
ZYDIS_CHECK(ZydisInputNextBytes(context, instruction, (ZydisU8*)&value, 4));
if (isSigned)
{
instruction->raw.imm[id].value.s = (int32_t)value;
instruction->raw.imm[id].value.s = (ZydisI32)value;
} else
{
instruction->raw.imm[id].value.u = value;
@ -804,11 +804,11 @@ static ZydisStatus ZydisReadImmediate(ZydisDecoderContext* context,
}
case 64:
{
uint64_t value;
ZYDIS_CHECK(ZydisInputNextBytes(context, instruction, (uint8_t*)&value, 8));
ZydisU64 value;
ZYDIS_CHECK(ZydisInputNextBytes(context, instruction, (ZydisU8*)&value, 8));
if (isSigned)
{
instruction->raw.imm[id].value.s = (int64_t)value;
instruction->raw.imm[id].value.s = (ZydisI64)value;
} else
{
instruction->raw.imm[id].value.u = value;
@ -841,7 +841,7 @@ static ZydisStatus ZydisReadImmediate(ZydisDecoderContext* context,
* This function calculates the register-id by combining different fields and flags of previously
* decoded structs.
*/
static uint8_t ZydisCalcRegisterId(ZydisDecoderContext* context,
static ZydisU8 ZydisCalcRegisterId(ZydisDecoderContext* context,
ZydisDecodedInstruction* instruction, ZydisRegisterEncoding encoding,
ZydisRegisterClass registerClass)
{
@ -860,7 +860,7 @@ static uint8_t ZydisCalcRegisterId(ZydisDecoderContext* context,
(registerClass == ZYDIS_REGCLASS_GPR16) ||
(registerClass == ZYDIS_REGCLASS_GPR32) ||
(registerClass == ZYDIS_REGCLASS_GPR64));
uint8_t value = (instruction->opcode & 0x0F);
ZydisU8 value = (instruction->opcode & 0x0F);
if (value > 7)
{
value = value - 8;
@ -913,7 +913,7 @@ static uint8_t ZydisCalcRegisterId(ZydisDecoderContext* context,
(registerClass == ZYDIS_REGCLASS_GPR16) ||
(registerClass == ZYDIS_REGCLASS_GPR32) ||
(registerClass == ZYDIS_REGCLASS_GPR64));
uint8_t value = (instruction->opcode & 0x0F);
ZydisU8 value = (instruction->opcode & 0x0F);
if (value > 7)
{
value = value - 8;
@ -923,7 +923,7 @@ static uint8_t ZydisCalcRegisterId(ZydisDecoderContext* context,
case ZYDIS_REG_ENCODING_REG:
{
ZYDIS_ASSERT(instruction->raw.modrm.isDecoded);
uint8_t value = instruction->raw.modrm.reg;
ZydisU8 value = instruction->raw.modrm.reg;
switch (registerClass)
{
case ZYDIS_REGCLASS_GPR8:
@ -969,7 +969,7 @@ static uint8_t ZydisCalcRegisterId(ZydisDecoderContext* context,
case ZYDIS_REG_ENCODING_RM:
{
ZYDIS_ASSERT(instruction->raw.modrm.isDecoded);
uint8_t value = instruction->raw.modrm.rm;
ZydisU8 value = instruction->raw.modrm.rm;
switch (registerClass)
{
case ZYDIS_REGCLASS_GPR8:
@ -1030,7 +1030,7 @@ static uint8_t ZydisCalcRegisterId(ZydisDecoderContext* context,
(context->cache.V2 << 4);
case ZYDIS_REG_ENCODING_IS4:
{
uint8_t value = (instruction->raw.imm[0].value.u >> 4) & 0x0F;
ZydisU8 value = (instruction->raw.imm[0].value.u >> 4) & 0x0F;
// We have to check the instruction-encoding, because the extension by bit [3] is only
// valid for EVEX and MVEX instructions
if ((instruction->encoding == ZYDIS_INSTRUCTION_ENCODING_EVEX) ||
@ -1299,7 +1299,7 @@ static void ZydisSetOperandSizeAndElementInfo(ZydisDecoderContext* context,
* @return A zydis status code.
*/
static ZydisStatus ZydisDecodeOperandRegister(ZydisDecodedInstruction* instruction,
ZydisDecodedOperand* operand, ZydisRegisterClass registerClass, uint8_t registerId)
ZydisDecodedOperand* operand, ZydisRegisterClass registerClass, ZydisU8 registerId)
{
ZYDIS_ASSERT(instruction);
ZYDIS_ASSERT(operand);
@ -1371,8 +1371,8 @@ static ZydisStatus ZydisDecodeOperandMemory(ZydisDecoderContext* context,
operand->type = ZYDIS_OPERAND_TYPE_MEMORY;
operand->mem.type = ZYDIS_MEMOP_TYPE_MEM;
const uint8_t modrm_rm = instruction->raw.modrm.rm;
uint8_t displacementSize = 0;
const ZydisU8 modrm_rm = instruction->raw.modrm.rm;
ZydisU8 displacementSize = 0;
switch (instruction->addressWidth)
{
case 16:
@ -1675,13 +1675,13 @@ static ZydisStatus ZydisDecodeOperands(ZydisDecoderContext* context,
ZYDIS_ASSERT(instruction);
ZYDIS_ASSERT(definition);
uint8_t immId = 0;
ZydisU8 immId = 0;
const ZydisOperandDefinition* operand;
instruction->operandCount = ZydisGetOperandDefinitions(definition, &operand);
ZYDIS_ASSERT(instruction->operandCount <= ZYDIS_ARRAY_SIZE(instruction->operands));
for (uint8_t i = 0; i < instruction->operandCount; ++i)
for (ZydisU8 i = 0; i < instruction->operandCount; ++i)
{
instruction->operands[i].id = i;
instruction->operands[i].visibility = operand->visibility;
@ -1864,8 +1864,8 @@ static ZydisStatus ZydisDecodeOperands(ZydisDecoderContext* context,
(instruction->raw.imm[0].size == 32));
ZYDIS_ASSERT( instruction->raw.imm[1].size == 16);
instruction->operands[i].type = ZYDIS_OPERAND_TYPE_POINTER;
instruction->operands[i].ptr.offset = (uint32_t)instruction->raw.imm[0].value.u;
instruction->operands[i].ptr.segment = (uint16_t)instruction->raw.imm[1].value.u;
instruction->operands[i].ptr.offset = (ZydisU32)instruction->raw.imm[0].value.u;
instruction->operands[i].ptr.segment = (ZydisU16)instruction->raw.imm[1].value.u;
break;
case ZYDIS_SEMANTIC_OPTYPE_AGEN:
instruction->operands[i].action = ZYDIS_OPERAND_ACTION_INVALID;
@ -1923,7 +1923,7 @@ static ZydisStatus ZydisDecodeOperands(ZydisDecoderContext* context,
// The upper half of the 8-bit immediate is used to encode a register specifier
ZYDIS_ASSERT(instruction->raw.imm[immId].size == 8);
instruction->operands[i].imm.value.u =
(uint8_t)instruction->raw.imm[immId].value.u & 0x0F;
(ZydisU8)instruction->raw.imm[immId].value.u & 0x0F;
} else
{
instruction->operands[i].imm.value.u = instruction->raw.imm[immId].value.u;
@ -2347,7 +2347,7 @@ static void ZydisSetAVXInformation(ZydisDecoderContext* context,
(const ZydisInstructionDefinitionEVEX*)definition;
// Vector length
uint8_t vectorLength = context->cache.LL;
ZydisU8 vectorLength = context->cache.LL;
if (def->vectorLength)
{
vectorLength = def->vectorLength - 1;
@ -2749,7 +2749,7 @@ static void ZydisSetAVXInformation(ZydisDecoderContext* context,
(const ZydisInstructionDefinitionMVEX*)definition;
// Static broadcast-factor
uint8_t index = def->hasElementGranularity;
ZydisU8 index = def->hasElementGranularity;
ZYDIS_ASSERT(!index || !def->broadcast);
if (!index && def->broadcast)
{
@ -2799,7 +2799,7 @@ static void ZydisSetAVXInformation(ZydisDecoderContext* context,
case ZYDIS_MVEX_FUNC_SF_32_BCST_4TO16:
case ZYDIS_MVEX_FUNC_UF_32:
{
static const uint8_t lookup[3][8] =
static const ZydisU8 lookup[3][8] =
{
{ 64, 4, 16, 32, 16, 16, 32, 32 },
{ 4, 0, 0, 2, 1, 1, 2, 2 },
@ -2814,7 +2814,7 @@ static void ZydisSetAVXInformation(ZydisDecoderContext* context,
case ZYDIS_MVEX_FUNC_SI_32_BCST:
case ZYDIS_MVEX_FUNC_SI_32_BCST_4TO16:
{
static const uint8_t lookup[3][8] =
static const ZydisU8 lookup[3][8] =
{
{ 64, 4, 16, 0, 16, 16, 32, 32 },
{ 4, 0, 0, 0, 1, 1, 2, 2 },
@ -2829,7 +2829,7 @@ static void ZydisSetAVXInformation(ZydisDecoderContext* context,
case ZYDIS_MVEX_FUNC_SI_64:
case ZYDIS_MVEX_FUNC_UI_64:
{
static const uint8_t lookup[3][3] =
static const ZydisU8 lookup[3][3] =
{
{ 64, 8, 32 },
{ 8, 0, 0 },
@ -2842,7 +2842,7 @@ static void ZydisSetAVXInformation(ZydisDecoderContext* context,
case ZYDIS_MVEX_FUNC_DF_32:
case ZYDIS_MVEX_FUNC_DI_32:
{
static const uint8_t lookup[2][8] =
static const ZydisU8 lookup[2][8] =
{
{ 64, 0, 0, 32, 16, 16, 32, 32 },
{ 4, 0, 0, 2, 1, 1, 2, 2 }
@ -2854,7 +2854,7 @@ static void ZydisSetAVXInformation(ZydisDecoderContext* context,
case ZYDIS_MVEX_FUNC_DF_64:
case ZYDIS_MVEX_FUNC_DI_64:
{
static const uint8_t lookup[2][1] =
static const ZydisU8 lookup[2][1] =
{
{ 64 },
{ 8 }
@ -3069,7 +3069,7 @@ static ZydisStatus ZydisCollectOptionalPrefixes(ZydisDecoderContext* context,
ZydisBool done = ZYDIS_FALSE;
do
{
uint8_t prefixByte;
ZydisU8 prefixByte;
ZYDIS_CHECK(ZydisInputPeek(context, instruction, &prefixByte));
switch (prefixByte)
{
@ -3188,12 +3188,12 @@ static ZydisStatus ZydisDecodeOptionalInstructionParts(ZydisDecoderContext* cont
{
if (!instruction->raw.modrm.isDecoded)
{
uint8_t modrmByte;
ZydisU8 modrmByte;
ZYDIS_CHECK(ZydisInputNext(context, instruction, &modrmByte));
ZydisDecodeModRM(instruction, modrmByte);
}
uint8_t hasSIB = 0;
uint8_t displacementSize = 0;
ZydisU8 hasSIB = 0;
ZydisU8 displacementSize = 0;
if (!(info->flags & ZYDIS_INSTR_ENC_FLAG_FORCE_REG_FORM))
{
switch (instruction->addressWidth)
@ -3252,7 +3252,7 @@ static ZydisStatus ZydisDecodeOptionalInstructionParts(ZydisDecoderContext* cont
}
if (hasSIB)
{
uint8_t sibByte;
ZydisU8 sibByte;
ZYDIS_CHECK(ZydisInputNext(context, instruction, &sibByte));
ZydisDecodeSIB(instruction, sibByte);
if (instruction->raw.sib.base == 5)
@ -3309,7 +3309,7 @@ static void ZydisSetEffectiveOperandSize(ZydisDecoderContext* context,
ZYDIS_ASSERT(instruction);
ZYDIS_ASSERT(definition);
static const uint8_t operandSizeMap[8][8] =
static const ZydisU8 operandSizeMap[8][8] =
{
// Default for most instructions
{
@ -3402,7 +3402,7 @@ static void ZydisSetEffectiveOperandSize(ZydisDecoderContext* context,
}
};
uint8_t index = (instruction->attributes & ZYDIS_ATTRIB_HAS_OPERANDSIZE) ? 1 : 0;
ZydisU8 index = (instruction->attributes & ZYDIS_ATTRIB_HAS_OPERANDSIZE) ? 1 : 0;
switch (context->decoder->machineMode)
{
case ZYDIS_MACHINE_MODE_LONG_COMPAT_16:
@ -3498,7 +3498,7 @@ static void ZydisSetEffectiveAddressWidth(ZydisDecoderContext* context,
/* ---------------------------------------------------------------------------------------------- */
static ZydisStatus ZydisNodeHandlerXOP(ZydisDecodedInstruction* instruction, uint16_t* index)
static ZydisStatus ZydisNodeHandlerXOP(ZydisDecodedInstruction* instruction, ZydisU16* index)
{
ZYDIS_ASSERT(instruction);
ZYDIS_ASSERT(index);
@ -3518,7 +3518,7 @@ static ZydisStatus ZydisNodeHandlerXOP(ZydisDecodedInstruction* instruction, uin
return ZYDIS_STATUS_SUCCESS;
}
static ZydisStatus ZydisNodeHandlerVEX(ZydisDecodedInstruction* instruction, uint16_t* index)
static ZydisStatus ZydisNodeHandlerVEX(ZydisDecodedInstruction* instruction, ZydisU16* index)
{
ZYDIS_ASSERT(instruction);
ZYDIS_ASSERT(index);
@ -3538,7 +3538,7 @@ static ZydisStatus ZydisNodeHandlerVEX(ZydisDecodedInstruction* instruction, uin
return ZYDIS_STATUS_SUCCESS;
}
static ZydisStatus ZydisNodeHandlerEMVEX(ZydisDecodedInstruction* instruction, uint16_t* index)
static ZydisStatus ZydisNodeHandlerEMVEX(ZydisDecodedInstruction* instruction, ZydisU16* index)
{
ZYDIS_ASSERT(instruction);
ZYDIS_ASSERT(index);
@ -3563,7 +3563,7 @@ static ZydisStatus ZydisNodeHandlerEMVEX(ZydisDecodedInstruction* instruction, u
}
static ZydisStatus ZydisNodeHandlerOpcode(ZydisDecoderContext* context,
ZydisDecodedInstruction* instruction, uint16_t* index)
ZydisDecodedInstruction* instruction, ZydisU16* index)
{
ZYDIS_ASSERT(context);
ZYDIS_ASSERT(instruction);
@ -3586,7 +3586,7 @@ static ZydisStatus ZydisNodeHandlerOpcode(ZydisDecoderContext* context,
case 0xC5:
case 0x62:
{
uint8_t nextInput;
ZydisU8 nextInput;
ZYDIS_CHECK(ZydisInputPeek(context, instruction, &nextInput));
if (((nextInput & 0xF0) >= 0xC0) ||
(context->decoder->machineMode == ZYDIS_MACHINE_MODE_LONG_64))
@ -3599,7 +3599,7 @@ static ZydisStatus ZydisNodeHandlerOpcode(ZydisDecoderContext* context,
{
return ZYDIS_STATUS_ILLEGAL_LEGACY_PFX;
}
uint8_t prefixBytes[4] = { 0, 0, 0, 0 };
ZydisU8 prefixBytes[4] = { 0, 0, 0, 0 };
prefixBytes[0] = instruction->opcode;
switch (instruction->opcode)
{
@ -3669,7 +3669,7 @@ static ZydisStatus ZydisNodeHandlerOpcode(ZydisDecoderContext* context,
}
case 0x8F:
{
uint8_t nextInput;
ZydisU8 nextInput;
ZYDIS_CHECK(ZydisInputPeek(context, instruction, &nextInput));
if ((nextInput & 0x1F) >= 8)
{
@ -3681,7 +3681,7 @@ static ZydisStatus ZydisNodeHandlerOpcode(ZydisDecoderContext* context,
{
return ZYDIS_STATUS_ILLEGAL_LEGACY_PFX;
}
uint8_t prefixBytes[3] = { 0x8F, 0x00, 0x00 };
ZydisU8 prefixBytes[3] = { 0x8F, 0x00, 0x00 };
// Read additional xop-prefix data
ZYDIS_CHECK(ZydisInputNextBytes(context, instruction, &prefixBytes[1], 2));
// Decode xop-prefix
@ -3738,7 +3738,7 @@ static ZydisStatus ZydisNodeHandlerOpcode(ZydisDecoderContext* context,
return ZYDIS_STATUS_SUCCESS;
}
static ZydisStatus ZydisNodeHandlerMode(ZydisDecoderContext* context, uint16_t* index)
static ZydisStatus ZydisNodeHandlerMode(ZydisDecoderContext* context, ZydisU16* index)
{
ZYDIS_ASSERT(context);
ZYDIS_ASSERT(index);
@ -3763,7 +3763,7 @@ static ZydisStatus ZydisNodeHandlerMode(ZydisDecoderContext* context, uint16_t*
return ZYDIS_STATUS_SUCCESS;
}
static ZydisStatus ZydisNodeHandlerModeCompact(ZydisDecoderContext* context, uint16_t* index)
static ZydisStatus ZydisNodeHandlerModeCompact(ZydisDecoderContext* context, ZydisU16* index)
{
ZYDIS_ASSERT(context);
ZYDIS_ASSERT(index);
@ -3773,7 +3773,7 @@ static ZydisStatus ZydisNodeHandlerModeCompact(ZydisDecoderContext* context, uin
}
static ZydisStatus ZydisNodeHandlerModrmMod(ZydisDecoderContext* context,
ZydisDecodedInstruction* instruction, uint16_t* index)
ZydisDecodedInstruction* instruction, ZydisU16* index)
{
ZYDIS_ASSERT(context);
ZYDIS_ASSERT(instruction);
@ -3781,7 +3781,7 @@ static ZydisStatus ZydisNodeHandlerModrmMod(ZydisDecoderContext* context,
if (!instruction->raw.modrm.isDecoded)
{
uint8_t modrmByte;
ZydisU8 modrmByte;
ZYDIS_CHECK(ZydisInputNext(context, instruction, &modrmByte));
ZydisDecodeModRM(instruction, modrmByte);
}
@ -3790,7 +3790,7 @@ static ZydisStatus ZydisNodeHandlerModrmMod(ZydisDecoderContext* context,
}
static ZydisStatus ZydisNodeHandlerModrmModCompact(ZydisDecoderContext* context,
ZydisDecodedInstruction* instruction, uint16_t* index)
ZydisDecodedInstruction* instruction, ZydisU16* index)
{
ZYDIS_CHECK(ZydisNodeHandlerModrmMod(context, instruction, index));
*index = (*index == 0x3) ? 0 : 1;
@ -3798,7 +3798,7 @@ static ZydisStatus ZydisNodeHandlerModrmModCompact(ZydisDecoderContext* context,
}
static ZydisStatus ZydisNodeHandlerModrmReg(ZydisDecoderContext* context,
ZydisDecodedInstruction* instruction, uint16_t* index)
ZydisDecodedInstruction* instruction, ZydisU16* index)
{
ZYDIS_ASSERT(context);
ZYDIS_ASSERT(instruction);
@ -3806,7 +3806,7 @@ static ZydisStatus ZydisNodeHandlerModrmReg(ZydisDecoderContext* context,
if (!instruction->raw.modrm.isDecoded)
{
uint8_t modrmByte;
ZydisU8 modrmByte;
ZYDIS_CHECK(ZydisInputNext(context, instruction, &modrmByte));
ZydisDecodeModRM(instruction, modrmByte);
}
@ -3815,7 +3815,7 @@ static ZydisStatus ZydisNodeHandlerModrmReg(ZydisDecoderContext* context,
}
static ZydisStatus ZydisNodeHandlerModrmRm(ZydisDecoderContext* context,
ZydisDecodedInstruction* instruction, uint16_t* index)
ZydisDecodedInstruction* instruction, ZydisU16* index)
{
ZYDIS_ASSERT(context);
ZYDIS_ASSERT(instruction);
@ -3823,7 +3823,7 @@ static ZydisStatus ZydisNodeHandlerModrmRm(ZydisDecoderContext* context,
if (!instruction->raw.modrm.isDecoded)
{
uint8_t modrmByte;
ZydisU8 modrmByte;
ZYDIS_CHECK(ZydisInputNext(context, instruction, &modrmByte));
ZydisDecodeModRM(instruction, modrmByte);
}
@ -3832,7 +3832,7 @@ static ZydisStatus ZydisNodeHandlerModrmRm(ZydisDecoderContext* context,
}
static ZydisStatus ZydisNodeHandlerMandatoryPrefix(ZydisDecoderContext* context,
ZydisDecodedInstruction* instruction, uint16_t* index)
ZydisDecodedInstruction* instruction, ZydisU16* index)
{
ZYDIS_ASSERT(context);
ZYDIS_ASSERT(instruction);
@ -3860,7 +3860,7 @@ static ZydisStatus ZydisNodeHandlerMandatoryPrefix(ZydisDecoderContext* context,
}
static ZydisStatus ZydisNodeHandlerOperandSize(ZydisDecoderContext* context,
ZydisDecodedInstruction* instruction, uint16_t* index)
ZydisDecodedInstruction* instruction, ZydisU16* index)
{
ZYDIS_ASSERT(context);
ZYDIS_ASSERT(instruction);
@ -3892,7 +3892,7 @@ static ZydisStatus ZydisNodeHandlerOperandSize(ZydisDecoderContext* context,
}
static ZydisStatus ZydisNodeHandlerAddressSize(ZydisDecoderContext* context,
ZydisDecodedInstruction* instruction, uint16_t* index)
ZydisDecodedInstruction* instruction, ZydisU16* index)
{
ZYDIS_ASSERT(context);
ZYDIS_ASSERT(instruction);
@ -3916,7 +3916,7 @@ static ZydisStatus ZydisNodeHandlerAddressSize(ZydisDecoderContext* context,
}
static ZydisStatus ZydisNodeHandlerVectorLength(ZydisDecoderContext* context,
ZydisDecodedInstruction* instruction, uint16_t* index)
ZydisDecodedInstruction* instruction, ZydisU16* index)
{
ZYDIS_ASSERT(context);
ZYDIS_ASSERT(instruction);
@ -3948,7 +3948,7 @@ static ZydisStatus ZydisNodeHandlerVectorLength(ZydisDecoderContext* context,
}
static ZydisStatus ZydisNodeHandlerRexW(ZydisDecoderContext* context,
ZydisDecodedInstruction* instruction, uint16_t* index)
ZydisDecodedInstruction* instruction, ZydisU16* index)
{
ZYDIS_ASSERT(context);
ZYDIS_ASSERT(instruction);
@ -3979,7 +3979,7 @@ static ZydisStatus ZydisNodeHandlerRexW(ZydisDecoderContext* context,
}
static ZydisStatus ZydisNodeHandlerRexB(ZydisDecoderContext* context,
ZydisDecodedInstruction* instruction, uint16_t* index)
ZydisDecodedInstruction* instruction, ZydisU16* index)
{
ZYDIS_ASSERT(context);
ZYDIS_ASSERT(instruction);
@ -4009,7 +4009,7 @@ static ZydisStatus ZydisNodeHandlerRexB(ZydisDecoderContext* context,
return ZYDIS_STATUS_SUCCESS;
}
static ZydisStatus ZydisNodeHandlerEvexB(ZydisDecodedInstruction* instruction, uint16_t* index)
static ZydisStatus ZydisNodeHandlerEvexB(ZydisDecodedInstruction* instruction, ZydisU16* index)
{
ZYDIS_ASSERT(instruction);
ZYDIS_ASSERT(index);
@ -4020,7 +4020,7 @@ static ZydisStatus ZydisNodeHandlerEvexB(ZydisDecodedInstruction* instruction, u
return ZYDIS_STATUS_SUCCESS;
}
static ZydisStatus ZydisNodeHandlerMvexE(ZydisDecodedInstruction* instruction, uint16_t* index)
static ZydisStatus ZydisNodeHandlerMvexE(ZydisDecodedInstruction* instruction, ZydisU16* index)
{
ZYDIS_ASSERT(instruction);
ZYDIS_ASSERT(index);
@ -4108,7 +4108,7 @@ static ZydisStatus ZydisCheckErrorConditions(ZydisDecoderContext* context,
maskPolicy = def->maskPolicy;
// Check for invalid MVEX.SSS values
static const uint8_t lookup[26][8] =
static const ZydisU8 lookup[26][8] =
{
// ZYDIS_MVEX_FUNC_IGNORED
{ 1, 1, 1, 1, 1, 1, 1, 1 },
@ -4242,7 +4242,7 @@ static ZydisStatus ZydisDecodeInstruction(ZydisDecoderContext* context,
do
{
nodeType = node->type;
uint16_t index = 0;
ZydisU16 index = 0;
ZydisStatus status = 0;
switch (nodeType)
{
@ -4466,7 +4466,7 @@ ZydisStatus ZydisDecoderEnableMode(ZydisDecoder* decoder, ZydisDecoderMode mode,
}
ZydisStatus ZydisDecoderDecodeBuffer(const ZydisDecoder* decoder, const void* buffer,
size_t bufferLen, uint64_t instructionPointer, ZydisDecodedInstruction* instruction)
ZydisUSize bufferLen, ZydisU64 instructionPointer, ZydisDecodedInstruction* instruction)
{
if (!decoder || !instruction)
{
@ -4481,7 +4481,7 @@ ZydisStatus ZydisDecoderDecodeBuffer(const ZydisDecoder* decoder, const void* bu
ZydisDecoderContext context;
ZydisMemorySet(&context.cache, 0, sizeof(context.cache));
context.decoder = decoder;
context.buffer = (uint8_t*)buffer;
context.buffer = (ZydisU8*)buffer;
context.bufferLen = bufferLen;
context.lastSegmentPrefix = 0;
context.mandatoryCandidate = 0;

View File

@ -275,7 +275,7 @@ const ZydisDecoderTreeNode* ZydisDecoderTreeGetRootNode()
}
const ZydisDecoderTreeNode* ZydisDecoderTreeGetChildNode(const ZydisDecoderTreeNode* parent,
uint16_t index)
ZydisU16 index)
{
switch (parent->type)
{
@ -360,7 +360,7 @@ void ZydisGetInstructionEncodingInfo(const ZydisDecoderTreeNode* node,
const ZydisInstructionEncodingInfo** info)
{
ZYDIS_ASSERT(node->type & ZYDIS_NODETYPE_DEFINITION_MASK);
uint8_t class = (node->type) & 0x7F;
ZydisU8 class = (node->type) & 0x7F;
ZYDIS_ASSERT(class < ZYDIS_ARRAY_SIZE(instructionEncodings));
*info = &instructionEncodings[class];
}

View File

@ -53,7 +53,7 @@ extern "C" {
/**
* @brief Defines the @c ZydisDecoderTreeNodeType datatype.
*/
typedef uint8_t ZydisDecoderTreeNodeType;
typedef ZydisU8 ZydisDecoderTreeNodeType;
/**
* @brief Values that represent zydis decoder tree node types.
@ -168,7 +168,7 @@ enum ZydisDecoderTreeNodeTypes
/**
* @brief Defines the @c ZydisDecoderTreeNodeValue datatype.
*/
typedef uint16_t ZydisDecoderTreeNodeValue;
typedef ZydisU16 ZydisDecoderTreeNodeValue;
/* ---------------------------------------------------------------------------------------------- */
@ -196,7 +196,7 @@ typedef struct ZydisDecoderTreeNode_
/**
* @brief Defines the @c ZydisInstructionEncodingFlags datatype.
*/
typedef uint8_t ZydisInstructionEncodingFlags;
typedef ZydisU8 ZydisInstructionEncodingFlags;
/**
* @brief The instruction has an optional modrm byte.
@ -243,7 +243,7 @@ typedef struct ZydisInstructionEncodingInfo_
/**
* @brief The size of the displacement value.
*/
uint8_t size[3];
ZydisU8 size[3];
} disp;
/**
* @brief Immediate info.
@ -253,7 +253,7 @@ typedef struct ZydisInstructionEncodingInfo_
/**
* @brief The size of the immediate value.
*/
uint8_t size[3];
ZydisU8 size[3];
/**
* @brief Signals, if the value is signed.
*/
@ -291,7 +291,7 @@ ZYDIS_NO_EXPORT const ZydisDecoderTreeNode* ZydisDecoderTreeGetRootNode();
* @return The specified child node.
*/
ZYDIS_NO_EXPORT const ZydisDecoderTreeNode* ZydisDecoderTreeGetChildNode(
const ZydisDecoderTreeNode* parent, uint16_t index);
const ZydisDecoderTreeNode* parent, ZydisU16 index);
/**
* @brief Returns information about optional instruction parts (like modrm, displacement or

View File

@ -68,13 +68,13 @@ static const char* decimalLookup =
/* Internal Functions */
/* ---------------------------------------------------------------------------------------------- */
void ZydisToLowerCase(char* buffer, size_t bufferLen)
void ZydisToLowerCase(char* buffer, ZydisUSize bufferLen)
{
ZYDIS_ASSERT(buffer);
ZYDIS_ASSERT(bufferLen);
const signed char rebase = 'a' - 'A';
for (size_t i = 0; i < bufferLen; ++i)
for (ZydisUSize i = 0; i < bufferLen; ++i)
{
char* c = buffer + i;
if ((*c >= 'A') && (*c <= 'Z'))
@ -84,13 +84,13 @@ void ZydisToLowerCase(char* buffer, size_t bufferLen)
}
}
void ZydisToUpperCase(char* buffer, size_t bufferLen)
void ZydisToUpperCase(char* buffer, ZydisUSize bufferLen)
{
ZYDIS_ASSERT(buffer);
ZYDIS_ASSERT(bufferLen);
const signed char rebase = 'A' - 'a';
for (size_t i = 0; i < bufferLen; ++i)
for (ZydisUSize i = 0; i < bufferLen; ++i)
{
char* c = buffer + i;
if ((*c >= 'a') && (*c <= 'z'))
@ -101,7 +101,7 @@ void ZydisToUpperCase(char* buffer, size_t bufferLen)
}
#ifdef ZYDIS_X86
ZydisStatus ZydisPrintDecU32(char** buffer, size_t bufferLen, uint32_t value, uint8_t paddingLength)
ZydisStatus ZydisPrintDecU32(char** buffer, ZydisUSize bufferLen, ZydisU32 value, ZydisU8 paddingLength)
{
ZYDIS_ASSERT(buffer);
ZYDIS_ASSERT(bufferLen > 0);
@ -111,21 +111,21 @@ ZydisStatus ZydisPrintDecU32(char** buffer, size_t bufferLen, uint32_t value, ui
*p = '\0';
while (value >= 100)
{
uint32_t const old = value;
ZydisU32 const old = value;
p -= 2;
value /= 100;
ZydisMemoryCopy(p, &decimalLookup[(old - (value * 100)) * 2], sizeof(uint16_t));
ZydisMemoryCopy(p, &decimalLookup[(old - (value * 100)) * 2], sizeof(ZydisU16));
}
p -= 2;
ZydisMemoryCopy(p, &decimalLookup[value * 2], sizeof(uint16_t));
ZydisMemoryCopy(p, &decimalLookup[value * 2], sizeof(ZydisU16));
const size_t n = &temp[ZYDIS_MAXCHARS_DEC_32] - p;
if ((bufferLen < (size_t)(n + 1)) || (bufferLen < (size_t)(paddingLength + 1)))
const ZydisUSize n = &temp[ZYDIS_MAXCHARS_DEC_32] - p;
if ((bufferLen < (ZydisUSize)(n + 1)) || (bufferLen < (ZydisUSize)(paddingLength + 1)))
{
return ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE;
}
uintptr_t offset = 0;
ZydisUSize offset = 0;
if (n <= paddingLength)
{
offset = paddingLength - n + 1;
@ -133,12 +133,12 @@ ZydisStatus ZydisPrintDecU32(char** buffer, size_t bufferLen, uint32_t value, ui
}
ZydisMemoryCopy(&(*buffer)[offset], &p[value < 10], n + 1);
*buffer += n + offset - (uint8_t)(value < 10);
*buffer += n + offset - (ZydisU8)(value < 10);
return ZYDIS_STATUS_SUCCESS;
}
ZydisStatus ZydisPrintHexU32(char** buffer, size_t bufferLen, uint32_t value, uint8_t paddingLength,
ZydisStatus ZydisPrintHexU32(char** buffer, ZydisUSize bufferLen, ZydisU32 value, ZydisU8 paddingLength,
ZydisBool uppercase, const char* prefix, const char* suffix)
{
ZYDIS_ASSERT(buffer);
@ -150,16 +150,16 @@ ZydisStatus ZydisPrintHexU32(char** buffer, size_t bufferLen, uint32_t value, ui
ZYDIS_CHECK(ZydisPrintStr(buffer, bufferLen, prefix, ZYDIS_LETTER_CASE_DEFAULT));
bufferLen = bufEnd - *buffer;
}
if (bufferLen < (size_t)(paddingLength + 1))
if (bufferLen < (ZydisUSize)(paddingLength + 1))
{
return ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE;
}
if (!value)
{
const uint8_t n = (paddingLength ? paddingLength : 1);
const ZydisU8 n = (paddingLength ? paddingLength : 1);
if (bufferLen < (size_t)(n + 1))
if (bufferLen < (ZydisUSize)(n + 1))
{
return ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE;
}
@ -170,17 +170,17 @@ ZydisStatus ZydisPrintHexU32(char** buffer, size_t bufferLen, uint32_t value, ui
return ZYDIS_STATUS_SUCCESS;
}
uint8_t n = 0;
for (int8_t i = ZYDIS_MAXCHARS_HEX_32 - 1; i >= 0; --i)
ZydisU8 n = 0;
for (ZydisI8 i = ZYDIS_MAXCHARS_HEX_32 - 1; i >= 0; --i)
{
const uint8_t v = (value >> i * 4) & 0x0F;
const ZydisU8 v = (value >> i * 4) & 0x0F;
if (!n)
{
if (!v)
{
continue;
}
if (bufferLen <= (uint8_t)(i + 1))
if (bufferLen <= (ZydisU8)(i + 1))
{
return ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE;
}
@ -210,7 +210,7 @@ ZydisStatus ZydisPrintHexU32(char** buffer, size_t bufferLen, uint32_t value, ui
}
#endif
ZydisStatus ZydisPrintDecU64(char** buffer, size_t bufferLen, uint64_t value, uint8_t paddingLength)
ZydisStatus ZydisPrintDecU64(char** buffer, ZydisUSize bufferLen, ZydisU64 value, ZydisU8 paddingLength)
{
ZYDIS_ASSERT(buffer);
ZYDIS_ASSERT(bufferLen > 0);
@ -220,7 +220,7 @@ ZydisStatus ZydisPrintDecU64(char** buffer, size_t bufferLen, uint64_t value, ui
*p = '\0';
while (value >= 100)
{
uint64_t const old = value;
ZydisU64 const old = value;
p -= 2;
value /= 100;
ZydisMemoryCopy(p, &decimalLookup[(old - (value * 100)) * 2], 2);
@ -228,13 +228,13 @@ ZydisStatus ZydisPrintDecU64(char** buffer, size_t bufferLen, uint64_t value, ui
p -= 2;
ZydisMemoryCopy(p, &decimalLookup[value * 2], 2);
const size_t n = &temp[ZYDIS_MAXCHARS_DEC_64] - p;
if ((bufferLen < (size_t)(n + 1)) || (bufferLen < (size_t)(paddingLength + 1)))
const ZydisUSize n = &temp[ZYDIS_MAXCHARS_DEC_64] - p;
if ((bufferLen < (ZydisUSize)(n + 1)) || (bufferLen < (ZydisUSize)(paddingLength + 1)))
{
return ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE;
}
uintptr_t offset = 0;
ZydisUSize offset = 0;
if (n <= paddingLength)
{
offset = paddingLength - n + 1;
@ -242,12 +242,12 @@ ZydisStatus ZydisPrintDecU64(char** buffer, size_t bufferLen, uint64_t value, ui
}
ZydisMemoryCopy(&(*buffer)[offset], &p[value < 10], n + 1);
*buffer += n + offset - (uint8_t)(value < 10);
*buffer += n + offset - (ZydisU8)(value < 10);
return ZYDIS_STATUS_SUCCESS;
}
ZydisStatus ZydisPrintHexU64(char** buffer, size_t bufferLen, uint64_t value, uint8_t paddingLength,
ZydisStatus ZydisPrintHexU64(char** buffer, ZydisUSize bufferLen, ZydisU64 value, ZydisU8 paddingLength,
ZydisBool uppercase, const char* prefix, const char* suffix)
{
ZYDIS_ASSERT(buffer);
@ -259,16 +259,16 @@ ZydisStatus ZydisPrintHexU64(char** buffer, size_t bufferLen, uint64_t value, ui
ZYDIS_CHECK(ZydisPrintStr(buffer, bufferLen, prefix, ZYDIS_LETTER_CASE_DEFAULT));
bufferLen = bufEnd - *buffer;
}
if (bufferLen < (size_t)(paddingLength + 1))
if (bufferLen < (ZydisUSize)(paddingLength + 1))
{
return ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE;
}
if (!value)
{
const uint8_t n = (paddingLength ? paddingLength : 1);
const ZydisU8 n = (paddingLength ? paddingLength : 1);
if (bufferLen < (size_t)(n + 1))
if (bufferLen < (ZydisUSize)(n + 1))
{
return ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE;
}
@ -279,18 +279,18 @@ ZydisStatus ZydisPrintHexU64(char** buffer, size_t bufferLen, uint64_t value, ui
return ZYDIS_STATUS_SUCCESS;
}
uint8_t n = 0;
const uint8_t c = ((value & 0xFFFFFFFF00000000) ? ZYDIS_MAXCHARS_HEX_64 : ZYDIS_MAXCHARS_HEX_32);
for (int8_t i = c - 1; i >= 0; --i)
ZydisU8 n = 0;
const ZydisU8 c = ((value & 0xFFFFFFFF00000000) ? ZYDIS_MAXCHARS_HEX_64 : ZYDIS_MAXCHARS_HEX_32);
for (ZydisI8 i = c - 1; i >= 0; --i)
{
const uint8_t v = (value >> i * 4) & 0x0F;
const ZydisU8 v = (value >> i * 4) & 0x0F;
if (!n)
{
if (!v)
{
continue;
}
if (bufferLen <= (uint8_t)(i + 1))
if (bufferLen <= (ZydisU8)(i + 1))
{
return ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE;
}
@ -323,14 +323,14 @@ ZydisStatus ZydisPrintHexU64(char** buffer, size_t bufferLen, uint64_t value, ui
/* Public Functions */
/* ---------------------------------------------------------------------------------------------- */
ZydisStatus ZydisPrintStr(char** buffer, size_t bufferLen, const char* text,
ZydisStatus ZydisPrintStr(char** buffer, ZydisUSize bufferLen, const char* text,
ZydisLetterCase letterCase)
{
ZYDIS_ASSERT(buffer);
ZYDIS_ASSERT(bufferLen > 0);
ZYDIS_ASSERT(text);
const size_t strLen = ZydisStrLen(text);
const ZydisUSize strLen = ZydisStrLen(text);
if (strLen >= bufferLen)
{
return ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE;
@ -354,7 +354,7 @@ ZydisStatus ZydisPrintStr(char** buffer, size_t bufferLen, const char* text,
return ZYDIS_STATUS_SUCCESS;
}
ZydisStatus ZydisPrintDecU(char** buffer, size_t bufferLen, uint64_t value, uint8_t paddingLength)
ZydisStatus ZydisPrintDecU(char** buffer, ZydisUSize bufferLen, ZydisU64 value, ZydisU8 paddingLength)
{
#ifdef ZYDIS_X64
return ZydisPrintDecU64(buffer, bufferLen, value, paddingLength);
@ -364,12 +364,12 @@ ZydisStatus ZydisPrintDecU(char** buffer, size_t bufferLen, uint64_t value, uint
return ZydisPrintDecU64(buffer, bufferLen, value, paddingLength);
} else
{
return ZydisPrintDecU32(buffer, bufferLen, (uint32_t)value, paddingLength);
return ZydisPrintDecU32(buffer, bufferLen, (ZydisU32)value, paddingLength);
}
#endif
}
ZydisStatus ZydisPrintDecS(char** buffer, size_t bufferLen, int64_t value, uint8_t paddingLength)
ZydisStatus ZydisPrintDecS(char** buffer, ZydisUSize bufferLen, ZydisI64 value, ZydisU8 paddingLength)
{
if (value < 0)
{
@ -379,7 +379,7 @@ ZydisStatus ZydisPrintDecS(char** buffer, size_t bufferLen, int64_t value, uint8
return ZydisPrintDecU(buffer, bufferLen, value, paddingLength);
}
ZydisStatus ZydisPrintHexU(char** buffer, size_t bufferLen, uint64_t value, uint8_t paddingLength,
ZydisStatus ZydisPrintHexU(char** buffer, ZydisUSize bufferLen, ZydisU64 value, ZydisU8 paddingLength,
ZydisBool uppercase, const char* prefix, const char* suffix)
{
#ifdef ZYDIS_X64
@ -390,13 +390,13 @@ ZydisStatus ZydisPrintHexU(char** buffer, size_t bufferLen, uint64_t value, uint
return ZydisPrintHexU64(buffer, bufferLen, value, paddingLength, uppercase, prefix, suffix);
} else
{
return ZydisPrintHexU32(buffer, bufferLen, (uint32_t)value, paddingLength, uppercase,
return ZydisPrintHexU32(buffer, bufferLen, (ZydisU32)value, paddingLength, uppercase,
prefix, suffix);
}
#endif
}
ZydisStatus ZydisPrintHexS(char** buffer, size_t bufferLen, int64_t value, uint8_t paddingLength,
ZydisStatus ZydisPrintHexS(char** buffer, ZydisUSize bufferLen, ZydisI64 value, ZydisU8 paddingLength,
ZydisBool uppercase, const char* prefix, const char* suffix)
{
if (value < 0)

View File

@ -45,7 +45,7 @@ extern "C" {
/**
* @brief Defines the `ZydisLetterCase` datatype.
*/
typedef uint8_t ZydisLetterCase;
typedef ZydisU8 ZydisLetterCase;
/**
* @brief Values that represent letter cases.
@ -91,7 +91,7 @@ enum ZydisLetterCases
* The string-buffer pointer is increased by the number of chars written, if the call was
* successfull.
*/
ZYDIS_NO_EXPORT ZydisStatus ZydisPrintStr(char** buffer, size_t bufferLen, const char* text,
ZYDIS_NO_EXPORT ZydisStatus ZydisPrintStr(char** buffer, ZydisUSize bufferLen, const char* text,
ZydisLetterCase letterCase);
/* ---------------------------------------------------------------------------------------------- */
@ -115,8 +115,8 @@ ZYDIS_NO_EXPORT ZydisStatus ZydisPrintStr(char** buffer, size_t bufferLen, const
* The string-buffer pointer is increased by the number of chars written, if the call was
* successfull.
*/
ZYDIS_NO_EXPORT ZydisStatus ZydisPrintDecU(char** buffer, size_t bufferLen, uint64_t value,
uint8_t paddingLength);
ZYDIS_NO_EXPORT ZydisStatus ZydisPrintDecU(char** buffer, ZydisUSize bufferLen, ZydisU64 value,
ZydisU8 paddingLength);
/**
* @brief Formats the given signed ordinal @c value to its decimal text-representation and
@ -135,8 +135,8 @@ ZYDIS_NO_EXPORT ZydisStatus ZydisPrintDecU(char** buffer, size_t bufferLen, uint
* The string-buffer pointer is increased by the number of chars written, if the call was
* successfull.
*/
ZYDIS_NO_EXPORT ZydisStatus ZydisPrintDecS(char** buffer, size_t bufferLen, int64_t value,
uint8_t paddingLength);
ZYDIS_NO_EXPORT ZydisStatus ZydisPrintDecS(char** buffer, ZydisUSize bufferLen, ZydisI64 value,
ZydisU8 paddingLength);
/* ---------------------------------------------------------------------------------------------- */
/* Hexadecimal values */
@ -163,8 +163,8 @@ ZYDIS_NO_EXPORT ZydisStatus ZydisPrintDecS(char** buffer, size_t bufferLen, int6
* The string-buffer pointer is increased by the number of chars written, if the call was
* successfull.
*/
ZYDIS_NO_EXPORT ZydisStatus ZydisPrintHexU(char** buffer, size_t bufferLen, uint64_t value,
uint8_t paddingLength, ZydisBool uppercase, const char* prefix, const char* suffix);
ZYDIS_NO_EXPORT ZydisStatus ZydisPrintHexU(char** buffer, ZydisUSize bufferLen, ZydisU64 value,
ZydisU8 paddingLength, ZydisBool uppercase, const char* prefix, const char* suffix);
/**
* @brief Formats the given signed ordinal @c value to its hexadecimal text-representation and
@ -187,8 +187,8 @@ ZYDIS_NO_EXPORT ZydisStatus ZydisPrintHexU(char** buffer, size_t bufferLen, uint
* The string-buffer pointer is increased by the number of chars written, if the call was
* successfull.
*/
ZYDIS_NO_EXPORT ZydisStatus ZydisPrintHexS(char** buffer, size_t bufferLen, int64_t value,
uint8_t paddingLength, ZydisBool uppercase, const char* prefix, const char* suffix);
ZYDIS_NO_EXPORT ZydisStatus ZydisPrintHexS(char** buffer, ZydisUSize bufferLen, ZydisI64 value,
ZydisU8 paddingLength, ZydisBool uppercase, const char* prefix, const char* suffix);
/* ---------------------------------------------------------------------------------------------- */

View File

@ -40,7 +40,7 @@
/* ---------------------------------------------------------------------------------------------- */
static ZydisStatus ZydisFormatterPrintPrefixesIntel(const ZydisFormatter* formatter,
char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction, void* userData)
char** buffer, ZydisUSize bufferLen, const ZydisDecodedInstruction* instruction, void* userData)
{
(void)userData;
@ -85,7 +85,7 @@ static ZydisStatus ZydisFormatterPrintPrefixesIntel(const ZydisFormatter* format
}
static ZydisStatus ZydisFormatterPrintMnemonicIntel(const ZydisFormatter* formatter,
char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction, void* userData)
char** buffer, ZydisUSize bufferLen, const ZydisDecodedInstruction* instruction, void* userData)
{
(void)userData;
@ -114,7 +114,7 @@ static ZydisStatus ZydisFormatterPrintMnemonicIntel(const ZydisFormatter* format
/* ---------------------------------------------------------------------------------------------- */
static ZydisStatus ZydisFormatterFormatOperandRegIntel(const ZydisFormatter* formatter,
char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction,
char** buffer, ZydisUSize bufferLen, const ZydisDecodedInstruction* instruction,
const ZydisDecodedOperand* operand, void* userData)
{
(void)userData;
@ -138,7 +138,7 @@ static ZydisStatus ZydisFormatterFormatOperandRegIntel(const ZydisFormatter* for
}
static ZydisStatus ZydisFormatterFormatOperandMemIntel(const ZydisFormatter* formatter,
char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction,
char** buffer, ZydisUSize bufferLen, const ZydisDecodedInstruction* instruction,
const ZydisDecodedOperand* operand, void* userData)
{
if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction || !operand)
@ -160,7 +160,7 @@ static ZydisStatus ZydisFormatterFormatOperandMemIntel(const ZydisFormatter* for
if ((formatter->addressFormat == ZYDIS_ADDR_FORMAT_ABSOLUTE) ||
(operand->mem.base == ZYDIS_REGISTER_NONE))
{
uint64_t address;
ZydisU64 address;
ZYDIS_CHECK(ZydisCalcAbsoluteAddress(instruction, operand, &address));
ZYDIS_CHECK(formatter->funcPrintAddress(formatter, buffer, bufEnd - *buffer,
instruction, operand, address, userData));
@ -212,7 +212,7 @@ static ZydisStatus ZydisFormatterFormatOperandMemIntel(const ZydisFormatter* for
}
static ZydisStatus ZydisFormatterFormatOperandPtrIntel(const ZydisFormatter* formatter,
char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction,
char** buffer, ZydisUSize bufferLen, const ZydisDecodedInstruction* instruction,
const ZydisDecodedOperand* operand, void* userData)
{
(void)userData;
@ -231,7 +231,7 @@ static ZydisStatus ZydisFormatterFormatOperandPtrIntel(const ZydisFormatter* for
}
static ZydisStatus ZydisFormatterFormatOperandImmIntel(const ZydisFormatter* formatter,
char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction,
char** buffer, ZydisUSize bufferLen, const ZydisDecodedInstruction* instruction,
const ZydisDecodedOperand* operand, void* userData)
{
if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction || !operand)
@ -247,7 +247,7 @@ static ZydisStatus ZydisFormatterFormatOperandImmIntel(const ZydisFormatter* for
{
case ZYDIS_ADDR_FORMAT_ABSOLUTE:
{
uint64_t address;
ZydisU64 address;
ZYDIS_CHECK(ZydisCalcAbsoluteAddress(instruction, operand, &address));
return formatter->funcPrintAddress(formatter, buffer, bufferLen, instruction, operand,
address, userData);
@ -263,7 +263,7 @@ static ZydisStatus ZydisFormatterFormatOperandImmIntel(const ZydisFormatter* for
if (printSignedHEX)
{
return ZydisPrintHexS(buffer, bufferLen, (int32_t)operand->imm.value.s,
return ZydisPrintHexS(buffer, bufferLen, (ZydisI32)operand->imm.value.s,
formatter->hexPaddingAddress, formatter->hexUppercase, formatter->hexPrefix,
formatter->hexSuffix);
}
@ -280,8 +280,8 @@ static ZydisStatus ZydisFormatterFormatOperandImmIntel(const ZydisFormatter* for
/* ---------------------------------------------------------------------------------------------- */
static ZydisStatus ZydisFormatterPrintAddressIntel(const ZydisFormatter* formatter,
char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction,
const ZydisDecodedOperand* operand, uint64_t address, void* userData)
char** buffer, ZydisUSize bufferLen, const ZydisDecodedInstruction* instruction,
const ZydisDecodedOperand* operand, ZydisU64 address, void* userData)
{
(void)userData;
@ -293,10 +293,10 @@ static ZydisStatus ZydisFormatterPrintAddressIntel(const ZydisFormatter* formatt
switch (instruction->stackWidth)
{
case 16:
return ZydisPrintHexU(buffer, bufferLen, (uint16_t)address, 4,
return ZydisPrintHexU(buffer, bufferLen, (ZydisU16)address, 4,
formatter->hexUppercase, formatter->hexPrefix, formatter->hexSuffix);
case 32:
return ZydisPrintHexU(buffer, bufferLen, (uint32_t)address, 8,
return ZydisPrintHexU(buffer, bufferLen, (ZydisU32)address, 8,
formatter->hexUppercase, formatter->hexPrefix, formatter->hexSuffix);
case 64:
return ZydisPrintHexU(buffer, bufferLen, address, 16,
@ -307,7 +307,7 @@ static ZydisStatus ZydisFormatterPrintAddressIntel(const ZydisFormatter* formatt
}
static ZydisStatus ZydisFormatterPrintDisplacementIntel(const ZydisFormatter* formatter,
char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction,
char** buffer, ZydisUSize bufferLen, const ZydisDecodedInstruction* instruction,
const ZydisDecodedOperand* operand, void* userData)
{
(void)userData;
@ -337,7 +337,7 @@ static ZydisStatus ZydisFormatterPrintDisplacementIntel(const ZydisFormatter* fo
{
ZYDIS_CHECK(ZydisPrintStr(buffer, bufferLen, "+", ZYDIS_LETTER_CASE_DEFAULT));
}
return ZydisPrintHexU(buffer, bufEnd - *buffer, (uint64_t)operand->mem.disp.value,
return ZydisPrintHexU(buffer, bufEnd - *buffer, (ZydisU64)operand->mem.disp.value,
formatter->hexPaddingDisplacement, formatter->hexUppercase, formatter->hexPrefix,
formatter->hexSuffix);
}
@ -345,7 +345,7 @@ static ZydisStatus ZydisFormatterPrintDisplacementIntel(const ZydisFormatter* fo
}
static ZydisStatus ZydisFormatterPrintImmediateIntel(const ZydisFormatter* formatter,
char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction,
char** buffer, ZydisUSize bufferLen, const ZydisDecodedInstruction* instruction,
const ZydisDecodedOperand* operand, void* userData)
{
(void)userData;
@ -366,15 +366,15 @@ static ZydisStatus ZydisFormatterPrintImmediateIntel(const ZydisFormatter* forma
switch (operand->size)
{
case 8:
return ZydisPrintHexS(buffer, bufferLen, (int8_t)operand->imm.value.s,
return ZydisPrintHexS(buffer, bufferLen, (ZydisI8)operand->imm.value.s,
formatter->hexPaddingImmediate, formatter->hexUppercase, formatter->hexPrefix,
formatter->hexSuffix);
case 16:
return ZydisPrintHexS(buffer, bufferLen, (int16_t)operand->imm.value.s,
return ZydisPrintHexS(buffer, bufferLen, (ZydisI16)operand->imm.value.s,
formatter->hexPaddingImmediate, formatter->hexUppercase, formatter->hexPrefix,
formatter->hexSuffix);
case 32:
return ZydisPrintHexS(buffer, bufferLen, (int32_t)operand->imm.value.s,
return ZydisPrintHexS(buffer, bufferLen, (ZydisI32)operand->imm.value.s,
formatter->hexPaddingImmediate, formatter->hexUppercase, formatter->hexPrefix,
formatter->hexSuffix);
case 64:
@ -388,15 +388,15 @@ static ZydisStatus ZydisFormatterPrintImmediateIntel(const ZydisFormatter* forma
switch (instruction->operandWidth)
{
case 8:
return ZydisPrintHexU(buffer, bufferLen, (uint8_t)operand->imm.value.u,
return ZydisPrintHexU(buffer, bufferLen, (ZydisU8)operand->imm.value.u,
formatter->hexPaddingImmediate, formatter->hexUppercase, formatter->hexPrefix,
formatter->hexSuffix);
case 16:
return ZydisPrintHexU(buffer, bufferLen, (uint16_t)operand->imm.value.u,
return ZydisPrintHexU(buffer, bufferLen, (ZydisU16)operand->imm.value.u,
formatter->hexPaddingImmediate, formatter->hexUppercase, formatter->hexPrefix,
formatter->hexSuffix);
case 32:
return ZydisPrintHexU(buffer, bufferLen, (uint32_t)operand->imm.value.u,
return ZydisPrintHexU(buffer, bufferLen, (ZydisU32)operand->imm.value.u,
formatter->hexPaddingImmediate, formatter->hexUppercase, formatter->hexPrefix,
formatter->hexSuffix);
case 64:
@ -411,7 +411,7 @@ static ZydisStatus ZydisFormatterPrintImmediateIntel(const ZydisFormatter* forma
/* ---------------------------------------------------------------------------------------------- */
static ZydisStatus ZydisFormatterPrintOperandSizeIntel(const ZydisFormatter* formatter,
char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction,
char** buffer, ZydisUSize bufferLen, const ZydisDecodedInstruction* instruction,
const ZydisDecodedOperand* operand, void* userData)
{
(void)userData;
@ -423,7 +423,7 @@ static ZydisStatus ZydisFormatterPrintOperandSizeIntel(const ZydisFormatter* for
// TODO: refactor
uint32_t typecast = 0;
ZydisU32 typecast = 0;
if (formatter->forceOperandSize)
{
if ((operand->type == ZYDIS_OPERAND_TYPE_MEMORY) &&
@ -518,7 +518,7 @@ static ZydisStatus ZydisFormatterPrintOperandSizeIntel(const ZydisFormatter* for
}
static ZydisStatus ZydisFormatterPrintSegmentIntel(const ZydisFormatter* formatter,
char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction,
char** buffer, ZydisUSize bufferLen, const ZydisDecodedInstruction* instruction,
const ZydisDecodedOperand* operand, void* userData)
{
(void)userData;
@ -566,7 +566,7 @@ static ZydisStatus ZydisFormatterPrintSegmentIntel(const ZydisFormatter* formatt
}
static ZydisStatus ZydisFormatterPrintDecoratorIntel(const ZydisFormatter* formatter,
char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction,
char** buffer, ZydisUSize bufferLen, const ZydisDecodedInstruction* instruction,
const ZydisDecodedOperand* operand, ZydisDecoratorType type, void* userData)
{
(void)userData;
@ -778,7 +778,7 @@ static ZydisStatus ZydisFormatterPrintDecoratorIntel(const ZydisFormatter* forma
}
static ZydisStatus ZydisFormatterFormatInstrIntel(const ZydisFormatter* formatter,
char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction, void* userData)
char** buffer, ZydisUSize bufferLen, const ZydisDecodedInstruction* instruction, void* userData)
{
if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction)
{
@ -792,7 +792,7 @@ static ZydisStatus ZydisFormatterFormatInstrIntel(const ZydisFormatter* formatte
formatter->funcPrintMnemonic(formatter, buffer, bufEnd - *buffer, instruction, userData));
char* bufRestore = *buffer;
for (uint8_t i = 0; i < instruction->operandCount; ++i)
for (ZydisU8 i = 0; i < instruction->operandCount; ++i)
{
if (instruction->operands[i].visibility == ZYDIS_OPERAND_VISIBILITY_HIDDEN)
{
@ -949,7 +949,7 @@ ZydisStatus ZydisFormatterInit(ZydisFormatter* formatter, ZydisFormatterStyle st
}
ZydisStatus ZydisFormatterSetProperty(ZydisFormatter* formatter,
ZydisFormatterProperty property, uintptr_t value)
ZydisFormatterProperty property, ZydisUSize value)
{
if (!formatter)
{
@ -972,21 +972,21 @@ ZydisStatus ZydisFormatterSetProperty(ZydisFormatter* formatter,
{
return ZYDIS_STATUS_INVALID_PARAMETER;
}
formatter->addressFormat = (uint8_t)value;
formatter->addressFormat = (ZydisU8)value;
break;
case ZYDIS_FORMATTER_PROP_DISP_FORMAT:
if (value > ZYDIS_DISP_FORMAT_MAX_VALUE)
{
return ZYDIS_STATUS_INVALID_PARAMETER;
}
formatter->displacementFormat = (uint8_t)value;
formatter->displacementFormat = (ZydisU8)value;
break;
case ZYDIS_FORMATTER_PROP_IMM_FORMAT:
if (value > ZYDIS_IMM_FORMAT_MAX_VALUE)
{
return ZYDIS_STATUS_INVALID_PARAMETER;
}
formatter->immediateFormat = (uint8_t)value;
formatter->immediateFormat = (ZydisU8)value;
break;
case ZYDIS_FORMATTER_PROP_HEX_UPPERCASE:
formatter->hexUppercase = (value) ? ZYDIS_TRUE : ZYDIS_FALSE;
@ -1002,21 +1002,21 @@ ZydisStatus ZydisFormatterSetProperty(ZydisFormatter* formatter,
{
return ZYDIS_STATUS_INVALID_PARAMETER;
}
formatter->hexPaddingAddress = (uint8_t)value;
formatter->hexPaddingAddress = (ZydisU8)value;
break;
case ZYDIS_FORMATTER_PROP_HEX_PADDING_DISP:
if (value > 20)
{
return ZYDIS_STATUS_INVALID_PARAMETER;
}
formatter->hexPaddingDisplacement = (uint8_t)value;
formatter->hexPaddingDisplacement = (ZydisU8)value;
break;
case ZYDIS_FORMATTER_PROP_HEX_PADDING_IMM:
if (value > 20)
{
return ZYDIS_STATUS_INVALID_PARAMETER;
}
formatter->hexPaddingImmediate = (uint8_t)value;
formatter->hexPaddingImmediate = (ZydisU8)value;
break;
default:
return ZYDIS_STATUS_INVALID_PARAMETER;
@ -1149,13 +1149,13 @@ ZydisStatus ZydisFormatterSetHook(ZydisFormatter* formatter, ZydisFormatterHookT
}
ZydisStatus ZydisFormatterFormatInstruction(const ZydisFormatter* formatter,
const ZydisDecodedInstruction* instruction, char* buffer, size_t bufferLen)
const ZydisDecodedInstruction* instruction, char* buffer, ZydisUSize bufferLen)
{
return ZydisFormatterFormatInstructionEx(formatter, instruction, buffer, bufferLen, NULL);
}
ZydisStatus ZydisFormatterFormatInstructionEx(const ZydisFormatter* formatter,
const ZydisDecodedInstruction* instruction, char* buffer, size_t bufferLen, void* userData)
const ZydisDecodedInstruction* instruction, char* buffer, ZydisUSize bufferLen, void* userData)
{
if (!formatter || !instruction || !buffer || (bufferLen == 0))
{

View File

@ -52,23 +52,23 @@
* but towards providing a last resort fallback for environments without a working libc.
*/
ZYDIS_INLINE void* ZydisMemorySet(void* ptr, int value, size_t num)
ZYDIS_INLINE void* ZydisMemorySet(void* ptr, int value, ZydisUSize num)
{
uint8_t c = value & 0xff;
for (size_t i = 0; i < num; ++i) ((uint8_t*)ptr)[i] = c;
ZydisU8 c = value & 0xff;
for (ZydisUSize i = 0; i < num; ++i) ((ZydisU8*)ptr)[i] = c;
return ptr;
}
ZYDIS_INLINE void* ZydisMemoryCopy(void* dst, const void* src, size_t num)
ZYDIS_INLINE void* ZydisMemoryCopy(void* dst, const void* src, ZydisUSize num)
{
for (size_t i = 0; i < num; ++i)
for (ZydisUSize i = 0; i < num; ++i)
{
((uint8_t*)dst)[i] = ((const uint8_t*)src)[i];
((ZydisU8*)dst)[i] = ((const ZydisU8*)src)[i];
}
return dst;
}
ZYDIS_INLINE size_t ZydisStrLen(const char* str)
ZYDIS_INLINE ZydisUSize ZydisStrLen(const char* str)
{
const char *s;
for (s = str; *s; ++s);

View File

@ -152,13 +152,13 @@ static const struct ZydisRegisterMapItem registerMap[] =
{ ZYDIS_REGCLASS_BOUND , ZYDIS_REGISTER_BND0 , ZYDIS_REGISTER_BND3 , 128 , 128 }
};
static const uint8_t registerMapCount = sizeof(registerMap) / sizeof(struct ZydisRegisterMapItem);
static const ZydisU8 registerMapCount = sizeof(registerMap) / sizeof(struct ZydisRegisterMapItem);
/* ============================================================================================== */
/* Exported functions */
/* ============================================================================================== */
ZydisRegister ZydisRegisterEncode(ZydisRegisterClass registerClass, uint8_t id)
ZydisRegister ZydisRegisterEncode(ZydisRegisterClass registerClass, ZydisU8 id)
{
switch (registerClass)
{
@ -176,7 +176,7 @@ ZydisRegister ZydisRegisterEncode(ZydisRegisterClass registerClass, uint8_t id)
return ZYDIS_REGISTER_NONE;
}
int16_t ZydisRegisterGetId(ZydisRegister reg)
ZydisI16 ZydisRegisterGetId(ZydisRegister reg)
{
for (unsigned i = 0; i < registerMapCount; ++i)
{

View File

@ -104,7 +104,7 @@ extern const ZydisInstructionDefinitionMVEX instructionDefinitionsMVEX[];
/* Instruction definition */
/* ---------------------------------------------------------------------------------------------- */
void ZydisGetInstructionDefinition(ZydisInstructionEncoding encoding, uint16_t id,
void ZydisGetInstructionDefinition(ZydisInstructionEncoding encoding, ZydisU16 id,
const ZydisInstructionDefinition** definition)
{
switch (encoding)
@ -136,7 +136,7 @@ void ZydisGetInstructionDefinition(ZydisInstructionEncoding encoding, uint16_t i
/* Operand definition */
/* ---------------------------------------------------------------------------------------------- */
uint8_t ZydisGetOperandDefinitions(const ZydisInstructionDefinition* definition,
ZydisU8 ZydisGetOperandDefinitions(const ZydisInstructionDefinition* definition,
const ZydisOperandDefinition** operand)
{
if (definition->operandCount == 0)

View File

@ -56,7 +56,7 @@ extern "C" {
/**
* @brief Defines the @c ZydisSemanticOperandType datatype.
*/
typedef uint8_t ZydisSemanticOperandType;
typedef ZydisU8 ZydisSemanticOperandType;
/**
* @brief Values that represent semantic operand-types.
@ -99,7 +99,7 @@ enum ZydisSemanticOperandTypes
/**
* @brief Defines the @c ZydisInternalElementType datatype.
*/
typedef uint8_t ZydisInternalElementType;
typedef ZydisU8 ZydisInternalElementType;
/**
* @brief Values that represent internal element-types.
@ -137,24 +137,24 @@ typedef struct ZydisOperandDefinition_
ZydisSemanticOperandType type ZYDIS_BITFIELD(5);
ZydisOperandVisibility visibility ZYDIS_BITFIELD(2);
ZydisOperandAction action ZYDIS_BITFIELD(3);
uint16_t size[3];
ZydisU16 size[3];
ZydisInternalElementType elementType ZYDIS_BITFIELD(5);
union
{
ZydisOperandEncoding encoding;
struct
{
uint8_t type ZYDIS_BITFIELD(3);
ZydisU8 type ZYDIS_BITFIELD(3);
union
{
ZydisRegister reg;
uint8_t id ZYDIS_BITFIELD(6);
ZydisU8 id ZYDIS_BITFIELD(6);
} reg;
} reg;
struct
{
uint8_t seg ZYDIS_BITFIELD(3);
uint8_t base ZYDIS_BITFIELD(3);
ZydisU8 seg ZYDIS_BITFIELD(3);
ZydisU8 base ZYDIS_BITFIELD(3);
} mem;
} op;
} ZydisOperandDefinition;
@ -192,7 +192,7 @@ enum ZydisImplicitMemBase
/**
* @brief Defines the @c ZydisInternalVectorLength datatype.
*/
typedef uint8_t ZydisInternalVectorLength;
typedef ZydisU8 ZydisInternalVectorLength;
/**
* @brief Values that represent internal vector-lengths.
@ -210,7 +210,7 @@ enum ZydisInternalVectorLengths
/**
* @brief Defines the @c ZydisInternalElementSize datatype.
*/
typedef uint8_t ZydisInternalElementSize;
typedef ZydisU8 ZydisInternalElementSize;
/**
* @brief Values that represent internal element-sizes.
@ -230,7 +230,7 @@ enum ZydisInternalElementSizes
/**
* @brief Defines the @c ZydisEVEXFunctionality datatype.
*/
typedef uint8_t ZydisEVEXFunctionality;
typedef ZydisU8 ZydisEVEXFunctionality;
/**
* @brief Values that represent EVEX-functionalities.
@ -257,7 +257,7 @@ enum ZydisEVEXFunctionalities
/**
* @brief Defines the @c ZydisEVEXTupleType datatype.
*/
typedef uint8_t ZydisEVEXTupleType;
typedef ZydisU8 ZydisEVEXTupleType;
/**
* @brief Values that represent EVEX tuple-types.
@ -332,7 +332,7 @@ enum ZydisEVEXTupleTypes
/**
* @brief Defines the @c ZydisMVEXFunctionality datatype.
*/
typedef uint8_t ZydisMVEXFunctionality;
typedef ZydisU8 ZydisMVEXFunctionality;
/**
* @brief Values that represent MVEX-functionalities.
@ -450,7 +450,7 @@ enum ZydisMVEXFunctionalities
/**
* @brief Defines the @c ZydisVEXStaticBroadcast datatype.
*/
typedef uint8_t ZydisVEXStaticBroadcast;
typedef ZydisU8 ZydisVEXStaticBroadcast;
/**
* @brief Values that represent static VEX-broadcasts.
@ -471,7 +471,7 @@ enum ZydisVEXStaticBroadcasts
/**
* @brief Defines the @c ZydisEVEXStaticBroadcast datatype.
*/
typedef uint8_t ZydisEVEXStaticBroadcast;
typedef ZydisU8 ZydisEVEXStaticBroadcast;
/**
* @brief Values that represent static EVEX-broadcasts.
@ -498,7 +498,7 @@ enum ZydisEVEXStaticBroadcasts
/**
* @brief Defines the @c ZydisMVEXStaticBroadcast datatype.
*/
typedef uint8_t ZydisMVEXStaticBroadcast;
typedef ZydisU8 ZydisMVEXStaticBroadcast;
/**
* @brief Values that represent static MVEX-broadcasts.
@ -517,7 +517,7 @@ enum ZydisMVEXStaticBroadcasts
/**
* @brief Defines the @c ZydisMaskPolicy datatype.
*/
typedef uint8_t ZydisMaskPolicy;
typedef ZydisU8 ZydisMaskPolicy;
/**
* @brief Values that represent AVX mask policies.
@ -544,10 +544,10 @@ enum ZydisMaskPolicies
#define ZYDIS_INSTRUCTION_DEFINITION_BASE \
ZydisMnemonic mnemonic ZYDIS_BITFIELD(ZYDIS_MNEMONIC_MAX_BITS); \
uint8_t operandCount ZYDIS_BITFIELD( 4); \
uint16_t operandReference ZYDIS_BITFIELD(15); \
uint8_t operandSizeMap ZYDIS_BITFIELD( 3); \
uint8_t flagsReference ZYDIS_BITFIELD( 7); \
ZydisU8 operandCount ZYDIS_BITFIELD( 4); \
ZydisU16 operandReference ZYDIS_BITFIELD(15); \
ZydisU8 operandSizeMap ZYDIS_BITFIELD( 3); \
ZydisU8 flagsReference ZYDIS_BITFIELD( 7); \
ZydisBool requiresProtectedMode ZYDIS_BITFIELD( 1); \
ZydisBool acceptsAddressSizeOverride ZYDIS_BITFIELD( 1); \
ZydisInstructionCategory category ZYDIS_BITFIELD(ZYDIS_CATEGORY_MAX_BITS); \
@ -660,7 +660,7 @@ typedef struct ZydisAccessedFlags_
* definition.
*/
ZYDIS_NO_EXPORT void ZydisGetInstructionDefinition(ZydisInstructionEncoding encoding,
uint16_t id, const ZydisInstructionDefinition** definition);
ZydisU16 id, const ZydisInstructionDefinition** definition);
/* ---------------------------------------------------------------------------------------------- */
/* Operand definition */
@ -675,7 +675,7 @@ ZYDIS_NO_EXPORT void ZydisGetInstructionDefinition(ZydisInstructionEncoding enco
*
* @return The number of operands for the given instruction-definition.
*/
ZYDIS_NO_EXPORT uint8_t ZydisGetOperandDefinitions(const ZydisInstructionDefinition* definition,
ZYDIS_NO_EXPORT ZydisU8 ZydisGetOperandDefinitions(const ZydisInstructionDefinition* definition,
const ZydisOperandDefinition** operand);
/* ---------------------------------------------------------------------------------------------- */

View File

@ -35,7 +35,7 @@
/* ---------------------------------------------------------------------------------------------- */
ZydisStatus ZydisCalcAbsoluteAddress(const ZydisDecodedInstruction* instruction,
const ZydisDecodedOperand* operand, uint64_t* address)
const ZydisDecodedOperand* operand, ZydisU64* address)
{
if (!instruction || !operand || !address)
{
@ -51,12 +51,12 @@ ZydisStatus ZydisCalcAbsoluteAddress(const ZydisDecodedInstruction* instruction,
if (operand->mem.base == ZYDIS_REGISTER_EIP)
{
*address =
(uint64_t)((uint32_t)instruction->instrPointer + (uint32_t)operand->mem.disp.value);
(ZydisU64)((ZydisU32)instruction->instrPointer + (ZydisU32)operand->mem.disp.value);
return ZYDIS_STATUS_SUCCESS;
}
if (operand->mem.base == ZYDIS_REGISTER_RIP)
{
*address = (uint64_t)(instruction->instrPointer + operand->mem.disp.value);
*address = (ZydisU64)(instruction->instrPointer + operand->mem.disp.value);
return ZYDIS_STATUS_SUCCESS;
}
if ((operand->mem.base == ZYDIS_REGISTER_NONE) &&
@ -65,13 +65,13 @@ ZydisStatus ZydisCalcAbsoluteAddress(const ZydisDecodedInstruction* instruction,
switch (instruction->addressWidth)
{
case 16:
*address = (uint64_t)operand->mem.disp.value & 0x000000000000FFFF;
*address = (ZydisU64)operand->mem.disp.value & 0x000000000000FFFF;
return ZYDIS_STATUS_SUCCESS;
case 32:
*address = (uint64_t)operand->mem.disp.value & 0x00000000FFFFFFFF;
*address = (ZydisU64)operand->mem.disp.value & 0x00000000FFFFFFFF;
return ZYDIS_STATUS_SUCCESS;
case 64:
*address = (uint64_t)operand->mem.disp.value;
*address = (ZydisU64)operand->mem.disp.value;
return ZYDIS_STATUS_SUCCESS;
default:
return ZYDIS_STATUS_INVALID_PARAMETER;
@ -81,7 +81,7 @@ ZydisStatus ZydisCalcAbsoluteAddress(const ZydisDecodedInstruction* instruction,
case ZYDIS_OPERAND_TYPE_IMMEDIATE:
if (operand->imm.isSigned && operand->imm.isRelative)
{
*address = (uint64_t)((int64_t)instruction->instrPointer + operand->imm.value.s);
*address = (ZydisU64)((ZydisI64)instruction->instrPointer + operand->imm.value.s);
switch (instruction->machineMode)
{
case ZYDIS_MACHINE_MODE_LONG_COMPAT_16:
@ -126,7 +126,7 @@ ZydisStatus ZydisGetAccessedFlagsByAction(const ZydisDecodedInstruction* instruc
return ZYDIS_STATUS_INVALID_PARAMETER;
}
*flags = 0;
for (uint8_t i = 0; i < ZYDIS_ARRAY_SIZE(instruction->accessedFlags); ++i)
for (ZydisU8 i = 0; i < ZYDIS_ARRAY_SIZE(instruction->accessedFlags); ++i)
{
if (instruction->accessedFlags[i].action == action)
{

View File

@ -30,7 +30,7 @@
/* Exported functions */
/* ============================================================================================== */
uint64_t ZydisGetVersion()
ZydisU64 ZydisGetVersion()
{
return ZYDIS_VERSION;
}