Zydis  v3.2.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 
53 #define ZYDIS_RUNTIME_ADDRESS_NONE (ZyanU64)(-1)
54 
55 /* ============================================================================================== */
56 /* Enums and types */
57 /* ============================================================================================== */
58 
59 /* ---------------------------------------------------------------------------------------------- */
60 /* Formatter style */
61 /* ---------------------------------------------------------------------------------------------- */
62 
67 {
83 
93 
94 /* ---------------------------------------------------------------------------------------------- */
95 /* Properties */
96 /* ---------------------------------------------------------------------------------------------- */
97 
102 {
103  /* ---------------------------------------------------------------------------------------- */
104  /* General */
105  /* ---------------------------------------------------------------------------------------- */
106 
154 
162 
163  /* ---------------------------------------------------------------------------------------- */
164  /* Numeric values */
165  /* ---------------------------------------------------------------------------------------- */
166 
192 
193  /* ---------------------------------------------------------------------------------------- */
194 
210 
211  /* ---------------------------------------------------------------------------------------- */
212 
232 
233  /* ---------------------------------------------------------------------------------------- */
234  /* Text formatting */
235  /* ---------------------------------------------------------------------------------------- */
236 
267 
268  /* ---------------------------------------------------------------------------------------- */
269  /* Number formatting */
270  /* ---------------------------------------------------------------------------------------- */
271 
290 
291  /* ---------------------------------------------------------------------------------------- */
292 
319 
320  /* ---------------------------------------------------------------------------------------- */
321 
331 
332 /* ---------------------------------------------------------------------------------------------- */
333 
337 typedef enum ZydisNumericBase_
338 {
347 
357 
358 /* ---------------------------------------------------------------------------------------------- */
359 
363 typedef enum ZydisSignedness_
364 {
378 
388 
389 /* ---------------------------------------------------------------------------------------------- */
390 
394 typedef enum ZydisPadding_
395 {
405 
413  ZYDIS_PADDING_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_PADDING_MAX_VALUE)
415 
416 /* ---------------------------------------------------------------------------------------------- */
417 /* Function types */
418 /* ---------------------------------------------------------------------------------------------- */
419 
427 {
428  /* ---------------------------------------------------------------------------------------- */
429  /* Instruction */
430  /* ---------------------------------------------------------------------------------------- */
431 
440 
441  /* ---------------------------------------------------------------------------------------- */
442 
451 
452  /* ---------------------------------------------------------------------------------------- */
453  /* Operands */
454  /* ---------------------------------------------------------------------------------------- */
455 
464 
465  /* ---------------------------------------------------------------------------------------- */
466 
491 
492  /* ---------------------------------------------------------------------------------------- */
493  /* Elemental tokens */
494  /* ---------------------------------------------------------------------------------------- */
495 
500 
501  /* ---------------------------------------------------------------------------------------- */
502 
545 
546  /* ---------------------------------------------------------------------------------------- */
547  /* Optional tokens */
548  /* ---------------------------------------------------------------------------------------- */
549 
567 
568  /* ---------------------------------------------------------------------------------------- */
569 
579 
580 /* ---------------------------------------------------------------------------------------------- */
581 /* Decorator types */
582 /* ---------------------------------------------------------------------------------------------- */
583 
587 typedef enum ZydisDecorator_
588 {
618 
628 
629 /* ---------------------------------------------------------------------------------------------- */
630 /* Formatter context */
631 /* ---------------------------------------------------------------------------------------------- */
632 
633 typedef struct ZydisFormatter_ ZydisFormatter;
634 
639 {
655  void* user_data;
657 
658 /* ---------------------------------------------------------------------------------------------- */
659 /* Function prototypes */
660 /* ---------------------------------------------------------------------------------------------- */
661 
702 typedef ZyanStatus (*ZydisFormatterFunc)(const ZydisFormatter* formatter,
703  ZydisFormatterBuffer* buffer, ZydisFormatterContext* context);
704 
719 typedef ZyanStatus (*ZydisFormatterRegisterFunc)(const ZydisFormatter* formatter,
721 
736 typedef ZyanStatus (*ZydisFormatterDecoratorFunc)(const ZydisFormatter* formatter,
737  ZydisFormatterBuffer* buffer, ZydisFormatterContext* context, ZydisDecorator decorator);
738 
739 /* ---------------------------------------------------------------------------------------------- */
740 /* Formatter struct */
741 /* ---------------------------------------------------------------------------------------------- */
742 
753 {
829  ZyanI32 case_prefixes;
833  ZyanI32 case_mnemonic;
837  ZyanI32 case_registers;
841  ZyanI32 case_typecasts;
849  ZyanBool hex_uppercase;
856  struct
857  {
861  const ZyanStringView* string;
865  ZyanStringView string_data;
869  char buffer[11];
947 };
948 
949 /* ---------------------------------------------------------------------------------------------- */
950 
951 /* ============================================================================================== */
952 /* Exported functions */
953 /* ============================================================================================== */
954 
961 /* ---------------------------------------------------------------------------------------------- */
962 /* Initialization */
963 /* ---------------------------------------------------------------------------------------------- */
964 
973 ZYDIS_EXPORT ZyanStatus ZydisFormatterInit(ZydisFormatter* formatter, ZydisFormatterStyle style);
974 
975 /* ---------------------------------------------------------------------------------------------- */
976 /* Setter */
977 /* ---------------------------------------------------------------------------------------------- */
978 
991 ZYDIS_EXPORT ZyanStatus ZydisFormatterSetProperty(ZydisFormatter* formatter,
992  ZydisFormatterProperty property, ZyanUPointer value);
993 
1011 ZYDIS_EXPORT ZyanStatus ZydisFormatterSetHook(ZydisFormatter* formatter,
1012  ZydisFormatterFunction type, const void** callback);
1013 
1014 /* ---------------------------------------------------------------------------------------------- */
1015 /* Formatting */
1016 /* ---------------------------------------------------------------------------------------------- */
1017 
1030 ZYDIS_EXPORT ZyanStatus ZydisFormatterFormatInstruction(const ZydisFormatter* formatter,
1031  const ZydisDecodedInstruction* instruction, char* buffer, ZyanUSize length,
1032  ZyanU64 runtime_address);
1033 
1048 ZYDIS_EXPORT ZyanStatus ZydisFormatterFormatInstructionEx(const ZydisFormatter* formatter,
1049  const ZydisDecodedInstruction* instruction, char* buffer, ZyanUSize length,
1050  ZyanU64 runtime_address, void* user_data);
1051 
1068 ZYDIS_EXPORT ZyanStatus ZydisFormatterFormatOperand(const ZydisFormatter* formatter,
1069  const ZydisDecodedInstruction* instruction, ZyanU8 index, char* buffer, ZyanUSize length,
1070  ZyanU64 runtime_address);
1071 
1090 ZYDIS_EXPORT ZyanStatus ZydisFormatterFormatOperandEx(const ZydisFormatter* formatter,
1091  const ZydisDecodedInstruction* instruction, ZyanU8 index, char* buffer, ZyanUSize length,
1092  ZyanU64 runtime_address, void* user_data);
1093 
1094 /* ---------------------------------------------------------------------------------------------- */
1095 /* Tokenizing */
1096 /* ---------------------------------------------------------------------------------------------- */
1097 
1111 ZYDIS_EXPORT ZyanStatus ZydisFormatterTokenizeInstruction(const ZydisFormatter* formatter,
1112  const ZydisDecodedInstruction* instruction, void* buffer, ZyanUSize length,
1113  ZyanU64 runtime_address, ZydisFormatterTokenConst** token);
1114 
1130 ZYDIS_EXPORT ZyanStatus ZydisFormatterTokenizeInstructionEx(const ZydisFormatter* formatter,
1131  const ZydisDecodedInstruction* instruction, void* buffer, ZyanUSize length,
1132  ZyanU64 runtime_address, ZydisFormatterTokenConst** token, void* user_data);
1133 
1151 ZYDIS_EXPORT ZyanStatus ZydisFormatterTokenizeOperand(const ZydisFormatter* formatter,
1152  const ZydisDecodedInstruction* instruction, ZyanU8 index, void* buffer, ZyanUSize length,
1153  ZyanU64 runtime_address, ZydisFormatterTokenConst** token);
1154 
1174 ZYDIS_EXPORT ZyanStatus ZydisFormatterTokenizeOperandEx(const ZydisFormatter* formatter,
1175  const ZydisDecodedInstruction* instruction, ZyanU8 index, void* buffer, ZyanUSize length,
1176  ZyanU64 runtime_address, ZydisFormatterTokenConst** token, void* user_data);
1177 
1178 /* ---------------------------------------------------------------------------------------------- */
1179 
1184 /* ============================================================================================== */
1185 
1186 #ifdef __cplusplus
1187 }
1188 #endif
1189 
1190 #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:67
@ ZYDIS_FORMATTER_STYLE_ATT
Generates AT&T-style disassembly.
Definition: Formatter.h:71
@ ZYDIS_FORMATTER_STYLE_INTEL_MASM
Generates MASM-style disassembly that is directly accepted as input for the MASM assembler.
Definition: Formatter.h:82
@ ZYDIS_FORMATTER_STYLE_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition: Formatter.h:91
@ ZYDIS_FORMATTER_STYLE_INTEL
Generates Intel-style disassembly.
Definition: Formatter.h:75
@ ZYDIS_FORMATTER_STYLE_MAX_VALUE
Maximum value of this enum.
Definition: Formatter.h:87
ZydisSignedness_
Defines the ZydisSignedness enum.
Definition: Formatter.h:364
@ ZYDIS_SIGNEDNESS_MAX_VALUE
Maximum value of this enum.
Definition: Formatter.h:382
@ ZYDIS_SIGNEDNESS_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition: Formatter.h:386
@ ZYDIS_SIGNEDNESS_AUTO
Automatically choose the most suitable mode based on the operands ZydisDecodedOperand....
Definition: Formatter.h:369
@ ZYDIS_SIGNEDNESS_UNSIGNED
Force unsigned values.
Definition: Formatter.h:377
@ ZYDIS_SIGNEDNESS_SIGNED
Force signed values.
Definition: Formatter.h:373
ZydisFormatterFunction_
Defines the ZydisFormatterFunction enum.
Definition: Formatter.h:427
@ ZYDIS_FORMATTER_FUNC_PRE_OPERAND
This function is invoked before the formatter formats an operand.
Definition: Formatter.h:459
@ ZYDIS_FORMATTER_FUNC_PRINT_ADDRESS_ABS
This function is invoked to print absolute addresses.
Definition: Formatter.h:518
@ ZYDIS_FORMATTER_FUNC_PRINT_TYPECAST
This function is invoked to print the size of a memory operand (INTEL only).
Definition: Formatter.h:553
@ ZYDIS_FORMATTER_FUNC_PRINT_ADDRESS_REL
This function is invoked to print relative addresses.
Definition: Formatter.h:525
@ ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_MEM
This function is invoked to format a memory operand.
Definition: Formatter.h:478
@ ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_IMM
This function is invoked to format an immediate operand.
Definition: Formatter.h:490
@ ZYDIS_FORMATTER_FUNC_PRINT_MNEMONIC
This function is invoked to print the instruction mnemonic.
Definition: Formatter.h:499
@ ZYDIS_FORMATTER_FUNC_PRE_INSTRUCTION
This function is invoked before the formatter formats an instruction.
Definition: Formatter.h:435
@ ZYDIS_FORMATTER_FUNC_PRINT_DECORATOR
This function is invoked after formatting an operand to print a EVEX/MVEX decorator.
Definition: Formatter.h:566
@ ZYDIS_FORMATTER_FUNC_PRINT_REGISTER
This function is invoked to print a register.
Definition: Formatter.h:506
@ ZYDIS_FORMATTER_FUNC_PRINT_DISP
This function is invoked to print a memory displacement value.
Definition: Formatter.h:533
@ ZYDIS_FORMATTER_FUNC_POST_INSTRUCTION
This function is invoked after the formatter formatted an instruction.
Definition: Formatter.h:439
@ ZYDIS_FORMATTER_FUNC_POST_OPERAND
This function is invoked after the formatter formatted an operand.
Definition: Formatter.h:463
@ ZYDIS_FORMATTER_FUNC_PRINT_SEGMENT
This function is invoked to print the segment-register of a memory operand.
Definition: Formatter.h:557
@ ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_PTR
This function is invoked to format a pointer operand.
Definition: Formatter.h:482
@ ZYDIS_FORMATTER_FUNC_PRINT_IMM
This function is invoked to print an immediate value.
Definition: Formatter.h:544
@ ZYDIS_FORMATTER_FUNC_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition: Formatter.h:577
@ ZYDIS_FORMATTER_FUNC_MAX_VALUE
Maximum value of this enum.
Definition: Formatter.h:573
@ ZYDIS_FORMATTER_FUNC_PRINT_PREFIXES
This function is invoked to print the instruction prefixes.
Definition: Formatter.h:561
@ ZYDIS_FORMATTER_FUNC_FORMAT_INSTRUCTION
This function refers to the main formatting function.
Definition: Formatter.h:450
@ ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_REG
This function is invoked to format a register operand.
Definition: Formatter.h:470
ZyanStatus(* ZydisFormatterRegisterFunc)(const ZydisFormatter *formatter, ZydisFormatterBuffer *buffer, ZydisFormatterContext *context, ZydisRegister reg)
Defines the ZydisFormatterRegisterFunc function prototype.
Definition: Formatter.h:719
enum ZydisFormatterStyle_ ZydisFormatterStyle
Defines the ZydisFormatterStyle enum.
ZydisPadding_
Defines the ZydisPadding enum.
Definition: Formatter.h:395
@ ZYDIS_PADDING_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition: Formatter.h:413
@ ZYDIS_PADDING_AUTO
Padds the value to the current stack-width for addresses, or to the operand-width for immediate value...
Definition: Formatter.h:404
@ ZYDIS_PADDING_MAX_VALUE
Maximum value of this enum.
Definition: Formatter.h:409
@ ZYDIS_PADDING_DISABLED
Disables padding.
Definition: Formatter.h:399
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:338
@ ZYDIS_NUMERIC_BASE_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition: Formatter.h:355
@ ZYDIS_NUMERIC_BASE_HEX
Hexadecimal system.
Definition: Formatter.h:346
@ ZYDIS_NUMERIC_BASE_MAX_VALUE
Maximum value of this enum.
Definition: Formatter.h:351
@ ZYDIS_NUMERIC_BASE_DEC
Decimal system.
Definition: Formatter.h:342
ZyanStatus(* ZydisFormatterFunc)(const ZydisFormatter *formatter, ZydisFormatterBuffer *buffer, ZydisFormatterContext *context)
Defines the ZydisFormatterFunc function prototype.
Definition: Formatter.h:702
ZydisDecorator_
Defines the ZydisDecorator enum.
Definition: Formatter.h:588
@ ZYDIS_DECORATOR_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition: Formatter.h:626
@ ZYDIS_DECORATOR_INVALID
Definition: Formatter.h:589
@ ZYDIS_DECORATOR_SAE
The suppress-all-exceptions decorator.
Definition: Formatter.h:605
@ ZYDIS_DECORATOR_BC
The broadcast decorator.
Definition: Formatter.h:597
@ ZYDIS_DECORATOR_SWIZZLE
The register-swizzle decorator.
Definition: Formatter.h:609
@ ZYDIS_DECORATOR_MASK
The embedded-mask decorator.
Definition: Formatter.h:593
@ ZYDIS_DECORATOR_EH
The eviction-hint decorator.
Definition: Formatter.h:617
@ ZYDIS_DECORATOR_MAX_VALUE
Maximum value of this enum.
Definition: Formatter.h:622
@ ZYDIS_DECORATOR_CONVERSION
The conversion decorator.
Definition: Formatter.h:613
@ ZYDIS_DECORATOR_RC
The rounding-control decorator.
Definition: Formatter.h:601
ZydisFormatterProperty_
Defines the ZydisFormatterProperty enum.
Definition: Formatter.h:102
@ ZYDIS_FORMATTER_PROP_MAX_VALUE
Maximum value of this enum.
Definition: Formatter.h:325
@ ZYDIS_FORMATTER_PROP_IMM_SIGNEDNESS
Controls the signedness of immediate values.
Definition: Formatter.h:223
@ ZYDIS_FORMATTER_PROP_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition: Formatter.h:329
@ ZYDIS_FORMATTER_PROP_HEX_SUFFIX
Controls the suffix for hexadecimal values.
Definition: Formatter.h:318
@ ZYDIS_FORMATTER_PROP_FORCE_RELATIVE_BRANCHES
Controls the printing of branch addresses.
Definition: Formatter.h:136
@ ZYDIS_FORMATTER_PROP_UPPERCASE_MNEMONIC
Controls the letter-case for the mnemonic.
Definition: Formatter.h:248
@ ZYDIS_FORMATTER_PROP_UPPERCASE_TYPECASTS
Controls the letter-case for typecasts.
Definition: Formatter.h:260
@ ZYDIS_FORMATTER_PROP_UPPERCASE_PREFIXES
Controls the letter-case for prefixes.
Definition: Formatter.h:242
@ ZYDIS_FORMATTER_PROP_DEC_SUFFIX
Controls the suffix for decimal values.
Definition: Formatter.h:289
@ ZYDIS_FORMATTER_PROP_DISP_SIGNEDNESS
Controls the signedness of displacement values.
Definition: Formatter.h:202
@ ZYDIS_FORMATTER_PROP_DISP_PADDING
Controls the padding of displacement values.
Definition: Formatter.h:209
@ ZYDIS_FORMATTER_PROP_HEX_PREFIX
Controls the prefix for hexadecimal values.
Definition: Formatter.h:309
@ ZYDIS_FORMATTER_PROP_FORCE_SEGMENT
Controls the printing of segment prefixes.
Definition: Formatter.h:121
@ ZYDIS_FORMATTER_PROP_ADDR_BASE
Controls the base of address values.
Definition: Formatter.h:170
@ ZYDIS_FORMATTER_PROP_UPPERCASE_REGISTERS
Controls the letter-case for registers.
Definition: Formatter.h:254
@ ZYDIS_FORMATTER_PROP_DISP_BASE
Controls the base of displacement values.
Definition: Formatter.h:198
@ ZYDIS_FORMATTER_PROP_IMM_BASE
Controls the base of immediate values.
Definition: Formatter.h:216
@ ZYDIS_FORMATTER_PROP_FORCE_RELATIVE_RIPREL
Controls the printing of EIP/RIP-relative addresses.
Definition: Formatter.h:144
@ ZYDIS_FORMATTER_PROP_FORCE_SCALE_ONE
Controls the printing of the scale-factor component for memory operands.
Definition: Formatter.h:128
@ ZYDIS_FORMATTER_PROP_PRINT_BRANCH_SIZE
Controls the printing of branch-instructions sizes.
Definition: Formatter.h:153
@ ZYDIS_FORMATTER_PROP_UPPERCASE_DECORATORS
Controls the letter-case for decorators.
Definition: Formatter.h:266
@ ZYDIS_FORMATTER_PROP_IMM_PADDING
Controls the padding of immediate values.
Definition: Formatter.h:231
@ ZYDIS_FORMATTER_PROP_FORCE_SIZE
Controls the printing of effective operand-size suffixes (AT&T) or operand-sizes of memory operands (...
Definition: Formatter.h:114
@ ZYDIS_FORMATTER_PROP_ADDR_PADDING_ABSOLUTE
Controls the padding of absolute address values.
Definition: Formatter.h:183
@ ZYDIS_FORMATTER_PROP_HEX_UPPERCASE
Controls the letter-case of hexadecimal values.
Definition: Formatter.h:300
@ ZYDIS_FORMATTER_PROP_DEC_PREFIX
Controls the prefix for decimal values.
Definition: Formatter.h:280
@ ZYDIS_FORMATTER_PROP_DETAILED_PREFIXES
Controls the printing of instruction prefixes.
Definition: Formatter.h:161
@ ZYDIS_FORMATTER_PROP_ADDR_PADDING_RELATIVE
Controls the padding of relative address values.
Definition: Formatter.h:191
@ ZYDIS_FORMATTER_PROP_ADDR_SIGNEDNESS
Controls the signedness of relative addresses.
Definition: Formatter.h:175
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:736
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.
Information about a decoded instruction.
Definition: DecoderTypes.h:969
Defines the ZydisDecodedOperand struct.
Definition: DecoderTypes.h:111
Defines the ZydisFormatterBuffer struct.
Definition: FormatterBuffer.h:168
Defines the ZydisFormatterContext struct.
Definition: Formatter.h:639
const ZydisDecodedInstruction * instruction
A pointer to the ZydisDecodedInstruction struct.
Definition: Formatter.h:643
void * user_data
A pointer to user-defined data.
Definition: Formatter.h:655
ZyanU64 runtime_address
The runtime address of the instruction.
Definition: Formatter.h:651
const ZydisDecodedOperand * operand
A pointer to the ZydisDecodedOperand struct.
Definition: Formatter.h:647
Defines the ZydisFormatterToken struct.
Definition: FormatterBuffer.h:139
Defines the ZydisFormatter struct.
Definition: Formatter.h:753
ZydisFormatterFunc func_format_operand_imm
The ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_IMM function.
Definition: Formatter.h:906
ZydisFormatterFunc func_post_operand
The ZYDIS_FORMATTER_FUNC_POST_OPERAND function.
Definition: Formatter.h:890
ZyanBool detailed_prefixes
The ZYDIS_FORMATTER_DETAILED_PREFIXES property.
Definition: Formatter.h:785
ZydisFormatterStyle style
The formatter style.
Definition: Formatter.h:757
ZydisFormatterFunc func_print_disp
The ZYDIS_FORMATTER_FUNC_PRINT_DISP function.
Definition: Formatter.h:926
ZydisFormatterFunc func_format_operand_mem
The ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_MEM function.
Definition: Formatter.h:898
ZydisNumericBase addr_base
The ZYDIS_FORMATTER_ADDR_BASE property.
Definition: Formatter.h:789
ZydisPadding imm_padding
The ZYDIS_FORMATTER_IMM_PADDING property.
Definition: Formatter.h:825
ZyanBool force_relative_branches
The ZYDIS_FORMATTER_PROP_FORCE_RELATIVE_BRANCHES property.
Definition: Formatter.h:773
ZydisPadding disp_padding
The ZYDIS_FORMATTER_DISP_PADDING property.
Definition: Formatter.h:813
ZydisSignedness imm_signedness
The ZYDIS_FORMATTER_IMM_SIGNEDNESS property.
Definition: Formatter.h:821
ZyanBool hex_uppercase
The ZYDIS_FORMATTER_HEX_UPPERCASE property.
Definition: Formatter.h:849
ZydisFormatterFunc func_post_instruction
The ZYDIS_FORMATTER_FUNC_POST_INSTRUCTION function.
Definition: Formatter.h:878
ZydisPadding addr_padding_absolute
The ZYDIS_FORMATTER_ADDR_PADDING_ABSOLUTE property.
Definition: Formatter.h:797
ZydisFormatterDecoratorFunc func_print_decorator
The ZYDIS_FORMATTER_FUNC_PRINT_DECORATOR function.
Definition: Formatter.h:946
ZyanBool force_memory_segment
The ZYDIS_FORMATTER_PROP_FORCE_SEGMENT property.
Definition: Formatter.h:765
ZyanI32 case_decorators
The ZYDIS_FORMATTER_UPPERCASE_DECORATORS property.
Definition: Formatter.h:845
ZydisPadding addr_padding_relative
The ZYDIS_FORMATTER_ADDR_PADDING_RELATIVE property.
Definition: Formatter.h:801
ZydisFormatterRegisterFunc func_print_register
The ZYDIS_FORMATTER_FUNC_PRINT_REGISTER function.
Definition: Formatter.h:914
ZydisNumericBase imm_base
The ZYDIS_FORMATTER_IMM_BASE property.
Definition: Formatter.h:817
ZydisNumericBase disp_base
The ZYDIS_FORMATTER_DISP_BASE property.
Definition: Formatter.h:805
ZyanBool force_memory_scale
The ZYDIS_FORMATTER_PROP_FORCE_SCALE_ONE property.
Definition: Formatter.h:769
const ZyanStringView * string
A pointer to the ZyanStringView to use as prefix/suffix.
Definition: Formatter.h:861
ZydisSignedness disp_signedness
The ZYDIS_FORMATTER_DISP_SIGNEDNESS property.
Definition: Formatter.h:809
ZyanI32 case_mnemonic
The ZYDIS_FORMATTER_UPPERCASE_MNEMONIC property.
Definition: Formatter.h:833
ZyanI32 case_registers
The ZYDIS_FORMATTER_UPPERCASE_REGISTERS property.
Definition: Formatter.h:837
ZydisFormatterFunc func_format_operand_ptr
The ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_PTR function.
Definition: Formatter.h:902
ZyanBool force_memory_size
The ZYDIS_FORMATTER_PROP_FORCE_SIZE property.
Definition: Formatter.h:761
ZydisFormatterFunc func_format_instruction
The ZYDIS_FORMATTER_FUNC_FORMAT_INSTRUCTION function.
Definition: Formatter.h:882
ZydisFormatterFunc func_print_address_abs
The ZYDIS_FORMATTER_FUNC_PRINT_ADDRESS_ABS function.
Definition: Formatter.h:918
ZyanBool force_relative_riprel
The ZYDIS_FORMATTER_PROP_FORCE_RELATIVE_RIPREL property.
Definition: Formatter.h:777
ZyanI32 case_prefixes
The ZYDIS_FORMATTER_UPPERCASE_PREFIXES property.
Definition: Formatter.h:829
ZyanStringView string_data
The ZyanStringView to use as prefix/suffix.
Definition: Formatter.h:865
ZydisSignedness addr_signedness
The ZYDIS_FORMATTER_ADDR_SIGNEDNESS property.
Definition: Formatter.h:793
ZyanBool print_branch_size
The ZYDIS_FORMATTER_PROP_PRINT_BRANCH_SIZE property.
Definition: Formatter.h:781
ZydisFormatterFunc func_pre_operand
The ZYDIS_FORMATTER_FUNC_PRE_OPERAND function.
Definition: Formatter.h:886
char buffer[11]
The actual string data.
Definition: Formatter.h:869
ZydisFormatterFunc func_print_typecast
The ZYDIS_FORMATTER_FUNC_PRINT_TYPECAST function.
Definition: Formatter.h:934
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:894
ZydisFormatterFunc func_print_address_rel
The ZYDIS_FORMATTER_FUNC_PRINT_ADDRESS_REL function.
Definition: Formatter.h:922
ZydisFormatterFunc func_print_imm
The ZYDIS_FORMATTER_FUNC_PRINT_IMM function.
Definition: Formatter.h:930
ZyanI32 case_typecasts
The ZYDIS_FORMATTER_UPPERCASE_TYPECASTS property.
Definition: Formatter.h:841
ZydisFormatterFunc func_print_segment
The ZYDIS_FORMATTER_FUNC_PRINT_SEGMENT function.
Definition: Formatter.h:938
ZydisFormatterFunc func_print_mnemonic
The `ZYDIS_FORMATTER_FUNC_PRINT_MNEMONIC function.
Definition: Formatter.h:910
ZydisFormatterFunc func_pre_instruction
The ZYDIS_FORMATTER_FUNC_PRE_INSTRUCTION function.
Definition: Formatter.h:874
ZydisFormatterFunc func_print_prefixes
The ZYDIS_FORMATTER_FUNC_PRINT_PREFIXES function.
Definition: Formatter.h:942