mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +00:00
[MOUNTMGR] HasDriveLetter(): Simplify code by using a for() loop
This commit is contained in:
parent
b6654c0fb5
commit
085528c31a
2 changed files with 9 additions and 19 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue