Clone this wiki locally
libwdi: a Windows Driver Installer library for USB devices
Table of Contents
The aim of this project is to provide Windows application developers and driver makers, with a convenient way of extracting and installing USB drivers on end-users systems. Such drivers can then be used with, but not limited to, libusb applications using libusb, libusb-win32 or libusbK.
If you have a question that cannot be answered in these pages, your best option is to send a mail to the libwdi-devel mailing list (registration required). Or you can also try to e-mail developers directly.
Alternatively, you can also use the github facility to log an issue.
- Automated signed driver package creation and installation, using the name reported by the USB device
- No security warnings during driver installation, when running in elevated mode
- One-off WCID device driver installation support, so that no further driver installation is required for any WCID device of the same type
- Dual 32 and 64 bit platform support
- Supports any Windows platforms, from Windows XP up to Windows 10
- Single library that can be statically or dynamically linked to your application in order to provide driver installation facilities at runtime
- Embedding of WinUSB (libusb, LibUsbDotNet, native), libusb-win32, libusbK or your own USB drivers (eg. WHQL)
- libusb-win32 filter driver support
- UAC elevation, where necessary
- Full locale support with UTF-8 API strings and UTF-16 autogenerated inf files
- Resolution of USB Vendor IDs, based on the USB ID Repository
- Fully Open Source (LGPL v3), with many example applications
- Supports MinGW, MinGW-w64, Visual Studio, WDK
libwdi v1.2.5, released 2016.01.22 (ChangeLog)
Zadig, a standalone driver installer GUI application, built on libwdi.
As a Free Software developer, there's nothing more frustrating than having to reinvent the wheel while harbouring a strong suspicion that someone, somewhere, might already have solved a similar issue. On the other hand, googling around and looking through scores of FOSS code listings to find that particular section of code which might be of interest to you is quite time consuming. Wouldn't it be just swell if the developers simply gave an detailed, high level overview of the problems they solved, whose solutions they think you can reuse?
The following page does just that and goes through a list of the features we implemented, which you might be interested in (provided your license is compatible with LGPL):
The following development environments are currently supported for libwdi on Windows:
MinGW (32 bit) or MinGW-w64. To compile a library that is both 32 and 64 bit compatible, you should use a version of MinGW-w64 that supports both
-m64(a.k.a. "multilib"). TDM64 is a good MinGW-w64 distribution under Windows which fulfils this requirement.
- Microsoft Visual Studio 2013 Community Edition, which is freely available for anyone wishing to recompile, run or debug libwdi.
Windows DDK build environment, which is freely available, through the use of the
ddk_build.cmdfile. This will also produce all of 32, 64 or 32+64 bits binaries. Note that if you want to produce libwdi applications that are compatible with all supported platforms from XP onwards, you will need to use the Windows XP WDK build environment for the 32bit builds and Windows Server 2003 build environment for the 64bit build.
The current development tree is available from our github repository.
For those not familiar with git, here are the git commands you can use retrieve and compile libwdi:
git clone git://github.com/pbatard/libwdi.git ; retrieve development branch (this only needs to be done once) git pull ; for further updates, once the clone has been done
If you don't want to use git from the commandline, you can use TortoiseGit to access and keep in sync with the git repository. Note that before you can install TortoiseGit you need to install MSysGit.
Also note that, for MinGW you need to run
./autogen.sh (after editing it according to your paths) or run the autotools creation utilities, in order to have configure and Makefile created for you.
To create projects relying on libwdi, please refer to how the sample executables zadic, wdi-simple (console) or zadig (GUI) are compiled.
- Because driver installation requires administrative privileges, but enumeration does not, the library compiles and embeds a 32/64 bit installer which will require elevation on platforms supporting UAC (Windows Vista and later).
- The project also uses a customer embedder to include the required driver resources (DLLs, 32 and 64 bit installer) along with any files you want to add (eg. signed inf).
- The reliance on
DifXAPI.dll, which we originally used, was dropped early on as the DLL is not available by default on XP and embedding it would drastically increase the binary size.
- It is possible to produce a 32 bit library that is 32+64 bit compatible, but the opposite is not true. As such, when compiling for 64 bit, 32 bit compatibility will be removed to make the library smaller.
- Downloading vs embedding of the driver files
- 7z based improved embedder
- Standalone signing utilities for the MinGW-w64 project
- libusb-win32 filter driver support
- WCID driver support
- provision of a custom GUID and other inf features
- self signed
.catcreation, for promptless install
- disabling of the creation of a restore point
- trusted publisher certificate installation for promptless install
- cross-compilation & embedder improvements
- GUI sample application (Zadig)
- allow the editing of the device name
- MinGW/cygwim/MSVC/DDK support
- 32 and 64 bit support and compilation time detection
- UAC elevation
- retrieval of device name
- Writing a Device Installation Application
- Determining Whether a Device Is Plugged In and removal of phantom devices
- Installer Detection for 32 bit applications
- Embedding manifests (for UAC elevation) with the DDK build environment
- Troubleshooting Device Installation with the SetupAPI Log File
- Debugging Device Installation in Windows Vista
- How To Browse for Folders from the Current Directory
- UI design guidelines from MSDN
- Setting Visual Styles
- Creating Status Bars
- How Windows elects the driver to use against a newly plugged device
- Using INX Files to Create INF Files
- Summary of INF Sections
- Microsoft's cryptographic functions
- Cryptographic Utilities by Michel Gallant