Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

tcmpmem.c File Reference

#include <nt.h>
#include <ntrtl.h>
#include <stdio.h>
#include "localrtl.h"

Go to the source code of this file.

Defines

#define BUFFER_SIZE   (MAX_OFFSET + MAX_LENGTH)

Functions

void __cdecl main ()

Variables

UCHAR String1 [BUFFER_SIZE]
UCHAR String2 [BUFFER_SIZE]


Define Documentation

#define BUFFER_SIZE   (MAX_OFFSET + MAX_LENGTH)
 

Definition at line 35 of file tcmpmem.c.

Referenced by CookedReadWaitRoutine(), DisplaySecurityContext(), main(), RawReadWaitRoutine(), ReadConsoleA(), ReadConsoleInternal(), ReadConsoleW(), SrvReadConsole(), and WriteConsoleInternal().


Function Documentation

void __cdecl main  ) 
 

Definition at line 42 of file tcmpmem.c.

References FillPattern(), MAX_LENGTH, MAX_OFFSET, String1, and String2.

00043 { 00044 ULONG ErrorCount; 00045 ULONG Expected; 00046 ULONG Length; 00047 ULONG Offset1; 00048 ULONG Offset2; 00049 ULONG Result; 00050 ULONG TestCases; 00051 00052 fprintf(stderr, "Testing RtlCompareMemory\n"); 00053 ErrorCount = 0; 00054 TestCases = 0; 00055 00056 for (Offset1 = 0; Offset1 <= MAX_OFFSET; Offset1 += 1) { 00057 00058 // 00059 // Copy the test pattern to Offset1 in String1 and then for each 00060 // possible offset of String1, for each possible offset of String2, 00061 // for each possible string compare length, and for each expected 00062 // return value, make a call RtlCompareMemory. 00063 // 00064 00065 FillPattern(&String1[Offset1], MAX_LENGTH); 00066 for (Offset2 = 0; Offset2 <= MAX_OFFSET; Offset2 += 1) { 00067 for (Length = 0; Length <= MAX_LENGTH; Length += 1) { 00068 for (Expected = 0; Expected <= Length; Expected += 1) { 00069 00070 // 00071 // Copy the test pattern starting at Offset2 in String2, 00072 // change one byte at location `Expected', call 00073 // RtlCompareMemory, and check that the function value 00074 // is in fact the expected value. 00075 // 00076 00077 FillPattern(&String2[Offset2], MAX_LENGTH); 00078 String2[Offset2 + Expected] = ' '; 00079 Result = RtlCompareMemory(&String1[Offset1], 00080 &String2[Offset2], 00081 Length); 00082 TestCases += 1; 00083 if (Result != Expected) { 00084 ErrorCount += 1; 00085 00086 // 00087 // The function failed to return the proper value. 00088 // 00089 00090 printf("ERROR: Offset1 = %d, Offset2 = %d, Length = %d, Expected = %d, Result = %d\n", 00091 Offset1, Offset2, Length, Expected, Result); 00092 printf(" String1[Offset1] = %lx: <%.*s>\n", 00093 &String1[Offset1], Length, &String1[Offset1]); 00094 printf(" String2[Offset2] = %lx: <%.*s>\n", 00095 &String2[Offset2], Length, &String2[Offset2]); 00096 printf("\n"); 00097 } 00098 } 00099 } 00100 } 00101 } 00102 00103 fprintf(stderr, "Test of RtlCompareMemory completed: "); 00104 fprintf(stderr, "%d test cases, %d errors found.\n", TestCases, ErrorCount); 00105 }


Variable Documentation

UCHAR String1[BUFFER_SIZE]
 

Definition at line 37 of file tcmpmem.c.

Referenced by DoTest(), IopConcatenateUnicodeStrings(), main(), MyStringCompareW(), RtlCompareString(), RtlCompareUnicodeString(), RtlEqualComputerName(), RtlEqualDomainName(), RtlEqualString(), RtlEqualUnicodeString(), RtlPrefixString(), RtlPrefixUnicodeString(), RtlpVerCompare(), StringCompare(), StringEqual(), and TestString().

UCHAR String2[BUFFER_SIZE]
 

Definition at line 38 of file tcmpmem.c.

Referenced by IopConcatenateUnicodeStrings(), main(), MyStringCompareW(), RtlCompareString(), RtlCompareUnicodeString(), RtlEqualComputerName(), RtlEqualDomainName(), RtlEqualString(), RtlEqualUnicodeString(), RtlPrefixString(), RtlPrefixUnicodeString(), RtlpVerCompare(), StringCompare(), StringEqual(), and TestString().


Generated on Sat May 15 19:45:44 2004 for test by doxygen 1.3.7