00043 {
00044 ULONG ErrorCount;
00045 ULONG Length;
00046 ULONG
Offset;
00047 ULONG Result;
00048 ULONG TestCases;
00049
00050 fprintf(stderr,
"Testing RtlZeroMemory\n");
00051 ErrorCount = 0;
00052 TestCases = 0;
00053
00054
for (
Offset = 0;
Offset <=
MAX_OFFSET;
Offset += 1) {
00055
for (Length = 0; Length <=
MAX_LENGTH; Length += 1) {
00056
00057
FillPattern(Buffer1, BUFFER_SIZE);
00058
FillPattern(Buffer2, BUFFER_SIZE);
00059
LocalZeroMemory(&Buffer1[Offset], Length);
00060 RtlZeroMemory(&Buffer2[Offset], Length);
00061
00062 Result =
LocalCompareMemory(Buffer1, Buffer2, BUFFER_SIZE);
00063
00064 TestCases += 1;
00065
if (Result !=
BUFFER_SIZE) {
00066 ErrorCount += 1;
00067
00068 printf(
"ERROR: Offset = %d, Length = %d\n", Offset, Length);
00069 printf(
"Buffers differ starting at byte %d:\n", Result);
00070 printf(
"Buffer1 = <%*s>\n", BUFFER_SIZE, Buffer1);
00071 printf(
"Buffer2 = <%*s>\n", BUFFER_SIZE, Buffer2);
00072 printf(
"\n");
00073 }
00074 }
00075 }
00076
00077 fprintf(stderr,
"Test of RtlZeroMemory completed: ");
00078 fprintf(stderr,
"%d test cases, %d errors found.\n", TestCases, ErrorCount);
00079 }