Addendum to the previous - Would anybody recommend any of the samples
specifically as a good place to start looking into this?
Sorry for the redundant email,
~Eric
-----Original Message-----
From: Eric Diven
Sent: Tuesday, December 04, 2007 11:33 AM
To: āWindows File Systems Devs Interest Listā
Subject: RE: [ntfsd] File sharing access
Okay, so to actually implement this, would an approriate approach be to
define a couple of IOCTLs that our existing userland service can use as
an interface to our existing minifilter. I know strictly speaking this
functionality is separate from the minifilter functionality, and could
probably merit a driver of its own, but Iām a little under the gun as
far as time goes.
The minifilter pends operations on the target file until it is restored
to disk by our userland service (which is the one running into the
issues with share access). Like the OPās situation, we donāt need to
worry about corrupting data on writes, because the process with the
exclusive access is blocked anyway.
Abstractly speaking, the interfaces I would need would be the following:
File_descriptor Create_special (filename) - opens the file in the driver
bypassing share access checks Write_special (file_descriptor, data,
data_length) - writes data into the file at the end of the file
Close_special (file_descriptor) - closes the file in the driver
Undo_special (file_descriptor) - closes and destorys the file if
something goes wrong on the restore
-possibly-
Restore_security_special (file_descriptor, acl) - apply the acl the the
file as it was when it was backed up
Apart from doing this with IOCTLs, I suppose I could use the minifilter
messaging interface. Iām guessing, however, that this is not meant for
moving large amounts of data between userland and the kernel. Is that a
valid assumption on my part, and if not, should I consider using
messaging instead of IOCTLs?
If IOCTLs are the way to go, how does one ensure that you donāt end up
using somebody elseās FunctionCodes? Iām sure you could cause no end of
trouble if your DeviceType and FunctionCode overlapped somebody elseās
on the same system.
Any thoughts on this would be much appreciated, thanks.
~Eric
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Don Burn
Sent: Monday, December 03, 2007 11:15 AM
To: Windows File Systems Devs Interest List
Subject: Re:[ntfsd] File sharing access
The memory mapping stuff is more for byte range locks, not share modes.
The whole problem can be done without a file system filter at all. I
have in the past created a driver that an application can perform a
create on with actual pathname appended to the driver path. The create
code in the driver, then opens the real file with
IoCreateFileSpecifyDeviceObjectHint overriding
the share checks. On read and writes the driver just performs the file
io
(or if you want to be fancy does it mapped to bypass the byte range
locking).
ā
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply
āEric Divenā wrote in message
news:xxxxx@ntfsdā¦
Stupid question, but when you try to add read/write share in approach 2,
do you remember to call FltSetCallbackDataDirty()? I only ask because
Iāve seen doing just that work. This is Q7 on the FAQ, by the way,
which suggests memory mapping the file in the filter driver as an
alternative to taking over the sharing semantics. Iāve got a similar
problem on my plate, and the jury is still out for me as to which
approach Iām going to take.
~Eric
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@abv.bg
Sent: Monday, December 03, 2007 10:34 AM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] File sharing access
Hi,
could someone tell me how I can grand access to specific user32
application.
The idea is that this application should be able to write into a file
that is opened by another application with exclusive access (just the
way my filter driver is able to). I tried some stuff:
1. Creating a handle with OBJ_KERNEL_HANDLE flag in the driver and pass
it to the user32 app but (not surprisingly at all
) the application
threw invalid handle exception.
2. I tried to forcibly change the requested access from other
application to a file, so that no one could open it exclusively:
Data->Iopb->Parameters.Create.ShareAccess |= FILE_SHARE_WRITE;
Data->Iopb->Parameters.Create.ShareAccess |= FILE_SHARE_READ;
and still no success
3. I tried to change the request mode of the user32 app if (
hCurrentProcessID == ProcessIDs[1] ) {
Data->RequestorMode = (KPROCESSOR_MODE)KernelMode;
}
(a long shot and really desperate attempt)
It is more then obvious that the i/o manager and the filter manager
do some kind of validation and forbid such actions!
Any ideas on how I could managed to do that? The code that I use to
lock the file for testing is:
FileStream fs =
File.Open(FileName,FileMode.Open,FileAccess.ReadWrite,FileShare.None);
ā
NTFSD is sponsored by OSR
For our schedule debugging and file system seminars (including our new
fs mini-filter seminar) visit:
http://www.osr.com/seminars
You are currently subscribed to ntfsd as: xxxxx@edsiohio.com To
unsubscribe send a blank email to xxxxx@lists.osr.com
ā
NTFSD is sponsored by OSR
For our schedule debugging and file system seminars (including our new
fs mini-filter seminar) visit:
http://www.osr.com/seminars
You are currently subscribed to ntfsd as: xxxxx@edsiohio.com To
unsubscribe send a blank email to xxxxx@lists.osr.com