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. More... | |
Typedefs | |
typedef enum ZydisFormatterStyle_ | ZydisFormatterStyle |
Enum selecting the syntax to format the disassembly in. More... | |
typedef enum ZydisFormatterProperty_ | ZydisFormatterProperty |
Enum selecting a property of the formatter. More... | |
typedef enum ZydisNumericBase_ | ZydisNumericBase |
Enum defining different mantissae to be used during formatting. More... | |
typedef enum ZydisSignedness_ | ZydisSignedness |
Enum defining the signeness of integers to be used during formatting. More... | |
typedef enum ZydisPadding_ | ZydisPadding |
Enum definining magic values that receive special treatment when used as padding properties of the formatter. More... | |
typedef enum ZydisFormatterFunction_ | ZydisFormatterFunction |
Enum selecting a formatter function to be replaced with hooks. More... | |
typedef enum ZydisDecorator_ | ZydisDecorator |
Enum of all decorator types. More... | |
typedef struct ZydisFormatter_ | ZydisFormatter |
typedef struct ZydisFormatterContext_ | ZydisFormatterContext |
Context structure that that is passed to all formatter. More... | |
typedef ZyanStatus(* | ZydisFormatterFunc) (const ZydisFormatter *formatter, ZydisFormatterBuffer *buffer, ZydisFormatterContext *context) |
Defines the ZydisFormatterFunc function prototype. More... | |
typedef ZyanStatus(* | ZydisFormatterRegisterFunc) (const ZydisFormatter *formatter, ZydisFormatterBuffer *buffer, ZydisFormatterContext *context, ZydisRegister reg) |
Defines the ZydisFormatterRegisterFunc function prototype. More... | |
typedef ZyanStatus(* | ZydisFormatterDecoratorFunc) (const ZydisFormatter *formatter, ZydisFormatterBuffer *buffer, ZydisFormatterContext *context, ZydisDecorator decorator) |
Defines the ZydisFormatterDecoratorFunc function prototype. More... | |
Functions | |
ZYDIS_EXPORT ZyanStatus | ZydisFormatterInit (ZydisFormatter *formatter, ZydisFormatterStyle style) |
Initializes the given ZydisFormatter instance. More... | |
ZYDIS_EXPORT ZyanStatus | ZydisFormatterSetProperty (ZydisFormatter *formatter, ZydisFormatterProperty property, ZyanUPointer value) |
Changes the value of the specified formatter property . More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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_OPERAND
ZYDIS_FORMATTER_FUNC_POST_OPERAND
ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_REG
ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_MEM
ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_PTR
ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_IMM
This function prototype is used by functions of the following types:
ZYDIS_FORMATTER_FUNC_PRE_INSTRUCTION
ZYDIS_FORMATTER_FUNC_POST_INSTRUCTION
ZYDIS_FORMATTER_FUNC_PRE_OPERAND
ZYDIS_FORMATTER_FUNC_POST_OPERAND
ZYDIS_FORMATTER_FUNC_FORMAT_INSTRUCTION
ZYDIS_FORMATTER_FUNC_PRINT_MNEMONIC
ZYDIS_FORMATTER_FUNC_PRINT_PREFIXES
ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_REG
ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_MEM
ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_PTR
ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_IMM
ZYDIS_FORMATTER_FUNC_PRINT_ADDRESS_ABS
ZYDIS_FORMATTER_FUNC_PRINT_ADDRESS_REL
ZYDIS_FORMATTER_FUNC_PRINT_DISP
ZYDIS_FORMATTER_FUNC_PRINT_IMM
ZYDIS_FORMATTER_FUNC_PRINT_TYPECAST
ZYDIS_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.