]> glassweightruler.freedombox.rocks Git - Ventoy.git/blobdiff - LinuxGUI/Ventoy2Disk/Core/ventoy_util.c
Fix a bug for Linux GUI program when update from old release. (#1590)
[Ventoy.git] / LinuxGUI / Ventoy2Disk / Core / ventoy_util.c
index d15a4191712827b7f78dd5111c76edb74de1b4e8..27c015fb0d35ae8ff11fcaaa4854bfdb0b52ae1c 100644 (file)
@@ -299,6 +299,7 @@ static int VentoyFillProtectMBR(uint64_t DiskSizeBytes, MBR_HEAD *pMBR)
     vdebug("Disk signature: 0x%08x\n", DiskSignature);
 
     memcpy(pMBR->BootCode + 0x1B8, &DiskSignature, 4);
+    memcpy(pMBR->BootCode + 0x180, &Guid, 16);
 
     DiskSectorCount = DiskSizeBytes / 512 - 1;
     if (DiskSectorCount > 0xFFFFFFFF)
@@ -412,7 +413,7 @@ int ventoy_fill_gpt(uint64_t size, uint64_t reserve, int align4k, VTOY_GPT_INFO
     ventoy_gen_preudo_uuid(&(Table[1].PartGuid));
     Table[1].StartLBA = Table[0].LastLBA + 1;
     Table[1].LastLBA = Table[1].StartLBA + VTOYEFI_PART_BYTES / 512 - 1;
-    Table[1].Attr = 0x8000000000000001ULL;
+    Table[1].Attr = 0xC000000000000001ULL;
     ventoy_fill_gpt_partname(Table[1].Name, "VTOYEFI");
 
 #if 0
@@ -490,6 +491,7 @@ int ventoy_fill_mbr(uint64_t size, uint64_t reserve, int align4k, MBR_HEAD *pMBR
     vdebug("Disk signature: 0x%08x\n", DiskSignature);
 
     memcpy(pMBR->BootCode + 0x1B8, &DiskSignature, 4);
+    memcpy(pMBR->BootCode + 0x180, &Guid, 16);
 
     if (size / 512 > 0xFFFFFFFF)
     {