How to build my client program to dll with wdk 6000 in minifilter driver development???

now i want to build my client program with wdk 6000 as dll, then call it in
my vc project, my code is as following:

//CommClient.h

/**************************************************************************************/

extern “C” {
bool __declspec(dllexport) SendReadMessage(void);
};
/**************************************************************************************/

//CommClient.cpp

/**************************************************************************************/
#include “Stdafx.h”
#include “CommClient.h”
#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;
};

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;
};
/**************************************************************************************/

sources file
/**************************************************************************************/
TARGETNAME=CommClient
TARGETTYPE=DYNLINK
UMTYPE=nt

C_DEFINES=$(C_DEFINES) -DUNICODE -D_UNICODE

LINKLIBS=$(SDK_LIB_PATH)\shell32.lib

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

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

SOURCES=StdAfx.cpp \
CommClient.cpp

!if “$(DDK_TARGET_OS)”==“WinLH”
_NT_TARGET_VERSION=$(_NT_TARGET_VERSION_WINXP)
!endif

/***************************************************************************************/

But i can’t build them successfully, i think there exists problem in my
sources file, but i don’t know why? can you tell me??

Is this a user mode DLL? If so, ‘UMTYPE=nt’ is wrong. It tells BUILD
to create a kernel mode program. You probably want ‘windows,’ as it
seems you are using SendMessage in some form or another.

If it is a kernel mode dll, then you definitely don’t want to link
against shell32.lib.

All that being said, what is BUILD reporting?

Good luck,

mm

å³°å§š wrote:

now i want to build my client program with wdk 6000 as dll, then call it
in my vc project, my code is as following:

//CommClient.h

/*****************************
*********************************************************/
extern “C” {
bool __declspec(dllexport) SendReadMessage(void);
};
/**************************************************************************************/

//CommClient.cpp

/**************************************************************************************/
#include “Stdafx.h”
#include “CommClient.h”

#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;
};

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;
};
/**************************************************************************************/

sources file
/**************************************************************************************/
TARGETNAME=CommClient
TARGETTYPE=DYNLINK
UMTYPE=nt

C_DEFINES=$(C_DEFINES) -DUNICODE -D_UNICODE

LINKLIBS=$(SDK_LIB_PATH)\shell32.lib

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

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

SOURCES=StdAfx.cpp \
CommClient.cpp

!if “$(DDK_TARGET_OS)”==“WinLH”
_NT_TARGET_VERSION=$(_NT_TARGET_VERSION_WINXP)
!endif

/***************************************************************************************/

But i can’t build them successfully, i think there exists problem in my
sources file, but i don’t know why? can you tell me??

my modified sources file is as following:

sources
/****************************************************************/
TARGETNAME=CommClient

TARGETPATH=obj

TARGETTYPE=DYNLINK

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

INCLUDES=$(INCLUDES); \
$(IFSKIT_INC_PATH); \
$(DDK_INC_PATH); \
…\inc
DEFFILE=CommClient.def

SOURCES = CommClient.c

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

EXPORTS
SendReadMessage

Build result is as following:
/**************************************************************
BUILD: Compile and Link for x86
BUILD: Loading c:\winddk\6000\build.dat…
BUILD: Computing Include file dependencies:
BUILD: Start time: Wed Jan 16 09:20:44 2008
BUILD: Examining d:\incubator\commclient directory for files to compile.
BUILD: Saving c:\winddk\6000\build.dat…
BUILD: Compiling d:\incubator\commclient directory
_NT_TARGET_VERSION SET TO WINXP
BUILD: Linking d:\incubator\commclient directory
_NT_TARGET_VERSION SET TO WINXP
Linking Executable - objchk_wxp_x86\i386\commclient.dll
errors in directory d:\incubator\commclient
d:\incubator\commclient\commclient.obj : error LNK2019: unresolved external
symb
ol _printf referenced in function _SendReadMessage@0
d:\incubator\commclient\bufferoverflowu.lib(gs_dllmain.obj) : error LNK2019:
unr
esolved external symbol xxxxx@4 referenced in
functio
n __DllMainCRTStartupForGS@12
d:\incubator\commclient\bufferoverflowu.lib(gs_support.obj) : error LNK2019:
unr
esolved external symbol xxxxx@4 referenced in
function
___security_init_cookie
d:\incubator\commclient\bufferoverflowu.lib(gs_support.obj) : error LNK2019:
unr
esolved external symbol xxxxx@0 referenced in function
___security
_init_cookie
d:\incubator\commclient\bufferoverflowu.lib(gs_support.obj) : error LNK2019:
unr
esolved external symbol xxxxx@0 referenced in function
___se
curity_init_cookie
d:\incubator\commclient\bufferoverflowu.lib(gs_support.obj) : error LNK2019:
unr
esolved external symbol xxxxx@0 referenced in function
___s
ecurity_init_cookie
d:\incubator\commclient\bufferoverflowu.lib(gs_support.obj) : error LNK2019:
unr
esolved external symbol xxxxx@4 referenced in
function
___security_init_cookie
d:\incubator\commclient\objchk_wxp_x86\i386\commclient.dll : error LNK1120:
7 un
resolved externals
BUILD: Finish time: Wed Jan 16 09:20:46 2008
BUILD: Done

1 executable built - 8 Errors

It’s a user mode dll

I believe that you need to add:

UMTYPE=windows

and

USE_MSVCRT

That may do it. If not, then I believe you need to make TARGETLIBS look
something like:

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

Good luck,

mm

å³°å§š wrote:

my modified sources file is as following:

sources
/****************************************************************/
TARGETNAME=CommClient

TARGETPATH=obj

TARGETTYPE=DYNLINK

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

INCLUDES=$(INCLUDES); \
$(IFSKIT_INC_PATH); \
$(DDK_INC_PATH); \
…\inc
DEFFILE=CommClient.def

SOURCES = CommClient.c

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

EXPORTS
SendReadMessage

Build result is as following:
/**************************************************************
BUILD: Compile and Link for x86
BUILD: Loading c:\winddk\6000\build.dat…
BUILD: Computing Include file dependencies:
BUILD: Start time: Wed Jan 16 09:20:44 2008
BUILD: Examining d:\incubator\commclient directory for files to compile.
BUILD: Saving c:\winddk\6000\build.dat…
BUILD: Compiling d:\incubator\commclient directory
_NT_TARGET_VERSION SET TO WINXP
BUILD: Linking d:\incubator\commclient directory
_NT_TARGET_VERSION SET TO WINXP
Linking Executable - objchk_wxp_x86\i386\commclient.dll
errors in directory d:\incubator\commclient
d:\incubator\commclient\commclient.obj : error LNK2019: unresolved
external symb
ol _printf referenced in function _SendReadMessage@0
d:\incubator\commclient\bufferoverflowu.lib(gs_dllmain.obj) : error
LNK2019: unr
esolved external symbol xxxxx@4 referenced in
functio
n __DllMainCRTStartupForGS@12
d:\incubator\commclient\bufferoverflowu.lib(gs_support.obj) : error
LNK2019: unr
esolved external symbol xxxxx@4 referenced in
function
___security_init_cookie
d:\incubator\commclient\bufferoverflowu.lib(gs_support.obj) : error
LNK2019: unr
esolved external symbol xxxxx@0 referenced in function
___security
_init_cookie
d:\incubator\commclient\bufferoverflowu.lib(gs_support.obj) : error
LNK2019: unr
esolved external symbol xxxxx@0 referenced in
function ___se
curity_init_cookie
d:\incubator\commclient\bufferoverflowu.lib(gs_support.obj) : error
LNK2019: unr
esolved external symbol xxxxx@0 referenced in
function ___s
ecurity_init_cookie
d:\incubator\commclient\bufferoverflowu.lib(gs_support.obj) : error
LNK2019: unr
esolved external symbol xxxxx@4 referenced in
function
___security_init_cookie
d:\incubator\commclient\objchk_wxp_x86\i386\commclient.dll : error
LNK1120: 7 un
resolved externals
BUILD: Finish time: Wed Jan 16 09:20:46 2008
BUILD: Done

1 executable built - 8 Errors

Martin O’Brien$B!$(B thank you

follow your advice, my code is as following:

CommClient.cpp
/***********************************************************************/
#include “CommClient.h”
#include <windows.h>
#include <fltuser.h>
#include <stdio.h>

#define COMM_PORT_NAME L"\CommPort"

typedef enum _READ_DIR_COMMAND {
FStart
} READ_DIR_COMMAND;

struct READ_DIR_MESSAGE {
READ_DIR_COMMAND Command;
};

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.h
/****************************************************************************/
extern “C” {
bool __declspec(dllexport) SendReadMessage(void);
};

Sources
/*****************************************************************************/
TARGETNAME=CommClient

TARGETPATH=obj

TARGETTYPE=DYNLINK

UMTYPE=windows

USE_MSVCRT=1

#TARGETLIBS=$(TARGETLIBS) <br># $(IFSKIT_LIB_PATH)\fltLib.lib

TARGETLIBS=$(TARGETLIBS) <br> $(IFSKIT_LIB_PATH)\fltLib.lib <br> $(SDK_LIB_PATH)\kernel32.lib <br> $(SDK_LIB_PATH)\advapi32.lib

INCLUDES=$(INCLUDES); <br> $(IFSKIT_INC_PATH); <br> $(DDK_INC_PATH); <br> …\inc

DEFFILE=CommClient.def

SOURCES = CommClient.cpp

The build result is as following:
D:\incubator\CommClient>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 10:14:57 2008
BUILD: Examining d:\incubator\commclient directory for files to compile.
d:\incubator\commclient - 1 source files (41 lines)
BUILD: Saving c:\winddk\6000\build.dat…
BUILD: Compiling d:\incubator\commclient directory
_NT_TARGET_VERSION SET TO WINXP
Compiling - commclient.cpp
errors in directory d:\incubator\commclient
d:\incubator\commclient\commclient.cpp(24) : error C3861:
‘FilterConnectCommunic
ationPort’: identifier not found
d:\incubator\commclient\commclient.cpp(36) : error C3861:
‘FilterSendMessage’: i
dentifier not found
Building Library - objchk_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\commclient directory
BUILD: Finish time: Wed Jan 16 10:14:58 2008
BUILD: Done

3 files compiled - 2 Errors
1 library built - 1 Error

D:\incubator\CommClient>

The declare of FilterSendMessage and FilterConnectCommunic is in FltUser.h.
error C3861: ‘FilterConnectCommunicationPort’: identifier not found
error C3861: ‘FilterSendMessage’: identifier not found

why??</stdio.h></fltuser.h></windows.h>

This looks like a messy problem involving mismatched headers or
something along those lines. To get started, add the following to your
SOURCES file, rebuild (build -ceZ) and post the results please. It
should list headers files in the order in which they were included.

USER_C_FLAGS=-showIncludes

Although you definitely want to use BUILD here, I don’t really use it
myself, and it’s possible that the results I’m expecting to see will end
up in a log file, so be sure to check there. All it should look like is
a list of paths naming header files.

Good luck,

mm

$BJvU-(B wrote:

Martin O’Brien$B!$(B thank you

follow your advice, my code is as following:

CommClient.cpp
/***********************************************************************/
#include “CommClient.h”
#include <windows.h>
> #include <fltuser.h>
> #include <stdio.h>
>
> #define COMM_PORT_NAME L"\CommPort"
>
> typedef enum _READ_DIR_COMMAND {
> FStart
> } READ_DIR_COMMAND;
>
> struct READ_DIR_MESSAGE {
> READ_DIR_COMMAND Command;
> };
>
> 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.h
> /****************************************************************************/
>
> extern “C” {
> bool __declspec(dllexport) SendReadMessage(void);
> };
>
> Sources
> /*****************************************************************************/
> TARGETNAME=CommClient
>
> TARGETPATH=obj
>
> TARGETTYPE=DYNLINK
>
> UMTYPE=windows
>
>
> USE_MSVCRT=1
>
>
> #TARGETLIBS=$(TARGETLIBS) <br>> # $(IFSKIT_LIB_PATH)\fltLib.lib
>
> TARGETLIBS=$(TARGETLIBS) <br>> $(IFSKIT_LIB_PATH)\fltLib.lib <br>> $(SDK_LIB_PATH)\kernel32.lib <br>> $(SDK_LIB_PATH)\advapi32.lib
>
> INCLUDES=$(INCLUDES); <br>> $(IFSKIT_INC_PATH); <br>> $(DDK_INC_PATH); <br>> …\inc
>
> DEFFILE=CommClient.def
>
> SOURCES = CommClient.cpp
>
>
> The build result is as following:
> D:\incubator\CommClient>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 10:14:57 2008
> BUILD: Examining d:\incubator\commclient directory for files to compile.
> d:\incubator\commclient - 1 source files (41 lines)
> BUILD: Saving c:\winddk\6000\build.dat…
> BUILD: Compiling d:\incubator\commclient directory
> _NT_TARGET_VERSION SET TO WINXP
> Compiling - commclient.cpp
> errors in directory d:\incubator\commclient
> d:\incubator\commclient\commclient.cpp(24) : error C3861:
> ‘FilterConnectCommunic
> ationPort’: identifier not found
> d:\incubator\commclient\commclient.cpp(36) : error C3861:
> ‘FilterSendMessage’: i
> dentifier not found
> Building Library - objchk_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\commclient directory
> BUILD: Finish time: Wed Jan 16 10:14:58 2008
> BUILD: Done
>
> 3 files compiled - 2 Errors
> 1 library built - 1 Error
>
> D:\incubator\CommClient>
>
> The declare of FilterSendMessage and FilterConnectCommunic is in FltUser.h.
> error C3861: ‘FilterConnectCommunicationPort’: identifier not found
> error C3861: ‘FilterSendMessage’: identifier not found
>
> why??
></stdio.h></fltuser.h></windows.h>

Also, I would encourage you to please stop posting he same question
under different subjects; it confuses and aggravates people.

Martin O’Brien wrote:

This looks like a messy problem involving mismatched headers or
something along those lines. To get started, add the following to your
SOURCES file, rebuild (build -ceZ) and post the results please. It
should list headers files in the order in which they were included.

USER_C_FLAGS=-showIncludes

Although you definitely want to use BUILD here, I don’t really use it
myself, and it’s possible that the results I’m expecting to see will end
up in a log file, so be sure to check there. All it should look like is
a list of paths naming header files.

Good luck,

mm

$BJvU-(B wrote:
> Martin O’Brien$B!$(B thank you
>
> follow your advice, my code is as following:
>
> CommClient.cpp
> /***********************************************************************/
> #include “CommClient.h”
> #include <windows.h>
>> #include <fltuser.h>
>> #include <stdio.h>
>>
>> #define COMM_PORT_NAME L"\CommPort"
>>
>> typedef enum _READ_DIR_COMMAND {
>> FStart
>> } READ_DIR_COMMAND;
>>
>> struct READ_DIR_MESSAGE {
>> READ_DIR_COMMAND Command;
>> };
>>
>> 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.h
>> /****************************************************************************/
>>
>> extern “C” {
>> bool __declspec(dllexport) SendReadMessage(void);
>> };
>>
>> Sources
>> /*****************************************************************************/
>> TARGETNAME=CommClient
>>
>> TARGETPATH=obj
>>
>> TARGETTYPE=DYNLINK
>>
>> UMTYPE=windows
>>
>>
>> USE_MSVCRT=1
>>
>>
>> #TARGETLIBS=$(TARGETLIBS) <br>>> # $(IFSKIT_LIB_PATH)\fltLib.lib
>>
>> TARGETLIBS=$(TARGETLIBS) <br>>> $(IFSKIT_LIB_PATH)\fltLib.lib <br>>> $(SDK_LIB_PATH)\kernel32.lib <br>>> $(SDK_LIB_PATH)\advapi32.lib
>>
>> INCLUDES=$(INCLUDES); <br>>> $(IFSKIT_INC_PATH); <br>>> $(DDK_INC_PATH); <br>>> …\inc
>>
>> DEFFILE=CommClient.def
>>
>> SOURCES = CommClient.cpp
>>
>>
>> The build result is as following:
>> D:\incubator\CommClient>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 10:14:57 2008
>> BUILD: Examining d:\incubator\commclient directory for files to compile.
>> d:\incubator\commclient - 1 source files (41 lines)
>> BUILD: Saving c:\winddk\6000\build.dat…
>> BUILD: Compiling d:\incubator\commclient directory
>> _NT_TARGET_VERSION SET TO WINXP
>> Compiling - commclient.cpp
>> errors in directory d:\incubator\commclient
>> d:\incubator\commclient\commclient.cpp(24) : error C3861:
>> ‘FilterConnectCommunic
>> ationPort’: identifier not found
>> d:\incubator\commclient\commclient.cpp(36) : error C3861:
>> ‘FilterSendMessage’: i
>> dentifier not found
>> Building Library - objchk_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\commclient directory
>> BUILD: Finish time: Wed Jan 16 10:14:58 2008
>> BUILD: Done
>>
>> 3 files compiled - 2 Errors
>> 1 library built - 1 Error
>>
>> D:\incubator\CommClient>
>>
>> The declare of FilterSendMessage and FilterConnectCommunic is in FltUser.h.
>> error C3861: ‘FilterConnectCommunicationPort’: identifier not found
>> error C3861: ‘FilterSendMessage’: identifier not found
>>
>> why??
>>
></stdio.h></fltuser.h></windows.h>

Martin O’Brien, follow your advice, rebuild and part content in
buildchk_wxp_x86.log is as following:

commclient.cpp
Note: including file: C:\WinDDK\6000\inc\api\warning.h
Note: including file: C:\WinDDK\6000\inc\api\suppress.h
Note: including file: C:\WinDDK\6000\inc\api\windows.h
Note: including file: C:\WinDDK\6000\inc\api\sdkddkver.h
Note: including file: C:\WinDDK\6000\inc\crt\excpt.h
Note: including file: C:\WinDDK\6000\inc\crt\crtdefs.h
Note: including file: C:\WinDDK\6000\inc\api\specstrings.h
Note: including file: C:\WinDDK\6000\inc\api\sal.h
Note: including file: C:\WinDDK\6000\inc\api\specstrings_adt.h
Note: including file: C:\WinDDK\6000\inc\api\specstrings_strict.h
Note: including file: C:\WinDDK\6000\inc\api\specstrings_undef.h
Note: including file: C:\WinDDK\6000\inc\crt\stdarg.h
Note: including file: C:\WinDDK\6000\inc\crt\crtdefs.h
Note: including file: C:\WinDDK\6000\inc\crt\vadefs.h
Note: including file: C:\WinDDK\6000\inc\crt\crtdefs.h
Note: including file: C:\WinDDK\6000\inc\api\windef.h
Note: including file: C:\WinDDK\6000\inc\api\winnt.h
Note: including file: C:\WinDDK\6000\inc\crt\ctype.h
Note: including file: C:\WinDDK\6000\inc\crt\crtdefs.h
Note: including file: C:\WinDDK\6000\inc\api\basetsd.h
Note: including file: C:\WinDDK\6000\inc\api\guiddef.h
Note: including file: C:\WinDDK\6000\inc\crt\string.h
Note: including file: C:\WinDDK\6000\inc\crt\crtdefs.h
Note: including file: C:\WinDDK\6000\inc\api\pshpack4.h
Note: including file: C:\WinDDK\6000\inc\api\poppack.h
Note: including file: c:\winddk\6000\inc\api\pshpack4.h
Note: including file: c:\winddk\6000\inc\api\pshpack2.h
Note: including file: c:\winddk\6000\inc\api\poppack.h
Note: including file: c:\winddk\6000\inc\api\pshpack2.h
Note: including file: C:\WinDDK\6000\inc\api\pshpack2.h
Note: including file: C:\WinDDK\6000\inc\api\poppack.h
Note: including file: c:\winddk\6000\inc\api\poppack.h
Note: including file: c:\winddk\6000\inc\api\pshpack8.h
Note: including file: c:\winddk\6000\inc\api\poppack.h
Note: including file: c:\winddk\6000\inc\api\poppack.h
Note: including file: C:\WinDDK\6000\inc\api\ktmtypes.h
Note: including file: C:\WinDDK\6000\inc\api\winbase.h
Note: including file: C:\WinDDK\6000\inc\api\winerror.h
Note: including file: C:\WinDDK\6000\inc\api\wingdi.h
Note: including file: C:\WinDDK\6000\inc\api\pshpack1.h
Note: including file: C:\WinDDK\6000\inc\api\poppack.h
Note: including file: C:\WinDDK\6000\inc\api\pshpack2.h
Note: including file: C:\WinDDK\6000\inc\api\poppack.h
Note: including file: C:\WinDDK\6000\inc\api\pshpack2.h
Note: including file: C:\WinDDK\6000\inc\api\poppack.h
Note: including file: C:\WinDDK\6000\inc\api\pshpack4.h
Note: including file: C:\WinDDK\6000\inc\api\poppack.h
Note: including file: C:\WinDDK\6000\inc\api\pshpack4.h
Note: including file: C:\WinDDK\6000\inc\api\poppack.h
Note: including file: C:\WinDDK\6000\inc\api\winuser.h
Note: including file: C:\WinDDK\6000\inc\api\pshpack2.h
Note: including file: C:\WinDDK\6000\inc\api\poppack.h
Note: including file: C:\WinDDK\6000\inc\api\tvout.h
Note: including file: C:\WinDDK\6000\inc\api\winnls.h
Note: including file: C:\WinDDK\6000\inc\api\wincon.h
Note: including file: C:\WinDDK\6000\inc\api\winver.h
Note: including file: C:\WinDDK\6000\inc\api\winreg.h
Note: including file: C:\WinDDK\6000\inc\api\reason.h
Note: including file: C:\WinDDK\6000\inc\api\winnetwk.h
Note: including file: C:\WinDDK\6000\inc\api\stralign.h
Note: including file: C:\WinDDK\6000\inc\api\winsvc.h
Note: including file: C:\WinDDK\6000\inc\api\mcx.h
Note: including file: C:\WinDDK\6000\inc\api\imm.h
Note: including file: C:\WinDDK\6000\inc\ddk\FltUser.h
Note: including file: C:\WinDDK\6000\inc\ddk\fltUserStructures.h
Note: including file: C:\WinDDK\6000\inc\crt\stdio.h
Note: including file: C:\WinDDK\6000\inc\crt\crtdefs.h
Note: including file: C:\WinDDK\6000\inc\crt\swprintf.inl
Note: including file: C:\WinDDK\6000\inc\crt\crtdefs.h
d:\incubator\commclient\commclient.cpp(23) : error C3861:
‘FilterConnectCommunicationPort’: identifier not found
errors in directory d:\incubator\commclient
d:\incubator\commclient\commclient.cpp(23) : error C3861:
‘FilterConnectCommunicationPort’: identifier not found
d:\incubator\commclient\commclient.cpp(35) : error C3861:
‘FilterSendMessage’: identifier not found
d:\incubator\commclient\commclient.cpp(35) : error C3861:
‘FilterSendMessage’: identifier not found
link.exe /lib /nologo /out:objchk_wxp_x86\i386\CommClient.lib
@C:\DOCUME~1\linuxyf\LOCALS~1\Temp\nm4B8.tmp
LINK : fatal error LNK1181: cannot open input file
‘objchk_wxp_x86\i386\commclient.obj’
link : error LNK1181: cannot open input file
‘objchk_wxp_x86\i386\commclient.obj’
Compile errors: not linking d:\incubator\commclient directory *************

Note: including file: C:\WinDDK\6000\inc\ddk\FltUser.h

the FltUser.h has been included. but FilterSendMessage and
FilterConnectCommunicationPort can’t be found, why

  1. in your sources file get rid of
    UMTYPE=windows

Here is a minimal dll sources file for a dll using fltLib:

TARGETNAME=xxxLib
TARGETTYPE=DYNLINK
DLLENTRY=_DllMainCRTStartup
DLLDEF=xxxLib.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=\
xxxLib.cpp

  1. I have no idea why you are not picking up the definitions for the fltlib api.

2008/1/15 $BJvU-(B :
> Martin O’Brien$B!$(B thank you
>
> follow your advice, my code is as following:
>
> CommClient.cpp
> /***********************************************************************/
> #include “CommClient.h”
> #include <windows.h>
> #include <fltuser.h>
> #include <stdio.h>
>
>
> #define COMM_PORT_NAME L"\CommPort"
>
> typedef enum _READ_DIR_COMMAND {
> FStart
> } READ_DIR_COMMAND;
>
> struct READ_DIR_MESSAGE {
> READ_DIR_COMMAND Command;
> };
>
> 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.h
> /****************************************************************************/
> extern “C” {
> bool __declspec(dllexport) SendReadMessage(void);
> };
>
> Sources
> / ***************************************************************************** /
>
> TARGETNAME=CommClient
>
> TARGETPATH=obj
>
> TARGETTYPE=DYNLINK
>
> UMTYPE=windows
>
>
> USE_MSVCRT=1
>
>
> #TARGETLIBS=$(TARGETLIBS) <br>>
> # $(IFSKIT_LIB_PATH)\fltLib.lib
>
> TARGETLIBS=$(TARGETLIBS) <br>> $(IFSKIT_LIB_PATH)\fltLib.lib <br>> $(SDK_LIB_PATH)\kernel32.lib <br>> $(SDK_LIB_PATH)\advapi32.lib
>
>
> INCLUDES=$(INCLUDES); <br>> $(IFSKIT_INC_PATH); <br>> $(DDK_INC_PATH); <br>> …\inc
>
> DEFFILE=CommClient.def
>
> SOURCES = CommClient.cpp
>
>
> The build result is as following:
> D:\incubator\CommClient>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 10:14:57 2008
>
> BUILD: Examining d:\incubator\commclient directory for files to compile.
> d:\incubator\commclient - 1 source files (41 lines)
>
> BUILD: Saving c:\winddk\6000\build.dat…
> BUILD: Compiling d:\incubator\commclient directory
> _NT_TARGET_VERSION SET TO WINXP
> Compiling - commclient.cpp
>
> errors in directory d:\incubator\commclient
> d:\incubator\commclient\commclient.cpp(24) : error C3861: ‘FilterConnectCommunic
> ationPort’: identifier not found
> d:\incubator\commclient\commclient.cpp(36) : error C3861: ‘FilterSendMessage’: i
> dentifier not found
> Building Library - objchk_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\commclient directory
> BUILD: Finish time: Wed Jan 16 10:14:58 2008
> BUILD: Done
>
> 3 files compiled - 2 Errors
> 1 library built - 1 Error
>
> D:\incubator\CommClient>
>
> The declare of FilterSendMessage and FilterConnectCommunic is in FltUser.h.
> error C3861: ‘FilterConnectCommunicationPort’: identifier not found
> error C3861: ‘FilterSendMessage’: identifier not found
>
> why??
> — NTFSD is sponsored by OSR For our schedule debugging and file system seminars (including our new fs mini-filter seminar) visit: http://www.osr.com/seminars You are currently subscribed to ntfsd as: xxxxx@hollistech.com To unsubscribe send a blank email to xxxxx@lists.osr.com


Mark Roddy</stdio.h></fltuser.h></windows.h>

This is very strange. Since FltUser.h is getting included, the only way
that I see that these function prototypes could get skipped is by
conditional compilation is for FLT_MGR_BASELINE to be either undefined
or defined == 0, but I don’t really see how that’s possible either, as
least based on a quick look. Along the way of getting this to build,
you didn’t by any chance do something like rename, replace or modify any
WDK header file, perhaps copy parts from them in to your code, or
perhaps what you posted is not the entire section of code that you are
using or it is old or something?

mm

å³°å§š wrote:

Martin O’Brien, follow your advice, rebuild and part content in
buildchk_wxp_x86.log is as following:

commclient.cpp
Note: including file: C:\WinDDK\6000\inc\api\warning.h
Note: including file: C:\WinDDK\6000\inc\api\suppress.h
Note: including file: C:\WinDDK\6000\inc\api\windows.h
Note: including file: C:\WinDDK\6000\inc\api\sdkddkver.h
Note: including file: C:\WinDDK\6000\inc\crt\excpt.h
Note: including file: C:\WinDDK\6000\inc\crt\crtdefs.h
Note: including file: C:\WinDDK\6000\inc\api\specstrings.h
Note: including file: C:\WinDDK\6000\inc\api\sal.h
Note: including file: C:\WinDDK\6000\inc\api\specstrings_adt.h
Note: including file: C:\WinDDK\6000\inc\api\specstrings_strict.h
Note: including file: C:\WinDDK\6000\inc\api\specstrings_undef.h
Note: including file: C:\WinDDK\6000\inc\crt\stdarg.h
Note: including file: C:\WinDDK\6000\inc\crt\crtdefs.h
Note: including file: C:\WinDDK\6000\inc\crt\vadefs.h
Note: including file: C:\WinDDK\6000\inc\crt\crtdefs.h
Note: including file: C:\WinDDK\6000\inc\api\windef.h
Note: including file: C:\WinDDK\6000\inc\api\winnt.h
Note: including file: C:\WinDDK\6000\inc\crt\ctype.h
Note: including file: C:\WinDDK\6000\inc\crt\crtdefs.h
Note: including file: C:\WinDDK\6000\inc\api\basetsd.h
Note: including file: C:\WinDDK\6000\inc\api\guiddef.h
Note: including file: C:\WinDDK\6000\inc\crt\string.h
Note: including file: C:\WinDDK\6000\inc\crt\crtdefs.h
Note: including file: C:\WinDDK\6000\inc\api\pshpack4.h
Note: including file: C:\WinDDK\6000\inc\api\poppack.h
Note: including file: c:\winddk\6000\inc\api\pshpack4.h
Note: including file: c:\winddk\6000\inc\api\pshpack2.h
Note: including file: c:\winddk\6000\inc\api\poppack.h
Note: including file: c:\winddk\6000\inc\api\pshpack2.h
Note: including file: C:\WinDDK\6000\inc\api\pshpack2.h
Note: including file: C:\WinDDK\6000\inc\api\poppack.h
Note: including file: c:\winddk\6000\inc\api\poppack.h
Note: including file: c:\winddk\6000\inc\api\pshpack8.h
Note: including file: c:\winddk\6000\inc\api\poppack.h
Note: including file: c:\winddk\6000\inc\api\poppack.h
Note: including file: C:\WinDDK\6000\inc\api\ktmtypes.h
Note: including file: C:\WinDDK\6000\inc\api\winbase.h
Note: including file: C:\WinDDK\6000\inc\api\winerror.h
Note: including file: C:\WinDDK\6000\inc\api\wingdi.h
Note: including file: C:\WinDDK\6000\inc\api\pshpack1.h
Note: including file: C:\WinDDK\6000\inc\api\poppack.h
Note: including file: C:\WinDDK\6000\inc\api\pshpack2.h
Note: including file: C:\WinDDK\6000\inc\api\poppack.h
Note: including file: C:\WinDDK\6000\inc\api\pshpack2.h
Note: including file: C:\WinDDK\6000\inc\api\poppack.h
Note: including file: C:\WinDDK\6000\inc\api\pshpack4.h
Note: including file: C:\WinDDK\6000\inc\api\poppack.h
Note: including file: C:\WinDDK\6000\inc\api\pshpack4.h
Note: including file: C:\WinDDK\6000\inc\api\poppack.h
Note: including file: C:\WinDDK\6000\inc\api\winuser.h
Note: including file: C:\WinDDK\6000\inc\api\pshpack2.h
Note: including file: C:\WinDDK\6000\inc\api\poppack.h
Note: including file: C:\WinDDK\6000\inc\api\tvout.h
Note: including file: C:\WinDDK\6000\inc\api\winnls.h
Note: including file: C:\WinDDK\6000\inc\api\wincon.h
Note: including file: C:\WinDDK\6000\inc\api\winver.h
Note: including file: C:\WinDDK\6000\inc\api\winreg.h
Note: including file: C:\WinDDK\6000\inc\api\reason.h
Note: including file: C:\WinDDK\6000\inc\api\winnetwk.h
Note: including file: C:\WinDDK\6000\inc\api\stralign.h
Note: including file: C:\WinDDK\6000\inc\api\winsvc.h
Note: including file: C:\WinDDK\6000\inc\api\mcx.h
Note: including file: C:\WinDDK\6000\inc\api\imm.h
Note: including file: C:\WinDDK\6000\inc\ddk\FltUser.h
Note: including file: C:\WinDDK\6000\inc\ddk\fltUserStructures.h
Note: including file: C:\WinDDK\6000\inc\crt\stdio.h
Note: including file: C:\WinDDK\6000\inc\crt\crtdefs.h
Note: including file: C:\WinDDK\6000\inc\crt\swprintf.inl
Note: including file: C:\WinDDK\6000\inc\crt\crtdefs.h
d:\incubator\commclient\commclient.cpp(23) : error C3861:
‘FilterConnectCommunicationPort’: identifier not found
errors in directory d:\incubator\commclient
d:\incubator\commclient\commclient.cpp(23) : error C3861:
‘FilterConnectCommunicationPort’: identifier not found
d:\incubator\commclient\commclient.cpp(35) : error C3861:
‘FilterSendMessage’: identifier not found
d:\incubator\commclient\commclient.cpp(35) : error C3861:
‘FilterSendMessage’: identifier not found
link.exe /lib /nologo /out:objchk_wxp_x86\i386\CommClient.lib
@C:\DOCUME~1\linuxyf\LOCALS~1\Temp\nm4B8.tmp
LINK : fatal error LNK1181: cannot open input file
‘objchk_wxp_x86\i386\commclient.obj’
link : error LNK1181: cannot open input file
‘objchk_wxp_x86\i386\commclient.obj’
Compile errors: not linking d:\incubator\commclient directory *************

Note: including file: C:\WinDDK\6000\inc\ddk\FltUser.h

the FltUser.h has been included. but FilterSendMessage and
FilterConnectCommunicationPort can’t be found, why

Is UMTYPE incorrect or just unnecessary? Just wondering as although I
knew ‘UMTYPE=nt’ was definitely wrong, this was a guess on my part.

mm

Mark Roddy wrote:

  1. in your sources file get rid of
    UMTYPE=windows

Here is a minimal dll sources file for a dll using fltLib:

TARGETNAME=xxxLib
TARGETTYPE=DYNLINK
DLLENTRY=_DllMainCRTStartup
DLLDEF=xxxLib.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=\
xxxLib.cpp

  1. I have no idea why you are not picking up the definitions for the fltlib api.

2008/1/15 $BJvU-(B :
>> Martin O’Brien$B!$(B thank you
>>
>> follow your advice, my code is as following:
>>
>> CommClient.cpp
>> /***********************************************************************/
>> #include “CommClient.h”
>> #include <windows.h>
>> #include <fltuser.h>
>> #include <stdio.h>
>>
>>
>> #define COMM_PORT_NAME L"\CommPort"
>>
>> typedef enum _READ_DIR_COMMAND {
>> FStart
>> } READ_DIR_COMMAND;
>>
>> struct READ_DIR_MESSAGE {
>> READ_DIR_COMMAND Command;
>> };
>>
>> 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.h
>> /****************************************************************************/
>> extern “C” {
>> bool __declspec(dllexport) SendReadMessage(void);
>> };
>>
>> Sources
>> / ***************************************************************************** /
>>
>> TARGETNAME=CommClient
>>
>> TARGETPATH=obj
>>
>> TARGETTYPE=DYNLINK
>>
>> UMTYPE=windows
>>
>>
>> USE_MSVCRT=1
>>
>>
>> #TARGETLIBS=$(TARGETLIBS) <br>>>
>> # $(IFSKIT_LIB_PATH)\fltLib.lib
>>
>> TARGETLIBS=$(TARGETLIBS) <br>>> $(IFSKIT_LIB_PATH)\fltLib.lib <br>>> $(SDK_LIB_PATH)\kernel32.lib <br>>> $(SDK_LIB_PATH)\advapi32.lib
>>
>>
>> INCLUDES=$(INCLUDES); <br>>> $(IFSKIT_INC_PATH); <br>>> $(DDK_INC_PATH); <br>>> …\inc
>>
>> DEFFILE=CommClient.def
>>
>> SOURCES = CommClient.cpp
>>
>>
>> The build result is as following:
>> D:\incubator\CommClient>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 10:14:57 2008
>>
>> BUILD: Examining d:\incubator\commclient directory for files to compile.
>> d:\incubator\commclient - 1 source files (41 lines)
>>
>> BUILD: Saving c:\winddk\6000\build.dat…
>> BUILD: Compiling d:\incubator\commclient directory
>> _NT_TARGET_VERSION SET TO WINXP
>> Compiling - commclient.cpp
>>
>> errors in directory d:\incubator\commclient
>> d:\incubator\commclient\commclient.cpp(24) : error C3861: ‘FilterConnectCommunic
>> ationPort’: identifier not found
>> d:\incubator\commclient\commclient.cpp(36) : error C3861: ‘FilterSendMessage’: i
>> dentifier not found
>> Building Library - objchk_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\commclient directory
>> BUILD: Finish time: Wed Jan 16 10:14:58 2008
>> BUILD: Done
>>
>> 3 files compiled - 2 Errors
>> 1 library built - 1 Error
>>
>> D:\incubator\CommClient>
>>
>> The declare of FilterSendMessage and FilterConnectCommunic is in FltUser.h.
>> error C3861: ‘FilterConnectCommunicationPort’: identifier not found
>> error C3861: ‘FilterSendMessage’: identifier not found
>>
>> why??
>> — NTFSD is sponsored by OSR For our schedule debugging and file system seminars (including our new fs mini-filter seminar) visit: http://www.osr.com/seminars You are currently subscribed to ntfsd as: xxxxx@hollistech.com To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
></stdio.h></fltuser.h></windows.h>

  1. I have no idea why you are not picking up the definitions for the fltlib
    api.

I can’t catch the meaning. would you explain it detailly? thanks very much.

i build the CommClient.cpp with such sources. the build result
FilterSendMessage and

FilterConnectCommunicationPort can’t be found

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

It is for specifying the ‘exe’ type. For dlls there is no exe type,
they are just dlls. It probably does no harm and removing it did not
fix his problem. The OP insists on starting new threads. I’ve built
his project on my system just fine. His system is screwed up.

2008/1/15 Martin O’Brien :
> Is UMTYPE incorrect or just unnecessary? Just wondering as although I
> knew ‘UMTYPE=nt’ was definitely wrong, this was a guess on my part.
>
> mm
>
> Mark Roddy wrote:
> > 1. in your sources file get rid of
> > UMTYPE=windows
> >
> > Here is a minimal dll sources file for a dll using fltLib:
> >
> > TARGETNAME=xxxLib
> > TARGETTYPE=DYNLINK
> > DLLENTRY=_DllMainCRTStartup
> > DLLDEF=xxxLib.def
> > USE_MSVCRT=1
> >
> >
> > TARGETPATH=…\lib$(BUILD_ALT_DIR)
> >
> > TARGETLIBS=$(TARGETLIBS) <br>> > $(IFSKIT_LIB_PATH)\fltLib.lib <br>> > $(SDK_LIB_PATH)\kernel32.lib
> >
> > C_DEFINES=$(C_DEFINES) -DUNICODE -D_UNICODE
> >
> > INCLUDES=$(INCLUDES); <br>> > $(IFSKIT_INC_PATH); <br>> > $(DDK_INC_PATH);
> >
> >
> > SOURCES=<br>> > xxxLib.cpp
> >
> > 2. I have no idea why you are not picking up the definitions for the fltlib api.
> >
> > 2008/1/15 $BJvU-(B :
>
> >> Martin O’Brien$B!$(B thank you
> >>
> >> follow your advice, my code is as following:
> >>
> >> CommClient.cpp
> >> /***********************************************************************/
> >> #include “CommClient.h”
> >> #include <windows.h>
> >> #include <fltuser.h>
> >> #include <stdio.h>
> >>
> >>
> >> #define COMM_PORT_NAME L"\CommPort"
> >>
> >> typedef enum _READ_DIR_COMMAND {
> >> FStart
> >> } READ_DIR_COMMAND;
> >>
> >> struct READ_DIR_MESSAGE {
> >> READ_DIR_COMMAND Command;
> >> };
> >>
> >> 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.h
> >> /****************************************************************************/
> >> extern “C” {
> >> bool __declspec(dllexport) SendReadMessage(void);
> >> };
> >>
> >> Sources
> >> / ***************************************************************************** /
> >>
> >> TARGETNAME=CommClient
> >>
> >> TARGETPATH=obj
> >>
> >> TARGETTYPE=DYNLINK
> >>
> >> UMTYPE=windows
> >>
> >>
> >> USE_MSVCRT=1
> >>
> >>
> >> #TARGETLIBS=$(TARGETLIBS) <br>> >>
> >> # $(IFSKIT_LIB_PATH)\fltLib.lib
> >>
> >> TARGETLIBS=$(TARGETLIBS) <br>> >> $(IFSKIT_LIB_PATH)\fltLib.lib <br>> >> $(SDK_LIB_PATH)\kernel32.lib <br>> >> $(SDK_LIB_PATH)\advapi32.lib
> >>
> >>
> >> INCLUDES=$(INCLUDES); <br>> >> $(IFSKIT_INC_PATH); <br>> >> $(DDK_INC_PATH); <br>> >> …\inc
> >>
> >> DEFFILE=CommClient.def
> >>
> >> SOURCES = CommClient.cpp
> >>
> >>
> >> The build result is as following:
> >> D:\incubator\CommClient>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 10:14:57 2008
> >>
> >> BUILD: Examining d:\incubator\commclient directory for files to compile.
> >> d:\incubator\commclient - 1 source files (41 lines)
> >>
> >> BUILD: Saving c:\winddk\6000\build.dat…
> >> BUILD: Compiling d:\incubator\commclient directory
> >> _NT_TARGET_VERSION SET TO WINXP
> >> Compiling - commclient.cpp
> >>
> >> errors in directory d:\incubator\commclient
> >> d:\incubator\commclient\commclient.cpp(24) : error C3861: ‘FilterConnectCommunic
> >> ationPort’: identifier not found
> >> d:\incubator\commclient\commclient.cpp(36) : error C3861: ‘FilterSendMessage’: i
> >> dentifier not found
> >> Building Library - objchk_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\commclient directory
> >> BUILD: Finish time: Wed Jan 16 10:14:58 2008
> >> BUILD: Done
> >>
> >> 3 files compiled - 2 Errors
> >> 1 library built - 1 Error
> >>
> >> D:\incubator\CommClient>
> >>
> >> The declare of FilterSendMessage and FilterConnectCommunic is in FltUser.h.
> >> error C3861: ‘FilterConnectCommunicationPort’: identifier not found
> >> error C3861: ‘FilterSendMessage’: identifier not found
> >>
> >> why??
> >> — NTFSD is sponsored by OSR For our schedule debugging and file system seminars (including our new fs mini-filter seminar) visit: http://www.osr.com/seminars You are currently subscribed to ntfsd as: xxxxx@hollistech.com To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> >
>
> —
> NTFSD is sponsored by OSR
>
> For our schedule debugging and file system seminars
> (including our new fs mini-filter seminar) visit:
> http://www.osr.com/seminars
>
> You are currently subscribed to ntfsd as: xxxxx@hollistech.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>


Mark Roddy</stdio.h></fltuser.h></windows.h>

Here is the SOURCES file of one of my user-mode DLLs:

TARGETNAME=mydll
TARGETPATH=obj
TARGETTYPE=DYNLINK

UMTYPE=console
DLLBASE=0x30050000
DLLENTRY=_DllMainCRTStartup

USE_MSVCRT=1
USE_PDB=1
MSC_WARNING_LEVEL=/W4 /WX

!IF !$(FREEBUILD)
MSC_OPTIMIZATION=/Od
!ENDIF

TARGETLIBS=$(SDK_LIB_PATH)\kernel32.lib \
$(SDK_LIB_PATH)\ole32.lib \
$(SDK_LIB_PATH)\oleaut32.lib \
$(SDK_LIB_PATH)\rpcrt4.lib

SOURCES=mydll.c mydll.rc


Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

> DLLDEF=xxxLib.def

DLLDEF is optional, the default is $(TARGETNAME).def


Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

My bad. I took a quick look and thought it was used to specify the
subsystem.

Thanks,

mm

Mark Roddy wrote:

It is for specifying the ‘exe’ type. For dlls there is no exe type,
they are just dlls. It probably does no harm and removing it did not
fix his problem. The OP insists on starting new threads. I’ve built
his project on my system just fine. His system is screwed up.

2008/1/15 Martin O’Brien :
>> Is UMTYPE incorrect or just unnecessary? Just wondering as although I
>> knew ‘UMTYPE=nt’ was definitely wrong, this was a guess on my part.
>>
>> mm
>>
>> Mark Roddy wrote:
>>> 1. in your sources file get rid of
>>> UMTYPE=windows
>>>
>>> Here is a minimal dll sources file for a dll using fltLib:
>>>
>>> TARGETNAME=xxxLib
>>> TARGETTYPE=DYNLINK
>>> DLLENTRY=_DllMainCRTStartup
>>> DLLDEF=xxxLib.def
>>> USE_MSVCRT=1
>>>
>>>
>>> TARGETPATH=…\lib$(BUILD_ALT_DIR)
>>>
>>> TARGETLIBS=$(TARGETLIBS) <br>>>> $(IFSKIT_LIB_PATH)\fltLib.lib <br>>>> $(SDK_LIB_PATH)\kernel32.lib
>>>
>>> C_DEFINES=$(C_DEFINES) -DUNICODE -D_UNICODE
>>>
>>> INCLUDES=$(INCLUDES); <br>>>> $(IFSKIT_INC_PATH); <br>>>> $(DDK_INC_PATH);
>>>
>>>
>>> SOURCES=<br>>>> xxxLib.cpp
>>>
>>> 2. I have no idea why you are not picking up the definitions for the fltlib api.
>>>
>>> 2008/1/15 $BJvU-(B :
>>>> Martin O’Brien$B!$(B thank you
>>>>
>>>> follow your advice, my code is as following:
>>>>
>>>> CommClient.cpp
>>>> /***********************************************************************/
>>>> #include “CommClient.h”
>>>> #include <windows.h>
>>>> #include <fltuser.h>
>>>> #include <stdio.h>
>>>>
>>>>
>>>> #define COMM_PORT_NAME L"\CommPort"
>>>>
>>>> typedef enum _READ_DIR_COMMAND {
>>>> FStart
>>>> } READ_DIR_COMMAND;
>>>>
>>>> struct READ_DIR_MESSAGE {
>>>> READ_DIR_COMMAND Command;
>>>> };
>>>>
>>>> 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.h
>>>> /****************************************************************************/
>>>> extern “C” {
>>>> bool __declspec(dllexport) SendReadMessage(void);
>>>> };
>>>>
>>>> Sources
>>>> / ***************************************************************************** /
>>>>
>>>> TARGETNAME=CommClient
>>>>
>>>> TARGETPATH=obj
>>>>
>>>> TARGETTYPE=DYNLINK
>>>>
>>>> UMTYPE=windows
>>>>
>>>>
>>>> USE_MSVCRT=1
>>>>
>>>>
>>>> #TARGETLIBS=$(TARGETLIBS) <br>>>>>
>>>> # $(IFSKIT_LIB_PATH)\fltLib.lib
>>>>
>>>> TARGETLIBS=$(TARGETLIBS) <br>>>>> $(IFSKIT_LIB_PATH)\fltLib.lib <br>>>>> $(SDK_LIB_PATH)\kernel32.lib <br>>>>> $(SDK_LIB_PATH)\advapi32.lib
>>>>
>>>>
>>>> INCLUDES=$(INCLUDES); <br>>>>> $(IFSKIT_INC_PATH); <br>>>>> $(DDK_INC_PATH); <br>>>>> …\inc
>>>>
>>>> DEFFILE=CommClient.def
>>>>
>>>> SOURCES = CommClient.cpp
>>>>
>>>>
>>>> The build result is as following:
>>>> D:\incubator\CommClient>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 10:14:57 2008
>>>>
>>>> BUILD: Examining d:\incubator\commclient directory for files to compile.
>>>> d:\incubator\commclient - 1 source files (41 lines)
>>>>
>>>> BUILD: Saving c:\winddk\6000\build.dat…
>>>> BUILD: Compiling d:\incubator\commclient directory
>>>> _NT_TARGET_VERSION SET TO WINXP
>>>> Compiling - commclient.cpp
>>>>
>>>> errors in directory d:\incubator\commclient
>>>> d:\incubator\commclient\commclient.cpp(24) : error C3861: ‘FilterConnectCommunic
>>>> ationPort’: identifier not found
>>>> d:\incubator\commclient\commclient.cpp(36) : error C3861: ‘FilterSendMessage’: i
>>>> dentifier not found
>>>> Building Library - objchk_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\commclient directory
>>>> BUILD: Finish time: Wed Jan 16 10:14:58 2008
>>>> BUILD: Done
>>>>
>>>> 3 files compiled - 2 Errors
>>>> 1 library built - 1 Error
>>>>
>>>> D:\incubator\CommClient>
>>>>
>>>> The declare of FilterSendMessage and FilterConnectCommunic is in FltUser.h.
>>>> error C3861: ‘FilterConnectCommunicationPort’: identifier not found
>>>> error C3861: ‘FilterSendMessage’: identifier not found
>>>>
>>>> why??
>>>> — NTFSD is sponsored by OSR For our schedule debugging and file system seminars (including our new fs mini-filter seminar) visit: http://www.osr.com/seminars You are currently subscribed to ntfsd as: xxxxx@hollistech.com To unsubscribe send a blank email to xxxxx@lists.osr.com
>>>
>>>
>> —
>> NTFSD is sponsored by OSR
>>
>> For our schedule debugging and file system seminars
>> (including our new fs mini-filter seminar) visit:
>> http://www.osr.com/seminars
>>
>> You are currently subscribed to ntfsd as: xxxxx@hollistech.com
>> To unsubscribe send a blank email to xxxxx@lists.osr.com
>>
>
>
></stdio.h></fltuser.h></windows.h>

Thanks everyone

I build fine after i reboot my computer with following sources

TARGETNAME=CommClient
TARGETTYPE=DYNLINK
DLLENTRY=_DllMainCRTStartup
USE_MSVCRT=1

TARGETPATH=obj

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

USER_C_FLAGS=-showIncludes

2008/1/16 Martin O’Brien :

> My bad. I took a quick look and thought it was used to specify the
> subsystem.
>
> Thanks,
>
> mm
>
> Mark Roddy wrote:
> > It is for specifying the ‘exe’ type. For dlls there is no exe type,
> > they are just dlls. It probably does no harm and removing it did not
> > fix his problem. The OP insists on starting new threads. I’ve built
> > his project on my system just fine. His system is screwed up.
> >
> > 2008/1/15 Martin O’Brien :
> >> Is UMTYPE incorrect or just unnecessary? Just wondering as although I
> >> knew ‘UMTYPE=nt’ was definitely wrong, this was a guess on my part.
> >>
> >> mm
> >>
> >> Mark Roddy wrote:
> >>> 1. in your sources file get rid of
> >>> UMTYPE=windows
> >>>
> >>> Here is a minimal dll sources file for a dll using fltLib:
> >>>
> >>> TARGETNAME=xxxLib
> >>> TARGETTYPE=DYNLINK
> >>> DLLENTRY=_DllMainCRTStartup
> >>> DLLDEF=xxxLib.def
> >>> USE_MSVCRT=1
> >>>
> >>>
> >>> TARGETPATH=…\lib$(BUILD_ALT_DIR)
> >>>
> >>> TARGETLIBS=$(TARGETLIBS) <br>> >>> $(IFSKIT_LIB_PATH)\fltLib.lib <br>> >>> $(SDK_LIB_PATH)\kernel32.lib
> >>>
> >>> C_DEFINES=$(C_DEFINES) -DUNICODE -D_UNICODE
> >>>
> >>> INCLUDES=$(INCLUDES); <br>> >>> $(IFSKIT_INC_PATH); <br>> >>> $(DDK_INC_PATH);
> >>>
> >>>
> >>> SOURCES=<br>> >>> xxxLib.cpp
> >>>
> >>> 2. I have no idea why you are not picking up the definitions for the
> fltlib api.
> >>>
> >>> 2008/1/15 $BJvU-(B :
> >>>> Martin O’Brien$B!$(B thank you
> >>>>
> >>>> follow your advice, my code is as following:
> >>>>
> >>>> CommClient.cpp
> >>>>
> /***********************************************************************/
> >>>> #include “CommClient.h”
> >>>> #include <windows.h>
> >>>> #include <fltuser.h>
> >>>> #include <stdio.h>
> >>>>
> >>>>
> >>>> #define COMM_PORT_NAME L"\CommPort"
> >>>>
> >>>> typedef enum _READ_DIR_COMMAND {
> >>>> FStart
> >>>> } READ_DIR_COMMAND;
> >>>>
> >>>> struct READ_DIR_MESSAGE {
> >>>> READ_DIR_COMMAND Command;
> >>>> };
> >>>>
> >>>> 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.h
> >>>>
> /****************************************************************************/
> >>>> extern “C” {
> >>>> bool __declspec(dllexport) SendReadMessage(void);
> >>>> };
> >>>>
> >>>> Sources
> >>>>
> / ***************************************************************************** /
> >>>>
> >>>> TARGETNAME=CommClient
> >>>>
> >>>> TARGETPATH=obj
> >>>>
> >>>> TARGETTYPE=DYNLINK
> >>>>
> >>>> UMTYPE=windows
> >>>>
> >>>>
> >>>> USE_MSVCRT=1
> >>>>
> >>>>
> >>>> #TARGETLIBS=$(TARGETLIBS) <br>> >>>>
> >>>> # $(IFSKIT_LIB_PATH)\fltLib.lib
> >>>>
> >>>> TARGETLIBS=$(TARGETLIBS) <br>> >>>> $(IFSKIT_LIB_PATH)\fltLib.lib <br>> >>>> $(SDK_LIB_PATH)\kernel32.lib <br>> >>>> $(SDK_LIB_PATH)\advapi32.lib
> >>>>
> >>>>
> >>>> INCLUDES=$(INCLUDES); <br>> >>>> $(IFSKIT_INC_PATH); <br>> >>>> $(DDK_INC_PATH); <br>> >>>> …\inc
> >>>>
> >>>> DEFFILE=CommClient.def
> >>>>
> >>>> SOURCES = CommClient.cpp
> >>>>
> >>>>
> >>>> The build result is as following:
> >>>> D:\incubator\CommClient>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 10:14:57 2008
> >>>>
> >>>> BUILD: Examining d:\incubator\commclient directory for files to
> compile.
> >>>> d:\incubator\commclient - 1 source files (41 lines)
> >>>>
> >>>> BUILD: Saving c:\winddk\6000\build.dat…
> >>>> BUILD: Compiling d:\incubator\commclient directory
> >>>> _NT_TARGET_VERSION SET TO WINXP
> >>>> Compiling - commclient.cpp
> >>>>
> >>>> errors in directory d:\incubator\commclient
> >>>> d:\incubator\commclient\commclient.cpp(24) : error C3861:
> ‘FilterConnectCommunic
> >>>> ationPort’: identifier not found
> >>>> d:\incubator\commclient\commclient.cpp(36) : error C3861:
> ‘FilterSendMessage’: i
> >>>> dentifier not found
> >>>> Building Library - objchk_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\commclient directory
> >>>> BUILD: Finish time: Wed Jan 16 10:14:58 2008
> >>>> BUILD: Done
> >>>>
> >>>> 3 files compiled - 2 Errors
> >>>> 1 library built - 1 Error
> >>>>
> >>>> D:\incubator\CommClient>
> >>>>
> >>>> The declare of FilterSendMessage and FilterConnectCommunic is in
> FltUser.h.
> >>>> error C3861: ‘FilterConnectCommunicationPort’: identifier not found
> >>>> error C3861: ‘FilterSendMessage’: identifier not found
> >>>>
> >>>> why??
> >>>> — NTFSD is sponsored by OSR For our schedule debugging and file
> system seminars (including our new fs mini-filter seminar) visit:
> http://www.osr.com/seminars You are currently subscribed to ntfsd as:
> xxxxx@hollistech.com To unsubscribe send a blank email to
> xxxxx@lists.osr.com
> >>>
> >>>
> >> —
> >> NTFSD is sponsored by OSR
> >>
> >> For our schedule debugging and file system seminars
> >> (including our new fs mini-filter seminar) visit:
> >> http://www.osr.com/seminars
> >>
> >> You are currently subscribed to ntfsd as: xxxxx@hollistech.com
> >> To unsubscribe send a blank email to xxxxx@lists.osr.com
> >>
> >
> >
> >
>
> —
> NTFSD is sponsored by OSR
>
> For our schedule debugging and file system seminars
> (including our new fs mini-filter seminar) visit:
> http://www.osr.com/seminars
>
> You are currently subscribed to ntfsd as: xxxxx@gmail.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
></stdio.h></fltuser.h></windows.h>