00057 {
00058 ULONG ErrorCount;
00059 ULONG Length;
00060 ULONG
Offset;
00061 LONG Overlap;
00062 ULONG Result;
00063 ULONG Source;
00064 ULONG Target;
00065 ULONG TestCases;
00066
00067 fprintf(stderr,
"Testing RtlMoveMemory\n");
00068 ErrorCount = 0;
00069 TestCases = 0;
00070
00071
00072
00073
00074
00075
00076
00077
00078
for (
Offset = 0;
Offset <=
MAX_OFFSET;
Offset += 1) {
00079
for (Length = 0; Length <=
MAX_LENGTH; Length += 1) {
00080
for (Overlap =
MIN_OVERLAP; Overlap <=
MAX_OVERLAP; Overlap += 1) {
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
FillPattern(Buffer1, BUFFER_SIZE);
00091
FillPattern(Buffer2, BUFFER_SIZE);
00092
00093 Source =
MAX_MARGIN +
MAX_LENGTH +
MAX_MARGIN +
Offset;
00094 Target = Source + Overlap;
00095
00096
LocalMoveMemory(&Buffer1[Target], &Buffer1[Source], Length);
00097 RtlMoveMemory(&Buffer2[Target], &Buffer2[Source], Length);
00098
00099 Result =
LocalCompareMemory(Buffer1, Buffer2, BUFFER_SIZE);
00100
00101 TestCases += 1;
00102
if (Result !=
BUFFER_SIZE) {
00103 ErrorCount += 1;
00104
00105 printf(
"ERROR: Offset = %d, Length = %d, Overlap = %d\n",
00106 Offset, Length, Overlap);
00107 printf(
"RtlMoveMemory( &Buffer[ %d ], &Buffer[ %d ], %d )\n",
00108 Target, Source, Length);
00109
00110
FillPattern(Buffer0, BUFFER_SIZE);
00111 printf(
" Original Source = %lx: <%.*s>\n",
00112 &Buffer0[Source], Length, &Buffer0[Source]);
00113 printf(
" Expected Target = %lx: <%.*s>\n",
00114 &Buffer1[Target], Length, &Buffer1[Target]);
00115 printf(
" Actual Target = %lx: <%.*s>\n",
00116 &Buffer2[Target], Length, &Buffer2[Target]);
00117 printf(
"\n");
00118 printf(
"Buffers differ starting at byte %d:\n", Result);
00119 printf(
"Buffer1 = <%*s>\n", BUFFER_SIZE, Buffer1);
00120 printf(
"Buffer2 = <%*s>\n", BUFFER_SIZE, Buffer2);
00121 printf(
"\n");
00122 }
00123 }
00124 }
00125 }
00126
00127 fprintf(stderr,
"Test of RtlMoveMemory completed: ");
00128 fprintf(stderr,
"%d test cases, %d errors found.\n", TestCases, ErrorCount);
00129 }