]> code.delx.au - refind/commitdiff
rEFInd now weeds out non-BIOS-bootable NTFS volumes on Macs *IF* the
authorsrs5694 <srs5694@users.sourceforge.net>
Wed, 4 Feb 2015 14:57:22 +0000 (09:57 -0500)
committersrs5694 <srs5694@users.sourceforge.net>
Wed, 4 Feb 2015 14:57:22 +0000 (09:57 -0500)
NTFS driver is loaded, reducing clutter on multi-boot systems with
multiple NTFS volumes.

refind/lib.c
refind/main.c

index c6c5e3113ee24db96d6734720f40ecd88e8ed6a7..08550e26b2964f6d0df1cdd5d16d59ec18171267 100644 (file)
@@ -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)
index 5805685ae9ce2ca7f2a59ee57359472e49955f00..f474a3740f5e7712dda4819b4fd73fb50adc8758 100644 (file)
@@ -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");