The Windows 2000 Device Driver Book: A Guide for Programmers (2nd Edition) - page 2

click for table of contents

Table of Contents
About the Authors

The Windows 2000 Device Driver Book, A Guide for Programmers, Second Edition

Art Baker
Jerry Lozano
Publisher: Prentice Hall PTR
Second Edition November 20, 2000
ISBN: 0-13-020431-5, 480 pages

  • The #1 Windows device driver book - fully updated for Windows 2000!

  • Step-by-step planning, implementation, testing, debugging, installation, and distribution

  • Complete coverage of the new Windows Driver Model (WDM)

  • Practical debugging and interactive troubleshooting

  • CD-ROM: Exclusive tools for streamlining driver development, plus extensive C/C++ sample driver library!

  • Windows Driver Model (WDM) for Windows 2000 and 98 - in depth!

  • Building drivers that support Plug-and-Play and Power Management

  • Windows Management Instrumentation: logging device errors and events - and interpreting them

  • Constructing safe reentrant driver code

  • Handling time-out conditions safely and effectively

  • Advanced techniques: kernel-mode threads, layered drivers, and more

  • Start-to-finish debugging and troubleshooting techniques

Foreword by Andrew Scoppa, UCI Corporation

The #1 book on Windows driver development - totally updated for Windows 2000!

With The Windows 2000 Device Driver Book, any experienced Windows programmer can master driver development start to finish: planning, implementation, testing, debugging, installation, and distribution. Totally updated to reflect Microsoft’s Windows Driver Model (WDM) for Windows 2000 and 98, this programming bestseller covers everything from architecture to tools, and includes a powerhouse library of exclusive tools and code for streamlining any driver development project.

You’ll start with a high-level overview of WDM components and then move quickly into the details of the development environment and driver installation. Next, master the Windows 2000 I/O Manager, its data structures, and its interaction with drivers. Using extensive practical examples, you’ll implement Plug-and-Play and Power Management; construct safe reentrant driver code; use Windows Management Instrumentation to log errors and events, and more.

The book covers today’s most advanced Windows driver development techniques and provides extensive debugging guidance, including crash dump analysis using WinDbg; lists of common bugcheck codes, meanings, and probable causes; and much more.

About the CD-ROM

Bonus CD-ROM contains powerful resources for streamlining device driver development!

  • An exclusive Device Driver AppWizard that works with Visual Studio to instantly create your driver’s framework

  • A library of complete sample drivers

  • C++ classes to jumpstart any project-including a Unicode string handling class that eliminates tedious, repetitive code

  • An exclusive Driver Installation Utility to simplify initial testing


UCI Software Training Centers specializes in high-end developer, systems, and Internet Training on Microsoft products and technologies. For more information about training in this topic and others, UCI can be reached at 800-884-1772, or on the Web at

The Windows 2000 Device Driver Book, A Guide for Programmers, Second Edition


   What You Should Already Know
   What's Covered
   What's Not
   About the Sample Code
   History of this Book
   Training and Consulting Services


1. Introduction to Windows 2000 Drivers
   Overall System Architecture
   Kernel-Mode I/O Components
   Special Driver Architectures

2. The Hardware Environment
   Hardware Basics
   Buses and Windows 2000
   Hints for Working with Hardware

3. Kernel-Mode I/O Processing
   How Kernel-Mode Code Executes
   Use of Interrupt Priorities by Windows 2000
   Deferred Procedure Calls (DPCs)
   Access to User Buffers
   Structure of a Kernel-Mode Driver
   I/O Processing Sequence

4. Drivers and Kernel-Mode Objects
   Data Objects and Windows 2000
   I/O Request Packets (IRPs)
   Driver Objects
   Device Objects and Device Extensions
   Controller Objects and Controller Extensions
   Adapter Objects
   Interrupt Objects

5. General Development Issues
   Driver Design Strategies
   Coding Conventions and Techniques
   Driver Memory Allocation
   Unicode Strings
   Interrupt Synchronization
   Synchronizing Multiple CPUs
   Linked Lists

6. Initialization and Cleanup Routines
   Writing a DriverEntry Routine
   Code Example: Driver Initialization
   Writing Reinitialize Routines
   Writing an Unload Routine
   Code Example: Driver Unload
   Writing Shutdown Routines
   Testing the Driver

7. Driver Dispatch Routines
   Announcing Driver Dispatch Routines
   Writing Driver Dispatch Routines
   Processing Read and Write Requests
   Code Example: A Loopback Device
   Extending the Dispatch Interface
   Testing Driver Dispatch Routines

8. Interrupt-Driven I/O
   How Programmed I/O Works
   Driver Initialization and Cleanup
   Writing a Start I/O Routine
   Writing an Interrupt Service Routine (ISR)
   Writing a DpcForIsr Routine
   Some Hardware: The Parallel Port
   Code Example: Parallel Port Loopback Driver
   Testing the Parallel Port Loopback Driver

9. Hardware Initialization
   The Plug and Play Architecture: A Brief History
   The Role of the Registry for Legacy Drivers
   Detecting Devices with Plug and Play
   The Role of Driver Layers in Plug and Play
   The New WDM IRP Dispatch Functions
   Device Enumeration
   Device Interfaces
   Code Example: A Simple Plug and Play Driver

10. Power Management
   Hot Plug Devices
   OnNow Initiative
   Wake Requests
   Power Management Issues

11. Timers
   Handling Device Timeouts
   Code Example: Catching Device Timeouts
   Managing Devices without Interrupts
   Code Example: A Timer-Based Driver

12. DMA Drivers
   How DMA Works under Windows 2000
   Working with Adapter Objects
   Writing a Packet-Based Slave DMA Driver
   Code Example: A Packet-Based Slave DMA Driver
   Writing a Packet-Based Bus Master DMA Driver
   Writing a Common Buffer Slave DMA Driver
   Writing a Common Buffer Bus Master DMA Driver

13. Windows Management and Instrumentation
   WMI: The Industry Picture
   The WMI Architecture
   WMI Summary
   Conventional Driver Event Logging

14. System Threads
   Definition and Use of System Threads
   Thread Synchronization
   Using Dispatcher Objects
   Code Example: A Thread-Based Driver

15. Layered Drivers
   An Overview of Intermediate Drivers
   Writing Layered Drivers
   Writing I/O Completion Routines
   Allocating Additional IRPs
   Writing Filter Drivers
   Code Example: A Filter Driver
   Writing Tightly Coupled Drivers

16. Driver Installation
   Installation of a Driver
   Auto-Install Using INF Files
   Using a Driver INF File
   Controlling Driver Load Sequence
   Digital Signing of a Driver

17. Testing and Debugging Drivers
   Guidelines for Driver Testing
   Why Drivers Fail
   Reading Crash Screens
   An Overview of WinDbg
   Analyzing a Crash Dump
   Interactive Debugging
   Writing WinDbg Extensions
   Code Example: A WinDbg Extension
   Miscellaneous Debugging Techniques

A. The Driver Debug Environment
   Hardware and Software Requirements
   Debug Symbol Files
   Enabling Crash Dumps on the Target System
   Enabling the Target System's Debug Client

B. Bugcheck Codes

C. Building Drivers
   The Build Utility
   Using Visual Studio to Build Drivers