dont_scan_files in refind.conf.
0.7.7 (12/??/2013):
-------------------
+- Can now specify complete paths, optionally including volumes, in
+ dont_scan_files.
+
+- Added shimx64.efi to the default dont_scan_files list.
+
+- Added windows_recovery_files token, to specify what program(s) launch a
+ Windows recovery utility; and the "windows_recovery" option to
+ "showtools," to control whether or not to display the Windows recovery
+ utility on the second row of icons.
+
- The use_graphics_for, also_scan_dirs, dont_scan_dirs, dont_scan_files,
and scan_driver_dirs tokens in refind.conf now support "+" as the first
option, which causes the remaining options to be added to the default
<tr>
<td><tt>dont_scan_files</tt> or <tt>don't_scan_files</tt></td>
<td>filename(s)</td>
- <td>Adds the specified filename or filenames to a filename "blacklist"—these files are <i>not</i> included as boot loader options even if they're found on the disk. This is useful to exclude support programs (such as <tt>shim.efi</tt> and <tt>MokManager.efi</tt>) and drivers from your OS list. The default value is <tt>shim.efi, shim-fedora.efi, PreLoader.efi, TextMode.efi, ebounce.efi, GraphicsConsole.efi, MokManager.efi, HashTool.efi, HashTool-signed.efi</tt>. To add files to the default list rather than replace the list, specify <tt>+</tt> as the first option, as in <tt>dont_scan_files + badloader.efi</tt>.</td>
+ <td>Adds the specified filename or filenames to a filename "blacklist"—these files are <i>not</i> included as boot loader options even if they're found on the disk. This is useful to exclude support programs (such as <tt>shim.efi</tt> and <tt>MokManager.efi</tt>) and drivers from your OS list. The default value is <tt>shim.efi, shim-fedora.efi, shimx64.efi, PreLoader.efi, TextMode.efi, ebounce.efi, GraphicsConsole.efi, MokManager.efi, HashTool.efi, HashTool-signed.efi</tt>. To add files to the default list rather than replace the list, specify <tt>+</tt> as the first option, as in <tt>dont_scan_files + badloader.efi</tt>.</td>
</tr>
<tr>
<td><tt>windows_recovery_files</tt></td>
# the main binary or if you want to "blacklist" certain loaders by
# name rather than location, use this option. Note that this will
# NOT prevent certain binaries from showing up in the second-row
-# set of tools. Most notably, MokManager.efi is in this blacklist,
-# but will show up as a tool if present in certain directories. You
-# can control the tools row with the showtools token.
-# The default is shim.efi,PreLoader.efi,TextMode.efi,ebounce.efi,
-# GraphicsConsole.efi,MokManager.efi,HashTool.efi,HashTool-signed.efi,
-# bootmgr.efi
+# set of tools. Most notably, various Secure Boot and recovery
+# tools are present in this list, but may appear as second-row
+# items.
+# The file may be specified as a bare name (e.g., "notme.efi"), as
+# a complete filename (e.g., "/EFI/somedir/notme.efi"), or as a
+# complete filename with volume (e.g., "SOMEDISK:/EFI/somedir/notme.efi").
+# The default is shim.efi,shim-fedora.efi,shimx64.efi,PreLoader.efi,
+# TextMode.efi,ebounce.efi,GraphicsConsole.efi,MokManager.efi,HashTool.efi,
+# HashTool-signed.efi,bootmgr.efi
#
#dont_scan_files shim.efi,MokManager.efi
FreeTokenLine(&TokenList, &TokenCount);
}
+ if ((GlobalConfig.DontScanFiles) && (GlobalConfig.WindowsRecoveryFiles))
+ MergeStrings(&(GlobalConfig.DontScanFiles), GlobalConfig.WindowsRecoveryFiles, L',');
MyFreePool(File.Buffer);
} /* VOID ReadConfig() */
#define CONFIG_FILE_NAME L"refind.conf"
// Note: Below is combined with MOK_NAMES to make default
-#define DONT_SCAN_FILES L"shim.efi,shim-fedora.efi,PreLoader.efi,TextMode.efi,ebounce.efi,GraphicsConsole.efi,bootmgr.efi"
+#define DONT_SCAN_FILES L"shim.efi,shim-fedora.efi,shimx64.efi,PreLoader.efi,TextMode.efi,ebounce.efi,GraphicsConsole.efi,bootmgr.efi"
#define DONT_SCAN_VOLUMES L"Recovery HD,LRS_ESP"
#define ALSO_SCAN_DIRS L"boot"
LastBackslash = i;
} // for
PathOnly = StrDuplicate(FullPath);
- PathOnly[LastBackslash] = 0;
+ if (PathOnly != NULL)
+ PathOnly[LastBackslash] = 0;
} // if
return (PathOnly);
}
return Position;
} // INTN FindSubString()
+// Take an input path name, which may include a volume specification and/or
+// a path, and return separate volume, path, and file names. For instance,
+// "BIGVOL:\EFI\ubuntu\grubx64.efi" will return a VolName of "BIGVOL", a Path
+// of "EFI\ubuntu", and a Filename of "grubx64.efi". If an element is missing,
+// the returned pointer is NULL. The calling function is responsible for
+// freeing the allocated memory.
+VOID SplitPathName(CHAR16 *InPath, CHAR16 **VolName, CHAR16 **Path, CHAR16 **Filename) {
+ CHAR16 *Temp = NULL;
+
+ MyFreePool(*VolName);
+ MyFreePool(*Path);
+ MyFreePool(*Filename);
+ *VolName = *Path = *Filename = NULL;
+ Temp = StrDuplicate(InPath);
+ SplitVolumeAndFilename(&Temp, VolName); // VolName is NULL or has volume; Temp has rest of path
+ CleanUpPathNameSlashes(Temp);
+ *Path = FindPath(Temp); // *Path has path (may be 0-length); Temp unchanged.
+ *Filename = StrDuplicate(Temp + StrLen(*Path));
+ CleanUpPathNameSlashes(*Filename);
+ if (StrLen(*Path) == 0) {
+ MyFreePool(*Path);
+ *Path = NULL;
+ }
+ if (StrLen(*Filename) == 0) {
+ MyFreePool(*Filename);
+ *Filename = NULL;
+ }
+ MyFreePool(Temp);
+} // VOID SplitPathName
+
// Returns TRUE if SmallString is an element in the comma-delimited List,
// FALSE otherwise. Performs comparison case-insensitively (except on
// buggy EFIs with case-sensitive StriCmp() functions).
Found = TRUE;
} // while
} // if
- return Found;
+ return Found;
} // BOOLEAN IsIn()
+// Returns TRUE if specified Volume, Directory, and Filename correspond to an
+// element in the comma-delimited List, FALSE otherwise. Note that Directory and
+// Filename must *NOT* include a volume or path specification (that's part of
+// the Volume variable), but the List elements may. Performs comparison
+// case-insensitively (except on buggy EFIs with case-sensitive StriCmp()
+// functions).
+BOOLEAN FilenameIn(REFIT_VOLUME *Volume, CHAR16 *Directory, CHAR16 *Filename, CHAR16 *List) {
+ UINTN i = 0;
+ BOOLEAN Found = FALSE;
+ CHAR16 *OneElement;
+ CHAR16 *TargetVolName = NULL, *TargetPath = NULL, *TargetFilename = NULL;
+
+ if (Filename && List) {
+ while (!Found && (OneElement = FindCommaDelimited(List, i++))) {
+ Found = TRUE;
+ SplitPathName(OneElement, &TargetVolName, &TargetPath, &TargetFilename);
+ VolumeNumberToName(Volume, &TargetVolName);
+ if (((TargetVolName != NULL) && ((Volume == NULL) || (StriCmp(TargetVolName, Volume->VolName) != 0))) ||
+ ((TargetPath != NULL) && (StriCmp(TargetPath, Directory) != 0)) ||
+ ((TargetFilename != NULL) && (StriCmp(TargetFilename, Filename) != 0))) {
+ Found = FALSE;
+ } // if
+ MyFreePool(OneElement);
+ } // while
+ } // if
+
+ MyFreePool(TargetVolName);
+ MyFreePool(TargetPath);
+ MyFreePool(TargetFilename);
+ return Found;
+} // BOOLEAN FilenameIn()
+
+// If *VolName is of the form "fs#", where "#" is a number, and if Volume points
+// to this volume number, returns with *VolName changed to the volume name, as
+// stored in the Volume data structure.
+// Returns TRUE if this substitution was made, FALSE otherwise.
+BOOLEAN VolumeNumberToName(REFIT_VOLUME *Volume, CHAR16 **VolName) {
+ BOOLEAN MadeSubstitution = FALSE;
+ UINTN VolNum;
+
+ if ((VolName == NULL) || (*VolName == NULL))
+ return FALSE;
+
+ if ((StrLen(*VolName) > 2) && (*VolName[0] == L'f') && (*VolName[1] == L's') && (*VolName[2] >= L'0') && (*VolName[2] <= L'9')) {
+ VolNum = Atoi(*VolName + 2);
+ if (VolNum == Volume->VolNumber) {
+ MyFreePool(*VolName);
+ *VolName = StrDuplicate(Volume->VolName);
+ MadeSubstitution = TRUE;
+ } // if
+ } // if
+ return MadeSubstitution;
+} // BOOLEAN VolumeMatchesNumber()
+
// Implement FreePool the way it should have been done to begin with, so that
// it doesn't throw an ASSERT message if fed a NULL pointer....
VOID MyFreePool(IN VOID *Pointer) {
CHAR16 *FindNumbers(IN CHAR16 *InString);
CHAR16 *FindCommaDelimited(IN CHAR16 *InString, IN UINTN Index);
INTN FindSubString(IN CHAR16 *SmallString, IN CHAR16 *BigString);
-BOOLEAN IsIn(IN CHAR16 *SmallString, IN CHAR16 *List);
+VOID SplitPathName(CHAR16 *InPath, CHAR16 **VolName, CHAR16 **Path, CHAR16 **Filename);
+BOOLEAN IsIn(IN CHAR16 *Filename, IN CHAR16 *List);
+BOOLEAN FilenameIn(IN REFIT_VOLUME *Volume, IN CHAR16 *Directory, IN CHAR16 *Filename, IN CHAR16 *List);
+BOOLEAN VolumeNumberToName(REFIT_VOLUME *Volume, CHAR16 **VolName);
VOID MyFreePool(IN OUT VOID *Pointer);
BOOLEAN EjectMedia(VOID);
{
if (AboutMenu.EntryCount == 0) {
AboutMenu.TitleImage = BuiltinIcon(BUILTIN_ICON_FUNC_ABOUT);
- AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.7.6.2");
+ AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.7.6.3");
AddMenuInfoLine(&AboutMenu, L"");
AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2006-2010 Christoph Pfisterer");
AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2012-2013 Roderick W. Smith");
// eligible for scanning.
static BOOLEAN ShouldScan(REFIT_VOLUME *Volume, CHAR16 *Path) {
CHAR16 *VolName = NULL, *DontScanDir, *PathCopy = NULL;
- UINTN i = 0, VolNum;
+ UINTN i = 0;
BOOLEAN ScanIt = TRUE;
if (IsIn(Volume->VolName, GlobalConfig.DontScanVolumes))
// See if Path includes an explicit volume declaration that's NOT Volume....
PathCopy = StrDuplicate(Path);
if (SplitVolumeAndFilename(&PathCopy, &VolName)) {
- if (StriCmp(VolName, Volume->VolName) != 0) {
- if ((StrLen(VolName) > 2) && (VolName[0] == L'f') && (VolName[1] == L's') && (VolName[2] >= L'0') && (VolName[2] <= L'9')) {
- VolNum = Atoi(VolName + 2);
- if (VolNum != Volume->VolNumber) {
- ScanIt = FALSE;
- }
- } else {
- ScanIt = FALSE;
- }
+ VolumeNumberToName(Volume, &VolName);
+ if (VolName && StriCmp(VolName, Volume->VolName) != 0) {
+ ScanIt = FALSE;
} // if
} // if Path includes volume specification
MyFreePool(PathCopy);
while ((DontScanDir = FindCommaDelimited(GlobalConfig.DontScanDirs, i++)) && ScanIt) {
SplitVolumeAndFilename(&DontScanDir, &VolName);
CleanUpPathNameSlashes(DontScanDir);
+ VolumeNumberToName(Volume, &VolName);
if (VolName != NULL) {
if ((StriCmp(VolName, Volume->VolName) == 0) && (StriCmp(DontScanDir, Path) == 0))
ScanIt = FALSE;
- if ((StrLen(VolName) > 2) && (VolName[0] == L'f') && (VolName[1] == L's') && (VolName[2] >= L'0') && (VolName[2] <= L'9')) {
- VolNum = Atoi(VolName + 2);
- if ((VolNum == Volume->VolNumber) && (StriCmp(DontScanDir, Path) == 0))
- ScanIt = FALSE;
- }
} else {
if (StriCmp(DontScanDir, Path) == 0)
ScanIt = FALSE;
(StriCmp(DirEntry->FileName, FALLBACK_BASENAME) == 0 && (StriCmp(Path, L"EFI\\BOOT") == 0)) ||
StriSubCmp(L"shell", DirEntry->FileName) ||
IsSymbolicLink(Volume, Path, DirEntry) || /* is symbolic link */
- IsIn(DirEntry->FileName, GlobalConfig.DontScanFiles))
+ FilenameIn(Volume, Path, DirEntry->FileName, GlobalConfig.DontScanFiles))
continue; // skip this
if (Path)
EFI_STATUS Status;
REFIT_DIR_ITER EfiDirIter;
EFI_FILE_INFO *EfiDirEntry;
- CHAR16 FileName[256], *Directory, *MatchPatterns, *VolName = NULL, *SelfPath;
+ CHAR16 FileName[256], *Directory = NULL, *MatchPatterns, *VolName = NULL, *SelfPath;
UINTN i, Length;
BOOLEAN ScanFallbackLoader = TRUE;
BOOLEAN FoundBRBackup = FALSE;
// check for Mac OS X boot loader
if (ShouldScan(Volume, L"System\\Library\\CoreServices")) {
StrCpy(FileName, MACOSX_LOADER_PATH);
- if (FileExists(Volume->RootDir, FileName) && !IsIn(L"boot.efi", GlobalConfig.DontScanFiles)) {
+ if (FileExists(Volume->RootDir, FileName) && !FilenameIn(Volume, Directory, L"boot.efi", GlobalConfig.DontScanFiles)) {
AddLoaderEntry(FileName, L"Mac OS X", Volume);
if (DuplicatesFallback(Volume, FileName))
ScanFallbackLoader = FALSE;
// check for XOM
StrCpy(FileName, L"System\\Library\\CoreServices\\xom.efi");
- if (FileExists(Volume->RootDir, FileName) && !IsIn(L"boot.efi", GlobalConfig.DontScanFiles)) {
+ if (FileExists(Volume->RootDir, FileName) && !FilenameIn(Volume, Directory, L"boot.efi", GlobalConfig.DontScanFiles)) {
AddLoaderEntry(FileName, L"Windows XP (XoM)", Volume);
if (DuplicatesFallback(Volume, FileName))
ScanFallbackLoader = FALSE;
// check for Microsoft boot loader/menu
if (ShouldScan(Volume, L"EFI\\Microsoft\\Boot")) {
StrCpy(FileName, L"EFI\\Microsoft\\Boot\\bkpbootmgfw.efi");
- if (FileExists(Volume->RootDir, FileName) && !IsIn(L"bkpbootmgfw.efi", GlobalConfig.DontScanFiles)) {
+ if (FileExists(Volume->RootDir, FileName) && !FilenameIn(Volume, Directory, L"bkpbootmgfw.efi", GlobalConfig.DontScanFiles)) {
AddLoaderEntry(FileName, L"Microsoft EFI boot (Boot Repair backup)", Volume);
FoundBRBackup = TRUE;
if (DuplicatesFallback(Volume, FileName))
ScanFallbackLoader = FALSE;
}
StrCpy(FileName, L"EFI\\Microsoft\\Boot\\bootmgfw.efi");
- if (FileExists(Volume->RootDir, FileName) && !IsIn(L"bootmgfw.efi", GlobalConfig.DontScanFiles)) {
+ if (FileExists(Volume->RootDir, FileName) && !FilenameIn(Volume, Directory, L"bootmgfw.efi", GlobalConfig.DontScanFiles)) {
if (FoundBRBackup)
AddLoaderEntry(FileName, L"Supposed Microsoft EFI boot (probably GRUB)", Volume);
else