Zydis  v3.1.0
Formatter.h
Go to the documentation of this file.
1 /***************************************************************************************************
2 
3  Zyan Disassembler Library (Zydis)
4 
5  Original Author : Florian Bernd
6 
7  * Permission is hereby granted, free of charge, to any person obtaining a copy
8  * of this software and associated documentation files (the "Software"), to deal
9  * in the Software without restriction, including without limitation the rights
10  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11  * copies of the Software, and to permit persons to whom the Software is
12  * furnished to do so, subject to the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be included in all
15  * copies or substantial portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23  * SOFTWARE.
24 
25 ***************************************************************************************************/
26 
32 #ifndef ZYDIS_FORMATTER_H
33 #define ZYDIS_FORMATTER_H
34 
35 #include <Zycore/Defines.h>
36 #include <Zycore/String.h>
37 #include <Zycore/Types.h>
38 #include <Zydis/DecoderTypes.h>
39 #include <Zydis/FormatterBuffer.h>
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 /* ============================================================================================== */
46 /* Constants */
47 /* ============================================================================================== */
48 
54 #define ZYDIS_RUNTIME_ADDRESS_NONE (ZyanU64)(-1)
55 
56 /* ============================================================================================== */
57 /* Enums and types */
58 /* ============================================================================================== */
59 
60 /* ---------------------------------------------------------------------------------------------- */
61 /* Formatter style */
62 /* ---------------------------------------------------------------------------------------------- */
63 
68 {
84 
94 
95 /* ---------------------------------------------------------------------------------------------- */
96 /* Properties */
97 /* ---------------------------------------------------------------------------------------------- */
98 
103 {
104  /* ---------------------------------------------------------------------------------------- */
105  /* General */
106  /* ---------------------------------------------------------------------------------------- */
107 
148 
156 
157  /* ---------------------------------------------------------------------------------------- */
158  /* Numeric values */
159  /* ---------------------------------------------------------------------------------------- */
160 
186 
187  /* ---------------------------------------------------------------------------------------- */
188 
204 
205  /* ---------------------------------------------------------------------------------------- */
206 
226 
227  /* ---------------------------------------------------------------------------------------- */
228  /* Text formatting */
229  /* ---------------------------------------------------------------------------------------- */
230 
261 
262  /* ---------------------------------------------------------------------------------------- */
263  /* Number formatting */
264  /* ---------------------------------------------------------------------------------------- */
265 
284 
285  /* ---------------------------------------------------------------------------------------- */
286 
313 
314  /* ---------------------------------------------------------------------------------------- */
315 
325 
326 /* ---------------------------------------------------------------------------------------------- */
327 
331 typedef enum ZydisNumericBase_
332 {
341 
351 
352 /* ---------------------------------------------------------------------------------------------- */
353 
357 typedef enum ZydisSignedness_
358 {
372 
382 
383 /* ---------------------------------------------------------------------------------------------- */
384 
388 typedef enum ZydisPadding_
389 {
399 
407  ZYDIS_PADDING_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_PADDING_MAX_VALUE)
409 
410 /* ---------------------------------------------------------------------------------------------- */
411 /* Function types */
412 /* ---------------------------------------------------------------------------------------------- */
413 
421 {
422  /* ---------------------------------------------------------------------------------------- */
423  /* Instruction */
424  /* ---------------------------------------------------------------------------------------- */
425 
434 
435  /* ---------------------------------------------------------------------------------------- */
436 
445 
446  /* ---------------------------------------------------------------------------------------- */
447  /* Operands */
448  /* ---------------------------------------------------------------------------------------- */
449 
458 
459  /* ---------------------------------------------------------------------------------------- */
460 
485 
486  /* ---------------------------------------------------------------------------------------- */
487  /* Elemental tokens */
488  /* ---------------------------------------------------------------------------------------- */
489 
494 
495  /* ---------------------------------------------------------------------------------------- */
496 
539 
540  /* ---------------------------------------------------------------------------------------- */
541  /* Optional tokens */
542  /* ---------------------------------------------------------------------------------------- */
543 
561 
562  /* ---------------------------------------------------------------------------------------- */
563 
573 
574 /* ---------------------------------------------------------------------------------------------- */
575 /* Decorator types */
576 /* ---------------------------------------------------------------------------------------------- */
577 
581 typedef enum ZydisDecorator_
582 {
612 
622 
623 /* ---------------------------------------------------------------------------------------------- */
624 /* Formatter context */
625 /* ---------------------------------------------------------------------------------------------- */
626 
627 typedef struct ZydisFormatter_ ZydisFormatter;
628 
633 {
649  void* user_data;
651 
652 /* ---------------------------------------------------------------------------------------------- */
653 /* Function prototypes */
654 /* ---------------------------------------------------------------------------------------------- */
655 
696 typedef ZyanStatus (*ZydisFormatterFunc)(const ZydisFormatter* formatter,
697  ZydisFormatterBuffer* buffer, ZydisFormatterContext* context);
698 
713 typedef ZyanStatus (*ZydisFormatterRegisterFunc)(const ZydisFormatter* formatter,
715 
730 typedef ZyanStatus (*ZydisFormatterDecoratorFunc)(const ZydisFormatter* formatter,
731  ZydisFormatterBuffer* buffer, ZydisFormatterContext* context, ZydisDecorator decorator);
732 
733 /* ---------------------------------------------------------------------------------------------- */
734 /* Formatter struct */
735 /* ---------------------------------------------------------------------------------------------- */
736 
747 {
819  ZyanI32 case_prefixes;
823  ZyanI32 case_mnemonic;
827  ZyanI32 case_registers;
831  ZyanI32 case_typecasts;
839  ZyanBool hex_uppercase;
846  struct
847  {
851  const ZyanStringView* string;
855  ZyanStringView string_data;
859  char buffer[11];
937 };
938 
939 /* ---------------------------------------------------------------------------------------------- */
940 
941 /* ============================================================================================== */
942 /* Exported functions */
943 /* ============================================================================================== */
944 
951 /* ---------------------------------------------------------------------------------------------- */
952 /* Initialization */
953 /* ---------------------------------------------------------------------------------------------- */
954 
963 ZYDIS_EXPORT ZyanStatus ZydisFormatterInit(ZydisFormatter* formatter, ZydisFormatterStyle style);
964 
965 /* ---------------------------------------------------------------------------------------------- */
966 /* Setter */
967 /* ---------------------------------------------------------------------------------------------- */
968 
981 ZYDIS_EXPORT ZyanStatus ZydisFormatterSetProperty(ZydisFormatter* formatter,
982  ZydisFormatterProperty property, ZyanUPointer value);
983 
1001 ZYDIS_EXPORT ZyanStatus ZydisFormatterSetHook(ZydisFormatter* formatter,
1002  ZydisFormatterFunction type, const void** callback);
1003 
1004 /* ---------------------------------------------------------------------------------------------- */
1005 /* Formatting */
1006 /* ---------------------------------------------------------------------------------------------- */
1007 
1020 ZYDIS_EXPORT ZyanStatus ZydisFormatterFormatInstruction(const ZydisFormatter* formatter,
1021  const ZydisDecodedInstruction* instruction, char* buffer, ZyanUSize length,
1022  ZyanU64 runtime_address);
1023 
1038 ZYDIS_EXPORT ZyanStatus ZydisFormatterFormatInstructionEx(const ZydisFormatter* formatter,
1039  const ZydisDecodedInstruction* instruction, char* buffer, ZyanUSize length,
1040  ZyanU64 runtime_address, void* user_data);
1041 
1058 ZYDIS_EXPORT ZyanStatus ZydisFormatterFormatOperand(const ZydisFormatter* formatter,
1059  const ZydisDecodedInstruction* instruction, ZyanU8 index, char* buffer, ZyanUSize length,
1060  ZyanU64 runtime_address);
1061 
1080 ZYDIS_EXPORT ZyanStatus ZydisFormatterFormatOperandEx(const ZydisFormatter* formatter,
1081  const ZydisDecodedInstruction* instruction, ZyanU8 index, char* buffer, ZyanUSize length,
1082  ZyanU64 runtime_address, void* user_data);
1083 
1084 /* ---------------------------------------------------------------------------------------------- */
1085 /* Tokenizing */
1086 /* ---------------------------------------------------------------------------------------------- */
1087 
1101 ZYDIS_EXPORT ZyanStatus ZydisFormatterTokenizeInstruction(const ZydisFormatter* formatter,
1102  const ZydisDecodedInstruction* instruction, void* buffer, ZyanUSize length,
1103  ZyanU64 runtime_address, ZydisFormatterTokenConst** token);
1104 
1120 ZYDIS_EXPORT ZyanStatus ZydisFormatterTokenizeInstructionEx(const ZydisFormatter* formatter,
1121  const ZydisDecodedInstruction* instruction, void* buffer, ZyanUSize length,
1122  ZyanU64 runtime_address, ZydisFormatterTokenConst** token, void* user_data);
1123 
1141 ZYDIS_EXPORT ZyanStatus ZydisFormatterTokenizeOperand(const ZydisFormatter* formatter,
1142  const ZydisDecodedInstruction* instruction, ZyanU8 index, void* buffer, ZyanUSize length,
1143  ZyanU64 runtime_address, ZydisFormatterTokenConst** token);
1144 
1164 ZYDIS_EXPORT ZyanStatus ZydisFormatterTokenizeOperandEx(const ZydisFormatter* formatter,
1165  const ZydisDecodedInstruction* instruction, ZyanU8 index, void* buffer, ZyanUSize length,
1166  ZyanU64 runtime_address, ZydisFormatterTokenConst** token, void* user_data);
1167 
1168 /* ---------------------------------------------------------------------------------------------- */
1169 
1174 /* ============================================================================================== */
1175 
1176 #ifdef __cplusplus
1177 }
1178 #endif
1179 
1180 #endif /* ZYDIS_FORMATTER_H */
Defines the basic ZydisDecodedInstruction and ZydisDecodedOperand structs.
enum ZydisRegister_ ZydisRegister
Defines the ZydisRegister enum.
Implements the ZydisFormatterToken type and provides functions to use it.
enum ZydisDecorator_ ZydisDecorator
Defines the ZydisDecorator enum.
enum ZydisNumericBase_ ZydisNumericBase
Defines the ZydisNumericBase enum.
ZydisFormatterStyle_
Defines the ZydisFormatterStyle enum.
Definition: Formatter.h:68
@ ZYDIS_FORMATTER_STYLE_ATT
Generates AT&T-style disassembly.
Definition: Formatter.h:72
@ ZYDIS_FORMATTER_STYLE_INTEL_MASM
Generates MASM-style disassembly that is directly accepted as input for the MASM assembler.
Definition: Formatter.h:83
@ ZYDIS_FORMATTER_STYLE_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition: Formatter.h:92
@ ZYDIS_FORMATTER_STYLE_INTEL
Generates Intel-style disassembly.
Definition: Formatter.h:76
@ ZYDIS_FORMATTER_STYLE_MAX_VALUE
Maximum value of this enum.
Definition: Formatter.h:88
ZydisSignedness_
Defines the ZydisSignedness enum.
Definition: Formatter.h:358
@ ZYDIS_SIGNEDNESS_MAX_VALUE
Maximum value of this enum.
Definition: Formatter.h:376
@ ZYDIS_SIGNEDNESS_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition: Formatter.h:380
@ ZYDIS_SIGNEDNESS_AUTO
Automatically choose the most suitable mode based on the operands ZydisDecodedOperand....
Definition: Formatter.h:363
@ ZYDIS_SIGNEDNESS_UNSIGNED
Force unsigned values.
Definition: Formatter.h:371
@ ZYDIS_SIGNEDNESS_SIGNED
Force signed values.
Definition: Formatter.h:367
ZydisFormatterFunction_
Defines the ZydisFormatterFunction enum.
Definition: Formatter.h:421
@ ZYDIS_FORMATTER_FUNC_PRE_OPERAND
This function is invoked before the formatter formats an operand.
Definition: Formatter.h:453
@ ZYDIS_FORMATTER_FUNC_PRINT_ADDRESS_ABS
This function is invoked to print absolute addresses.
Definition: Formatter.h:512
@ ZYDIS_FORMATTER_FUNC_PRINT_TYPECAST
This function is invoked to print the size of a memory operand (INTEL only).
Definition: Formatter.h:547
@ ZYDIS_FORMATTER_FUNC_PRINT_ADDRESS_REL
This function is invoked to print relative addresses.
Definition: Formatter.h:519
@ ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_MEM
This function is invoked to format a memory operand.
Definition: Formatter.h:472
@ ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_IMM
This function is invoked to format an immediate operand.
Definition: Formatter.h:484
@ ZYDIS_FORMATTER_FUNC_PRINT_MNEMONIC
This function is invoked to print the instruction mnemonic.
Definition: Formatter.h:493
@ ZYDIS_FORMATTER_FUNC_PRE_INSTRUCTION
This function is invoked before the formatter formats an instruction.
Definition: Formatter.h:429
@ ZYDIS_FORMATTER_FUNC_PRINT_DECORATOR
This function is invoked after formatting an operand to print a EVEX/MVEX decorator.
Definition: Formatter.h:560
@ ZYDIS_FORMATTER_FUNC_PRINT_REGISTER
This function is invoked to print a register.
Definition: Formatter.h:500
@ ZYDIS_FORMATTER_FUNC_PRINT_DISP
This function is invoked to print a memory displacement value.
Definition: Formatter.h:527
@ ZYDIS_FORMATTER_FUNC_POST_INSTRUCTION
This function is invoked after the formatter formatted an instruction.
Definition: Formatter.h:433
@ ZYDIS_FORMATTER_FUNC_POST_OPERAND
This function is invoked after the formatter formatted an operand.
Definition: Formatter.h:457
@ ZYDIS_FORMATTER_FUNC_PRINT_SEGMENT
This function is invoked to print the segment-register of a memory operand.
Definition: Formatter.h:551
@ ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_PTR
This function is invoked to format a pointer operand.
Definition: Formatter.h:476
@ ZYDIS_FORMATTER_FUNC_PRINT_IMM
This function is invoked to print an immediate value.
Definition: Formatter.h:538
@ ZYDIS_FORMATTER_FUNC_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition: Formatter.h:571
@ ZYDIS_FORMATTER_FUNC_MAX_VALUE
Maximum value of this enum.
Definition: Formatter.h:567
@ ZYDIS_FORMATTER_FUNC_PRINT_PREFIXES
This function is invoked to print the instruction prefixes.
Definition: Formatter.h:555
@ ZYDIS_FORMATTER_FUNC_FORMAT_INSTRUCTION
This function refers to the main formatting function.
Definition: Formatter.h:444
@ ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_REG
This function is invoked to format a register operand.
Definition: Formatter.h:464
ZyanStatus(* ZydisFormatterRegisterFunc)(const ZydisFormatter *formatter, ZydisFormatterBuffer *buffer, ZydisFormatterContext *context, ZydisRegister reg)
Defines the ZydisFormatterRegisterFunc function prototype.
Definition: Formatter.h:713
enum ZydisFormatterStyle_ ZydisFormatterStyle
Defines the ZydisFormatterStyle enum.
ZydisPadding_
Defines the ZydisPadding enum.
Definition: Formatter.h:389
@ ZYDIS_PADDING_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition: Formatter.h:407
@ ZYDIS_PADDING_AUTO
Padds the value to the current stack-width for addresses, or to the operand-width for immediate value...
Definition: Formatter.h:398
@ ZYDIS_PADDING_MAX_VALUE
Maximum value of this enum.
Definition: Formatter.h:403
@ ZYDIS_PADDING_DISABLED
Disables padding.
Definition: Formatter.h:393
enum ZydisFormatterFunction_ ZydisFormatterFunction
Defines the ZydisFormatterFunction enum.
enum ZydisSignedness_ ZydisSignedness
Defines the ZydisSignedness enum.
enum ZydisFormatterProperty_ ZydisFormatterProperty
Defines the ZydisFormatterProperty enum.
struct ZydisFormatterContext_ ZydisFormatterContext
Defines the ZydisFormatterContext struct.
ZydisNumericBase_
Defines the ZydisNumericBase enum.
Definition: Formatter.h:332
@ ZYDIS_NUMERIC_BASE_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition: Formatter.h:349
@ ZYDIS_NUMERIC_BASE_HEX
Hexadecimal system.
Definition: Formatter.h:340
@ ZYDIS_NUMERIC_BASE_MAX_VALUE
Maximum value of this enum.
Definition: Formatter.h:345
@ ZYDIS_NUMERIC_BASE_DEC
Decimal system.
Definition: Formatter.h:336
ZyanStatus(* ZydisFormatterFunc)(const ZydisFormatter *formatter, ZydisFormatterBuffer *buffer, ZydisFormatterContext *context)
Defines the ZydisFormatterFunc function prototype.
Definition: Formatter.h:696
ZydisDecorator_
Defines the ZydisDecorator enum.
Definition: Formatter.h:582
@ ZYDIS_DECORATOR_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition: Formatter.h:620
@ ZYDIS_DECORATOR_INVALID
Definition: Formatter.h:583
@ ZYDIS_DECORATOR_SAE
The suppress-all-exceptions decorator.
Definition: Formatter.h:599
@ ZYDIS_DECORATOR_BC
The broadcast decorator.
Definition: Formatter.h:591
@ ZYDIS_DECORATOR_SWIZZLE
The register-swizzle decorator.
Definition: Formatter.h:603
@ ZYDIS_DECORATOR_MASK
The embedded-mask decorator.
Definition: Formatter.h:587
@ ZYDIS_DECORATOR_EH
The eviction-hint decorator.
Definition: Formatter.h:611
@ ZYDIS_DECORATOR_MAX_VALUE
Maximum value of this enum.
Definition: Formatter.h:616
@ ZYDIS_DECORATOR_CONVERSION
The conversion decorator.
Definition: Formatter.h:607
@ ZYDIS_DECORATOR_RC
The rounding-control decorator.
Definition: Formatter.h:595
ZydisFormatterProperty_
Defines the ZydisFormatterProperty enum.
Definition: Formatter.h:103
@ ZYDIS_FORMATTER_PROP_MAX_VALUE
Maximum value of this enum.
Definition: Formatter.h:319
@ ZYDIS_FORMATTER_PROP_IMM_SIGNEDNESS
Controls the signedness of immediate values.
Definition: Formatter.h:217
@ ZYDIS_FORMATTER_PROP_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition: Formatter.h:323
@ ZYDIS_FORMATTER_PROP_HEX_SUFFIX
Controls the suffix for hexadecimal values.
Definition: Formatter.h:312
@ ZYDIS_FORMATTER_PROP_FORCE_RELATIVE_BRANCHES
Controls the printing of branch addresses.
Definition: Formatter.h:130
@ ZYDIS_FORMATTER_PROP_UPPERCASE_MNEMONIC
Controls the letter-case for the mnemonic.
Definition: Formatter.h:242
@ ZYDIS_FORMATTER_PROP_UPPERCASE_TYPECASTS
Controls the letter-case for typecasts.
Definition: Formatter.h:254
@ ZYDIS_FORMATTER_PROP_UPPERCASE_PREFIXES
Controls the letter-case for prefixes.
Definition: Formatter.h:236
@ ZYDIS_FORMATTER_PROP_DEC_SUFFIX
Controls the suffix for decimal values.
Definition: Formatter.h:283
@ ZYDIS_FORMATTER_PROP_DISP_SIGNEDNESS
Controls the signedness of displacement values.
Definition: Formatter.h:196
@ ZYDIS_FORMATTER_PROP_DISP_PADDING
Controls the padding of displacement values.
Definition: Formatter.h:203
@ ZYDIS_FORMATTER_PROP_HEX_PREFIX
Controls the prefix for hexadecimal values.
Definition: Formatter.h:303
@ ZYDIS_FORMATTER_PROP_FORCE_SEGMENT
Controls the printing of segment prefixes.
Definition: Formatter.h:122
@ ZYDIS_FORMATTER_PROP_ADDR_BASE
Controls the base of address values.
Definition: Formatter.h:164
@ ZYDIS_FORMATTER_PROP_UPPERCASE_REGISTERS
Controls the letter-case for registers.
Definition: Formatter.h:248
@ ZYDIS_FORMATTER_PROP_DISP_BASE
Controls the base of displacement values.
Definition: Formatter.h:192
@ ZYDIS_FORMATTER_PROP_IMM_BASE
Controls the base of immediate values.
Definition: Formatter.h:210
@ ZYDIS_FORMATTER_PROP_FORCE_RELATIVE_RIPREL
Controls the printing of EIP/RIP-relative addresses.
Definition: Formatter.h:138
@ ZYDIS_FORMATTER_PROP_PRINT_BRANCH_SIZE
Controls the printing of branch-instructions sizes.
Definition: Formatter.h:147
@ ZYDIS_FORMATTER_PROP_UPPERCASE_DECORATORS
Controls the letter-case for decorators.
Definition: Formatter.h:260
@ ZYDIS_FORMATTER_PROP_IMM_PADDING
Controls the padding of immediate values.
Definition: Formatter.h:225
@ ZYDIS_FORMATTER_PROP_FORCE_SIZE
Controls the printing of effective operand-size suffixes (AT&T) or operand-sizes of memory operands (...
Definition: Formatter.h:115
@ ZYDIS_FORMATTER_PROP_ADDR_PADDING_ABSOLUTE
Controls the padding of absolute address values.
Definition: Formatter.h:177
@ ZYDIS_FORMATTER_PROP_HEX_UPPERCASE
Controls the letter-case of hexadecimal values.
Definition: Formatter.h:294
@ ZYDIS_FORMATTER_PROP_DEC_PREFIX
Controls the prefix for decimal values.
Definition: Formatter.h:274
@ ZYDIS_FORMATTER_PROP_DETAILED_PREFIXES
Controls the printing of instruction prefixes.
Definition: Formatter.h:155
@ ZYDIS_FORMATTER_PROP_ADDR_PADDING_RELATIVE
Controls the padding of relative address values.
Definition: Formatter.h:185
@ ZYDIS_FORMATTER_PROP_ADDR_SIGNEDNESS
Controls the signedness of relative addresses.
Definition: Formatter.h:169
enum ZydisPadding_ ZydisPadding
Defines the ZydisPadding enum.
ZyanStatus(* ZydisFormatterDecoratorFunc)(const ZydisFormatter *formatter, ZydisFormatterBuffer *buffer, ZydisFormatterContext *context, ZydisDecorator decorator)
Defines the ZydisFormatterDecoratorFunc function prototype.
Definition: Formatter.h:730
ZYDIS_EXPORT ZyanStatus ZydisFormatterInit(ZydisFormatter *formatter, ZydisFormatterStyle style)
Initializes the given ZydisFormatter instance.
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.
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.
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.
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.
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.
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 ZydisFormatterSetProperty(ZydisFormatter *formatter, ZydisFormatterProperty property, ZyanUPointer value)
Changes the value of the specified formatter property.
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.
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.
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.
Defines the ZydisDecodedInstruction struct.
Definition: DecoderTypes.h:892
Defines the ZydisDecodedOperand struct.
Definition: DecoderTypes.h:92
Defines the ZydisFormatterBuffer struct.
Definition: FormatterBuffer.h:168
Defines the ZydisFormatterContext struct.
Definition: Formatter.h:633
const ZydisDecodedInstruction * instruction
A pointer to the ZydisDecodedInstruction struct.
Definition: Formatter.h:637
void * user_data
A pointer to user-defined data.
Definition: Formatter.h:649
ZyanU64 runtime_address
The runtime address of the instruction.
Definition: Formatter.h:645
const ZydisDecodedOperand * operand
A pointer to the ZydisDecodedOperand struct.
Definition: Formatter.h:641
Defines the ZydisFormatterToken struct.
Definition: FormatterBuffer.h:139
Defines the ZydisFormatter struct.
Definition: Formatter.h:747
ZydisFormatterFunc func_format_operand_imm
The ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_IMM function.
Definition: Formatter.h:896
ZydisFormatterFunc func_post_operand
The ZYDIS_FORMATTER_FUNC_POST_OPERAND function.
Definition: Formatter.h:880
ZyanBool detailed_prefixes
The ZYDIS_FORMATTER_DETAILED_PREFIXES property.
Definition: Formatter.h:775
ZydisFormatterStyle style
The formatter style.
Definition: Formatter.h:751
ZydisFormatterFunc func_print_disp
The ZYDIS_FORMATTER_FUNC_PRINT_DISP function.
Definition: Formatter.h:916
ZydisFormatterFunc func_format_operand_mem
The ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_MEM function.
Definition: Formatter.h:888
ZydisNumericBase addr_base
The ZYDIS_FORMATTER_ADDR_BASE property.
Definition: Formatter.h:779
ZydisPadding imm_padding
The ZYDIS_FORMATTER_IMM_PADDING property.
Definition: Formatter.h:815
ZyanBool force_relative_branches
The ZYDIS_FORMATTER_PROP_FORCE_RELATIVE_BRANCHES property.
Definition: Formatter.h:763
ZydisPadding disp_padding
The ZYDIS_FORMATTER_DISP_PADDING property.
Definition: Formatter.h:803
ZydisSignedness imm_signedness
The ZYDIS_FORMATTER_IMM_SIGNEDNESS property.
Definition: Formatter.h:811
ZyanBool hex_uppercase
The ZYDIS_FORMATTER_HEX_UPPERCASE property.
Definition: Formatter.h:839
ZydisFormatterFunc func_post_instruction
The ZYDIS_FORMATTER_FUNC_POST_INSTRUCTION function.
Definition: Formatter.h:868
ZydisPadding addr_padding_absolute
The ZYDIS_FORMATTER_ADDR_PADDING_ABSOLUTE property.
Definition: Formatter.h:787
ZydisFormatterDecoratorFunc func_print_decorator
The ZYDIS_FORMATTER_FUNC_PRINT_DECORATOR function.
Definition: Formatter.h:936
ZyanBool force_memory_segment
The ZYDIS_FORMATTER_PROP_FORCE_SEGMENT property.
Definition: Formatter.h:759
ZyanI32 case_decorators
The ZYDIS_FORMATTER_UPPERCASE_DECORATORS property.
Definition: Formatter.h:835
ZydisPadding addr_padding_relative
The ZYDIS_FORMATTER_ADDR_PADDING_RELATIVE property.
Definition: Formatter.h:791
ZydisFormatterRegisterFunc func_print_register
The ZYDIS_FORMATTER_FUNC_PRINT_REGISTER function.
Definition: Formatter.h:904
ZydisNumericBase imm_base
The ZYDIS_FORMATTER_IMM_BASE property.
Definition: Formatter.h:807
ZydisNumericBase disp_base
The ZYDIS_FORMATTER_DISP_BASE property.
Definition: Formatter.h:795
const ZyanStringView * string
A pointer to the ZyanStringView to use as prefix/suffix.
Definition: Formatter.h:851
ZydisSignedness disp_signedness
The ZYDIS_FORMATTER_DISP_SIGNEDNESS property.
Definition: Formatter.h:799
ZyanI32 case_mnemonic
The ZYDIS_FORMATTER_UPPERCASE_MNEMONIC property.
Definition: Formatter.h:823
ZyanI32 case_registers
The ZYDIS_FORMATTER_UPPERCASE_REGISTERS property.
Definition: Formatter.h:827
ZydisFormatterFunc func_format_operand_ptr
The ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_PTR function.
Definition: Formatter.h:892
ZyanBool force_memory_size
The ZYDIS_FORMATTER_PROP_FORCE_SIZE property.
Definition: Formatter.h:755
ZydisFormatterFunc func_format_instruction
The ZYDIS_FORMATTER_FUNC_FORMAT_INSTRUCTION function.
Definition: Formatter.h:872
ZydisFormatterFunc func_print_address_abs
The ZYDIS_FORMATTER_FUNC_PRINT_ADDRESS_ABS function.
Definition: Formatter.h:908
ZyanBool force_relative_riprel
The ZYDIS_FORMATTER_PROP_FORCE_RELATIVE_RIPREL property.
Definition: Formatter.h:767
ZyanI32 case_prefixes
The ZYDIS_FORMATTER_UPPERCASE_PREFIXES property.
Definition: Formatter.h:819
ZyanStringView string_data
The ZyanStringView to use as prefix/suffix.
Definition: Formatter.h:855
ZydisSignedness addr_signedness
The ZYDIS_FORMATTER_ADDR_SIGNEDNESS property.
Definition: Formatter.h:783
ZyanBool print_branch_size
The ZYDIS_FORMATTER_PROP_PRINT_BRANCH_SIZE property.
Definition: Formatter.h:771
ZydisFormatterFunc func_pre_operand
The ZYDIS_FORMATTER_FUNC_PRE_OPERAND function.
Definition: Formatter.h:876
char buffer[11]
The actual string data.
Definition: Formatter.h:859
ZydisFormatterFunc func_print_typecast
The ZYDIS_FORMATTER_FUNC_PRINT_TYPECAST function.
Definition: Formatter.h:924
struct ZydisFormatter_::@0 number_format[ZYDIS_NUMERIC_BASE_MAX_VALUE+1][2]
The number formats for all numeric bases.
ZydisFormatterFunc func_format_operand_reg
The ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_REG function.
Definition: Formatter.h:884
ZydisFormatterFunc func_print_address_rel
The ZYDIS_FORMATTER_FUNC_PRINT_ADDRESS_REL function.
Definition: Formatter.h:912
ZydisFormatterFunc func_print_imm
The ZYDIS_FORMATTER_FUNC_PRINT_IMM function.
Definition: Formatter.h:920
ZyanI32 case_typecasts
The ZYDIS_FORMATTER_UPPERCASE_TYPECASTS property.
Definition: Formatter.h:831
ZydisFormatterFunc func_print_segment
The ZYDIS_FORMATTER_FUNC_PRINT_SEGMENT function.
Definition: Formatter.h:928
ZydisFormatterFunc func_print_mnemonic
The `ZYDIS_FORMATTER_FUNC_PRINT_MNEMONIC function.
Definition: Formatter.h:900
ZydisFormatterFunc func_pre_instruction
The ZYDIS_FORMATTER_FUNC_PRE_INSTRUCTION function.
Definition: Formatter.h:864
ZydisFormatterFunc func_print_prefixes
The ZYDIS_FORMATTER_FUNC_PRINT_PREFIXES function.
Definition: Formatter.h:932