Zydis
v3.2.1
|
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_ |
Defines the ZydisFormatterContext struct. More... | |
struct | ZydisFormatter_ |
Defines the ZydisFormatter struct. 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 |
Defines the ZydisFormatterStyle enum. More... | |
typedef enum ZydisFormatterProperty_ | ZydisFormatterProperty |
Defines the ZydisFormatterProperty enum. More... | |
typedef enum ZydisNumericBase_ | ZydisNumericBase |
Defines the ZydisNumericBase enum. More... | |
typedef enum ZydisSignedness_ | ZydisSignedness |
Defines the ZydisSignedness enum. More... | |
typedef enum ZydisPadding_ | ZydisPadding |
Defines the ZydisPadding enum. More... | |
typedef enum ZydisFormatterFunction_ | ZydisFormatterFunction |
Defines the ZydisFormatterFunction enum. More... | |
typedef enum ZydisDecorator_ | ZydisDecorator |
Defines the ZydisDecorator enum. More... | |
typedef struct ZydisFormatter_ | ZydisFormatter |
typedef struct ZydisFormatterContext_ | ZydisFormatterContext |
Defines the ZydisFormatterContext struct. 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, char *buffer, ZyanUSize length, ZyanU64 runtime_address) |
Formats the given instruction and writes it into the output buffer. More... | |
ZYDIS_EXPORT ZyanStatus | ZydisFormatterFormatInstructionEx (const ZydisFormatter *formatter, const ZydisDecodedInstruction *instruction, 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, ZyanU8 index, char *buffer, ZyanUSize length, ZyanU64 runtime_address) |
Formats the given operand and writes it into the output buffer. More... | |
ZYDIS_EXPORT ZyanStatus | ZydisFormatterFormatOperandEx (const ZydisFormatter *formatter, const ZydisDecodedInstruction *instruction, ZyanU8 index, 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, void *buffer, ZyanUSize length, ZyanU64 runtime_address, ZydisFormatterTokenConst **token) |
Tokenizes the given instruction and writes it into the output buffer. More... | |
ZYDIS_EXPORT ZyanStatus | ZydisFormatterTokenizeInstructionEx (const ZydisFormatter *formatter, const ZydisDecodedInstruction *instruction, 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, ZyanU8 index, void *buffer, ZyanUSize length, ZyanU64 runtime_address, ZydisFormatterTokenConst **token) |
Tokenizes the given operand and writes it into the output buffer. More... | |
ZYDIS_EXPORT ZyanStatus | ZydisFormatterTokenizeOperandEx (const ZydisFormatter *formatter, const ZydisDecodedInstruction *instruction, ZyanU8 index, 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 |
Defines the ZydisDecorator
enum.
typedef struct ZydisFormatter_ ZydisFormatter |
typedef struct ZydisFormatterContext_ ZydisFormatterContext |
Defines the ZydisFormatterContext
struct.
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 |
Defines the ZydisFormatterFunction
enum.
Do NOT change the order of the values this enum or the function fields inside the ZydisFormatter
struct.
typedef enum ZydisFormatterProperty_ ZydisFormatterProperty |
Defines the ZydisFormatterProperty
enum.
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 |
Defines the ZydisFormatterStyle
enum.
typedef enum ZydisNumericBase_ ZydisNumericBase |
Defines the ZydisNumericBase
enum.
typedef enum ZydisPadding_ ZydisPadding |
Defines the ZydisPadding
enum.
typedef enum ZydisSignedness_ ZydisSignedness |
Defines the ZydisSignedness
enum.
enum ZydisDecorator_ |
Defines the ZydisDecorator
enum.
Defines the ZydisFormatterFunction
enum.
Do NOT change the order of the values this enum or the function fields inside the ZydisFormatter
struct.
Defines the ZydisFormatterProperty
enum.
enum ZydisFormatterStyle_ |
Defines the ZydisFormatterStyle
enum.
enum ZydisNumericBase_ |
enum ZydisPadding_ |
Defines the ZydisPadding
enum.
enum ZydisSignedness_ |
Defines the ZydisSignedness
enum.