diff --git a/reactos/ntoskrnl/io/iomgr/device.c b/reactos/ntoskrnl/io/iomgr/device.c index c141afbf541..6432c04e77d 100644 --- a/reactos/ntoskrnl/io/iomgr/device.c +++ b/reactos/ntoskrnl/io/iomgr/device.c @@ -1167,6 +1167,41 @@ IoGetRelatedDeviceObject(IN PFILE_OBJECT FileObject) return DeviceObject; } +/* + * @implemented + */ +PDEVICE_OBJECT +NTAPI +IoGetBaseFileSystemDeviceObject(IN PFILE_OBJECT FileObject) +{ + PDEVICE_OBJECT DeviceObject; + + /* + * If the FILE_OBJECT's VPB is defined, + * get the device from it. + */ + if ((FileObject->Vpb) && (FileObject->Vpb->DeviceObject)) + { + /* Use the VPB's Device Object's */ + DeviceObject = FileObject->Vpb->DeviceObject; + } + else if (!(FileObject->Flags & FO_DIRECT_DEVICE_OPEN) && + (FileObject->DeviceObject->Vpb) && + (FileObject->DeviceObject->Vpb->DeviceObject)) + { + /* Use the VPB's File System Object */ + DeviceObject = FileObject->DeviceObject->Vpb->DeviceObject; + } + else + { + /* Use the FO's Device Object */ + DeviceObject = FileObject->DeviceObject; + } + + /* Return the device object we found */ + return DeviceObject; +} + /* * @implemented */ diff --git a/reactos/ntoskrnl/io/iomgr/volume.c b/reactos/ntoskrnl/io/iomgr/volume.c index e4be3ae43ed..0f1732bf3fe 100644 --- a/reactos/ntoskrnl/io/iomgr/volume.c +++ b/reactos/ntoskrnl/io/iomgr/volume.c @@ -35,7 +35,8 @@ INIT_FUNCTION NTAPI IoInitVpbImplementation(VOID) { - KeInitializeSpinLock(&IoVpbLock); + /* Just initialize the VPB Lock */ + KeInitializeSpinLock(&IoVpbLock); } VOID @@ -348,7 +349,8 @@ IopMountVolume(IN PDEVICE_OBJECT DeviceObject, /* Initialize the event to wait on */ KeInitializeEvent(&Event, NotificationEvent, FALSE); - /* Get the actual device to mount */ + /* Remove the verify flag and get the actual device to mount */ + DeviceObject->Flags &= ~DO_VERIFY_VOLUME; while (AttachedDeviceObject->AttachedDevice) { /* Get the next one */ @@ -779,48 +781,6 @@ IoUnregisterFileSystem(IN PDEVICE_OBJECT DeviceObject) KeLeaveCriticalRegion(); } -/* - * @implemented - */ -PDEVICE_OBJECT -NTAPI -IoGetBaseFileSystemDeviceObject(IN PFILE_OBJECT FileObject) -{ - PDEVICE_OBJECT DeviceObject = NULL; - PVPB Vpb = NULL; - - /* - * If the FILE_OBJECT's VPB is defined, - * get the device from it. - */ - if (NULL != (Vpb = FileObject->Vpb)) - { - if (NULL != (DeviceObject = Vpb->DeviceObject)) - { - /* Vpb->DeviceObject DEFINED! */ - return DeviceObject; - } - } - - /* - * If that failed, try the VPB - * in the FILE_OBJECT's DeviceObject. - */ - DeviceObject = FileObject->DeviceObject; - if (NULL == (Vpb = DeviceObject->Vpb)) - { - /* DeviceObject->Vpb UNDEFINED! */ - return DeviceObject; - } - - /* - * If that pointer to the VPB is again - * undefined, return directly the - * device object from the FILE_OBJECT. - */ - return ((NULL == Vpb->DeviceObject) ? DeviceObject : Vpb->DeviceObject); -} - /* * @implemented */