Read data from a exclusive write locked file

Hi,
I want to read data from a file that has been opened for exclusive
write by an application level program.
Is there any way of reading this file in the KernelMode ?
ZwCreateFile is failing.
I tried to create an IRP for MJ_CREATE with PFILE_OBJECT filled by the
return value of IoGetDeviceObjectPointer for the required file. The status
that is seen in the completion routine is STATUS_FILE_CLOSED
((NTSTATUS)0xC0000128L). This seems to be due to the fact that
IoGetDeviceObjectPointer closes the file object before returning the values.
Is there a work around for this problem ?
Any suggestion is welcome.

Thanks in advance.
Josie

Just open the file as for FILE_READ_ATTRIBUTES only.
Then map the file in memory. You should be able to read the file now.

Inaki.

-----Original Message-----
From: Joseph _Arun
Sent: viernes 17 de marzo de 2000 11:31
To: File Systems Developers
Subject: [ntfsd] Read data from a exclusive write locked file

Hi,
I want to read data from a file that has been opened for exclusive
write by an application level program.
Is there any way of reading this file in the KernelMode ?
ZwCreateFile is failing.
I tried to create an IRP for MJ_CREATE with PFILE_OBJECT filled by the
return value of IoGetDeviceObjectPointer for the required file. The
status that is seen in the completion routine is STATUS_FILE_CLOSED
((NTSTATUS)0xC0000128L). This seems to be due to the fact that
IoGetDeviceObjectPointer closes the file object before returning the
values.

Is there a work around for this problem ?
Any suggestion is welcome.

Thanks in advance.
Josie

At 12:10 PM 3/17/00 +0100, you wrote:

Just open the file as for FILE_READ_ATTRIBUTES only.
Then map the file in memory. You should be able to read the file now.

Inaki.

Hi,

I think that if the original file was created with ‘FILE_FLAG_NO_BUFFERING’
flag, then this method may cause unpredictable results.

Lev.

Read data from a exclusive write locked fileYou should investigate why
ZwCreateFile() is failing rather than trying to roll-your-own create IRP.

Jamey
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Joseph _Arun
Sent: Friday, March 17, 2000 2:31 AM
To: File Systems Developers
Subject: [ntfsd] Read data from a exclusive write locked file

Hi,
I want to read data from a file that has been opened for exclusive
write by an application level program.
Is there any way of reading this file in the KernelMode ?
ZwCreateFile is failing.
I tried to create an IRP for MJ_CREATE with PFILE_OBJECT filled by the
return value of IoGetDeviceObjectPointer for the required file. The status
that is seen in the completion routine is STATUS_FILE_CLOSED
((NTSTATUS)0xC0000128L). This seems to be due to the fact that
IoGetDeviceObjectPointer closes the file object before returning the values.

Is there a work around for this problem ?
Any suggestion is welcome.

Thanks in advance.
Josie