How to Write a Windows Driver

 

Microsoft Corporation

Created: July 2001

The current version of this information is maintained at https://www.microsoft.com/whdc/driver/foundation/default.mspx.

Applies to:
   The Windows Driver Development Kit

Summary: This document describes the basic steps for learning to create a driver for your device. The Windows DDK provides the development environment, tools, sample code, and documentation. (2 printed pages)

To create a Windows device driver:

  • Install the current Windows DDK. Read the system requirements and installation instructions in the stand-alone Getting Started file (Installs.htm) supplied with the DDK.

  • Read "Getting Started with Windows Drivers" in the DDK documentation. This document guides you through the planning and decision-making process involved in making a Windows device driver from design through distribution.

    Also refer to the DDK documentation for device-type specific information.

  • Look through the driver sample 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 specific needs.

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

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

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

    The checked build of Windows provides extensive kernel-mode debugging capabilities not available in the free build. For information, see Using Checked Builds of Windows.

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

  • 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. For information, see Debugging Tools for Windows.

    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. For information, see the Driver Verification page on WHDC.

  • Provide an installation package so that customers can install devices that use your driver. For information, see Device and Driver Installation.

  • Submit your driver and installation package to Microsoft so that it can be digitally signed. For information, see Driver Signing and File Protection.

There are many resources available to you while developing your driver. The following sites describe some of the support available to you: