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内核驱动程序是一个非常具有挑战性的工作,你得忍耐调试过程中操作系统 不断蓝屏.不断崩溃的噩梦,所以强烈建议你采用虚拟机做开发平台,这样即使把整个系统都搞蹦了,大不了从新装过虚 ...
随机推荐
- BOM知识梳理
学过前端开发的地球人应该都了解,JavaScript分为三个部分:ECMAScript(JS语言本身基础语法),DOM(文档对象模型,应用程序编程接口),BOM(浏览器对象模型). BOM,实际上与浏 ...
- android httpUrlConnection HttpClient
韩梦飞沙 韩亚飞 313134555@qq.com yue31313 han_meng_fei_sha httpUrlConnection 超文本传输协议统一资源定位器连接 http 超 ...
- GNU C __attribute__ 机制简介
摘要: 在学习linux内核代码及一些开源软件的源码(如:DirectFB),经常可以看到有关__attribute__的相关使用.本文结合自己的学习经历,较为详细的介绍了__attribute__相 ...
- hdu 5308 (2015多校第二场第9题)脑洞模拟题,无语
题目链接:http://acm.hdu.edu.cn/listproblem.php?vol=44 题意:给你n个n,如果能在n-1次运算之后(加减乘除)结果为24的输出n-1次运算的过程,如果不能输 ...
- ROS知识(12)----cv_bridge依赖opencv版本的问题
cv_bridge默认依赖的oencv版本是2.4.8,如果安装了新的opencv版本,比如2.4.11,那么在编译cv_bridge时候会提示无法找到opencv 2.4.8.so的库. 为解决这个 ...
- Vue基础知识简介
基础知识: vue的生命周期: beforeCreate/created.beforeMount/mounted.beforeUpdate/updated.beforeDestory/destorye ...
- 写给在Java和.net中徘徊的新手
在很多网站上,网友都会问一个相同的问题,到底是学Java还是.net,个有个的见解. 自从.Net问世以来,程序员都很关心的一个问题是「该学Java或.NET」.我也在挣扎,该「该继续Java的研究, ...
- MEF(Managed Extensibility Framework)使用全部扩展组件
MEF(Managed Extensibility Framework),所在命名空间是System.ComponentModel.Composition.dll.简单来说,MEF是将符合约定(一般是 ...
- EJB实体Bean怎样和数据库中表关联?
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE ejb-jar PUBLIC "- ...
- [翻译] SWTableViewCell
SWTableViewCell An easy-to-use UITableViewCell subclass that implements a swippable content view whi ...