Book description
Start developing robust drivers with expert guidance from the teams who developed Windows Driver Foundation. This comprehensive book gets you up to speed quickly and goes beyond the fundamentals to help you extend your Windows development skills. You get best practices, technical guidance, and extensive code samples to help you master the intricacies of the next-generation driver model—and simplify driver development.
Discover how to:
Use the Windows Driver Foundation to develop kernel-mode or user-mode drivers
Create drivers that support Plug and Play and power management—with minimal code
Implement robust I/O handling code
Effectively manage synchronization and concurrency in driver code
Develop user-mode drivers for protocol-based and serial-bus-based devices
Use USB-specific features of the frameworks to quickly develop drivers for USB devices
Design and implement kernel-mode drivers for DMA devices
Evaluate your drivers with source code analysis and static verification tools
Apply best practices to test, debug, and install drivers
PLUS—Get driver code samples on the Web
Table of contents
- Developing Drivers with the Windows® Driver Foundation
- Foreword
- Acknowledgments
-
I. Getting Started with WDF
- 1. Introduction to WDF
- 2. Windows Driver Fundamentals
- 3. WDF Fundamentals
-
II. Exploring the Frameworks
- 4. Overview of the Driver Frameworks
- 5. WDF Object Model
-
6. Driver Structure and Initialization
- Required Driver Components
- Driver Object
- Device Objects
- Queues and Other Support Objects
- Device Interfaces
- UMDF Device Object Creation and Initialization
- KMDF Device Object Creation and Initialization
- Child Device Enumeration (KMDF PDOs Only)
- Device Naming Techniques for KMDF Drivers
-
III. Applying WDF Fundamentals
-
7. Plug and Play and Power Management
- Introduction to Plug and Play and Power Management
- Plug and Play and Power Management Support in WDF
- Callback Sequences for Plug and Play and Power Management
- How to Implement Plug and Play and Power Management in WDF Drivers
- Plug and Play and Power Management in Software-Only Drivers
-
Plug and Play and Power Management in Simple Hardware Drivers
- Device Power-Up Initialization and Power-Down Teardown
- Power Management for Queues in Hardware Function Drivers
- UMDF Example: Plug and Play and Power Code in a Protocol Function Driver
- KMDF Example: Plug and Play and Power Code in a Simple Hardware Function Driver
- Framework Actions for a Simple Hardware Function Driver
- Advanced Power Management for KMDF Drivers
-
8. I/O Flow and Dispatching
- Common I/O Request Types
- I/O Transfer Types
- I/O Request Flow
- I/O Request Objects
- I/O Queues
- I/O Event Callbacks
- Completing I/O Requests
- Canceled and Suspended Requests
- Adaptive Time-outs in UMDF
- Self-Managed I/O
-
9. I/O Targets
- About I/O Targets
- I/O Target Creation and Management
- I/O Request Creation
- Memory Objects and Buffers for Driver-Created I/O Requests
- I/O Request Formatting
-
How to Send an I/O Request
- KMDF methods to format and send synchronous I/O requests
- Options for Sending Requests
- UMDF Example: Send a Request to the Default I/O Target
- KMDF Example: Send and Forget
- KMDF Example: Format and Send an I/O Request to an I/O Target
- How to Split an I/O Request into Smaller Requests
- KMDF Example: Reuse an I/O Request Object
- How to Cancel a Sent Request
- File Handle I/O Targets in UMDF Drivers
- USB I/O Targets
- Guidelines for Sending I/O Requests
-
10. Synchronization
- When Synchronization Is Required
- WDF Synchronization Features
- Synchronization Scope and I/O Callback Serialization
- KMDF Wait Locks and Spin Locks
- Synchronization of I/O Request Cancellation in KMDF Drivers
- Summary and General Tips for Synchronization
-
11. Driver Tracing and Diagnosability
- WPP Software Tracing Basics
- Trace Message Functions and Macros
- How to Support Software Tracing in a Driver
- Tools for Software Tracing
- How to Run a Software Trace Session
- Best Practices: Design for Diagnosability
- 12. WDF Support Objects
- 13. UMDF Driver Template
-
7. Plug and Play and Power Management
-
IV. Additional Topics for KMDF Drivers
- 14. Beyond the Frameworks
- 15. Scheduling, Thread Context, and IRQL
- 16. Hardware Resources and Interrupts
-
17. Direct Memory Access
- Basic DMA Concepts and Terminology
- DMA-Specific Device Information
- Windows DMA Abstraction
- Implementing DMA Drivers
- Testing DMA Drivers
- Best Practices: Do’s and Don’ts for DMA Drivers
- 18. An Introduction to COM
-
V. Building, Installing, and Testing a WDF Driver
- 19. How to Build WDF Drivers
-
20. How to Install WDF Drivers
- Driver Installation Basics
- WDF Driver Installation Considerations
- WDF Driver Package Components
- How to Create an INF for a WDF Driver Package
- Examples of WDF INFs
- How to Sign and Distribute a Driver Package
- How to Distribute the Driver Package
-
How to Install a Driver
- Considerations for Test Installations
- Considerations for Release Installations
- How to Install a Driver by Using the PnP Manager
- How to Install a Driver by Using DPInst or DIFxApp
- How to Install a Driver by Using a Custom Installation Application
- How to Install or Update a Driver by Using DevCon
- How to Update a Driver by Using Device Manager
- How to Uninstall a Driver
- Driver Installation Process
- Uninstall Actions
- How to Troubleshoot WDF Driver Installation Problems
-
21. Tools for Testing WDF Drivers
- Getting Started with Driver Testing
-
Driver Verifier
- When to Use Driver Verifier
- How Driver Verifier Works
- How to Run Driver Verifier
-
Driver Verifier Examples
- Example 1: Activate Standard Options for a List of Drivers
- Example 2: Activate Specific Options for All Drivers
- Example 3: Start or Stop the Verification of a Driver without Rebooting
- Example 4: Activate or Deactivate Options without Rebooting
- Example 5: Deactivate All Driver Verifier Options
- Example 6: Deactivate Driver Verifier
- Example 7: Use Low Resources Simulation
- Example 8: Use Force IRQL Checking
- How to Use Driver Verifier Information during Debugging
- KMDF Verifier
- UMDF Verifier
- Application Verifier
- Best Practices for Testing WDF Drivers
-
22. How to Debug WDF Drivers
- About WDF Debugging Tools
- WinDbg Basics
- How to Prepare for UMDF Debugging
- How to Prepare for KMDF Debugging
- UMDF Walkthrough: Debugging the Fx2_Driver Sample
- KMDF Walkthrough: Debugging the Osrusbfx2 Sample
- How to View Trace Messages with WinDbg
- How to Use WinDbg to View the KMDF Log
- More Suggestions for Experimenting with WinDbg
-
23. PREfast for Drivers
- Introduction to PREfast
- How to Use PREfast
- Coding Practices that Improve PREfast Results
- How to Use Annotations
- General-Purpose Annotations
-
Driver Annotations
- Basic Driver Annotations and Conventions
- Conditional Annotations
- Function Result Annotations
- Type-Matching Annotations
- Pointer Annotations
- Constant and Non-Constant Parameter Annotations
- Format String Annotations
- Diagnostic Annotations
- Annotations for Functions in __try Statements
- Memory Annotations
- Nonmemory Resource Annotations
- Function Type Class Annotations
- Floating-Point Annotations
-
IRQL Annotations
- Annotations for Specifying Maximum and Minimum IRQL
- Annotations for Specifying Explicit IRQL
- Annotations for Raising or Lowering IRQL
- Annotations for Saving and Restoring IRQL
- Annotations for Maintaining the Same IRQL
- Annotations for Saving and Restoring IRQL for I/O Cancellation Routines
- IRQL Annotation Examples
- Tips for Applying IRQL Annotations
- DO_DEVICE_INITIALIZING Annotation
- Annotations for Interlocked Operands
- Examples of Annotated System Functions
- How to Write and Debug Annotations
- PREfast Best Practices
- Example: Osrusbfx2.h with Annotations
-
24. Static Driver Verifier
- Introduction to SDV
- How SDV Works
- How to Annotate KMDF Driver Source Code for SDV
- How to Run SDV
- How to View SDV Reports
- KMDF Rules for SDV
- Example: Walkthrough SDV Analysis of Fail_Driver3
- KMDF Callback Function Role Types for SDV
- Glossary
- A. Microsoft Press Support Information
- Index
- About the Authors
- Copyright
Product information
- Title: Developing Drivers with the Windows® Driver Foundation
- Author(s):
- Release date: April 2007
- Publisher(s): Microsoft Press
- ISBN: 9780735623743
You might also like
book
Linux Device Drivers, 3rd Edition
Device drivers literally drive everything you're interested in--disks, monitors, keyboards, modems--everything outside the computer chip and …
book
Mastering Linux Device Driver Development
Master the art of developing customized device drivers for your embedded Linux systems Key Features Stay …
book
Linux Device Drivers Development
Learn to develop customized device drivers for your embedded Linux system About This Book Learn to …
book
Linux Device Driver Development - Second Edition
Get up to speed with the most important concepts in driver development and focus on common …