From ff429eb9f35ecf8f6bda015d72ef0470d6f6ca79 Mon Sep 17 00:00:00 2001 From: Alex Ionescu Date: Sun, 2 Jul 2006 06:15:52 +0000 Subject: [PATCH] - Use IoIsErrorUserInoduced to check if we couldn't mount the device because it was not actually inserted, was unrocognized, write-protected, etc... and completely break out of the mounting procedure if so. - Also use FsRtlIsTotalDeviceFailure to check if the error was a fatal device error (like a CRC error) and abandon mounting in this case as well. svn path=/trunk/; revision=22765 --- reactos/ntoskrnl/io/iomgr/volume.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/reactos/ntoskrnl/io/iomgr/volume.c b/reactos/ntoskrnl/io/iomgr/volume.c index a555d0ac94f..54184110b56 100644 --- a/reactos/ntoskrnl/io/iomgr/volume.c +++ b/reactos/ntoskrnl/io/iomgr/volume.c @@ -479,6 +479,15 @@ IopMountVolume(IN PDEVICE_OBJECT DeviceObject, } else { + /* Check if we failed because of the user */ + if ((IoIsErrorUserInduced(Status)) && + (IoStatusBlock.Information == 1)) + { + /* Break out and fail */ + break; + } + + /* Otherwise, check if we need to load the FS driver */ if (Status == STATUS_FS_DRIVER_REQUIRED) { /* We need to release the lock */ @@ -497,7 +506,6 @@ IopMountVolume(IN PDEVICE_OBJECT DeviceObject, if (!DeviceIsLocked) { /* Lock it ourselves */ - DPRINT1("Waiting\n"); Status = KeWaitForSingleObject(&DeviceObject-> DeviceLock, Executive, @@ -531,6 +539,19 @@ IopMountVolume(IN PDEVICE_OBJECT DeviceObject, LocalList.Flink = FsList->Flink; ListEntry = &LocalList; } + + /* + * Check if we failed with any other error then an unrecognized + * volume, and if this request doesn't allow mounting the raw + * file system. + */ + if (!(AllowRawMount) && + (Status != STATUS_UNRECOGNIZED_VOLUME) && + (FsRtlIsTotalDeviceFailure(Status))) + { + /* Break out and give up */ + break; + } } /* Go to the next FS entry */