mirror of https://github.com/x64dbg/zydis
Fixed a bug in ZYDIS_CHECK that caused functions to run more than once on certain conditions
This commit is contained in:
parent
9804bf1d3e
commit
5af25eee4b
|
@ -141,6 +141,20 @@ enum ZydisStatusCode
|
|||
*/
|
||||
#define ZYDIS_SUCCESS(status) (status == ZYDIS_STATUS_SUCCESS)
|
||||
|
||||
/**
|
||||
* @brief Checks if a zydis operation was successfull and returns the status-code, if not.
|
||||
*
|
||||
* @param status The zydis status-code to check.
|
||||
*/
|
||||
#define ZYDIS_CHECK(status) \
|
||||
{ \
|
||||
ZydisStatus s = status; \
|
||||
if (!ZYDIS_SUCCESS(s)) \
|
||||
{ \
|
||||
return s; \
|
||||
} \
|
||||
}
|
||||
|
||||
/* ============================================================================================== */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -29,20 +29,6 @@
|
|||
#include <Zydis/Decoder.h>
|
||||
#include <Zydis/Internal/InstructionTable.h>
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* Internal macros */
|
||||
/* ============================================================================================== */
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Helper macros */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
#define ZYDIS_CHECK(status) \
|
||||
if (status != ZYDIS_STATUS_SUCCESS) \
|
||||
{ \
|
||||
return status; \
|
||||
}
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* Internal functions */
|
||||
/* ============================================================================================== */
|
||||
|
@ -2291,6 +2277,7 @@ ZydisStatus ZydisDecoderInitInstructionDecoder(ZydisInstructionDecoder* decoder,
|
|||
decoder->disassemblerMode = disassemblerMode;
|
||||
decoder->input.buffer = NULL;
|
||||
decoder->input.bufferLen = 0;
|
||||
decoder->instructionPointer = 0;
|
||||
return ZYDIS_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,20 +32,6 @@
|
|||
#include <Zydis/Formatter.h>
|
||||
#include <Zydis/Utils.h>
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* Internal macros */
|
||||
/* ============================================================================================== */
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Helper macros */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
#define ZYDIS_CHECK(status) \
|
||||
if (status != ZYDIS_STATUS_SUCCESS) \
|
||||
{ \
|
||||
return status; \
|
||||
}
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* String formatting */
|
||||
/* ============================================================================================== */
|
||||
|
|
Loading…
Reference in New Issue