32 #ifndef ZYDIS_FORMATTER_BASE_H
33 #define ZYDIS_FORMATTER_BASE_H
59 #define ZYDIS_STRING_APPEND_NUM_U(formatter, base, str, value, padding_length) \
62 case ZYDIS_NUMERIC_BASE_DEC: \
63 ZYAN_CHECK(ZydisStringAppendDecU(str, value, padding_length, \
64 (formatter)->number_format[base][0].string, \
65 (formatter)->number_format[base][1].string)); \
67 case ZYDIS_NUMERIC_BASE_HEX: \
68 ZYAN_CHECK(ZydisStringAppendHexU(str, value, padding_length, \
69 (formatter)->hex_uppercase, \
70 (formatter)->number_format[base][0].string, \
71 (formatter)->number_format[base][1].string)); \
74 return ZYAN_STATUS_INVALID_ARGUMENT; \
87 #define ZYDIS_STRING_APPEND_NUM_S(formatter, base, str, value, padding_length, force_sign) \
90 case ZYDIS_NUMERIC_BASE_DEC: \
91 ZYAN_CHECK(ZydisStringAppendDecS(str, value, padding_length, force_sign, \
92 (formatter)->number_format[base][0].string, \
93 (formatter)->number_format[base][1].string)); \
95 case ZYDIS_NUMERIC_BASE_HEX: \
96 ZYAN_CHECK(ZydisStringAppendHexS(str, value, padding_length, \
97 (formatter)->hex_uppercase, force_sign, \
98 (formatter)->number_format[base][0].string, \
99 (formatter)->number_format[base][1].string)); \
102 return ZYAN_STATUS_INVALID_ARGUMENT; \
119 #define ZYDIS_BUFFER_APPEND_TOKEN(buffer, type) \
120 if ((buffer)->is_token_list) \
122 ZYAN_CHECK(ZydisFormatterBufferAppend(buffer, type)); \
134 #define ZYDIS_BUFFER_REMEMBER(buffer, state) \
135 if ((buffer)->is_token_list) \
137 (state) = (ZyanUPointer)(buffer)->string.vector.data; \
140 (state) = (ZyanUPointer)(buffer)->string.vector.size; \
149 #define ZYDIS_BUFFER_APPEND(buffer, name) \
150 if ((buffer)->is_token_list) \
152 ZYAN_CHECK(ZydisFormatterBufferAppendPredefined(buffer, TOK_ ## name)); \
155 ZYAN_CHECK(ZydisStringAppendShort(&buffer->string, &STR_ ## name)); \
167 #define ZYDIS_BUFFER_APPEND_CASE(buffer, name, letter_case) \
168 if ((buffer)->is_token_list) \
170 ZYAN_CHECK(ZydisFormatterBufferAppendPredefined(buffer, TOK_ ## name)); \
173 ZYAN_CHECK(ZydisStringAppendShortCase(&buffer->string, &STR_ ## name, letter_case)); \
188 # pragma warning(push)
189 # pragma warning(disable:4200)
192 #pragma pack(push, 1)
204 # pragma warning(pop)
224 const ZyanUSize len = buffer->
string.vector.size;
225 ZYAN_ASSERT((len > 0) && (len < 256));
228 return ZYAN_STATUS_INSUFFICIENT_BUFFER_SIZE;
232 last->
next = (ZyanU8)len;
234 ZYAN_MEMCPY((ZyanU8*)buffer->
string.vector.data + len, &data->
data[0], data->
size);
236 const ZyanUSize delta = len + data->
next;
238 buffer->
string.vector.data = (ZyanU8*)buffer->
string.vector.data + delta;
242 return ZYAN_STATUS_SUCCESS;
Provides some internal, more performant, but unsafe helper functions for the ZyanString data-type.
Defines the ZydisFormatterContext struct.
Definition: Formatter.h:639
Definition: FormatterBase.h:195
ZyanU8 size
Definition: FormatterBase.h:196
ZyanU8 next
Definition: FormatterBase.h:197
ZyanU8 data[]
Definition: FormatterBase.h:198