How Driver Installation Works

The last few months I've been working on the WDF 1.7 (UMDF+KMDF) coinstallers (that's one of the reasons that I've been silent for quite some time).

Through this process I managed to learn a lot of things about how driver installation works and what is required by the driver developer. Unfortunately, this area is often a black box for driver developers, since their job ends, after the driver is up and running (and hopefully tested :) ). However, it's possible that you might want the driver installation to do something "more", e.g. change the icon of the device in the device manager or add a page in the device manager that shows the driver capabilities, etc. This is when a coinstaller or a class installer is needed.

Let's start from the beginning though. If you have a driver, then how do you install it? The easy way is OSR's Driver Loader. Just point to your sys file, click "Register Service" (i.e. create the appropriate settings in the registry at HKLM\System\CurrentControlSet\Services\<Driver Name>) and "Start Service" (i.e. call the Service Control Manager APIs that load the driver according to the registry settings). If you want to remove the driver, just click on "Stop Service" (stops the driver from running) and "Unregister Service" (deletes the registry settings). Easy, right? You don't need an inf file or anything more apart from your driver. However, this program supports non-pnp (legacy) drivers only.

For WDF drivers we provide a coinstaller (one for UMDF and one for KMDF). The main tasks of the coinstaller is to upgrade the framework (e.g. from 1.5 to 1.7), parse the inf file and configure the driver correctly. In the past, we've had some issues with the previous versions of the coinstallers, as shown by Bob Kjelgaard (part 1, part 2, part 3), however we're trying our best to tackle them. By the way, if you have any problems with the installation of a WDF driver, please look at the Doron's post for information on how to debug it and at Bob's post for information about how you can ask more help from Microsoft.

Microsoft has lots of useful information on Driver Installation at http://www.microsoft.com/whdc/driver/install/default.mspx, however I'd also like to point specifically to:

  • Eugene Lin and Jason Cobb's channel9 video: Introductory overview on how the user-mode Plug-and-Play manager works and how the installation works from the point that the device is connected to the machine, until the corresponding driver is selected and the device is running
  • Jim Cavalaris' presentation on coinstallers and class installers: Excellent presentation that shows how the class installers and the coinstaller cooperate during driver installation. Also look at the resources, which are provided at the last page.
  • Debugging Device Installation on Windows Vista: Everything that you wanted to know (and even more than that!) about how to debug problems during device installation (and were afraid to ask)
  • Device Installation Design Guide: Microsoft's official documentation on everything that has to do with device installation