FilterReplyMessage() in another thread

Hi all,

I’m having problems with FilterGetMessage()/FilterReplyMessage() Filter
Manager functions.

My applications is running FilterGetMessage() in a loop. When it receives a
message from the filter driver, it creates a new thread which does the actual
message processing. When the new thread finishes processing the request, it
sends a reply to the filter driver with FilterReplyMessage().

The problem here is that when the worker thread replies to a message with
FilterReplyMessage(), FilterGetMessage() in the main thread receives this
same message again (the message was first received regularly in the loop,
then again when I call FilterReplyMessage()). At this point the main thread
creates another worker thread, but this time FilterReplyMessage() obviously
fails.

Note, that this is definitely a duplicate since:

  • The filter driver debugs show that only ONE message was sent to userland
  • The MessageId is the same for both messages

I searched the WINDDK help for any clues about this issue, but the help pages
for FilterGetMessage()/FilterReplyMessage() do not mention any restrictions
regarding threads.

The scanner example uses IoCompletion ports, but unfortunately I cannot use
that. (FilterGetMessage()/FilterReplyMessage() are used in an API to another
application).

Any suggestions regarding this issue would be really appreciated.

Thanks in advance and regards,
Mitja Horvat

Mitja,

I reviewed the messaging code and this does not make much sense. You
should be able to reply from any thread and the message should not be
directed back up to user land Are your sure your filter isn’t somehow
sending it back up?

If you will send me a simple filter and user mode piece that
demonstrates the problem you are seeing I will be glad to look into
this.

Neal Christiansen
Microsoft File System Filter Group Lead
This posting is provided “AS IS” with no warranties, and confers no
rights

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Mitja Horvat
Sent: Thursday, February 24, 2005 6:29 AM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] FilterReplyMessage() in another thread

Hi all,

I’m having problems with FilterGetMessage()/FilterReplyMessage() Filter
Manager functions.

My applications is running FilterGetMessage() in a loop. When it
receives a
message from the filter driver, it creates a new thread which does the
actual
message processing. When the new thread finishes processing the request,
it
sends a reply to the filter driver with FilterReplyMessage().

The problem here is that when the worker thread replies to a message
with
FilterReplyMessage(), FilterGetMessage() in the main thread receives
this
same message again (the message was first received regularly in the
loop,
then again when I call FilterReplyMessage()). At this point the main
thread
creates another worker thread, but this time FilterReplyMessage()
obviously
fails.

Note, that this is definitely a duplicate since:

  • The filter driver debugs show that only ONE message was sent
    to userland
  • The MessageId is the same for both messages

I searched the WINDDK help for any clues about this issue, but the help
pages
for FilterGetMessage()/FilterReplyMessage() do not mention any
restrictions
regarding threads.

The scanner example uses IoCompletion ports, but unfortunately I cannot
use
that. (FilterGetMessage()/FilterReplyMessage() are used in an API to
another
application).

Any suggestions regarding this issue would be really appreciated.

Thanks in advance and regards,
Mitja Horvat


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Hi Neal,

Sorry for the late response, I have been busy with other things and was not
able to read the list.

I actually found a workaround for this problem - overlapped IO.

I’m 100% the filter is not seinding anything - at least DbgView does not show
this (I call DbgPrint() before the only call to FltSendMessage()). Later on,
I also discovered that (besides duplicated messages) some replies also get
lost (the filter never receives the reply sent from user-space).

Anyway, I re-wrote the code to use overlapped IO with FilterGetMessage() and
wait for the message in WaitForSingleObject() - it works flawlessly.

I don’t have the user source code that triggers this bug anymore, but I can
write another sample if you are still interested.

Regards,
Mitja Horvat

On Sunday 06 of March 2005 01:30, Neal Christiansen wrote:

Mitja,

I reviewed the messaging code and this does not make much sense. You
should be able to reply from any thread and the message should not be
directed back up to user land Are your sure your filter isn’t somehow
sending it back up?

If you will send me a simple filter and user mode piece that
demonstrates the problem you are seeing I will be glad to look into
this.

Neal Christiansen
Microsoft File System Filter Group Lead
This posting is provided “AS IS” with no warranties, and confers no
rights

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Mitja Horvat
Sent: Thursday, February 24, 2005 6:29 AM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] FilterReplyMessage() in another thread

Hi all,

I’m having problems with FilterGetMessage()/FilterReplyMessage() Filter
Manager functions.

My applications is running FilterGetMessage() in a loop. When it
receives a
message from the filter driver, it creates a new thread which does the
actual
message processing. When the new thread finishes processing the request,
it
sends a reply to the filter driver with FilterReplyMessage().

The problem here is that when the worker thread replies to a message
with
FilterReplyMessage(), FilterGetMessage() in the main thread receives
this
same message again (the message was first received regularly in the
loop,
then again when I call FilterReplyMessage()). At this point the main
thread
creates another worker thread, but this time FilterReplyMessage()
obviously
fails.

Note, that this is definitely a duplicate since:

  • The filter driver debugs show that only ONE message was sent
    to userland
  • The MessageId is the same for both messages

I searched the WINDDK help for any clues about this issue, but the help
pages
for FilterGetMessage()/FilterReplyMessage() do not mention any
restrictions
regarding threads.

The scanner example uses IoCompletion ports, but unfortunately I cannot
use
that. (FilterGetMessage()/FilterReplyMessage() are used in an API to
another
application).

Any suggestions regarding this issue would be really appreciated.

Thanks in advance and regards,
Mitja Horvat


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

If you don’t mind I am still interested. To be honest all of our
testing has been done using overlapped IO so there may be a bug if you
are doing this synchronously and if so I would like to find and fix
this.

Neal Christiansen
Microsoft File System Filter Group Lead
This posting is provided “AS IS” with no warranties, and confers no
rights

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Mitja Horvat
Sent: Monday, March 21, 2005 8:03 AM
To: Windows File Systems Devs Interest List
Subject: Re: [ntfsd] FilterReplyMessage() in another thread

Hi Neal,

Sorry for the late response, I have been busy with other things and was
not
able to read the list.

I actually found a workaround for this problem - overlapped IO.

I’m 100% the filter is not seinding anything - at least DbgView does not
show
this (I call DbgPrint() before the only call to FltSendMessage()). Later
on,
I also discovered that (besides duplicated messages) some replies also
get
lost (the filter never receives the reply sent from user-space).

Anyway, I re-wrote the code to use overlapped IO with FilterGetMessage()
and
wait for the message in WaitForSingleObject() - it works flawlessly.

I don’t have the user source code that triggers this bug anymore, but I
can
write another sample if you are still interested.

Regards,
Mitja Horvat

On Sunday 06 of March 2005 01:30, Neal Christiansen wrote:

Mitja,

I reviewed the messaging code and this does not make much sense. You
should be able to reply from any thread and the message should not be
directed back up to user land Are your sure your filter isn’t somehow
sending it back up?

If you will send me a simple filter and user mode piece that
demonstrates the problem you are seeing I will be glad to look into
this.

Neal Christiansen
Microsoft File System Filter Group Lead
This posting is provided “AS IS” with no warranties, and confers no
rights

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Mitja Horvat
Sent: Thursday, February 24, 2005 6:29 AM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] FilterReplyMessage() in another thread

Hi all,

I’m having problems with FilterGetMessage()/FilterReplyMessage()
Filter
Manager functions.

My applications is running FilterGetMessage() in a loop. When it
receives a
message from the filter driver, it creates a new thread which does the
actual
message processing. When the new thread finishes processing the
request,
it
sends a reply to the filter driver with FilterReplyMessage().

The problem here is that when the worker thread replies to a message
with
FilterReplyMessage(), FilterGetMessage() in the main thread receives
this
same message again (the message was first received regularly in the
loop,
then again when I call FilterReplyMessage()). At this point the main
thread
creates another worker thread, but this time FilterReplyMessage()
obviously
fails.

Note, that this is definitely a duplicate since:

  • The filter driver debugs show that only ONE message was sent
    to userland
  • The MessageId is the same for both messages

I searched the WINDDK help for any clues about this issue, but the
help
pages
for FilterGetMessage()/FilterReplyMessage() do not mention any
restrictions
regarding threads.

The scanner example uses IoCompletion ports, but unfortunately I
cannot
use
that. (FilterGetMessage()/FilterReplyMessage() are used in an API to
another
application).

Any suggestions regarding this issue would be really appreciated.

Thanks in advance and regards,
Mitja Horvat


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: unknown lmsubst tag
argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Neal,

I cannot send you the sources I’m currently working on. However, in the next
few weeks I will be writing from scratch a prototype minifilter, which I will
be able to send you without problems.

I will try to reproduce the problem with the prototype and If I succeed, I
will send you the user-space application and the prototype minifilter. Hope
you don’t mind waiting for few weeks …

Regards,
Mitja Horvat

On Thursday 24 of March 2005 10:53, Neal Christiansen wrote:

If you don’t mind I am still interested. To be honest all of our
testing has been done using overlapped IO so there may be a bug if you
are doing this synchronously and if so I would like to find and fix
this.

Neal Christiansen
Microsoft File System Filter Group Lead
This posting is provided “AS IS” with no warranties, and confers no
rights

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Mitja Horvat
Sent: Monday, March 21, 2005 8:03 AM
To: Windows File Systems Devs Interest List
Subject: Re: [ntfsd] FilterReplyMessage() in another thread

Hi Neal,

Sorry for the late response, I have been busy with other things and was
not
able to read the list.

I actually found a workaround for this problem - overlapped IO.

I’m 100% the filter is not seinding anything - at least DbgView does not
show
this (I call DbgPrint() before the only call to FltSendMessage()). Later
on,
I also discovered that (besides duplicated messages) some replies also
get
lost (the filter never receives the reply sent from user-space).

Anyway, I re-wrote the code to use overlapped IO with FilterGetMessage()
and
wait for the message in WaitForSingleObject() - it works flawlessly.

I don’t have the user source code that triggers this bug anymore, but I
can
write another sample if you are still interested.

Regards,
Mitja Horvat

On Sunday 06 of March 2005 01:30, Neal Christiansen wrote:
> Mitja,
>
> I reviewed the messaging code and this does not make much sense. You
> should be able to reply from any thread and the message should not be
> directed back up to user land Are your sure your filter isn’t somehow
> sending it back up?
>
> If you will send me a simple filter and user mode piece that
> demonstrates the problem you are seeing I will be glad to look into
> this.
>
> Neal Christiansen
> Microsoft File System Filter Group Lead
> This posting is provided “AS IS” with no warranties, and confers no
> rights
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Mitja Horvat
> Sent: Thursday, February 24, 2005 6:29 AM
> To: Windows File Systems Devs Interest List
> Subject: [ntfsd] FilterReplyMessage() in another thread
>
> Hi all,
>
> I’m having problems with FilterGetMessage()/FilterReplyMessage()

Filter

> Manager functions.
>
> My applications is running FilterGetMessage() in a loop. When it
> receives a
> message from the filter driver, it creates a new thread which does the
> actual
> message processing. When the new thread finishes processing the

request,

> it
> sends a reply to the filter driver with FilterReplyMessage().
>
> The problem here is that when the worker thread replies to a message
> with
> FilterReplyMessage(), FilterGetMessage() in the main thread receives
> this
> same message again (the message was first received regularly in the
> loop,
> then again when I call FilterReplyMessage()). At this point the main
> thread
> creates another worker thread, but this time FilterReplyMessage()
> obviously
> fails.
>
> Note, that this is definitely a duplicate since:
> - The filter driver debugs show that only ONE message was sent
> to userland
> - The MessageId is the same for both messages
>
> I searched the WINDDK help for any clues about this issue, but the

help

> pages
> for FilterGetMessage()/FilterReplyMessage() do not mention any
> restrictions
> regarding threads.
>
> The scanner example uses IoCompletion ports, but unfortunately I

cannot

> use
> that. (FilterGetMessage()/FilterReplyMessage() are used in an API to
> another
> application).
>
> Any suggestions regarding this issue would be really appreciated.
>
> Thanks in advance and regards,
> Mitja Horvat
>
>
> —
> Questions? First check the IFS FAQ at
> https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to ntfsd as: xxxxx@windows.microsoft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
> —
> Questions? First check the IFS FAQ at
> https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to ntfsd as: unknown lmsubst tag

argument: ‘’

> To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

That will be fine.

Neal Christiansen
Microsoft File System Filter Group Lead
This posting is provided “AS IS” with no warranties, and confers no
Rights

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Mitja Horvat
Sent: Tuesday, March 29, 2005 6:46 AM
To: Windows File Systems Devs Interest List
Subject: Re: [ntfsd] FilterReplyMessage() in another thread

Neal,

I cannot send you the sources I’m currently working on. However, in the
next
few weeks I will be writing from scratch a prototype minifilter, which I
will
be able to send you without problems.

I will try to reproduce the problem with the prototype and If I succeed,
I
will send you the user-space application and the prototype minifilter.
Hope
you don’t mind waiting for few weeks …

Regards,
Mitja Horvat

On Thursday 24 of March 2005 10:53, Neal Christiansen wrote:

If you don’t mind I am still interested. To be honest all of our
testing has been done using overlapped IO so there may be a bug if you
are doing this synchronously and if so I would like to find and fix
this.

Neal Christiansen
Microsoft File System Filter Group Lead
This posting is provided “AS IS” with no warranties, and confers no
rights

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Mitja Horvat
Sent: Monday, March 21, 2005 8:03 AM
To: Windows File Systems Devs Interest List
Subject: Re: [ntfsd] FilterReplyMessage() in another thread

Hi Neal,

Sorry for the late response, I have been busy with other things and
was
not
able to read the list.

I actually found a workaround for this problem - overlapped IO.

I’m 100% the filter is not seinding anything - at least DbgView does
not
show
this (I call DbgPrint() before the only call to FltSendMessage()).
Later
on,
I also discovered that (besides duplicated messages) some replies also
get
lost (the filter never receives the reply sent from user-space).

Anyway, I re-wrote the code to use overlapped IO with
FilterGetMessage()
and
wait for the message in WaitForSingleObject() - it works flawlessly.

I don’t have the user source code that triggers this bug anymore, but
I
can
write another sample if you are still interested.

Regards,
Mitja Horvat

On Sunday 06 of March 2005 01:30, Neal Christiansen wrote:
> Mitja,
>
> I reviewed the messaging code and this does not make much sense.
You
> should be able to reply from any thread and the message should not
be
> directed back up to user land Are your sure your filter isn’t
somehow
> sending it back up?
>
> If you will send me a simple filter and user mode piece that
> demonstrates the problem you are seeing I will be glad to look into
> this.
>
> Neal Christiansen
> Microsoft File System Filter Group Lead
> This posting is provided “AS IS” with no warranties, and confers no
> rights
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Mitja Horvat
> Sent: Thursday, February 24, 2005 6:29 AM
> To: Windows File Systems Devs Interest List
> Subject: [ntfsd] FilterReplyMessage() in another thread
>
> Hi all,
>
> I’m having problems with FilterGetMessage()/FilterReplyMessage()

Filter

> Manager functions.
>
> My applications is running FilterGetMessage() in a loop. When it
> receives a
> message from the filter driver, it creates a new thread which does
the
> actual
> message processing. When the new thread finishes processing the

request,

> it
> sends a reply to the filter driver with FilterReplyMessage().
>
> The problem here is that when the worker thread replies to a message
> with
> FilterReplyMessage(), FilterGetMessage() in the main thread receives
> this
> same message again (the message was first received regularly in the
> loop,
> then again when I call FilterReplyMessage()). At this point the main
> thread
> creates another worker thread, but this time FilterReplyMessage()
> obviously
> fails.
>
> Note, that this is definitely a duplicate since:
> - The filter driver debugs show that only ONE message was sent
> to userland
> - The MessageId is the same for both messages
>
> I searched the WINDDK help for any clues about this issue, but the

help

> pages
> for FilterGetMessage()/FilterReplyMessage() do not mention any
> restrictions
> regarding threads.
>
> The scanner example uses IoCompletion ports, but unfortunately I

cannot

> use
> that. (FilterGetMessage()/FilterReplyMessage() are used in an API to
> another
> application).
>
> Any suggestions regarding this issue would be really appreciated.
>
> Thanks in advance and regards,
> Mitja Horvat
>
>
> —
> Questions? First check the IFS FAQ at
> https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to ntfsd as:
xxxxx@windows.microsoft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
> —
> Questions? First check the IFS FAQ at
> https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to ntfsd as: unknown lmsubst tag

argument: ‘’

> To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: unknown lmsubst tag
argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com