Install (original) (raw)

Installing and compiling libwdi

Table of Contents

Latest official release

The latest official release of libwdi can be downloaded here. Or you can also use git to retrieve the latest development tree.

Prerequisites

Compilation of libwdi is supported for the following environments, with the restrictions indicated below:

Depending on the driver files you are planning to enable in libwdi, you may also require:

MinGW compilation also requires the following packages to be installed:

Configuration & Compilation

IMPORTANT: If you are not using the WDK 8 redistributable components, you must edit your config.h and set WDF_VER to the relevant WDF version. For instance, if you used the WinUSB installer files from WinDDK 7600.16385.0, you should use: WDF_VER=1009 (when compiling with MS compilers) or add the option --with-wdfver=1009 when invoking configure (MinGW).

Provided that you have one of the environments highlighted above and retrieved the source (either from a tarball or the git repository), you need to configure the building of libwdi as follows:

Using a custom driver file with libwdi

If you have a custom driver that you would like to use with libwdi (eg, a custom USB .sys file and DLL, or a driver with a signed .inf+.cat), you can configure libwdi to install your driver instead of libusb0/libusbK/WinUSB:

  1. Create a directory containing all the required driver files you need to embed in the library. This directory will be parsed recursively when creating the library, and recreated with the exact same structure (but in the libwdi user directory) before installation.
  2. Use either the --with-userdir option when running configure (MinGW/cross-compilation) or set the #define USER_DIR in msvc/config.h (MS environments) to point to the directory above. You can also setup the WinUSB, libusb0 or libusbK directories if you want to include these driver files as well.
  3. In your application, use wdi_prepare_driver() with the driver_type set to WDI_USER for the options parameter (or, if this is the only driver embedded, you can leave the options blank) and call wdi_install_driver with the name of your inf file.

Notes:

  1. Unless you manually edit libdwi/embedder_files.h it is not possible to differentiate between a 32 bit or 64 bit install, so both the 32 and 64 bit driver files must be included in your directory
  2. Because it is impossible for libwdi to guess how the inf file for a custom driver should be generated, you must provide your own inf file along with the driver, and set all its parameters accordingly.