FltGetStreamHandleContext in PreWrite

Hi everyone,
I’m developing an encryption minifilter, and I got a problem.
My scenario is:
I use the function FltSetStreamHandleContext in PostCreate. It works perfectly with PreRead, but it didn’t work for PreWrite, the system hangs when I start my minifilter.
Can anyone help me please?
Thanks.

More information:
I used FltGetStreamHandleContext in PreRead, and it worked perfectly. But it didn’t in PreWrite.

First up: FltGet or FltSet? you mention both. I have never had any
problems with using FltGet anywhere, but I only ever use FltSet in
PostCreate

Secondly: Your first task should be to debug the hang. Do you have a
smoking gun pointing to a stalled call to the Flt routine? If so, post some
stacks…

Hi Rod,
Maybe I need to explain my scenario with more details:

  1. In PostCreate, I set the handle context via FltSetStreamHandleContext.
  2. In PreRead, I get the context via FltGetStreamHandleContext. This worked perfectly.
  3. In PreWrite, I get the context via FltGetStreamHandleContext. It worked for the first time. The second time, the system hangs and I must restart my system.
    I followed the scanner example (PostCreate, PreWrite) and applied it for swapBuffers, but it didn’t work for PreWrite.

You are going to have to diagnose your hang then. I have been doing this
for a long time and I have never had a hang in FltGetStreamHandleContext (in
PreWrite or anywhere else).

I’m not saying that this isn’t possible, it’s just that its unlikely and its
almost certain to not be a problem with FltMgr.

You should be running under verifier at this stage to get rid of any other
edge issues…

FltGetStreamHandleContext should work in preWrite. Perhaps you could post the stack (and the related stacks)?

Thanks,
Alex.

Thanks for all replies.
Sorry, I don’t know how to get the stack? Because when it hangs, i cannot
do anything except restarting.

On Fri, Mar 23, 2012 at 11:44 PM, wrote:

> FltGetStreamHandleContext should work in preWrite. Perhaps you could post
> the stack (and the related stacks)?
>
> Thanks,
> Alex.
>
> —
> NTFSD is sponsored by OSR
>
> 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,
Nhat


Hoang Xuan Quang Nhat
Faculty of Information Technology
University of Science - Vietnam National University HCM

I’ve just realized that it only hangs up when I stop the minifilter (using
the command line prompt).
When the minifilter is running, it works nice. But when I try to stop the
minifilter, it hangs.
Sorry for not posting enough information.
So, anyone knows this error?
Thanks.

Even if the machine hangs you should in most cases be able to break in the debugger and look at the machine state. So that’s how you can get the stacks.

Do you have a kernel debugger attached to the machine ?

Thanks,
Alex.

Thanks Rod.
I’ll try to get the stack and post it as soon as possible.

On Sat, Mar 24, 2012 at 12:06 AM, wrote:

> Even if the machine hangs you should in most cases be able to break in the
> debugger and look at the machine state. So that’s how you can get the
> stacks.
>
> Do you have a kernel debugger attached to the machine ?
>
> Thanks,
> Alex.
>
> —
> NTFSD is sponsored by OSR
>
> 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,
Nhat


Hoang Xuan Quang Nhat
Faculty of Information Technology
University of Science - Vietnam National University HCM