From 51e10ca14578f3120723c0f72028b5cc46a982cb Mon Sep 17 00:00:00 2001
From: srs5694
Date: Wed, 23 Jan 2013 22:36:20 -0500
Subject: [PATCH] Fixed bug that caused rEFInd to ignore manual boot stanzas in
files included via the "include" token in refind.conf.
---
NEWS.txt | 3 +++
docs/refind/bootmode.html | 5 ++++-
refind/config.c | 16 +++++++++++-----
refind/config.h | 2 +-
refind/main.c | 4 ++--
5 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/NEWS.txt b/NEWS.txt
index d3c870c..a4b5d8b 100644
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -1,6 +1,9 @@
0.6.6 (?/??/2013):
------------------
+- Fixed bug that caused rEFInd to ignore manual boot stanzas in files
+ included via the "include" token in refind.conf.
+
- Fixed bug that caused ASSERT error on some systems (and conceivably a
crash on startup on some) when default_selection line in refind.conf was
commented out or empty.
diff --git a/docs/refind/bootmode.html b/docs/refind/bootmode.html
index 09441d6..cc2239d 100644
--- a/docs/refind/bootmode.html
+++ b/docs/refind/bootmode.html
@@ -177,6 +177,8 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com
Identifying Your Windows Boot Mode
+
-Another way to identify your boot mode is to examine your partitions. Microsoft has tied use of the GUID Partition Table (GPT) to EFI booting. If you've booted from a GPT disk, then you must be using EFI, and if you've booted from a Master Boot Record (MBR) disk, you must have booted in BIOS mode. Therefore, you can check your partition table type as a proxy for your boot mode. To do this in Windows 7, follow these steps:
+The most reliable way I know of to identify your boot mode is to examine your partitions. Microsoft has tied use of the GUID Partition Table (GPT) to EFI booting. If you've booted from a GPT disk, then you must be using EFI, and if you've booted from a Master Boot Record (MBR) disk, you must have booted in BIOS mode. Therefore, you can check your partition table type as a proxy for your boot mode. To do this in Windows 7, follow these steps:
diff --git a/refind/config.c b/refind/config.c
index 8c18f41..ffe1970 100644
--- a/refind/config.c
+++ b/refind/config.c
@@ -362,7 +362,7 @@ VOID ReadConfig(CHAR16 *FileName)
GlobalConfig.DontScanDirs = SelfPath;
MyFreePool(GlobalConfig.DontScanFiles);
GlobalConfig.DontScanFiles = StrDuplicate(DONT_SCAN_FILES);
- }
+ } // if
if (!FileExists(SelfDir, FileName)) {
Print(L"Configuration file '%s' missing!\n", FileName);
@@ -731,7 +731,7 @@ static LOADER_ENTRY * AddStanzaEntries(REFIT_FILE *File, REFIT_VOLUME *Volume, C
// Read the user-configured menu entries from refind.conf and add or delete
// entries based on the contents of that file....
-VOID ScanUserConfigured(VOID)
+VOID ScanUserConfigured(CHAR16 *FileName)
{
EFI_STATUS Status;
REFIT_FILE File;
@@ -741,8 +741,8 @@ VOID ScanUserConfigured(VOID)
UINTN TokenCount, size;
LOADER_ENTRY *Entry;
- if (FileExists(SelfDir, CONFIG_FILE_NAME)) {
- Status = ReadFile(SelfDir, CONFIG_FILE_NAME, &File, &size);
+ if (FileExists(SelfDir, FileName)) {
+ Status = ReadFile(SelfDir, FileName, &File, &size);
if (EFI_ERROR(Status))
return;
@@ -760,7 +760,13 @@ VOID ScanUserConfigured(VOID)
MyFreePool(Entry);
} // if/else
MyFreePool(Title);
- } // if
+
+ } else if ((StriCmp(TokenList[0], L"include") == 0) && (TokenCount == 2) && (StriCmp(FileName, CONFIG_FILE_NAME) == 0)) {
+ if (StriCmp(TokenList[1], FileName) != 0) {
+ ScanUserConfigured(TokenList[1]);
+ }
+
+ } // if/else if...
FreeTokenLine(&TokenList, &TokenCount);
} // while()
} // if()
diff --git a/refind/config.h b/refind/config.h
index cafcb4f..79acf21 100644
--- a/refind/config.h
+++ b/refind/config.h
@@ -84,7 +84,7 @@ typedef struct {
EFI_STATUS ReadFile(IN EFI_FILE_HANDLE BaseDir, CHAR16 *FileName, REFIT_FILE *File, UINTN *size);
VOID ReadConfig(CHAR16 *FileName);
-VOID ScanUserConfigured(VOID);
+VOID ScanUserConfigured(CHAR16 *FileName);
UINTN ReadTokenLine(IN REFIT_FILE *File, OUT CHAR16 ***TokenList);
VOID FreeTokenLine(IN OUT CHAR16 ***TokenList, IN OUT UINTN *TokenCount);
REFIT_FILE * ReadLinuxOptionsFile(IN CHAR16 *LoaderPath, IN REFIT_VOLUME *Volume);
diff --git a/refind/main.c b/refind/main.c
index 1034927..3e1061a 100644
--- a/refind/main.c
+++ b/refind/main.c
@@ -128,7 +128,7 @@ static VOID AboutrEFInd(VOID)
if (AboutMenu.EntryCount == 0) {
AboutMenu.TitleImage = BuiltinIcon(BUILTIN_ICON_FUNC_ABOUT);
- AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.6.5.4");
+ AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.6.5.5");
AddMenuInfoLine(&AboutMenu, L"");
AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2006-2010 Christoph Pfisterer");
AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2012 Roderick W. Smith");
@@ -1828,7 +1828,7 @@ static VOID ScanForBootloaders(VOID) {
ScanLegacyExternal();
break;
case 'm': case 'M':
- ScanUserConfigured();
+ ScanUserConfigured(CONFIG_FILE_NAME);
break;
case 'e': case 'E':
ScanExternal();
--
2.39.2