FYI: The type of locking I was referring to is an open with no share
access granted.
Thanks Nicholas and Rick (previous reply) for your info. I will
investigate both of these paths. I’m currently finishing up my IRPs
that will return the object name and type (looking for a specific
filename).
If anyone else has a caveat or recommendation along these lines
(Nicholas’ reply and Rick’s reply), please comment.
Thanks again,
Dan
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Nicholas Ryan
Sent: Friday, November 01, 2002 10:49 PM
To: NT Developers Interest List
Subject: [ntdev] RE: Reading a file opened with exclusive lock
What type of lock are you referring to? Are you referring to a file
opened by another process with no share access granted, or are you
referring to a file locked by another process with a byte-range lock?
In the case of a byte-range lock, the solution is easy. Memory-map the
file from your user-mode application (this is from the OSR IFS faq, item
Q44).
In the case of a share conflict, you need to write a driver. In your
driver, ZwCreateFile the file with just FILE_READ_ATTRIBUTES access,
then issue paging I/O reads/writes to the file object by rolling your
own IRPs. Paging I/O will bypass the share protection.
There is a caveat to this advice, however. Although both of the
preceding techniques will work for local files, they may not work for
network files (since for network files the ‘enforcement’ is done on the
server, otherwise, where is the security?).
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Dan Morales
Sent: Friday, November 01, 2002 10:13 AM
To: NT Developers Interest List
Subject: [ntdev] Reading a file opened with exclusive lock
All,
I have a need to read the contents of a file that is already opened with
an exclusive lock. With the help of a driver, this should be possible.
Does anyone have experience doing this? What APIs would be useful?
I have already found the process id of the application that has the file
locked. I am thinking that I can enumerate the open handles for this
process and perhaps use ZwDuplicateObject to copy that file object into
my process. Can someone comment on this approach?
I am still struggling through various technical issues, so any thoughts
and help will be appreciated.
Thanks,
Dan
You are currently subscribed to ntdev as: xxxxx@nryan.com
To unsubscribe send a blank email to %%email.unsub%%
You are currently subscribed to ntdev as: xxxxx@moralesdirect.com
To unsubscribe send a blank email to %%email.unsub%%