// Converts forward slashes to backslashes and removes duplicate slashes.
// Necessary because some (buggy?) EFI implementations produce "\/" strings
-// in pathnames.
-static VOID CleanUpPathNameSlashes(IN OUT CHAR16 *PathName) {
+// in pathnames and because some user inputs can produce duplicate directory
+// separators
+VOID CleanUpPathNameSlashes(IN OUT CHAR16 *PathName) {
CHAR16 *NewName;
UINTN i, j = 0;
BOOLEAN LastWasSlash = FALSE;
}
if (Seen)
continue;
-
+
PathList[PathCount++] = AppendDevicePath(DevicePath, LegacyLoaderMediaPath);
}
FreePool(Handles);
-
+
if (HardcodedPathList) {
for (HardcodedIndex = 0; HardcodedPathList[HardcodedIndex] && PathCount < MaxPaths; HardcodedIndex++)
PathList[PathCount++] = HardcodedPathList[HardcodedIndex];
UINTN i;
MBR_PARTITION_INFO *MbrTable;
BOOLEAN MbrTableFound;
-
+
Volume->HasBootCode = FALSE;
Volume->OSIconName = NULL;
Volume->OSName = NULL;
*Bootable = FALSE;
-
+
if (Volume->BlockIO == NULL)
return;
if (Volume->BlockIO->Media->BlockSize > SECTOR_SIZE)
return; // our buffer is too small...
-
+
// look at the boot sector (this is used for both hard disks and El Torito images!)
Status = refit_call5_wrapper(Volume->BlockIO->ReadBlocks,
Volume->BlockIO, Volume->BlockIO->Media->MediaId,
// open the root directory of the volume
Volume->RootDir = LibOpenRoot(Volume->DeviceHandle);
if (Volume->RootDir == NULL) {
+ Volume->IsReadable = FALSE;
return;
+ } else {
+ Volume->IsReadable = TRUE;
}
// get volume name
if (Second != NULL)
Length2 = StrLen(Second);
NewString = AllocatePool(sizeof(CHAR16) * (Length1 + Length2 + 2));
- NewString[0] = L'\0';
if (NewString != NULL) {
+ NewString[0] = L'\0';
if (*First != NULL) {
StrCat(NewString, *First);
if (AddChar) {
NewString[Length1 + 1] = 0;
} // if (AddChar)
} // if (*First != NULL)
- if (First != NULL)
+ if (Second != NULL)
StrCat(NewString, Second);
FreePool(*First);
*First = NewString;
// Find the #Index element (numbered from 0) in a comma-delimited string
// of elements.
-// Returns the found element, or NULL if Index is out of range of InString
+// Returns the found element, or NULL if Index is out of range or InString
// is NULL.
CHAR16 *FindCommaDelimited(IN CHAR16 *InString, IN UINTN Index) {
UINTN StartPos = 0, CurPos = 0;
else
CurPos++;
} // while
+ if (Index == 0)
+ FoundString = StrDuplicate(&InString[StartPos]);
+ if (FoundString != NULL)
+ FoundString[CurPos - StartPos] = 0;
} // if
- if (Index == 0)
- FoundString = StrDuplicate(&InString[StartPos]);
- if (FoundString != NULL)
- FoundString[CurPos - StartPos] = 0;
return (FoundString);
} // CHAR16 *FindCommaDelimited()