1
1
Fork 0
mirror of https://github.com/pbatard/rufus.git synced 2024-08-14 23:57:05 +00:00

[core] add workaround for Windows 11's locking issue

* Windows 11 appears to be a lot more proactive in locking system partitions (ESPs, MSRs)
  than previous versions of Windows were, resulting in format or access errors.
* Try to work around these by disabling exclusive drive locking as needed.
This commit is contained in:
Pete Batard 2021-09-28 16:17:35 +01:00
parent fba24170e1
commit df8058b4f3
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
3 changed files with 12 additions and 6 deletions

View file

@ -11,7 +11,7 @@
<Identity <Identity
Name="19453.net.Rufus" Name="19453.net.Rufus"
Publisher="CN=7AC86D13-3E5A-491A-ADD5-80095C212740" Publisher="CN=7AC86D13-3E5A-491A-ADD5-80095C212740"
Version="3.16.1825.0" /> Version="3.16.1826.0" />
<Properties> <Properties>
<DisplayName>Rufus</DisplayName> <DisplayName>Rufus</DisplayName>

View file

@ -1807,6 +1807,10 @@ DWORD WINAPI FormatThread(void* param)
// too well with Windows. Same with ESPs. Relaxing our locking rules seems to help... // too well with Windows. Same with ESPs. Relaxing our locking rules seems to help...
if ((extra_partitions & (XP_ESP | XP_CASPER)) || (fs_type >= FS_EXT2)) if ((extra_partitions & (XP_ESP | XP_CASPER)) || (fs_type >= FS_EXT2))
actual_lock_drive = FALSE; actual_lock_drive = FALSE;
// Windows 11 is a lot more proactive in locking ESPs and MSRs than previous versions
// were, meaning that we also can't lock the drive without incurring errors...
if ((nWindowsVersion >= WINDOWS_11) && extra_partitions)
actual_lock_drive = FALSE;
PrintInfoDebug(0, MSG_225); PrintInfoDebug(0, MSG_225);
hPhysicalDrive = GetPhysicalHandle(DriveIndex, actual_lock_drive, FALSE, !actual_lock_drive); hPhysicalDrive = GetPhysicalHandle(DriveIndex, actual_lock_drive, FALSE, !actual_lock_drive);
@ -1841,6 +1845,8 @@ DWORD WINAPI FormatThread(void* param)
// If we couldn't delete partitions, Windows give us trouble unless we // If we couldn't delete partitions, Windows give us trouble unless we
// request access to the logical drive. Don't ask me why! // request access to the logical drive. Don't ask me why!
need_logical = TRUE; need_logical = TRUE;
// Also, since we couldn't clean the disk, we need to disable drive locking
actual_lock_drive = FALSE;
} }
// An extra refresh of the (now empty) partition data here appears to be helpful // An extra refresh of the (now empty) partition data here appears to be helpful

View file

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 232, 326 IDD_DIALOG DIALOGEX 12, 12, 232, 326
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 3.16.1825" CAPTION "Rufus 3.16.1826"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0 FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@ -395,8 +395,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,16,1825,0 FILEVERSION 3,16,1826,0
PRODUCTVERSION 3,16,1825,0 PRODUCTVERSION 3,16,1826,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -414,13 +414,13 @@ BEGIN
VALUE "Comments", "https://rufus.ie" VALUE "Comments", "https://rufus.ie"
VALUE "CompanyName", "Akeo Consulting" VALUE "CompanyName", "Akeo Consulting"
VALUE "FileDescription", "Rufus" VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "3.16.1825" VALUE "FileVersion", "3.16.1826"
VALUE "InternalName", "Rufus" VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2021 Pete Batard (GPL v3)" VALUE "LegalCopyright", "© 2011-2021 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html" VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
VALUE "OriginalFilename", "rufus-3.16.exe" VALUE "OriginalFilename", "rufus-3.16.exe"
VALUE "ProductName", "Rufus" VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "3.16.1825" VALUE "ProductVersion", "3.16.1826"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"