wiki:libwdi/faq

Version 15 (modified by pbatard, 3 years ago) (diff)

--

(Next) (Back to Table of Content)
[TODO: organize this stuff]

Installation

How can I specify a custom signed inf/driver files for use with libwdi?

See the paragraph 'Using a custom driver file with libwdi' in the installation & compilation guide.

Compilation

Is it possible to cross-compile libwdi?

Currently, this is not possible as the compilation process requires custom embedding of the Windows driver files, and the custom embedder, which is built and called during compilation itself, is targeted at Windows platforms only. We will try to address this problem in an upcoming version.

How can I create a 32+64 bit compatible version of libwdi?

  1. Use Visual Studio (>= 2005) and select Win32 for the target. Note that Visual Studio Express cannot be used, as it doesn't include a 64 bit compiler.
  2. Use the Windows Driver Kit or DDK (v 7.x or later), and run ddk_build.cmd from one of the Windows XP 32 bit command prompts
  3. Use a multilib version of MinGW-w64. Multilib means a compiler that supports both the -m32 and -m64 options. Currently, the binaries provided on the project page are not multilib, so you need to recompile MinGW-w64 yourself.

How can I create Windows 2000 compatible version of libwdi?

Currently, the only supported way to do so is either to use MinGW32 or a multilib MinGW-w64.

How can I create a DLL with the DDK environment?

Run 'ddk_build DLL'. Make sure the DLL parameter is specified as uppercase.

I get "System error: -2147154677" when trying to convert the project files in Visual C++ Express 2010

Unfortunately, Microsoft's Visual C++ Express 2010 is a crippled version that cannot import project files that contain 64 bit builds. Currently, the only solution is to either not use Visual Studio Express 2010 or re-create the project files manually.

I get "fatal error RC1050: Cannot open include file 'afxres.h'." when compiling zadig with Visual Studio Express

This is because Visual Studio Express does not officially support MFC application. You can however get zadig compiled if you edit the 'zadig.rc' file and replace the line

#include "afxres.h"

with

#include <windows.h>
#define IDC_STATIC -1

I get "Warning: linker path does not have real file for library -lsetupapi/-lole32" when compiling with MinGW

Use the latest version of libtool (2.2.10 or later). If pre-built binaries are not available, you might have to recompile it from source.

I get "gcc.exe: CreateProcess?: No such file or directory" when compiling with MinGW

You are probably attempting to cross compile on an environment where the default gcc cannot produce executables. Because libwdi requires the compilation and execution of an embedder.exe native to the host, the host's default gcc must be able to produce executables that run on the compilation platform.

Running libwdi

Does libwdi support internationalization

Absolutely. The inf file created by libwdi is written in Unicode (UTF-16) format, to preserve any international characters, and the libwdi API calls and string parameters fully support UTF-8, meaning that you can name your devices with non English characters, or use directories in a different locale than English, and libwdi will happily process that data.

Is libwdi re-entrant/Can two libwdi applications concurrently access libwdi at the same time?

No. Just like Windows provides mechanisms to prevent simultaneous driver installations, most of the libwdi API calls will prevent concurrent access to libwdi to ensure that only one application at a time has the ability to install a system driver.

Is it possible to remove the UAC prompt during driver installation?

The UAC prompt end users get on Vista and later versions of Windows comes from the autogenerated inf not being signed by Microsoft. By default, when using an unsigned inf, Windows warns end users that the driver might not be trustworthy. The only way to prevent the security warning is to use an inf and cat file that have gone through Microsoft's WHQL/Windows Logo process.

Why is the driver installation slow?

If you have system restore points enabled (default for most installations), Windows will create a restore point before installing the driver. Depending on the system, this can be a fairly lengthy operation (20 seconds or more) that can not be disabled programmatically.

Are the extracted driver files removed after installation?

They aren't. The reason behind this is twofold. First, it is a bad idea to have an application running in elevated mode to delete files, as, if the extraction directory is user selected, we could end up deleting important data. Secondly, it is possible to use libwdi to setup the driver files for the next time the device is plugged in, in which case we must ensure that the files are still available.

Running Zadig

Development considerations

Why does lbwdi use a custom installer instead of Microsoft's redistributable dpinst.exe

The 2 main reasons are the size factor (each dpinst is about 1 MB in size or 300 KB compressed, whereas our installer is a lot smaller) as well as the ability to have greater control over the installation process. We might provide an option to embed and use dpinst in future versions of the library.