diff --git a/drivers/filters/mountmgr/device.c b/drivers/filters/mountmgr/device.c index ce8f58ce855..8ed81e327d0 100644 --- a/drivers/filters/mountmgr/device.c +++ b/drivers/filters/mountmgr/device.c @@ -506,13 +506,13 @@ MountMgrNextDriveLetterWorker(IN PDEVICE_EXTENSION DeviceExtension, DeviceInformation->LetterAssigned = DriveLetterInfo->DriveLetterWasAssigned = TRUE; - /* Browse all the symlink to see if there's already a drive letter */ + /* Browse all the symlinks to check if there is already a drive letter */ NextEntry = DeviceInformation->SymbolicLinksListHead.Flink; while (NextEntry != &(DeviceInformation->SymbolicLinksListHead)) { SymlinkInformation = CONTAINING_RECORD(NextEntry, SYMLINK_INFORMATION, SymbolicLinksListEntry); - /* This is a driver letter & online one, forget about new drive eltter */ + /* If this is a drive letter and it is online, forget about new drive letter */ if (IsDriveLetter(&(SymlinkInformation->Name)) && SymlinkInformation->Online) { DriveLetterInfo->DriveLetterWasAssigned = FALSE; diff --git a/drivers/filters/mountmgr/mountmgr.c b/drivers/filters/mountmgr/mountmgr.c index c2fc801a478..37c85874c97 100644 --- a/drivers/filters/mountmgr/mountmgr.c +++ b/drivers/filters/mountmgr/mountmgr.c @@ -89,28 +89,18 @@ HasDriveLetter(IN PDEVICE_INFORMATION DeviceInformation) PLIST_ENTRY NextEntry; PSYMLINK_INFORMATION SymlinkInfo; - /* To have a drive letter, a device must have symbolic links */ - if (IsListEmpty(&(DeviceInformation->SymbolicLinksListHead))) - { - return FALSE; - } - - /* Browse all the links untill a drive letter is found */ - NextEntry = &(DeviceInformation->SymbolicLinksListHead); - do + /* Browse all the symlinks to check if there is at least a drive letter */ + for (NextEntry = DeviceInformation->SymbolicLinksListHead.Flink; + NextEntry != &DeviceInformation->SymbolicLinksListHead; + NextEntry = NextEntry->Flink) { SymlinkInfo = CONTAINING_RECORD(NextEntry, SYMLINK_INFORMATION, SymbolicLinksListEntry); - if (SymlinkInfo->Online) + if (IsDriveLetter(&SymlinkInfo->Name) && SymlinkInfo->Online) { - if (IsDriveLetter(&(SymlinkInfo->Name))) - { - return TRUE; - } + return TRUE; } - - NextEntry = NextEntry->Flink; - } while (NextEntry != &(DeviceInformation->SymbolicLinksListHead)); + } return FALSE; }