]> code.delx.au - refind/blobdiff - refind/config.c
Fix memory management error; version 0.6.4 release.
[refind] / refind / config.c
index 2f314e8bf6dc40ba45de3b08f59d230971bb191b..12375c4868e04382d7009e5e4aac02b37a79df22 100644 (file)
@@ -341,12 +341,25 @@ VOID ReadConfig(CHAR16 *FileName)
     REFIT_FILE      File;
     CHAR16          **TokenList;
     CHAR16          *FlagName;
+    CHAR16          *SelfPath = NULL;
     UINTN           TokenCount, i;
 
     // Set a few defaults only if we're loading the default file.
     if (StriCmp(FileName, CONFIG_FILE_NAME) == 0) {
+       MyFreePool(GlobalConfig.AlsoScan);
+       GlobalConfig.AlsoScan = StrDuplicate(ALSO_SCAN_DIRS);
        MyFreePool(GlobalConfig.DontScanDirs);
-       GlobalConfig.DontScanDirs = StrDuplicate(SelfDirPath);
+       if (SelfVolume) {
+          if (SelfVolume->VolName) {
+             SelfPath = StrDuplicate(SelfVolume->VolName);
+          } else {
+             SelfPath = AllocateZeroPool(256 * sizeof(CHAR16));
+             if (SelfPath != NULL)
+                SPrint(SelfPath, 255, L"fs%d", SelfVolume->VolNumber);
+          } // if/else
+       }
+       MergeStrings(&SelfPath, SelfDirPath, L':');
+       GlobalConfig.DontScanDirs = SelfPath;
        MyFreePool(GlobalConfig.DontScanFiles);
        GlobalConfig.DontScanFiles = StrDuplicate(DONT_SCAN_FILES);
     }
@@ -409,6 +422,15 @@ VOID ReadConfig(CHAR16 *FileName)
         } else if (StriCmp(TokenList[0], L"also_scan_dirs") == 0) {
             HandleStrings(TokenList, TokenCount, &(GlobalConfig.AlsoScan));
 
+        } else if ((StriCmp(TokenList[0], L"don't_scan_volumes") == 0) || (StriCmp(TokenList[0], L"dont_scan_volumes") == 0)) {
+           HandleStrings(TokenList, TokenCount, &(GlobalConfig.AlsoScan));
+           // Note: Don't use HandleStrings() because it modifies slashes, which might be present in volume name
+           MyFreePool(GlobalConfig.DontScanVolumes);
+           GlobalConfig.DontScanVolumes = NULL;
+           for (i = 1; i < TokenCount; i++) {
+              MergeStrings(&GlobalConfig.DontScanVolumes, TokenList[i], L',');
+           }
+
         } else if ((StriCmp(TokenList[0], L"don't_scan_dirs") == 0) || (StriCmp(TokenList[0], L"dont_scan_dirs") == 0)) {
             HandleStrings(TokenList, TokenCount, &(GlobalConfig.DontScanDirs));
 
@@ -716,7 +738,6 @@ VOID ScanUserConfigured(VOID)
    CHAR16            *Title = NULL;
    UINTN             TokenCount, size;
    LOADER_ENTRY      *Entry;
-//   REFIT_MENU_SCREEN  *SubScreen;
 
    if (FileExists(SelfDir, CONFIG_FILE_NAME)) {
       Status = ReadFile(SelfDir, CONFIG_FILE_NAME, &File, &size);