Author: Kant (USA)
Translator: Sun Yi et al.
Editor-in-Chief: Chen Jianou
Publisher:
Publish Date: 2000-01-01
Features:
WS2000 new driver model (WDM). Describes the structure, functionality, and development methods of WDM device drivers; through practical device driver examples, illustrates the implementation techniques, testing, and debugging methods of WDM device drivers; introduces a debugging software DebugPrint provided in this book; explains how to use the USB Driver Interface (USBDI) in client drivers to access USB devices, as well as how to use the HID class driver to access various input devices using standard methods.
Excerpt:
Using this, making requests to the USB bus is quite straightforward. Source code compatibility and binary compatibility were initially announced by Microsoft, stating that WDM drivers would be binary compatible between Windows 98 and Windows 2000x86, and source code compatible with the Windows 2000 Alpha platform. However, it is now clear that binary compatibility cannot be guaranteed, although the DDK is unclear about this. For safety, the author only installs drivers constructed for the correct operating system, i.e., when constructing drivers for Windows 98, the Windows 98 Driver Development Kit (DDK) is used, while for Windows 2000, the Windows 2000 DDK is used. If some WDM features that only appear in Windows 2000 are used, source code compatibility cannot be achieved. For example, the Windows 2000 USB system driver supports some features that are not available in Windows 98 drivers. Below, by developing a simple device driver, the core functions of WDM are first discussed. Then, drivers that must use hardware resources such as memory access and interrupt handling are discussed. Finally, USB and HID system drivers are introduced. Use the kernel routine IoIsWdmVersionAvailable to determine if the required WDM version is available. The DDK header files define two constants, WDM_MAJORVERSION and WDM_MINORVERSION, which are 1 and 0 for Windows 98, and 1 and 0x10 for Windows 2000.
1.1.1 WDM and NT-style Drivers
Figure 1-1 roughly illustrates the differences between WDM and NT-style drivers, and the book will explain all the functions mentioned in this figure. The overlap between these two types of drivers is quite significant. In fact, writing WDM and NT-style drivers is essentially the same work, with the main difference in the driver code being how to create the device. In WDM drivers, the Plug and Play (PnP) manager informs the system when to add or remove a device. The PnP manager uses installation INF files to find the correct driver for a new device; conversely, NT-style drivers must discover their own devices, usually in their initialization routines. NT-style drivers are typically installed using a dedicated installation program. New bus drivers and class drivers are only available for WDM device drivers, and new WDM and NT-style drivers should support power management and WMI features.
1.1.2 Available Drivers
If you start writing a driver from scratch, it seems that most of the code is unrelated to device access, and many "basic frameworks" must be set up before performing actual input/output (I/O). Using some practical and useful drivers as examples in this book will help readers get started quickly. Some drivers can be used directly, while others form the foundation for readers' own drivers. A virtual device driver is used to explain the core WDM functions. The virtual device does not use any actual hardware. Three drivers, Wdm1, Wdm2, and Wdm3, gradually implement more functions. Initially, they provide a shared memory buffer, making them a foundation for other useful drivers. In fact, the Wdm2 driver is used as the foundation for several other drivers in the book, including those that use system drivers. In this book, the DebugPrint software is used to provide trace debugging output for drivers. The DebugPrint driver will be introduced in Chapter 4. Readers can use DebugPrint in their own device drivers. WdmIO and PHDIO are general-purpose drivers that can be used immediately to provide access to simple hardware devices. A Win32 program can communicate with hardware using a set of simple but powerful commands. These drivers support interrupt-driven I/O. Application examples illustrate how these general-purpose drivers are used to access parallel ports. The UsbKbd and HidKbd drivers both access keyboards connected to the USB bus, demonstrating the techniques required for using USB and HID class drivers. Finally, the Win32 application HidKbdUser shows how user-mode applications can discover and access HID devices.
1.1.3 Companion CD-ROM
The companion CD-ROM contains all the drivers mentioned above, including the full source code and compiled executable files for these drivers. Each driver has at least one test program to test the driver. Additionally, the book includes some useful Win32 utilities to assist in driver development. Full instructions for installing the software on the companion CD-ROM are provided in Chapter 4. Most of the test Win32 programs are console applications, making them easy to write and understand; there is no need to make these codes mature window-style or MFC applications. To make the most of this book, all driver examples should be installed and the Win32 test programs should be run. All drivers include trace debugging statements, and if DebugPrint software is installed, the trace output can be seen in the DebugPrintMonitor application. Carefully examining the source code of each example is very useful, as in real-world work, one can only learn programming by writing actual code. These driver examples can be used as a starting point to add more features and further master the writing of device drivers.
1.1.4 Device Driver Software Tools
There are two types of software that can help with device driver development, as shown in Table 1-1. The driver class is a source code C++ class wrapper that provides most of the default functionality required for drivers; general-purpose drivers can access many types of devices from user mode. OSR has a debugging aid called the OSRDDK.
Windows WDM Device Driver Development Guide
📌 Related Posts
Literature
Dimension of Morality: Introduction to Modern Economic Ethics: Introduction to Modern Economic Ethics
2026-09-21
Literature
Attitude determines everything
2026-09-24
Literature
2026-09-25
Literature
International High IQ Association Quality Test Manual: Discover Your Talents, Personality, Career, and Future
2026-09-22
Literature
Read want to use. Senior 2 Politics (Part 2): Senior 2 Politics
2026-09-25
Literature
New Curriculum Standard Graded Reading. Senior 3 (Level 8): Senior 3
2026-09-25
Literature
Interchangeability and Measurement Technology Basics ((Second Edition))
2026-09-25
Literature
Automotive body structure and design
2026-09-25