|
Zydis v4.1.0
|
Functions for formatting instructions to human-readable text. More...
#include <Zycore/Defines.h>#include <Zycore/String.h>#include <Zycore/Types.h>#include <Zydis/DecoderTypes.h>#include <Zydis/FormatterBuffer.h>Go to the source code of this file.
Data Structures | |
| struct | ZydisFormatterContext_ |
| Context structure that that is passed to all formatter. More... | |
| struct | ZydisFormatter_ |
| Context structure keeping track of internal state of the formatter. More... | |
Macros | |
| #define | ZYDIS_RUNTIME_ADDRESS_NONE (ZyanU64)(-1) |
Use this constant as value for runtime_address in ZydisFormatterFormatInstruction(Ex) or ZydisFormatterFormatOperand(Ex) to print relative values for all addresses. | |
Typedefs | |
| typedef enum ZydisFormatterStyle_ | ZydisFormatterStyle |
| Enum selecting the syntax to format the disassembly in. | |
| typedef enum ZydisFormatterProperty_ | ZydisFormatterProperty |
| Enum selecting a property of the formatter. | |
| typedef enum ZydisNumericBase_ | ZydisNumericBase |
| Enum defining different mantissae to be used during formatting. | |
| typedef enum ZydisSignedness_ | ZydisSignedness |
| Enum defining the signeness of integers to be used during formatting. | |
| typedef enum ZydisPadding_ | ZydisPadding |
| Enum definining magic values that receive special treatment when used as padding properties of the formatter. | |
| typedef enum ZydisFormatterFunction_ | ZydisFormatterFunction |
| Enum selecting a formatter function to be replaced with hooks. | |
| typedef enum ZydisDecorator_ | ZydisDecorator |
| Enum of all decorator types. | |
| typedef struct ZydisFormatter_ | ZydisFormatter |
| typedef struct ZydisFormatterContext_ | ZydisFormatterContext |
| Context structure that that is passed to all formatter. | |
| typedef ZyanStatus(* | ZydisFormatterFunc) (const ZydisFormatter *formatter, ZydisFormatterBuffer *buffer, ZydisFormatterContext *context) |
Defines the ZydisFormatterFunc function prototype. | |
| typedef ZyanStatus(* | ZydisFormatterRegisterFunc) (const ZydisFormatter *formatter, ZydisFormatterBuffer *buffer, ZydisFormatterContext *context, ZydisRegister reg) |
Defines the ZydisFormatterRegisterFunc function prototype. | |
| typedef ZyanStatus(* | ZydisFormatterDecoratorFunc) (const ZydisFormatter *formatter, ZydisFormatterBuffer *buffer, ZydisFormatterContext *context, ZydisDecorator decorator) |
Defines the ZydisFormatterDecoratorFunc function prototype. | |
Functions | |
| ZYDIS_EXPORT ZyanStatus | ZydisFormatterInit (ZydisFormatter *formatter, ZydisFormatterStyle style) |
Initializes the given ZydisFormatter instance. | |
| ZYDIS_EXPORT ZyanStatus | ZydisFormatterSetProperty (ZydisFormatter *formatter, ZydisFormatterProperty property, ZyanUPointer value) |
Changes the value of the specified formatter property. | |
| ZYDIS_EXPORT ZyanStatus | ZydisFormatterSetHook (ZydisFormatter *formatter, ZydisFormatterFunction type, const void **callback) |
| Replaces a formatter function with a custom callback and/or retrieves the currently used function. | |
| ZYDIS_EXPORT ZyanStatus | ZydisFormatterFormatInstruction (const ZydisFormatter *formatter, const ZydisDecodedInstruction *instruction, const ZydisDecodedOperand *operands, ZyanU8 operand_count, char *buffer, ZyanUSize length, ZyanU64 runtime_address, void *user_data) |
| Formats the given instruction and writes it into the output buffer. | |
| ZYDIS_EXPORT ZyanStatus | ZydisFormatterFormatOperand (const ZydisFormatter *formatter, const ZydisDecodedInstruction *instruction, const ZydisDecodedOperand *operand, char *buffer, ZyanUSize length, ZyanU64 runtime_address, void *user_data) |
| Formats the given operand and writes it into the output buffer. | |
| ZYDIS_EXPORT ZyanStatus | ZydisFormatterTokenizeInstruction (const ZydisFormatter *formatter, const ZydisDecodedInstruction *instruction, const ZydisDecodedOperand *operands, ZyanU8 operand_count, void *buffer, ZyanUSize length, ZyanU64 runtime_address, ZydisFormatterTokenConst **token, void *user_data) |
| Tokenizes the given instruction and writes it into the output buffer. | |
| ZYDIS_EXPORT ZyanStatus | ZydisFormatterTokenizeOperand (const ZydisFormatter *formatter, const ZydisDecodedInstruction *instruction, const ZydisDecodedOperand *operand, void *buffer, ZyanUSize length, ZyanU64 runtime_address, ZydisFormatterTokenConst **token, void *user_data) |
| Tokenizes the given operand and writes it into the output buffer. | |
Functions for formatting instructions to human-readable text.
| #define ZYDIS_RUNTIME_ADDRESS_NONE (ZyanU64)(-1) |
Use this constant as value for runtime_address in ZydisFormatterFormatInstruction(Ex) or ZydisFormatterFormatOperand(Ex) to print relative values for all addresses.
| typedef enum ZydisDecorator_ ZydisDecorator |
Enum of all decorator types.
| typedef struct ZydisFormatter_ ZydisFormatter |
| typedef struct ZydisFormatterContext_ ZydisFormatterContext |
Context structure that that is passed to all formatter.
| typedef ZyanStatus(* ZydisFormatterDecoratorFunc) (const ZydisFormatter *formatter, ZydisFormatterBuffer *buffer, ZydisFormatterContext *context, ZydisDecorator decorator) |
Defines the ZydisFormatterDecoratorFunc function prototype.
| formatter | A pointer to the ZydisFormatter instance. |
| buffer | A pointer to the ZydisFormatterBuffer struct. |
| context | A pointer to the ZydisFormatterContext struct. |
| decorator | The decorator type. |
ZYAN_STATUS_SUCCESS will immediately cause the formatting process to fail.This function type is used for:
ZYDIS_FORMATTER_FUNC_PRINT_DECORATOR | typedef ZyanStatus(* ZydisFormatterFunc) (const ZydisFormatter *formatter, ZydisFormatterBuffer *buffer, ZydisFormatterContext *context) |
Defines the ZydisFormatterFunc function prototype.
| formatter | A pointer to the ZydisFormatter instance. |
| buffer | A pointer to the ZydisFormatterBuffer struct. |
| context | A pointer to the ZydisFormatterContext struct. |
Returning a status code other than ZYAN_STATUS_SUCCESS will immediately cause the formatting process to fail (see exceptions below).
Returning ZYDIS_STATUS_SKIP_TOKEN is valid for functions of the following types and will instruct the formatter to omit the whole operand:
ZYDIS_FORMATTER_FUNC_PRE_OPERANDZYDIS_FORMATTER_FUNC_POST_OPERANDZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_REGZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_MEMZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_PTRZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_IMMThis function prototype is used by functions of the following types:
ZYDIS_FORMATTER_FUNC_PRE_INSTRUCTIONZYDIS_FORMATTER_FUNC_POST_INSTRUCTIONZYDIS_FORMATTER_FUNC_PRE_OPERANDZYDIS_FORMATTER_FUNC_POST_OPERANDZYDIS_FORMATTER_FUNC_FORMAT_INSTRUCTIONZYDIS_FORMATTER_FUNC_PRINT_MNEMONICZYDIS_FORMATTER_FUNC_PRINT_PREFIXESZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_REGZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_MEMZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_PTRZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_IMMZYDIS_FORMATTER_FUNC_PRINT_ADDRESS_ABSZYDIS_FORMATTER_FUNC_PRINT_ADDRESS_RELZYDIS_FORMATTER_FUNC_PRINT_DISPZYDIS_FORMATTER_FUNC_PRINT_IMMZYDIS_FORMATTER_FUNC_PRINT_TYPECASTZYDIS_FORMATTER_FUNC_PRINT_SEGMENT | typedef enum ZydisFormatterFunction_ ZydisFormatterFunction |
Enum selecting a formatter function to be replaced with hooks.
Do NOT change the order of the values this enum or the function fields inside the ZydisFormatter struct.
| typedef enum ZydisFormatterProperty_ ZydisFormatterProperty |
Enum selecting a property of the formatter.
| typedef ZyanStatus(* ZydisFormatterRegisterFunc) (const ZydisFormatter *formatter, ZydisFormatterBuffer *buffer, ZydisFormatterContext *context, ZydisRegister reg) |
Defines the ZydisFormatterRegisterFunc function prototype.
| formatter | A pointer to the ZydisFormatter instance. |
| buffer | A pointer to the ZydisFormatterBuffer struct. |
| context | A pointer to the ZydisFormatterContext struct. |
| reg | The register. |
ZYAN_STATUS_SUCCESS will immediately cause the formatting process to fail.This function prototype is used by functions of the following types:
ZYDIS_FORMATTER_FUNC_PRINT_REGISTER. | typedef enum ZydisFormatterStyle_ ZydisFormatterStyle |
Enum selecting the syntax to format the disassembly in.
| typedef enum ZydisNumericBase_ ZydisNumericBase |
Enum defining different mantissae to be used during formatting.
| typedef enum ZydisPadding_ ZydisPadding |
Enum definining magic values that receive special treatment when used as padding properties of the formatter.
| typedef enum ZydisSignedness_ ZydisSignedness |
Enum defining the signeness of integers to be used during formatting.
| enum ZydisDecorator_ |
Enum of all decorator types.
Enum selecting a formatter function to be replaced with hooks.
Do NOT change the order of the values this enum or the function fields inside the ZydisFormatter struct.
Enum selecting a property of the formatter.
| enum ZydisFormatterStyle_ |
Enum selecting the syntax to format the disassembly in.
| enum ZydisNumericBase_ |
Enum defining different mantissae to be used during formatting.
| enum ZydisPadding_ |
Enum definining magic values that receive special treatment when used as padding properties of the formatter.
| enum ZydisSignedness_ |
Enum defining the signeness of integers to be used during formatting.