Mark offers some third party utilities. That's good, but I will show a more handy way (IMHO): how to configure and use Visual Studio for compiling drivers.

Have Fun

  1. Setup Visual Studio 2008.
  2. Setup DDK (WDK).
  3. Add to VS paths DDK include files, libs and bins.
  4. Create new empty "Win32 project" and add source file (i.e. HelloWorld.c).
  5. Configure project properties (All Configurations):
    1. C\C++ - General - Debug Information Format = Program Database (/Zi)
    2. C\C++ - Preprocessor - Preprocessor Definitions = _X86_ [add also DBG for Debug config]
    3. C\C++ - Code Generation - Enable C++ Exceptions = No
    4. C\C++ - Code Generation - Basic Runtime Checks = Default
    5. C\C++ - Code Generation - Buffer Security Check = No (/GS-)
    6. C\C++ - Advanced - Calling Convention = __stdcall (/Gz)
    7. C\C++ - Advanced - Compile As = Compile as C Code (/TC) [if you are going to use plain C]
    8. Linker - General - Output File = $(OutDir)\$(ProjectName).sys
    9. Linker - General - Enable Incremental Linking = Default
    10. Linker - Input - Additional Dependencies = ntoskrnl.lib hal.lib $(NOINHERIT) [add needed libs here e.g. ntoskrnl.lib hal.lib]

      不用拷贝两个lib文件到项目根目录中,只需要在项目属性的链接器-> 常规中将附件库目录设置成DDK中对应的lib文件夹就可以,比如: C:\WinDDK\7600.16385.1\lib\wxp\i386。为什么要用wxp下的那?参考了这个文章,不然好像会报错:http://www.codeexperts.com/showthread.php?829-unresolved-external-symbol-security_cookie

    11. Linker - Input - Ignore All Default Libraries = Yes (/NODEFAULTLIB)
    12. Linker - Manifest File - Generate Manifest = No
    13. Linker - System - SubSystem = Native (/SUBSYSTEM:NATIVE)
    14. Linker - System - Driver = Driver (/DRIVER)
    15. Linker - Advanced - Entry Point = DriverEntry
    16. Linker - Advanced - Base Address = 0x10000
    17. Linker - Advanced - Randomized Base Address = Disable (/DYNAMICBASE:NO)

      (应该为默认值)

    18. Linker - Advanced - Data Execution Prevention (DEP) = Disable (/NXCOMPAT:NO)

    (应该为默认值)
     19. Linker-->Command Line:(我自己加的,在编译时有警告,应用解决方案后警告消失)

    Additional options = /SECTION:INIT,D /IGNORE:4078 /safeseh:no

          这项是为了去掉以下警告:

LINK : warning LNK4078: multiple 'INIT' sections found with different attributes (E2000020)

LINK : error LNK2001: 无法解析的外部符号__load_config_used

参考了这个文章: http://www.cnblogs.com/erika/articles/2427184.html

   6. OK. Done. Now you can test it with simple code, e.g.:

Hide   Copy Code

#include"ntddk.h"

NTSTATUS

DriverEntry(PDRIVER_OBJECT DriverObject,PUNICODE_STRING

RegistryPath)

{

return STATUS_UNSUCCESSFUL;

}

VS2008+Windows DDK 7的环境配置的更多相关文章

  1. VS2008+Windows DDK 7的环境配置(二)

    在第一篇的基础上,进行如下的步骤,就可以编译出X64的驱动程序. (建议再另外建一个项目,这样避免混淆,因为x86和x64编译的有些编译选项是不同的.) 1. 安装VS2008 x64 build 组 ...

  2. 【Objective-C】Windows下Objective-C开发环境配置

    [Objective-C]Windows下Objective-C开发环境配置 ftp://ftpmain.gnustep.org/pub/gnustep/binaries/windows/   最近打 ...

  3. Windows Server2008 R2 MVC 环境配置

    *:first-child { margin-top: 0 !important; } body>*:last-child { margin-bottom: 0 !important; } /* ...

  4. windows下spark开发环境配置

    http://www.cnblogs.com/davidwang456/p/5032766.html windows下spark开发环境配置 --本篇随笔由同事葛同学提供. windows下spark ...

  5. windows下apache+https环境配置

    windows下apache+https环境配置 转 https://www.cnblogs.com/sandaizi/p/7519370.html 1.修改配置文件conf/httpd.conf,去 ...

  6. Metabase在Windows下的开发环境配置

    Metabase在Windows下的开发环境配置 */--> pre.src {background-color: #292b2e; color: #b2b2b2;} Metabase在Wind ...

  7. 第一篇 Windows 8 开发Windows Metro style app环境配置

    半   饱问 题 到 我 这 里 为 止! 第一篇 Windows 8 开发Windows Metro style app环境配置 2012-09-24 08:24 by 半饱, 1289 阅读, 3 ...

  8. Windows驱动开发VS2012 DDK/WDK的环境配置

    [开发Windows驱动的配置是很必要的,下文将详细介绍VS2012如何配置驱动开发环境] [转载] 以下部分内容是转载博客:http://blog.csdn.net/huangxy10/articl ...

  9. VC/DDK/DriverWorks开发环境配置

    1·前言开发windows内核驱动程序是一个非常具有挑战性的工作,你得忍耐调试过程中操作系统 不断蓝屏.不断崩溃的噩梦,所以强烈建议你采用虚拟机做开发平台,这样即使把整个系统都搞蹦了,大不了从新装过虚 ...

随机推荐

  1. android 数据存储方式

    韩梦飞沙  韩亚飞  313134555@qq.com  yue31313  han_meng_fei_sha 1,文件 2,内容提供者 3,偏好设置 4,数据库 5,网络存储. 网络存储,就是上传到 ...

  2. ksyun主机挂载ksyun硬盘

    1.查看虚拟磁盘的设备号是 /dev/vdc ls /dev/vd*2.格式化块设备,强烈推荐ext4文件系统: mkfs.ext4 /dev/vdc 3.准备挂载点,建立挂载目录.例: mkdir ...

  3. 20162327WJH实验五——数据结构综合应用

    20162327WJH实验五--数据结构综合应用 实 验 报 告 课程:程序设计与数据结构 班级: 1623 姓名: 王旌含 学号:20162327 成绩: 指导教师:娄嘉鹏 王志强 实验密级: 非密 ...

  4. hdu 4417 区间内比h小的数 线段树

    题意求区间内比h小的数的个数 将所有的询问离线读入之后,按H从小到大排序.然后对于所有的结点也按从小到大排序,然后根据查询的H,将比H小的点加入到线段树,然后就是一个区间和. 2015-07-27:专 ...

  5. Any way to start Google Chrome in headless mode?

    Any way to start Google Chrome in headless mode? - Stack Overflow Any way to start Google Chrome in ...

  6. datagrid在MVC中的运用06-固定连续列

    本文主要体验datagrid的frozenColumns属性. □ frozenColumns效果: 在frozenColumns的列将保持不动,而其他列横向滚动. □ frozenColumns效果 ...

  7. MVC借助Masonry实现图文瀑布流

    借助Masonry可轻松实现瀑布流.本篇实现一个简单的图文瀑布流效果,如下: 图文瀑布流显示的2个要素是图片路径和文字内容,对应的Model为: namespace MvcApplication1.M ...

  8. c++11改进我们的程序之垃圾回收(一)

    c#和java中有自己主动垃圾回收机制,.net执行时和java虚拟机能够管理分配的堆内存,在对象失去引用时自己主动回收,因此在c#和jva中,  内存管理不是大问题.c++语言没有垃圾回收机制,必须 ...

  9. unity 脚本执行顺序设置 Script Execution Order Settings

     通过Edit->Project Settings->Script Execution Order打开MonoManager面板  或者选择任意脚本在Inspector视图中点击Execu ...

  10. mybatis 模糊查询和<![CDATA[ ]]>的作用

    1. sql中字符串拼接 SELECT * FROM tableName WHERE name LIKE CONCAT(CONCAT('%', #{text}), '%'); 2. 使用 ${...} ...