VS2008+Windows DDK 7的环境配置
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
- Setup Visual Studio 2008.
- Setup DDK (WDK).
- Add to VS paths DDK include files, libs and bins.
- Create new empty "Win32 project" and add source file (i.e. HelloWorld.c).
- Configure project properties (All Configurations):
- C\C++ - General - Debug Information Format = Program Database (/Zi)
- C\C++ - Preprocessor - Preprocessor Definitions = _X86_ [add also DBG for Debug config]
- C\C++ - Code Generation - Enable C++ Exceptions = No
- C\C++ - Code Generation - Basic Runtime Checks = Default
- C\C++ - Code Generation - Buffer Security Check = No (/GS-)
- C\C++ - Advanced - Calling Convention = __stdcall (/Gz)
- C\C++ - Advanced - Compile As = Compile as C Code (/TC) [if you are going to use plain C]
- Linker - General - Output File = $(OutDir)\$(ProjectName).sys
- Linker - General - Enable Incremental Linking = Default
- 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
- Linker - Input - Ignore All Default Libraries = Yes (/NODEFAULTLIB)
- Linker - Manifest File - Generate Manifest = No
- Linker - System - SubSystem = Native (/SUBSYSTEM:NATIVE)
- Linker - System - Driver = Driver (/DRIVER)
- Linker - Advanced - Entry Point = DriverEntry
- Linker - Advanced - Base Address = 0x10000
- Linker - Advanced - Randomized Base Address = Disable (/DYNAMICBASE:NO)
(应该为默认值)
- 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的环境配置的更多相关文章
- VS2008+Windows DDK 7的环境配置(二)
在第一篇的基础上,进行如下的步骤,就可以编译出X64的驱动程序. (建议再另外建一个项目,这样避免混淆,因为x86和x64编译的有些编译选项是不同的.) 1. 安装VS2008 x64 build 组 ...
- 【Objective-C】Windows下Objective-C开发环境配置
[Objective-C]Windows下Objective-C开发环境配置 ftp://ftpmain.gnustep.org/pub/gnustep/binaries/windows/ 最近打 ...
- Windows Server2008 R2 MVC 环境配置
*:first-child { margin-top: 0 !important; } body>*:last-child { margin-bottom: 0 !important; } /* ...
- windows下spark开发环境配置
http://www.cnblogs.com/davidwang456/p/5032766.html windows下spark开发环境配置 --本篇随笔由同事葛同学提供. windows下spark ...
- windows下apache+https环境配置
windows下apache+https环境配置 转 https://www.cnblogs.com/sandaizi/p/7519370.html 1.修改配置文件conf/httpd.conf,去 ...
- Metabase在Windows下的开发环境配置
Metabase在Windows下的开发环境配置 */--> pre.src {background-color: #292b2e; color: #b2b2b2;} Metabase在Wind ...
- 第一篇 Windows 8 开发Windows Metro style app环境配置
半 饱问 题 到 我 这 里 为 止! 第一篇 Windows 8 开发Windows Metro style app环境配置 2012-09-24 08:24 by 半饱, 1289 阅读, 3 ...
- Windows驱动开发VS2012 DDK/WDK的环境配置
[开发Windows驱动的配置是很必要的,下文将详细介绍VS2012如何配置驱动开发环境] [转载] 以下部分内容是转载博客:http://blog.csdn.net/huangxy10/articl ...
- VC/DDK/DriverWorks开发环境配置
1·前言开发windows内核驱动程序是一个非常具有挑战性的工作,你得忍耐调试过程中操作系统 不断蓝屏.不断崩溃的噩梦,所以强烈建议你采用虚拟机做开发平台,这样即使把整个系统都搞蹦了,大不了从新装过虚 ...
随机推荐
- android activity 窗口 样式
韩梦飞沙 韩亚飞 313134555@qq.com yue31313 han_meng_fei_sha 将 活动 设置成 窗口样式, 可以设置 主题 为 对话框, 或者 半透明. 安卓:主题= ...
- JavaSE基础之矩阵运算
JavaSE基础之矩阵运算 1.矩阵类:Matrix.java 包括矩阵的加.乘运算,行列式的求解,最大最小元素等 package cn.com.zfc.help; import java.text. ...
- 洛谷 P4884 多少个1?
题面在这里 好久没做题了2333,竟然还一次A了,神奇 大概就是等比数列然后把分母乘过去,然后直接BSGS就行了,就是要写快速乘恩... #include<bits/stdc++.h> # ...
- ARC 067 E - Grouping
题面在这里! 很显然是个暴力dp. 我们先枚举一下 队伍人数的种类,然后再逆序枚举一下dp数组里的总人数(顺序就会算重),最后枚举一下这种队伍的数量,之后就可以O(1)算方案了. 具体的,O(1)算方 ...
- JavaScript将具有父子关系的原始数据格式化成树形结构数据(id,pid)
前几天遇到一个树型组件(类似树形菜单)数据格式化的问题,由于后台把原始查询的数据直接返回给前端,父子关系并未构建,因此需要前端JS来完成,后台返回的数据和下面的测试数据相似. var data=[ { ...
- MVC高级编程-目录
MVC高级编程 ================================================== 控制器 视图 模型 表单和HTML辅助方法 数据注解和验证 成员资格.授权和安全性 ...
- 模拟登陆CSDN——就是这么简单
工具介绍 本篇文章主要是解说怎样模拟登陆CSDN.使用的工具是HttpClient+Jsoup 当中HttpClient主要是负责发送请求,而Jsoup主要是解析HTML 你可能对HttpClient ...
- js比较两个String字符串找出不同,并将不同处高亮显示
根据java代码改写成js,下边js文件代码: function StringBuffer() { this.__strings__ = []; }; StringBuffer.prototype.a ...
- MVC实现多选下拉框,保存并显示多选项
在"MVC实现多选下拉框"中,主要是多选下拉框的显示,而实际情况通常是:选择多个选项提交后,需要在编辑页把所有选中的项显示出来. 模拟这样的一个场景:一个车迷可能有多个自己喜欢的汽 ...
- C语言 const, static, static const 的区别
基本定义: const 就是只读的意思,只在声明中使用;static 一般有2个作用,规定作用域和存储方式. 对于局部变量, static规定其为静态存储方式, 每次调用的初始值为上一次调用的值,调 ...