- Published on
Communicating with a USB Device Using WinUSB 4: Driver Distribution and Installation
- Authors

- Name
- Daisuke Kobayashi
- https://twitter.com
Finally, I will write about how to install the driver. In other words, this is about how to distribute the driver to end users. These are notes from trying various things in my own environment.
There are two installation methods.
- Install from Device Manager
- Install with
dpinst.exe
1. Installing from Device Manager
In Device Manager, update the driver, or if the USB device is not recognized, use the wizard that appears and point it to the folder containing the driver.
This approach forces the user to do things like selecting a folder manually, but it has the advantage that even if multiple INF files are placed in the same folder, the wizard automatically finds the correct INF file based on the device's VID and PID.
The DLLs distributed with the driver are the same, and the only part that needs to vary from device to device is the INF file. So this method has the advantage that distribution files for multiple devices can be kept together in a single folder.
2. Installing with dpinst.exe
dpinst.exe launches the driver installation wizard. It is included with WinDDK by default.
dpinst.exe: WinDDK\BuildNumber\redist\DIFx\dpinst\MultiLin\CPUArch
Place dpinst in the same folder as the INF file and run it. (This was also shown in the second folder layout example.) Just running it launches the wizard automatically. You can also customize the icon, software license, wizard images, and so on by modifying the XML file. A sample is included under WinDDK\BuildNumber\src\setup\DPInst.
The advantage of distributing the driver with dpinst is that it can be run as a wizard-style installer. It can also install the driver even when the device is not connected, and installed drivers are registered in Add/Remove Programs in Control Panel, which makes it more user-friendly.
On the other hand, if the same folder contains multiple INF files, it may perform installation once for each INF file. Also, when distributing it, you need different dpinst binaries for each CPU architecture, so management becomes slightly more troublesome on the developer side.
Method 1 naturally leads to longer manuals. Personally, I think method 1 is nice because it can be unified more easily, but method 2 is certainly simpler for users.
Finally, I will list the references I used while writing this series. Much of the sample source code I implemented was basically a lightly class-wrapped cleanup of what appears in the references.
References
Windows Driver Foundation (WDF)
The material below is in English, but it is the first thing you should read. Most of what I wrote in this series is based on what is explained there.
How to Use WinUSB to Communicate with a USB Device
The reference below is useful for understanding the overall picture of device driver development on Windows.
Interface Magazine, February 2010
If you want to understand USB communication specifications and related topics, the following material is also helpful. It covers things like USB connector shapes and communication specifications.