WDK VC2008 开发调试Win7 64位驱动详细步骤 转载

WDK VC2008 开发调试Win7 64位驱动详细步骤 (2017-04-12 22:43:10)转载▼
标签: it
经本人反复尝试成功搭建并能调试 WIN7 64位驱动,写成博客备忘以供不时之需。

严格按照以下步骤,就可以开发和调试

需要的工具和条件:

WIN7 64位电脑一台

WDK7.1文件GRMWDK_EN_7600_1.ISO

ddkwizard+ddkbuild_bat+ddkbuild_cmd.rar

InstSrv.exe

DebugVieiw.exe

64Signer.exe(数字签名用,可有可无)

VMWare9 安装WIN7 64位虚拟机一台,测试驱动使用。

环境搭建步骤:

1.首先必须要在WIN764位电脑上来安装VS2008,XP电脑貌似无法开发WIN7 64位的东西(试过没成功)。

2.从MS下载和安装WDK7.1 光盘 GRMWDK_EN_7600_1.ISO(自己找就行了),注意安装时不要选DSF.

3.从CSDN下载 ddkwizard+ddkbuild_bat+ddkbuild_cmd.rar 运行ddkwizard ,把ddkbuild.bat ddkbuild.cmd复制到DDK的根目录,如 E:\WINDDK

4.系统环境变量 path后追加 E:\WINDDK ,新建两个系统环境变量 W7BASE WLHBASE 值都是 E:\WINDDK\7600.16385.1

5.启动VS2008 ,进入VC开发环境,工具->选项->项目和解决方案->VC++目录

包含目录 E:\WINDDK\7600.16385.1\inc

库目录 E:\WINDDK\7600.16385.1\lib

6.文件->新建->项目->Visual C++->DDK Project ->Empty driver

名称 EmptyDriver1

确定

7.解决方案 -> Source File ->右键->添加->新建项->C++文件 ->test.c

如果产生的是test.cpp 则 F2改为 test.c,输入以下内容

include

VOID DriverUnload(PDRIVER_OBJECT driver)
{
DbgPrint(“[Test] Hello DriverUnload\r\n”);
}

NTSTATUS DriverEntry(PDRIVER_OBJECT driver,PUNICODE_STRING reg_path)
{
DbgPrint(“[Test] Hello,DriverEntry!\r\n”);
driver->DriverUnload=DriverUnload;
return STATUS_SUCCESS;
}

  1. 选择 W7X64 Checked ,生成解决方案

9.复制 DebugView.exe InstSrv.exe到虚拟机

10.进入虚拟机,Regedit->HKEY_LOCAL_MACHINE->SYSTEM->Current Control Set ->Control->Session Manager 结点右健,新建->项 Debug Print Filter

加入一个DEFAULT DWORD值 0XF,重启虚拟机,重启时按F8选 禁止驱动强制签名 方式启动

  1. 将生成的 EmptyDriver1.sys复制到虚拟机桌面,InstSrv.exe ->选择桌面的 EmptyDriver1.sys 安装,先不要启动驱动,此时运行起 DebugView.exe -> Capture Kernel , InstSrv界面点启动驱动。此时就可以看到驱动的调试信息输出在 DebugView.exe 里面了。

启动驱动时,WIN7会弹出一个需要数字签名的提醒,不用管它只是个提示,关掉它就行。

12.也可以用64Signer对sys签名,但测试时需要对虚拟机进行:

以管理员身份运行cm

BCDEDIT - SET TESTSIGNING ON

BCDEDIT - SET TESTSIGNING OFF

打开或关闭系统的调试模式,重启

至此就完成了 WDK+VS2008+WIN7 X64 环境的搭建,和驱动框架的编写和调试。

写这些东西也是为了自己以后再用到时,能够快速拿过来做参考。

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.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值