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

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

Foreword

Preface

   What You Should Already Know

   What's Covered

   What's Not

   About the Sample Code

   History of this Book

   Training and Consulting Services

Acknowledgments

1. Introduction to Windows 2000 Drivers

   Overall System Architecture

   Kernel-Mode I/O Components

   Special Driver Architectures

   Summary

2. The Hardware Environment

   Hardware Basics

   Buses and Windows 2000

   Hints for Working with Hardware

   Summary

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

   Summary

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

   Summary

5. General Development Issues

   Driver Design Strategies

   Coding Conventions and Techniques

   Driver Memory Allocation

   Unicode Strings

   Interrupt Synchronization

   Synchronizing Multiple CPUs

   Linked Lists

   Summary

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

   Summary

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

   Summary

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

   Summary

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

   Summary

10. Power Management

   Hot Plug Devices

   OnNow Initiative

   Wake Requests

   Power Management Issues

   Summary

11. Timers

   Handling Device Timeouts

   Code Example: Catching Device Timeouts

   Managing Devices without Interrupts

   Code Example: A Timer-Based Driver

   Summary

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

   Summary

13. Windows Management and Instrumentation

   WMI: The Industry Picture

   The WMI Architecture

   WMI Summary

   Conventional Driver Event Logging

   Summary

14. System Threads

   Definition and Use of System Threads

   Thread Synchronization

   Using Dispatcher Objects

   Code Example: A Thread-Based Driver

   Summary

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

   Summary

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

   Summary

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

   Summary

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

Bibliography

Категории