This paper provides information about writing drivers for the Microsoft Windows family of operating systems. It describes a number of common errors and suggests how driver writers can find, correct, and prevent such errors.
Included in this white paper:
| • | User-Mode Addresses in Kernel-Mode Code |
| • | Probing |
| • | Addresses Passed in METHOD_NEITHER IOCTLs and FSCTLs |
| • | Pointers Embedded in Buffered I/O Requests |
| • | Using Handles in User Context |
| • | Driver I/O Methods and Their Tradeoffs |
| • | Buffered I/O |
| • | Direct I/O |
| • | Neither Buffered nor Direct I/O (METHOD_NEITHER) |
| • | Device State Validation |
| • | Cleanup and Close Routines |
| • | Device Control Routines |
| • | Synchronization |
| • | Shared Access |
| • | Locks and Disabling APCs |
| • | Handle Validation |
| • | Requests to Create and Open Files and Devices |
| • | Opening Files in the Device Namespace |
| • | Long File Names |
| • | Unexpected I/O Requests |
| • | Relative Open Requests for Direct Device Open Handles |
| • | Extended Attributes |
| • | Driver Unload Routines |
| • | Work Items |
| • | Driver-Created Threads |
| • | Timers 28 |
| • | Queued DPCs |
| • | IoCompletion Routines |
| • | Pageable Drivers and DPCs |
| • | User-Mode APIs |
| • | NtReadFile and NtWriteFile |
| • | TransmitFile |
| • | StartIo Recursion |
| • | Passing and Completing IRPs |
| • | Copying Stack Locations Incorrectly |
| • | Returning Incorrect Status for an IRP That the Driver Does Not Handle |
| • | Losing IRPs or Completing Them More Than Once |
| • | Returning Incorrect Status from an IRP That the Driver Issues |
| • | Odd-length Unicode Buffers |
| • | Pool Allocation in Low Memory |
| • | Call to Action and Resources |