Join GitHub today
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 Windows platforms from Windows 7 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 and MinGW-w64
libwdi v1.3.0, released 2017.04.18 (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", which the current MinGW-w64 sadly does not properly support).
- Microsoft Visual Studio 2017 Community Edition, which is freely available for anyone wishing to recompile, run or debug libwdi.
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.
- 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 was not available 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.
- 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