X-Git-Url: https://code.delx.au/refind/blobdiff_plain/4cbcc9d19f8bfa11a4bc396645c5689d4c6f9482..494f7ae2bbd05b26a4a1b3dc2b57120bb7025dd6:/refind/lib.c diff --git a/refind/lib.c b/refind/lib.c index 92abfd0..40c1814 100644 --- a/refind/lib.c +++ b/refind/lib.c @@ -853,23 +853,25 @@ static VOID SetPartGuidAndName(REFIT_VOLUME *Volume, EFI_DEVICE_PATH_PROTOCOL *D HARDDRIVE_DEVICE_PATH *HdDevicePath; GPT_ENTRY *PartInfo; - if ((Volume == NULL) || (DevicePath == NULL)) - return; + if ((Volume == NULL) || (DevicePath == NULL)) + return; - if ((DevicePath->Type == MEDIA_DEVICE_PATH) && (DevicePath->SubType == MEDIA_HARDDRIVE_DP)) { - HdDevicePath = (HARDDRIVE_DEVICE_PATH*) DevicePath; - if (HdDevicePath->SignatureType == SIGNATURE_TYPE_GUID) { - Volume->PartGuid = *((EFI_GUID*) HdDevicePath->Signature); - PartInfo = FindPartWithGuid(&(Volume->PartGuid)); - if (PartInfo) { - Volume->PartName = StrDuplicate(PartInfo->name); - CopyMem(&(Volume->PartTypeGuid), PartInfo->type_guid, sizeof(EFI_GUID)); - if (GuidsAreEqual (&(Volume->PartTypeGuid), &gFreedesktopRootGuid)) { - GlobalConfig.DiscoveredRoot = Volume; - } // if (GUIDs match) - } // if (PartInfo exists) - } // if (GPT disk) - } // if (disk device) + if ((DevicePath->Type == MEDIA_DEVICE_PATH) && (DevicePath->SubType == MEDIA_HARDDRIVE_DP)) { + HdDevicePath = (HARDDRIVE_DEVICE_PATH*) DevicePath; + if (HdDevicePath->SignatureType == SIGNATURE_TYPE_GUID) { + Volume->PartGuid = *((EFI_GUID*) HdDevicePath->Signature); + PartInfo = FindPartWithGuid(&(Volume->PartGuid)); + if (PartInfo) { + Volume->PartName = StrDuplicate(PartInfo->name); + CopyMem(&(Volume->PartTypeGuid), PartInfo->type_guid, sizeof(EFI_GUID)); + if (GuidsAreEqual(&(Volume->PartTypeGuid), &gFreedesktopRootGuid) && + ((PartInfo->attributes & GPT_NO_AUTOMOUNT) == 0)) { + GlobalConfig.DiscoveredRoot = Volume; + } // if (GUIDs match && automounting OK) + Volume->IsMarkedReadOnly = ((PartInfo->attributes & GPT_READ_ONLY) > 0); + } // if (PartInfo exists) + } // if (GPT disk) + } // if (disk device) } // VOID SetPartGuid() // Return TRUE if NTFS boot files are found or if Volume is unreadable,