Chinaunix首页 | 论坛 | 博客
  • 博客访问: 532402
  • 博文数量: 252
  • 博客积分: 6057
  • 博客等级: 准将
  • 技术积分: 1635
  • 用 户 组: 普通用户
  • 注册时间: 2009-12-21 10:17
文章分类

全部博文(252)

文章存档

2013年(1)

2012年(1)

2011年(32)

2010年(212)

2009年(6)

分类: WINDOWS

2010-03-24 15:08:38

I’ll give you what I found, but all I can say is don’t do it.

There are always problems linking one version of the CRT against a version of a compiler that it wasn’t written for.

Create a win32 DLL project.

C/C++ settings for VC2008

  • General
    Additional Include Directories:
    C:\WINDDK\2600\inc\wxp
    C:\WINDDK\2600\inc\ddk\wxp
    C:\WINDDK\2600\inc\ddk\wdm\wxp
    C:\WINDDK\2600\inc\crt
    Debug Information Format : Program Database (/Zi)
  • Optimization
    Enable Intrinsic Functions: Yes (/Oi) … To avoid the memcmp compile error.
  • Preprocessor
    Preprocessor Definitions:
    _X86_=1
    i386=1
    _WIN32_WINNT=0×0501
    WINVER=0×0501
    WIN32_LEAN_AND_MEAN=1 … dont know if this does much for a device driver
    Ignore Standard Include Path:Yes (/X)
  • Code Generation
    Enable C++ Exceptions:No … no exception handling in the kernel!
    Buffer Security Check:No (/GS-) … linker error if set to Yes
    Basic runtime Checks: Default
  • Advanced
    Calling Convention:__stdcall (/Gz)
  • Language
    Enable Run-Time Type Info:No (/GR-) … linker error if set to Yes


Linker settings for VC2008

  • Input
    Additional Dependencies:int64.lib ntoskrnl.lib hal.lib … etc.
    Ignore All Default Libraries:Yes (/NODEFAULTLIB)
  • Manifest File
    Generate Manifest:No
  • System
    SubSystem:Native (/SUBSYSTEM:NATIVE)
    Driver:Driver (/DRIVER)
  • Advanced
    Base address:0×10000
    Entry Point:DriverEntry
    Target Machine:MachineX86 (/MACHINE:X86)
    Randomized Base Address:Default
    Data Execution Prevention (DEP) : default
  • General
    Additional Library Directories:C:\WINDDK\2600\lib\wxp\i386
    Enable Incremental linking: No (/INCREMENTAL:NO)
    Output file: $(OutDir)\$(ProjectName).sys
  • Command line
    add there /safeseh:no option

You change the paths to your paths obviously, but this is what the original poster said worked.
相关连接:

VS2008 头文件和库文件目录的设置, 在编译驱动时, 将 WDK 相关的头文件和库文件如下图所示在搜索顺序中置顶(由于 WDK(DDK) 头文件与 SDK 头文件并不完全兼容, 不能混用, 因此在不再编译驱动时, 将其置底, 在这一点上, MS 做的比 GCC 要差, WinGW 就能够混用):


Exported-2010-02-28
例 子工程
hellosys

附录: VC6 的驱动编译环境设置

一些资源:

修改版的 QuickSys 在这里 QuickSYS

windows 2000 NTDDK
修改后的山寨版 ntifs.h
old sfilter
sfilter 流程浅析 以及配套代码 sfilter better — crypfile
romfs-15
filedisk-17

内核编程, 技术心得 , , , , ,

阅读(797) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~