The approaches I know:
- Don’t change the size of the data within the file; if you have extra
information, store it in a different location (e.g., stream or separate
database or file.)
- Create a secondary file object (IoCreateStreamFileObjectLite will do the
trick) and pass that secondary file object to NTFS. The primary file object
(the one that arrived at your driver) then points to a device object
controlled by your filter. The downside to this approach is that *you* are
now responsible for managing the VM state. This increases complexity by at
least an order of magnitude (essentially, you are implementing your own file
system layered on top of FAT or NTFS.)
There may be other approaches that people have found to work for them and if
that is the case I’d love to hear their suggestions so we can augment the
FAQ.
Regards,
Tony
Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com
-----Original Message-----
From: Matthew White [mailto:xxxxx@fsnnet.net]
Sent: Friday, March 14, 2003 8:50 PM
To: File Systems Developers
Subject: [ntfsd] RE: Encryption filter driver?
Thanks for the response, Tony. The help is much appreciated. In
relation to item (1) below (the complex beasts), I was wondering if you,
or anyone else who has done such work, could explain one issue I have
been wondering about. In an earlier post you said this:
“The difficult case for any filter that attempts to manipulate data
sizes in
the file systems is memory mapped files - the size information comes
from
the VM system, not the file system. While the VM system gets the
initial
size from the file system (via an IRP_MJ_QUERY_INFORMATION) the file
system
reports any subsequent file size changes to the VM system using a
programmatic interface (CcSetFileSize as I recall.)”
And this:
“Of course, many applications only use the read/write interface.
Notepad,
however, uses the memory mapped API and is thus a great test application
for
a filter driver of this type.”
Are there any general strategies that would be useful to work
around/with the issue of the underlying file system calling
CcSetFileSizes() to change the file size(s) in the cache manager for a
filter driver that would like to mess with file sizes? There must be
some way to do this (since these types of filters are possible), but I
don’t see right away how this issue can be resolved at all, since this
call by the file system into the cache manager is independent of a
filter driver. I have seen a couple posts in the archives describing
such things as duplicated file objects being used. Just want to know if
there is a “right way” to do this type of thing, or if it’s kind of a
“you’re on your own” thing. If anyone has any comments on this, many
thanks.
Matt
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Tony Mason
Sent: Friday, March 07, 2003 3:33 PM
To: File Systems Developers
Subject: [ntfsd] RE: Encryption filter driver?
(1) Yes there are such examples. Complex beasts.
(2) No. Using work routines from completion routines (paging I/O or
not) is perfectly acceptable, provided you understand the
synchronization issues involved.
(3) Paging I/O operations are called at APC_LEVEL, so you need to
understand the ramifications of this. But NTFS and FAT roll their own
IRPs all the time in the context of paging I/O operations…
(4) Block for what? Block for locks? No, that won’t work. Block for
external events, like disk I/O to complete? Sure, that works fine.
Keep in mind the locking hierarchy here - file system locks, then cache
manager, then memory manager.
Regards,
Tony
Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com
-----Original Message-----
From: Matthew White [mailto:xxxxx@fsnnet.net]
Sent: Friday, March 07, 2003 3:15 PM
To: File Systems Developers
Subject: [ntfsd] Encryption filter driver?
Hi all,
I’m writing a file system encryption filter driver (an amazingly
new concept, I know) and have a few questions that I was hoping some of
the battle-tested filter driver veterans could enlighten me on, if you
are not sick of doing it yet. Also, I know this is a large development
effort, will take a very long time, and will be fraught with nasty
issues and will almost be impossible, so you can try to discourage me,
but I’m not giving up
Here are my questions:
-
Do you consider it theoretically possible to build, or has anyone
successfully completed, a filter driver that adds a header/trailer to
files for metadata and adjusts file offsets/sizes without the
header/trailer being page aligned? I’ve seen traffic in the archives
that discusses this sort of thing, but I was curious to know if I should
even attempt such an architecture. It seems there are numerous issues
with this when interactions with the VMM and CM are taken into account.
-
Is it generally a “bad idea” to post to a worker thread in the
completion routine of a paging i/o read or write? I’m assuming it is.
-
Can I roll my own IRPs and used these to perform reads in a paging
i/o read or write dispatch routine without problems?
-
Can I block in the dispatch routines for paging i/o reads/writes?
Thanks for your help.
Matt
You are currently subscribed to ntfsd as: xxxxx@osr.com
To unsubscribe send a blank email to xxxxx@lists.osr.com
You are currently subscribed to ntfsd as: xxxxx@fsnnet.net
To unsubscribe send a blank email to xxxxx@lists.osr.com
You are currently subscribed to ntfsd as: xxxxx@osr.com
To unsubscribe send a blank email to xxxxx@lists.osr.com