## The DEVPROP Sample

The DEVPROP Sample accompanies Chapter 15 and illustrates how to determine standard device properties.

The sample includes two components:

- DEVPROP.SYS (SYS subdirectory) is a WDM driver for a non-existent hardware device.
- TEST.EXE (TEST subdirectory) is a user-mode test program for DEVPROP.SYS.

### Building DEVPROP

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

To build TEST.EXE, follow the general instructions for building user-mode programs. The Microsoft Visual C++ project file is named TEST.DSP in the TEST subdirectory.

### Testing DEVPROP

First start a debugger or provide some other way of viewing debug messages. (You could download DbgView from http://www.sysinternals.com, for example.) Install DEVPROP.SYS. Follow the general instructions for using FastInst in Windows XP or Windows 98/Me. The INF file is named SYS\DEVPROP.INF. During installation, the driver will issue a debug message containing the device description property. (The message is to the effect that AddDevice was called for the DEVPROP Sample device.)

Open a command prompt and run TEST.EXE from the TEST\DEBUG subdirectory. It will display property information about DEVPROP and all other sample drivers that you happen to have installed. TEST actually enumerates the drivers that use GENERIC.SYS, so you can run it even without having DEVPROP installed.

### What to look for

The AddDevice function (DriverEntry.cpp in the sys directory) shows how to obtain device property information in kernel mode. DeviceList.cpp and DeviceList.h (test directory) implement a general-purpose MFC class for enumerating devices that support a given interface. Test.cpp (also in the test directory) shows how to obtain property information in user mode.