From: longpanda Date: Tue, 26 Apr 2022 06:49:07 +0000 (+0800) Subject: Fix a bug for Linux GUI program when update from old release. (#1590) X-Git-Tag: v1.0.74~5 X-Git-Url: https://glassweightruler.freedombox.rocks/gitweb/Ventoy.git/commitdiff_plain/9e2e4ec0a972fdbfe4edff46077061f82aaada99 Fix a bug for Linux GUI program when update from old release. (#1590) --- diff --git a/INSTALL/tool/aarch64/V2DServer b/INSTALL/tool/aarch64/V2DServer index f4e4873..03ce643 100644 Binary files a/INSTALL/tool/aarch64/V2DServer and b/INSTALL/tool/aarch64/V2DServer differ diff --git a/INSTALL/tool/aarch64/Ventoy2Disk.gtk3 b/INSTALL/tool/aarch64/Ventoy2Disk.gtk3 index db03db5..e42d624 100644 Binary files a/INSTALL/tool/aarch64/Ventoy2Disk.gtk3 and b/INSTALL/tool/aarch64/Ventoy2Disk.gtk3 differ diff --git a/INSTALL/tool/aarch64/Ventoy2Disk.qt5 b/INSTALL/tool/aarch64/Ventoy2Disk.qt5 index 4b84939..009a187 100644 Binary files a/INSTALL/tool/aarch64/Ventoy2Disk.qt5 and b/INSTALL/tool/aarch64/Ventoy2Disk.qt5 differ diff --git a/INSTALL/tool/i386/V2DServer b/INSTALL/tool/i386/V2DServer index fe154ac..deb1033 100644 Binary files a/INSTALL/tool/i386/V2DServer and b/INSTALL/tool/i386/V2DServer differ diff --git a/INSTALL/tool/i386/Ventoy2Disk.gtk2 b/INSTALL/tool/i386/Ventoy2Disk.gtk2 index f7317c5..774f5d3 100644 Binary files a/INSTALL/tool/i386/Ventoy2Disk.gtk2 and b/INSTALL/tool/i386/Ventoy2Disk.gtk2 differ diff --git a/INSTALL/tool/i386/Ventoy2Disk.gtk3 b/INSTALL/tool/i386/Ventoy2Disk.gtk3 index 938d680..6116798 100644 Binary files a/INSTALL/tool/i386/Ventoy2Disk.gtk3 and b/INSTALL/tool/i386/Ventoy2Disk.gtk3 differ diff --git a/INSTALL/tool/i386/Ventoy2Disk.qt5 b/INSTALL/tool/i386/Ventoy2Disk.qt5 index e46494e..b1c226d 100644 Binary files a/INSTALL/tool/i386/Ventoy2Disk.qt5 and b/INSTALL/tool/i386/Ventoy2Disk.qt5 differ diff --git a/INSTALL/tool/mips64el/V2DServer b/INSTALL/tool/mips64el/V2DServer index 14be9ac..38eca27 100644 Binary files a/INSTALL/tool/mips64el/V2DServer and b/INSTALL/tool/mips64el/V2DServer differ diff --git a/INSTALL/tool/mips64el/Ventoy2Disk.gtk3 b/INSTALL/tool/mips64el/Ventoy2Disk.gtk3 index 540a93b..83ced17 100644 Binary files a/INSTALL/tool/mips64el/Ventoy2Disk.gtk3 and b/INSTALL/tool/mips64el/Ventoy2Disk.gtk3 differ diff --git a/INSTALL/tool/mips64el/Ventoy2Disk.qt5 b/INSTALL/tool/mips64el/Ventoy2Disk.qt5 index 03cc6bf..d3c827e 100644 Binary files a/INSTALL/tool/mips64el/Ventoy2Disk.qt5 and b/INSTALL/tool/mips64el/Ventoy2Disk.qt5 differ diff --git a/INSTALL/tool/x86_64/V2DServer b/INSTALL/tool/x86_64/V2DServer index 492a0e9..0bd0a4e 100644 Binary files a/INSTALL/tool/x86_64/V2DServer and b/INSTALL/tool/x86_64/V2DServer differ diff --git a/INSTALL/tool/x86_64/Ventoy2Disk.gtk2 b/INSTALL/tool/x86_64/Ventoy2Disk.gtk2 index 7180adc..20ca6b3 100644 Binary files a/INSTALL/tool/x86_64/Ventoy2Disk.gtk2 and b/INSTALL/tool/x86_64/Ventoy2Disk.gtk2 differ diff --git a/INSTALL/tool/x86_64/Ventoy2Disk.gtk3 b/INSTALL/tool/x86_64/Ventoy2Disk.gtk3 index 8e4b114..4d41ef2 100644 Binary files a/INSTALL/tool/x86_64/Ventoy2Disk.gtk3 and b/INSTALL/tool/x86_64/Ventoy2Disk.gtk3 differ diff --git a/INSTALL/tool/x86_64/Ventoy2Disk.qt5 b/INSTALL/tool/x86_64/Ventoy2Disk.qt5 index 3bef337..40beccc 100644 Binary files a/INSTALL/tool/x86_64/Ventoy2Disk.qt5 and b/INSTALL/tool/x86_64/Ventoy2Disk.qt5 differ diff --git a/LinuxGUI/Ventoy2Disk/Web/ventoy_http.c b/LinuxGUI/Ventoy2Disk/Web/ventoy_http.c index 3113157..8344b05 100644 --- a/LinuxGUI/Ventoy2Disk/Web/ventoy_http.c +++ b/LinuxGUI/Ventoy2Disk/Web/ventoy_http.c @@ -685,6 +685,7 @@ static int ventoy_write_gpt_part_table(int fd, uint64_t disksize, VTOY_GPT_INFO static void * ventoy_update_thread(void *data) { int fd; + int updateMBR; ssize_t len; off_t offset; MBR_HEAD MBR; @@ -742,17 +743,32 @@ static void * ventoy_update_thread(void *data) len = write(fd, disk->vtoydata.rsvdata, sizeof(disk->vtoydata.rsvdata)); vlog("Writing reserve data offset:%llu len:%llu ...\n", (_ull)offset, (_ull)len); + updateMBR = 0; memcpy(&MBR, &(disk->vtoydata.gptinfo.MBR), 512); + if (disk->vtoydata.partition_style == 0 && MBR.PartTbl[0].Active == 0) { MBR.PartTbl[0].Active = 0x80; MBR.PartTbl[1].Active = 0; MBR.PartTbl[2].Active = 0; MBR.PartTbl[3].Active = 0; - + updateMBR = 1; + vlog("set MBR partition 1 active flag enabled\n"); + } + + if (MBR.BootCode[0x190] != 0x56 || MBR.BootCode[0x191] != 0x54) + { + vlog("set VT data %02x %02x\n", MBR.BootCode[0x190], MBR.BootCode[0x191]); + MBR.BootCode[0x190] = 0x56; + MBR.BootCode[0x191] = 0x54; + updateMBR = 1; + } + + if (updateMBR) + { offset = lseek(fd, 0, SEEK_SET); len = write(fd, &MBR, 512); - vlog("set MBR partition 1 active flag enabled offset:%llu len:%llu\n", (_ull)offset, (_ull)len); + vlog("update MBR offset:%llu len:%llu\n", (_ull)offset, (_ull)len); } g_current_progress = PT_SYNC_DATA1;