阅读:2870回复:7
第一个驱动就编译通不过,跪求除错办法
以下是first.c
#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("firs:hello"); driver->DriverUnload=DriverUnload; return STATUS_SUCCESS; } 以下是MakeFile !IF 0 Copyright (C) Microsoft Corporation, 1999 - 2002 Module Name: makefile. Notes: DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source file to this component. This file merely indirects to the real make file that is shared by all the components of Windows NT (DDK) !ENDIF !INCLUDE $(NTMAKEENV)\makefile.def 以下是SOURCES TARGETNAME=first TARGETTYPE=DRIVER TARGETPATH=obj SOURCES=first.c 用WDK的xpCheck版build出2个警告0个可执行文件,请问究竟错在哪里啊,才学写驱动哦! ERROR - "f:\first\objchk_wxp_x86\i386\_objects.mac" file time is slightly in the future (0x1caab11370ef000 (2/11/2010 11:56:16) vs. 0x1caab1135e9aec2 (2/11/2010 11:56:14)). 需要贴.log或.wrn等文本请讲一声 |
|
沙发#
发布于:2010-02-11 20:28
Re:谁来翻译下大概意思。不警告不行么?
28101 - The Drivers module has inferred that the current function is a <function-type> functionPREfast for Drivers has detected that a function is of a particular type, such as a callback function. This is an informational message only. It does not indicate an error. This message indicates that PREfast for Drivers is applying rules that are specific to that function type. If this inference is wrong, PREfast for Drivers will generate false-positive warnings, but those warnings can be safely ignored. For more information, see Coping with Noise. The function signature (the arguments and result type) are used to identify the function whenever possible. Some standard driver routines, such as Cancel and StartIo, have the same signature, so the name is checked to see if it matches the conventional name for that function. Other functions might be checked for conventional names. To suppress this warning when it is redundant, you can explicitly declare the function to be of a particular function type. The functions that are detected this way are typically callback functions. The proper action is to declare them using a function typedef. For more information, see Declaring Functions Using Function Role Type Declarations- ? 2009 Microsoft Corporation Send feedback on this topic PREfast for Drivers |
|
板凳#
发布于:2010-02-12 23:42
以下是我个人见解:
PREfast 这个是检查代码用的,对于驱动来说,他必然需要一系列的Callback函数,有一些函数是必须的,AddDevice之类的最好加上,即使你不用。 |
|
地板#
发布于:2010-02-13 11:33
哦,书上的例子就这么精简还通过了。
原来这不算error而是警告 |
|
地下室#
发布于:2010-02-16 11:07
WDK开始严格检查语法了,警告也视作错误。虽然可以关闭,但是为了驱动程序更键壮,建议认真对待。
|
|
|
5楼#
发布于:2010-02-18 14:15
编译有警告应该不影响编译结果吧!
|
|
6楼#
发布于:2010-06-03 16:14
回 4楼(znsoft) 的帖子
管理员 你好,我也是楼主的问题,这个例子是谭文写的寒江独钓里面的第一个例子,我也是调试不出来,有两个警告,我想用DebugView查看一下输出的信息,但就是出不来,很头痛,在线等您的回答。 |
|
7楼#
发布于:2010-06-03 17:46
这段程序,偶成功编译通过
|
|