test: tex.c File Reference

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

# tex.c File Reference

`#include "exp.h"`
`#include <version.h>`
`#include <string.h>`

Go to the source code of this file.

## Defines

#define | DumpPool(x, y)
#define | HANDLE_TEST_SIZE 30

## Functions

BOOLEAN | ExTest (VOID)
BOOLEAN | DoEventTest ()
BOOLEAN | DoExceptionTest ()
BOOLEAN | DoMutantTest ()
BOOLEAN | DoSemaphoreTest ()
VOID | TimerApcRoutine (IN PVOID TimerContext, IN ULONG TimerLowValue, IN LONG TimerHighValue)
BOOLEAN | DoTimerTest ()
BOOLEAN | TestDupHandle1 (IN PVOID HandleTableEntry)
BOOLEAN | TestDupHandle4 (IN PVOID HandleTableEntry)
BOOLEAN | TestEnumHandle1 (IN PVOID HandleTableEntry, IN PVOID EnumParameter)
BOOLEAN | TestEnumHandle4 (IN PVOID HandleTableEntry, IN PVOID EnumParameter)
BOOLEAN | DoHandleTest (void)
BOOLEAN | DoInfoTest (void)
BOOLEAN | DoLuidTest (void)
BOOLEAN | DoMemoryTest (void)
BOOLEAN | DoPartyTest (void)
BOOLEAN | DoPoolTest (void)
BOOLEAN | DoZoneTest (void)
PVOID | ExDumpResource (IN PERESOURCE Resource)
VOID | Reader (IN PVOID StartContext)
VOID | Writer (IN PVOID StartContext)
VOID | ReaderTurnedWriter (IN PVOID StartContext)
BOOLEAN | DoResourceTest (void)
BOOLEAN | DoBitMapTest (void)
int _CDECL | main (int argc, char *argv[])
void | oops ()

## Variables

PTESTFCN | TestFunction = ExTest
USHORT | TestEvent = 0
USHORT | TestHandle = 0
USHORT | TestInfo = 0
USHORT | TestLuid = 0
USHORT | TestMemory = 0
USHORT | TestParty = 0
USHORT | TestPool = 0
USHORT | TestResource = 0
USHORT | TestBitMap = 0
USHORT | TestSemaphore = 0
USHORT | TestTimer = 0
USHORT | TestZone = 0
USHORT | TestMutant = 0
USHORT | TestException = 0
char | MemoryTestBuffer1 [128]
char | TestString1 [] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
char | TestString2 [] = "123456789012345678901234567890123456789012345678901234567890"
char | MemoryTestBuffer2 [128]
ERESOURCE | Resource
ULONG | ResourceCount
KSEMAPHORE | ResourceSemaphore

## Define Documentation

#define DumpPool | ( | x,
|  | y |  | ) |

| Definition at line 26 of file tex.c. Referenced by DoPoolTest().

#define HANDLE_TEST_SIZE 30

| Definition at line 1157 of file tex.c. Referenced by DoHandleTest().

## Function Documentation

BOOLEAN DoBitMapTest | ( | void |  | ) |

Definition at line 1781 of file tex.c.

References BitMap, DbgPrint, ExAllocatePool, FALSE, NonPagedPool, RtlClearAllBits(), RtlClearBits(), RtlFindClearBitsAndSet(), RtlFindSetBitsAndClear(), RtlInitializeBitMap(), RtlSetAllBits(), RtlSetBits(), Size, and TRUE.

Referenced by ExTest().

    01782 {
    01783     ULONG Size;
    01784     PRTL_BITMAP BitMap;
    01785
    01786     DbgPrint("Start DoBitMapTest...\n");
    01787
    01788     //
    01789     //  First create a new bitmap
    01790     //
    01791
    01792     Size = sizeof(RTL_BITMAP) + (((2048*8 + 31) / 32) * 4);
    01793     BitMap = (PRTL_BITMAP)(ExAllocatePool( NonPagedPool, Size ));
    01794     RtlInitializeBitMap( BitMap, (PULONG)(BitMap+1), 2048*8 );
    01795
    01796     //
    01797     //  >>>> Test setting bits
    01798     //
    01799
    01800     //
    01801     //  Now clear all bits
    01802     //
    01803
    01804     RtlClearAllBits( BitMap );
    01805
    01806     //
    01807     //  Now set some bit patterns, and test them
    01808     //
    01809
    01810     RtlSetBits( BitMap,   0,  1 );
    01811     RtlSetBits( BitMap,  63,  1 );
    01812     RtlSetBits( BitMap,  65, 30 );
    01813     RtlSetBits( BitMap, 127,  2 );
    01814     RtlSetBits( BitMap, 191, 34 );
    01815
    01816     if ((BitMap->Buffer[0] != 0x00000001) ||
    01817         (BitMap->Buffer[1] != 0x80000000) ||
    01818         (BitMap->Buffer[2] != 0x7ffffffe) ||
    01819         (BitMap->Buffer[3] != 0x80000000) ||
    01820         (BitMap->Buffer[4] != 0x00000001) ||
    01821         (BitMap->Buffer[5] != 0x80000000) ||
    01822         (BitMap->Buffer[6] != 0xffffffff) ||
    01823         (BitMap->Buffer[7] != 0x00000001)) {
    01824
    01825         DbgPrint("RtlSetBits Error\n");
    01826         return FALSE;
    01827     }
    01828
    01829     //
    01830     //  Now test some RtlFindClearBitsAndSet
    01831     //
    01832
    01833     RtlSetAllBits( BitMap );
    01834
    01835     RtlClearBits( BitMap, 0 +  10*32,  1 );
    01836     RtlClearBits( BitMap, 5 +  11*32,  1 );
    01837     RtlClearBits( BitMap, 7 +  12*32,  1 );
    01838
    01839     RtlClearBits( BitMap, 0 +  13*32,  9 );
    01840     RtlClearBits( BitMap, 4 +  14*32,  9 );
    01841     RtlClearBits( BitMap, 7 +  15*32,  9 );
    01842
    01843     RtlClearBits( BitMap, 0 +  16*32, 10 );
    01844     RtlClearBits( BitMap, 4 +  17*32, 10 );
    01845     RtlClearBits( BitMap, 6 +  18*32, 10 );
    01846     RtlClearBits( BitMap, 7 +  19*32, 10 );
    01847
    01848     RtlClearBits( BitMap, 0 + 110*32, 14 );
    01849     RtlClearBits( BitMap, 1 + 111*32, 14 );
    01850     RtlClearBits( BitMap, 2 + 112*32, 14 );
    01851
    01852     RtlClearBits( BitMap, 0 + 113*32, 15 );
    01853     RtlClearBits( BitMap, 1 + 114*32, 15 );
    01854     RtlClearBits( BitMap, 2 + 115*32, 15 );
    01855
    01856 //    {
    01857 //        ULONG i;
    01858 //        for (i = 0; i < 16; i++) {
    01859 //            DbgPrint("%2d: %08lx\n", i, BitMap->Buffer[i]);
    01860 //        }
    01861 //    }
    01862
    01863     if (RtlFindClearBitsAndSet( BitMap, 15, 0) != 0 + 113*32) {
    01864         DbgPrint("RtlFindClearBitsAndSet Error  0 + 113*32\n");
    01865         return FALSE;
    01866     }
    01867     if (RtlFindClearBitsAndSet( BitMap, 15, 0) != 1 + 114*32) {
    01868         DbgPrint("RtlFindClearBitsAndSet Error  1 + 114*32\n");
    01869         return FALSE;
    01870     }
    01871     if (RtlFindClearBitsAndSet( BitMap, 15, 0) != 2 + 115*32) {
    01872         DbgPrint("RtlFindClearBitsAndSet Error  2 + 115*32\n");
    01873         return FALSE;
    01874     }
    01875
    01876     if (RtlFindClearBitsAndSet( BitMap, 14, 0) != 0 + 110*32) {
    01877         DbgPrint("RtlFindClearBitsAndSet Error  0 + 110*32\n");
    01878         return FALSE;
    01879     }
    01880     if (RtlFindClearBitsAndSet( BitMap, 14, 0) != 1 + 111*32) {
    01881         DbgPrint("RtlFindClearBitsAndSet Error  1 + 111*32\n");
    01882         return FALSE;
    01883     }
    01884     if (RtlFindClearBitsAndSet( BitMap, 14, 0) != 2 + 112*32) {
    01885         DbgPrint("RtlFindClearBitsAndSet Error  2 + 112*32\n");
    01886         return FALSE;
    01887     }
    01888
    01889     if (RtlFindClearBitsAndSet( BitMap, 10, 0) != 0 + 16*32) {
    01890         DbgPrint("RtlFindClearBitsAndSet Error  0 + 16*32\n");
    01891         return FALSE;
    01892     }
    01893     if (RtlFindClearBitsAndSet( BitMap, 10, 0) != 4 + 17*32) {
    01894         DbgPrint("RtlFindClearBitsAndSet Error  4 + 17*32\n");
    01895         return FALSE;
    01896     }
    01897     if (RtlFindClearBitsAndSet( BitMap, 10, 0) != 6 + 18*32) {
    01898         DbgPrint("RtlFindClearBitsAndSet Error  6 + 18*32\n");
    01899         return FALSE;
    01900     }
    01901     if (RtlFindClearBitsAndSet( BitMap, 10, 0) != 7 + 19*32) {
    01902         DbgPrint("RtlFindClearBitsAndSet Error  7 + 19*32\n");
    01903         return FALSE;
    01904     }
    01905
    01906     if (RtlFindClearBitsAndSet( BitMap, 9, 0) != 0 + 13*32) {
    01907         DbgPrint("RtlFindClearBitsAndSet Error 0 + 13*32\n");
    01908         return FALSE;
    01909     }
    01910     if (RtlFindClearBitsAndSet( BitMap, 9, 0) != 4 + 14*32) {
    01911         DbgPrint("RtlFindClearBitsAndSet Error 4 + 14*32\n");
    01912         return FALSE;
    01913     }
    01914     if (RtlFindClearBitsAndSet( BitMap, 9, 0) != 7 + 15*32) {
    01915         DbgPrint("RtlFindClearBitsAndSet Error 7 + 15*32\n");
    01916         return FALSE;
    01917     }
    01918
    01919     if (RtlFindClearBitsAndSet( BitMap, 1, 0) != 0 + 10*32) {
    01920         DbgPrint("RtlFindClearBitsAndSet Error 0 + 10*32\n");
    01921         return FALSE;
    01922     }
    01923     if (RtlFindClearBitsAndSet( BitMap, 1, 0) != 5 + 11*32) {
    01924         DbgPrint("RtlFindClearBitsAndSet Error 5 + 11*32\n");
    01925         return FALSE;
    01926     }
    01927     if (RtlFindClearBitsAndSet( BitMap, 1, 0) != 7 + 12*32) {
    01928         DbgPrint("RtlFindClearBitsAndSet Error 7 + 12*32\n");
    01929         return FALSE;
    01930     }
    01931
    01932     //
    01933     //  Now test some RtlFindClearBitsAndSet
    01934     //
    01935
    01936     RtlSetAllBits( BitMap );
    01937
    01938     RtlClearBits( BitMap, 0 +  0*32,  1 );
    01939     RtlClearBits( BitMap, 5 +  1*32,  1 );
    01940     RtlClearBits( BitMap, 7 +  2*32,  1 );
    01941
    01942     RtlClearBits( BitMap, 0 +  3*32,  9 );
    01943     RtlClearBits( BitMap, 4 +  4*32,  9 );
    01944     RtlClearBits( BitMap, 7 +  5*32,  9 );
    01945
    01946     RtlClearBits( BitMap, 0 +  6*32, 10 );
    01947     RtlClearBits( BitMap, 4 +  7*32, 10 );
    01948     RtlClearBits( BitMap, 6 +  8*32, 10 );
    01949     RtlClearBits( BitMap, 7 +  9*32, 10 );
    01950
    01951     RtlClearBits( BitMap, 0 + 10*32, 14 );
    01952     RtlClearBits( BitMap, 1 + 11*32, 14 );
    01953     RtlClearBits( BitMap, 2 + 12*32, 14 );
    01954
    01955     RtlClearBits( BitMap, 0 + 13*32, 15 );
    01956     RtlClearBits( BitMap, 1 + 14*32, 15 );
    01957     RtlClearBits( BitMap, 2 + 15*32, 15 );
    01958
    01959 //    {
    01960 //        ULONG i;
    01961 //        for (i = 0; i < 16; i++) {
    01962 //            DbgPrint("%2d: %08lx\n", i, BitMap->Buffer[i]);
    01963 //        }
    01964 //    }
    01965
    01966     if (RtlFindClearBitsAndSet( BitMap, 15, 0) != 0 + 13*32) {
    01967         DbgPrint("RtlFindClearBitsAndSet Error  0 + 13*32\n");
    01968         return FALSE;
    01969     }
    01970     if (RtlFindClearBitsAndSet( BitMap, 15, 0) != 1 + 14*32) {
    01971         DbgPrint("RtlFindClearBitsAndSet Error  1 + 14*32\n");
    01972         return FALSE;
    01973     }
    01974     if (RtlFindClearBitsAndSet( BitMap, 15, 0) != 2 + 15*32) {
    01975         DbgPrint("RtlFindClearBitsAndSet Error  2 + 15*32\n");
    01976         return FALSE;
    01977     }
    01978
    01979     if (RtlFindClearBitsAndSet( BitMap, 14, 0) != 0 + 10*32) {
    01980         DbgPrint("RtlFindClearBitsAndSet Error  0 + 10*32\n");
    01981         return FALSE;
    01982     }
    01983     if (RtlFindClearBitsAndSet( BitMap, 14, 0) != 1 + 11*32) {
    01984         DbgPrint("RtlFindClearBitsAndSet Error  1 + 11*32\n");
    01985         return FALSE;
    01986     }
    01987     if (RtlFindClearBitsAndSet( BitMap, 14, 0) != 2 + 12*32) {
    01988         DbgPrint("RtlFindClearBitsAndSet Error  2 + 12*32\n");
    01989         return FALSE;
    01990     }
    01991
    01992     if (RtlFindClearBitsAndSet( BitMap, 10, 0) != 0 + 6*32) {
    01993         DbgPrint("RtlFindClearBitsAndSet Error  0 + 6*32\n");
    01994         return FALSE;
    01995     }
    01996     if (RtlFindClearBitsAndSet( BitMap, 10, 0) != 4 + 7*32) {
    01997         DbgPrint("RtlFindClearBitsAndSet Error  4 + 7*32\n");
    01998         return FALSE;
    01999     }
    02000     if (RtlFindClearBitsAndSet( BitMap, 10, 0) != 6 + 8*32) {
    02001         DbgPrint("RtlFindClearBitsAndSet Error  6 + 8*32\n");
    02002         return FALSE;
    02003     }
    02004     if (RtlFindClearBitsAndSet( BitMap, 10, 0) != 7 + 9*32) {
    02005         DbgPrint("RtlFindClearBitsAndSet Error  7 + 9*32\n");
    02006         return FALSE;
    02007     }
    02008
    02009     if (RtlFindClearBitsAndSet( BitMap, 9, 0) != 0 + 3*32) {
    02010         DbgPrint("RtlFindClearBitsAndSet Error 0 + 3*32\n");
    02011         return FALSE;
    02012     }
    02013     if (RtlFindClearBitsAndSet( BitMap, 9, 0) != 4 + 4*32) {
    02014         DbgPrint("RtlFindClearBitsAndSet Error 4 + 4*32\n");
    02015         return FALSE;
    02016     }
    02017     if (RtlFindClearBitsAndSet( BitMap, 9, 0) != 7 + 5*32) {
    02018         DbgPrint("RtlFindClearBitsAndSet Error 7 + 5*32\n");
    02019         return FALSE;
    02020     }
    02021
    02022     if (RtlFindClearBitsAndSet( BitMap, 1, 0) != 0 + 0*32) {
    02023         DbgPrint("RtlFindClearBitsAndSet Error 0 + 0*32\n");
    02024         return FALSE;
    02025     }
    02026     if (RtlFindClearBitsAndSet( BitMap, 1, 0) != 5 + 1*32) {
    02027         DbgPrint("RtlFindClearBitsAndSet Error 5 + 1*32\n");
    02028         return FALSE;
    02029     }
    02030     if (RtlFindClearBitsAndSet( BitMap, 1, 0) != 7 + 2*32) {
    02031         DbgPrint("RtlFindClearBitsAndSet Error 7 + 2*32\n");
    02032         return FALSE;
    02033     }
    02034
    02035     //
    02036     //  >>>> Test clearing bits
    02037     //
    02038
    02039     //
    02040     //  Now clear all bits
    02041     //
    02042
    02043     RtlSetAllBits( BitMap );
    02044
    02045     //
    02046     //  Now set some bit patterns, and test them
    02047     //
    02048
    02049     RtlClearBits( BitMap,   0,  1 );
    02050     RtlClearBits( BitMap,  63,  1 );
    02051     RtlClearBits( BitMap,  65, 30 );
    02052     RtlClearBits( BitMap, 127,  2 );
    02053     RtlClearBits( BitMap, 191, 34 );
    02054
    02055     if ((BitMap->Buffer[0] != ~0x00000001) ||
    02056         (BitMap->Buffer[1] != ~0x80000000) ||
    02057         (BitMap->Buffer[2] != ~0x7ffffffe) ||
    02058         (BitMap->Buffer[3] != ~0x80000000) ||
    02059         (BitMap->Buffer[4] != ~0x00000001) ||
    02060         (BitMap->Buffer[5] != ~0x80000000) ||
    02061         (BitMap->Buffer[6] != ~0xffffffff) ||
    02062         (BitMap->Buffer[7] != ~0x00000001)) {
    02063
    02064         DbgPrint("RtlClearBits Error\n");
    02065         return FALSE;
    02066     }
    02067
    02068     //
    02069     //  Now test some RtlFindSetBitsAndClear
    02070     //
    02071
    02072     RtlClearAllBits( BitMap );
    02073
    02074     RtlSetBits( BitMap, 0 +  0*32,  1 );
    02075     RtlSetBits( BitMap, 5 +  1*32,  1 );
    02076     RtlSetBits( BitMap, 7 +  2*32,  1 );
    02077
    02078     RtlSetBits( BitMap, 0 +  3*32,  9 );
    02079     RtlSetBits( BitMap, 4 +  4*32,  9 );
    02080     RtlSetBits( BitMap, 7 +  5*32,  9 );
    02081
    02082     RtlSetBits( BitMap, 0 +  6*32, 10 );
    02083     RtlSetBits( BitMap, 4 +  7*32, 10 );
    02084     RtlSetBits( BitMap, 6 +  8*32, 10 );
    02085     RtlSetBits( BitMap, 7 +  9*32, 10 );
    02086
    02087     RtlSetBits( BitMap, 0 + 10*32, 14 );
    02088     RtlSetBits( BitMap, 1 + 11*32, 14 );
    02089     RtlSetBits( BitMap, 2 + 12*32, 14 );
    02090
    02091     RtlSetBits( BitMap, 0 + 13*32, 15 );
    02092     RtlSetBits( BitMap, 1 + 14*32, 15 );
    02093     RtlSetBits( BitMap, 2 + 15*32, 15 );
    02094
    02095     {
    02096         ULONG i;
    02097         for (i = 0; i < 16; i++) {
    02098             DbgPrint("%2d: %08lx\n", i, BitMap->Buffer[i]);
    02099         }
    02100     }
    02101
    02102     if (RtlFindSetBitsAndClear( BitMap, 15, 0) != 0 + 13*32) {
    02103         DbgPrint("RtlFindSetBitsAndClear Error  0 + 13*32\n");
    02104         return FALSE;
    02105     }
    02106     if (RtlFindSetBitsAndClear( BitMap, 15, 0) != 1 + 14*32) {
    02107         DbgPrint("RtlFindSetBitsAndClear Error  1 + 14*32\n");
    02108         return FALSE;
    02109     }
    02110     if (RtlFindSetBitsAndClear( BitMap, 15, 0) != 2 + 15*32) {
    02111         DbgPrint("RtlFindSetBitsAndClear Error  2 + 15*32\n");
    02112         return FALSE;
    02113     }
    02114
    02115     if (RtlFindSetBitsAndClear( BitMap, 14, 0) != 0 + 10*32) {
    02116         DbgPrint("RtlFindSetBitsAndClear Error  0 + 10*32\n");
    02117         return FALSE;
    02118     }
    02119     if (RtlFindSetBitsAndClear( BitMap, 14, 0) != 1 + 11*32) {
    02120         DbgPrint("RtlFindSetBitsAndClear Error  1 + 11*32\n");
    02121         return FALSE;
    02122     }
    02123     if (RtlFindSetBitsAndClear( BitMap, 14, 0) != 2 + 12*32) {
    02124         DbgPrint("RtlFindSetBitsAndClear Error  2 + 12*32\n");
    02125         return FALSE;
    02126     }
    02127
    02128     if (RtlFindSetBitsAndClear( BitMap, 10, 0) != 0 + 6*32) {
    02129         DbgPrint("RtlFindSetBitsAndClear Error  0 + 6*32\n");
    02130         return FALSE;
    02131     }
    02132     if (RtlFindSetBitsAndClear( BitMap, 10, 0) != 4 + 7*32) {
    02133         DbgPrint("RtlFindSetBitsAndClear Error  4 + 7*32\n");
    02134         return FALSE;
    02135     }
    02136     if (RtlFindSetBitsAndClear( BitMap, 10, 0) != 6 + 8*32) {
    02137         DbgPrint("RtlFindSetBitsAndClear Error  6 + 8*32\n");
    02138         return FALSE;
    02139     }
    02140     if (RtlFindSetBitsAndClear( BitMap, 10, 0) != 7 + 9*32) {
    02141         DbgPrint("RtlFindSetBitsAndClear Error  7 + 9*32\n");
    02142         return FALSE;
    02143     }
    02144
    02145     if (RtlFindSetBitsAndClear( BitMap, 9, 0) != 0 + 3*32) {
    02146         DbgPrint("RtlFindSetBitsAndClear Error 0 + 3*32\n");
    02147         return FALSE;
    02148     }
    02149     if (RtlFindSetBitsAndClear( BitMap, 9, 0) != 4 + 4*32) {
    02150         DbgPrint("RtlFindSetBitsAndClear Error 4 + 4*32\n");
    02151         return FALSE;
    02152     }
    02153     if (RtlFindSetBitsAndClear( BitMap, 9, 0) != 7 + 5*32) {
    02154         DbgPrint("RtlFindSetBitsAndClear Error 7 + 5*32\n");
    02155         return FALSE;
    02156     }
    02157
    02158     if (RtlFindSetBitsAndClear( BitMap, 1, 0) != 0 + 0*32) {
    02159         DbgPrint("RtlFindSetBitsAndClear Error 0 + 0*32\n");
    02160         return FALSE;
    02161     }
    02162     if (RtlFindSetBitsAndClear( BitMap, 1, 0) != 5 + 1*32) {
    02163         DbgPrint("RtlFindSetBitsAndClear Error 5 + 1*32\n");
    02164         return FALSE;
    02165     }
    02166     if (RtlFindSetBitsAndClear( BitMap, 1, 0) != 7 + 2*32) {
    02167         DbgPrint("RtlFindSetBitsAndClear Error 7 + 2*32\n");
    02168         return FALSE;
    02169     }
    02170
    02171     DbgPrint("DoBitMapTest Done.\n");
    02172
    02173     return TRUE;
    02174 }

BOOLEAN DoEventTest | ( |  | ) |

Definition at line 72 of file tex.c.

References DbgPrint, FALSE, L, NtClose(), NTSTATUS(), NULL, RtlInitUnicodeString(), Status, and TRUE.

Referenced by ExTest().

    00074 {
    00075     ULONG DesiredAccess = EVENT_ALL_ACCESS;
    00076     EVENT_BASIC_INFORMATION EventInformation;
    00077     HANDLE Handle1;
    00078     HANDLE Handle1c;
    00079     HANDLE Handle2;
    00080     HANDLE Handle2c;
    00081     ULONG Length;
    00082     UNICODE_STRING Name1;
    00083     UNICODE_STRING Name2;
    00084     OBJECT_ATTRIBUTES Object1Attributes;
    00085     OBJECT_ATTRIBUTES Object2Attributes;
    00086     LONG State;
    00087     NTSTATUS Status;
    00088
    00089     //
    00090     // Announce start of event test.
    00091     //
    00092
    00093     DbgPrint(" ** Start of Event Test **\n");
    00094
    00095     //
    00096     // Initialize strings and fill in object attributes structures.
    00097     //
    00098
    00099     RtlInitUnicodeString(&Name1, L "\\Event1");
    00100     RtlInitUnicodeString(&Name2, L "\\Event2");
    00101     InitializeObjectAttributes(&Object1Attributes, &Name1, 0, NULL, NULL);
    00102     InitializeObjectAttributes(&Object2Attributes, &Name2, 0, NULL, NULL);
    00103
    00104     //
    00105     // Create event 1.
    00106     //
    00107
    00108     Status = ZwCreateEvent(&Handle1c, DesiredAccess, &Object1Attributes,
    00109                            NotificationEvent, TRUE);
    00110     if (Status < 0) {
    00111         DbgPrint(" Event test - create event 1 failed, status = %lx\n", Status);
    00112     }
    00113
    00114     //
    00115     // Open event 1.
    00116     //
    00117
    00118     Status = ZwOpenEvent(&Handle1, DesiredAccess, &Object1Attributes);
    00119     if (Status < 0) {
    00120         DbgPrint(" Event test - open event 1 failed, status = %lx\n", Status);
    00121     }
    00122
    00123     //
    00124     // Query event 1.
    00125     //
    00126
    00127     EventInformation.EventState = 0;
    00128     Length = 0;
    00129     Status = ZwQueryEvent(Handle1, EventBasicInformation,
    00130                           (PVOID)&EventInformation, sizeof(EVENT_BASIC_INFORMATION),
    00131                           &Length);
    00132     if (Status < 0) {
    00133         DbgPrint(" Event test - query event 1 failed, status = %lx\n", Status);
    00134     }
    00135     if (EventInformation.EventType != NotificationEvent) {
    00136         DbgPrint(" Event test - query event 1 wrong event type\n");
    00137     }
    00138     if (EventInformation.EventState == 0) {
    00139         DbgPrint(" Event test - query event 1 current state wrong\n");
    00140     }
    00141     if (Length != sizeof(EVENT_BASIC_INFORMATION)) {
    00142         DbgPrint(" Event test - query event 1 return length wrong\n");
    00143     }
    00144
    00145     //
    00146     // Pulse event 1.
    00147     //
    00148
    00149     State = 0;
    00150     Status = ZwPulseEvent(Handle1, &State);
    00151     if (Status < 0) {
    00152         DbgPrint(" Event test - pulse event 1 failed, status = %lx\n", Status);
    00153     }
    00154     if (State == 0) {
    00155         DbgPrint(" Event test - pulse event 1 previous state wrong\n");
    00156     }
    00157
    00158     //
    00159     // Set event 1.
    00160     //
    00161
    00162     State = 1;
    00163     Status = ZwSetEvent(Handle1, &State);
    00164     if (Status < 0) {
    00165         DbgPrint(" Event test - set event 1 failed, status = %lx\n", Status);
    00166     }
    00167     if (State == 1) {
    00168         DbgPrint(" Event test - set event 1 previous state wrong\n");
    00169     }
    00170
    00171     //
    00172     // Wait on event 1.
    00173     //
    00174
    00175     Status = ZwWaitForSingleObject(Handle1, FALSE, NULL);
    00176     if (Status < 0) {
    00177         DbgPrint(" Event test - wait event 1 failed\n");
    00178     }
    00179
    00180     //
    00181     // Reset event 1.
    00182     //
    00183
    00184     State = 0;
    00185     Status = ZwResetEvent(Handle1, &State);
    00186     if (Status < 0) {
    00187         DbgPrint(" Event test - reset event 1 failed, status = %lx\n", Status);
    00188     }
    00189     if (State == 0) {
    00190         DbgPrint(" Event test - reset event 1 previous state wrong\n");
    00191     }
    00192
    00193     //
    00194     // Create event 2.
    00195     //
    00196
    00197     Status = ZwCreateEvent(&Handle2c, DesiredAccess, &Object2Attributes,
    00198                            NotificationEvent, FALSE);
    00199     if (Status < 0) {
    00200         DbgPrint(" Event test - create event 2 failed, status = %lx\n", Status);
    00201     }
    00202
    00203     //
    00204     // Open event 2.
    00205     //
    00206
    00207     Status = ZwOpenEvent(&Handle2, DesiredAccess, &Object2Attributes);
    00208     if (Status < 0) {
    00209         DbgPrint(" Event test - open event 2 failed, status = %lx\n", Status);
    00210     }
    00211
    00212     //
    00213     // Query event 2.
    00214     //
    00215
    00216     EventInformation.EventState = 1;
    00217     Length = 0;
    00218     Status = ZwQueryEvent(Handle2, EventBasicInformation,
    00219                           (PVOID)&EventInformation, sizeof(EVENT_BASIC_INFORMATION),
    00220                           &Length);
    00221     if (Status < 0) {
    00222         DbgPrint(" Event test - query event 2 failed, status = %lx\n", Status);
    00223     }
    00224     if (EventInformation.EventType != NotificationEvent) {
    00225         DbgPrint(" Event test - query event 2 wrong event type\n");
    00226     }
    00227     if (EventInformation.EventState == 1) {
    00228         DbgPrint(" Event test - query event 2 current state wrong\n");
    00229     }
    00230     if (Length != sizeof(EVENT_BASIC_INFORMATION)) {
    00231         DbgPrint(" Event test - query event 2 return length wrong\n");
    00232     }
    00233
    00234     //
    00235     // Pulse event 2.
    00236     //
    00237
    00238     State = 1;
    00239     Status = ZwPulseEvent(Handle2, &State);
    00240     if (Status < 0) {
    00241         DbgPrint(" Event test - pulse event 2 failed, status = %lx\n", Status);
    00242     }
    00243     if (State == 1) {
    00244         DbgPrint(" Event test - pulse event 2 previous state wrong\n");
    00245     }
    00246
    00247     //
    00248     // Set event 2.
    00249     //
    00250
    00251     State = 1;
    00252     Status = ZwSetEvent(Handle2, &State);
    00253     if (Status < 0) {
    00254         DbgPrint(" Event test - set event 2 failed, status = %lx\n", Status);
    00255     }
    00256     if (State == 1) {
    00257         DbgPrint(" Event test - set event 2 previous state wrong\n");
    00258     }
    00259
    00260     //
    00261     // Wait on event 2.
    00262     //
    00263
    00264     Status = ZwWaitForSingleObject(Handle2, FALSE, NULL);
    00265     if (Status < 0) {
    00266         DbgPrint(" Event test - wait event 2 failed\n");
    00267     }
    00268
    00269     //
    00270     // Reset event 2.
    00271     //
    00272
    00273     State = 0;
    00274     Status = ZwResetEvent(Handle2, &State);
    00275     if (Status < 0) {
    00276         DbgPrint(" Event test - reset event 2 failed, status = %lx\n", Status);
    00277     }
    00278     if (State == 0) {
    00279         DbgPrint(" Event test - reset event 2 previous state wrong\n");
    00280     }
    00281
    00282     //
    00283     // Close all handles.
    00284     //
    00285
    00286     Status = NtClose(Handle1);
    00287     if (Status < 0) {
    00288         DbgPrint(" Event test - event 1 close failed, status = %lx\n", Status);
    00289     }
    00290     Status = NtClose(Handle1c);
    00291     if (Status < 0) {
    00292         DbgPrint(" Event test - event 1c close failed, status = %lx\n", Status);
    00293     }
    00294     Status = NtClose(Handle2);
    00295     if (Status < 0) {
    00296         DbgPrint(" Event test - event 2 close failed, status = %lx\n", Status);
    00297     }
    00298     Status = NtClose(Handle2c);
    00299     if (Status < 0) {
    00300         DbgPrint(" Event test - event 2c close failed, status = %lx\n", Status);
    00301     }
    00302
    00303     //
    00304     // Announce end of event test.
    00305     //
    00306
    00307     DbgPrint(" ** End of Event Test **\n");
    00308     return TRUE;
    00309 }

BOOLEAN DoExceptionTest | ( |  | ) |

Definition at line 312 of file tex.c.

References DbgPrint, NTSTATUS(), NULL, Status, and TRUE.

Referenced by ExTest().

    00315 {
    00316 #ifndef  i386
    00317     NTSTATUS Status;
    00318
    00319     //
    00320     // Announce start of system service exception test.
    00321     //
    00322
    00323     DbgPrint(" ** Start of System Service Exception Test **\n");
    00324
    00325     //
    00326     // Eventually this should have a test case for each system service that
    00327     // has input of output arguments which are addressed by pointers. The
    00328     // intent of this test is to make sure that each service correctly
    00329     // handles access violations.
    00330     //
    00331
    00332     //
    00333     // Query system time test.
    00334     //
    00335
    00336     Status = ZwQuerySystemTime((PLARGE_INTEGER)NULL);
    00337     if (Status != STATUS_ACCESS_VIOLATION) {
    00338         DbgPrint(" Exception test - NtQuerySystemTime failed, status = %lx\n", Status);
    00339     }
    00340
    00341     //
    00342     // Set system time test.
    00343     //
    00344
    00345     Status = ZwSetSystemTime((PLARGE_INTEGER)NULL, (PLARGE_INTEGER)NULL);
    00346     if (Status != STATUS_ACCESS_VIOLATION) {
    00347         DbgPrint(" Exception test - NtSetSystemTime failed, status = %lx\n", Status);
    00348     }
    00349
    00350     //
    00351     // Announce end of system service exception test.
    00352     //
    00353
    00354     DbgPrint(" ** End of System Service Exception Test **\n");
    00355 #else
    00356     DbgPrint(" ** Skip System Service Exception Test for 386 **\n");
    00357 #endif  // i386
    00358     return TRUE;
    00359 }

BOOLEAN DoHandleTest | ( | void |  | ) |

Definition at line 1160 of file tex.c.

References DbgPrint, ExCreateHandle(), ExCreateHandleTable(), ExDestroyHandle(), ExDestroyHandleTable(), ExDupHandleTable(), ExEnumHandleTable(), ExMapHandleToPointer(), FALSE, HANDLE_TEST_SIZE, L, NULL, TestDupHandle1(), TestDupHandle4(), TestEnumHandle1(), TestEnumHandle4(), and TRUE.

Referenced by ExTest().

    01161 {
    01162     PVOID HandleTable1;
    01163     PVOID HandleTable4;
    01164     PVOID HandleTable1a;
    01165     PVOID HandleTable4a;
    01166     HANDLE HandlesForTable1[ HANDLE_TEST_SIZE ];
    01167     HANDLE HandlesForTable4[ HANDLE_TEST_SIZE ];
    01168     HANDLE h;
    01169     PULONG HandleValue;
    01170     BOOLEAN LockFlag;
    01171     ULONG i, v[4];
    01172
    01173     HandleTable1 = ExCreateHandleTable( (PEPROCESS)NULL, 0L, 0L, 0L, MUTEX_LEVEL_PS_CID_TABLE, FALSE );
    01174     HandleTable4 = ExCreateHandleTable( (PEPROCESS)NULL, 16L, 8L, 2L, MUTEX_LEVEL_OB_TABLE, TRUE );
    01175
    01176     ExDumpHandleTable( (PEPROCESS)NULL, HandleTable1, NULL );
    01177     ExDumpHandleTable( (PEPROCESS)NULL, HandleTable4, NULL );
    01178
    01179     for (i=0; i<HANDLE_TEST_SIZE; i++) {
    01180         v[0] = (i+1) << 4;
    01181         v[1] = (i+1) << 3;
    01182         v[2] = (i+1) << 2;
    01183         v[3] = (i+1) << 1;
    01184
    01185         HandlesForTable1[ i ] = ExCreateHandle( HandleTable1, (PVOID)(v[0]) );
    01186         DbgPrint( "HandleTable1: %lx => %lx\n", HandlesForTable1[ i ], v[0] );
    01187         HandlesForTable4[ i ] = ExCreateHandle( HandleTable4, (PVOID)(&v[0]) );
    01188         DbgPrint( "HandleTable4: %lx => %lx\n", HandlesForTable4[ i ], v[0] );
    01189         }
    01190
    01191     ExDumpHandleTable( HandleTable1, NULL, NULL );
    01192     ExDumpHandleTable( HandleTable4, NULL, NULL );
    01193
    01194     for (i=0; i<=HANDLE_TEST_SIZE; i++) {
    01195         v[0] = (i+1) << 4;
    01196         v[1] = (i+1) << 3;
    01197         v[2] = (i+1) << 2;
    01198         v[3] = (i+1) << 1;
    01199
    01200         if (ExEnumHandleTable( HandleTable1, TestEnumHandle1, (PVOID)(v[0]), &h )) {
    01201             DbgPrint( "HandleTable1: Found: %lx <= %lx\n", v[0], h );
    01202             }
    01203         else {
    01204             DbgPrint( "HandleTable1: %lx not found\n", v[0] );
    01205             }
    01206
    01207         if (ExEnumHandleTable( HandleTable4, TestEnumHandle4, (PVOID)(v[0]), &h )) {
    01208             DbgPrint( "HandleTable4: Found: %lx <= %lx\n", v[0], h );
    01209             }
    01210         else {
    01211             DbgPrint( "HandleTable4: %lx not found\n", v[0] );
    01212             }
    01213         }
    01214
    01215     for (i=0; i<HANDLE_TEST_SIZE; i++) {
    01216         LockFlag = ExMapHandleToPointer( HandleTable1,
    01217                                          HandlesForTable1[ i ],
    01218                                          (PVOID)&HandleValue
    01219                                        );
    01220
    01221         DbgPrint( "HandleTable1: %lx => %lx\n",
    01222                  HandlesForTable1[ i ], HandleValue
    01223                );
    01224         ExUnlockHandleTable( HandleTable1, LockFlag );
    01225
    01226         LockFlag = ExMapHandleToPointer( HandleTable4,
    01227                                          HandlesForTable4[ i ],
    01228                                          (PVOID)&HandleValue
    01229                                        );
    01230         DbgPrint( "HandleTable4: %lx => %lx\n",
    01231                  HandlesForTable4[ i ], *HandleValue
    01232                );
    01233         ExUnlockHandleTable( HandleTable4, LockFlag );
    01234         }
    01235
    01236     HandleTable1a = ExDupHandleTable( (PEPROCESS)NULL, HandleTable1, TestDupHandle1 );
    01237     HandleTable4a = ExDupHandleTable( (PEPROCESS)NULL, HandleTable4, TestDupHandle4 );
    01238
    01239     ExDumpHandleTable( HandleTable1a, NULL, NULL );
    01240     ExDumpHandleTable( HandleTable4a, NULL, NULL );
    01241
    01242     for (i=0; i<HANDLE_TEST_SIZE; i++) {
    01243         ExDestroyHandle( HandleTable1, HandlesForTable1[ i ] );
    01244         ExDestroyHandle( HandleTable4, HandlesForTable4[ i ] );
    01245         }
    01246
    01247     ExDumpHandleTable( HandleTable1, NULL, NULL );
    01248     ExDumpHandleTable( HandleTable4, NULL, NULL );
    01249
    01250     ExDestroyHandleTable( HandleTable1, NULL );
    01251     ExDestroyHandleTable( HandleTable4, NULL );
    01252
    01253     ExDestroyHandleTable( HandleTable1a, NULL );
    01254     ExDestroyHandleTable( HandleTable4a, NULL );
    01255
    01256     return( TRUE );
    01257 }

BOOLEAN DoInfoTest | ( | void |  | ) |

Definition at line 1260 of file tex.c.

References DbgPrint, FALSE, NT_SUCCESS, NTSTATUS(), and Status.

Referenced by ExTest().

    01261 {
    01262     BOOLEAN Result = FALSE;
    01263     NTSTATUS Status;
    01264     SYSTEM_BASIC_INFORMATION BasicInfo;
    01265     SYSTEM_PROCESSOR_INFORMATION ProcessorInfo;
    01266     ULONG ReturnedLength;
    01267
    01268     DbgPrint(" ** Start of System Information Test **\n");
    01269     Status = ZwQuerySystemInformation( SystemBasicInformation,
    01270                                        (PVOID)&BasicInfo,
    01271                                        sizeof( BasicInfo ),
    01272                                        &ReturnedLength
    01273                                      );
    01274     if (NT_SUCCESS( Status )) {
    01275         DbgPrint( "NtQuerySystemInformation returns:\n" );
    01276         DbgPrint( "    Number of Processors: %ld\n",
    01277                  BasicInfo.NumberOfProcessors
    01278                );
    01279         DbgPrint( "    OEM Machine Id: %lx\n",
    01280                  BasicInfo.OemMachineId
    01281                );
    01282         DbgPrint( "    Timer Resolution: %ld microseconds\n",
    01283                  BasicInfo.TimerResolutionInMicroSeconds
    01284                );
    01285         DbgPrint( "    Page Size: %ld   Allocation Granularity: %ld\n",
    01286                  BasicInfo.PageSize,
    01287                  BasicInfo.AllocationGranularity
    01288                );
    01289         DbgPrint( "    User Mode Address Range: 0x%08lx <-> 0x%08lx\n",
    01290                  BasicInfo.MinimumUserModeAddress,
    01291                  BasicInfo.MaximumUserModeAddress
    01292                );
    01293         }
    01294     else {
    01295         DbgPrint( "NtQuerySystemInformation failed.  Status == %X\n",
    01296                  Status
    01297                );
    01298         }
    01299
    01300     DbgPrint(" ** End of System Information Test **\n");
    01301     return( Result );
    01302 }

BOOLEAN DoLuidTest | ( | void |  | ) |

Definition at line 1305 of file tex.c.

References DbgPrint, FALSE, NT_SUCCESS, NTSTATUS(), Status, and TRUE.

Referenced by ExTest().

    01306 {
    01307     BOOLEAN Result = TRUE;
    01308     NTSTATUS Status;
    01309
    01310     LUID FirstLuid;
    01311     LUID SecondLuid;
    01312
    01313     FirstLuid.LowPart = 0;
    01314     FirstLuid.HighPart = 0;
    01315
    01316     SecondLuid.LowPart = 0;
    01317     SecondLuid.HighPart = 0;
    01318
    01319     DbgPrint(" ** Start of Locally Unique ID Test **\n");
    01320
    01321
    01322
    01323     Status = ZwAllocateLocallyUniqueId( &FirstLuid );
    01324
    01325     if (!NT_SUCCESS( Status )) {
    01326         DbgPrint( "First Luid Allocation Error.\n" );
    01327         Result = FALSE;
    01328     }
    01329
    01330     if (LiLeqZero( FirstLuid )) {
    01331         DbgPrint( "First Luid Allocation Failed - Bad Value.\n" );
    01332         Result = FALSE;
    01333     }
    01334
    01335
    01336
    01337     if (Result) {
    01338
    01339         Status = ZwAllocateLocallyUniqueId( &SecondLuid );
    01340
    01341         if (!NT_SUCCESS( Status )) {
    01342             DbgPrint( "Second Luid Allocation Error.\n" );
    01343             Result = FALSE;
    01344         }
    01345
    01346         if (LiLeqZero( SecondLuid )) {
    01347             DbgPrint( "Second Luid Allocation Failed - Bad Value.\n" );
    01348             Result = FALSE;
    01349         }
    01350
    01351         if (LiLeq( FirstLuid, SecondLuid )) {
    01352             DbgPrint( "Second Luid Allocation Failed - Not larger than first value.\n" );
    01353             Result = FALSE;
    01354         }
    01355
    01356     }
    01357
    01358
    01359     DbgPrint(" ** End of Locally Unique ID Test **\n");
    01360     return( Result );
    01361 }

BOOLEAN DoMemoryTest | ( | void |  | ) |

Definition at line 1369 of file tex.c.

References DbgPrint, FALSE, MemoryTestBuffer1, MemoryTestBuffer2, TestString1, TestString2, and TRUE.

Referenced by ExTest().

    01370 {
    01371     LONG i,j,k;
    01372     BOOLEAN Result;
    01373
    01374     DbgPrint(" ** Start of Memory Test **\n");
    01375
    01376     Result = TRUE;
    01377     strcpy( MemoryTestBuffer1, TestString1 );
    01378     for (i=15; i>=0; i--) {
    01379         MemoryTestBuffer1[16] = 0xFF;
    01380         RtlZeroMemory( &MemoryTestBuffer1[i], 16-i );
    01381         if (strncmp( MemoryTestBuffer1, TestString1, i ) || MemoryTestBuffer1[i] || !MemoryTestBuffer1[16]) {
    01382             DbgPrint( "*** failed *** - RtlZeroMemory( %s, %ld )\n",
    01383                      MemoryTestBuffer1, 16-i );
    01384             Result = FALSE;
    01385             }
    01386         }
    01387
    01388     for (k = 0; k < 8; k++) {
    01389         DbgPrint("k = %d, j = ",k);
    01390         for (j = 0; j < 8; j++) {
    01391             DbgPrint(" %d ",j);
    01392             for (i=0; i<26; i++) {
    01393                 RtlZeroMemory( MemoryTestBuffer1, (ULONG)sizeof( MemoryTestBuffer1 ) );
    01394                 RtlMoveMemory( &MemoryTestBuffer1[j], &TestString2[k], i );
    01395                 if (strncmp( &MemoryTestBuffer1[j], &TestString2[k], i ) || MemoryTestBuffer1[j+i]) {
    01396                     DbgPrint( "*** failed *** - RtlMoveMemory( %s, %s, %ld )\n",
    01397                              &MemoryTestBuffer1[j], TestString2, i );
    01398                     Result = FALSE;
    01399                     }
    01400                 }
    01401             }
    01402         DbgPrint("\n");
    01403         }
    01404
    01405     for (k = 0; k < 8; k++) {
    01406         DbgPrint("k = %d, j = ",k);
    01407         for (j = 0; j < 8; j++) {
    01408             DbgPrint(" %d ",j);
    01409             for (i=0; i<26; i++) {
    01410                 RtlZeroMemory( MemoryTestBuffer2, (ULONG)sizeof( MemoryTestBuffer2 ) );
    01411                 RtlMoveMemory( &MemoryTestBuffer2[j], &TestString2[k], i );
    01412                 if (strncmp( &MemoryTestBuffer2[j], &TestString2[k], i ) || MemoryTestBuffer2[j+i]) {
    01413                     DbgPrint( "*** failed *** - RtlMoveMemory( %s, %s, %ld )\n",
    01414                              &MemoryTestBuffer2[j], TestString2, i );
    01415                     Result = FALSE;
    01416                     }
    01417                 }
    01418             }
    01419         DbgPrint("\n");
    01420         }
    01421
    01422     for (k = 0; k < 8; k++) {
    01423         DbgPrint("k = %d, j = ",k);
    01424         for (j = 0; j < 8; j++) {
    01425             DbgPrint(" %d ",j);
    01426             for (i=0; i<26; i++) {
    01427                 strcpy( MemoryTestBuffer1, TestString1 );
    01428                 RtlMoveMemory( &MemoryTestBuffer1[j], &MemoryTestBuffer1[k], i );
    01429                 if (strncmp( &MemoryTestBuffer1[j], &TestString1[k], i )) {
    01430                     DbgPrint( "*** failed *** - RtlMoveMemory( %s, %s, %ld )\n",
    01431                              &MemoryTestBuffer2[j], TestString2, i );
    01432                     Result = FALSE;
    01433                     }
    01434                 }
    01435             }
    01436         DbgPrint("\n");
    01437         }
    01438
    01439     DbgPrint(" ** End of Memory Test **\n");
    01440
    01441     return( Result );
    01442 }

BOOLEAN DoMutantTest | ( |  | ) |

Definition at line 362 of file tex.c.

References Count, DbgPrint, FALSE, L, NtClose(), NTSTATUS(), NULL, RtlInitUnicodeString(), Status, and TRUE.

Referenced by ExTest().

    00364 {
    00365
    00366     LONG Count;
    00367     ULONG DesiredAccess = MUTANT_ALL_ACCESS;
    00368     HANDLE Handle1;
    00369     HANDLE Handle1c;
    00370     HANDLE Handle2;
    00371     HANDLE Handle2c;
    00372     ULONG Length;
    00373     STRING Name1;
    00374     STRING Name2;
    00375     OBJECT_ATTRIBUTES Object1Attributes;
    00376     OBJECT_ATTRIBUTES Object2Attributes;
    00377     MUTANT_BASIC_INFORMATION MutantInformation;
    00378     NTSTATUS Status;
    00379
    00380     //
    00381     // Announce start of mutant test.
    00382     //
    00383
    00384     DbgPrint(" ** Start of Mutant Test **\n");
    00385
    00386     //
    00387     // Initialize strings and fill in object attributes structures.
    00388     //
    00389
    00390     RtlInitUnicodeString(&Name1, L"\\Mutant1");
    00391     RtlInitUnicodeString(&Name2, L"\\Mutant2");
    00392     InitializeObjectAttributes(&Object1Attributes,&Name1,0,NULL,NULL);
    00393     InitializeObjectAttributes(&Object2Attributes,&Name2,0,NULL,NULL);
    00394
    00395     //
    00396     // Create mutant 1.
    00397     //
    00398
    00399     Status = ZwCreateMutant(&Handle1c, DesiredAccess, &Object1Attributes,
    00400                             FALSE);
    00401     if (Status < 0) {
    00402         DbgPrint(" Mutant test - create mutant 1 failed, status = %lx\n",
    00403                 Status);
    00404     }
    00405
    00406     //
    00407     // Open mutant 1.
    00408     //
    00409
    00410     Status = ZwOpenMutant(&Handle1, DesiredAccess, &Object1Attributes);
    00411     if (Status < 0) {
    00412         DbgPrint(" Mutant test - open mutant 1 failed, status = %lx\n",
    00413                 Status);
    00414     }
    00415
    00416     //
    00417     // Query mutant 1.
    00418     //
    00419
    00420     MutantInformation.CurrentCount = 10;
    00421     MutantInformation.AbandonedState = TRUE;
    00422     Length = 0;
    00423     Status = ZwQueryMutant(Handle1, MutantBasicInformation,
    00424                            (PVOID)&MutantInformation,
    00425                            sizeof(MUTANT_BASIC_INFORMATION), &Length);
    00426     if (Status < 0) {
    00427         DbgPrint(" Mutant test - query mutant 1 failed, status = %lx\n",
    00428                 Status);
    00429     }
    00430     if (MutantInformation.CurrentCount != 1) {
    00431         DbgPrint(" Mutant test - query mutant 1 current count wrong\n");
    00432     }
    00433     if (MutantInformation.AbandonedState != FALSE) {
    00434         DbgPrint(" Mutant test - query mutant 1 abandoned state wrong\n");
    00435     }
    00436     if (Length != sizeof(MUTANT_BASIC_INFORMATION)) {
    00437         DbgPrint(" Mutant test - query mutant 1 return length wrong\n");
    00438     }
    00439
    00440     //
    00441     // Acquire mutant 1.
    00442     //
    00443
    00444     Status = ZwWaitForSingleObject(Handle1, FALSE, NULL);
    00445     if (Status < 0) {
    00446         DbgPrint(" Mutant test - wait mutant 1 failed, status = %lx\n",
    00447                 Status);
    00448     }
    00449
    00450     //
    00451     // Release mutant 1.
    00452     //
    00453
    00454     Count = 100;
    00455     Status = ZwReleaseMutant(Handle1, &Count);
    00456     if (Status < 0) {
    00457         DbgPrint(" Mutant test - release mutant 1 failed, status = %lx\n",
    00458                 Status);
    00459     }
    00460     if (Count != 0) {
    00461         DbgPrint(" Mutant test - release mutant 1 previous count wrong\n");
    00462     }
    00463
    00464     //
    00465     // Create mutant 2.
    00466     //
    00467
    00468     Status = ZwCreateMutant(&Handle2c, DesiredAccess, &Object2Attributes,
    00469                             FALSE);
    00470     if (Status < 0) {
    00471         DbgPrint(" Mutant test - create mutant 2 failed, status = %lx\n",
    00472                 Status);
    00473     }
    00474
    00475     //
    00476     // Open mutant 2.
    00477     //
    00478
    00479     Status = ZwOpenMutant(&Handle2, DesiredAccess, &Object2Attributes);
    00480     if (Status < 0) {
    00481         DbgPrint(" Mutant test - open mutant 2 failed, status = %lx\n",
    00482                 Status);
    00483     }
    00484
    00485     //
    00486     // Acquire mutant 2.
    00487     //
    00488
    00489     Status = ZwWaitForSingleObject(Handle2, FALSE, NULL);
    00490     if (Status < 0) {
    00491         DbgPrint(" Mutant test - wait mutant 2 failed, status = %lx\n",
    00492                 Status);
    00493     }
    00494
    00495     //
    00496     // Query mutant 2.
    00497     //
    00498
    00499     MutantInformation.CurrentCount = 20;
    00500     MutantInformation.AbandonedState = TRUE;
    00501     Length = 0;
    00502     Status = ZwQueryMutant(Handle2, MutantBasicInformation,
    00503                           (PVOID)&MutantInformation,
    00504                           sizeof(MUTANT_BASIC_INFORMATION), &Length);
    00505     if (Status < 0) {
    00506         DbgPrint(" Mutant test - query mutant 2 failed, status = %lx\n",
    00507                 Status);
    00508     }
    00509     if (MutantInformation.CurrentCount != 0) {
    00510         DbgPrint(" Mutant test - query mutant 2 current count wrong\n");
    00511     }
    00512     if (MutantInformation.AbandonedState != FALSE) {
    00513         DbgPrint(" Mutant test - query mutant 2 abandoned state wrong\n");
    00514     }
    00515     if (Length != sizeof(MUTANT_BASIC_INFORMATION)) {
    00516         DbgPrint(" Mutant test - query mutant 2 return length wrong\n");
    00517     }
    00518
    00519     //
    00520     // Acquire mutant 2.
    00521     //
    00522
    00523     Status = ZwWaitForSingleObject(Handle2, FALSE, NULL);
    00524     if (Status < 0) {
    00525         DbgPrint(" Mutant test - wait mutant 2 failed, status = %lx\n",
    00526                 Status);
    00527     }
    00528
    00529     //
    00530     // Release mutant 2.
    00531     //
    00532
    00533     Count = 100;
    00534     Status = ZwReleaseMutant(Handle2, &Count);
    00535     if (Status < 0) {
    00536         DbgPrint(" Mutant test - release mutant 2 failed, status = %lx\n",
    00537                 Status);
    00538     }
    00539     if (Count != - 1) {
    00540         DbgPrint(" Mutant test - release mutant 2 previous count wrong\n");
    00541     }
    00542
    00543     //
    00544     // Release mutant 2.
    00545     //
    00546
    00547     Count = 100;
    00548     Status = ZwReleaseMutant(Handle2, &Count);
    00549     if (Status < 0) {
    00550         DbgPrint(" Mutant test - release mutant 2 failed, status = %lx\n",
    00551                 Status);
    00552     }
    00553     if (Count != 0) {
    00554         DbgPrint(" Mutant test - release mutant 2 previous count wrong\n");
    00555     }
    00556
    00557     //
    00558     // Close all handles.
    00559     //
    00560
    00561     Status = NtClose(Handle1);
    00562     if (Status < 0) {
    00563         DbgPrint(" Mutant test - mutant 1 close failed, status = %lx\n",
    00564                 Status);
    00565     }
    00566     Status = NtClose(Handle1c);
    00567     if (Status < 0) {
    00568         DbgPrint(" Mutant test - mutant 1c close failed, status = %lx\n",
    00569                 Status);
    00570     }
    00571     Status = NtClose(Handle2);
    00572     if (Status < 0) {
    00573         DbgPrint(" Mutant test - mutant 2 close failed, status = %lx\n",
    00574                 Status);
    00575     }
    00576     Status = NtClose(Handle2c);
    00577     if (Status < 0) {
    00578         DbgPrint(" Mutant test - mutant 2c close failed, status = %lx\n",
    00579                 Status);
    00580     }
    00581
    00582     //
    00583     // Announce end of mutant test.
    00584     //
    00585
    00586     DbgPrint(" ** End of Mutant Test **\n");
    00587     return TRUE;
    00588 }

BOOLEAN DoPartyTest | ( | void |  | ) |

Definition at line 1445 of file tex.c.

References DbgPrint, Handle, NTSTATUS(), NULL, ObjectAttributes, Status, and TRUE.

Referenced by ExTest().

    01446 {
    01447     BOOLEAN Result = TRUE;
    01448     NTSTATUS Status;
    01449     OBJECT_ATTRIBUTES ObjectAttributes;
    01450     HANDLE Handle;
    01451
    01452     DbgPrint(" ** Start of Party By Number Test **\n");
    01453
    01454     NtPartyByNumber( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 );
    01455     InitializeObjectAttributes( &ObjectAttributes, NULL, 0, NULL, NULL );
    01456     Status = ZwCreateEvent( &Handle,
    01457                             EVENT_ALL_ACCESS,
    01458                             &ObjectAttributes, NotificationEvent ,TRUE);
    01459     NtPartyByNumber( PARTY_DUMP_OBJECT_BY_HANDLE, Handle, NULL );
    01460     ZwClose( Handle );
    01461     NtPartyByNumber( PARTY_DUMP_OBJECT_BY_HANDLE, Handle, NULL );
    01462
    01463     DbgPrint(" ** End of Party By Number Test **\n");
    01464     return( Result );
    01465 }

BOOLEAN DoPoolTest | ( | void |  | ) |

Definition at line 1468 of file tex.c.

References DumpPool, ExAllocatePool, ExFreePool(), L, NonPagedPool, and TRUE.

Referenced by ExTest().

    01469 {
    01470     PVOID p,p0,p1,p2,p3;
    01471
    01472     p = ExAllocatePool(NonPagedPool,4000L);
    01473     DumpPool("After 4000 byte Allocation",NonPagedPool);
    01474     p = ExAllocatePool(NonPagedPool,2000L);
    01475     DumpPool("After 2000 byte Allocation",NonPagedPool);
    01476     p = ExAllocatePool(NonPagedPool,2000L);
    01477     DumpPool("After 2000 byte Allocation",NonPagedPool);
    01478
    01479     p0 = ExAllocatePool(NonPagedPool,24L);
    01480     DumpPool("After 24 byte Allocation p0",NonPagedPool);
    01481     p1 = ExAllocatePool(NonPagedPool,24L);
    01482     DumpPool("After 24 byte Allocation p1",NonPagedPool);
    01483     p2 = ExAllocatePool(NonPagedPool,24L);
    01484     DumpPool("After 24 byte Allocation p2",NonPagedPool);
    01485     p3 = ExAllocatePool(NonPagedPool,24L);
    01486     DumpPool("After 24 byte Allocation p3",NonPagedPool);
    01487
    01488     ExFreePool(p1);
    01489     DumpPool("After 24 byte Deallocation p1",NonPagedPool);
    01490     ExFreePool(p3);
    01491     DumpPool("After 24 byte Deallocation p3",NonPagedPool);
    01492     ExFreePool(p2);
    01493     DumpPool("After 24 byte Deallocation p2",NonPagedPool);
    01494     ExFreePool(p0);
    01495     DumpPool("After 24 byte Deallocation p0",NonPagedPool);
    01496
    01497     p0 = ExAllocatePool(NonPagedPool,120L);
    01498     DumpPool("After 120 byte Allocation p0",NonPagedPool);
    01499     p1 = ExAllocatePool(NonPagedPool,24L);
    01500     DumpPool("After 24 byte Allocation p1",NonPagedPool);
    01501     ExFreePool(p1);
    01502     DumpPool("After 24 byte Deallocation p1",NonPagedPool);
    01503     ExFreePool(p0);
    01504     DumpPool("After 120 byte Deallocation p0",NonPagedPool);
    01505
    01506     return( TRUE );
    01507 }

BOOLEAN DoResourceTest | ( | void |  | ) |

Definition at line 1706 of file tex.c.

References DbgPrint, Executive, ExInitializeResource, FALSE, KeInitializeSemaphore(), KernelMode, KeWaitForSingleObject(), NT_SUCCESS, NULL, PsCreateSystemThread(), Reader(), ReaderTurnedWriter(), Resource, ResourceCount, ResourceSemaphore, TRUE, and Writer().

Referenced by ExTest().

    01707 {
    01708     HANDLE Handles[32];
    01709     ULONG i;
    01710
    01711     DbgPrint("Start DoResourceTest...\n");
    01712
    01713     ExInitializeResource(&Resource);
    01714     ResourceCount = 0;
    01715
    01716     KeInitializeSemaphore(&ResourceSemaphore, 0, MAXLONG);
    01717
    01718     for (i = 0; i < 4; i += 1) {
    01719
    01720         if (!NT_SUCCESS(PsCreateSystemThread(&Handles[i],
    01721                                           0,
    01722                                           NULL,
    01723                                           0,
    01724                                           NULL,
    01725                                           Reader,
    01726                                           (PVOID)i))) {
    01727
    01728             DbgPrint("Create system thread error %8lx\n", i);
    01729         }
    01730
    01731     }
    01732
    01733     for (i = 4; i < 6; i += 1) {
    01734
    01735         if (!NT_SUCCESS(PsCreateSystemThread(&Handles[i],
    01736                                           0,
    01737                                           NULL,
    01738                                           0,
    01739                                           NULL,
    01740                                           Writer,
    01741                                           (PVOID)i))) {
    01742
    01743             DbgPrint("Create system thread error %8lx\n", i);
    01744         }
    01745
    01746     }
    01747
    01748     for (i = 6; i < 8; i += 1) {
    01749
    01750         if (!NT_SUCCESS(PsCreateSystemThread(&Handles[i],
    01751                                           0,
    01752                                           NULL,
    01753                                           0,
    01754                                           NULL,
    01755                                           ReaderTurnedWriter,
    01756                                           (PVOID)i))) {
    01757
    01758             DbgPrint("Create system thread error %8lx\n", i);
    01759         }
    01760
    01761     }
    01762
    01763     DbgPrint("DoResourceTest wait for everyone to complete...\n");
    01764
    01765     for (i = 0; i < 8; i += 1) {
    01766
    01767         KeWaitForSingleObject( &ResourceSemaphore,
    01768                                Executive,
    01769                                KernelMode,
    01770                                FALSE,
    01771                                NULL);
    01772
    01773     }
    01774
    01775     DbgPrint("DoResourceTest Done\n");
    01776
    01777     return( TRUE );
    01778 }

BOOLEAN DoSemaphoreTest | ( |  | ) |

Definition at line 591 of file tex.c.

References Count, DbgPrint, L, NtClose(), NTSTATUS(), NULL, RtlInitUnicodeString(), Status, and TRUE.

Referenced by ExTest().

    00593 {
    00594
    00595     LONG Count;
    00596     ULONG DesiredAccess = SEMAPHORE_ALL_ACCESS;
    00597     HANDLE Handle1;
    00598     HANDLE Handle1c;
    00599     HANDLE Handle2;
    00600     HANDLE Handle2c;
    00601     ULONG Length;
    00602     STRING Name1;
    00603     STRING Name2;
    00604     OBJECT_ATTRIBUTES Object1Attributes;
    00605     OBJECT_ATTRIBUTES Object2Attributes;
    00606     SEMAPHORE_BASIC_INFORMATION SemaphoreInformation;
    00607     NTSTATUS Status;
    00608
    00609     //
    00610     // Announce start of semaphore test.
    00611     //
    00612
    00613     DbgPrint(" ** Start of Semaphore Test **\n");
    00614
    00615     //
    00616     // Initialize strings and fill in object attributes structures.
    00617     //
    00618
    00619     RtlInitUnicodeString(&Name1, L"\\Semaphore1");
    00620     RtlInitUnicodeString(&Name2, L"\\Semaphore2");
    00621     InitializeObjectAttributes(&Object1Attributes,&Name1,0,NULL,NULL);
    00622     InitializeObjectAttributes(&Object2Attributes,&Name2,0,NULL,NULL);
    00623
    00624     //
    00625     // Create semaphore 1.
    00626     //
    00627
    00628     Status = ZwCreateSemaphore(&Handle1c, DesiredAccess, &Object1Attributes,
    00629                                0, 10);
    00630     if (Status < 0) {
    00631         DbgPrint(" Semaphore test - create semaphore 1 failed, status = %lx\n",
    00632                 Status);
    00633     }
    00634
    00635     //
    00636     // Open semaphore 1.
    00637     //
    00638
    00639     Status = ZwOpenSemaphore(&Handle1, DesiredAccess, &Object1Attributes);
    00640     if (Status < 0) {
    00641         DbgPrint(" Semaphore test - open semaphore 1 failed, status = %lx\n",
    00642                 Status);
    00643     }
    00644
    00645     //
    00646     // Query semaphore 1.
    00647     //
    00648
    00649     SemaphoreInformation.CurrentCount = 10;
    00650     SemaphoreInformation.MaximumCount = 0;
    00651     Length = 0;
    00652     Status = ZwQuerySemaphore(Handle1, SemaphoreBasicInformation,
    00653                           (PVOID)&SemaphoreInformation,
    00654                           sizeof(SEMAPHORE_BASIC_INFORMATION), &Length);
    00655     if (Status < 0) {
    00656         DbgPrint(" Semaphore test - query semaphore 1 failed, status = %lx\n",
    00657                 Status);
    00658     }
    00659     if (SemaphoreInformation.CurrentCount != 0) {
    00660         DbgPrint(" Semaphore test - query semaphore 1 current count wrong\n");
    00661     }
    00662     if (SemaphoreInformation.MaximumCount != 10) {
    00663         DbgPrint(" Semaphore test - query semaphore 1 maximum count wrong\n");
    00664     }
    00665     if (Length != sizeof(SEMAPHORE_BASIC_INFORMATION)) {
    00666         DbgPrint(" Semaphore test - query semaphore 1 return length wrong\n");
    00667     }
    00668
    00669     //
    00670     // Release semaphore 1.
    00671     //
    00672
    00673     Count = 100;
    00674     Status = ZwReleaseSemaphore(Handle1, 2, &Count);
    00675     if (Status < 0) {
    00676         DbgPrint(" Semaphore test - release semaphore 1 failed, status = %lx\n",
    00677                 Status);
    00678     }
    00679     if (Count != 0) {
    00680         DbgPrint(" Semaphore test - release semaphore 1 previous count wrong\n");
    00681     }
    00682
    00683     //
    00684     // Release semaphore 1.
    00685     //
    00686
    00687     Count = 100;
    00688     Status = ZwReleaseSemaphore(Handle1, 5, &Count);
    00689     if (Status < 0) {
    00690         DbgPrint(" Semaphore test - release semaphore 1 failed, status = %lx\n",
    00691                 Status);
    00692     }
    00693     if (Count != 2) {
    00694         DbgPrint(" Semaphore test - release semaphore 1 previous count wrong\n");
    00695     }
    00696
    00697     //
    00698     // Create semaphore 2.
    00699     //
    00700
    00701     Status = ZwCreateSemaphore(&Handle2c, DesiredAccess, &Object2Attributes,
    00702                                5, 20);
    00703     if (Status < 0) {
    00704         DbgPrint(" Semaphore test - create semaphore 2 failed, status = %lx\n",
    00705                 Status);
    00706     }
    00707
    00708     //
    00709     // Open semaphore 2.
    00710     //
    00711
    00712     Status = ZwOpenSemaphore(&Handle2, DesiredAccess, &Object2Attributes);
    00713     if (Status < 0) {
    00714         DbgPrint(" Semaphore test - open semaphore 2 failed, status = %lx\n",
    00715                 Status);
    00716     }
    00717
    00718     //
    00719     // Query semaphore 2.
    00720     //
    00721
    00722     SemaphoreInformation.CurrentCount = 20;
    00723     SemaphoreInformation.MaximumCount = 5;
    00724     Length = 0;
    00725     Status = ZwQuerySemaphore(Handle2, SemaphoreBasicInformation,
    00726                           (PVOID)&SemaphoreInformation,
    00727                           sizeof(SEMAPHORE_BASIC_INFORMATION), &Length);
    00728     if (Status < 0) {
    00729         DbgPrint(" Semaphore test - query semaphore 2 failed, status = %lx\n",
    00730                 Status);
    00731     }
    00732     if (SemaphoreInformation.CurrentCount != 5) {
    00733         DbgPrint(" Semaphore test - query semaphore 2 current count wrong\n");
    00734     }
    00735     if (SemaphoreInformation.MaximumCount != 20) {
    00736         DbgPrint(" Semaphore test - query semaphore 2 maximum count wrong\n");
    00737     }
    00738     if (Length != sizeof(SEMAPHORE_BASIC_INFORMATION)) {
    00739         DbgPrint(" Semaphore test - query semaphore 2 return length wrong\n");
    00740     }
    00741
    00742     //
    00743     // Release semaphore 2.
    00744     //
    00745
    00746     Count = 100;
    00747     Status = ZwReleaseSemaphore(Handle2, 3, &Count);
    00748     if (Status < 0) {
    00749         DbgPrint(" Semaphore test - release semaphore 2 failed, status = %lx\n",
    00750                 Status);
    00751     }
    00752     if (Count != 5) {
    00753         DbgPrint(" Semaphore test - release semaphore 2 previous count wrong\n");
    00754     }
    00755
    00756     //
    00757     // Release semaphore 2.
    00758     //
    00759
    00760     Count = 100;
    00761     Status = ZwReleaseSemaphore(Handle2, 5, &Count);
    00762     if (Status < 0) {
    00763         DbgPrint(" Semaphore test - release semaphore 2 failed, status = %lx\n",
    00764                 Status);
    00765     }
    00766     if (Count != 8) {
    00767         DbgPrint(" Semaphore test - release semaphore 2 previous count wrong\n");
    00768     }
    00769
    00770     //
    00771     // Close all handles.
    00772     //
    00773
    00774     Status = NtClose(Handle1);
    00775     if (Status < 0) {
    00776         DbgPrint(" Semaphore test - semaphore 1 close failed, status = %lx\n",
    00777                 Status);
    00778     }
    00779     Status = NtClose(Handle1c);
    00780     if (Status < 0) {
    00781         DbgPrint(" Semaphore test - semaphore 1c close failed, status = %lx\n",
    00782                 Status);
    00783     }
    00784     Status = NtClose(Handle2);
    00785     if (Status < 0) {
    00786         DbgPrint(" Semaphore test - semaphore 2 close failed, status = %lx\n",
    00787                 Status);
    00788     }
    00789     Status = NtClose(Handle2c);
    00790     if (Status < 0) {
    00791         DbgPrint(" Semaphore test - semaphore 2c close failed, status = %lx\n",
    00792                 Status);
    00793     }
    00794
    00795     //
    00796     // Announce end of semaphore test.
    00797     //
    00798
    00799     DbgPrint(" ** End of Semaphore Test **\n");
    00800     return TRUE;
    00801 }

BOOLEAN DoTimerTest | ( |  | ) |

Definition at line 817 of file tex.c.

References DbgPrint, FALSE, L, NT_SUCCESS, NtClose(), NTSTATUS(), NULL, RtlInitUnicodeString(), Status, TimerApcRoutine(), and TRUE.

Referenced by ExTest().

    00820 {
    00821
    00822     BOOLEAN ApcHappened;
    00823     BOOLEAN CurrentState;
    00824     ULONG DesiredAccess = TIMER_ALL_ACCESS;
    00825     LARGE_INTEGER DueTime;
    00826     HANDLE Handle1;
    00827     HANDLE Handle1c;
    00828     HANDLE Handle2;
    00829     HANDLE Handle2c;
    00830     ULONG Length;
    00831     STRING Name1;
    00832     STRING Name2;
    00833     OBJECT_ATTRIBUTES Object1Attributes;
    00834     OBJECT_ATTRIBUTES Object2Attributes;
    00835     BOOLEAN PreviousState;
    00836     TIMER_BASIC_INFORMATION TimerInformation;
    00837     NTSTATUS Status;
    00838
    00839     //
    00840     // Announce start of timer test.
    00841     //
    00842
    00843     DbgPrint(" ** Start of Timer Test **\n");
    00844
    00845     //
    00846     // Initialize strings and fill in object attributes structures.
    00847     //
    00848
    00849     RtlInitUnicodeString(&Name1, L"\\Timer1");
    00850     RtlInitUnicodeString(&Name2, L"\\Timer2");
    00851     InitializeObjectAttributes(&Object1Attributes,&Name1,0,NULL,NULL);
    00852     InitializeObjectAttributes(&Object2Attributes,&Name2,0,NULL,NULL);
    00853
    00854     //
    00855     // Create timer 1.
    00856     //
    00857
    00858     Status = ZwCreateTimer(&Handle1c, DesiredAccess, &Object1Attributes);
    00859     if (!NT_SUCCESS(Status)) {
    00860         DbgPrint(" Timer test - create timer 1 failed, status = %lx\n",
    00861                 Status);
    00862     }
    00863
    00864     //
    00865     // Open timer 1.
    00866     //
    00867
    00868     Status = ZwOpenTimer(&Handle1, DesiredAccess, &Object1Attributes);
    00869     if (Status < 0) {
    00870         DbgPrint(" Timer test - open timer 1 failed, status = %lx\n",
    00871                 Status);
    00872     }
    00873
    00874     //
    00875     // Query timer 1.
    00876     //
    00877
    00878     TimerInformation.TimerState = TRUE;
    00879     Length = 0;
    00880     Status = ZwQueryTimer(Handle1, TimerBasicInformation,
    00881                           (PVOID)&TimerInformation,
    00882                           sizeof(TIMER_BASIC_INFORMATION), &Length);
    00883     if (Status < 0) {
    00884         DbgPrint(" Timer test - query timer 1 failed, status = %lx\n",
    00885                 Status);
    00886     }
    00887     if (TimerInformation.TimerState) {
    00888         DbgPrint(" Timer test - query timer 1 state wrong\n");
    00889     }
    00890     if (Length != sizeof(TIMER_BASIC_INFORMATION)) {
    00891         DbgPrint(" Timer test - query timer 1 return length wrong\n");
    00892     }
    00893
    00894     //
    00895     // Set timer 1 and then cancel timer 1.
    00896     //
    00897
    00898     DueTime.LowPart = -100000;
    00899     DueTime.HighPart = -1;
    00900     PreviousState = TRUE;
    00901     Status = ZwSetTimer(Handle1, &DueTime, NULL, NULL, &PreviousState);
    00902     if (!NT_SUCCESS(Status)) {
    00903         DbgPrint(" Timer test - set timer 1 failed, status = %lx\n",
    00904                 Status);
    00905     }
    00906     if (PreviousState) {
    00907         DbgPrint(" Timer test - set timer 1 previous state wrong\n");
    00908     }
    00909     CurrentState = TRUE;
    00910     Status = ZwCancelTimer(Handle1, &CurrentState);
    00911     if (!NT_SUCCESS(Status)) {
    00912         DbgPrint(" Timer test - cancel timer 1 failed, status = %lx\n",
    00913                 Status);
    00914     }
    00915     if (CurrentState) {
    00916         DbgPrint(" Timer test - cancel timer 1 current state wrong\n");
    00917     }
    00918
    00919     //
    00920     // Set timer 1, wait for timer to expire, and then cancel timer 1.
    00921     //
    00922
    00923     DueTime.LowPart = -5;
    00924     DueTime.HighPart = -1;
    00925     PreviousState = TRUE;
    00926     Status = ZwSetTimer(Handle1, &DueTime, NULL, NULL, &PreviousState);
    00927     if (!NT_SUCCESS(Status)) {
    00928         DbgPrint(" Timer test - set timer 1 failed, status = %lx\n",
    00929                 Status);
    00930     }
    00931     if (PreviousState) {
    00932         DbgPrint(" Timer test - set timer 1 previous state wrong\n");
    00933     }
    00934     Status = ZwWaitForSingleObject(Handle1, FALSE, NULL);
    00935     if (!NT_SUCCESS(Status)) {
    00936         DbgPrint(" Timer test - wait timer 1 failed, status = %lx\n",
    00937                 Status);
    00938     }
    00939     CurrentState = FALSE;
    00940     Status = ZwCancelTimer(Handle1, &CurrentState);
    00941     if (!NT_SUCCESS(Status)) {
    00942         DbgPrint(" Timer test - cancel timer 1 failed, status = %lx\n",
    00943                 Status);
    00944     }
    00945     if (!CurrentState) {
    00946         DbgPrint(" Timer test - cancel timer 1 current state wrong\n");
    00947     }
    00948
    00949     //
    00950     // Set timer 1 with APC, then cancel timer 1.
    00951     //
    00952
    00953     ApcHappened = FALSE;
    00954     DueTime.LowPart = -100000;
    00955     DueTime.HighPart = -1;
    00956     PreviousState = FALSE;
    00957     Status = ZwSetTimer(Handle1, &DueTime, TimerApcRoutine, &ApcHappened,
    00958                         &PreviousState);
    00959     if (!NT_SUCCESS(Status)) {
    00960         DbgPrint(" Timer test - set timer 1 failed, status = %lx\n",
    00961                 Status);
    00962     }
    00963     if (!PreviousState) {
    00964         DbgPrint(" Timer test - set timer 1 previous state wrong\n");
    00965     }
    00966     CurrentState = TRUE;
    00967     Status = ZwCancelTimer(Handle1, &CurrentState);
    00968     if (!NT_SUCCESS(Status)) {
    00969         DbgPrint(" Timer test - cancel timer 1 failed, status = %lx\n",
    00970                 Status);
    00971     }
    00972     if (CurrentState) {
    00973         DbgPrint(" Timer test - cancel timer 1 current state wrong\n");
    00974     }
    00975     if (ApcHappened) {
    00976         DbgPrint(" Timer test - cancel timer 1 APC happened state wrong\n");
    00977     }
    00978
    00979     //
    00980     // Set timer 1 with APC, set timer again with APC, wait for timer, then
    00981     // cancel timer 1.
    00982     //
    00983
    00984     ApcHappened = FALSE;
    00985     DueTime.LowPart = -100000;
    00986     DueTime.HighPart = -1;
    00987     PreviousState = TRUE;
    00988     Status = ZwSetTimer(Handle1, &DueTime, TimerApcRoutine, &ApcHappened,
    00989                         &PreviousState);
    00990     if (!NT_SUCCESS(Status)) {
    00991         DbgPrint(" Timer test - set timer 1 failed, status = %lx\n",
    00992                 Status);
    00993     }
    00994     if (PreviousState) {
    00995         DbgPrint(" Timer test - set timer 1 previous state wrong\n");
    00996     }
    00997     DueTime.LowPart = -5;
    00998     DueTime.HighPart = -1;
    00999     PreviousState = TRUE;
    01000     Status = ZwSetTimer(Handle1, &DueTime, TimerApcRoutine, &ApcHappened,
    01001                         &PreviousState);
    01002     if (!NT_SUCCESS(Status)) {
    01003         DbgPrint(" Timer test - set timer 1 failed, status = %lx\n",
    01004                 Status);
    01005     }
    01006     if (PreviousState) {
    01007         DbgPrint(" Timer test - set timer 1 previous state wrong\n");
    01008     }
    01009     Status = ZwWaitForSingleObject(Handle1, FALSE, NULL);
    01010     if (!NT_SUCCESS(Status)) {
    01011         DbgPrint(" Timer test - wait timer 1 failed, status = %lx\n",
    01012                 Status);
    01013     }
    01014     CurrentState = FALSE;
    01015     Status = ZwCancelTimer(Handle1, &CurrentState);
    01016     if (!NT_SUCCESS(Status)) {
    01017         DbgPrint(" Timer test - cancel timer 1 failed, status = %lx\n",
    01018                 Status);
    01019     }
    01020     if (!CurrentState) {
    01021         DbgPrint(" Timer test - cancel timer 1 current state wrong\n");
    01022     }
    01023     if (!ApcHappened) {
    01024         DbgPrint(" Timer test - cancel timer 1 APC happened state wrong\n");
    01025     }
    01026
    01027     //
    01028     // Create timer 2.
    01029     //
    01030
    01031     Status = ZwCreateTimer(&Handle2c, DesiredAccess, &Object2Attributes);
    01032     if (Status < 0) {
    01033         DbgPrint(" Timer test - create timer 2 failed, status = %lx\n",
    01034                 Status);
    01035     }
    01036
    01037     //
    01038     // Open timer 2.
    01039     //
    01040
    01041     Status = ZwOpenTimer(&Handle2, DesiredAccess, &Object2Attributes);
    01042     if (Status < 0) {
    01043         DbgPrint(" Timer test - open timer 2 failed, status = %lx\n",
    01044                 Status);
    01045     }
    01046
    01047     //
    01048     // Query timer 2.
    01049     //
    01050
    01051     TimerInformation.TimerState = TRUE;
    01052     Length = 0;
    01053     Status = ZwQueryTimer(Handle2, TimerBasicInformation,
    01054                           (PVOID)&TimerInformation,
    01055                           sizeof(TIMER_BASIC_INFORMATION), &Length);
    01056     if (Status < 0) {
    01057         DbgPrint(" Timer test - query timer 2 failed, status = %lx\n",
    01058                 Status);
    01059     }
    01060     if (TimerInformation.TimerState) {
    01061         DbgPrint(" Timer test - query timer 2 state wrong\n");
    01062     }
    01063     if (Length != sizeof(TIMER_BASIC_INFORMATION)) {
    01064         DbgPrint(" Timer test - query timer 2 return length wrong\n");
    01065     }
    01066
    01067     //
    01068     // Close all handles.
    01069     //
    01070
    01071     Status = NtClose(Handle1);
    01072     if (Status < 0) {
    01073         DbgPrint(" Timer test - timer 1 close failed, status = %lx\n",
    01074                 Status);
    01075     }
    01076     Status = NtClose(Handle1c);
    01077     if (Status < 0) {
    01078         DbgPrint(" Timer test - timer 1c close failed, status = %lx\n",
    01079                 Status);
    01080     }
    01081     Status = NtClose(Handle2);
    01082     if (Status < 0) {
    01083         DbgPrint(" Timer test - timer 2 close failed, status = %lx\n",
    01084                 Status);
    01085     }
    01086     Status = NtClose(Handle2c);
    01087     if (Status < 0) {
    01088         DbgPrint(" Timer test - timer 2c close failed, status = %lx\n",
    01089                 Status);
    01090     }
    01091
    01092     //
    01093     // Announce end of timer test.
    01094     //
    01095
    01096     DbgPrint(" ** End of Timer Test **\n");
    01097     return TRUE;
    01098 }

BOOLEAN DoZoneTest | ( | void |  | ) |

Definition at line 1510 of file tex.c.

References DbgPrint, ExAllocateFromZone, ExAllocatePool, ExExtendZone(), ExFreeToZone, ExInitializeZone(), L, NonPagedPool, NTSTATUS(), and TRUE.

Referenced by ExTest().

    01511 {
    01512     PULONG p1,p2;
    01513     PZONE_HEADER z;
    01514     NTSTATUS st;
    01515     PVOID b1, b2, b3, b4, b5;
    01516
    01517     z = ExAllocatePool(NonPagedPool,(ULONG)sizeof(ZONE_HEADER));
    01518     p1 = ExAllocatePool(NonPagedPool,2048L);
    01519     p2 = ExAllocatePool(NonPagedPool,1024L);
    01520     st = ExInitializeZone(z,512L,p1,2048L);
    01521     ExDumpZone(z);
    01522
    01523     b1 = ExAllocateFromZone(z);
    01524     DbgPrint("b1 = 0x%lx\n",b1);
    01525     ExDumpZone(z);
    01526
    01527     b2 = ExAllocateFromZone(z);
    01528     DbgPrint("b2 = 0x%lx\n",b2);
    01529     ExDumpZone(z);
    01530
    01531     b3 = ExAllocateFromZone(z);
    01532     DbgPrint("b3 = 0x%lx\n",b3);
    01533     ExDumpZone(z);
    01534
    01535     b4 = ExAllocateFromZone(z);
    01536     DbgPrint("b4 = 0x%lx\n",b4);
    01537     ExDumpZone(z);
    01538
    01539     b5 = ExAllocateFromZone(z);
    01540     DbgPrint("b5 = 0x%lx\n",b5);
    01541     ExDumpZone(z);
    01542
    01543     ExFreeToZone(z,b4);
    01544     ExDumpZone(z);
    01545
    01546     ExFreeToZone(z,b3);
    01547     ExDumpZone(z);
    01548
    01549     ExFreeToZone(z,b2);
    01550     ExDumpZone(z);
    01551
    01552     ExFreeToZone(z,b1);
    01553     ExDumpZone(z);
    01554
    01555     st = ExExtendZone(z,p2,1024L);
    01556     ExDumpZone(z);
    01557
    01558     return( TRUE );
    01559 }

PVOID ExDumpResource | ( | IN PERESOURCE | Resource | ) |

BOOLEAN ExTest | ( | VOID |  | ) |

Definition at line 2177 of file tex.c.

References DbgPrint, DoBitMapTest(), DoEventTest(), DoExceptionTest(), DoHandleTest(), DoInfoTest(), DoLuidTest(), DoMemoryTest(), DoMutantTest(), DoPartyTest(), DoPoolTest(), DoResourceTest(), DoSemaphoreTest(), DoTimerTest(), DoZoneTest(), NULL, TestBitMap, TestEvent, TestException, TestFunction, TestHandle, TestInfo, TestLuid, TestMemory, TestMutant, TestParty, TestPool, TestResource, TestSemaphore, TestTimer, TestZone, TRUE, and USHORT.

    02181 {
    02182
    02183     USHORT i;
    02184
    02185     DbgPrint( "In extest\n" );
    02186     for (i=1; i<16; i++) {
    02187         if (i == TestEvent)
    02188             DoEventTest();
    02189         else
    02190         if (i == TestHandle)
    02191             DoHandleTest();
    02192         else
    02193         if (i == TestInfo)
    02194             DoInfoTest();
    02195         else
    02196         if (i == TestLuid) {
    02197             DoLuidTest();
    02198             }
    02199         else
    02200         if (i == TestMemory) {
    02201             DoMemoryTest();
    02202             }
    02203         else
    02204         if (i == TestParty)
    02205             DoPartyTest();
    02206         else
    02207         if (i == TestPool)
    02208             DoPoolTest();
    02209         else
    02210         if (i == TestResource)
    02211             DoResourceTest();
    02212         else
    02213         if (i == TestBitMap)
    02214             DoBitMapTest();
    02215         else
    02216         if (i == TestSemaphore)
    02217             DoSemaphoreTest();
    02218         else
    02219         if (i == TestTimer)
    02220             DoTimerTest();
    02221         else
    02222         if (i == TestZone)
    02223             DoZoneTest();
    02224         else
    02225         if (i == TestMutant)
    02226             DoMutantTest();
    02227         else
    02228         if (i == TestException)
    02229             DoExceptionTest();
    02230         }
    02231
    02232     TestFunction = NULL;    // Invoke the CLI
    02233     return TRUE;
    02234 }

int _CDECL main | ( | int | argc,
|  | char * | argv[]
| ) |

Definition at line 2239 of file tex.c.

References c, DbgPrint, KiSystemStartup(), TestBitMap, TestEvent, TestException, TestFunction, TestHandle, TestInfo, TestLuid, TestMemory, TestMutant, TestParty, TestPool, TestResource, TestSemaphore, TestTimer, TestZone, and USHORT.

    02243 {
    02244 #ifdef SIMULATOR
    02245     char c, *s;
    02246     USHORT i;
    02247
    02248     i = 1;
    02249     if (argc > 1 ) {
    02250         while (--argc) {
    02251             s = *++argv;
    02252             while ((c = *s++) != '\0') {
    02253                 switch (c) {
    02254                 case 'B':
    02255                 case 'b':
    02256                     TestBitMap = i++;
    02257                     break;
    02258
    02259                 case 'C':
    02260                 case 'c':
    02261                     TestException = i++;
    02262                     break;
    02263
    02264                 case 'E':
    02265                 case 'e':
    02266                     TestEvent = i++;
    02267                     break;
    02268
    02269                 case 'H':
    02270                 case 'h':
    02271                     TestHandle = i++;
    02272                     break;
    02273
    02274                 case 'I':
    02275                 case 'i':
    02276                     TestInfo = i++;
    02277                     break;
    02278
    02279                 case 'L':
    02280                 case 'l':
    02281                     TestLuid = i++;
    02282                     break;
    02283
    02284                 case 'M':
    02285                 case 'm':
    02286                     TestMemory = i++;
    02287                     break;
    02288
    02289                 case 'P':
    02290                 case 'p':
    02291                     TestPool = i++;
    02292                     break;
    02293
    02294                 case 'R':
    02295                 case 'r':
    02296                     TestResource = i++;
    02297                     break;
    02298
    02299                 case 'S':
    02300                 case 's':
    02301                     TestSemaphore = i++;
    02302                     break;
    02303
    02304                 case 'T':
    02305                 case 't':
    02306                     TestTimer = i++;
    02307                     break;
    02308
    02309                 case 'X':
    02310                 case 'x':
    02311                     TestMutant = i++;
    02312                     break;
    02313
    02314                 case 'Z':
    02315                 case 'z':
    02316                     TestZone = i++;
    02317                     break;
    02318
    02319                 default:
    02320                     DbgPrint( "tex: invalid test code - '%s'", *argv );
    02321                     break;
    02322                 }
    02323             }
    02324         }
    02325     } else {
    02326         if (!strcmp( "DAVEC", szVerUser )) {
    02327             TestEvent = 1;
    02328             TestSemaphore = 2;
    02329             TestTimer = 3;
    02330             TestMutant = 4;
    02331             TestException = 5;
    02332         }
    02333         else
    02334         if (!strcmp( "MARKL", szVerUser )) {
    02335             TestPool = 1;
    02336             TestZone = 2;
    02337         }
    02338         else
    02339         if (!strcmp( "STEVEWO", szVerUser )) {
    02340             TestInfo = 1;
    02341             TestParty = 2;
    02342             TestMemory = 3;
    02343             TestHandle = 4;
    02344         }
    02345         else
    02346         if (!strcmp( "GARYKI", szVerUser )) {
    02347             TestResource = 1;
    02348             TestMemory = 2;
    02349             TestBitMap = 3;
    02350         }
    02351         else
    02352         if (!strcmp( "JIMK", szVerUser )) {
    02353             TestLuid = 1;
    02354         }
    02355         else {
    02356             DbgPrint( "*** Warning *** - %s is an unauthorized user of tex\n",
    02357                      szVerUser
    02358                    );
    02359         }
    02360     }
    02361 #else
    02362     TestEvent = 1;
    02363     TestSemaphore = 2;
    02364     TestTimer = 3;
    02365     TestMutant = 4;
    02366     TestException = 5;
    02367 #endif // SIMULATOR
    02368
    02369     TestFunction = extest;
    02370     KiSystemStartup();
    02371     return 0;
    02372 }

void oops | ( |  | ) |

Definition at line 2376 of file tex.c.

References ExTimerRundown().

    02377 {
    02378     ExTimerRundown();
    02379 }

VOID Reader | ( | IN PVOID | StartContext | ) |

Definition at line 1567 of file tex.c.

References DbgPrint, ExAcquireResourceShared, ExReleaseResource, FALSE, KeDelayExecutionThread(), KeReleaseSemaphore(), KernelMode, Resource, ResourceCount, ResourceSemaphore, Time, TRUE, and VOID().

Referenced by DoResourceTest().

    01570 {
    01571     LARGE_INTEGER Time;
    01572
    01573     //KeSetPriorityThread( &PsGetCurrentThread()->Tcb, 2 );
    01574
    01575     DbgPrint("Starting Reader %lx...\n", StartContext);
    01576
    01577     Time.LowPart = -(1+(ULONG)StartContext);
    01578     Time.HighPart = -1;
    01579
    01580     while (TRUE) {
    01581
    01582         (VOID)ExAcquireResourceShared(&Resource,TRUE);
    01583
    01584         DbgPrint("%lx with shared access\n", StartContext);
    01585
    01586         if (ResourceCount >= 10) {
    01587             ExReleaseResource(&Resource);
    01588             break;
    01589         }
    01590
    01591         KeDelayExecutionThread ( KernelMode, FALSE, &Time);
    01592
    01593         ExReleaseResource(&Resource);
    01594
    01595         DbgPrint("%lx released shared access\n", StartContext);
    01596
    01597         KeDelayExecutionThread ( KernelMode, FALSE, &Time);
    01598     }
    01599
    01600     DbgPrint("Reader %lx exiting\n", StartContext);
    01601
    01602     KeReleaseSemaphore(&ResourceSemaphore, 0, 1, FALSE);
    01603 }

VOID ReaderTurnedWriter | ( | IN PVOID | StartContext | ) |

Definition at line 1646 of file tex.c.

References DbgPrint, ExAcquireResourceShared, ExConvertExclusiveToShared, ExReleaseResource, FALSE, KeDelayExecutionThread(), KeReleaseSemaphore(), KernelMode, Resource, ResourceCount, ResourceSemaphore, Time, TRUE, and VOID().

Referenced by DoResourceTest().

    01649 {
    01650     LARGE_INTEGER Time;
    01651
    01652     //KeSetPriorityThread( &PsGetCurrentThread()->Tcb, 4 );
    01653
    01654     DbgPrint("Starting Reader turned Writer %lx\n", StartContext);
    01655
    01656     Time.LowPart = -(1+(ULONG)StartContext);
    01657     Time.HighPart = -1;
    01658
    01659     while (TRUE) {
    01660
    01661         (VOID)ExAcquireResourceShared(&Resource,TRUE);
    01662
    01663         DbgPrint("%lx with shared access\n", StartContext);
    01664
    01665         if (ResourceCount >= 10) {
    01666             ExReleaseResource(&Resource);
    01667             break;
    01668         }
    01669
    01670         KeDelayExecutionThread ( KernelMode, FALSE, &Time);
    01671
    01672         ExConvertSharedToExclusive(&Resource);
    01673
    01674         DbgPrint("%lx Shared turned Exclusive access\n", StartContext);
    01675
    01676         ResourceCount += 1;
    01677         if (ResourceCount >= 10) {
    01678             ExReleaseResource(&Resource);
    01679             break;
    01680         }
    01681
    01682         KeDelayExecutionThread ( KernelMode, FALSE, &Time);
    01683
    01684         ExConvertExclusiveToShared(&Resource);
    01685
    01686         DbgPrint("%lx Exclusive turned Shared access\n", StartContext);
    01687
    01688         if (ResourceCount >= 10) {
    01689             ExReleaseResource(&Resource);
    01690             break;
    01691         }
    01692
    01693         ExReleaseResource(&Resource);
    01694
    01695         DbgPrint("%lx release Shared access\n", StartContext);
    01696
    01697         KeDelayExecutionThread ( KernelMode, FALSE, &Time);
    01698     }
    01699
    01700     DbgPrint("Reader turned Writer %lx exiting\n", StartContext);
    01701
    01702     KeReleaseSemaphore(&ResourceSemaphore, 0, 1, FALSE);
    01703 }

BOOLEAN TestDupHandle1 | ( | IN PVOID | HandleTableEntry | ) |

Definition at line 1101 of file tex.c.

References DbgPrint, and TRUE.

Referenced by DoHandleTest().

    01104 {
    01105     DbgPrint( "Dupping %lx\n", HandleTableEntry );
    01106     return( TRUE );
    01107 }

BOOLEAN TestDupHandle4 | ( | IN PVOID | HandleTableEntry | ) |

Definition at line 1110 of file tex.c.

References DbgPrint, FALSE, and TRUE.

Referenced by DoHandleTest().

    01113 {
    01114     PULONG p = (PULONG)HandleTableEntry;
    01115     ULONG i;
    01116
    01117     if (!((*p>>4) % 4)) {
    01118         return( FALSE );
    01119         }
    01120
    01121     DbgPrint( "Dupping " );
    01122     for (i=0; i<4; i++) {
    01123         DbgPrint( "  %lx", *p++ );
    01124         }
    01125     DbgPrint( "\n" );
    01126     return( TRUE );
    01127 }

BOOLEAN TestEnumHandle1 | ( | IN PVOID | HandleTableEntry,
|  | IN PVOID | EnumParameter
| ) |

Definition at line 1130 of file tex.c.

References FALSE, and TRUE.

Referenced by DoHandleTest().

    01134 {
    01135     if (EnumParameter == HandleTableEntry) {
    01136         return( TRUE );
    01137         }
    01138     else {
    01139         return( FALSE );
    01140         }
    01141 }

BOOLEAN TestEnumHandle4 | ( | IN PVOID | HandleTableEntry,
|  | IN PVOID | EnumParameter
| ) |

Definition at line 1144 of file tex.c.

References FALSE, and TRUE.

Referenced by DoHandleTest().

    01148 {
    01149     if (EnumParameter == (PVOID)*(PULONG)HandleTableEntry) {
    01150         return( TRUE );
    01151         }
    01152     else {
    01153         return( FALSE );
    01154         }
    01155 }

VOID TimerApcRoutine | ( | IN PVOID | TimerContext,
|  | IN ULONG | TimerLowValue,
|  | IN LONG | TimerHighValue
| ) |

Definition at line 804 of file tex.c.

References TRUE.

Referenced by DoTimerTest(), and NtSetTimer().

    00810 {
    00811
    00812     *((PBOOLEAN)TimerContext) = TRUE;
    00813     return;
    00814 }

VOID Writer | ( | IN PVOID | StartContext | ) |

Definition at line 1606 of file tex.c.

References DbgPrint, ExAcquireResourceExclusive, ExReleaseResource, FALSE, KeDelayExecutionThread(), KeReleaseSemaphore(), KernelMode, Resource, ResourceCount, ResourceSemaphore, Time, TRUE, and VOID().

Referenced by DoResourceTest().

    01609 {
    01610     LARGE_INTEGER Time;
    01611
    01612     //KeSetPriorityThread( &PsGetCurrentThread()->Tcb, 3 );
    01613
    01614     DbgPrint("Starting Writer %lx...\n", StartContext);
    01615
    01616     Time.LowPart = -(1+(ULONG)StartContext);
    01617     Time.HighPart = -1;
    01618
    01619     while (TRUE) {
    01620
    01621         (VOID)ExAcquireResourceExclusive(&Resource,TRUE);
    01622
    01623         DbgPrint("%lx with Exclusive access\n", StartContext);
    01624
    01625         ResourceCount += 1;
    01626         if (ResourceCount >= 10) {
    01627             ExReleaseResource(&Resource);
    01628             break;
    01629         }
    01630
    01631         KeDelayExecutionThread ( KernelMode, FALSE, &Time);
    01632
    01633         ExReleaseResource(&Resource);
    01634
    01635         DbgPrint("%lx released Exclusive access\n", StartContext);
    01636
    01637         KeDelayExecutionThread ( KernelMode, FALSE, &Time);
    01638     }
    01639
    01640     DbgPrint("Writer %lx exiting\n", StartContext);
    01641
    01642     KeReleaseSemaphore(&ResourceSemaphore, 0, 1, FALSE);
    01643 }

## Variable Documentation

char MemoryTestBuffer1[128]

| Definition at line 1363 of file tex.c. Referenced by DoMemoryTest().

char MemoryTestBuffer2[128]

| Definition at line 1366 of file tex.c. Referenced by DoMemoryTest().

ERESOURCE Resource

| Definition at line 1561 of file tex.c. Referenced by CcPinMappedData(), CcSetBcbOwnerPointer(), CcUnpinDataForThread(), CcUnpinRepinnedBcb(), DoResourceTest(), ExAcquireResourceExclusive(), ExAcquireResourceExclusiveLite(), ExAcquireResourceSharedLite(), ExAcquireSharedStarveExclusive(), ExAcquireSharedWaitForExclusive(), ExConvertExclusiveToSharedLite(), ExDeleteResource(), ExDeleteResourceLite(), ExDisableResourceBoostLite(), ExGetExclusiveWaiterCount(), ExGetSharedWaiterCount(), ExInitializeResource(), ExInitializeResourceLite(), ExIsResourceAcquiredExclusiveLite(), ExIsResourceAcquiredSharedLite(), ExpAcquireResourceExclusiveLite(), ExpCheckForResource(), ExpFindCurrentThread(), ExpWaitForResource(), ExpWaitForResourceDdk(), ExQuerySystemLockInformation(), ExReinitializeResourceLite(), ExReleaseResourceForThread(), ExReleaseResourceForThreadLite(), ExReleaseResourceLite(), ExSetResourceOwnerPointer(), ExTryToAcquireResourceExclusiveLite(), IopGetDeviceResourcesFromRegistry(), IopQueryDeviceResources(), LdrpGetFileVersion(), LdrQueryApplicationCompatibilityGoo(), Reader(), ReaderTurnedWriter(), RtlAcquireResourceExclusive(), RtlAcquireResourceShared(), RtlConvertExclusiveToShared(), RtlConvertSharedToExclusive(), RtlDeleteResource(), RtlDumpResource(), RtlInitializeResource(), RtlQueryProcessLockInformation(), RtlReleaseResource(), UdfAcquireResource(), UdfSingleAsyncCompletionRoutine(), VerifierExAcquireResourceExclusive(), VerifierExReleaseResource(), and Writer().

ULONG ResourceCount

| Definition at line 1562 of file tex.c. Referenced by DoResourceTest(), Reader(), ReaderTurnedWriter(), and Writer().

KSEMAPHORE ResourceSemaphore

| Definition at line 1563 of file tex.c. Referenced by DoResourceTest(), Reader(), ReaderTurnedWriter(), and Writer().

USHORT TestBitMap = 0

| Definition at line 45 of file tex.c. Referenced by ExTest(), and main().

USHORT TestEvent = 0

| Definition at line 37 of file tex.c. Referenced by ExTest(), and main().

USHORT TestException = 0

| Definition at line 50 of file tex.c. Referenced by ExTest(), and main().

PTESTFCN TestFunction = ExTest

| Definition at line 33 of file tex.c. Referenced by ExTest(), main(), and obtest().

USHORT TestHandle = 0

| Definition at line 38 of file tex.c. Referenced by ExTest(), and main().

USHORT TestInfo = 0

| Definition at line 39 of file tex.c. Referenced by ExTest(), and main().

USHORT TestLuid = 0

| Definition at line 40 of file tex.c. Referenced by ExTest(), and main().

USHORT TestMemory = 0

| Definition at line 41 of file tex.c. Referenced by ExTest(), and main().

USHORT TestMutant = 0

| Definition at line 49 of file tex.c. Referenced by ExTest(), and main().

USHORT TestParty = 0

| Definition at line 42 of file tex.c. Referenced by ExTest(), and main().

USHORT TestPool = 0

| Definition at line 43 of file tex.c. Referenced by ExTest(), and main().

USHORT TestResource = 0

| Definition at line 44 of file tex.c. Referenced by ExTest(), and main().

USHORT TestSemaphore = 0

| Definition at line 46 of file tex.c. Referenced by ExTest(), and main().

char TestString1[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"

| Definition at line 1364 of file tex.c. Referenced by DoMemoryTest().

char TestString2[] = "123456789012345678901234567890123456789012345678901234567890"

| Definition at line 1365 of file tex.c. Referenced by DoMemoryTest().

USHORT TestTimer = 0

| Definition at line 47 of file tex.c. Referenced by ExTest(), and main().

USHORT TestZone = 0

| Definition at line 48 of file tex.c. Referenced by ExTest(), and main().