Zydis  v3.1.0
Formatter

Functions allowing formatting of previously decoded instructions to human readable text. 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...
 

Detailed Description

Functions allowing formatting of previously decoded instructions to human readable text.

Function Documentation

◆ ZydisFormatterFormatInstruction()

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.

Parameters
formatterA pointer to the ZydisFormatter instance.
instructionA pointer to the ZydisDecodedInstruction struct.
bufferA pointer to the output buffer.
lengthThe length of the output buffer (in characters).
runtime_addressThe runtime address of the instruction or ZYDIS_RUNTIME_ADDRESS_NONE to print relative addresses.
Returns
A zyan status code.

◆ ZydisFormatterFormatInstructionEx()

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.

Parameters
formatterA pointer to the ZydisFormatter instance.
instructionA pointer to the ZydisDecodedInstruction struct.
bufferA pointer to the output buffer.
lengthThe length of the output buffer (in characters).
runtime_addressThe runtime address of the instruction or ZYDIS_RUNTIME_ADDRESS_NONE to print relative addresses.
user_dataA pointer to user-defined data which can be used in custom formatter callbacks.
Returns
A zyan status code.

◆ ZydisFormatterFormatOperand()

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.

Parameters
formatterA pointer to the ZydisFormatter instance.
instructionA pointer to the ZydisDecodedInstruction struct.
indexThe index of the operand to format.
bufferA pointer to the output buffer.
lengthThe length of the output buffer (in characters).
runtime_addressThe runtime address of the instruction or ZYDIS_RUNTIME_ADDRESS_NONE to print relative addresses.
Returns
A zyan status code.

Use ZydisFormatterFormatInstruction or ZydisFormatterFormatInstructionEx to format a complete instruction.

◆ ZydisFormatterFormatOperandEx()

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.

Parameters
formatterA pointer to the ZydisFormatter instance.
instructionA pointer to the ZydisDecodedInstruction struct.
indexThe index of the operand to format.
bufferA pointer to the output buffer.
lengthThe length of the output buffer (in characters).
runtime_addressThe runtime address of the instruction or ZYDIS_RUNTIME_ADDRESS_NONE to print relative addresses.
user_dataA pointer to user-defined data which can be used in custom formatter callbacks.
Returns
A zyan status code.

Use ZydisFormatterFormatInstruction or ZydisFormatterFormatInstructionEx to format a complete instruction.

◆ ZydisFormatterInit()

ZYDIS_EXPORT ZyanStatus ZydisFormatterInit ( ZydisFormatter formatter,
ZydisFormatterStyle  style 
)

Initializes the given ZydisFormatter instance.

Parameters
formatterA pointer to the ZydisFormatter instance.
styleThe base formatter style (either AT&T or Intel style).
Returns
A zyan status code.

◆ ZydisFormatterSetHook()

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.

Parameters
formatterA pointer to the ZydisFormatter instance.
typeThe formatter function-type.
callbackA pointer to a variable that contains the pointer of the callback function and receives the pointer of the currently used function.
Returns
A zyan status code.

Call this function with callback pointing to a ZYAN_NULL value to retrieve the currently used function without replacing it.

This function returns ZYAN_STATUS_INVALID_OPERATION if a function can't be replaced for the current formatter-style.

◆ ZydisFormatterSetProperty()

ZYDIS_EXPORT ZyanStatus ZydisFormatterSetProperty ( ZydisFormatter formatter,
ZydisFormatterProperty  property,
ZyanUPointer  value 
)

Changes the value of the specified formatter property.

Parameters
formatterA pointer to the ZydisFormatter instance.
propertyThe id of the formatter-property.
valueThe new value.
Returns
A zyan status code.

This function returns ZYAN_STATUS_INVALID_OPERATION if a property can't be changed for the current formatter-style.

◆ ZydisFormatterTokenizeInstruction()

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.

Parameters
formatterA pointer to the ZydisFormatter instance.
instructionA pointer to the ZydisDecodedInstruction struct.
bufferA pointer to the output buffer.
lengthThe length of the output buffer (in bytes).
runtime_addressThe runtime address of the instruction or ZYDIS_RUNTIME_ADDRESS_NONE to print relative addresses.
tokenReceives a pointer to the first token in the output buffer.
Returns
A zyan status code.

◆ ZydisFormatterTokenizeInstructionEx()

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.

Parameters
formatterA pointer to the ZydisFormatter instance.
instructionA pointer to the ZydisDecodedInstruction struct.
bufferA pointer to the output buffer.
lengthThe length of the output buffer (in bytes).
runtime_addressThe runtime address of the instruction or ZYDIS_RUNTIME_ADDRESS_NONE to print relative addresses.
tokenReceives a pointer to the first token in the output buffer.
user_dataA pointer to user-defined data which can be used in custom formatter callbacks.
Returns
A zyan status code.

◆ ZydisFormatterTokenizeOperand()

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.

Parameters
formatterA pointer to the ZydisFormatter instance.
instructionA pointer to the ZydisDecodedInstruction struct.
indexThe index of the operand to format.
bufferA pointer to the output buffer.
lengthThe length of the output buffer (in bytes).
runtime_addressThe runtime address of the instruction or ZYDIS_RUNTIME_ADDRESS_NONE to print relative addresses.
tokenReceives a pointer to the first token in the output buffer.
Returns
A zyan status code.

Use ZydisFormatterTokenizeInstruction or ZydisFormatterTokenizeInstructionEx to tokenize a complete instruction.

◆ ZydisFormatterTokenizeOperandEx()

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.

Parameters
formatterA pointer to the ZydisFormatter instance.
instructionA pointer to the ZydisDecodedInstruction struct.
indexThe index of the operand to format.
bufferA pointer to the output buffer.
lengthThe length of the output buffer (in bytes).
runtime_addressThe runtime address of the instruction or ZYDIS_RUNTIME_ADDRESS_NONE to print relative addresses.
tokenReceives a pointer to the first token in the output buffer.
user_dataA pointer to user-defined data which can be used in custom formatter callbacks.
Returns
A zyan status code.

Use ZydisFormatterTokenizeInstruction or ZydisFormatterTokenizeInstructionEx to tokenize a complete instruction.