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

tzermem.c

Go to the documentation of this file.
00001 /*++ 00002 00003 Copyright (c) 1993 Digital Equipment Corporation 00004 00005 Module Name: 00006 00007 tzermem.c 00008 00009 Abstract: 00010 00011 This module implements a test of the operation of the RtlZeroMemory 00012 function by running an exhaustive test of every case of string offset 00013 and length up to and a little beyond one 32-byte cache line. This 00014 represents several thousand test cases. It is assumed any bugs that 00015 exist will be found within this range. If only the error count summary 00016 is desired, type "tzermem > nul" instead. 00017 00018 Author: 00019 00020 Thomas Van Baak (tvb) 13-Jan-1993 00021 00022 Environment: 00023 00024 User mode. 00025 00026 Revision History: 00027 00028 --*/ 00029 00030 #include <nt.h> 00031 #include <ntrtl.h> 00032 #include <stdio.h> 00033 #include "localrtl.h" 00034 00035 #define BUFFER_SIZE (MAX_MARGIN + MAX_OFFSET + MAX_LENGTH + MAX_MARGIN) 00036 00037 UCHAR Buffer1[BUFFER_SIZE]; 00038 UCHAR Buffer2[BUFFER_SIZE]; 00039 00040 void 00041 __cdecl 00042 main() 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 }

Generated on Sat May 15 19:42:10 2004 for test by doxygen 1.3.7