32 #ifndef ZYDIS_FORMATTER_BASE_H
33 #define ZYDIS_FORMATTER_BASE_H
61 #define ZYDIS_STRING_APPEND_NUM_U(formatter, base, str, value, padding_length, \
62 force_leading_number) \
65 case ZYDIS_NUMERIC_BASE_DEC: \
66 ZYAN_CHECK(ZydisStringAppendDecU(str, value, padding_length, \
67 (formatter)->number_format[base][0].string, \
68 (formatter)->number_format[base][1].string)); \
70 case ZYDIS_NUMERIC_BASE_HEX: \
71 ZYAN_CHECK(ZydisStringAppendHexU(str, value, padding_length, force_leading_number, \
72 (formatter)->hex_uppercase, \
73 (formatter)->number_format[base][0].string, \
74 (formatter)->number_format[base][1].string)); \
77 return ZYAN_STATUS_INVALID_ARGUMENT; \
92 #define ZYDIS_STRING_APPEND_NUM_S(formatter, base, str, value, padding_length, \
93 force_leading_number, force_sign) \
96 case ZYDIS_NUMERIC_BASE_DEC: \
97 ZYAN_CHECK(ZydisStringAppendDecS(str, value, padding_length, force_sign, \
98 (formatter)->number_format[base][0].string, \
99 (formatter)->number_format[base][1].string)); \
101 case ZYDIS_NUMERIC_BASE_HEX: \
102 ZYAN_CHECK(ZydisStringAppendHexS(str, value, padding_length, force_leading_number, \
103 (formatter)->hex_uppercase, force_sign, \
104 (formatter)->number_format[base][0].string, \
105 (formatter)->number_format[base][1].string)); \
108 return ZYAN_STATUS_INVALID_ARGUMENT; \
125 #define ZYDIS_BUFFER_APPEND_TOKEN(buffer, type) \
126 if ((buffer)->is_token_list) \
128 ZYAN_CHECK(ZydisFormatterBufferAppend(buffer, type)); \
140 #define ZYDIS_BUFFER_REMEMBER(buffer, state) \
141 if ((buffer)->is_token_list) \
143 (state) = (ZyanUPointer)(buffer)->string.vector.data; \
146 (state) = (ZyanUPointer)(buffer)->string.vector.size; \
155 #define ZYDIS_BUFFER_APPEND(buffer, name) \
156 if ((buffer)->is_token_list) \
158 ZYAN_CHECK(ZydisFormatterBufferAppendPredefined(buffer, TOK_ ## name)); \
161 ZYAN_CHECK(ZydisStringAppendShort(&buffer->string, &STR_ ## name)); \
173 #define ZYDIS_BUFFER_APPEND_CASE(buffer, name, letter_case) \
174 if ((buffer)->is_token_list) \
176 ZYAN_CHECK(ZydisFormatterBufferAppendPredefined(buffer, TOK_ ## name)); \
179 ZYAN_CHECK(ZydisStringAppendShortCase(&buffer->string, &STR_ ## name, letter_case)); \
194 # pragma warning(push)
195 # pragma warning(disable:4200)
198 #pragma pack(push, 1)
210 # pragma warning(pop)
230 const ZyanUSize len = buffer->
string.vector.size;
231 ZYAN_ASSERT((len > 0) && (len < 256));
234 return ZYAN_STATUS_INSUFFICIENT_BUFFER_SIZE;
238 last->
next = (ZyanU8)len;
240 ZYAN_MEMCPY((ZyanU8*)buffer->
string.vector.data + len, &data->
data[0], data->
size);
242 const ZyanUSize delta = len + data->
next;
244 buffer->
string.vector.data = (ZyanU8*)buffer->
string.vector.data + delta;
248 return ZYAN_STATUS_SUCCESS;
Provides some internal, more performant, but unsafe helper functions for the ZyanString data-type.
Defines the ZydisDecodedOperand struct.
Definition: DecoderTypes.h:214
Context structure that that is passed to all formatter.
Definition: Formatter.h:652
Definition: FormatterBase.h:201
ZyanU8 size
Definition: FormatterBase.h:202
ZyanU8 next
Definition: FormatterBase.h:203
ZyanU8 data[]
Definition: FormatterBase.h:204