mirror of https://github.com/x64dbg/zydis
Merge branch 'develop' of github.com:zyantific/zyan-disassembler-engine into develop
This commit is contained in:
commit
0c38e08306
|
@ -51,6 +51,14 @@ int main(int argc, char** argv)
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ZydisInstructionDecoder decoder;
|
||||||
|
if (!ZYDIS_SUCCESS(ZydisDecoderInitInstructionDecoder(
|
||||||
|
&decoder, ZYDIS_MACHINE_MODE_LONG_64, ZYDIS_ADDRESS_WIDTH_INVALID)))
|
||||||
|
{
|
||||||
|
fputs("Failed to initialize decoder\n", stderr);
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
ZydisInstructionFormatter formatter;
|
ZydisInstructionFormatter formatter;
|
||||||
if (!ZYDIS_SUCCESS(ZydisFormatterInitInstructionFormatterEx(&formatter,
|
if (!ZYDIS_SUCCESS(ZydisFormatterInitInstructionFormatterEx(&formatter,
|
||||||
ZYDIS_FORMATTER_STYLE_INTEL, ZYDIS_FMTFLAG_FORCE_SEGMENTS | ZYDIS_FMTFLAG_FORCE_OPERANDSIZE,
|
ZYDIS_FORMATTER_STYLE_INTEL, ZYDIS_FMTFLAG_FORCE_SEGMENTS | ZYDIS_FMTFLAG_FORCE_OPERANDSIZE,
|
||||||
|
@ -69,8 +77,8 @@ int main(int argc, char** argv)
|
||||||
ZydisInstructionInfo info;
|
ZydisInstructionInfo info;
|
||||||
ZydisStatus status;
|
ZydisStatus status;
|
||||||
size_t readOffs = 0;
|
size_t readOffs = 0;
|
||||||
while ((status = ZydisDecode(
|
while ((status = ZydisDecoderDecodeBuffer(
|
||||||
ZYDIS_OPERATING_MODE_64BIT,
|
&decoder,
|
||||||
readBuf + readOffs,
|
readBuf + readOffs,
|
||||||
numBytesRead - readOffs,
|
numBytesRead - readOffs,
|
||||||
readOffs,
|
readOffs,
|
||||||
|
|
|
@ -40,13 +40,13 @@
|
||||||
#include <Zydis/Zydis.h>
|
#include <Zydis/Zydis.h>
|
||||||
|
|
||||||
typedef struct ZydisFuzzControlBlock_ {
|
typedef struct ZydisFuzzControlBlock_ {
|
||||||
ZydisOperatingMode operatingMode;
|
ZydisMachineMode machineMode;
|
||||||
|
ZydisDecodeGranularity granularity;
|
||||||
ZydisFormatterStyle formatterStyle;
|
ZydisFormatterStyle formatterStyle;
|
||||||
ZydisFormatterFlags formatterFlags;
|
ZydisFormatterFlags formatterFlags;
|
||||||
ZydisFormatterAddressFormat formatterAddrFormat;
|
ZydisFormatterAddressFormat formatterAddrFormat;
|
||||||
ZydisFormatterDisplacementFormat formatterDispFormat;
|
ZydisFormatterDisplacementFormat formatterDispFormat;
|
||||||
ZydisFormatterImmediateFormat formatterImmFormat;
|
ZydisFormatterImmediateFormat formatterImmFormat;
|
||||||
ZydisDecodeGranularity granularity;
|
|
||||||
} ZydisFuzzControlBlock;
|
} ZydisFuzzControlBlock;
|
||||||
|
|
||||||
/* ============================================================================================== */
|
/* ============================================================================================== */
|
||||||
|
@ -62,6 +62,15 @@ int main()
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ZydisInstructionDecoder decoder;
|
||||||
|
if (!ZYDIS_SUCCESS(ZydisDecoderInitInstructionDecoderEx(
|
||||||
|
&decoder, controlBlock.machineMode,
|
||||||
|
ZYDIS_ADDRESS_WIDTH_INVALID, controlBlock.granularity)))
|
||||||
|
{
|
||||||
|
fputs("Failed to initialize decoder\n", stderr);
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
ZydisInstructionFormatter formatter;
|
ZydisInstructionFormatter formatter;
|
||||||
if (!ZYDIS_SUCCESS(ZydisFormatterInitInstructionFormatterEx(&formatter,
|
if (!ZYDIS_SUCCESS(ZydisFormatterInitInstructionFormatterEx(&formatter,
|
||||||
controlBlock.formatterStyle, controlBlock.formatterFlags, controlBlock.formatterAddrFormat,
|
controlBlock.formatterStyle, controlBlock.formatterFlags, controlBlock.formatterAddrFormat,
|
||||||
|
@ -80,12 +89,11 @@ int main()
|
||||||
ZydisInstructionInfo info;
|
ZydisInstructionInfo info;
|
||||||
ZydisStatus status;
|
ZydisStatus status;
|
||||||
size_t readOffs = 0;
|
size_t readOffs = 0;
|
||||||
while ((status = ZydisDecodeEx(
|
while ((status = ZydisDecoderDecodeBuffer(
|
||||||
controlBlock.operatingMode,
|
&decoder,
|
||||||
readBuf + readOffs,
|
readBuf + readOffs,
|
||||||
numBytesRead - readOffs,
|
numBytesRead - readOffs,
|
||||||
readOffs,
|
readOffs,
|
||||||
controlBlock.granularity,
|
|
||||||
&info
|
&info
|
||||||
)) != ZYDIS_STATUS_NO_MORE_DATA)
|
)) != ZYDIS_STATUS_NO_MORE_DATA)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue