Wednesday, June 4, 2008

How to Write a Windows XP Driver

How to Write a Windows XP Driver

Summary: This document describes the steps you should take to create a Microsoft® Windows® XP driver for your device.

To create a Windows XP device driver:

1. Install the current Windows DDK. Read the system requirements and installation instructions in the stand-alone Getting Started HTML file supplied with the DDK.

2. Read Getting Started with Windows Drivers. This document guides you through the planning and decision-making process involved in making a Windows device driver from design through distribution. You should also look through the DDK documentation for device-type-specific information.

The DDK documentation set has the following device-type-specific nodes:
· Battery Devices
· Display and Print Devices
· IEEE 1284.4 Devices
· Interactive Input Devices
· Modem Devices
· Multifunction Devices
· Network Devices and Protocols
· Parallel Ports and Devices
· Serial Ports and Devices
· Smart Card Devices
· Still Image Devices
· Storage Devices
· Streaming Devices (Video and Audio)
· Devices Requiring VDDs

3. IDE bus are described in System Support for Buses. Driver development for most device types also requires a strong understanding of Windows operating system fundamentals, which are described in Kernel-Mode Driver Architecture.

4. Look through the driver source code provided with the DDK for a sample that represents your device type. Use the sample code where possible, modifying it for your device's specifics.

5. The sample code can enhance your understanding of Windows XP driver implementation requirements and speed your development time.

6. Compile and build your driver. This should be done using the Build utility and not some other compiler, because the Build utility has certain features that are necessary for driver development.

7. Obtain a checked build of Windows XP, so that you can test and debug your driver using free and checked system builds.

8. The checked build of Windows XP provides extensive kernel-mode debugging capabilities not available in the free build.

9. Create an INF file so that you can install and test your driver.

10. Test and debug your driver. You should use Driver Verifier, a program that puts your driver through a variety of tests, stresses, and deliberate failures in order to test its response and reliability in many extreme situations. You should also use a debugger. Microsoft provides several powerful debuggers that can monitor and debug kernel-mode and user-mode drivers. Using Driver Verifier in conjunction with these debuggers, on both the checked and free versions of the operating system, can be a powerful way to test your driver.

11. Provide an installation package so that customers can install devices that use your driver.

12. Submit your driver and installation package to Microsoft so that it can be digitally signed.
There are many resources available to you while developing your driver. The following sites describe some of the support available to you:
a. describes how to obtain the current DDK and provides other information, such as a driver development reading list.
b. provides information, such as device-type-specific white papers and late-breaking news, and a list of resources available to driver developers.
c. contains DDK product support information.