opening file locked with exclusive access

hey, here’s a question about opening locked files

i’ve read many posts and articles about all sorts of things with much
conclusive but…

i have a win32 user app which wants to open a locked file (previously opened
as exclusive in another app)
as i’ve gathered the only way to do it is to get into IRP_MJ_CREATE and
reopen the file with different file create options.

i’ve created a mini filter driver and in PreCreate succeded in opening a
file with various methods
ZwCreateFile - yes yes reentrancy :slight_smile:
IoCreateFileSpecifyDeviceObjectHint - allmost ok
FltCreateFile - works as needed

so i have the file open and what now?
I’ve tried to open it into FltObjects->FileObject with FltCreateFileEx but i
can’t try it yet because it’s not available on xp. I guess i’ll have to
install w2k and download the symbols… if i’m on the right track anyway…

How can i change the old file handle to the new one in the old FileObject.
Or must i create a new FileObject

sorry for boring you and thank you
Marko

What do you mean by “open it into FltObjects->FileObject with
FltCreateFileEx”? Unless I’m misunderstanding you, you’re on the wrong
track. FltObjects->FileObject is an *output* from FltCreateFileEx, not an
input.

You can open it with FltCreateFile (works on Win2K an XP) and then return
the handle to the user-mode program.

Ken

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of marek
Sent: Tuesday, September 13, 2005 10:02 AM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] opening file locked with exclusive access

hey, here’s a question about opening locked files

i’ve read many posts and articles about all sorts of things with much
conclusive but…

i have a win32 user app which wants to open a locked file (previously opened

as exclusive in another app)
as i’ve gathered the only way to do it is to get into IRP_MJ_CREATE and
reopen the file with different file create options.

i’ve created a mini filter driver and in PreCreate succeded in opening a
file with various methods
ZwCreateFile - yes yes reentrancy :slight_smile:
IoCreateFileSpecifyDeviceObjectHint - allmost ok
FltCreateFile - works as needed

so i have the file open and what now?
I’ve tried to open it into FltObjects->FileObject with FltCreateFileEx but i

can’t try it yet because it’s not available on xp. I guess i’ll have to
install w2k and download the symbols… if i’m on the right track anyway…

How can i change the old file handle to the new one in the old FileObject.
Or must i create a new FileObject

sorry for boring you and thank you
Marko


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@comcast.net
To unsubscribe send a blank email to xxxxx@lists.osr.com

hehm

well i guessed i’m on the wrong track :slight_smile: my mind is buzzing with all the new
info digested over the past few days

my question is How to return the handle to the user-mode program? Without
user app actually knowing what is going on (later i want to isolate this
actions to my app only)

FltObjects->FileObject is an *output* from FltCreateFileEx, not an input.
It is also an object in the PreCreate event an i wanted to change it to the
one FltCreateFileEx created.

Marko

“Ken Cross” wrote in message news:xxxxx@ntfsd…
> What do you mean by “open it into FltObjects->FileObject with
> FltCreateFileEx”? Unless I’m misunderstanding you, you’re on the wrong
> track. FltObjects->FileObject is an output from FltCreateFileEx, not
> an
> input.
>
> You can open it with FltCreateFile (works on Win2K an XP) and then return
> the handle to the user-mode program.
>
> Ken
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of marek
> Sent: Tuesday, September 13, 2005 10:02 AM
> To: Windows File Systems Devs Interest List
> Subject: [ntfsd] opening file locked with exclusive access
>
> hey, here’s a question about opening locked files
>
> i’ve read many posts and articles about all sorts of things with much
> conclusive but…
>
> i have a win32 user app which wants to open a locked file (previously
> opened
>
> as exclusive in another app)
> as i’ve gathered the only way to do it is to get into IRP_MJ_CREATE and
> reopen the file with different file create options.
>
> i’ve created a mini filter driver and in PreCreate succeded in opening a
> file with various methods
> ZwCreateFile - yes yes reentrancy :slight_smile:
> IoCreateFileSpecifyDeviceObjectHint - allmost ok
> FltCreateFile - works as needed
>
> so i have the file open and what now?
> I’ve tried to open it into FltObjects->FileObject with FltCreateFileEx but
> i
>
> can’t try it yet because it’s not available on xp. I guess i’ll have to
> install w2k and download the symbols… if i’m on the right track
> anyway…
>
> How can i change the old file handle to the new one in the old FileObject.
> Or must i create a new FileObject
>
> sorry for boring you and thank you
> Marko
>
>
>
> —
> Questions? First check the IFS FAQ at
> https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to ntfsd as: xxxxx@comcast.net
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>

Well, it depends how/if you have communication between the filter and your
user app. There are lots of ways to do that, so it’s hard to be specific.

Basically, get the filename from the user app, open the file in the driver
(be sure to open the file while in the user context) and then just pass the
handle (an integer) back to the app.

Ken

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of marek
Sent: Tuesday, September 13, 2005 11:30 AM
To: Windows File Systems Devs Interest List
Subject: Re:[ntfsd] opening file locked with exclusive access

hehm

well i guessed i’m on the wrong track :slight_smile: my mind is buzzing with all the new

info digested over the past few days

my question is How to return the handle to the user-mode program? Without
user app actually knowing what is going on (later i want to isolate this
actions to my app only)

FltObjects->FileObject is an *output* from FltCreateFileEx, not an input.
It is also an object in the PreCreate event an i wanted to change it to the
one FltCreateFileEx created.

Marko

“Ken Cross” wrote in message news:xxxxx@ntfsd…
> What do you mean by “open it into FltObjects->FileObject with
> FltCreateFileEx”? Unless I’m misunderstanding you, you’re on the wrong
> track. FltObjects->FileObject is an output from FltCreateFileEx, not
> an
> input.
>
> You can open it with FltCreateFile (works on Win2K an XP) and then return
> the handle to the user-mode program.
>
> Ken
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of marek
> Sent: Tuesday, September 13, 2005 10:02 AM
> To: Windows File Systems Devs Interest List
> Subject: [ntfsd] opening file locked with exclusive access
>
> hey, here’s a question about opening locked files
>
> i’ve read many posts and articles about all sorts of things with much
> conclusive but…
>
> i have a win32 user app which wants to open a locked file (previously
> opened
>
> as exclusive in another app)
> as i’ve gathered the only way to do it is to get into IRP_MJ_CREATE and
> reopen the file with different file create options.
>
> i’ve created a mini filter driver and in PreCreate succeded in opening a
> file with various methods
> ZwCreateFile - yes yes reentrancy :slight_smile:
> IoCreateFileSpecifyDeviceObjectHint - allmost ok
> FltCreateFile - works as needed
>
> so i have the file open and what now?
> I’ve tried to open it into FltObjects->FileObject with FltCreateFileEx but

> i
>
> can’t try it yet because it’s not available on xp. I guess i’ll have to
> install w2k and download the symbols… if i’m on the right track
> anyway…
>
> How can i change the old file handle to the new one in the old FileObject.
> Or must i create a new FileObject
>
> sorry for boring you and thank you
> Marko
>
>
>
> —
> Questions? First check the IFS FAQ at
> https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to ntfsd as: xxxxx@comcast.net
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@comcast.net
To unsubscribe send a blank email to xxxxx@lists.osr.com

What do you want to do with this file?

“marek” wrote in message news:xxxxx@ntfsd…
> hey, here’s a question about opening locked files
>
> i’ve read many posts and articles about all sorts of things with much
> conclusive but…
>
> i have a win32 user app which wants to open a locked file (previously
> opened as exclusive in another app)
> as i’ve gathered the only way to do it is to get into IRP_MJ_CREATE and
> reopen the file with different file create options.
>
> i’ve created a mini filter driver and in PreCreate succeded in opening a
> file with various methods
> ZwCreateFile - yes yes reentrancy :slight_smile:
> IoCreateFileSpecifyDeviceObjectHint - allmost ok
> FltCreateFile - works as needed
>
> so i have the file open and what now?
> I’ve tried to open it into FltObjects->FileObject with FltCreateFileEx but
> i can’t try it yet because it’s not available on xp. I guess i’ll have to
> install w2k and download the symbols… if i’m on the right track
> anyway…
>
> How can i change the old file handle to the new one in the old FileObject.
> Or must i create a new FileObject
>
> sorry for boring you and thank you
> Marko
>
>

i want the user app to read the locked file without problems

i’ve studied the ifs samples (mainly Scanner) and have tested various
possibilities. The problem i have is that some functions of my user app is
in dlls that are not mine so i cannot use some ReadFileThroughFilter
function.

I have to be able to pass/open the file in user app with no communication
with the mini filter

thought it would be trivial but nothing seems that way here :slight_smile:

Marko

“Lyndon J Clarke” wrote in message
news:xxxxx@ntfsd…
> What do you want to do with this file?
>
> “marek” wrote in message news:xxxxx@ntfsd…
>> hey, here’s a question about opening locked files
>>
>> i’ve read many posts and articles about all sorts of things with much
>> conclusive but…
>>
>> i have a win32 user app which wants to open a locked file (previously
>> opened as exclusive in another app)
>> as i’ve gathered the only way to do it is to get into IRP_MJ_CREATE and
>> reopen the file with different file create options.
>>
>> i’ve created a mini filter driver and in PreCreate succeded in opening a
>> file with various methods
>> ZwCreateFile - yes yes reentrancy :slight_smile:
>> IoCreateFileSpecifyDeviceObjectHint - allmost ok
>> FltCreateFile - works as needed
>>
>> so i have the file open and what now?
>> I’ve tried to open it into FltObjects->FileObject with FltCreateFileEx
>> but i can’t try it yet because it’s not available on xp. I guess i’ll
>> have to install w2k and download the symbols… if i’m on the right track
>> anyway…
>>
>> How can i change the old file handle to the new one in the old
>> FileObject. Or must i create a new FileObject
>>
>> sorry for boring you and thank you
>> Marko
>>
>>
>
>
>

What you describe (“be able to pass/open the file in user app with no
communication with the mini filter”) is something the file system works very
hard to prevent. The whole point of locking a file is, well, to *lock* it
against others reading it.

You need to review your requirements.

Ken

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of marek
Sent: Tuesday, September 13, 2005 11:55 AM
To: Windows File Systems Devs Interest List
Subject: Re:[ntfsd] opening file locked with exclusive access

i want the user app to read the locked file without problems

i’ve studied the ifs samples (mainly Scanner) and have tested various
possibilities. The problem i have is that some functions of my user app is
in dlls that are not mine so i cannot use some ReadFileThroughFilter
function.

I have to be able to pass/open the file in user app with no communication
with the mini filter

thought it would be trivial but nothing seems that way here :slight_smile:

Marko

“Lyndon J Clarke” wrote in message
news:xxxxx@ntfsd…
> What do you want to do with this file?
>
> “marek” wrote in message news:xxxxx@ntfsd…
>> hey, here’s a question about opening locked files
>>
>> i’ve read many posts and articles about all sorts of things with much
>> conclusive but…
>>
>> i have a win32 user app which wants to open a locked file (previously
>> opened as exclusive in another app)
>> as i’ve gathered the only way to do it is to get into IRP_MJ_CREATE and
>> reopen the file with different file create options.
>>
>> i’ve created a mini filter driver and in PreCreate succeded in opening a
>> file with various methods
>> ZwCreateFile - yes yes reentrancy :slight_smile:
>> IoCreateFileSpecifyDeviceObjectHint - allmost ok
>> FltCreateFile - works as needed
>>
>> so i have the file open and what now?
>> I’ve tried to open it into FltObjects->FileObject with FltCreateFileEx
>> but i can’t try it yet because it’s not available on xp. I guess i’ll
>> have to install w2k and download the symbols… if i’m on the right track
>> anyway…
>>
>> How can i change the old file handle to the new one in the old
>> FileObject. Or must i create a new FileObject
>>
>> sorry for boring you and thank you
>> Marko
>>
>>
>
>
>


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@comcast.net
To unsubscribe send a blank email to xxxxx@lists.osr.com

I do agree with Ken that when an APP opens a file for Exclusive
access, it should mean exclusive.

The correct approach would be to modify the APP to open the file
allowing READ shared access, and NOWRITE.

Another approach could be to open the Partition and get the file’s
Logical Cluster Numbers and then read the actual disk blocks as
opposed to trying to read the file opened for exclusive access
if you really must bypass that.

However, I assume that if you can’t modufy the OPEN code, you probably
can’t modify the program open/read constructs to take an alternate
approach. If the APP can ABSTRACT the open/read concepts, then this
should be possible.

In fact, if you are filtering, you can do this from the filter driver
automatically.

Rick Cadruvi…

What you describe (“be able to pass/open the file in user app with no
communication with the mini filter”) is something the file system works very
hard to prevent. The whole point of locking a file is, well, to *lock* it
against others reading it.

You need to review your requirements.

Ken

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of marek
Sent: Tuesday, September 13, 2005 11:55 AM
To: Windows File Systems Devs Interest List
Subject: Re:[ntfsd] opening file locked with exclusive access

i want the user app to read the locked file without problems

i’ve studied the ifs samples (mainly Scanner) and have tested various
possibilities. The problem i have is that some functions of my user app is
in dlls that are not mine so i cannot use some ReadFileThroughFilter
function.

I have to be able to pass/open the file in user app with no communication
with the mini filter

thought it would be trivial but nothing seems that way here :slight_smile:

Marko

“Lyndon J Clarke” wrote in message
news:xxxxx@ntfsd…
> What do you want to do with this file?
>
> “marek” wrote in message news:xxxxx@ntfsd…
>> hey, here’s a question about opening locked files
>>
>> i’ve read many posts and articles about all sorts of things with much
>> conclusive but…
>>
>> i have a win32 user app which wants to open a locked file (previously
>> opened as exclusive in another app)
>> as i’ve gathered the only way to do it is to get into IRP_MJ_CREATE and
>> reopen the file with different file create options.
>>
>> i’ve created a mini filter driver and in PreCreate succeded in opening a
>> file with various methods
>> ZwCreateFile - yes yes reentrancy :slight_smile:
>> IoCreateFileSpecifyDeviceObjectHint - allmost ok
>> FltCreateFile - works as needed
>>
>> so i have the file open and what now?
>> I’ve tried to open it into FltObjects->FileObject with FltCreateFileEx
>> but i can’t try it yet because it’s not available on xp. I guess i’ll
>> have to install w2k and download the symbols… if i’m on the right track
>> anyway…
>>
>> How can i change the old file handle to the new one in the old
>> FileObject. Or must i create a new FileObject
>>
>> sorry for boring you and thank you
>> Marko
>>
>>
>
>
>


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@comcast.net
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the IFS FAQ at https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@rdperf.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

yes this is exactly what i want

In fact, if you are filtering, you can do this from the filter driver
automatically.

I am filtering and checking file names and checking related objects etc… I
also can open the file in the filter in PreCreate event but i don’t know how
to tell the user app that the file is succesfully open and pass the new
handler to it.

Marko

wrote in message news:xxxxx@ntfsd…
>I do agree with Ken that when an APP opens a file for Exclusive
> access, it should mean exclusive.
>
> The correct approach would be to modify the APP to open the file
> allowing READ shared access, and NOWRITE.
>
> Another approach could be to open the Partition and get the file’s
> Logical Cluster Numbers and then read the actual disk blocks as
> opposed to trying to read the file opened for exclusive access
> if you really must bypass that.
>
> However, I assume that if you can’t modufy the OPEN code, you probably
> can’t modify the program open/read constructs to take an alternate
> approach. If the APP can ABSTRACT the open/read concepts, then this
> should be possible.
>
> In fact, if you are filtering, you can do this from the filter driver
> automatically.
>
>
> Rick Cadruvi…
>
>
> What you describe (“be able to pass/open the file in user app with no
> communication with the mini filter”) is something the file system works
> very
> hard to prevent. The whole point of locking a file is, well, to lock it
> against others reading it.
>
> You need to review your requirements.
>
> Ken
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of marek
> Sent: Tuesday, September 13, 2005 11:55 AM
> To: Windows File Systems Devs Interest List
> Subject: Re:[ntfsd] opening file locked with exclusive access
>
>
> i want the user app to read the locked file without problems
>
> i’ve studied the ifs samples (mainly Scanner) and have tested various
> possibilities. The problem i have is that some functions of my user app is
> in dlls that are not mine so i cannot use some ReadFileThroughFilter
> function.
>
> I have to be able to pass/open the file in user app with no communication
> with the mini filter
>
> thought it would be trivial but nothing seems that way here :slight_smile:
>
> Marko
>
>
> “Lyndon J Clarke” wrote in message
> news:xxxxx@ntfsd…
>> What do you want to do with this file?
>>
>> “marek” wrote in message news:xxxxx@ntfsd…
>>> hey, here’s a question about opening locked files
>>>
>>> i’ve read many posts and articles about all sorts of things with much
>>> conclusive but…
>>>
>>> i have a win32 user app which wants to open a locked file (previously
>>> opened as exclusive in another app)
>>> as i’ve gathered the only way to do it is to get into IRP_MJ_CREATE and
>>> reopen the file with different file create options.
>>>
>>> i’ve created a mini filter driver and in PreCreate succeded in opening a
>>> file with various methods
>>> ZwCreateFile - yes yes reentrancy :slight_smile:
>>> IoCreateFileSpecifyDeviceObjectHint - allmost ok
>>> FltCreateFile - works as needed
>>>
>>> so i have the file open and what now?
>>> I’ve tried to open it into FltObjects->FileObject with FltCreateFileEx
>>> but i can’t try it yet because it’s not available on xp. I guess i’ll
>>> have to install w2k and download the symbols… if i’m on the right track
>>> anyway…
>>>
>>> How can i change the old file handle to the new one in the old
>>> FileObject. Or must i create a new FileObject
>>>
>>> sorry for boring you and thank you
>>> Marko
>>>
>>>
>>
>>
>>
>
>
>
> —
> Questions? First check the IFS FAQ at
> https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to ntfsd as: xxxxx@comcast.net
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
> —
> Questions? First check the IFS FAQ at
> https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to ntfsd as: xxxxx@rdperf.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>

I think the solution is to implement your own access management and lock
management in the filter; superseding the native access and locks management
of the file system.

Jamey

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@rdperf.com
Sent: Tuesday, September 13, 2005 9:56 AM
To: Windows File Systems Devs Interest List
Subject: Re: [ntfsd] opening file locked with exclusive access

I do agree with Ken that when an APP opens a file for Exclusive
access, it should mean exclusive.

The correct approach would be to modify the APP to open the file
allowing READ shared access, and NOWRITE.

Another approach could be to open the Partition and get the file’s
Logical Cluster Numbers and then read the actual disk blocks as
opposed to trying to read the file opened for exclusive access
if you really must bypass that.

However, I assume that if you can’t modufy the OPEN code, you probably
can’t modify the program open/read constructs to take an alternate
approach. If the APP can ABSTRACT the open/read concepts, then this
should be possible.

In fact, if you are filtering, you can do this from the filter driver
automatically.

Rick Cadruvi…

What you describe (“be able to pass/open the file in user app with no
communication with the mini filter”) is something the file system works very
hard to prevent. The whole point of locking a file is, well, to *lock* it
against others reading it.

You need to review your requirements.

Ken

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of marek
Sent: Tuesday, September 13, 2005 11:55 AM
To: Windows File Systems Devs Interest List
Subject: Re:[ntfsd] opening file locked with exclusive access

i want the user app to read the locked file without problems

i’ve studied the ifs samples (mainly Scanner) and have tested various
possibilities. The problem i have is that some functions of my user app is
in dlls that are not mine so i cannot use some ReadFileThroughFilter
function.

I have to be able to pass/open the file in user app with no communication
with the mini filter

thought it would be trivial but nothing seems that way here :slight_smile:

Marko

“Lyndon J Clarke” wrote in message
news:xxxxx@ntfsd…
> What do you want to do with this file?
>
> “marek” wrote in message news:xxxxx@ntfsd…
>> hey, here’s a question about opening locked files
>>
>> i’ve read many posts and articles about all sorts of things with much
>> conclusive but…
>>
>> i have a win32 user app which wants to open a locked file (previously
>> opened as exclusive in another app)
>> as i’ve gathered the only way to do it is to get into IRP_MJ_CREATE and
>> reopen the file with different file create options.
>>
>> i’ve created a mini filter driver and in PreCreate succeded in opening a
>> file with various methods
>> ZwCreateFile - yes yes reentrancy :slight_smile:
>> IoCreateFileSpecifyDeviceObjectHint - allmost ok
>> FltCreateFile - works as needed
>>
>> so i have the file open and what now?
>> I’ve tried to open it into FltObjects->FileObject with FltCreateFileEx
>> but i can’t try it yet because it’s not available on xp. I guess i’ll
>> have to install w2k and download the symbols… if i’m on the right track
>> anyway…
>>
>> How can i change the old file handle to the new one in the old
>> FileObject. Or must i create a new FileObject
>>
>> sorry for boring you and thank you
>> Marko
>>
>>
>
>
>


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@comcast.net
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@rdperf.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@rocketdivision.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Oh, Jamey, this is just what we all need. He can buy the source code and
write his own OS. Then opens with no sharing can mean share everything.
Maybe a C++ class to change divide to plus, multiply to minus?

It does seem that a decision on how to do something has been decided when
the first problem was never specified. I wonder why you need to access a
file that may be in a state that is not usable. Specifics would make it
easier to give advice.

“Jamey Kirby” wrote in message
news:xxxxx@ntfsd…
>I think the solution is to implement your own access management and lock
> management in the filter; superseding the native access and locks
> management
> of the file system.
>
> Jamey
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@rdperf.com
> Sent: Tuesday, September 13, 2005 9:56 AM
> To: Windows File Systems Devs Interest List
> Subject: Re: [ntfsd] opening file locked with exclusive access
>
> I do agree with Ken that when an APP opens a file for Exclusive
> access, it should mean exclusive.
>
> The correct approach would be to modify the APP to open the file
> allowing READ shared access, and NOWRITE.
>
> Another approach could be to open the Partition and get the file’s
> Logical Cluster Numbers and then read the actual disk blocks as
> opposed to trying to read the file opened for exclusive access
> if you really must bypass that.
>
> However, I assume that if you can’t modufy the OPEN code, you probably
> can’t modify the program open/read constructs to take an alternate
> approach. If the APP can ABSTRACT the open/read concepts, then this
> should be possible.
>
> In fact, if you are filtering, you can do this from the filter driver
> automatically.
>
>
> Rick Cadruvi…
>
>
> What you describe (“be able to pass/open the file in user app with no
> communication with the mini filter”) is something the file system works
> very
> hard to prevent. The whole point of locking a file is, well, to lock it
> against others reading it.
>
> You need to review your requirements.
>
> Ken
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of marek
> Sent: Tuesday, September 13, 2005 11:55 AM
> To: Windows File Systems Devs Interest List
> Subject: Re:[ntfsd] opening file locked with exclusive access
>
>
> i want the user app to read the locked file without problems
>
> i’ve studied the ifs samples (mainly Scanner) and have tested various
> possibilities. The problem i have is that some functions of my user app is
> in dlls that are not mine so i cannot use some ReadFileThroughFilter
> function.
>
> I have to be able to pass/open the file in user app with no communication
> with the mini filter
>
> thought it would be trivial but nothing seems that way here :slight_smile:
>
> Marko
>
>
> “Lyndon J Clarke” wrote in message
> news:xxxxx@ntfsd…
>> What do you want to do with this file?
>>
>> “marek” wrote in message news:xxxxx@ntfsd…
>>> hey, here’s a question about opening locked files
>>>
>>> i’ve read many posts and articles about all sorts of things with much
>>> conclusive but…
>>>
>>> i have a win32 user app which wants to open a locked file (previously
>>> opened as exclusive in another app)
>>> as i’ve gathered the only way to do it is to get into IRP_MJ_CREATE and
>>> reopen the file with different file create options.
>>>
>>> i’ve created a mini filter driver and in PreCreate succeded in opening a
>>> file with various methods
>>> ZwCreateFile - yes yes reentrancy :slight_smile:
>>> IoCreateFileSpecifyDeviceObjectHint - allmost ok
>>> FltCreateFile - works as needed
>>>
>>> so i have the file open and what now?
>>> I’ve tried to open it into FltObjects->FileObject with FltCreateFileEx
>>> but i can’t try it yet because it’s not available on xp. I guess i’ll
>>> have to install w2k and download the symbols… if i’m on the right track
>>> anyway…
>>>
>>> How can i change the old file handle to the new one in the old
>>> FileObject. Or must i create a new FileObject
>>>
>>> sorry for boring you and thank you
>>> Marko
>>>
>>>
>>
>>
>>
>
>
>
> —
> Questions? First check the IFS FAQ at
> https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to ntfsd as: xxxxx@comcast.net
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
> —
> Questions? First check the IFS FAQ at
> https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to ntfsd as: xxxxx@rdperf.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
> —
> Questions? First check the IFS FAQ at
> https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to ntfsd as: xxxxx@rocketdivision.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>

FltObjects->FileObject is an OUT from FltCreateFileEx, not IN

I’ve tried to open it into FltObjects->FileObject with FltCreateFileEx

  • Developer

yeah

well it’s simply for backup intent. We have some specific needs and the data
in the files is changed 2 times per day so there is no worry about
corruption.

well thank you for your help. I guess i’ll try to mingle something with that
ReadFileThroughFilter of mine (with rolling read irp’s forward)

i just thought since you say i can implement my onw locks management that i
could simply change/fill the handle somewhere in the PreCreate event and
then pass it up to the user app in the way the system would anyway if the
file would not be locked.

I would check somehow if this request has come from my app, so i would not
allow all other apps on the system to do it…

Marko

“David J. Craig” wrote in message
news:xxxxx@ntfsd…
> Oh, Jamey, this is just what we all need. He can buy the source code and
> write his own OS. Then opens with no sharing can mean share everything.
> Maybe a C++ class to change divide to plus, multiply to minus?
>
> It does seem that a decision on how to do something has been decided when
> the first problem was never specified. I wonder why you need to access a
> file that may be in a state that is not usable. Specifics would make it
> easier to give advice.
>
> “Jamey Kirby” wrote in message
> news:xxxxx@ntfsd…
>>I think the solution is to implement your own access management and lock
>> management in the filter; superseding the native access and locks
>> management
>> of the file system.
>>
>> Jamey
>>
>> -----Original Message-----
>> From: xxxxx@lists.osr.com
>> [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@rdperf.com
>> Sent: Tuesday, September 13, 2005 9:56 AM
>> To: Windows File Systems Devs Interest List
>> Subject: Re: [ntfsd] opening file locked with exclusive access
>>
>> I do agree with Ken that when an APP opens a file for Exclusive
>> access, it should mean exclusive.
>>
>> The correct approach would be to modify the APP to open the file
>> allowing READ shared access, and NOWRITE.
>>
>> Another approach could be to open the Partition and get the file’s
>> Logical Cluster Numbers and then read the actual disk blocks as
>> opposed to trying to read the file opened for exclusive access
>> if you really must bypass that.
>>
>> However, I assume that if you can’t modufy the OPEN code, you probably
>> can’t modify the program open/read constructs to take an alternate
>> approach. If the APP can ABSTRACT the open/read concepts, then this
>> should be possible.
>>
>> In fact, if you are filtering, you can do this from the filter driver
>> automatically.
>>
>>
>> Rick Cadruvi…
>>
>>
>> What you describe (“be able to pass/open the file in user app with no
>> communication with the mini filter”) is something the file system works
>> very
>> hard to prevent. The whole point of locking a file is, well, to lock
>> it
>> against others reading it.
>>
>> You need to review your requirements.
>>
>> Ken
>>
>>
>> -----Original Message-----
>> From: xxxxx@lists.osr.com
>> [mailto:xxxxx@lists.osr.com] On Behalf Of marek
>> Sent: Tuesday, September 13, 2005 11:55 AM
>> To: Windows File Systems Devs Interest List
>> Subject: Re:[ntfsd] opening file locked with exclusive access
>>
>>
>> i want the user app to read the locked file without problems
>>
>> i’ve studied the ifs samples (mainly Scanner) and have tested various
>> possibilities. The problem i have is that some functions of my user app
>> is
>> in dlls that are not mine so i cannot use some ReadFileThroughFilter
>> function.
>>
>> I have to be able to pass/open the file in user app with no communication
>> with the mini filter
>>
>> thought it would be trivial but nothing seems that way here :slight_smile:
>>
>> Marko
>>
>>
>> “Lyndon J Clarke” wrote in message
>> news:xxxxx@ntfsd…
>>> What do you want to do with this file?
>>>
>>> “marek” wrote in message news:xxxxx@ntfsd…
>>>> hey, here’s a question about opening locked files
>>>>
>>>> i’ve read many posts and articles about all sorts of things with much
>>>> conclusive but…
>>>>
>>>> i have a win32 user app which wants to open a locked file (previously
>>>> opened as exclusive in another app)
>>>> as i’ve gathered the only way to do it is to get into IRP_MJ_CREATE and
>>>> reopen the file with different file create options.
>>>>
>>>> i’ve created a mini filter driver and in PreCreate succeded in opening
>>>> a
>>>> file with various methods
>>>> ZwCreateFile - yes yes reentrancy :slight_smile:
>>>> IoCreateFileSpecifyDeviceObjectHint - allmost ok
>>>> FltCreateFile - works as needed
>>>>
>>>> so i have the file open and what now?
>>>> I’ve tried to open it into FltObjects->FileObject with FltCreateFileEx
>>>> but i can’t try it yet because it’s not available on xp. I guess i’ll
>>>> have to install w2k and download the symbols… if i’m on the right
>>>> track
>>>> anyway…
>>>>
>>>> How can i change the old file handle to the new one in the old
>>>> FileObject. Or must i create a new FileObject
>>>>
>>>> sorry for boring you and thank you
>>>> Marko
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>>
>> —
>> Questions? First check the IFS FAQ at
>> https://www.osronline.com/article.cfm?id=17
>>
>> You are currently subscribed to ntfsd as: xxxxx@comcast.net
>> To unsubscribe send a blank email to xxxxx@lists.osr.com
>>
>>
>> —
>> Questions? First check the IFS FAQ at
>> https://www.osronline.com/article.cfm?id=17
>>
>> You are currently subscribed to ntfsd as: xxxxx@rdperf.com
>> To unsubscribe send a blank email to xxxxx@lists.osr.com
>>
>>
>> —
>> Questions? First check the IFS FAQ at
>> https://www.osronline.com/article.cfm?id=17
>>
>> You are currently subscribed to ntfsd as: xxxxx@rocketdivision.com
>> To unsubscribe send a blank email to xxxxx@lists.osr.com
>>
>>
>
>
>

Why not use ShadowCopy or St. Bernard’s OFM or something similar? There are
many products out there to do this for backup. If you do what you want to
do, your backup will be trash. No guaranteed consistency of data in the
backup.

Jamey

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of marek
Sent: Tuesday, September 13, 2005 11:56 PM
To: Windows File Systems Devs Interest List
Subject: Re:[ntfsd] opening file locked with exclusive access

yeah

well it’s simply for backup intent. We have some specific needs and the data

in the files is changed 2 times per day so there is no worry about
corruption.

well thank you for your help. I guess i’ll try to mingle something with that

ReadFileThroughFilter of mine (with rolling read irp’s forward)

i just thought since you say i can implement my onw locks management that i
could simply change/fill the handle somewhere in the PreCreate event and
then pass it up to the user app in the way the system would anyway if the
file would not be locked.

I would check somehow if this request has come from my app, so i would not
allow all other apps on the system to do it…

Marko

“David J. Craig” wrote in message
news:xxxxx@ntfsd…
> Oh, Jamey, this is just what we all need. He can buy the source code and
> write his own OS. Then opens with no sharing can mean share everything.
> Maybe a C++ class to change divide to plus, multiply to minus?
>
> It does seem that a decision on how to do something has been decided when
> the first problem was never specified. I wonder why you need to access a
> file that may be in a state that is not usable. Specifics would make it
> easier to give advice.
>
> “Jamey Kirby” wrote in message
> news:xxxxx@ntfsd…
>>I think the solution is to implement your own access management and lock
>> management in the filter; superseding the native access and locks
>> management
>> of the file system.
>>
>> Jamey
>>
>> -----Original Message-----
>> From: xxxxx@lists.osr.com
>> [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@rdperf.com
>> Sent: Tuesday, September 13, 2005 9:56 AM
>> To: Windows File Systems Devs Interest List
>> Subject: Re: [ntfsd] opening file locked with exclusive access
>>
>> I do agree with Ken that when an APP opens a file for Exclusive
>> access, it should mean exclusive.
>>
>> The correct approach would be to modify the APP to open the file
>> allowing READ shared access, and NOWRITE.
>>
>> Another approach could be to open the Partition and get the file’s
>> Logical Cluster Numbers and then read the actual disk blocks as
>> opposed to trying to read the file opened for exclusive access
>> if you really must bypass that.
>>
>> However, I assume that if you can’t modufy the OPEN code, you probably
>> can’t modify the program open/read constructs to take an alternate
>> approach. If the APP can ABSTRACT the open/read concepts, then this
>> should be possible.
>>
>> In fact, if you are filtering, you can do this from the filter driver
>> automatically.
>>
>>
>> Rick Cadruvi…
>>
>>
>> What you describe (“be able to pass/open the file in user app with no
>> communication with the mini filter”) is something the file system works
>> very
>> hard to prevent. The whole point of locking a file is, well, to lock
>> it
>> against others reading it.
>>
>> You need to review your requirements.
>>
>> Ken
>>
>>
>> -----Original Message-----
>> From: xxxxx@lists.osr.com
>> [mailto:xxxxx@lists.osr.com] On Behalf Of marek
>> Sent: Tuesday, September 13, 2005 11:55 AM
>> To: Windows File Systems Devs Interest List
>> Subject: Re:[ntfsd] opening file locked with exclusive access
>>
>>
>> i want the user app to read the locked file without problems
>>
>> i’ve studied the ifs samples (mainly Scanner) and have tested various
>> possibilities. The problem i have is that some functions of my user app
>> is
>> in dlls that are not mine so i cannot use some ReadFileThroughFilter
>> function.
>>
>> I have to be able to pass/open the file in user app with no communication
>> with the mini filter
>>
>> thought it would be trivial but nothing seems that way here :slight_smile:
>>
>> Marko
>>
>>
>> “Lyndon J Clarke” wrote in message
>> news:xxxxx@ntfsd…
>>> What do you want to do with this file?
>>>
>>> “marek” wrote in message news:xxxxx@ntfsd…
>>>> hey, here’s a question about opening locked files
>>>>
>>>> i’ve read many posts and articles about all sorts of things with much
>>>> conclusive but…
>>>>
>>>> i have a win32 user app which wants to open a locked file (previously
>>>> opened as exclusive in another app)
>>>> as i’ve gathered the only way to do it is to get into IRP_MJ_CREATE and
>>>> reopen the file with different file create options.
>>>>
>>>> i’ve created a mini filter driver and in PreCreate succeded in opening
>>>> a
>>>> file with various methods
>>>> ZwCreateFile - yes yes reentrancy :slight_smile:
>>>> IoCreateFileSpecifyDeviceObjectHint - allmost ok
>>>> FltCreateFile - works as needed
>>>>
>>>> so i have the file open and what now?
>>>> I’ve tried to open it into FltObjects->FileObject with FltCreateFileEx
>>>> but i can’t try it yet because it’s not available on xp. I guess i’ll
>>>> have to install w2k and download the symbols… if i’m on the right
>>>> track
>>>> anyway…
>>>>
>>>> How can i change the old file handle to the new one in the old
>>>> FileObject. Or must i create a new FileObject
>>>>
>>>> sorry for boring you and thank you
>>>> Marko
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>>
>> —
>> Questions? First check the IFS FAQ at
>> https://www.osronline.com/article.cfm?id=17
>>
>> You are currently subscribed to ntfsd as: xxxxx@comcast.net
>> To unsubscribe send a blank email to xxxxx@lists.osr.com
>>
>>
>> —
>> Questions? First check the IFS FAQ at
>> https://www.osronline.com/article.cfm?id=17
>>
>> You are currently subscribed to ntfsd as: xxxxx@rdperf.com
>> To unsubscribe send a blank email to xxxxx@lists.osr.com
>>
>>
>> —
>> Questions? First check the IFS FAQ at
>> https://www.osronline.com/article.cfm?id=17
>>
>> You are currently subscribed to ntfsd as: xxxxx@rocketdivision.com
>> To unsubscribe send a blank email to xxxxx@lists.osr.com
>>
>>
>
>
>


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@rocketdivision.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

I’ll try to make a temporary file through my filter driver and unleash the
dll’s recalculate something thingy on it. That should make no problems.

For the consistency i’ll probably make a crc code during reads and again
after the file is complete. I know that it is not a guarantee but at least
I’ll know if it changed in the process… hmm… I guess I know if it changed
since I have a filter driver and all writes have to go through it.

I’ll have to think about this for a while. I remember reading something
about file name in the FileObject not valid during writes…

I have a really good feeling that what i wanted to achieve in the first
place, could be done but nobody wants me to know :wink:

user app (opening file) -> filter driver (opens the file with
no_share_check) -> returns the handle and status to the app as normal system
would

thank you all for help

Marko

“Jamey Kirby” wrote in message
news:xxxxx@ntfsd…
> Why not use ShadowCopy or St. Bernard’s OFM or something similar? There
> are
> many products out there to do this for backup. If you do what you want to
> do, your backup will be trash. No guaranteed consistency of data in the
> backup.
>
> Jamey
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of marek
> Sent: Tuesday, September 13, 2005 11:56 PM
> To: Windows File Systems Devs Interest List
> Subject: Re:[ntfsd] opening file locked with exclusive access
>
> yeah
>
> well it’s simply for backup intent. We have some specific needs and the
> data
>
> in the files is changed 2 times per day so there is no worry about
> corruption.
>
> well thank you for your help. I guess i’ll try to mingle something with
> that
>
> ReadFileThroughFilter of mine (with rolling read irp’s forward)
>
> i just thought since you say i can implement my onw locks management that
> i
> could simply change/fill the handle somewhere in the PreCreate event and
> then pass it up to the user app in the way the system would anyway if the
> file would not be locked.
>
> I would check somehow if this request has come from my app, so i would not
> allow all other apps on the system to do it…
>
> Marko
>
>
> “David J. Craig” wrote in message
> news:xxxxx@ntfsd…
>> Oh, Jamey, this is just what we all need. He can buy the source code and
>> write his own OS. Then opens with no sharing can mean share everything.
>> Maybe a C++ class to change divide to plus, multiply to minus?
>>
>> It does seem that a decision on how to do something has been decided when
>> the first problem was never specified. I wonder why you need to access a
>> file that may be in a state that is not usable. Specifics would make it
>> easier to give advice.
>>
>> “Jamey Kirby” wrote in message
>> news:xxxxx@ntfsd…
>>>I think the solution is to implement your own access management and lock
>>> management in the filter; superseding the native access and locks
>>> management
>>> of the file system.
>>>
>>> Jamey
>>>
>>> -----Original Message-----
>>> From: xxxxx@lists.osr.com
>>> [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@rdperf.com
>>> Sent: Tuesday, September 13, 2005 9:56 AM
>>> To: Windows File Systems Devs Interest List
>>> Subject: Re: [ntfsd] opening file locked with exclusive access
>>>
>>> I do agree with Ken that when an APP opens a file for Exclusive
>>> access, it should mean exclusive.
>>>
>>> The correct approach would be to modify the APP to open the file
>>> allowing READ shared access, and NOWRITE.
>>>
>>> Another approach could be to open the Partition and get the file’s
>>> Logical Cluster Numbers and then read the actual disk blocks as
>>> opposed to trying to read the file opened for exclusive access
>>> if you really must bypass that.
>>>
>>> However, I assume that if you can’t modufy the OPEN code, you probably
>>> can’t modify the program open/read constructs to take an alternate
>>> approach. If the APP can ABSTRACT the open/read concepts, then this
>>> should be possible.
>>>
>>> In fact, if you are filtering, you can do this from the filter driver
>>> automatically.
>>>
>>>
>>> Rick Cadruvi…
>>>
>>>
>>> What you describe (“be able to pass/open the file in user app with no
>>> communication with the mini filter”) is something the file system works
>>> very
>>> hard to prevent. The whole point of locking a file is, well, to lock
>>> it
>>> against others reading it.
>>>
>>> You need to review your requirements.
>>>
>>> Ken
>>>
>>>
>>> -----Original Message-----
>>> From: xxxxx@lists.osr.com
>>> [mailto:xxxxx@lists.osr.com] On Behalf Of marek
>>> Sent: Tuesday, September 13, 2005 11:55 AM
>>> To: Windows File Systems Devs Interest List
>>> Subject: Re:[ntfsd] opening file locked with exclusive access
>>>
>>>
>>> i want the user app to read the locked file without problems
>>>
>>> i’ve studied the ifs samples (mainly Scanner) and have tested various
>>> possibilities. The problem i have is that some functions of my user app
>>> is
>>> in dlls that are not mine so i cannot use some ReadFileThroughFilter
>>> function.
>>>
>>> I have to be able to pass/open the file in user app with no
>>> communication
>>> with the mini filter
>>>
>>> thought it would be trivial but nothing seems that way here :slight_smile:
>>>
>>> Marko
>>>
>>>
>>> “Lyndon J Clarke” wrote in message
>>> news:xxxxx@ntfsd…
>>>> What do you want to do with this file?
>>>>
>>>> “marek” wrote in message news:xxxxx@ntfsd…
>>>>> hey, here’s a question about opening locked files
>>>>>
>>>>> i’ve read many posts and articles about all sorts of things with much
>>>>> conclusive but…
>>>>>
>>>>> i have a win32 user app which wants to open a locked file (previously
>>>>> opened as exclusive in another app)
>>>>> as i’ve gathered the only way to do it is to get into IRP_MJ_CREATE
>>>>> and
>>>>> reopen the file with different file create options.
>>>>>
>>>>> i’ve created a mini filter driver and in PreCreate succeded in opening
>>>>> a
>>>>> file with various methods
>>>>> ZwCreateFile - yes yes reentrancy :slight_smile:
>>>>> IoCreateFileSpecifyDeviceObjectHint - allmost ok
>>>>> FltCreateFile - works as needed
>>>>>
>>>>> so i have the file open and what now?
>>>>> I’ve tried to open it into FltObjects->FileObject with FltCreateFileEx
>>>>> but i can’t try it yet because it’s not available on xp. I guess i’ll
>>>>> have to install w2k and download the symbols… if i’m on the right
>>>>> track
>>>>> anyway…
>>>>>
>>>>> How can i change the old file handle to the new one in the old
>>>>> FileObject. Or must i create a new FileObject
>>>>>
>>>>> sorry for boring you and thank you
>>>>> Marko
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>> —
>>> Questions? First check the IFS FAQ at
>>> https://www.osronline.com/article.cfm?id=17
>>>
>>> You are currently subscribed to ntfsd as: xxxxx@comcast.net
>>> To unsubscribe send a blank email to xxxxx@lists.osr.com
>>>
>>>
>>> —
>>> Questions? First check the IFS FAQ at
>>> https://www.osronline.com/article.cfm?id=17
>>>
>>> You are currently subscribed to ntfsd as: xxxxx@rdperf.com
>>> To unsubscribe send a blank email to xxxxx@lists.osr.com
>>>
>>>
>>> —
>>> Questions? First check the IFS FAQ at
>>> https://www.osronline.com/article.cfm?id=17
>>>
>>> You are currently subscribed to ntfsd as: xxxxx@rocketdivision.com
>>> To unsubscribe send a blank email to xxxxx@lists.osr.com
>>>
>>>
>>
>>
>>
>
>
>
> —
> Questions? First check the IFS FAQ at
> https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to ntfsd as: xxxxx@rocketdivision.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>

You can’t generate a different handle in the filter and then pass it to the
app. What you can use the filter for is to change parameters of the incoming
IRP to let underlying file system open the file successfully. For example you
may try to add IO_IGNORE_SHARE_ACCESS_CHECK flag and see if it helps (I never
used this flag myself). Or you may try to set “DesiredAccess” in the incoming
IRP to 0 to pass share access check by file system.

Alexei.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of marek
Sent: Wednesday, September 14, 2005 10:52 AM
To: Windows File Systems Devs Interest List
Subject: Re:[ntfsd] opening file locked with exclusive access

I’ll try to make a temporary file through my filter driver and unleash the
dll’s recalculate something thingy on it. That should make no problems.

For the consistency i’ll probably make a crc code during reads and again
after the file is complete. I know that it is not a guarantee but at least
I’ll know if it changed in the process… hmm… I guess I know if it changed
since I have a filter driver and all writes have to go through it.

I’ll have to think about this for a while. I remember reading something
about file name in the FileObject not valid during writes…

I have a really good feeling that what i wanted to achieve in the first
place, could be done but nobody wants me to know :wink:

user app (opening file) -> filter driver (opens the file with
no_share_check) -> returns the handle and status to the app as normal system
would

thank you all for help

Marko

“Jamey Kirby” wrote in message
news:xxxxx@ntfsd…
> Why not use ShadowCopy or St. Bernard’s OFM or something similar? There
> are
> many products out there to do this for backup. If you do what you want to
> do, your backup will be trash. No guaranteed consistency of data in the
> backup.
>
> Jamey
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of marek
> Sent: Tuesday, September 13, 2005 11:56 PM
> To: Windows File Systems Devs Interest List
> Subject: Re:[ntfsd] opening file locked with exclusive access
>
> yeah
>
> well it’s simply for backup intent. We have some specific needs and the
> data
>
> in the files is changed 2 times per day so there is no worry about
> corruption.
>
> well thank you for your help. I guess i’ll try to mingle something with
> that
>
> ReadFileThroughFilter of mine (with rolling read irp’s forward)
>
> i just thought since you say i can implement my onw locks management that
> i
> could simply change/fill the handle somewhere in the PreCreate event and
> then pass it up to the user app in the way the system would anyway if the
> file would not be locked.
>
> I would check somehow if this request has come from my app, so i would not
> allow all other apps on the system to do it…
>
> Marko
>
>
> “David J. Craig” wrote in message
> news:xxxxx@ntfsd…
>> Oh, Jamey, this is just what we all need. He can buy the source code and
>> write his own OS. Then opens with no sharing can mean share everything.
>> Maybe a C++ class to change divide to plus, multiply to minus?
>>
>> It does seem that a decision on how to do something has been decided when
>> the first problem was never specified. I wonder why you need to access a
>> file that may be in a state that is not usable. Specifics would make it
>> easier to give advice.
>>
>> “Jamey Kirby” wrote in message
>> news:xxxxx@ntfsd…
>>>I think the solution is to implement your own access management and lock
>>> management in the filter; superseding the native access and locks
>>> management
>>> of the file system.
>>>
>>> Jamey
>>>
>>> -----Original Message-----
>>> From: xxxxx@lists.osr.com
>>> [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@rdperf.com
>>> Sent: Tuesday, September 13, 2005 9:56 AM
>>> To: Windows File Systems Devs Interest List
>>> Subject: Re: [ntfsd] opening file locked with exclusive access
>>>
>>> I do agree with Ken that when an APP opens a file for Exclusive
>>> access, it should mean exclusive.
>>>
>>> The correct approach would be to modify the APP to open the file
>>> allowing READ shared access, and NOWRITE.
>>>
>>> Another approach could be to open the Partition and get the file’s
>>> Logical Cluster Numbers and then read the actual disk blocks as
>>> opposed to trying to read the file opened for exclusive access
>>> if you really must bypass that.
>>>
>>> However, I assume that if you can’t modufy the OPEN code, you probably
>>> can’t modify the program open/read constructs to take an alternate
>>> approach. If the APP can ABSTRACT the open/read concepts, then this
>>> should be possible.
>>>
>>> In fact, if you are filtering, you can do this from the filter driver
>>> automatically.
>>>
>>>
>>> Rick Cadruvi…
>>>
>>>
>>> What you describe (“be able to pass/open the file in user app with no
>>> communication with the mini filter”) is something the file system works
>>> very
>>> hard to prevent. The whole point of locking a file is, well, to lock
>>> it
>>> against others reading it.
>>>
>>> You need to review your requirements.
>>>
>>> Ken
>>>
>>>
>>> -----Original Message-----
>>> From: xxxxx@lists.osr.com
>>> [mailto:xxxxx@lists.osr.com] On Behalf Of marek
>>> Sent: Tuesday, September 13, 2005 11:55 AM
>>> To: Windows File Systems Devs Interest List
>>> Subject: Re:[ntfsd] opening file locked with exclusive access
>>>
>>>
>>> i want the user app to read the locked file without problems
>>>
>>> i’ve studied the ifs samples (mainly Scanner) and have tested various
>>> possibilities. The problem i have is that some functions of my user app
>>> is
>>> in dlls that are not mine so i cannot use some ReadFileThroughFilter
>>> function.
>>>
>>> I have to be able to pass/open the file in user app with no
>>> communication
>>> with the mini filter
>>>
>>> thought it would be trivial but nothing seems that way here :slight_smile:
>>>
>>> Marko
>>>
>>>
>>> “Lyndon J Clarke” wrote in message
>>> news:xxxxx@ntfsd…
>>>> What do you want to do with this file?
>>>>
>>>> “marek” wrote in message news:xxxxx@ntfsd…
>>>>> hey, here’s a question about opening locked files
>>>>>
>>>>> i’ve read many posts and articles about all sorts of things with much
>>>>> conclusive but…
>>>>>
>>>>> i have a win32 user app which wants to open a locked file (previously
>>>>> opened as exclusive in another app)
>>>>> as i’ve gathered the only way to do it is to get into IRP_MJ_CREATE
>>>>> and
>>>>> reopen the file with different file create options.
>>>>>
>>>>> i’ve created a mini filter driver and in PreCreate succeded in opening
>>>>> a
>>>>> file with various methods
>>>>> ZwCreateFile - yes yes reentrancy :slight_smile:
>>>>> IoCreateFileSpecifyDeviceObjectHint - allmost ok
>>>>> FltCreateFile - works as needed
>>>>>
>>>>> so i have the file open and what now?
>>>>> I’ve tried to open it into FltObjects->FileObject with FltCreateFileEx
>>>>> but i can’t try it yet because it’s not available on xp. I guess i’ll
>>>>> have to install w2k and download the symbols… if i’m on the right
>>>>> track
>>>>> anyway…
>>>>>
>>>>> How can i change the old file handle to the new one in the old
>>>>> FileObject. Or must i create a new FileObject
>>>>>
>>>>> sorry for boring you and thank you
>>>>> Marko
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>> —
>>> Questions? First check the IFS FAQ at
>>> https://www.osronline.com/article.cfm?id=17
>>>
>>> You are currently subscribed to ntfsd as: xxxxx@comcast.net
>>> To unsubscribe send a blank email to xxxxx@lists.osr.com
>>>
>>>
>>> —
>>> Questions? First check the IFS FAQ at
>>> https://www.osronline.com/article.cfm?id=17
>>>
>>> You are currently subscribed to ntfsd as: xxxxx@rdperf.com
>>> To unsubscribe send a blank email to xxxxx@lists.osr.com
>>>
>>>
>>> —
>>> Questions? First check the IFS FAQ at
>>> https://www.osronline.com/article.cfm?id=17
>>>
>>> You are currently subscribed to ntfsd as: xxxxx@rocketdivision.com
>>> To unsubscribe send a blank email to xxxxx@lists.osr.com
>>>
>>>
>>
>>
>>
>
>
>
> —
> Questions? First check the IFS FAQ at
> https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to ntfsd as: xxxxx@rocketdivision.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@vmware.com
To unsubscribe send a blank email to xxxxx@lists.osr.com