Author: ion
Date: Sat Jul 8 22:30:59 2006
New Revision: 22933
URL: http://svn.reactos.org/svn/reactos?rev=22933&view=rev
Log:
- Add support for cases when the FSD that actually did the FO create wasn't the one to whom we went the IRP.
- Also add support for detecting volume opens and setting the FO_VOLUME_OPEN flag.
Modified:
trunk/reactos/ntoskrnl/io/iomgr/file.c
Modified: trunk/reactos/ntoskrnl/io/iomgr/file.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/file.c?r…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/file.c (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/file.c Sat Jul 8 22:30:59 2006
@@ -30,7 +30,8 @@
OUT PVOID *Object)
{
POPEN_PACKET OpenPacket = (POPEN_PACKET)Context;
- PDEVICE_OBJECT OriginalDeviceObject = (PDEVICE_OBJECT)ParseObject, DeviceObject;
+ PDEVICE_OBJECT OriginalDeviceObject = (PDEVICE_OBJECT)ParseObject;
+ PDEVICE_OBJECT DeviceObject, OwnerDevice;
NTSTATUS Status;
PFILE_OBJECT FileObject;
PVPB Vpb = NULL;
@@ -431,9 +432,43 @@
KEBUGCHECK(0);
}
+ /* Get the owner of the File Object */
+ OwnerDevice = IoGetRelatedDeviceObject(FileObject);
+
+ /*
+ * It's possible that the device to whom we sent the IRP to
+ * isn't actually the device that ended opening the file object
+ * internally.
+ */
+ if (OwnerDevice != DeviceObject)
+ {
+ /* We have to de-reference the VPB we had associated */
+ if (Vpb) IopDereferenceVpb(Vpb);
+
+ /* And re-associate with the actual one */
+ Vpb = FileObject->Vpb;
+ if (Vpb) InterlockedIncrement(&Vpb->ReferenceCount);
+ }
+
/* Make sure we are not using a dummy */
if (!UseDummyFile)
{
+ /* Check if this was a volume open */
+ if ((!(FileObject->RelatedFileObject) ||
+ (FileObject->RelatedFileObject->Flags & FO_VOLUME_OPEN)) &&
+ !(FileObject->FileName.Length))
+ {
+ /* All signs point to it, but make sure it was actually an FSD */
+ if ((OwnerDevice->DeviceType == FILE_DEVICE_DISK_FILE_SYSTEM) ||
+ (OwnerDevice->DeviceType == FILE_DEVICE_CD_ROM_FILE_SYSTEM) ||
+ (OwnerDevice->DeviceType == FILE_DEVICE_TAPE_FILE_SYSTEM) ||
+ (OwnerDevice->DeviceType == FILE_DEVICE_FILE_SYSTEM))
+ {
+ /* The owner device is an FSD, so this is a volume open for real */
+ FileObject->Flags |= FO_VOLUME_OPEN;
+ }
+ }
+
/* Reference the object and set the parse check */
ObReferenceObject(FileObject);
*Object = FileObject;
Author: ion
Date: Sat Jul 8 22:19:39 2006
New Revision: 22929
URL: http://svn.reactos.org/svn/reactos?rev=22929&view=rev
Log:
- Remove a ROS hack in IopCloseFile.
Modified:
trunk/reactos/ntoskrnl/io/iomgr/file.c
Modified: trunk/reactos/ntoskrnl/io/iomgr/file.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/file.c?r…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/file.c (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/file.c Sat Jul 8 22:19:39 2006
@@ -962,13 +962,6 @@
/* Make sure this is the last handle */
if (SystemHandleCount != 1) return;
-
- /* FIXME: ROS HACK */
- if (!FileObject->DeviceObject)
- {
- DPRINT1("FIXME: MALFORMED FILE OBJECT!\n");
- return;
- }
/* Check if this is a direct open or not */
if (FileObject->Flags & FO_DIRECT_DEVICE_OPEN)