Skip to content
Pete Batard edited this page Sep 4, 2021 · 39 revisions

libwdi: a Windows Driver Installer library for USB devices

Table of Contents

Description

About

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.

Getting Support

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 the developers directly.

Alternatively, you can also use the github facility to log an issue.

Features

Main Features

  • 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

Additional Features

Downloads

Documentation

Reusable Code Parts: Can our code solve your problems?

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):

Development

Supported Environments

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 -m32 and -m64 (a.k.a. "multilib", which the current MinGW-w64 sadly does not properly support).
  • Microsoft Visual Studio 2019 Community Edition, which is freely available for anyone wishing to recompile, run or debug libwdi.

Source

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 Git for Windows.

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 wdi-simple (console) or zadig (GUI) are compiled.

Development Considerations

  • 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.

Links