X-Git-Url: https://code.delx.au/refind/blobdiff_plain/4677259a82b13dd1ab9fb6696d0ffe8976aeae34..9a669ad3b5fb341500d76d487c38a7102eb01b3d:/refind/config.c diff --git a/refind/config.c b/refind/config.c index 58043ae..bb5a53d 100644 --- a/refind/config.c +++ b/refind/config.c @@ -372,6 +372,18 @@ static UINTN HandleTime(IN CHAR16 *TimeString) { return (Hour * 60 + Minute); } // BOOLEAN HandleTime() +static BOOLEAN HandleBoolean(IN CHAR16 **TokenList, IN UINTN TokenCount) { + BOOLEAN TruthValue = TRUE; + + if ((TokenCount >= 2) && ((StriCmp(TokenList[1], L"0") == 0) || + (StriCmp(TokenList[1], L"false") == 0) || + (StriCmp(TokenList[1], L"off") == 0))) { + TruthValue = FALSE; + } // if + + return TruthValue; +} // BOOLEAN HandleBoolean + // Sets the default boot loader IF the current time is within the bounds // defined by the third and fourth tokens in the TokenList. static VOID SetDefaultByTime(IN CHAR16 **TokenList, OUT CHAR16 **Default) { @@ -498,6 +510,9 @@ VOID ReadConfig(CHAR16 *FileName) GlobalConfig.ScanFor[i] = ' '; } + } else if (StriCmp(TokenList[0], L"deep_uefi_legacy_scan") == 0) { + GlobalConfig.DeepLegacyScan = HandleBoolean(TokenList, TokenCount); + } else if ((StriCmp(TokenList[0], L"scan_delay") == 0) && (TokenCount == 2)) { HandleInt(TokenList, TokenCount, &(GlobalConfig.ScanDelay)); @@ -532,6 +547,8 @@ VOID ReadConfig(CHAR16 *FileName) GlobalConfig.ShowTools[i - 1] = TAG_SHELL; } else if (StriCmp(FlagName, L"gptsync") == 0) { GlobalConfig.ShowTools[i - 1] = TAG_GPTSYNC; + } else if (StriCmp(FlagName, L"gdisk") == 0) { + GlobalConfig.ShowTools[i - 1] = TAG_GDISK; } else if (StriCmp(FlagName, L"about") == 0) { GlobalConfig.ShowTools[i - 1] = TAG_ABOUT; } else if (StriCmp(FlagName, L"exit") == 0) { @@ -593,11 +610,12 @@ VOID ReadConfig(CHAR16 *FileName) } } else if (StriCmp(TokenList[0], L"textonly") == 0) { - if ((TokenCount >= 2) && (StriCmp(TokenList[1], L"0") == 0)) { - GlobalConfig.TextOnly = FALSE; - } else { - GlobalConfig.TextOnly = TRUE; - } + GlobalConfig.TextOnly = HandleBoolean(TokenList, TokenCount); +// if ((TokenCount >= 2) && (StriCmp(TokenList[1], L"0") == 0)) { +// GlobalConfig.TextOnly = FALSE; +// } else { +// GlobalConfig.TextOnly = TRUE; +// } } else if (StriCmp(TokenList[0], L"textmode") == 0) { HandleInt(TokenList, TokenCount, &(GlobalConfig.RequestedTextMode)); @@ -633,11 +651,12 @@ VOID ReadConfig(CHAR16 *FileName) egLoadFont(TokenList[1]); } else if (StriCmp(TokenList[0], L"scan_all_linux_kernels") == 0) { - if ((TokenCount >= 2) && (StriCmp(TokenList[1], L"0") == 0)) { - GlobalConfig.ScanAllLinux = FALSE; - } else { - GlobalConfig.ScanAllLinux = TRUE; - } + GlobalConfig.ScanAllLinux = HandleBoolean(TokenList, TokenCount); +// if ((TokenCount >= 2) && (StriCmp(TokenList[1], L"0") == 0)) { +// GlobalConfig.ScanAllLinux = FALSE; +// } else { +// GlobalConfig.ScanAllLinux = TRUE; +// } } else if (StriCmp(TokenList[0], L"max_tags") == 0) { HandleInt(TokenList, TokenCount, &(GlobalConfig.MaxTags)); @@ -657,18 +676,23 @@ VOID ReadConfig(CHAR16 *FileName) MyFreePool(File.Buffer); } /* VOID ReadConfig() */ -// Finds a volume with the specified Identifier (a volume label or a number -// followed by a colon, for the moment). If found, sets *Volume to point to -// that volume. If not, leaves it unchanged. +// Finds a volume with the specified Identifier (a filesystem label, a +// partition name, a partition GUID, or a number followed by a colon). If +// found, sets *Volume to point to that volume. If not, leaves it unchanged. // Returns TRUE if a match was found, FALSE if not. static BOOLEAN FindVolume(REFIT_VOLUME **Volume, CHAR16 *Identifier) { - UINTN i = 0, CountedVolumes = 0; + UINTN i = 0, CountedVolumes = 0, Length; INTN Number = -1; - BOOLEAN Found = FALSE; + BOOLEAN Found = FALSE, IdIsGuid = FALSE; + EFI_GUID VolGuid, NullGuid = NULL_GUID_VALUE; - if ((StrLen(Identifier) >= 2) && (Identifier[StrLen(Identifier) - 1] == L':') && + VolGuid = StringAsGuid(Identifier); + Length = StrLen(Identifier); + if ((Length >= 2) && (Identifier[Length - 1] == L':') && (Identifier[0] >= L'0') && (Identifier[0] <= L'9')) { Number = (INTN) Atoi(Identifier); + } else if (IsGuid(Identifier)) { + IdIsGuid = TRUE; } while ((i < VolumesCount) && (!Found)) { if (Number >= 0) { // User specified a volume by number @@ -679,11 +703,18 @@ static BOOLEAN FindVolume(REFIT_VOLUME **Volume, CHAR16 *Identifier) { } CountedVolumes++; } // if - } else { // User specified a volume by label - if (StriCmp(Identifier, Volumes[i]->VolName) == 0) { + } else { // User specified a volume by label or GUID + if ((StriCmp(Identifier, Volumes[i]->VolName) == 0) || + (StriCmp(Identifier, Volumes[i]->PartName) == 0)) { *Volume = Volumes[i]; Found = TRUE; } // if + if (IdIsGuid && !Found) { + if (GuidsAreEqual(&VolGuid, &(Volumes[i]->PartGuid)) && !GuidsAreEqual(&NullGuid, &(Volumes[i]->PartGuid))) { + *Volume = Volumes[i]; + Found = TRUE; + } // if + } // if } // if/else i++; } // while()