| Version 35 (modified by pbatard, 3 years ago) (diff) |
|---|
libwdi: Windows Driver Installer library for usb devices
About
The aim of this project is to provide 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 like libusb 1.0 or libusb-win32.
If you have a question that cannot be answered in these pages, please send an e-mail to libusb-devel@….
Make sure you have '[libwdi]' in the e-mail subject so that your question is dealt with appropriately. Or you can also try to mail the developers directly.
Main Features
- Automated driverless device detection
- Automated inf creation, using the name reported by the USB device
- Automated driver files extraction, for both 32 and 64 bit platforms
- Automated driver installation, including UAC elevation where necessary
- A single library, embedding all the required files. Can be statically or dynamically linked to an application, so that driver installation can be taken care automatically of when required.
- Ability to produce a single library that runs and can install drivers on any platform from Windows 2000 to Windows 7
- Ability to produce a single library that runs and can install drivers on both 32 and 64 bit versions of Windows
Additional Features
- Allows the embedding and selection of WinUSB, libusb0.sys (from libusb-win32) or your own USB driver (eg. WHQL drivers)
- Full locale support. All API strings are UTF-8, and the generated inf is UTF-16
- Open Source, with a proprietary application friendly license (LGPL v2.1)
Status
v1.0.1 was released on 2010.09.01.
If you want to download the Zadig driver installer application, please visit the Driver Installation section of the libusb Windows backend page.
Documentation
- FAQ?
- Using Zadig (the GUI driver installer application)?
- Library Installation & Configuration?
- Library API Documentation & Usage?
Supported development 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.
- Microsoft Visual C++ (Visual Studio) 2008. Only the full version will allow you to produce 64 bit or or 32+64 bit binaries.
- Windows DDK build environment, which is freely available, through the use of the 'ddk_build.cmd' file. 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, you will need to use the Windows XP DDK build environment
- cygwin (32 bit only).
The recommended development environment to compile the library/apps is Windows DDK as it allows the building of a 32+64 bit compatible library, and ensures that the required WinUSB DLL files are available. If you need Windows 2000 compatibility, a multilib version of MinGW-w64 is the preferred development environment.
Source
- The current development tree is also available from the libusb git server in the libwdi repository.
For those not familiar with git, here are the git commands you can use retrieve and compile the Windows branch:
git clone git://git.libusb.org/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 or Git Extensions to access and keep in sync with the git repository. Git Extensions comes ready to use, but note that before you can install TortoiseGit you need to install MSysGit and make sure that, during the installation of MSysGit, when prompted to adjust the PATH environment, you select "Run Git from the Windows Command Prompt" (2nd option). Also, in the general settings of TortoiseGit, the MSysGit path must point to the MSysGit bin directory (eg: C:Program Files (x86)Gitin")
Also note that, for MinGW and cygwin, as with the libusb development tree, you need to run './autogen.sh' in order to have configure and Makefile created for you.
To create projects relying on libwdi, please refer to how the sample executables zadic (console) and zadig (GUI) are compiled.
Reusable Code Parts: Can our code solve your problems?
As a FOSS 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 v2):
Development Considerations
- Because the driver installation requires administrative privileges, but enumeration does not, the library compiled and embeds a 32/64 bit installer, that requires UAC 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). Note that since most of the DLLs are already compressed, there's not much space to be gained in using compression in the embedder.
- The reliance on DifXAPI.dll was dropped in w20, as the DLL is not available by default on XP and would 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.
To Do
- cross-compilation & embedder improvements
- downloading vs embedding of the driver files
In Progress
Done
- GUI sample application (beta)
- Documentation
- allow the editing of the device name
- libusb0.sys driver support
- MinGW/cygwim/MSVC/DDK support
- 32 and 64 bit support and compilation time detection
- UAC elevation
- retrieval of device name
- automated inf generation
Development's status log
Please consult the git log or the WDI section of the raw Activity Log.
Development Links
- 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