Zydis  v2.0.3
Formatter.h File Reference

Functions for formatting human-readable instructions. More...

#include <Zydis/DecoderTypes.h>
#include <Zydis/Defines.h>
#include <Zydis/Status.h>
#include <Zydis/String.h>
Include dependency graph for Formatter.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ZydisFormatter_
 Defines the ZydisFormatter struct. More...
 

Typedefs

typedef ZydisU8 ZydisFormatterStyle
 Defines the ZydisFormatterStyle datatype. More...
 
typedef ZydisU8 ZydisFormatterProperty
 Defines the ZydisFormatterProperty datatype. More...
 
typedef ZydisU8 ZydisFormatterHookType
 Defines the ZydisFormatterHookType datatype. More...
 
typedef ZydisU8 ZydisDecoratorType
 Defines the ZydisDecoratorType datatype. More...
 
typedef struct ZydisFormatter_ ZydisFormatter
 
typedef ZydisStatus(* ZydisFormatterFunc) (const ZydisFormatter *formatter, ZydisString *string, const ZydisDecodedInstruction *instruction, void *userData)
 Defines the ZydisFormatterFunc function pointer. More...
 
typedef ZydisStatus(* ZydisFormatterOperandFunc) (const ZydisFormatter *formatter, ZydisString *string, const ZydisDecodedInstruction *instruction, const ZydisDecodedOperand *operand, void *userData)
 Defines the ZydisFormatterOperandFunc function pointer. More...
 
typedef ZydisStatus(* ZydisFormatterRegisterFunc) (const ZydisFormatter *formatter, ZydisString *string, const ZydisDecodedInstruction *instruction, const ZydisDecodedOperand *operand, ZydisRegister reg, void *userData)
 Defines the ZydisFormatterRegisterFunc function pointer. More...
 
typedef ZydisStatus(* ZydisFormatterAddressFunc) (const ZydisFormatter *formatter, ZydisString *string, const ZydisDecodedInstruction *instruction, const ZydisDecodedOperand *operand, ZydisU64 address, void *userData)
 Defines the ZydisFormatterAddressFunc function pointer. More...
 
typedef ZydisStatus(* ZydisFormatterDecoratorFunc) (const ZydisFormatter *formatter, ZydisString *string, const ZydisDecodedInstruction *instruction, const ZydisDecodedOperand *operand, ZydisDecoratorType decorator, void *userData)
 Defines the ZydisFormatterDecoratorFunc function pointer. More...
 

Enumerations

enum  ZydisFormatterStyles { ZYDIS_FORMATTER_STYLE_INTEL , ZYDIS_FORMATTER_STYLE_MAX_VALUE = ZYDIS_FORMATTER_STYLE_INTEL }
 Values that represent formatter-styles. More...
 
enum  ZydisFormatterProperties {
  ZYDIS_FORMATTER_PROP_UPPERCASE , ZYDIS_FORMATTER_PROP_FORCE_MEMSEG , ZYDIS_FORMATTER_PROP_FORCE_MEMSIZE , ZYDIS_FORMATTER_PROP_ADDR_FORMAT ,
  ZYDIS_FORMATTER_PROP_DISP_FORMAT , ZYDIS_FORMATTER_PROP_IMM_FORMAT , ZYDIS_FORMATTER_PROP_HEX_UPPERCASE , ZYDIS_FORMATTER_PROP_HEX_PREFIX ,
  ZYDIS_FORMATTER_PROP_HEX_SUFFIX , ZYDIS_FORMATTER_PROP_HEX_PADDING_ADDR , ZYDIS_FORMATTER_PROP_HEX_PADDING_DISP , ZYDIS_FORMATTER_PROP_HEX_PADDING_IMM ,
  ZYDIS_FORMATTER_PROP_MAX_VALUE = ZYDIS_FORMATTER_PROP_HEX_PADDING_IMM
}
 Values that represent formatter-properties. More...
 
enum  ZydisAddressFormat { ZYDIS_ADDR_FORMAT_ABSOLUTE , ZYDIS_ADDR_FORMAT_RELATIVE_SIGNED , ZYDIS_ADDR_FORMAT_RELATIVE_UNSIGNED , ZYDIS_ADDR_FORMAT_MAX_VALUE = ZYDIS_ADDR_FORMAT_RELATIVE_UNSIGNED }
 Values that represent address-formats. More...
 
enum  ZydisDisplacementFormat { ZYDIS_DISP_FORMAT_HEX_SIGNED , ZYDIS_DISP_FORMAT_HEX_UNSIGNED , ZYDIS_DISP_FORMAT_MAX_VALUE = ZYDIS_DISP_FORMAT_HEX_UNSIGNED }
 Values that represent displacement-formats. More...
 
enum  ZydisImmediateFormat { ZYDIS_IMM_FORMAT_HEX_AUTO , ZYDIS_IMM_FORMAT_HEX_SIGNED , ZYDIS_IMM_FORMAT_HEX_UNSIGNED , ZYDIS_IMM_FORMAT_MAX_VALUE = ZYDIS_IMM_FORMAT_HEX_UNSIGNED }
 Values that represent formatter immediate-formats. More...
 
enum  ZydisFormatterHookTypes {
  ZYDIS_FORMATTER_HOOK_PRE_INSTRUCTION , ZYDIS_FORMATTER_HOOK_POST_INSTRUCTION , ZYDIS_FORMATTER_HOOK_PRE_OPERAND , ZYDIS_FORMATTER_HOOK_POST_OPERAND ,
  ZYDIS_FORMATTER_HOOK_FORMAT_INSTRUCTION , ZYDIS_FORMATTER_HOOK_FORMAT_OPERAND_REG , ZYDIS_FORMATTER_HOOK_FORMAT_OPERAND_MEM , ZYDIS_FORMATTER_HOOK_FORMAT_OPERAND_PTR ,
  ZYDIS_FORMATTER_HOOK_FORMAT_OPERAND_IMM , ZYDIS_FORMATTER_HOOK_PRINT_MNEMONIC , ZYDIS_FORMATTER_HOOK_PRINT_REGISTER , ZYDIS_FORMATTER_HOOK_PRINT_ADDRESS ,
  ZYDIS_FORMATTER_HOOK_PRINT_DISP , ZYDIS_FORMATTER_HOOK_PRINT_IMM , ZYDIS_FORMATTER_HOOK_PRINT_MEMSIZE , ZYDIS_FORMATTER_HOOK_PRINT_PREFIXES ,
  ZYDIS_FORMATTER_HOOK_PRINT_DECORATOR , ZYDIS_FORMATTER_HOOK_MAX_VALUE = ZYDIS_FORMATTER_HOOK_PRINT_DECORATOR
}
 Values that represent formatter hook-types. More...
 
enum  ZydisDecoratorTypes {
  ZYDIS_DECORATOR_TYPE_INVALID , ZYDIS_DECORATOR_TYPE_MASK , ZYDIS_DECORATOR_TYPE_BC , ZYDIS_DECORATOR_TYPE_RC ,
  ZYDIS_DECORATOR_TYPE_SAE , ZYDIS_DECORATOR_TYPE_SWIZZLE , ZYDIS_DECORATOR_TYPE_CONVERSION , ZYDIS_DECORATOR_TYPE_EH ,
  ZYDIS_DECORATOR_TYPE_MAX_VALUE = ZYDIS_DECORATOR_TYPE_EH
}
 Values that represent decorator-types. More...
 

Functions

ZYDIS_EXPORT ZydisStatus ZydisFormatterInit (ZydisFormatter *formatter, ZydisFormatterStyle style)
 Initializes the given ZydisFormatter instance. More...
 
ZYDIS_EXPORT ZydisStatus ZydisFormatterSetProperty (ZydisFormatter *formatter, ZydisFormatterProperty property, ZydisUPointer value)
 Sets the value of the specified formatter attribute. More...
 
ZYDIS_EXPORT ZydisStatus ZydisFormatterSetHook (ZydisFormatter *formatter, ZydisFormatterHookType hook, const void **callback)
 Replaces a formatter function with a custom callback and/or retrieves the currently used function. More...
 
ZYDIS_EXPORT ZydisStatus ZydisFormatterFormatInstruction (const ZydisFormatter *formatter, const ZydisDecodedInstruction *instruction, char *buffer, ZydisUSize bufferLen)
 Formats the given instruction and writes it into the output buffer. More...
 
ZYDIS_EXPORT ZydisStatus ZydisFormatterFormatInstructionEx (const ZydisFormatter *formatter, const ZydisDecodedInstruction *instruction, char *buffer, ZydisUSize bufferLen, void *userData)
 Formats the given instruction and writes it into the output buffer. More...
 
ZYDIS_EXPORT ZydisStatus ZydisFormatterFormatOperand (const ZydisFormatter *formatter, const ZydisDecodedInstruction *instruction, ZydisU8 index, char *buffer, ZydisUSize bufferLen)
 Formats the given operand and writes it into the output buffer. More...
 
ZYDIS_EXPORT ZydisStatus ZydisFormatterFormatOperandEx (const ZydisFormatter *formatter, const ZydisDecodedInstruction *instruction, ZydisU8 index, char *buffer, ZydisUSize bufferLen, void *userData)
 Formats the given operand and writes it into the output buffer. More...
 

Detailed Description

Functions for formatting human-readable instructions.

Typedef Documentation

◆ ZydisDecoratorType

Defines the ZydisDecoratorType datatype.

◆ ZydisFormatter

◆ ZydisFormatterAddressFunc

typedef ZydisStatus(* ZydisFormatterAddressFunc) (const ZydisFormatter *formatter, ZydisString *string, const ZydisDecodedInstruction *instruction, const ZydisDecodedOperand *operand, ZydisU64 address, void *userData)

Defines the ZydisFormatterAddressFunc function pointer.

Parameters
formatterA pointer to the ZydisFormatter instance.
stringA pointer to the string.
instructionA pointer to the ZydisDecodedInstruction struct.
operandA pointer to the ZydisDecodedOperand struct.
addressThe address.
userDataA pointer to user-defined data.
Returns
Returning a status code other than ZYDIS_STATUS_SUCCESS will immediately cause the formatting process to fail.

This function type is used for:

  • ZYDIS_FORMATTER_HOOK_PRINT_ADDRESS

◆ ZydisFormatterDecoratorFunc

typedef ZydisStatus(* ZydisFormatterDecoratorFunc) (const ZydisFormatter *formatter, ZydisString *string, const ZydisDecodedInstruction *instruction, const ZydisDecodedOperand *operand, ZydisDecoratorType decorator, void *userData)

Defines the ZydisFormatterDecoratorFunc function pointer.

Parameters
formatterA pointer to the ZydisFormatter instance.
stringA pointer to the string.
instructionA pointer to the ZydisDecodedInstruction struct.
operandA pointer to the ZydisDecodedOperand struct.
decoratorThe decorator type.
userDataA pointer to user-defined data.
Returns
Returning a status code other than ZYDIS_STATUS_SUCCESS will immediately cause the formatting process to fail.

This function type is used for:

  • ZYDIS_FORMATTER_HOOK_PRINT_DECORATOR

◆ ZydisFormatterFunc

typedef ZydisStatus(* ZydisFormatterFunc) (const ZydisFormatter *formatter, ZydisString *string, const ZydisDecodedInstruction *instruction, void *userData)

Defines the ZydisFormatterFunc function pointer.

Parameters
formatterA pointer to the ZydisFormatter instance.
stringA pointer to the string.
instructionA pointer to the ZydisDecodedInstruction struct.
userDataA pointer to user-defined data.
Returns
A zydis status code.

Returning a status code other than ZYDIS_STATUS_SUCCESS will immediately cause the formatting process to fail.

This function type is used for:

  • ZYDIS_FORMATTER_HOOK_PRE_INSTRUCTION
  • ZYDIS_FORMATTER_HOOK_POST_INSTRUCTION
  • ZYDIS_FORMATTER_HOOK_FORMAT_INSTRUCTION
  • ZYDIS_FORMATTER_HOOK_PRINT_MNEMONIC
  • ZYDIS_FORMATTER_HOOK_PRINT_PREFIXES

◆ ZydisFormatterHookType

Defines the ZydisFormatterHookType datatype.

◆ ZydisFormatterOperandFunc

typedef ZydisStatus(* ZydisFormatterOperandFunc) (const ZydisFormatter *formatter, ZydisString *string, const ZydisDecodedInstruction *instruction, const ZydisDecodedOperand *operand, void *userData)

Defines the ZydisFormatterOperandFunc function pointer.

Parameters
formatterA pointer to the ZydisFormatter instance.
stringA pointer to the string.
instructionA pointer to the ZydisDecodedInstruction struct.
operandA pointer to the ZydisDecodedOperand struct.
userDataA pointer to user-defined data.
Returns
A zydis status code.

Returning a status code other than ZYDIS_STATUS_SUCCESS will immediately cause the formatting process to fail (see exceptions below).

Returning ZYDIS_STATUS_SKIP_OPERAND is valid for ZYDIS_FORMATTER_HOOK_PRE_OPERAND, ZYDIS_FORMATTER_HOOK_POST_OPERAND and all of the ZYDIS_FORMATTER_HOOK_FORMAT_OPERAND_XXX callbacks. This will cause the formatter to omit the current operand.

DEPRECATED: Returning ZYDIS_STATUS_SUCCESS without writing to the string is valid for ZYDIS_FORMATTER_HOOK_PRE_OPERAND, ZYDIS_FORMATTER_HOOK_POST_OPERAND and all of the ZYDIS_FORMATTER_HOOK_FORMAT_OPERAND_XXX. This will cause the formatter to omit the current operand.

This function type is used for:

  • ZYDIS_FORMATTER_HOOK_PRE_OPERAND
  • ZYDIS_FORMATTER_HOOK_POST_OPERAND
  • ZYDIS_FORMATTER_HOOK_FORMAT_OPERAND_REG
  • ZYDIS_FORMATTER_HOOK_FORMAT_OPERAND_MEM
  • ZYDIS_FORMATTER_HOOK_FORMAT_OPERAND_PTR
  • ZYDIS_FORMATTER_HOOK_FORMAT_OPERAND_IMM
  • ZYDIS_FORMATTER_HOOK_PRINT_DISP
  • ZYDIS_FORMATTER_HOOK_PRINT_IMM
  • ZYDIS_FORMATTER_HOOK_PRINT_MEMSIZE

◆ ZydisFormatterProperty

Defines the ZydisFormatterProperty datatype.

◆ ZydisFormatterRegisterFunc

typedef ZydisStatus(* ZydisFormatterRegisterFunc) (const ZydisFormatter *formatter, ZydisString *string, const ZydisDecodedInstruction *instruction, const ZydisDecodedOperand *operand, ZydisRegister reg, void *userData)

Defines the ZydisFormatterRegisterFunc function pointer.

Parameters
formatterA pointer to the ZydisFormatter instance.
stringA pointer to the string.
instructionA pointer to the ZydisDecodedInstruction struct.
operandA pointer to the ZydisDecodedOperand struct.
regThe register.
userDataA pointer to user-defined data.
Returns
Returning a status code other than ZYDIS_STATUS_SUCCESS will immediately cause the formatting process to fail.

This function type is used for:

  • ZYDIS_FORMATTER_HOOK_PRINT_REGISTER.

◆ ZydisFormatterStyle

Defines the ZydisFormatterStyle datatype.

Enumeration Type Documentation

◆ ZydisAddressFormat

Values that represent address-formats.

Enumerator
ZYDIS_ADDR_FORMAT_ABSOLUTE 

Displays absolute addresses instead of relative ones.

Using this value will cause the formatter to invoke ZYDIS_FORMATTER_HOOK_PRINT_ADDRESS for every address.

ZYDIS_ADDR_FORMAT_RELATIVE_SIGNED 

Uses signed hexadecimal values to display relative addresses.

Using this value will cause the formatter to either invoke ZYDIS_FORMATTER_HOOK_PRINT_DISP or ZYDIS_FORMATTER_HOOK_PRINT_IMM to format addresses.

Examples:

  • "JMP 0x20"
  • "JMP -0x20"
ZYDIS_ADDR_FORMAT_RELATIVE_UNSIGNED 

Uses unsigned hexadecimal values to display relative addresses.

Using this value will cause the formatter to either invoke ZYDIS_FORMATTER_HOOK_PRINT_DISP or ZYDIS_FORMATTER_HOOK_PRINT_IMM to format addresses.

Examples:

  • "JMP 0x20"
  • "JMP 0xE0"
ZYDIS_ADDR_FORMAT_MAX_VALUE 

Maximum value of this enum.

◆ ZydisDecoratorTypes

Values that represent decorator-types.

Enumerator
ZYDIS_DECORATOR_TYPE_INVALID 
ZYDIS_DECORATOR_TYPE_MASK 

The embedded-mask decorator.

ZYDIS_DECORATOR_TYPE_BC 

The broadcast decorator.

ZYDIS_DECORATOR_TYPE_RC 

The rounding-control decorator.

ZYDIS_DECORATOR_TYPE_SAE 

The suppress-all-exceptions decorator.

ZYDIS_DECORATOR_TYPE_SWIZZLE 

The register-swizzle decorator.

ZYDIS_DECORATOR_TYPE_CONVERSION 

The conversion decorator.

ZYDIS_DECORATOR_TYPE_EH 

The eviction-hint decorator.

ZYDIS_DECORATOR_TYPE_MAX_VALUE 

Maximum value of this enum.

◆ ZydisDisplacementFormat

Values that represent displacement-formats.

Enumerator
ZYDIS_DISP_FORMAT_HEX_SIGNED 

Formats displacements as signed hexadecimal values.

Examples:

  • "MOV EAX, DWORD PTR SS:[ESP+0x400]"
  • "MOV EAX, DWORD PTR SS:[ESP-0x400]"
ZYDIS_DISP_FORMAT_HEX_UNSIGNED 

Formats displacements as unsigned hexadecimal values.

Examples:

  • "MOV EAX, DWORD PTR SS:[ESP+0x400]"
  • "MOV EAX, DWORD PTR SS:[ESP+0xFFFFFC00]"
ZYDIS_DISP_FORMAT_MAX_VALUE 

Maximum value of this enum.

◆ ZydisFormatterHookTypes

Values that represent formatter hook-types.

Enumerator
ZYDIS_FORMATTER_HOOK_PRE_INSTRUCTION 

This function is invoked before the formatter formats an instruction.

ZYDIS_FORMATTER_HOOK_POST_INSTRUCTION 

This function is invoked after the formatter formatted an instruction.

ZYDIS_FORMATTER_HOOK_PRE_OPERAND 

This function is invoked before the formatter formats an operand.

ZYDIS_FORMATTER_HOOK_POST_OPERAND 

This function is invoked after the formatter formatted an operand.

ZYDIS_FORMATTER_HOOK_FORMAT_INSTRUCTION 

This function refers to the main formatting function.

Replacing this function allows for complete custom formatting, but indirectly disables all other hooks except for ZYDIS_FORMATTER_HOOK_PRE_INSTRUCTION and ZYDIS_FORMATTER_HOOK_POST_INSTRUCTION.

ZYDIS_FORMATTER_HOOK_FORMAT_OPERAND_REG 

This function is invoked to format a register operand.

ZYDIS_FORMATTER_HOOK_FORMAT_OPERAND_MEM 

This function is invoked to format a memory operand.

Replacing this function might indirectly disable some specific calls to the ZYDIS_FORMATTER_HOOK_PRINT_MEMSIZE, ZYDIS_FORMATTER_HOOK_PRINT_ADDRESS and ZYDIS_FORMATTER_HOOK_PRINT_DISP functions.

ZYDIS_FORMATTER_HOOK_FORMAT_OPERAND_PTR 

This function is invoked to format a pointer operand.

ZYDIS_FORMATTER_HOOK_FORMAT_OPERAND_IMM 

This function is invoked to format an immediate operand.

Replacing this function might indirectly disable some specific calls to the ZYDIS_FORMATTER_HOOK_PRINT_ADDRESS and ZYDIS_FORMATTER_HOOK_PRINT_IMM functions.

ZYDIS_FORMATTER_HOOK_PRINT_MNEMONIC 

This function is invoked to print the instruction mnemonic.

ZYDIS_FORMATTER_HOOK_PRINT_REGISTER 

This function is invoked to print a register.

ZYDIS_FORMATTER_HOOK_PRINT_ADDRESS 

This function is invoked to print an absolute address.

ZYDIS_FORMATTER_HOOK_PRINT_DISP 

This function is invoked to print a memory displacement value.

ZYDIS_FORMATTER_HOOK_PRINT_IMM 

This function is invoked to print an immediate value.

ZYDIS_FORMATTER_HOOK_PRINT_MEMSIZE 

This function is invoked to print the size of a memory operand.

ZYDIS_FORMATTER_HOOK_PRINT_PREFIXES 

This function is invoked to print the instruction prefixes.

ZYDIS_FORMATTER_HOOK_PRINT_DECORATOR 

This function is invoked after formatting an operand to print a EVEX/MVEX decorator.

ZYDIS_FORMATTER_HOOK_MAX_VALUE 

Maximum value of this enum.

◆ ZydisFormatterProperties

Values that represent formatter-properties.

Enumerator
ZYDIS_FORMATTER_PROP_UPPERCASE 

Controls the letter-case.

Pass ZYDIS_TRUE as value to format in uppercase and ZYDIS_FALSE to format in lowercase.

The default value is ZYDIS_FALSE.

ZYDIS_FORMATTER_PROP_FORCE_MEMSEG 

Controls the printing of segment prefixes.

Pass ZYDIS_TRUE as value to force the formatter to always print the segment register of memory-operands or ZYDIS_FALSE to ommit implicit DS/SS segments.

The default value is ZYDIS_FALSE.

ZYDIS_FORMATTER_PROP_FORCE_MEMSIZE 

Controls the printing of memory-operand sizes.

Pass ZYDIS_TRUE as value to force the formatter to always print the size of memory-operands or ZYDIS_FALSE to only print it on demand.

The default value is ZYDIS_FALSE.

ZYDIS_FORMATTER_PROP_ADDR_FORMAT 

Controls the format of addresses.

The default value is ZYDIS_ADDR_FORMAT_ABSOLUTE.

ZYDIS_FORMATTER_PROP_DISP_FORMAT 

Controls the format of displacement values.

The default value is ZYDIS_DISP_FORMAT_HEX_SIGNED.

ZYDIS_FORMATTER_PROP_IMM_FORMAT 

Controls the format of immediate values.

The default value is ZYDIS_IMM_FORMAT_HEX_UNSIGNED.

ZYDIS_FORMATTER_PROP_HEX_UPPERCASE 

Controls the letter-case of hexadecimal values.

Pass ZYDIS_TRUE as value to format in uppercase and ZYDIS_FALSE to format in lowercase.

The default value is ZYDIS_TRUE.

ZYDIS_FORMATTER_PROP_HEX_PREFIX 

Sets the prefix for hexadecimal values.

The default value is "0x".

ZYDIS_FORMATTER_PROP_HEX_SUFFIX 

Sets the suffix for hexadecimal values.

The default value is NULL.

ZYDIS_FORMATTER_PROP_HEX_PADDING_ADDR 

Controls the padding (minimum number of chars) of hexadecimal address values.

The default value is 2.

ZYDIS_FORMATTER_PROP_HEX_PADDING_DISP 

Controls the padding (minimum number of chars) of hexadecimal displacement values.

The default value is 2.

ZYDIS_FORMATTER_PROP_HEX_PADDING_IMM 

Controls the padding (minimum number of chars) of hexadecimal immediate values.

The default value is 2.

ZYDIS_FORMATTER_PROP_MAX_VALUE 

Maximum value of this enum.

◆ ZydisFormatterStyles

Values that represent formatter-styles.

Enumerator
ZYDIS_FORMATTER_STYLE_INTEL 

Generates intel-style disassembly.

ZYDIS_FORMATTER_STYLE_MAX_VALUE 

Maximum value of this enum.

◆ ZydisImmediateFormat

Values that represent formatter immediate-formats.

Enumerator
ZYDIS_IMM_FORMAT_HEX_AUTO 

Automatically chooses the most suitable formatting-mode based on the operands ZydisOperandInfo.imm.isSigned attribute.

ZYDIS_IMM_FORMAT_HEX_SIGNED 

Formats immediates as signed hexadecimal values.

Examples:

  • "MOV EAX, 0x400"
  • "MOV EAX, -0x400"
ZYDIS_IMM_FORMAT_HEX_UNSIGNED 

Formats immediates as unsigned hexadecimal values.

Examples:

  • "MOV EAX, 0x400"
  • "MOV EAX, 0xFFFFFC00"
ZYDIS_IMM_FORMAT_MAX_VALUE 

Maximum value of this enum.

Function Documentation

◆ ZydisFormatterFormatInstruction()

ZYDIS_EXPORT ZydisStatus ZydisFormatterFormatInstruction ( const ZydisFormatter formatter,
const ZydisDecodedInstruction instruction,
char *  buffer,
ZydisUSize  bufferLen 
)

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.
bufferLenThe length of the output buffer.
Returns
A zydis status code.

◆ ZydisFormatterFormatInstructionEx()

ZYDIS_EXPORT ZydisStatus ZydisFormatterFormatInstructionEx ( const ZydisFormatter formatter,
const ZydisDecodedInstruction instruction,
char *  buffer,
ZydisUSize  bufferLen,
void *  userData 
)

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.
bufferLenThe length of the output buffer.
userDataA pointer to user-defined data which can be used in custom formatter callbacks.
Returns
A zydis status code.

◆ ZydisFormatterFormatOperand()

ZYDIS_EXPORT ZydisStatus ZydisFormatterFormatOperand ( const ZydisFormatter formatter,
const ZydisDecodedInstruction instruction,
ZydisU8  index,
char *  buffer,
ZydisUSize  bufferLen 
)

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.
bufferLenThe length of the output buffer.
Returns
A zydis status code.

Use ZydisFormatterFormatInstruction or ZydisFormatterFormatInstructionEx to format a complete instruction.

◆ ZydisFormatterFormatOperandEx()

ZYDIS_EXPORT ZydisStatus ZydisFormatterFormatOperandEx ( const ZydisFormatter formatter,
const ZydisDecodedInstruction instruction,
ZydisU8  index,
char *  buffer,
ZydisUSize  bufferLen,
void *  userData 
)

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.
bufferLenThe length of the output buffer.
userDataA pointer to user-defined data which can be used in custom formatter callbacks.
Returns
A zydis status code.

Use ZydisFormatterFormatInstruction or ZydisFormatterFormatInstructionEx to format a complete instruction.

◆ ZydisFormatterInit()

ZYDIS_EXPORT ZydisStatus ZydisFormatterInit ( ZydisFormatter formatter,
ZydisFormatterStyle  style 
)

Initializes the given ZydisFormatter instance.

Parameters
formatterA pointer to the ZydisFormatter instance.
styleThe formatter style.
Returns
A zydis status code.

◆ ZydisFormatterSetHook()

ZYDIS_EXPORT ZydisStatus ZydisFormatterSetHook ( ZydisFormatter formatter,
ZydisFormatterHookType  hook,
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.
hookThe formatter hook-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 zydis status code.

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

◆ ZydisFormatterSetProperty()

ZYDIS_EXPORT ZydisStatus ZydisFormatterSetProperty ( ZydisFormatter formatter,
ZydisFormatterProperty  property,
ZydisUPointer  value 
)

Sets the value of the specified formatter attribute.

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