当前位置: 代码迷 >> 驱动开发 >> wdk开发驱动程序没法生成xp的sys文件
  详细解决方案

wdk开发驱动程序没法生成xp的sys文件

热度:51   发布时间:2016-04-28 10:47:23.0
wdk开发驱动程序无法生成xp的sys文件
按照《寒江独钓:windows内核安全编程》讲解的第一个例子,写了一个first文件,
#include <ntddk.h>
VOID DriverUnload(PDRIVER_OBJECT driver)
{
DbgPrint("first: our driver is unloading...\r\n");
}
NTSTATUS DriverEntry(PDRIVER_OBJECT driver, PUNICODE_STRING reg_path)
{
DbgPrint("first:hello worlsd!\r\n");
driver->DriverUnload=DriverUnload;
return STATUS_SUCCESS; 
}
然后拷贝了一个makefile。写了一个sources文件
TARGETNAME=first
TARGETTYPE=DRIVER
SOURCES=first.c
使用windows xp的x86 checked build environment 编译

D:\neihe\first>build
BUILD: Compile and Link for x86
BUILD: Loading d:\winddk\build.dat...
BUILD: Computing Include file dependencies:
BUILD: Start time: Mon Nov 07 22:14:47 2011
BUILD: Examining d:\neihe\first directory for files to compile.
  d:\neihe\first Invalidating OACR warning log for 'root:x86chk'
BUILD: Saving d:\winddk\build.dat...
BUILD: Compiling and Linking d:\neihe\first directory
Configuring OACR for 'root:x86chk' - <OACR on>
BUILD: Finish time: Mon Nov 07 22:14:55 2011
BUILD: Done
然后就完了,first文件中的i386文件夹下并没有生成sys文件,反倒是生成了一个叫_objects.mac的文件。
求大侠帮忙解决下啊!

------解决方案--------------------
试着从WDK里面的例子进行修改。
你的Sources文件里可能缺东西了:
如:
C/C++ code
DRIVERTYPE=WDMMSC_WARNING_LEVEL=/W3 /WXC_DEFINES=$(C_DEFINES) -DUNICODE -D_UNICODE -DDEBUG_LEVEL=DEBUGLVL_BLAB -D_WIN2K_COMPAT_SLIST_USAGELINKER_FLAGS =$(LINKER_FLAGS) -map -merge:PAGECONST=PAGE