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, 20, 0, 0, NULL, NULL, NULL, NULL,
+REFIT_CONFIG GlobalConfig = { FALSE, 20, 0, 0, NULL, NULL, NULL, NULL, NULL,
{TAG_SHELL, TAG_ABOUT, TAG_SHUTDOWN, TAG_REBOOT, 0, 0, 0, 0, 0 }};
//
{
if (AboutMenu.EntryCount == 0) {
AboutMenu.TitleImage = BuiltinIcon(BUILTIN_ICON_FUNC_ABOUT);
- AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.2.5.2");
+ AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.2.6.1");
AddMenuInfoLine(&AboutMenu, L"");
AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2006-2010 Christoph Pfisterer");
AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2012 Roderick W. Smith");
LOADER_ENTRY * AddLoaderEntry(IN CHAR16 *LoaderPath, IN CHAR16 *LoaderTitle, IN REFIT_VOLUME *Volume) {
LOADER_ENTRY *Entry;
+ CleanUpPathNameSlashes(LoaderPath);
Entry = InitializeLoaderEntry(NULL);
if (Entry != NULL) {
Entry->Title = StrDuplicate(LoaderTitle);
EFI_STATUS Status;
REFIT_DIR_ITER DirIter;
EFI_FILE_INFO *DirEntry;
- CHAR16 FileName[256];
+ CHAR16 FileName[256], *SelfPath;
+ UINTN i = 0;
+
+ // Skip past leading slashes, which are sometimes (but not always) included
+ // in SelfDirPath, to get a path that's known to never include this feature.
+ while ((SelfDirPath != NULL) && (SelfDirPath[i] == L'\\')) {
+ i++;
+ }
+ SelfPath = &SelfDirPath[i]; // NOTE: *DO NOT* call FreePool() on SelfPath!!!
- // Note: SelfDirPath includes a leading backslash ('\'), but Path
- // doesn't, so we rejigger the string to compensate....
- if (!SelfDirPath || !Path || ((StriCmp(Path, &SelfDirPath[1]) == 0) && Volume != SelfVolume) ||
- (StriCmp(Path, &SelfDirPath[1]) != 0)) {
+ if (!SelfPath || !Path || ((StriCmp(Path, SelfPath) == 0) && Volume != SelfVolume) ||
+ (StriCmp(Path, SelfPath) != 0)) {
// look through contents of the directory
DirIterOpen(Volume->RootDir, Path, &DirIter);
while (DirIterNext(&DirIter, 2, L"*.efi", &DirEntry)) {
SPrint(FileName, 255, L"\\%s\\%s", Path, DirEntry->FileName);
else
SPrint(FileName, 255, L"\\%s", DirEntry->FileName);
- // TODO: Sort loader entries by date/time, most recent first
AddLoaderEntry(FileName, NULL, Volume);
- } // while()
+ }
Status = DirIterClose(&DirIter);
if (Status != EFI_NOT_FOUND) {
if (Path)
EFI_STATUS Status;
REFIT_DIR_ITER EfiDirIter;
EFI_FILE_INFO *EfiDirEntry;
- CHAR16 FileName[256];
+ CHAR16 FileName[256], *Directory;
+ UINTN i, Length;
if ((Volume->RootDir != NULL) && (Volume->VolName != NULL)) {
// check for Mac OS X boot loader
// scan the root directory for EFI executables
ScanLoaderDir(Volume, NULL);
- // scan the elilo directory (as used on gimli's first Live CD)
- ScanLoaderDir(Volume, L"elilo");
- // scan the boot directory
- ScanLoaderDir(Volume, L"boot");
// scan subdirectories of the EFI directory (as per the standard)
DirIterOpen(Volume->RootDir, L"EFI", &EfiDirIter);
Status = DirIterClose(&EfiDirIter);
if (Status != EFI_NOT_FOUND)
CheckError(Status, L"while scanning the EFI directory");
+
+ // Scan user-specified (or additional default) directories....
+ i = 0;
+ while ((Directory = FindCommaDelimited(GlobalConfig.AlsoScan, i++)) != NULL) {
+ Length = StrLen(Directory);
+ // Some EFI implementations won't read a directory if the path ends in
+ // a backslash, so eliminate this character, if it's present....
+ while ((Length > 0) && (Directory[Length - 1] == L'\\')) {
+ Directory[--Length] = 0;
+ } // while
+ if (Length > 0)
+ ScanLoaderDir(Volume, Directory);
+ FreePool(Directory);
+ } // while
} // if
} // static VOID ScanEfiFiles()