From 97315a238deeb3d446d475cac567483180c7b8d5 Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Fri, 14 Sep 2018 14:10:40 +0100 Subject: [PATCH] [togo] fix bcdboot invocation for ISOs that aren't dual BIOS and UEFI * Closes #1111 --- ChangeLog.txt | 3 ++- src/format.c | 5 +++-- src/iso.c | 6 +++++- src/rufus.c | 3 ++- src/rufus.h | 5 ++++- src/rufus.rc | 10 +++++----- 6 files changed, 21 insertions(+), 11 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 90c9a69c..025cde9f 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,5 +1,6 @@ -o Version 3.2 (2018.09.??) [BUGFIX RELEASE] +o Version 3.3 (2018.09.??) [BUGFIX RELEASE] Fix a regression when processing uncompressed bootable DD images + Fix Windows To Go drive creation for ARM64 Windows ISOs o Version 3.2 (2018.09.11) Add RSA-2048 signature validation on all the server downloads diff --git a/src/format.c b/src/format.c index 52e75a65..3a0ee992 100644 --- a/src/format.c +++ b/src/format.c @@ -1479,8 +1479,9 @@ static BOOL SetupWinToGo(const char* drive_name, BOOL use_ms_efi) // Also, since Rufus should (usually) be running as a 32 bit app, on 64 bit systems, we need to use // 'C:\Windows\Sysnative' and not 'C:\Windows\System32' to invoke bcdboot, as 'C:\Windows\System32' // will get converted to 'C:\Windows\SysWOW64' behind the scenes, and there is no bcdboot.exe there. - static_sprintf(cmd, "%s\\bcdboot.exe %s\\Windows /v /f ALL /s %s", sysnative_dir, - drive_name, (use_ms_efi)?ms_efi:drive_name); + static_sprintf(cmd, "%s\\bcdboot.exe %s\\Windows /v /f %s /s %s", sysnative_dir, drive_name, + HAS_BOOTMGR_BIOS(img_report) ? (HAS_BOOTMGR_EFI(img_report) ? "ALL" : "BIOS") : "UEFI", + (use_ms_efi)?ms_efi:drive_name); uprintf("Enabling boot using command '%s'", cmd); if (RunCommand(cmd, sysnative_dir, usb_debug) != 0) { // Try to continue... but report a failure diff --git a/src/iso.c b/src/iso.c index d247b7b0..86df10b7 100644 --- a/src/iso.c +++ b/src/iso.c @@ -70,6 +70,7 @@ extern BOOL preserve_timestamps; BOOL enable_iso = TRUE, enable_joliet = TRUE, enable_rockridge = TRUE, has_ldlinux_c32; #define ISO_BLOCKING(x) do {x; iso_blocking_status++; } while(0) static const char* psz_extract_dir; +static const char* bootmgr_name = "bootmgr"; static const char* bootmgr_efi_name = "bootmgr.efi"; static const char* grldr_name = "grldr"; static const char* ldlinux_name = "ldlinux.sys"; @@ -185,9 +186,12 @@ static BOOL check_iso_props(const char* psz_dirname, int64_t file_length, const // Check for various files in root (psz_dirname = "") if ((psz_dirname != NULL) && (psz_dirname[0] == 0)) { - if (safe_strnicmp(psz_basename, bootmgr_efi_name, safe_strlen(bootmgr_efi_name)-5) == 0) { + if (safe_stricmp(psz_basename, bootmgr_name) == 0) { img_report.has_bootmgr = TRUE; } + if (safe_stricmp(psz_basename, bootmgr_efi_name) == 0) { + img_report.has_bootmgr_efi = TRUE; + } if (safe_stricmp(psz_basename, grldr_name) == 0) { img_report.has_grub4dos = TRUE; } diff --git a/src/rufus.c b/src/rufus.c index 60dcb12e..8aad76e0 100644 --- a/src/rufus.c +++ b/src/rufus.c @@ -980,7 +980,8 @@ static void DisplayISOProps(void) uprintf(" Uses: EFI (through '%s')", img_report.efi_img_path); else PRINT_ISO_PROP(img_report.has_efi, " Uses: EFI %s", HAS_WIN7_EFI(img_report) ? "(win7_x64)" : ""); - PRINT_ISO_PROP(HAS_BOOTMGR(img_report), " Uses: Bootmgr"); + PRINT_ISO_PROP(HAS_BOOTMGR(img_report), " Uses: Bootmgr (%s)", + HAS_BOOTMGR_BIOS(img_report) ? (HAS_BOOTMGR_EFI(img_report) ? "BIOS and UEFI" : "BIOS only") : "UEFI only"); PRINT_ISO_PROP(HAS_WINPE(img_report), " Uses: WinPE %s", (img_report.uses_minint) ? "(with /minint)" : ""); if (HAS_INSTALL_WIM(img_report)) { uprintf(" Uses: Install.wim (version %d.%d.%d)", (img_report.install_wim_version >> 24) & 0xff, diff --git a/src/rufus.h b/src/rufus.h index 624144c7..5a81107a 100644 --- a/src/rufus.h +++ b/src/rufus.h @@ -272,7 +272,9 @@ enum checksum_type { #define HAS_REACTOS(r) (r.reactos_path[0] != 0) #define HAS_GRUB(r) ((r.has_grub2) || (r.has_grub4dos)) #define HAS_SYSLINUX(r) (r.sl_version != 0) -#define HAS_BOOTMGR(r) (r.has_bootmgr) +#define HAS_BOOTMGR_BIOS(r) (r.has_bootmgr) +#define HAS_BOOTMGR_EFI(r) (r.has_bootmgr_efi) +#define HAS_BOOTMGR(r) (HAS_BOOTMGR_BIOS(r) || HAS_BOOTMGR_EFI(r)) #define HAS_INSTALL_WIM(r) (r.install_wim_path[0] != 0) #define HAS_WINPE(r) (((r.winpe & WINPE_I386) == WINPE_I386)||((r.winpe & WINPE_AMD64) == WINPE_AMD64)||((r.winpe & WINPE_MININT) == WINPE_MININT)) #define HAS_WINDOWS(r) (HAS_BOOTMGR(r) || (r.uses_minint) || HAS_WINPE(r)) @@ -304,6 +306,7 @@ typedef struct { BOOLEAN has_long_filename; BOOLEAN has_symlinks; BOOLEAN has_bootmgr; + BOOLEAN has_bootmgr_efi; BOOLEAN has_autorun; BOOLEAN has_old_c32[NB_OLD_C32]; BOOLEAN has_old_vesamenu; diff --git a/src/rufus.rc b/src/rufus.rc index def83c34..d0e77e2c 100644 --- a/src/rufus.rc +++ b/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 3.3.1398" +CAPTION "Rufus 3.3.1399" 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 3,3,1398,0 - PRODUCTVERSION 3,3,1398,0 + FILEVERSION 3,3,1399,0 + PRODUCTVERSION 3,3,1399,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -411,13 +411,13 @@ BEGIN VALUE "Comments", "https://akeo.ie" VALUE "CompanyName", "Akeo Consulting" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "3.3.1398" + VALUE "FileVersion", "3.3.1399" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "© 2011-2018 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "https://www.gnu.org/copyleft/gpl.html" VALUE "OriginalFilename", "rufus-3.3.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "3.3.1398" + VALUE "ProductVersion", "3.3.1399" END END BLOCK "VarFileInfo"