Dear NTDev folks,
We are writing a FileSystem Filter Driver, that mangles the contents of
a particular file, such that:
- the content is Mangled on Write, and
- Unmangled on Read.
Our Mangling actually increases the size of the file, and we also insert
our own header data in the beginning of the file.
However we still want to present the “correct” file-length to the client
programs (e.g. they shouldn’t know that the data is actually mangled
before it’s stored in the file).
We have been able to do this, to some degree, by handling the Read/Write
IRPs, and modifying the length fields in the QueryInformation IRPs (for
both File Information, and Directory Listings).
However, we are worried that interactions between the underlying
FileSystem Driver, and the Cache Manager may expose the real length of
the file in some cases (e.g. through the FileSize field in the
FSRTL_FCB_COMMON_HEADER structure stored in the FsContext field of the
FileObject), or cause other problems. We are not able to find a good
discussion on Data Modifying filter drivers in the IFS kit documentation
or in the “Windows NT File System Internals” Book by Rajeev Nagar.
FileSystem Filter Drivers that do non-length-preserving Encryption or
Compression must face the same issues that we are coming across. We
would really appreciate it if you folks could shed some light on how the
cache manager may affect FileSystem Filter Drivers that mangle the
content of the file such that the actual file length changes, or if you
could suggest some resources where this information is available.
Thanks in Advance.
-Sincerely,
-Anurag