[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 0f23c47184.
This commit is contained in:
Pete Batard 2024-05-22 09:47:23 +01:00
parent fcf5e2eede
commit 59fd550c46
No known key found for this signature in database
GPG Key ID: 38E0CF5E69EDD671
2 changed files with 11 additions and 6 deletions

View File

@ -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)

View File

@ -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", "<22> 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"