From 59fd550c468f13ab086076061f26f9ce15a93d51 Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Wed, 22 May 2024 09:47:23 +0100 Subject: [PATCH] [core] do not set the UEFI:NTFS partition to ESP type * As usual, Microsoft products are so poorly designed that they can't deal with multiple instances of one thing. In this case, if the Windows installer sees two ESPs after you select the drive where you want to install Windows and it creates its own ESP there, it will fail during the "CopyinG Windows Files" step. * So make sure that the UEFI:NTFS partition is *not* set to ESP type, even though it is really an ESP, which is something that we used to do, but that got reverted in 0f23c4718421c8bd7dd4810b7ef759267d535f83. --- src/drive.c | 7 ++++++- src/rufus.rc | 10 +++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/drive.c b/src/drive.c index 7d74d9ff..e3a9d7cb 100644 --- a/src/drive.c +++ b/src/drive.c @@ -2439,6 +2439,8 @@ BOOL CreatePartition(HANDLE hDrive, int partition_style, int file_system, BOOL m // May override the the type of main partition if write_as_esp is active if ((wcscmp(SelectedDrive.Partition[i].Name, L"EFI System Partition") == 0) || (wcscmp(SelectedDrive.Partition[i].Name, L"UEFI:NTFS") == 0)) + // UEFI:NTFS as an MBR ESP somehow seems to be okay, but we may want + // to switch to type 0x01 (FAT21) if people report issues. DriveLayoutEx.PartitionEntry[i].Mbr.PartitionType = 0xef; else if (wcscmp(SelectedDrive.Partition[i].Name, L"Linux Persistence") == 0) DriveLayoutEx.PartitionEntry[i].Mbr.PartitionType = 0x83; @@ -2447,7 +2449,10 @@ BOOL CreatePartition(HANDLE hDrive, int partition_style, int file_system, BOOL m } else { assert(partition_style == PARTITION_STYLE_GPT); if (wcscmp(SelectedDrive.Partition[i].Name, L"UEFI:NTFS") == 0) { - DriveLayoutEx.PartitionEntry[i].Gpt.PartitionType = PARTITION_GENERIC_ESP; + // Boy do you *NOT* want the ESP of a GPT bootable drive to be declared as ESP, + // lest the Microsoft Windows installer errors out at "Copying Windows Files" + // because it just can't handle 2 ESPs on one system. The horror! The horror! + DriveLayoutEx.PartitionEntry[i].Gpt.PartitionType = PARTITION_MICROSOFT_DATA; // Prevent a drive letter from being assigned to the UEFI:NTFS partition DriveLayoutEx.PartitionEntry[i].Gpt.Attributes = GPT_BASIC_DATA_ATTRIBUTE_NO_DRIVE_LETTER; #if !defined(_DEBUG) diff --git a/src/rufus.rc b/src/rufus.rc index a837d366..94804941 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 4.5.2178" +CAPTION "Rufus 4.5.2179" FONT 9, "Segoe UI Symbol", 400, 0, 0x0 BEGIN LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP @@ -397,8 +397,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 4,5,2178,0 - PRODUCTVERSION 4,5,2178,0 + FILEVERSION 4,5,2179,0 + PRODUCTVERSION 4,5,2179,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -416,13 +416,13 @@ BEGIN VALUE "Comments", "https://rufus.ie" VALUE "CompanyName", "Akeo Consulting" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "4.5.2178" + VALUE "FileVersion", "4.5.2179" 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.5.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "4.5.2178" + VALUE "ProductVersion", "4.5.2179" END END BLOCK "VarFileInfo"