首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 服务器 > 云计算 >

Libwdi 编译装配

2013-10-18 
Libwdi 编译安装Libwdi 编译安装1.编译工具可以采用MinGW,MinGW-w64,Microsoft Visual C (Visual Studio)

Libwdi 编译安装

Libwdi 编译安装

1.     编译工具

可以采用MinGW,MinGW-w64,Microsoft Visual C++ (Visual Studio)等编译,但最好的是采用Windows DDK build environment进行编译,为了支持XP系统,建议编译环境设置在XP上,否则从win7等系统编译出来的libwdi.dll不能再XP上使用。

编译步骤如下:

1)        下载并安装winddk;

a)        从http://www.microsoft.com/en-us/download/details.aspx?id=11800下载WDK,目前是7.1.0版本;

b)        解开ISO文件,执行 KitSetup.exe,选择除模拟环境之外的选项进行安装,比如安装到 D:/WinDDK/7600.16385.1 目录下;

2)        下载源码

从 http://sourceforge.net/projects/libwdi/下载最新的libwdi源码,并解开到本地目录,比如:D:\Workroom\practise\open-source\libwdi-1.2.2

3)        下载辅助工具

从 http://code.google.com/p/usb-travis/下载 libusbK:libusbK-3.0.5.16-bin.7z

从 http://sourceforge.net/apps/trac/libusb-win32/wiki下载

libusb-win: libusb-win32-bin-1.2.6.0.zip

4)        编辑D:\Workroom\practise\open-source\libwdi-1.2.2\msvc\config.h

注:参考红色字体部分修改

/* config.h.  Manual config for MSVC.  */

 

#ifndef _MSC_VER

#warn "msvc/config.h shouldn't be included for your development environment."

#error "Please make sure the msvc/ directory is removed from your build path."

#endif

 

#if defined(_PREFAST_)

/* Disable "Banned API Usage:" errors when using WDK's OACR/Prefast */

#pragma warning(disable:28719)

#endif

 

/* embed WinUSB driver files from the following DDK location */

#ifndef DDK_DIR

//#define DDK_DIR "C:/Program Files (x86)/Windows Kits/8.0"

#define DDK_DIR "D:/WinDDK/7600.16385.1"

#endif

 

/* embed libusb0 driver files from the following location */

#ifndef LIBUSB0_DIR

#define LIBUSB0_DIR "D:/Workroom/practise/open-source/libusb-win32-bin-1.2.6.0"

#endif

 

/* embed libusbK driver files from the following location */

#ifndef LIBUSBK_DIR

#define LIBUSBK_DIR "D:/Workroom/practise/open-source/libusbK-3.0.5.16-bin"

#endif

 

/* embed user defined driver files from the following location */

#ifndef USER_DIR

// #define USER_DIR "C:/signed-driver"

#endif

 

/* DDK WDF coinstaller version */

//#define WDF_VER 1011

#define WDF_VER 1009

 

/* 32 bit support */

#define OPT_M32

 

/* 64 bit support */

#define OPT_M64

 

/* embed IA64 driver files */

//#define OPT_IA64

 

/* Debug message logging */

//#define ENABLE_DEBUG_LOGGING

 

/* Debug message logging (toggable) */

#define INCLUDE_DEBUG_LOGGING

 

/* Message logging */

#define ENABLE_LOGGING 1

 

5)        编译

a)        在“开始“-》”所有程序“-》”Windows Driver Kits”…下选择对应Windows XP的编译环境,会开一个命令行窗口

b)        Cd 到 D:\Workroom\practise\open-source\libwdi-1.2.2目录下,

执行:ddk_build.cmd DLL

正常情况下,编译成功,编译完以后的动态库就在D:\Workroom\practise\open-source\libwdi-1.2.2\libwdi.dll

6)        安装

将libwdi.dll拷贝到c:\windows\system32下即可

热点排行