]> code.delx.au - refind/blobdiff - refind/main.c
Improved GPT support; uses CRCs to minimize the risk of damaged data wreaking
[refind] / refind / main.c
index 8b2412d2a8b0224023aa06a37d67789460896696..64fe8985c310f91a51b4ecfd8dcd9b3c5823c56b 100644 (file)
@@ -49,6 +49,7 @@
 #include "icns.h"
 #include "menu.h"
 #include "mok.h"
+#include "gpt.h"
 #include "security_policy.h"
 #include "../include/Handle.h"
 #include "../include/refit_call_wrapper.h"
@@ -143,6 +144,8 @@ REFIT_CONFIG GlobalConfig = { FALSE, FALSE, 0, 0, 0, DONT_CHANGE_TEXT_MODE, 20,
 
 EFI_GUID GlobalGuid = EFI_GLOBAL_VARIABLE;
 
+GPT_DATA *gPartitions = NULL;
+
 // Structure used to hold boot loader filenames and time stamps in
 // a linked list; used to sort entries within a directory.
 struct LOADER_LIST {
@@ -159,7 +162,7 @@ static VOID AboutrEFInd(VOID)
 {
     if (AboutMenu.EntryCount == 0) {
         AboutMenu.TitleImage = BuiltinIcon(BUILTIN_ICON_FUNC_ABOUT);
-        AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.7.8.6");
+        AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.7.9.4");
         AddMenuInfoLine(&AboutMenu, L"");
         AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2006-2010 Christoph Pfisterer");
         AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2012-2014 Roderick W. Smith");
@@ -1110,7 +1113,7 @@ static BOOLEAN ShouldScan(REFIT_VOLUME *Volume, CHAR16 *Path) {
    VolName = NULL;
 
    // See if Volume is in GlobalConfig.DontScanDirs....
-   while ((DontScanDir = FindCommaDelimited(GlobalConfig.DontScanDirs, i++)) && ScanIt) {
+   while (ScanIt && (DontScanDir = FindCommaDelimited(GlobalConfig.DontScanDirs, i++))) {
       SplitVolumeAndFilename(&DontScanDir, &VolName);
       CleanUpPathNameSlashes(DontScanDir);
       VolumeNumberToName(Volume, &VolName);
@@ -1124,6 +1127,7 @@ static BOOLEAN ShouldScan(REFIT_VOLUME *Volume, CHAR16 *Path) {
       MyFreePool(DontScanDir);
       MyFreePool(VolName);
       DontScanDir = NULL;
+      VolName = NULL;
    } // while()
 
    return ScanIt;
@@ -1328,11 +1332,11 @@ static VOID ScanEfiFiles(REFIT_VOLUME *Volume) {
    BOOLEAN                 ScanFallbackLoader = TRUE;
    BOOLEAN                 FoundBRBackup = FALSE;
 
-   MatchPatterns = StrDuplicate(LOADER_MATCH_PATTERNS);
-   if (GlobalConfig.ScanAllLinux)
-      MergeStrings(&MatchPatterns, LINUX_MATCH_PATTERNS, L',');
-
    if ((Volume->RootDir != NULL) && (Volume->VolName != NULL) && (Volume->IsReadable)) {
+      MatchPatterns = StrDuplicate(LOADER_MATCH_PATTERNS);
+      if (GlobalConfig.ScanAllLinux)
+         MergeStrings(&MatchPatterns, LINUX_MATCH_PATTERNS, L',');
+
       // check for Mac OS X boot loader
       if (ShouldScan(Volume, L"System\\Library\\CoreServices")) {
          StrCpy(FileName, MACOSX_LOADER_PATH);
@@ -2187,7 +2191,7 @@ static VOID ScanForBootloaders(VOID) {
 //       PauseForKey();
 //    }
 
-   ScanVolumes();
+//   ScanVolumes();
 
    // scan for loaders and tools, add them to the menu
    for (i = 0; i < NUM_SCAN_OPTIONS; i++) {
@@ -2508,7 +2512,7 @@ efi_main (EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
        CopyMem(GlobalConfig.ScanFor, "ihebocm   ", NUM_SCAN_OPTIONS);
     SetConfigFilename(ImageHandle);
     ReadConfig(GlobalConfig.ConfigFilename);
-    ScanVolumes();
+//    ScanVolumes();
 
     InitScreen();
     WarnIfLegacyProblems();
@@ -2520,6 +2524,7 @@ efi_main (EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
     // further bootstrap (now with config available)
     MokProtocol = SecureBootSetup();
     LoadDrivers();
+    ScanVolumes();
     ScanForBootloaders();
     ScanForTools();
     SetupScreen();