diff --git a/include/Zydis/Formatter.h b/include/Zydis/Formatter.h index 033bbb4..8d8fca8 100644 --- a/include/Zydis/Formatter.h +++ b/include/Zydis/Formatter.h @@ -326,7 +326,7 @@ enum ZydisDecoratorTypes ZYDIS_DECORATOR_TYPE_MAX_VALUE = ZYDIS_DECORATOR_TYPE_EVICTION_HINT }; -typedef struct ZydisFormatter_ ZydisFormatter; +typedef struct ZydisFormatter_ ZydisFormatter; /** * @brief Defines the @c ZydisFormatterNotifyFunc function pointer. @@ -341,7 +341,7 @@ typedef struct ZydisFormatter_ ZydisFormatter; * @c ZYDIS_FORMATTER_HOOK_POST hook-types. */ typedef ZydisStatus (*ZydisFormatterNotifyFunc)(const ZydisFormatter* formatter, - ZydisDecodedInstruction* instruction); + const ZydisDecodedInstruction* instruction); /** * @brief Defines the @c ZydisFormatterFormatFunc function pointer. @@ -361,7 +361,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, ZydisDecodedInstruction* instruction); + char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction); /** * @brief Defines the @c ZydisFormatterFormatOperandFunc function pointer. @@ -397,8 +397,8 @@ typedef ZydisStatus (*ZydisFormatterFormatFunc)(const ZydisFormatter* formatter, * hook-types. */ typedef ZydisStatus (*ZydisFormatterFormatOperandFunc)(const ZydisFormatter* formatter, - char** buffer, size_t bufferLen, ZydisDecodedInstruction* instruction, - ZydisDecodedOperand* operand); + char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction, + const ZydisDecodedOperand* operand); /** * @brief Defines the @c ZydisFormatterFormatAddressFunc function pointer. @@ -419,8 +419,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, ZydisDecodedInstruction* instruction, - ZydisDecodedOperand* operand, uint64_t address); + char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction, + const ZydisDecodedOperand* operand, uint64_t address); /** * @brief Defines the @c ZydisFormatterFormatDecoratorFunc function pointer. @@ -444,8 +444,8 @@ 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, ZydisDecodedInstruction* instruction, - ZydisDecodedOperand* operand, ZydisDecoratorType type); + char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction, + const ZydisDecodedOperand* operand, ZydisDecoratorType type); /** * @brief Defines the @c ZydisFormatter struct. diff --git a/src/Formatter.c b/src/Formatter.c index bf1dafe..bb5bae4 100644 --- a/src/Formatter.c +++ b/src/Formatter.c @@ -47,7 +47,7 @@ /* ---------------------------------------------------------------------------------------------- */ static ZydisStatus ZydisFormatterPrintPrefixesIntel(const ZydisFormatter* formatter, - char** buffer, size_t bufferLen, ZydisDecodedInstruction* instruction) + char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction) { if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction) { @@ -90,7 +90,7 @@ static ZydisStatus ZydisFormatterPrintPrefixesIntel(const ZydisFormatter* format } static ZydisStatus ZydisFormatterPrintMnemonicIntel(const ZydisFormatter* formatter, - char** buffer, size_t bufferLen, ZydisDecodedInstruction* instruction) + char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction) { if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction) { @@ -117,8 +117,8 @@ static ZydisStatus ZydisFormatterPrintMnemonicIntel(const ZydisFormatter* format /* ---------------------------------------------------------------------------------------------- */ static ZydisStatus ZydisFormatterFormatOperandRegIntel(const ZydisFormatter* formatter, - char** buffer, size_t bufferLen, ZydisDecodedInstruction* instruction, - ZydisDecodedOperand* operand) + char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction, + const ZydisDecodedOperand* operand) { if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction || !operand) { @@ -139,8 +139,8 @@ static ZydisStatus ZydisFormatterFormatOperandRegIntel(const ZydisFormatter* for } static ZydisStatus ZydisFormatterFormatOperandMemIntel(const ZydisFormatter* formatter, - char** buffer, size_t bufferLen, ZydisDecodedInstruction* instruction, - ZydisDecodedOperand* operand) + char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction, + const ZydisDecodedOperand* operand) { if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction || !operand) { @@ -213,8 +213,8 @@ static ZydisStatus ZydisFormatterFormatOperandMemIntel(const ZydisFormatter* for } static ZydisStatus ZydisFormatterFormatOperandPtrIntel(const ZydisFormatter* formatter, - char** buffer, size_t bufferLen, ZydisDecodedInstruction* instruction, - ZydisDecodedOperand* operand) + char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction, + const ZydisDecodedOperand* operand) { if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction || !operand) { @@ -230,8 +230,8 @@ static ZydisStatus ZydisFormatterFormatOperandPtrIntel(const ZydisFormatter* for } static ZydisStatus ZydisFormatterFormatOperandImmIntel(const ZydisFormatter* formatter, - char** buffer, size_t bufferLen, ZydisDecodedInstruction* instruction, - ZydisDecodedOperand* operand) + char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction, + const ZydisDecodedOperand* operand) { if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction || !operand) { @@ -276,8 +276,8 @@ static ZydisStatus ZydisFormatterFormatOperandImmIntel(const ZydisFormatter* for /* ---------------------------------------------------------------------------------------------- */ static ZydisStatus ZydisFormatterPrintAddressIntel(const ZydisFormatter* formatter, - char** buffer, size_t bufferLen, ZydisDecodedInstruction* instruction, - ZydisDecodedOperand* operand, uint64_t address) + char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction, + const ZydisDecodedOperand* operand, uint64_t address) { if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction || !operand) { @@ -298,8 +298,8 @@ static ZydisStatus ZydisFormatterPrintAddressIntel(const ZydisFormatter* formatt } static ZydisStatus ZydisFormatterPrintDisplacementIntel(const ZydisFormatter* formatter, - char** buffer, size_t bufferLen, ZydisDecodedInstruction* instruction, - ZydisDecodedOperand* operand) + char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction, + const ZydisDecodedOperand* operand) { if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction || !operand) { @@ -332,8 +332,8 @@ static ZydisStatus ZydisFormatterPrintDisplacementIntel(const ZydisFormatter* fo } static ZydisStatus ZydisFormatterPrintImmediateIntel(const ZydisFormatter* formatter, - char** buffer, size_t bufferLen, ZydisDecodedInstruction* instruction, - ZydisDecodedOperand* operand) + char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction, + const ZydisDecodedOperand* operand) { if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction || !operand) { @@ -388,8 +388,8 @@ static ZydisStatus ZydisFormatterPrintImmediateIntel(const ZydisFormatter* forma /* ---------------------------------------------------------------------------------------------- */ static ZydisStatus ZydisFormatterPrintOperandSizeIntel(const ZydisFormatter* formatter, - char** buffer, size_t bufferLen, ZydisDecodedInstruction* instruction, - ZydisDecodedOperand* operand) + char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction, + const ZydisDecodedOperand* operand) { if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction || !operand) { @@ -486,8 +486,8 @@ static ZydisStatus ZydisFormatterPrintOperandSizeIntel(const ZydisFormatter* for } static ZydisStatus ZydisFormatterPrintSegmentIntel(const ZydisFormatter* formatter, - char** buffer, size_t bufferLen, ZydisDecodedInstruction* instruction, - ZydisDecodedOperand* operand) + char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction, + const ZydisDecodedOperand* operand) { if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction || !operand) { @@ -532,8 +532,8 @@ static ZydisStatus ZydisFormatterPrintSegmentIntel(const ZydisFormatter* formatt } static ZydisStatus ZydisFormatterPrintDecoratorIntel(const ZydisFormatter* formatter, - char** buffer, size_t bufferLen, ZydisDecodedInstruction* instruction, - ZydisDecodedOperand* operand, ZydisDecoratorType type) + char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction, + const ZydisDecodedOperand* operand, ZydisDecoratorType type) { if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction || !operand) { @@ -742,7 +742,7 @@ static ZydisStatus ZydisFormatterPrintDecoratorIntel(const ZydisFormatter* forma } static ZydisStatus ZydisFormatterFormatInstrIntel(const ZydisFormatter* formatter, - char** buffer, size_t bufferLen, ZydisDecodedInstruction* instruction) + char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction) { if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction) {