FileObject and IRP_MJ_CLEANUP

Hello,

Is the file object still valid when a filter driver gets an
IRP_MJ_CLEANUP?

I store the file object in a hash and when
I get IRP_MJ_CLEANUP I try to remove the FileObject from
the hash. I dont have any references to the file object.
Once in a while when I try to remove the file object from
the hash, it dumps core. Examining the fobject in windbag,
I see that it is invalid.

If I set my own reference to the Fileobject, will I get an
MJ CLEANUP before I deref the Fileobject or until the ref count goes to
zero?

Thanks.

–El Haddi

El Haddi

You might have done better with this question in ntfsd. However, afaik the
file object should indeed be valid when your filter driver receives
IRP_MJ_CLEANUP. Remember, it is IRP_MJ_CLOSE which hails the end of the
observabe lifecycle of the file object, and IRP_MJ_CLEANUP means that the
handle count has become zero.

Cheers
Lyndon

wrote in message news:xxxxx@ntdev…
>
>
> Hello,
>
> Is the file object still valid when a filter driver gets an
> IRP_MJ_CLEANUP?
>
> I store the file object in a hash and when
> I get IRP_MJ_CLEANUP I try to remove the FileObject from
> the hash. I dont have any references to the file object.
> Once in a while when I try to remove the file object from
> the hash, it dumps core. Examining the fobject in windbag,
> I see that it is invalid.
>
> If I set my own reference to the Fileobject, will I get an
> MJ CLEANUP before I deref the Fileobject or until the ref count goes to
> zero?
>
>
> Thanks.
>
> --El Haddi
>
>

xxxxx@constantdata.com wrote:

Hello,

Is the file object still valid when a filter driver gets an
IRP_MJ_CLEANUP?

Yes. It is valid until your DispatchClose routine exits.

I store the file object in a hash and when
I get IRP_MJ_CLEANUP I try to remove the FileObject from
the hash. I dont have any references to the file object.
Once in a while when I try to remove the file object from
the hash, it dumps core. Examining the fobject in windbag,
I see that it is invalid.

If I set my own reference to the Fileobject, will I get an
MJ CLEANUP before I deref the Fileobject or until the ref count goes to
zero?

Thanks.

–El Haddi


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@bitdefender.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


Ignorance more frequently begets confidence than does knowledge.
— Charles Darwin


This message was scanned for spam and viruses by BitDefender.
For more information please visit http://linux.bitdefender.com/

> Is the file object still valid when a filter driver gets an

IRP_MJ_CLEANUP?

Yes. It is still valid in CLOSE too, and destroyed just on CLOSE completion.

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