1。建立一個空的Win32 Application,將驅動檔案(包括INCLUDE和SOURCES)加入工程
2。Tools-->Options-->Directories-->Executable files
加入:C:\WINDDK\7600.16385.0\BIN\X86\X86
編譯驅動的時候將該命令放在最上面;
編譯應用態程式的時候,將該命令放在最下面
3。Project-->Settings...
{C/C++}
[General]
Debug info:
Program Database
Preprocessor definitions:
_X86_=1,i386=1,STD_CALL,WIN32=100,_WIN32_WINNT=0x0501,WINVER=0x0501,_DEBUG
Project Options:
去掉GX /YX /pdbtype:sept
MLd->MTd
[Code Generation]
Calling convention:
__stdcall
Use run-time library
Debug Multithreaded
[Preprocessor]
Additional include directories:
C:\WinDDK\7600.16385.0\inc,
C:\WinDDK\7600.16385.0\inc\api,
C:\WinDDK\7600.16385.0\inc\ddk,
C:\WinDDK\7600.16385.0\inc\crt
{Link}
[General]
Output file name:
name.sys
Object/library modules:
ntoskrnl.lib hal.lib usbd.lib wmilib.lib
去掉"Link incrementally"的勾
[input]
Additional library path:
C:\WinDDK\7600.16385.0\lib,
C:\WinDDK\7600.16385.0\lib\crt\i386,
C:\WinDDK\7600.16385.0\lib\wnet\i386
[output]
Entry-point symbol:
DriverEntry
Project Options:
/machine:IX86 /driver /subsystem:native /SECTION:INIT,d
/IGNORE:4198,4010,4037,4039,4065,4070,4078,4087,4089,4221
刪除如下選項:
/subsystem:windows
其實主要是為了利用VA編輯代碼的方便。編譯64位的程式或者WIN7等版本,可以直接使用WDK的編譯命令來編譯即可。