1.安装vs2008 (这个不用多说了吧)
2.下载 安装WDK7.1.0 ,(安装包可能有点大慢慢下吧),安装过程一路下一步就可以了,
安装包地址 http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=11800
GRMWDK_EN_7600_1.ISO | 619.0 MB |
3.下载DDkWizard
下载地址 http://ddkwizard.assarbad.net/ 这个目前不支持Microsoft Visual Studio 2010
需要下载下面三个文件。
1、ddkwizard_setup.exe
2、ddkbuild_bat.zip
3、ddkbuild_cmd.zip
ddkwizard_setup.exe 也是一路下一步 ,默认安装就OK。
把winddk 下目录 7600.16385.1 改为 7600.16385.0
解压ddkbuild_bat.zip,ddkbuild_cmd.zip 拷文件到DDK安装目录,
如图:
4.下面就是环境变量的配置
计算机(右键)->属性-》高级系统设置-》高级-》环境变量
添加系统变量
变量名W7BASE 变量值: C:\WinDDK\7600.16385.0(DDK安装目录下子目录)
变量名PATH 变量值: C:\WinDDK(DDK安装目录);
5.vs2008配置
打开工具-》选项-》项目和解决方案-》vs++目录
在“显示以下内容目录” 下选择 可执行文件 添加 C:\WinDDK(DDK安装目录)
到此 配置完毕
6,测试程序
新建项目下多了一个DDkProject
选择Empty driver,新建 HelloDDK 项目 下面一路默认就OK了。
项目添加文件 HelloDDK.c (如果是.CPP 文件 可在源文件中加入extern "C" 关键字 声明为 c语言编译方式,不再多说);
添加代码测试如下:
#include <ntddk.h>
VOID DriverUnload(PDRIVER_OBJECT driver)
{
DbgPrint(("HelloEping\r\n"));
}
NTSTATUS DriverEntry(PDRIVER_OBJECT driver,PUNICODE_STRING reg_path)
{
DbgPrint(("Hello,Eping!"));
driver->DriverUnload=DriverUnload;
return STATUS_SUCCESS;
}
修改source文件
TARGETTYPE=DRIVER
SOURCES=默认也为空 我把它改成SOURCES=HelloDDK.c
下面开始编译 成功后可在工程目录下看到 .sys文件