How to close FCB immediately?

I need to design a special file system that automatically close the FCB( by IRP_MJ_CLOSE ) when the user Close the File Handle or the Memory Mapping Handle or the user application crashed.

Usually at this time the system will holding one or more FCB reference. But my file system can not allow the system to retain FCB reference. It must be released immediately.

This file system is now nearing completion, but the above-mentioned features can not.

How can I do? What’s the key point?

> Usually at this time the system will holding one or more FCB reference. But my file system can not ?

allow the system to retain FCB reference. It must be released immediately.

Call CcPurgeCacheSection in each MJ_CLEANUP path.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

It seems work. I need to test it carefully again.

However, Thank you Maxim. Thank you very much.

dcg1981@163.com wrote:

It seems work. I need to test it carefully again.

However, Thank you Maxim. Thank you very much.

Note that this can only work if the user has not created a mapped view.
If the user did create a mapped view a) the purge could fail and b) it
wouldn’t matter since the user section will retain a reference anyway.

Expecting IRP_MJ_CLEANUP and IRP_MJ_CLOSE to mean one and the same thing
seems like a design that can’t really work (unless mapped sections are
disallowed.)

  • M