]> code.delx.au - refind/blobdiff - refind/lib.c
Fixed refind-install bug that could cause mountesp script to be
[refind] / refind / lib.c
index 5bc1828bd9401cda06c9b89e544333f887d919e8..f38ac64d2706618077c519efe218757a999ea2da 100644 (file)
@@ -998,9 +998,6 @@ VOID ScanVolume(REFIT_VOLUME *Volume)
    // open the root directory of the volume
    Volume->RootDir = LibOpenRoot(Volume->DeviceHandle);
 
-   // Set volume icon based on .VolumeBadge icon or disk kind
-   SetVolumeBadgeIcon(Volume);
-
    Volume->VolName = GetVolumeName(Volume);
 
    if (Volume->RootDir == NULL) {
@@ -1015,10 +1012,6 @@ VOID ScanVolume(REFIT_VOLUME *Volume)
       }
    } // if/else
 
-   // get custom volume icons if present
-   if (!Volume->VolIconImage) {
-      Volume->VolIconImage = egLoadIconAnyType(Volume->RootDir, L"", L".VolumeIcon", GlobalConfig.IconSizes[ICON_SIZE_BIG]);
-   }
 } // ScanVolume()
 
 static VOID ScanExtendedPartition(REFIT_VOLUME *WholeDiskVolume, MBR_PARTITION_INFO *MbrEntry)
@@ -1101,12 +1094,12 @@ VOID ScanVolumes(VOID)
 
     // get all filesystem handles
     Status = LibLocateHandle(ByProtocol, &BlockIoProtocol, NULL, &HandleCount, &Handles);
-    UuidList = AllocateZeroPool(sizeof(EFI_GUID) * HandleCount);
     if (Status == EFI_NOT_FOUND) {
         return;  // no filesystems. strange, but true...
     }
     if (CheckError(Status, L"while listing all file systems"))
         return;
+    UuidList = AllocateZeroPool(sizeof(EFI_GUID) * HandleCount);
 
     // first pass: collect information about all handles
     for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++) {
@@ -1212,6 +1205,23 @@ VOID ScanVolumes(VOID)
     } // for
 } /* VOID ScanVolumes() */
 
+VOID SetVolumeIcons(VOID) {
+    UINTN        VolumeIndex;
+    REFIT_VOLUME *Volume;
+
+    for (VolumeIndex = 0; VolumeIndex < VolumesCount; VolumeIndex++) {
+        Volume = Volumes[VolumeIndex];
+        // Set volume icon based on .VolumeBadge icon or disk kind
+        SetVolumeBadgeIcon(Volume);
+        if (Volumes[VolumeIndex]->DiskKind == DISK_KIND_INTERNAL) {
+            // get custom volume icons if present
+            if (!Volume->VolIconImage) {
+                Volume->VolIconImage = egLoadIconAnyType(Volume->RootDir, L"", L".VolumeIcon", GlobalConfig.IconSizes[ICON_SIZE_BIG]);
+            }
+        }
+    } // for
+} // VOID SetVolumeIcons()
+
 //
 // file and dir functions
 //