请教使用wdk编译MiniFilter驱动中通信用的客户端代码出错问题

后学   2008-1-16 14:17 楼主
程序编译成动态链接库,编译出错,说是FilterSendMessage and FilterConnectCommunic找不到,可我已经包含了头文件FltUser.h,郁闷,请高手指点一下,代码如下:

CommClient.cpp
/**************************************************************/
#include
#include
#include "FltUser.h"

#define COMM_PORT_NAME  L"\\CommPort"

typedef enum _READ_DIR_COMMAND {
     FStart
} READ_DIR_COMMAND;

struct READ_DIR_MESSAGE {
     READ_DIR_COMMAND Command;
};

extern "C" _declspec(dllexport) bool SendReadMessage(void)
{
        HRESULT hResult = S_OK;
        HANDLE port = INVALID_HANDLE_VALUE;
        DWORD bytesReturned = 0;
        READ_DIR_MESSAGE command;

        command.Command = FStart;
        hResult = FilterConnectCommunicationPort(L"\\CommPort", 0,NULL,0,NULL,&port );

    if (IS_ERROR( hResult )) {

        printf( "Could not connect to filter: 0x%08x\n", hResult );
        return 0;
    }
        else
        {
                printf("connect ok \n");
        }

        /*hResult = FilterSendMessage( port, &command, sizeof(READ_DIR_COMMAND), 0, 0, &bytesReturned ); */

     
        return TRUE;
};

CommClient.def
/*********************************************************************/
LIBRARY CommClient

EXPORTS
    SendReadMessage

sources
/*********************************************************************/
TARGETNAME=CommClient
TARGETTYPE=DYNLINK
DLLENTRY=_DllMainCRTStartup
DLLDEF=CommClient.def
USE_MSVCRT=1


TARGETPATH=..\lib\$(BUILD_ALT_DIR)

TARGETLIBS=$(TARGETLIBS) \
           $(IFSKIT_LIB_PATH)\fltLib.lib \
           $(SDK_LIB_PATH)\kernel32.lib

C_DEFINES=$(C_DEFINES) -DUNICODE -D_UNICODE

INCLUDES=$(INCLUDES);         \
        $(IFSKIT_INC_PATH);  \
        $(DDK_INC_PATH);


SOURCES=CommClient.cpp

build时出错,说是找不到'FilterConnectCommunicationPort'和'FilterSendMessage',但我明明已经包含了#include "FltUser.h"头文件的,不知道是什么原因。请高手明示。谢谢

D:\incubator\user>build
BUILD: Compile and Link for x86
BUILD: Loading c:\winddk\6000\build.dat...
BUILD: Computing Include file dependencies:
BUILD: Start time: Wed Jan 16 14:15:30 2008
BUILD: Examining d:\incubator\user directory for files to compile.
    d:\incubator\user - 1 source files (42 lines)
BUILD: Saving c:\winddk\6000\build.dat...
BUILD: Compiling d:\incubator\user directory
_NT_TARGET_VERSION SET TO WINXP
Compiling - commclient.cpp
errors in directory d:\incubator\user
d:\incubator\user\commclient.cpp(25) : error C3861: 'FilterConnectCommunicationP
ort': identifier not found
d:\incubator\user\commclient.cpp(37) : error C3861: 'FilterSendMessage': identif
ier not found
Building Library - d:\incubator\lib\chk_wxp_x86\i386\commclient.lib
link : error LNK1181: cannot open input file 'objchk_wxp_x86\i386\commclient.obj
'
BUILD: Compile errors: not linking d:\incubator\user directory
BUILD: Finish time: Wed Jan 16 14:15:31 2008
BUILD: Done

回复评论

暂无评论,赶紧抢沙发吧
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 京公网安备 11010802033920号
    写回复