Programming the Microsoft Windows Driver Model
Basic Driver Information
The initial page (shown in Figure B-1) asks you for basic information about the driver you want to build.
For Type Of Driver, you can specify these choices:
- Generic Function Driver
Builds a function driver for a generic device. (Note that the use of the word generic here is unfortunate because it has nothing to do with GENERIC.SYS.)
- Generic Filter Driver
Builds a filter driver with default handling for all types of I/O request packet (IRP).
- USB Function Driver
Builds a function driver for a universal serial bus (USB) device.
- Empty Driver Project
Builds a project with no files but with options set up for building a WDM driver.
- Convert existing SOURCES file
Creates a project according to the definition in a standard DDK SOURCES file. Use this option, for example, to convert a DDK sample to a Visual Studio project.
Figure B-1. Page for entering basic driver information.
You can select the following options:
- Verbose Debugging Trace
If you check this option, the driver project files will include many KdPrint macro calls to trace important operations in the driver.
- Use Buffered Method For Reads And Writes
Set this option if you want to use the DO_BUFFERED_IO method for read and write operations. Clear this option if you want to use DO_DIRECT_IO instead.
- Use Old-Style For Device Naming
Set this option to generate named device objects. Clear this option to generate a driver that uses a device interface instead. The second choice (device interface) is the one Microsoft prefers for WDM drivers.
- Replace ASSERT For i86 Platforms
The DDK s ASSERT macro calls a kernel-mode support routine (RtlAssert) that s a no-operation in the free build of Microsoft Windows 2000. The checked build of your driver will therefore not stop in the free build of the operating system. Set this option to redefine ASSERT so that the checked build of your driver halts even in the free build of the operating system.
- Use GENERIC.SYS Library
Set this option to make use of the standardized driver code in GENERIC.SYS. Clear this option to put all that standardized code in your own driver.
- Windows 98 Detection
Set this option to include a run-time check for whether your driver is running under Windows 98/Me or Windows 2000/XP. Clear this option to omit the check.
You can also specify the base pathname where you ve installed the Windows .NET DDK and the samples for this book. The default values $(DDKPATH) and $(WDMBOOK) rely on the environment variables that the sample setup program creates.
Finally you can click the Dispatch Functions button to specify the types of IRP your driver will handle, as Figure B-2 shows. The dialog box embodies some design decisions that you can t override. Your driver will include support for IRP_MJ_PNP and IRP_MJ_POWER. If you specify handling for IRP_MJ_CREATE, you ll get support for IRP_MJ_CLOSE. If you specify handling for IRP_MJ_READ, IRP_MJ_WRITE, or IRP_MJ_DEVICE_CONTROL, you ll get support for IRP_MJ_CREATE (and therefore IRP_MJ_CLOSE). WDMWIZ.AWX doesn t generate skeleton dispatch functions for many types of IRP that are used only by file system drivers.
Figure B-2. Dialog box for specifying the IRP major function codes for which you want dispatch functions.