Fix a bug when use workaround for Legacy BIOS access limitation with GPT partition style

This commit is contained in:
longpanda 2021-01-08 20:08:32 +08:00
parent 44bb72ca0a
commit 7cdc7386a8
1 changed files with 18 additions and 5 deletions

View File

@ -1771,6 +1771,18 @@ int ventoy_check_device(grub_device_t dev)
}
if (workaround)
{
if (grub_strncmp(g_ventoy_part_info->Head.Signature, "EFI PART", 8) == 0)
{
ventoy_gpt_part_tbl *PartTbl = g_ventoy_part_info->PartTbl;
if (PartTbl[1].StartLBA != PartTbl[0].LastLBA + 1 ||
(PartTbl[1].LastLBA + 1 - PartTbl[1].StartLBA) != 65536)
{
grub_file_close(file);
return ventoy_check_device_result(6);
}
}
else
{
ventoy_part_table *PartTbl = g_ventoy_part_info->MBR.PartTbl;
if (PartTbl[1].StartSectorId != PartTbl[0].StartSectorId + PartTbl[0].SectorCount ||
@ -1780,6 +1792,7 @@ int ventoy_check_device(grub_device_t dev)
return ventoy_check_device_result(6);
}
}
}
else
{
offset = partition->start + partition->len;