ffjj56
驱动牛犊
驱动牛犊
  • 注册日期2010-02-11
  • 最后登录2010-12-28
  • 粉丝0
  • 关注0
  • 积分19分
  • 威望121点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:2757回复:7

第一个驱动就编译通不过,跪求除错办法

楼主#
更多 发布于:2010-02-11 20:20
以下是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等文本请讲一声
ffjj56
驱动牛犊
驱动牛犊
  • 注册日期2010-02-11
  • 最后登录2010-12-28
  • 粉丝0
  • 关注0
  • 积分19分
  • 威望121点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
沙发#
发布于:2010-02-11 20:28
Re:谁来翻译下大概意思。不警告不行么?
28101 - The Drivers module has inferred that the current function is a <function-type> function
PREfast 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
sonxn@163.com
驱动牛犊
驱动牛犊
  • 注册日期2009-07-09
  • 最后登录2011-03-27
  • 粉丝0
  • 关注0
  • 积分22分
  • 威望181点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
板凳#
发布于:2010-02-12 23:42
以下是我个人见解:
PREfast  这个是检查代码用的,对于驱动来说,他必然需要一系列的Callback函数,有一些函数是必须的,AddDevice之类的最好加上,即使你不用。
ffjj56
驱动牛犊
驱动牛犊
  • 注册日期2010-02-11
  • 最后登录2010-12-28
  • 粉丝0
  • 关注0
  • 积分19分
  • 威望121点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
地板#
发布于:2010-02-13 11:33
哦,书上的例子就这么精简还通过了。
原来这不算error而是警告
znsoft
管理员
管理员
  • 注册日期2001-03-23
  • 最后登录2023-10-25
  • 粉丝300
  • 关注6
  • 积分910分
  • 威望14796点
  • 贡献值7点
  • 好评度2410点
  • 原创分5分
  • 专家分100分
  • 社区居民
  • 最爱沙发
  • 社区明星
地下室#
发布于:2010-02-16 11:07
WDK开始严格检查语法了,警告也视作错误。虽然可以关闭,但是为了驱动程序更键壮,建议认真对待。
http://www.zndev.com 免费源码交换网 ----------------------------- 软件创造价值,驱动提供力量! 淡泊以明志,宁静以致远。 ---------------------------------- 勤用搜索,多查资料,先搜再问。
guenli
驱动牛犊
驱动牛犊
  • 注册日期2009-12-18
  • 最后登录2010-02-19
  • 粉丝0
  • 关注0
  • 积分61分
  • 威望611点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
5楼#
发布于:2010-02-18 14:15
编译有警告应该不影响编译结果吧!
madonglingyan
驱动牛犊
驱动牛犊
  • 注册日期2010-06-03
  • 最后登录2010-06-03
  • 粉丝0
  • 关注0
  • 积分1分
  • 威望11点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
6楼#
发布于:2010-06-03 16:14
回 4楼(znsoft) 的帖子
管理员 你好,我也是楼主的问题,这个例子是谭文写的寒江独钓里面的第一个例子,我也是调试不出来,有两个警告,我想用DebugView查看一下输出的信息,但就是出不来,很头痛,在线等您的回答。
asminfo
驱动牛犊
驱动牛犊
  • 注册日期2010-06-03
  • 最后登录2010-06-04
  • 粉丝0
  • 关注0
  • 积分1分
  • 威望11点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
7楼#
发布于:2010-06-03 17:46
  这段程序,偶成功编译通过
游客

返回顶部