ReactOS 0.4.16-dev-297-gc569aee
RtlMemory.c File Reference
#include <stddef.h>
#include <kmt_test.h>
Include dependency graph for RtlMemory.c:

Go to the source code of this file.

Macros

#define KMT_EMULATE_KERNEL
 

Functions

 __declspec (dllimport)
 
static BOOLEAN CheckBuffer (IN const VOID *Buffer,...)
 
static VOID MakePattern (OUT PVOID Buffer,...)
 
static BOOLEAN CheckPattern (IN const VOID *Buffer,...)
 
 START_TEST (RtlMemory)
 

Macro Definition Documentation

◆ KMT_EMULATE_KERNEL

#define KMT_EMULATE_KERNEL

Function Documentation

◆ __declspec()

__declspec ( dllimport  )

Definition at line 9 of file RtlMemory.c.

24{
26 INT Count;
27 INT Value;
28 va_list Arguments;
29
30 va_start(Arguments, Buffer);
31
32 while (1)
33 {
34 Count = va_arg(Arguments, INT);
35 if (!Count)
36 break;
37 ASSERT(Count > 0);
38
39 Value = va_arg(Arguments, INT);
40 while (Count--)
41 *OutBuffer++ = Value;
42 }
43
44 va_end(Arguments);
45}
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define va_arg(ap, T)
Definition: acmsvcex.h:89
Definition: bufpool.h:45
#define ASSERT(a)
Definition: mode.c:44
int Count
Definition: noreturn.cpp:7
_In_ UCHAR _In_ ULONG _Out_ PUCHAR _Outptr_result_bytebuffer_ OutBufferLength PVOID * OutBuffer
Definition: scsi.h:4071
int32_t INT
Definition: typedefs.h:58
unsigned char * PUCHAR
Definition: typedefs.h:53
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413

◆ CheckBuffer()

static BOOLEAN CheckBuffer ( IN const VOID Buffer,
  ... 
)
static

Definition at line 49 of file RtlMemory.c.

52{
54 INT Count;
55 INT Value;
56 va_list Arguments;
57
58 va_start(Arguments, Buffer);
59
60 while (1)
61 {
62 Count = va_arg(Arguments, INT);
63 if (!Count)
64 break;
65 ASSERT(Count > 0);
66
67 Value = va_arg(Arguments, INT);
68 while (Count--)
69 if (*OutBuffer++ != Value)
70 {
71 --OutBuffer;
72 trace("CheckBuffer failed at offset %d, value %x, expected %x\n", OutBuffer - (CONST UCHAR*)Buffer, *OutBuffer, Value);
73 return FALSE;
74 }
75 }
76
77 va_end(Arguments);
78 return TRUE;
79}
#define trace
Definition: atltest.h:70
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define CONST
Definition: pedump.c:81
unsigned char UCHAR
Definition: xmlstorage.h:181

Referenced by START_TEST().

◆ CheckPattern()

static BOOLEAN CheckPattern ( IN const VOID Buffer,
  ... 
)
static

Definition at line 117 of file RtlMemory.c.

120{
122 INT Count, Repeat, i;
123 INT Values[16];
124 va_list Arguments;
125
126 va_start(Arguments, Buffer);
127
128 while (1)
129 {
130 Count = va_arg(Arguments, INT);
131 if (!Count)
132 break;
133 ASSERT(Count > 0 && Count < sizeof Values / sizeof Values[0]);
134
135 Repeat = va_arg(Arguments, INT);
136 ASSERT(Repeat > 0);
137
138 for (i = 0; i < Count; ++i)
139 Values[i] = va_arg(Arguments, INT);
140
141 while (Repeat--)
142 for (i = 0; i < Count; ++i)
143 if (*OutBuffer++ != Values[i])
144 {
145 --OutBuffer;
146 trace("CheckPattern failed at offset %d, value %x, expected %x\n", OutBuffer - (CONST UCHAR*)Buffer, *OutBuffer, Values[i]);
147 return FALSE;
148 }
149 }
150
151 va_end(Arguments);
152 return TRUE;
153}
static BOOLEAN Repeat
Definition: dem.c:247
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248

Referenced by START_TEST().

◆ MakePattern()

static VOID MakePattern ( OUT PVOID  Buffer,
  ... 
)
static

Definition at line 83 of file RtlMemory.c.

86{
88 INT Count, Repeat, i;
89 INT Values[16];
90 va_list Arguments;
91
92 va_start(Arguments, Buffer);
93
94 while (1)
95 {
96 Count = va_arg(Arguments, INT);
97 if (!Count)
98 break;
99 ASSERT(Count > 0 && Count < sizeof Values / sizeof Values[0]);
100
101 Repeat = va_arg(Arguments, INT);
102 ASSERT(Repeat > 0);
103
104 for (i = 0; i < Count; ++i)
105 Values[i] = va_arg(Arguments, INT);
106
107 while (Repeat--)
108 for (i = 0; i < Count; ++i)
109 *OutBuffer++ = Values[i];
110 }
111
112 va_end(Arguments);
113}

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( RtlMemory  )

Definition at line 155 of file RtlMemory.c.

156{
158 UCHAR Buffer[513];
159 const SIZE_T Size = 512;
160 const SIZE_T HalfSize = Size / 2;
161 SIZE_T RetSize;
162 KIRQL Irql;
163 SIZE_T i;
164
166 /* zero everything behind 'Size'. Tests will check that this wasn't changed.
167 * TODO: use guarded memory for this! */
168 MakeBuffer(Buffer + Size, sizeof Buffer - Size, 0, 0);
169
170 /* test our helper functions first */
171 MakeBuffer(Buffer, HalfSize, 0x55, HalfSize, 0xAA, 0);
172 for (i = 0; i < HalfSize; ++i)
173 ok_eq_uint(Buffer[i], 0x55);
174 for (i = HalfSize; i < Size; ++i)
175 ok_eq_uint(Buffer[i], 0xAA);
176 ok_bool_true(CheckBuffer(Buffer, HalfSize, 0x55, HalfSize, 0xAA, 1, 0, 0), "CheckBuffer");
177
178 MakePattern(Buffer, 3, 20, 0x11, 0x22, 0x33, 1, 4, 0x44, 0);
179 for (i = 0; i < 60; i += 3)
180 {
181 ok_eq_uint(Buffer[i+0], 0x11);
182 ok_eq_uint(Buffer[i+1], 0x22);
183 ok_eq_uint(Buffer[i+2], 0x33);
184 }
185 for (i = 60; i < 64; ++i)
186 ok_eq_uint(Buffer[i], 0x44);
187 for (i = 64; i < HalfSize; ++i)
188 ok_eq_uint(Buffer[i], 0x55);
189 for (i = HalfSize; i < Size; ++i)
190 ok_eq_uint(Buffer[i], 0xAA);
191 ok_bool_true(CheckPattern(Buffer, 3, 20, 0x11, 0x22, 0x33, 1, 4, 0x44, 0), "CheckPattern");
192
193 /* RtlMoveMemory */
194 MakePattern(Buffer, 2, 64, 0x12, 0x34, 2, 192, 0x56, 0x78, 0);
195 RtlMoveMemory(Buffer + 13, Buffer + 62, 95);
196 ok_bool_true(CheckPattern(Buffer, 2, 6, 0x12, 0x34, 1, 1, 0x12, 2, 33, 0x12, 0x34, 2, 14, 0x56, 0x78, 1, 1, 0x56, 2, 10, 0x12, 0x34, 2, 192, 0x56, 0x78, 1, 1, 0, 0), "CheckPattern");
197
198 MakePattern(Buffer, 2, 32, 0x12, 0x34, 2, 32, 0x56, 0x78, 2, 192, 0x9A, 0xAB, 0);
199 RtlMoveMemory(Buffer + 78, Buffer + 43, 107);
200 ok_bool_true(CheckPattern(Buffer, 2, 32, 0x12, 0x34, 2, 7, 0x56, 0x78, 1, 1, 0x34, 2, 10, 0x12, 0x34, 2, 32, 0x56, 0x78, 2, 11, 0x9A, 0xAB, 1, 1, 0xAB, 2, 163, 0x9A, 0xAB, 1, 1, 0, 0), "CheckPattern");
201
204 _SEH2_TRY {
208 } _SEH2_END;
211
212#undef RtlMoveMemory
213 /* RtlMoveMemory export */
214 MakePattern(Buffer, 2, 64, 0x12, 0x34, 2, 192, 0x56, 0x78, 0);
215 RtlMoveMemory(Buffer + 13, Buffer + 62, 95);
216 ok_bool_true(CheckPattern(Buffer, 2, 6, 0x12, 0x34, 1, 1, 0x12, 2, 33, 0x12, 0x34, 2, 14, 0x56, 0x78, 1, 1, 0x56, 2, 10, 0x12, 0x34, 2, 192, 0x56, 0x78, 1, 1, 0, 0), "CheckPattern");
217
218 MakePattern(Buffer, 2, 32, 0x12, 0x34, 2, 32, 0x56, 0x78, 2, 192, 0x9A, 0xAB, 0);
219 RtlMoveMemory(Buffer + 78, Buffer + 43, 107);
220 ok_bool_true(CheckPattern(Buffer, 2, 32, 0x12, 0x34, 2, 7, 0x56, 0x78, 1, 1, 0x34, 2, 10, 0x12, 0x34, 2, 32, 0x56, 0x78, 2, 11, 0x9A, 0xAB, 1, 1, 0xAB, 2, 163, 0x9A, 0xAB, 1, 1, 0, 0), "CheckPattern");
221
224 _SEH2_TRY {
228 } _SEH2_END;
231
232 /* RtlCopyMemory */
233 MakePattern(Buffer, 2, 64, 0x12, 0x34, 2, 192, 0x56, 0x78, 0);
234 RtlCopyMemory(Buffer + 13, Buffer + 62, 95);
235 ok_bool_true(CheckPattern(Buffer, 2, 6, 0x12, 0x34, 1, 1, 0x12, 2, 33, 0x12, 0x34, 2, 14, 0x56, 0x78, 1, 1, 0x56, 2, 10, 0x12, 0x34, 2, 192, 0x56, 0x78, 1, 1, 0, 0), "CheckPattern");
236
237 MakePattern(Buffer, 2, 32, 0x12, 0x34, 2, 32, 0x56, 0x78, 2, 192, 0x9A, 0xAB, 0);
238 RtlCopyMemory(Buffer + 78, Buffer + 43, 107);
239 ok_bool_true(CheckPattern(Buffer, 2, 32, 0x12, 0x34, 2, 7, 0x56, 0x78, 1, 1, 0x34, 2, 10, 0x12, 0x34, 2, 32, 0x56, 0x78, 2, 11, 0x9A, 0xAB, 1, 1, 0xAB, 2, 163, 0x9A, 0xAB, 1, 1, 0, 0), "CheckPattern");
240
243 _SEH2_TRY {
247 } _SEH2_END;
250
251 /* RtlCopyMemoryNonTemporal */
252 MakePattern(Buffer, 2, 64, 0x12, 0x34, 2, 192, 0x56, 0x78, 0);
253 RtlCopyMemoryNonTemporal(Buffer + 13, Buffer + 62, 95);
254 ok_bool_true(CheckPattern(Buffer, 2, 6, 0x12, 0x34, 1, 1, 0x12, 2, 33, 0x12, 0x34, 2, 14, 0x56, 0x78, 1, 1, 0x56, 2, 10, 0x12, 0x34, 2, 192, 0x56, 0x78, 1, 1, 0, 0), "CheckPattern");
255
256 MakePattern(Buffer, 2, 32, 0x12, 0x34, 2, 32, 0x56, 0x78, 2, 192, 0x9A, 0xAB, 0);
257 RtlCopyMemoryNonTemporal(Buffer + 78, Buffer + 43, 107);
258 ok_bool_true(CheckPattern(Buffer, 2, 32, 0x12, 0x34, 2, 7, 0x56, 0x78, 1, 1, 0x34, 2, 10, 0x12, 0x34, 2, 32, 0x56, 0x78, 2, 11, 0x9A, 0xAB, 1, 1, 0xAB, 2, 163, 0x9A, 0xAB, 1, 1, 0, 0), "CheckPattern");
259
262 _SEH2_TRY {
266 } _SEH2_END;
269
270 /* RtlCopyBytes */
271 MakePattern(Buffer, 2, 64, 0x12, 0x34, 2, 192, 0x56, 0x78, 0);
272 RtlCopyBytes(Buffer + 13, Buffer + 62, 95);
273 ok_bool_true(CheckPattern(Buffer, 2, 6, 0x12, 0x34, 1, 1, 0x12, 2, 33, 0x12, 0x34, 2, 14, 0x56, 0x78, 1, 1, 0x56, 2, 10, 0x12, 0x34, 2, 192, 0x56, 0x78, 1, 1, 0, 0), "CheckPattern");
274
275 MakePattern(Buffer, 2, 32, 0x12, 0x34, 2, 32, 0x56, 0x78, 2, 192, 0x9A, 0xAB, 0);
276 RtlCopyBytes(Buffer + 78, Buffer + 43, 107);
277 ok_bool_true(CheckPattern(Buffer, 2, 32, 0x12, 0x34, 2, 7, 0x56, 0x78, 1, 1, 0x34, 2, 10, 0x12, 0x34, 2, 32, 0x56, 0x78, 2, 11, 0x9A, 0xAB, 1, 1, 0xAB, 2, 163, 0x9A, 0xAB, 1, 1, 0, 0), "CheckPattern");
278
281 _SEH2_TRY {
285 } _SEH2_END;
288
289 /* RtlEqualMemory */
290 MakePattern(Buffer, 8, HalfSize / 8 - 1, 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0,
291 1, 1, 0x12,
292 8, HalfSize / 8, 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0,
293 1, 7, 0x12, 0);
294
296 "RtlEqualMemory returned");
297 ok_bool_true(RtlEqualMemory(Buffer, Buffer + HalfSize - 7, HalfSize - 8),
298 "RtlEqualMemory returned");
299 ok_bool_true(RtlEqualMemory(Buffer, Buffer + HalfSize - 7, HalfSize - 8 + 1),
300 "RtlEqualMemory returned");
301 ok_bool_false(RtlEqualMemory(Buffer, Buffer + HalfSize - 7, HalfSize - 8 + 2),
302 "RtlEqualMemory returned");
303
304 /* RtlCompareMemory */
305 MakePattern(Buffer, 8, HalfSize / 8 - 1, 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0,
306 1, 1, 0x12,
307 8, HalfSize / 8, 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0,
308 1, 7, 0x12, 0);
309
310 RetSize = RtlCompareMemory(Buffer, Buffer + HalfSize - 7, HalfSize - 8);
311 ok_eq_size(RetSize, HalfSize - 8);
312 RetSize = RtlCompareMemory(Buffer, Buffer + HalfSize - 7, HalfSize - 8 + 1);
313 ok_eq_size(RetSize, HalfSize - 8 + 1);
314 RetSize = RtlCompareMemory(Buffer, Buffer + HalfSize - 7, HalfSize - 8 + 2);
315 ok_eq_size(RetSize, HalfSize - 8 + 1);
316
319 _SEH2_TRY {
320 RetSize = RtlCompareMemory(Buffer, Buffer + HalfSize - 7, SIZE_MAX);
321 ok_eq_size(RetSize, HalfSize - 8 + 1);
322 RetSize = RtlCompareMemory(NULL, NULL, 0);
323 ok_eq_size(RetSize, 0);
326 } _SEH2_END;
329
330 /* RtlCompareMemoryUlong */
331 MakeBuffer(Buffer, 8, 0x55, Size - 8, 0, 0);
332 RetSize = RtlCompareMemoryUlong(Buffer, sizeof(ULONG), 0x55555555LU);
333 ok_eq_size(RetSize, 4);
334 RetSize = RtlCompareMemoryUlong(Buffer + 1, sizeof(ULONG), 0x55555555LU);
335 ok_eq_size(RetSize, 4);
336 RetSize = RtlCompareMemoryUlong(Buffer + 2, sizeof(ULONG), 0x55555555LU);
337 ok_eq_size(RetSize, 4);
338 RetSize = RtlCompareMemoryUlong(Buffer + 3, sizeof(ULONG), 0x55555555LU);
339 ok_eq_size(RetSize, 4);
340 RetSize = RtlCompareMemoryUlong(Buffer + 5, sizeof(ULONG), 0x55555555LU);
341 ok_eq_size(RetSize, 0);
342 RetSize = RtlCompareMemoryUlong(Buffer + 5, sizeof(ULONG), 0x00555555LU);
343 ok_eq_size(RetSize, 4);
344 RetSize = RtlCompareMemoryUlong(Buffer, 1, 0x55555555LU);
345 ok_eq_size(RetSize, 0);
346 RetSize = RtlCompareMemoryUlong(Buffer, 2, 0x55555555LU);
347 ok_eq_size(RetSize, 0);
348 RetSize = RtlCompareMemoryUlong(Buffer, 3, 0x55555555LU);
349 ok_eq_size(RetSize, 0);
350 RetSize = RtlCompareMemoryUlong(Buffer, 5, 0x55555555LU);
351 ok_eq_size(RetSize, 4);
352
355 _SEH2_TRY {
356 RetSize = RtlCompareMemoryUlong(NULL, 0, 0x55555555LU);
357 ok_eq_size(RetSize, 0);
360 } _SEH2_END;
363
364 /* RtlZeroMemory */
365 MakeBuffer(Buffer, Size, 0x11, 0);
367 ok_bool_true(CheckBuffer(Buffer, 1, 0, Size - 1, 0x11, 1, 0, 0), "CheckBuffer");
368 Buffer[0] = 0x11;
370 ok_bool_true(CheckBuffer(Buffer, Size - 1, 0, 1, 0x11, 1, 0, 0), "CheckBuffer");
371
374 _SEH2_TRY {
378 } _SEH2_END;
381
382 /* RtlSecureZeroMemory */
383 MakeBuffer(Buffer, Size, 0x11, 0);
385 ok_bool_true(CheckBuffer(Buffer, 1, 0, Size - 1, 0x11, 1, 0, 0), "CheckBuffer");
386 Buffer[0] = 0x11;
388 ok_bool_true(CheckBuffer(Buffer, Size - 1, 0, 1, 0x11, 1, 0, 0), "CheckBuffer");
389
392 _SEH2_TRY {
396 } _SEH2_END;
399
400 /* RtlZeroBytes */
401 MakeBuffer(Buffer, Size, 0x11, 0);
403 ok_bool_true(CheckBuffer(Buffer, 1, 0, Size - 1, 0x11, 1, 0, 0), "CheckBuffer");
404 Buffer[0] = 0x11;
406 ok_bool_true(CheckBuffer(Buffer, Size - 1, 0, 1, 0x11, 1, 0, 0), "CheckBuffer");
407
410 _SEH2_TRY {
411 RtlZeroBytes(NULL, 0);
414 } _SEH2_END;
417
418 /* RtlFillMemory */
419 MakeBuffer(Buffer, Size, 0, 0);
420 RtlFillMemory(Buffer, HalfSize, 0x55);
421 RtlFillMemory(Buffer + HalfSize, HalfSize, 0xAA);
422 ok_bool_true(CheckBuffer(Buffer, HalfSize, 0x55, HalfSize, 0xAA, 1, 0, 0), "CheckBuffer");
423 RtlFillMemory(Buffer + 3, 7, 0x88);
424 ok_bool_true(CheckBuffer(Buffer, 3, 0x55, 7, 0x88, HalfSize - 10, 0x55, HalfSize, 0xAA, 1, 0, 0), "CheckBuffer");
425
428 _SEH2_TRY {
429#if defined(__GNUC__) && __GNUC__ >= 5
430#pragma GCC diagnostic push
431#pragma GCC diagnostic ignored "-Wmemset-transposed-args"
432#endif
433 RtlFillMemory(NULL, 0, 0x55);
434#if defined(__GNUC__) && __GNUC__ >= 5
435#pragma GCC diagnostic pop
436#endif
439 } _SEH2_END;
442
443#undef RtlFillMemory
444 /* RtlFillMemory export */
445 MakeBuffer(Buffer, Size, 0, 0);
446 RtlFillMemory(Buffer, HalfSize, 0x55);
447 RtlFillMemory(Buffer + HalfSize, HalfSize, 0xAA);
448 ok_bool_true(CheckBuffer(Buffer, HalfSize, 0x55, HalfSize, 0xAA, 1, 0, 0), "CheckBuffer");
449 RtlFillMemory(Buffer + 3, 7, 0x88);
450 ok_bool_true(CheckBuffer(Buffer, 3, 0x55, 7, 0x88, HalfSize - 10, 0x55, HalfSize, 0xAA, 1, 0, 0), "CheckBuffer");
451
454 _SEH2_TRY {
455 RtlFillMemory(NULL, 0, 0x55);
458 } _SEH2_END;
461
462 /* TODO: fix NDK. This should work! */
463#if !defined _M_AMD64 || defined KMT_KERNEL_MODE
464 /* RtlFillMemoryUlong */
465 MakeBuffer(Buffer, Size, 0, 0);
466 RtlFillMemoryUlong(Buffer, HalfSize, 0x01234567LU);
467 RtlFillMemoryUlong(Buffer + HalfSize, HalfSize, 0x89ABCDEFLU);
468 ok_bool_true(CheckPattern(Buffer, 4, HalfSize / 4, 0x67, 0x45, 0x23, 0x01, 4, HalfSize / 4, 0xEF, 0xCD, 0xAB, 0x89, 1, 1, 0, 0), "CheckPattern");
469
472 _SEH2_TRY {
473 MakeBuffer(Buffer, Size, 0, 0);
474 RtlFillMemoryUlong(Buffer + 1, sizeof(ULONG), 0xAAAAAAAALU);
475 ok_bool_true(CheckBuffer(Buffer, 1, 0, sizeof(ULONG), 0xAA, Size - sizeof(ULONG) - 1, 0, 1, 0, 0), "CheckBuffer");
476
477 RtlFillMemoryUlong(NULL, 0, 0x55555555LU);
480 } _SEH2_END;
483#endif
484
485 /* RtlFillMemoryUlonglong */
486 /* TODO: this function doesn't exist in 2k3/x86? wdm.h error? */
487
488 /* RtlFillBytes */
489 MakeBuffer(Buffer, Size, 0, 0);
490 RtlFillBytes(Buffer, HalfSize, 0x55);
491 RtlFillBytes(Buffer + HalfSize, HalfSize, 0xAA);
492 ok_bool_true(CheckBuffer(Buffer, HalfSize, 0x55, HalfSize, 0xAA, 1, 0, 0), "CheckBuffer");
493 RtlFillBytes(Buffer + 3, 7, 0x88);
494 ok_bool_true(CheckBuffer(Buffer, 3, 0x55, 7, 0x88, HalfSize - 10, 0x55, HalfSize, 0xAA, 1, 0, 0), "CheckBuffer");
495
498 _SEH2_TRY {
499 RtlFillBytes(NULL, 0, 0x55);
502 } _SEH2_END;
505
506 /* RtlPrefetchMemoryNonTemporal */
508
511 _SEH2_TRY {
515 } _SEH2_END;
518
520}
static VOID MakePattern(OUT PVOID Buffer,...)
Definition: RtlMemory.c:83
static BOOLEAN CheckPattern(IN const VOID *Buffer,...)
Definition: RtlMemory.c:117
static BOOLEAN CheckBuffer(IN const VOID *Buffer,...)
Definition: RtlMemory.c:49
#define ok_eq_hex(value, expected)
Definition: apitest.h:77
#define ok_bool_false(value, desc)
Definition: apitest.h:79
#define ok_eq_uint(value, expected)
Definition: apitest.h:61
#define ok_bool_true(value, desc)
Definition: apitest.h:78
#define ok_eq_size(value, expected)
Definition: apitest.h:69
LONG NTSTATUS
Definition: precomp.h:26
_Out_ PKIRQL Irql
Definition: csq.h:179
#define NULL
Definition: types.h:112
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define HIGH_LEVEL
Definition: env_spec_w32.h:703
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
Status
Definition: gdiplustypes.h:25
#define RtlFillMemory(Dest, Length, Fill)
Definition: winternl.h:599
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define RtlEqualMemory(dst, src, len)
Definition: kdvm.h:18
#define RtlFillMemoryUlong(dst, len, val)
Definition: mkhive.h:55
VOID FASTCALL RtlPrefetchMemoryNonTemporal(IN PVOID Source, IN SIZE_T Length)
Definition: misc.c:214
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:66
#define _SEH2_END
Definition: pseh2_64.h:155
#define _SEH2_TRY
Definition: pseh2_64.h:55
#define SIZE_MAX
Definition: compat.h:66
#define STATUS_SUCCESS
Definition: shellext.h:65
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
FORCEINLINE PVOID RtlSecureZeroMemory(_Out_writes_bytes_all_(Size) PVOID Pointer, _In_ SIZE_T Size)
Definition: rtlfuncs.h:3142
#define RtlFillBytes
Definition: rtlfuncs.h:325
#define RtlZeroBytes
Definition: rtlfuncs.h:386
#define RtlCopyMemoryNonTemporal
Definition: rtlfuncs.h:296
_Must_inspect_result_ NTSYSAPI SIZE_T NTAPI RtlCompareMemoryUlong(_In_reads_bytes_(Length) PVOID Source, _In_ SIZE_T Length, _In_ ULONG Pattern)
#define RtlCopyBytes
Definition: rtlfuncs.h:285