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

This commit is contained in:
flobernd 2017-11-25 16:30:10 +01:00
commit dd9d9134d4
9 changed files with 19 additions and 16 deletions

View File

@ -75,6 +75,12 @@
# error "Unsupported word size." # error "Unsupported word size."
#endif #endif
/* ============================================================================================== */
/* NULL */
/* ============================================================================================== */
#define ZYDIS_NULL ((void*)0)
/* ============================================================================================== */ /* ============================================================================================== */
/* Boolean */ /* Boolean */
/* ============================================================================================== */ /* ============================================================================================== */

View File

@ -24,7 +24,6 @@
***************************************************************************************************/ ***************************************************************************************************/
#include <string.h>
#include <Zydis/Decoder.h> #include <Zydis/Decoder.h>
#include <Zydis/Status.h> #include <Zydis/Status.h>
#include <DecoderData.h> #include <DecoderData.h>
@ -4237,7 +4236,7 @@ static ZydisStatus ZydisDecodeInstruction(ZydisDecoderContext* context,
// Iterate through the decoder tree // Iterate through the decoder tree
const ZydisDecoderTreeNode* node = ZydisDecoderTreeGetRootNode(); const ZydisDecoderTreeNode* node = ZydisDecoderTreeGetRootNode();
const ZydisDecoderTreeNode* temp = NULL; const ZydisDecoderTreeNode* temp = ZYDIS_NULL;
ZydisDecoderTreeNodeType nodeType; ZydisDecoderTreeNodeType nodeType;
do do
{ {
@ -4250,7 +4249,7 @@ static ZydisStatus ZydisDecodeInstruction(ZydisDecoderContext* context,
if (temp) if (temp)
{ {
node = temp; node = temp;
temp = NULL; temp = ZYDIS_NULL;
nodeType = ZYDIS_NODETYPE_FILTER_MANDATORY_PREFIX; nodeType = ZYDIS_NODETYPE_FILTER_MANDATORY_PREFIX;
if (context->mandatoryCandidate == 0x66) if (context->mandatoryCandidate == 0x66)
{ {

View File

@ -24,8 +24,6 @@
***************************************************************************************************/ ***************************************************************************************************/
#include <string.h>
#include <ctype.h>
#include <FormatHelper.h> #include <FormatHelper.h>
#include <LibC.h> #include <LibC.h>
@ -408,7 +406,7 @@ ZydisStatus ZydisPrintHexS(char** buffer, ZydisUSize bufferLen, ZydisI64 value,
ZYDIS_CHECK(ZydisPrintStr(buffer, bufEnd - *buffer, prefix, ZYDIS_LETTER_CASE_DEFAULT)); ZYDIS_CHECK(ZydisPrintStr(buffer, bufEnd - *buffer, prefix, ZYDIS_LETTER_CASE_DEFAULT));
} }
return ZydisPrintHexU(buffer, bufEnd - *buffer, -value, paddingLength, uppercase, return ZydisPrintHexU(buffer, bufEnd - *buffer, -value, paddingLength, uppercase,
NULL, suffix); ZYDIS_NULL, suffix);
} }
return ZydisPrintHexU(buffer, bufferLen, value, paddingLength, uppercase, prefix, suffix); return ZydisPrintHexU(buffer, bufferLen, value, paddingLength, uppercase, prefix, suffix);
} }

View File

@ -24,7 +24,6 @@
***************************************************************************************************/ ***************************************************************************************************/
#include <string.h>
#include <Zydis/CommonTypes.h> #include <Zydis/CommonTypes.h>
#include <Zydis/Formatter.h> #include <Zydis/Formatter.h>
#include <Zydis/Utils.h> #include <Zydis/Utils.h>
@ -475,7 +474,7 @@ static ZydisStatus ZydisFormatterPrintOperandSizeIntel(const ZydisFormatter* for
} }
if (typecast) if (typecast)
{ {
const char* str = NULL; const char* str = ZYDIS_NULL;
switch (typecast) switch (typecast)
{ {
case 8: case 8:
@ -919,7 +918,7 @@ ZydisStatus ZydisFormatterInit(ZydisFormatter* formatter, ZydisFormatterStyle st
formatter->immediateFormat = ZYDIS_IMM_FORMAT_HEX_UNSIGNED; formatter->immediateFormat = ZYDIS_IMM_FORMAT_HEX_UNSIGNED;
formatter->hexUppercase = ZYDIS_TRUE; formatter->hexUppercase = ZYDIS_TRUE;
formatter->hexPrefix = "0x"; formatter->hexPrefix = "0x";
formatter->hexSuffix = NULL; formatter->hexSuffix = ZYDIS_NULL;
formatter->hexPaddingAddress = 2; formatter->hexPaddingAddress = 2;
formatter->hexPaddingDisplacement = 2; formatter->hexPaddingDisplacement = 2;
formatter->hexPaddingImmediate = 2; formatter->hexPaddingImmediate = 2;
@ -1151,7 +1150,7 @@ ZydisStatus ZydisFormatterSetHook(ZydisFormatter* formatter, ZydisFormatterHookT
ZydisStatus ZydisFormatterFormatInstruction(const ZydisFormatter* formatter, ZydisStatus ZydisFormatterFormatInstruction(const ZydisFormatter* formatter,
const ZydisDecodedInstruction* instruction, char* buffer, ZydisUSize bufferLen) const ZydisDecodedInstruction* instruction, char* buffer, ZydisUSize bufferLen)
{ {
return ZydisFormatterFormatInstructionEx(formatter, instruction, buffer, bufferLen, NULL); return ZydisFormatterFormatInstructionEx(formatter, instruction, buffer, bufferLen, ZYDIS_NULL);
} }
ZydisStatus ZydisFormatterFormatInstructionEx(const ZydisFormatter* formatter, ZydisStatus ZydisFormatterFormatInstructionEx(const ZydisFormatter* formatter,

View File

@ -36,6 +36,7 @@
/* LibC is available */ /* LibC is available */
/* ============================================================================================== */ /* ============================================================================================== */
# include <string.h>
# define ZydisMemoryCopy memcpy # define ZydisMemoryCopy memcpy
# define ZydisMemorySet memset # define ZydisMemorySet memset
# define ZydisStrLen strlen # define ZydisStrLen strlen

View File

@ -42,7 +42,7 @@ const char* ZydisCategoryGetString(ZydisInstructionCategory category)
{ {
if (category > ZYDIS_ARRAY_SIZE(zydisInstructionCategoryStrings) - 1) if (category > ZYDIS_ARRAY_SIZE(zydisInstructionCategoryStrings) - 1)
{ {
return NULL; return ZYDIS_NULL;
} }
return zydisInstructionCategoryStrings[category]; return zydisInstructionCategoryStrings[category];
} }
@ -51,7 +51,7 @@ const char* ZydisISASetGetString(ZydisISASet isaSet)
{ {
if (isaSet > ZYDIS_ARRAY_SIZE(zydisISASetStrings) - 1) if (isaSet > ZYDIS_ARRAY_SIZE(zydisISASetStrings) - 1)
{ {
return NULL; return ZYDIS_NULL;
} }
return zydisISASetStrings[isaSet]; return zydisISASetStrings[isaSet];
} }
@ -60,7 +60,7 @@ const char* ZydisISAExtGetString(ZydisISAExt isaExt)
{ {
if (isaExt > ZYDIS_ARRAY_SIZE(zydisISAExtStrings) - 1) if (isaExt > ZYDIS_ARRAY_SIZE(zydisISAExtStrings) - 1)
{ {
return NULL; return ZYDIS_NULL;
} }
return zydisISAExtStrings[isaExt]; return zydisISAExtStrings[isaExt];
} }

View File

@ -40,7 +40,7 @@ const char* ZydisMnemonicGetString(ZydisMnemonic mnemonic)
{ {
if (mnemonic > ZYDIS_ARRAY_SIZE(zydisMnemonicStrings) - 1) if (mnemonic > ZYDIS_ARRAY_SIZE(zydisMnemonicStrings) - 1)
{ {
return NULL; return ZYDIS_NULL;
} }
return zydisMnemonicStrings[mnemonic]; return zydisMnemonicStrings[mnemonic];
} }

View File

@ -270,7 +270,7 @@ const char* ZydisRegisterGetString(ZydisRegister reg)
{ {
if (reg > (sizeof(registerStrings) / sizeof(registerStrings[0])) - 1) if (reg > (sizeof(registerStrings) / sizeof(registerStrings[0])) - 1)
{ {
return NULL; return ZYDIS_NULL;
} }
return registerStrings[reg]; return registerStrings[reg];
} }

View File

@ -141,7 +141,7 @@ ZydisU8 ZydisGetOperandDefinitions(const ZydisInstructionDefinition* definition,
{ {
if (definition->operandCount == 0) if (definition->operandCount == 0)
{ {
*operand = NULL; *operand = ZYDIS_NULL;
return 0; return 0;
} }
ZYDIS_ASSERT(definition->operandReference != 0xFFFF); ZYDIS_ASSERT(definition->operandReference != 0xFFFF);