编译PassThru出现函数没有定义的问题

shihe06   2009-5-13 19:21 楼主
小弟我刚接触驱动开发,现在在学习PassThru,把书上的例子用VS2008+DDKWinWiard+XP SP3+DDK(server 03)编译PassThru
但是却出现了莫名奇妙的错误:
c:\MyProject\PassThru\PassThru\miniport.c(74) : error C4013: 'NdisIMGetDeviceContext' undefined; assuming extern returning int
c:\MyProject\PassThru\PassThru\miniport.c(74) : warning C4047: '=' : 'PADAPT' differs in levels of indirection from 'int'
c:\MyProject\PassThru\PassThru\miniport.c(117) : error C4013: 'NdisMSetAttributesEx' undefined; assuming extern returning int
c:\MyProject\PassThru\PassThru\miniport.c(120) : error C2065: 'NDIS_ATTRIBUTE_IGNORE_PACKET_TIMEOUT' : undeclared identifier
c:\MyProject\PassThru\PassThru\miniport.c(121) : error C2065: 'NDIS_ATTRIBUTE_IGNORE_REQUEST_TIMEOUT' : undeclared identifier
c:\MyProject\PassThru\PassThru\miniport.c(122) : error C2065: 'NDIS_ATTRIBUTE_INTERMEDIATE_DRIVER' : undeclared identifier
c:\MyProject\PassThru\PassThru\miniport.c(123) : error C2065: 'NDIS_ATTRIBUTE_DESERIALIZE' : undeclared identifier
c:\MyProject\PassThru\PassThru\miniport.c(124) : error C2065: 'NDIS_ATTRIBUTE_NO_HALT_ON_SUSPEND' : undeclared identifier
c:\MyProject\PassThru\PassThru\miniport.c(326) : error C4013: 'NdisIMCopySendPerPacketInfo' undefined; assuming extern returning int
c:\MyProject\PassThru\PassThru\miniport.c(351) : error C4013: 'NdisIMCopySendCompletePerPacketInfo' undefined; assuming extern returning int
c:\MyProject\PassThru\PassThru\miniport.c(414) : error C4013: 'NdisMSendComplete' undefined; assuming extern returning int
c:\MyProject\PassThru\PassThru\miniport.c(1062) : error C4013: 'NdisMIndicateStatus' undefined; assuming extern returning int
c:\MyProject\PassThru\PassThru\miniport.c(1066) : error C4013: 'NdisMIndicateStatusComplete' undefined; assuming extern returning int
c:\MyProject\PassThru\PassThru\passthru.c(93) : error C2065: 'NDIS_MINIPORT_CHARACTERISTICS' : undeclared identifier

我已经包含了nids.h 文件,我打开这个文件发现上面有几个函数确实在这个头文件里声明了,但是确实灰色的。弄了半天也没有解决问题,还请大家帮我看看,谢谢了!!!!!!!!

回复评论 (6)

注意这个预编译条件:
#if ((defined(NDIS_MINIPORT_DRIVER) && (NDIS_MINIPORT_MAJOR_VERSION < 6)) || NDIS_WRAPPER)
点赞  2009-5-13 21:19
引用: 引用 1 楼 cnzdgs 的回复:
注意这个预编译条件:
#if ((defined(NDIS_MINIPORT_DRIVER) && (NDIS_MINIPORT_MAJOR_VERSION < 6)) || NDIS_WRAPPER)


貌似 LZ 的编译条件有点儿问题,需要指明...
点赞  2009-5-14 09:19
以下是WDK中passthru的例子中的sources文件内容,其中有一些预定义:
TARGETNAME=passthru
TARGETTYPE=DRIVER

C_DEFINES=$(C_DEFINES) -DNDIS_MINIPORT_DRIVER -DNDIS_WDM=1


!if "$(DDK_TARGET_OS)"=="Win2K"
#
# The driver is built in the Win2K build environment
#
C_DEFINES=$(C_DEFINES) -DNDIS40_MINIPORT=1
C_DEFINES=$(C_DEFINES) -DNDIS40=1
!else
#
# The driver is built in the XP or .NET build environment
# So let us build NDIS 5.1 version.
#
C_DEFINES=$(C_DEFINES) -DNDIS51_MINIPORT=1
C_DEFINES=$(C_DEFINES) -DNDIS51=1
!endif

# Uncomment the following to build for Win98/SE/WinMe
# This causes several APIs that are not present in Win9X to be
# ifdef'ed out.
# C_DEFINES=$(C_DEFINES) -DWIN9X=1

PRECOMPILED_INCLUDE=precomp.h

TARGETLIBS=$(DDK_LIB_PATH)\ndis.lib

INCLUDES=

SOURCES=\
    miniport.c \
    passthru.c \
    passthru.rc \
    protocol.c

点赞  2009-5-14 11:58
严重支持
点赞  2009-5-15 09:29
呵呵 谢谢大家的支持 我用VC6.0编译老出问题 最后只有用built来编译了。虽然有点不方便,但是总算是编译成功了。
点赞  2009-5-16 02:21
已经给分了 一楼和三楼
点赞  2009-5-16 02:22
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 京公网安备 11010802033920号
    写回复