File system filter question

I have a file system filter driver which needs to do special processing for certain files (on local file systems only). The criteria for determining whether a file needs to be processed is rather complex (i.e. could be base on the file name or extension, location on the file system or other attributes. In order to improve performance I would like to make the determination once for each file in the file system being filtered. Is there a way to store flags in some OS structure so that I can check first there before going through the processing to determine whether the file should be processed or not?

Thanks,
Mario Jauvin

Just an idea, why not take the EA (extended attributes) or (perhaps not so
good) ADS (alternative data streams) to store this. I believe EA were made
exactly for this purpose.

Oliver

PS: I don’t know how well-documented EA are, but on the other hand you can
get Nebbett’s Native API reference … it’s in there for sure :wink:

There is no OS structure to which you can add flags, but there are mechanisms for adding your own context to remember your filter’s in-memory state for a data stream.

The stream context support provided in Windows XP and later is one option. It allows you to associate your own context with a given stream – the equivalent of how the FileObject->FsContext field is used by the file systems.

The APIs are part of the FsRtl library (FsRtlInitPerStreamContext, FsRtlGetPerStreamContext, etc.). The IFS Kit documentation documents all these APIs and had a good topic explaining how to use stream contexts. This can be found in any of the IFS Kit releases for Windows XP or later.

If you need something for pre-Windows XP, check out the OSR FAQ for this list and the list archives. They will tell you how to implement your own stream context support. It’s a bit involved, but it has been done in many filter products.

Thanks,
Molly Brown
Microsoft Corporation

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 Mario François Jauvin
Sent: Wednesday, January 28, 2004 8:14 AM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] File system filter question

I have a file system filter driver which needs to do special processing for certain files (on local file systems only). The criteria for determining whether a file needs to be processed is rather complex (i.e. could be base on the file name or extension, location on the file system or other attributes. In order to improve performance I would like to make the determination once for each file in the file system being filtered. Is there a way to store flags in some OS structure so that I can check first there before going through the processing to determine whether the file should be processed or not?

Thanks,
Mario Jauvin
B笶*'X!y-HPjm?0Xy&^qt
b箷&vڵjɖ\ڲh~י:˱m֕zfyw^)۲