From 5f6ffecff58565798170ae97535c57ede91cda8b Mon Sep 17 00:00:00 2001 From: srs5694 Date: Wed, 4 Feb 2015 09:57:22 -0500 Subject: [PATCH] rEFInd now weeds out non-BIOS-bootable NTFS volumes on Macs *IF* the NTFS driver is loaded, reducing clutter on multi-boot systems with multiple NTFS volumes. --- refind/lib.c | 18 +++++++++++++++++- refind/main.c | 2 +- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/refind/lib.c b/refind/lib.c index c6c5e31..08550e2 100644 --- a/refind/lib.c +++ b/refind/lib.c @@ -851,6 +851,20 @@ static VOID SetPartGuidAndName(REFIT_VOLUME *Volume, EFI_DEVICE_PATH_PROTOCOL *D } // if } // VOID SetPartGuid() +// Return TRUE if NTFS boot files are found, FALSE otherwise. +// Assumes Volume is already mounted. +static BOOLEAN HasWindowsBiosBootFiles(REFIT_VOLUME *Volume) { + BOOLEAN FilesFound = TRUE; + + if (Volume->RootDir != NULL) { + FilesFound = (FileExists(Volume->RootDir, L"NTLDR") && // Windows XP boot files + FileExists(Volume->RootDir, L"ntdetect.com") && + FileExists(Volume->RootDir, L"boot.ini")) || + FileExists(Volume->RootDir, L"Windows"); // Windows 7 ID (imperfect; TODO: Improve) + } // if + return FilesFound; +} // static VOID HasWindowsBiosBootFiles() + VOID ScanVolume(REFIT_VOLUME *Volume) { EFI_STATUS Status; @@ -977,7 +991,9 @@ VOID ScanVolume(REFIT_VOLUME *Volume) return; } else { Volume->IsReadable = TRUE; - } + if ((Volume->FSType == FS_TYPE_NTFS) && Volume->HasBootCode) + Volume->HasBootCode = HasWindowsBiosBootFiles(Volume); + } // if/else // get custom volume icons if present if (!Volume->VolIconImage) diff --git a/refind/main.c b/refind/main.c index 5805685..f474a37 100644 --- a/refind/main.c +++ b/refind/main.c @@ -166,7 +166,7 @@ static VOID AboutrEFInd(VOID) if (AboutMenu.EntryCount == 0) { AboutMenu.TitleImage = BuiltinIcon(BUILTIN_ICON_FUNC_ABOUT); - AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.8.5.5"); + AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.8.5.6"); AddMenuInfoLine(&AboutMenu, L""); AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2006-2010 Christoph Pfisterer"); AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2012-2015 Roderick W. Smith"); -- 2.39.2