mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[iso] work around ISOs that use broken symbolic links for UEFI bootloaders
* Per linuxmint/linuxmint#622 some ISOs may have a /EFI/boot/bootx64.efi that
is a symbolic to a nonexisting file.
* This is originally due to a Debian bug that was fixed in:
5bff71fea2
* Work around this by trying to extract a working bootx64.efi from the El-Torito image.
* Also improve DumpFatDir() to not replace already existing files.
This commit is contained in:
parent
ae6732c07b
commit
710bfe7f4d
3 changed files with 29 additions and 9 deletions
26
src/iso.c
26
src/iso.c
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Rufus: The Reliable USB Formatting Utility
|
||||
* ISO file extraction
|
||||
* Copyright © 2011-2023 Pete Batard <pete@akeo.ie>
|
||||
* Copyright © 2011-2024 Pete Batard <pete@akeo.ie>
|
||||
* Based on libcdio's iso & udf samples:
|
||||
* Copyright © 2003-2014 Rocky Bernstein <rocky@gnu.org>
|
||||
*
|
||||
|
@ -292,6 +292,16 @@ static BOOL check_iso_props(const char* psz_dirname, int64_t file_length, const
|
|||
}
|
||||
}
|
||||
}
|
||||
// Linux Mint Edge 21.2/Mint 21.3 have an invalid /EFI/boot/bootx64.efi
|
||||
// because it's a symbolic link to a file that does not exist on the media.
|
||||
// This is originally due to a Debian bug that was fixed in:
|
||||
// https://salsa.debian.org/live-team/live-build/-/commit/5bff71fea2dd54adcd6c428d3f1981734079a2f7
|
||||
// Because of this, if we detect a small bootx64.efi file, we assert that it's a
|
||||
// broken link and try to extract a "good" version from the El-Torito image.
|
||||
if ((safe_stricmp(psz_basename, efi_bootname[2]) == 0) && (file_length < 100)) {
|
||||
img_report.has_efi |= 0x4000;
|
||||
static_strcpy(img_report.efi_img_path, "[BOOT]/1-Boot-NoEmul.img");
|
||||
}
|
||||
}
|
||||
|
||||
if (psz_dirname != NULL) {
|
||||
|
@ -1277,8 +1287,16 @@ out:
|
|||
SendMessage(hMainDialog, UM_PROGRESS_EXIT, 0, 0);
|
||||
} else {
|
||||
// Solus and other ISOs only provide EFI boot files in a FAT efi.img
|
||||
if (img_report.has_efi == 0x8000)
|
||||
// Also work around ISOs that have a borked symbolic link for bootx64.efi.
|
||||
// See https://github.com/linuxmint/linuxmint/issues/622.
|
||||
if (img_report.has_efi & 0xc000) {
|
||||
if (img_report.has_efi & 0x4000) {
|
||||
uprintf("Broken UEFI bootloader detected - Applying workaround:");
|
||||
static_sprintf(path, "%s\\EFI\\boot\\bootx64.efi", dest_dir);
|
||||
DeleteFileU(path);
|
||||
}
|
||||
DumpFatDir(dest_dir, 0);
|
||||
}
|
||||
if (HAS_SYSLINUX(img_report)) {
|
||||
static_sprintf(path, "%s\\syslinux.cfg", dest_dir);
|
||||
// Create a /syslinux.cfg (if none exists) that points to the existing isolinux cfg
|
||||
|
@ -1463,6 +1481,8 @@ try_iso:
|
|||
|
||||
out:
|
||||
safe_closehandle(file_handle);
|
||||
if (r == 0)
|
||||
DeleteFileU(dest_file);
|
||||
iso9660_stat_free(p_statbuf);
|
||||
udf_dirent_free(p_udf_root);
|
||||
udf_dirent_free(p_udf_file);
|
||||
|
@ -1727,7 +1747,7 @@ BOOL DumpFatDir(const char* path, int32_t cluster)
|
|||
}
|
||||
if (!DumpFatDir(target, dirpos.cluster))
|
||||
goto out;
|
||||
} else {
|
||||
} else if (!PathFileExistsU(target)) {
|
||||
// Need to figure out if it's a .conf file (Damn you Solus!!)
|
||||
EXTRACT_PROPS props = { 0 };
|
||||
size_t len = strlen(name);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Rufus: The Reliable USB Formatting Utility
|
||||
* Copyright © 2011-2023 Pete Batard <pete@akeo.ie>
|
||||
* Copyright © 2011-2024 Pete Batard <pete@akeo.ie>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
10
src/rufus.rc
10
src/rufus.rc
|
@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
|||
IDD_DIALOG DIALOGEX 12, 12, 232, 326
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
EXSTYLE WS_EX_ACCEPTFILES
|
||||
CAPTION "Rufus 4.4.2100"
|
||||
CAPTION "Rufus 4.4.2101"
|
||||
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
|
||||
BEGIN
|
||||
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
|
||||
|
@ -392,8 +392,8 @@ END
|
|||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 4,4,2100,0
|
||||
PRODUCTVERSION 4,4,2100,0
|
||||
FILEVERSION 4,4,2101,0
|
||||
PRODUCTVERSION 4,4,2101,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
@ -411,13 +411,13 @@ BEGIN
|
|||
VALUE "Comments", "https://rufus.ie"
|
||||
VALUE "CompanyName", "Akeo Consulting"
|
||||
VALUE "FileDescription", "Rufus"
|
||||
VALUE "FileVersion", "4.4.2100"
|
||||
VALUE "FileVersion", "4.4.2101"
|
||||
VALUE "InternalName", "Rufus"
|
||||
VALUE "LegalCopyright", "© 2011-2024 Pete Batard (GPL v3)"
|
||||
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
|
||||
VALUE "OriginalFilename", "rufus-4.4.exe"
|
||||
VALUE "ProductName", "Rufus"
|
||||
VALUE "ProductVersion", "4.4.2100"
|
||||
VALUE "ProductVersion", "4.4.2101"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
|
Loading…
Reference in a new issue