WDK编译libwdi
1.获得源码
http://sourceforge.net/projects/libwdi/
下载libwdi-1.2.2.tar.gz
2.配置环境
安装WDK,我用的是7.0
下载libusb-win32 和 libusbK 的二进制文件
然后,修改config.h文件在libwdi-1.2.2\msvc\下
/* embed WinUSB driver files from the following DDK location */
#ifndef DDK_DIR
#define DDK_DIR "C:/WinDDK/7600.16385.1"
#endif
/* embed libusb0 driver files from the following location */
#ifndef LIBUSB0_DIR
#define LIBUSB0_DIR "H:/wdi/libusb-win32-bin-1.2.6.0"
#endif
/* embed libusbK driver files from the following location */
#ifndef LIBUSBK_DIR
#define LIBUSBK_DIR "H:/wdi/libusbK-3.0.5.16-bin/bin"
#endif
/* DDK WDF coinstaller version */
#define WDF_VER 1009
分别修改为自己的路径,否则会无法生成embedded.h文件,然后报错 libwdi-1.2.2\libwdi\libwdi.c(39) : error C1083: Cannot open include file: 'embedded.h': No such file or directory
3.编译
启动wdk进入libwdi的目录,执行 ddk_build.cmd,然后就得到libwdi.lib文件了,如果想要dll文件可以修改ddk_build.cmd文件实现