Merge branch 'develop' of github.com:zyantific/zyan-disassembler-engine into develop

This commit is contained in:
flobernd 2017-06-25 23:50:13 +02:00
commit 0c38e08306
2 changed files with 23 additions and 7 deletions

View File

@ -51,6 +51,14 @@ int main(int argc, char** argv)
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;
if (!ZYDIS_SUCCESS(ZydisFormatterInitInstructionFormatterEx(&formatter,
ZYDIS_FORMATTER_STYLE_INTEL, ZYDIS_FMTFLAG_FORCE_SEGMENTS | ZYDIS_FMTFLAG_FORCE_OPERANDSIZE,
@ -69,8 +77,8 @@ int main(int argc, char** argv)
ZydisInstructionInfo info;
ZydisStatus status;
size_t readOffs = 0;
while ((status = ZydisDecode(
ZYDIS_OPERATING_MODE_64BIT,
while ((status = ZydisDecoderDecodeBuffer(
&decoder,
readBuf + readOffs,
numBytesRead - readOffs,
readOffs,

View File

@ -40,13 +40,13 @@
#include <Zydis/Zydis.h>
typedef struct ZydisFuzzControlBlock_ {
ZydisOperatingMode operatingMode;
ZydisMachineMode machineMode;
ZydisDecodeGranularity granularity;
ZydisFormatterStyle formatterStyle;
ZydisFormatterFlags formatterFlags;
ZydisFormatterAddressFormat formatterAddrFormat;
ZydisFormatterDisplacementFormat formatterDispFormat;
ZydisFormatterImmediateFormat formatterImmFormat;
ZydisDecodeGranularity granularity;
} ZydisFuzzControlBlock;
/* ============================================================================================== */
@ -62,6 +62,15 @@ int main()
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;
if (!ZYDIS_SUCCESS(ZydisFormatterInitInstructionFormatterEx(&formatter,
controlBlock.formatterStyle, controlBlock.formatterFlags, controlBlock.formatterAddrFormat,
@ -80,12 +89,11 @@ int main()
ZydisInstructionInfo info;
ZydisStatus status;
size_t readOffs = 0;
while ((status = ZydisDecodeEx(
controlBlock.operatingMode,
while ((status = ZydisDecoderDecodeBuffer(
&decoder,
readBuf + readOffs,
numBytesRead - readOffs,
readOffs,
controlBlock.granularity,
&info
)) != ZYDIS_STATUS_NO_MORE_DATA)
{