mirror of
https://github.com/pbatard/rufus.git
synced 2025-05-24 19:54:25 -04:00
[iso] fix ISO→ESP creation for Windows 11
* In their great "wisdom", Microsoft made it even harder to access ESPs on Windows 11, meaning that we have to use even more convoluted ways of providing the ISO→ESP feature. * Closes #1855
This commit is contained in:
parent
14847a1a89
commit
00a802ca1d
5 changed files with 80 additions and 41 deletions
|
@ -2,7 +2,7 @@
|
|||
* Rufus: The Reliable USB Formatting Utility
|
||||
* Large FAT32 formatting
|
||||
* Copyright © 2007-2009 Tom Thornhill/Ridgecrop
|
||||
* Copyright © 2011-2021 Pete Batard <pete@akeo.ie>
|
||||
* Copyright © 2011-2022 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
|
||||
|
@ -42,6 +42,8 @@
|
|||
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|err; \
|
||||
goto out; } while(0)
|
||||
|
||||
extern BOOL write_as_esp;
|
||||
|
||||
/* Large FAT32 */
|
||||
#pragma pack(push, 1)
|
||||
typedef struct tagFAT_BOOTSECTOR32
|
||||
|
@ -196,7 +198,9 @@ BOOL FormatLargeFAT32(DWORD DriveIndex, uint64_t PartitionOffset, DWORD ClusterS
|
|||
VolumeId = GetVolumeID();
|
||||
|
||||
// Open the drive and lock it
|
||||
hLogicalVolume = GetLogicalHandle(DriveIndex, PartitionOffset, TRUE, TRUE, FALSE);
|
||||
hLogicalVolume = write_as_esp ?
|
||||
AltGetLogicalHandle(DriveIndex, PartitionOffset, TRUE, TRUE, FALSE) :
|
||||
GetLogicalHandle(DriveIndex, PartitionOffset, TRUE, TRUE, FALSE);
|
||||
if (IS_ERROR(FormatStatus))
|
||||
goto out;
|
||||
if ((hLogicalVolume == INVALID_HANDLE_VALUE) || (hLogicalVolume == NULL))
|
||||
|
@ -450,7 +454,9 @@ BOOL FormatLargeFAT32(DWORD DriveIndex, uint64_t PartitionOffset, DWORD ClusterS
|
|||
uprintf("Setting label...");
|
||||
// Handle must be closed for SetVolumeLabel to work
|
||||
safe_closehandle(hLogicalVolume);
|
||||
VolumeName = GetLogicalName(DriveIndex, PartitionOffset, TRUE, TRUE);
|
||||
VolumeName = write_as_esp ?
|
||||
AltGetLogicalName(DriveIndex, PartitionOffset, TRUE, TRUE) :
|
||||
GetLogicalName(DriveIndex, PartitionOffset, TRUE, TRUE);
|
||||
if ((VolumeName == NULL) || (!SetVolumeLabelA(VolumeName, Label))) {
|
||||
uprintf("Could not set label: %s", WindowsErrorString());
|
||||
// Non fatal error
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue