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. Django小知识点整理

    一.Django中Choices字段显示中文的两种方式 1.get_xxxx_display():这种方式只能针对对象来使用 {% for row in server_list %} <li&g ...

  2. SKLearn数据集API(二)

    注:本文是人工智能研究网的学习笔记 计算机生成的数据集 用于分类任务和聚类任务,这些函数产生样本特征向量矩阵以及对应的类别标签集合. 数据集 简介 make_blobs 多类单标签数据集,为每个类分配 ...

  3. 【CF 453A】 A. Little Pony and Expected Maximum(期望、快速幂)

    A. Little Pony and Expected Maximum time limit per test 1 second memory limit per test 256 megabytes ...

  4. 在Eclipse中修改web项目的名称

    在Eclipse中修改web项目的名称 一.误区: 单击要修改名称的项目上右键Refactor->Rename,然后修改成另外一个名称 (光这样是不够的,哪怕你再修改web.xml中的displ ...

  5. [BZOJ5291][BJOI2018]链上二次求和(线段树)

    感觉自己做的麻烦了,但常数似乎不算差.(只是Luogu最慢的点不到2s本地要跑10+s) 感觉我的想法是最自然的,但不明白为什么网上似乎找不到这种做法.(不过当然所有的做法都是分类大讨论,而我的方法手 ...

  6. hdoj 4450 Draw Something 水题

    Draw Something Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Tota ...

  7. CentOS7LINUX 内核调试符号安装

    yum install -y kernel-devel # debuginfo,在CentOS7中需要这样装 sudo vim /etc/yum.repos.d/CentOS-Debuginfo.re ...

  8. c#分页工具类,完美实现List分页

    using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace Proje ...

  9. vim 之cscope的使用

    http://www.mcuos.com/thread-8488-1-1.html http://blog.csdn.net/longerzone/article/details/7789581 ht ...

  10. MySQL 5.5版本解决中文乱码问题时my.ini内[mysqld]项中不能再写default-character-set=utf8

    来看看如何解决乱码问题: 在mysql中默认字符集是latin1, 想要设置字符集为uft-8,可以在 my.cnf 文件中添加以下设置: [client] default-character-set ...