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内核驱动程序是一个非常具有挑战性的工作,你得忍耐调试过程中操作系统 不断蓝屏.不断崩溃的噩梦,所以强烈建议你采用虚拟机做开发平台,这样即使把整个系统都搞蹦了,大不了从新装过虚 ...
随机推荐
- luoguP4336 [SHOI2016]黑暗前的幻想乡 容斥原理 + 矩阵树定理
自然地想到容斥原理 然后套个矩阵树就行了 求行列式的时候只有换行要改变符号啊QAQ 复杂度为\(O(2^n * n^3)\) #include <cstdio> #include < ...
- BZOJ.2125.最短路(仙人掌 圆方树)
题目链接 圆方树.做题思路不写了.. 就是当LCA是方点时跳进那个环可以分类讨论一下用树剖而不必须用倍增: 如果v是u的(唯一的那个)重儿子,那么u的DFS序上+1的点即是要找的:否则v会引出一条新的 ...
- java知识点总结
一.java 1.容器 1)List Java中ArrayList和LinkedList区别 2)Set 理解HashSet及使用 HashMap和HashSet的区别 3Map HashMap的容量 ...
- 【转载】CMarkup函数说明
1.初始化Load 导入一个XML文件到CMarkup的对象中,并对它进行解析.类似C#的Load.SetDoc 从字符串中导入XML数据,并对它解析.类似C#的LoadXml. 2.输出Sa ...
- Python文件类型
Python的文件类型分为三种:源代码.字节代码.优化代码. 1. 源代码 Python源代码文件,即py脚本文件,由 python.exe 解释,可在控制台下运行.pyw脚本文件是图形用户接口 ...
- BZOJ 2342: [Shoi2011]双倍回文 马拉车算法/并查集
2342: [Shoi2011]双倍回文 Time Limit: 10 Sec Memory Limit: 162 MBSubmit: 1123 Solved: 408 题目连接 http://w ...
- 华为S5300系列交换机V100R005SPH020升级补丁
S23_33_53-V100R005SPH020.pat 附件: 链接:https://pan.baidu.com/s/1-qgNEtRsZbNnC4eK4DTctA 密码:wpn3
- go语言 defer 高级
go语言defer语句的用法 defer的语法 defer后面必须是函数调用语句,不能是其他语句,否则编译器会出错. package main import "log" func ...
- UITableView与UIScrollView的一些问题(持续更新)
UITableView的一些常用操作 --------------------------------------------------------------------------------- ...
- Kafka broker配置介绍 (四)
这部分内容对了解系统和提高软件性能都有很大的帮助,kafka官网上也给出了比较详细的配置详单,但是我们还是直接从代码来看broker到底有哪些配置需要我们去了解的,配置都有英文注释,所以每一部分是干什 ...