Author: ion Date: Mon Aug 21 00:00:56 2006 New Revision: 23622
URL: http://svn.reactos.org/svn/reactos?rev=23622&view=rev Log: - Fix bug 1764 reported by alexvlas.
Modified: trunk/reactos/ntoskrnl/io/iomgr/device.c
Modified: trunk/reactos/ntoskrnl/io/iomgr/device.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/device.c?... ============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/device.c (original) +++ trunk/reactos/ntoskrnl/io/iomgr/device.c Mon Aug 21 00:00:56 2006 @@ -1067,6 +1067,7 @@ PEXTENDED_DEVOBJ_EXTENSION DeviceExtension; PVPB Vpb; KIRQL OldIrql; + NTSTATUS Status;
/* Make sure there's a VPB */ if (!FileSystemDeviceObject->Vpb) return STATUS_INVALID_PARAMETER; @@ -1079,21 +1080,34 @@
/* Make sure this one has a VPB too */ Vpb = DeviceExtension->Vpb; - if (!Vpb) return STATUS_INVALID_PARAMETER; - - /* Make sure that it's mounted */ - if ((!Vpb->ReferenceCount) || (Vpb->Flags & VPB_MOUNTED)) - { - /* It's not, so return failure */ - return STATUS_VOLUME_DISMOUNTED; - } - - /* Return the Disk Device Object */ - *DiskDeviceObject = Vpb->RealDevice; + if (Vpb) + { + /* Make sure that it's mounted */ + if ((Vpb->ReferenceCount) && + (Vpb->Flags & VPB_MOUNTED)) + { + /* Return the Disk Device Object */ + *DiskDeviceObject = Vpb->RealDevice; + + /* Reference it and return success */ + ObReferenceObject(Vpb->RealDevice); + Status = STATUS_SUCCESS; + } + else + { + /* It's not, so return failure */ + return STATUS_VOLUME_DISMOUNTED; + } + } + else + { + /* Fail */ + Status = STATUS_INVALID_PARAMETER; + }
/* Release the lock */ IoReleaseVpbSpinLock(OldIrql); - return STATUS_SUCCESS; + return Status; }
/*