FltSendMessage giving error STATUS_PORT_DISCONNECTED

Hi ,

I am new to Driver Development. I want to send a message from my driver to
a simple user application.
So I have called FltSendMessage in the driver code in PreOperationWrite
routine.
And FilterGetMessage in the user app.

FltSendMessage( gFilterHandle, &gClientPort,
SenderBuffer,sizeof(SenderBuffer),NULL, &ReplyLength,NULL);

I am closing the port in Unload routine.

So how come FltSendMessage is returning STATUS_PORT_DISCONNECTED error ?


Regards,
Annu Agrawal

Please see Scanner example. First, kernel-mode driver must create a
communication port (FltCreateCommunicationPort), then user-mode application
connects to this port (FilterConnectCommunicationPort – your
ConnectNotifyCallback function will be invoked) and then user-mode app calls
FilterGetMessage. Check before FltSendMessage calling, that both
client/server ports are initialized, valid and that your
DisconnectNotifyCallback wasn’t invoked. You can also use !fltkd.filter
command to check communication port list.

Do you really need to call user-mode app from your PreOperationWrite
routine? Sometimes you can use filter manager’s contexts to propagate such
information into cleanup routine and then perform some actions with the
file.

Hi Petr ,

Thanks for the reply.
I used !fltkd.filter command and figured out the mistake.
The problem was with the FILTER_MESSAGE_HEADER member in the structure
which is needed to be passed in filtergetmessage function.
I was using its pointer instead of the structure itself.

On Wed, Jan 8, 2014 at 8:10 PM, Petr Kurtin wrote:

> Please see Scanner example. First, kernel-mode driver must create a
> communication port (FltCreateCommunicationPort), then user-mode application
> connects to this port (FilterConnectCommunicationPort – your
> ConnectNotifyCallback function will be invoked) and then user-mode app
> calls FilterGetMessage. Check before FltSendMessage calling, that both
> client/server ports are initialized, valid and that your
> DisconnectNotifyCallback wasn’t invoked. You can also use !fltkd.filter
> command to check communication port list.
>
>
>
> Do you really need to call user-mode app from your PreOperationWrite
> routine? Sometimes you can use filter manager’s contexts to propagate such
> information into cleanup routine and then perform some actions with the
> file.
>
>
>
> —
> NTFSD is sponsored by OSR
>
> OSR is hiring!! Info at http://www.osr.com/careers
>
> For our schedule of debugging and file system seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>


Regards,
Annu Agrawal