Skip to content

Commit

Permalink
Fix a bug when use workaround for Legacy BIOS access limitation with …
Browse files Browse the repository at this point in the history
…GPT partition style
  • Loading branch information
ventoy committed Jan 8, 2021
1 parent 44bb72c commit 7cdc738
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy.c
Original file line number Diff line number Diff line change
Expand Up @@ -1772,12 +1772,25 @@ int ventoy_check_device(grub_device_t dev)

if (workaround)
{
ventoy_part_table *PartTbl = g_ventoy_part_info->MBR.PartTbl;
if (PartTbl[1].StartSectorId != PartTbl[0].StartSectorId + PartTbl[0].SectorCount ||
PartTbl[1].SectorCount != 65536)
if (grub_strncmp(g_ventoy_part_info->Head.Signature, "EFI PART", 8) == 0)
{
grub_file_close(file);
return ventoy_check_device_result(6);
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 ||
PartTbl[1].SectorCount != 65536)
{
grub_file_close(file);
return ventoy_check_device_result(6);
}
}
}
else
Expand Down

0 comments on commit 7cdc738

Please sign in to comment.