驱动开发的几种编译环境配置法(转)

转链接:

http://www.vcfans.com/2009/07/windows-driver-compiler-link-config.html

很不错,值得收藏!

 

英文版

/ /How to Configure Visual Studio 2008 for Compiling Drivers

 

 

  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):
  6. C/C++ - General - Debug Information Format = Program Database (/Zi)
  7. C/C++ - Preprocessor - Preprocessor Definitions = _X86_ [add also DBG for Debug config]
  8. C/C++ - Code Generation - Enable C++ Exceptions = No
  9. C/C++ - Code Generation - Basic Runtime Checks = Default
  10. C/C++ - Code Generation - Buffer Security Check = No (/GS-)
  11. C/C++ - Advanced - Calling Convention = __stdcall (/Gz)
  12. C/C++ - Advanced - Compile As = Compile as C Code (/TC) [if you are going to use plain C]
  13. Linker - General - Output File = $(OutDir)/$(ProjectName).sys
  14. Linker - General - Enable Incremental Linking = Default
  15. Linker - Input - Additional Dependencies = ntoskrnl.lib hal.lib $(NOINHERIT) [add needed libs here e.g. ntoskrnl.lib hal.lib]
  16. Linker - Input - Ignore All Default Libraries = Yes (/NODEFAULTLIB)
  17. Linker - Manifest File - Generate Manifest = No
  18. Linker - System - SubSystem = Native (/SUBSYSTEM:NATIVE)
  19. Linker - System - Driver = Driver (/DRIVER)
  20. Linker - Advanced - Entry Point = DriverEntry
  21. Linker - Advanced - Base Address = 0x10000
  22. Linker - Advanced - Randomized Base Address = Disable (/DYNAMICBASE:NO)
  23. Linker - Advanced - Data Execution Prevention (DEP) = Disable (/NXCOMPAT:NO)

#include "ntddk.h"

NTSTATUS
DriverEntry(PDRIVER_OBJECT DriverObject,PUNICODE_STRING
RegistryPath)
{
return STATUS_UNSUCCESSFUL;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值