Opening file before IRP_MJ_SETINFORMATION gives sharing violation

Hi guys,

I need to open a file when my driver sees an IRP_MJ_SETINFORMATION
(because of a file delete/rename action). Basically, based on the file
contents I want to allow or deny the rename/delete operation. Therefor I
need to read the file contents first before I pass down the irp.

The problem is, that when I open the file (using IoCreateFile, using my
shadow device object), IoCreateFile returns status C0000043 (meaning
sharing violation). I find this strange, because in IRP_MJ_CREATE the
file is openend with sharing mode 0x7, which means that another thread
can open the file for reading/writing/deleting.

What causes this sharing violation ? Is there any way to open/read the
file in the IRP_MJ_SETINFORMATION path ?

Best,
Bartjan

What is the sharing mode you are specifying. Don’t forget that you also can conflict with the previous open’s access mode.

You can also open the file for SYNCHRONIZE access and then roll your own IRP for the set information call.

/TomH

-----Original Message-----
From: Dejan Maksimovic [mailto:xxxxx@alfasp.com]
Sent: Monday, October 21, 2002 9:13 AM
To: File Systems Developers
Subject: [ntfsd] Re: Opening file before IRP_MJ_SETINFORMATION gives
sharing violation

How about using the passed FO to read the file?

Regards, Dejan.

Bartjan Wattel wrote:

Hi guys,

I need to open a file when my driver sees an IRP_MJ_SETINFORMATION
(because of a file delete/rename action). Basically, based on the file
contents I want to allow or deny the rename/delete operation. Therefor I
need to read the file contents first before I pass down the irp.

The problem is, that when I open the file (using IoCreateFile, using my
shadow device object), IoCreateFile returns status C0000043 (meaning
sharing violation). I find this strange, because in IRP_MJ_CREATE the file
is openend with sharing mode 0x7, which means that another thread can open
the file for reading/writing/deleting.

What causes this sharing violation ? Is there any way to open/read the
file in the IRP_MJ_SETINFORMATION path ?


Kind regards, Dejan M. www.alfasp.com
E-mail: xxxxx@alfasp.com ICQ#: 56570367
Alfa File Monitor - File monitoring library for Win32 developers.
Alfa File Protector - File protection and hiding library for Win32
developers.


You are currently subscribed to ntfsd as: xxxxx@inflectionsystems.com
To unsubscribe send a blank email to %%email.unsub%%