VS2008编译驱动程序的配置方法

编译驱动程序的常用方法有两种,一种是通过WDK/DDK的COMMAND环境进行编译,另外一种是通过Visual Studio系列软件实现界面编译。通过VisualStudio编译驱动程序需要对其进行相关配置,本文以VS2008和WDK7600为例,讲解了实现编译驱动程序的配置方法。

一、安装VS2008和WDK7600

安装路径为默认路径,即VS2008的安装路径为C:\ProgramFiles\Microsoft Visual Stuido 9.0,WDK7600的安装路径为C:\WinDDK。

二、下载ddkwizard、ddkbuild_bat和ddkbuild_cmd

其中ddkwizard的作用是产生驱动向导,通过该向导,使用VS2008就可以创建驱动程序文件;ddkbuild_bat和ddkbuild_cmd是驱动程序的编译环境。其中,ddkwizard对应的文件是ddkwizard_setup_v1.2.0a.exe,ddkbuild_bat对应的文件是ddkbuild_bat.zip,ddkbuild_cmd对应的文件是ddkbuild_cmd.zip。

这三个文件的下载地址是http://ddkwizard.asssarbad.net/

下载完成后,安装ddkwizard_setup_v1.2.0a.exe文件,并将ddkbuild_bat.zip和ddkbuild_cmd.zip解压缩后拷贝到WDK的安装根目录中,即C:\WinDDK中。

三、添加系统变量

在“我的电脑”右键菜单中选择“属性->高级->环境变量->系统变量->新建”中添加变量名,如图1所示。

 

新建的变量名为WXPBASE,变量值是WDK的目录,即C:\WinDDK\7600.16385.1。

四、在VS2008中为可执行文件添加目录

打开VS2008,在菜单栏中选择“工具(Tools)->选项(Options)”,如图2所示。之后选择“项目和解决方案(Projectsand Solutions)->VC++目录(VC++ Directories)”,在右侧的“显示以下内容的目录(Show directions for)”中选择“可执行文件(ExecutableFiles)”,接下来在下面的图标中选择“新行”添加WDK的根目录,即C:\WinDDK。

图2

五、在VS2008中为库文件添加目录

继续留在图2的对话框中,在右侧的“显示以下内容的目录(Showdirections for)”中选择“库文件(Library Files)”,并在下面的图标中选择“新行”添加WDK的库文件目录,即C:\WinDDK\7600.16385.1\lib\wxp\i386。

六、创建驱动程序

打开VS2008,新建项目,此时在“新建项目”对话框右侧的项目类型中就多了一个“DDK Project”选项,该选项即为之前安装的ddkwizard产生的向导,在右侧“模板”选项中选择“Driver”或者“Empty Driver”,接下来在DDK向导中选择使用的WDK/DDK的类型,需要注意的是不要选择“Create PREfast configuration”选项。

七、SOURCES文件的配置

如果在第六步中选择的是“Empty Driver”,则需要对驱动程序的SOURCES文件进行配置。在TARGETTYPE=之后加入DRIVER,表示驱动类型,之后添加SOURCE=XXX.cpp,其中XXX.cpp为添加到驱动程序中的文件;最后加入DDK的目录和头文件目录

DDKROOT=C:\WinDDK\7600.16385.1

INCLUDES=$(DDKROOT)\inc

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
DDKWizard is a so-called project creation wizard that allows you to create projects that use the DDKBUILD scripts from OSR (also available in the download section from this site). The wizard will give you several options to configure your project prior to the creation. Have a look at figure 1. Figure 2: Project creation dialog (click to enlarge) Instead of forcing you to use a subset of options and specific DDKs this wizard lets you choose what you want. Of course the template files are predefined and so is the content of the project(s) within certain limits. However, I tried to choose the best options that I could think of and provide a way to create quickly and easily the DDKBUILD project you want. This means that I tried to leave out those things that may limit your choice lateron and add other options that will give you the flexibility to change options quickly long after the project was created. DDKWizard adds a new subfolder in the project creation wizard - see figure 2 - and presents all supported project types there. Currently these are Driver, Empty Driver, Native Application, Win32 console application and Win32 DLL. In either case you just choose the type of project to create, give the name of the project and/or solution as well as other options (at the bottom) and you are being presented the wizard dialog (see figure 1). From the wizard dialog you choose the DDKBUILD script you want to use, the DDK or multiple DDKs as well as the other options. If you are curious about the Property Sheet feature, please download the manual and read the respective section there. Compatibility DDKWizard (1.2.0a) has been tested on the following configurations: Visual Studio Professional .NET with WNET DDK and DDKBUILD.CMD on Windows 2003 Server R2 Standard Visual Studio Professional .NET 2003 with WNET DDK and DDKBUILD.CMD on Windows 2003 Server R2 Standard Visual C++ 2005 Express with WNET DDK and DDKBUILD.CMD on Windows 2003 Server R2 Standard Visual Studio 2005 Professional with WNET DDK and DDKBUILD.CMD on Windows 2003 Server R2 Standard Visual Studio 2008 Professional with WNET DDK and DDKBUILD.CMD on Windows XP From this list one can deduce that it is supposed to also run if you got the respective "non-Express" Visual C++ version. Also if there has been some Visual C++ .NET 2003 Express DDKWizard is prepared for it. Download You could go watch the demo or download right away: Manual: contains the detailed description of how to configure DDKBUILD and use DDKWizard. If you are unsure whether you should download and install DDKWizard grab this file and skim over it. Download: ddkwiz_manual.pdf (~513kB, 2009-12-05@20-11-55, downloaded 31666 times) Installer (incl. manual) of DDKWizard 1.3.0a: this is the setup program which will install DDKWizard along with the manual on your computer and register it with Visual Studio. Download: ddkwizard_setup.exe (~557kB, 2009-12-05@20-12-37, downloaded 72787 times) DDKBUILD.CMD: Stable version 7.4/r60 of OSRs DDKBUILD NT script version. Feedback for this version can be sent to me directly. Download: ddkbuild_cmd.zip (~12kB, 2009-11-28@04-38-36, downloaded 20707 times) DDKBUILD.BAT (obsoleted by the above!): Version 6.12 of OSRs DDKBUILD batch script version. Download: ddkbuild_bat.zip (~6kB, 2008-03-21@15-59-07, downloaded 17226 times) Trunk version of DDKBUILD.CMD The version from trunk is available as well. Please note that this is not necessarily the same version as offered in the ZIP archive above. It may be in a better shape (e.g. reported bugs fixed) or slightly worse (e.g. new feature that is not yet stable). So use this version only if you want to test the latest development version and are able to provide feedback. Here is the link to the prettier ViewVC URL: ddkbuild/trunk - SVN clients get read-only access here. License All projects created by DDKWizard can be put under whatever license you like to put them. The scripts and HTML files which contain the DDKWizard logic are subject to the zlib license starting with version 1.2.0, before it was released under the GPL v2 from 1991. The zlib license is a lot more liberal and allows just about any kind of use for the script and "user interface" part of DDKWizard. The DDKBUILD scripts are mirrored with the permission of OSR. I will try to keep it synchronized at all times. Everything else Contact me here and also visit my blog and my website. Note that I usually announce new versions of DDKWizard and DDKBUILD on my blog - you also might want to subscribe to the RSS feed for DDKWizard and DDKBUILD. This page will be extended whenever I deem it necessary.
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值