## The WHICHOS Sample

The WHICHOS Sample accompanies Appendix A and illustrates how to determine the version of the operating system under which a WDM driver is running. This sample was added in Service Pack 9 for the 1st edition.

The sample includes one component:

- WHICHOS.SYS is a WDM driver for a non-existent hardware device.

### Building WHICHOS

To build WHICHOS.SYS, follow the general instructions for building a WDM sample. The Microsoft Visual C++ project file is named WHICHOS.DSP.

### Testing WHICHOS

First provide a way to view debug messages, for example by running DbgView from http://www.sysinternals.com. Follow the general instructions for using FastInst in either Windows XP or Windows 98/Me. The INF file is named WHICHOS.INF.

The DriverEntry function for WHICHOS determines which operating system is in use and prints a message to the debugging terminal. It then returns STATUS_UNSUCCESSFUL to abort loading the driver. To cleanup, you should open the Device Manager and uninstall WHICHOS.

### What to look for

The WhichOs function in DriverEntry.cpp determines the OS version.