Author: ion
Date: Wed Jun 14 10:48:28 2006
New Revision: 22346
URL:
http://svn.reactos.ru/svn/reactos?rev=22346&view=rev
Log:
- Handle mount failure (such as when a CDROM isn't actually inside the drive) instead
of assuming success and setting a NULL device object. Fixes regression seen by Arty/James
when winefiling, dir d:-ing or hardware device wizarding.
Modified:
trunk/reactos/ntoskrnl/io/file.c
Modified: trunk/reactos/ntoskrnl/io/file.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/ntoskrnl/io/file.c?rev=2234…
==============================================================================
--- trunk/reactos/ntoskrnl/io/file.c (original)
+++ trunk/reactos/ntoskrnl/io/file.c Wed Jun 14 10:48:28 2006
@@ -66,6 +66,7 @@
0,
(PVOID*)&FileObject);
/* Set File Object Data */
+ ASSERT(DeviceObject);
FileObject->DeviceObject = IoGetAttachedDevice(DeviceObject);
DPRINT("DO. DRV Name: %p %wZ\n", DeviceObject,
&DeviceObject->DriverObject->DriverName);
@@ -89,12 +90,23 @@
{
/* Parent is a device object */
DeviceObject = IoGetAttachedDevice((PDEVICE_OBJECT)ParseObject);
+
+ /* Check if it has a VPB */
if (DeviceObject->Vpb)
{
+ /* Check if it's not already mounted */
if (!(DeviceObject->Vpb->Flags & VPB_MOUNTED))
{
Status = IoMountVolume(DeviceObject, FALSE);
+ if (!NT_SUCCESS(Status))
+ {
+ /* Couldn't mount, fail the lookup */
+ ObDereferenceObject(FileObject);
+ *Object = NULL;
+ return STATUS_UNSUCCESSFUL;
+ }
}
+
DeviceObject = DeviceObject->Vpb->DeviceObject;
}
}