#
#also_scan_dirs boot,EFI/linux/kernels
+# Directories that should NOT be scanned for boot loaders. By default,
+# rEFInd doesn't scan its own directory or the EFI/tools directory.
+# You can "blacklist" additional directories with this option, which
+# takes a list of directory names as options. You might do this to
+# keep EFI/boot/bootx64.efi out of the menu if that's a duplicate of
+# another boot loader or to exclude a directory that holds drivers
+# or non-bootloader utilities provided by a hardware manufacturer. If
+# a directory is listed both here and in also_scan_dirs, dont_scan_dirs
+# takes precedence.
+#
+#dont_scan_dirs EFI/boot,EFI/Dell
+
# Scan for Linux kernels that lack a ".efi" filename extension. This is
# useful for better integration with Linux distributions that provide
# kernels with EFI stub loaders but that don't give those kernels filenames
} // static VOID HandleString()
// Handle a parameter with a series of string arguments, to be added to a comma-delimited
-// list
+// list. Passes each token through the CleanUpPathNameSlashes() function to ensure
+// consistency in subsequent comparisons of filenames.
static VOID HandleStrings(IN CHAR16 **TokenList, IN UINTN TokenCount, OUT CHAR16 **Target) {
UINTN i;
FreePool(*Target);
*Target = NULL;
} // if
- for (i = 1; i < TokenCount; i++)
- MergeStrings(Target, TokenList[i], L',');
+ for (i = 1; i < TokenCount; i++) {
+ CleanUpPathNameSlashes(TokenList[i]);
+ MergeStrings(Target, TokenList[i], L',');
+ }
} // static VOID HandleStrings()
// read config file
} else if (StriCmp(TokenList[0], L"also_scan_dirs") == 0) {
HandleStrings(TokenList, TokenCount, &(GlobalConfig.AlsoScan));
+ } else if ((StriCmp(TokenList[0], L"don't_scan_dirs") == 0) || (StriCmp(TokenList[0], L"dont_scan_dirs") == 0)) {
+ HandleStrings(TokenList, TokenCount, &(GlobalConfig.DontScan));
+
} else if (StriCmp(TokenList[0], L"scan_driver_dirs") == 0) {
HandleStrings(TokenList, TokenCount, &(GlobalConfig.DriverDirs));
// Returns the directory portion of a pathname. For instance,
// if FullPath is 'EFI\foo\bar.efi', this function returns the
-// string 'EFI\foo'.
+// string 'EFI\foo'. The calling function is responsible for
+// freeing the returned string's memory.
CHAR16 *FindPath(IN CHAR16* FullPath) {
UINTN i, LastBackslash = 0;
CHAR16 *PathOnly;
return (FoundString);
} // CHAR16 *FindCommaDelimited()
+// 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).
+BOOLEAN IsIn(IN CHAR16 *SmallString, IN CHAR16 *List) {
+ UINTN i = 0;
+ BOOLEAN Found = FALSE;
+ CHAR16 *OneElement;
+
+ if (SmallString && List) {
+ while (!Found && (OneElement = FindCommaDelimited(List, i++))) {
+ if (StriCmp(OneElement, SmallString) == 0)
+ Found = TRUE;
+ } // while
+ } // if
+ return Found;
+} // BOOLEAN IsIn()
static EFI_GUID AppleRemovableMediaGuid = APPLE_REMOVABLE_MEDIA_PROTOCOL_GUID;
static REFIT_MENU_SCREEN MainMenu = { L"Main Menu", NULL, 0, NULL, 0, NULL, 0, L"Automatic boot" };
static REFIT_MENU_SCREEN AboutMenu = { L"About", NULL, 0, NULL, 0, NULL, 0, NULL };
-REFIT_CONFIG GlobalConfig = { FALSE, FALSE, 0, 0, 20, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+REFIT_CONFIG GlobalConfig = { FALSE, FALSE, 0, 0, 20, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
{TAG_SHELL, TAG_ABOUT, TAG_SHUTDOWN, TAG_REBOOT, 0, 0, 0, 0, 0 }};
// Structure used to hold boot loader filenames and time stamps in
{
if (AboutMenu.EntryCount == 0) {
AboutMenu.TitleImage = BuiltinIcon(BUILTIN_ICON_FUNC_ABOUT);
- AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.4.1");
+ AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.4.1.1");
AddMenuInfoLine(&AboutMenu, L"");
AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2006-2010 Christoph Pfisterer");
AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2012 Roderick W. Smith");
CHAR16 FileName[256], *Extension;
struct LOADER_LIST *LoaderList = NULL, *NewLoader;
- if (!SelfDirPath || !Path || ((StriCmp(Path, SelfDirPath) == 0) && Volume->DeviceHandle != SelfVolume->DeviceHandle) ||
- (StriCmp(Path, SelfDirPath) != 0)) {
+ if ((!SelfDirPath || !Path || ((StriCmp(Path, SelfDirPath) == 0) && Volume->DeviceHandle != SelfVolume->DeviceHandle) ||
+ (StriCmp(Path, SelfDirPath) != 0)) && (!IsIn(Path, GlobalConfig.DontScan))) {
// look through contents of the directory
DirIterOpen(Volume->RootDir, Path, &DirIter);
while (DirIterNext(&DirIter, 2, Pattern, &DirEntry)) {
if ((Volume->RootDir != NULL) && (Volume->VolName != NULL)) {
// check for Mac OS X boot loader
- StrCpy(FileName, MACOSX_LOADER_PATH);
- if (FileExists(Volume->RootDir, FileName)) {
- AddLoaderEntry(FileName, L"Mac OS X", Volume);
- }
+ if (!IsIn(L"System\\Library\\CoreServices", GlobalConfig.DontScan)) {
+ StrCpy(FileName, MACOSX_LOADER_PATH);
+ if (FileExists(Volume->RootDir, FileName)) {
+ AddLoaderEntry(FileName, L"Mac OS X", Volume);
+ }
- // check for XOM
- StrCpy(FileName, L"System\\Library\\CoreServices\\xom.efi");
- if (FileExists(Volume->RootDir, FileName)) {
- AddLoaderEntry(FileName, L"Windows XP (XoM)", Volume);
- }
+ // check for XOM
+ StrCpy(FileName, L"System\\Library\\CoreServices\\xom.efi");
+ if (FileExists(Volume->RootDir, FileName)) {
+ AddLoaderEntry(FileName, L"Windows XP (XoM)", Volume);
+ }
+ } // if Mac directory not in GlobalConfig.DontScan list
// check for Microsoft boot loader/menu
StrCpy(FileName, L"EFI\\Microsoft\\Boot\\Bootmgfw.efi");
- if (FileExists(Volume->RootDir, FileName)) {
+ if (FileExists(Volume->RootDir, FileName) && !IsIn(L"EFI\\Microsoft\\Boot", GlobalConfig.DontScan)) {
AddLoaderEntry(FileName, L"Microsoft EFI boot", Volume);
}