mirror of
https://github.com/reactos/reactos.git
synced 2024-09-30 14:37:45 +00:00
[MOUNTMGR] HasDriveLetter(): Simplify code by using a for() loop
This commit is contained in:
parent
b6654c0fb5
commit
085528c31a
|
@ -506,13 +506,13 @@ MountMgrNextDriveLetterWorker(IN PDEVICE_EXTENSION DeviceExtension,
|
||||||
DeviceInformation->LetterAssigned =
|
DeviceInformation->LetterAssigned =
|
||||||
DriveLetterInfo->DriveLetterWasAssigned = TRUE;
|
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;
|
NextEntry = DeviceInformation->SymbolicLinksListHead.Flink;
|
||||||
while (NextEntry != &(DeviceInformation->SymbolicLinksListHead))
|
while (NextEntry != &(DeviceInformation->SymbolicLinksListHead))
|
||||||
{
|
{
|
||||||
SymlinkInformation = CONTAINING_RECORD(NextEntry, SYMLINK_INFORMATION, SymbolicLinksListEntry);
|
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)
|
if (IsDriveLetter(&(SymlinkInformation->Name)) && SymlinkInformation->Online)
|
||||||
{
|
{
|
||||||
DriveLetterInfo->DriveLetterWasAssigned = FALSE;
|
DriveLetterInfo->DriveLetterWasAssigned = FALSE;
|
||||||
|
|
|
@ -89,28 +89,18 @@ HasDriveLetter(IN PDEVICE_INFORMATION DeviceInformation)
|
||||||
PLIST_ENTRY NextEntry;
|
PLIST_ENTRY NextEntry;
|
||||||
PSYMLINK_INFORMATION SymlinkInfo;
|
PSYMLINK_INFORMATION SymlinkInfo;
|
||||||
|
|
||||||
/* To have a drive letter, a device must have symbolic links */
|
/* Browse all the symlinks to check if there is at least a drive letter */
|
||||||
if (IsListEmpty(&(DeviceInformation->SymbolicLinksListHead)))
|
for (NextEntry = DeviceInformation->SymbolicLinksListHead.Flink;
|
||||||
{
|
NextEntry != &DeviceInformation->SymbolicLinksListHead;
|
||||||
return FALSE;
|
NextEntry = NextEntry->Flink)
|
||||||
}
|
|
||||||
|
|
||||||
/* Browse all the links untill a drive letter is found */
|
|
||||||
NextEntry = &(DeviceInformation->SymbolicLinksListHead);
|
|
||||||
do
|
|
||||||
{
|
{
|
||||||
SymlinkInfo = CONTAINING_RECORD(NextEntry, SYMLINK_INFORMATION, SymbolicLinksListEntry);
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue