mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[core] work around Windows refusing to mount Linux MBR partitions on FIXED drives
* Fixes #1922. * Also fix a typo and apply minor updates for GitHub Actions workflows.
This commit is contained in:
parent
c76327f96e
commit
746f91acc7
5 changed files with 16 additions and 15 deletions
2
.github/workflows/codeql.nope
vendored
2
.github/workflows/codeql.nope
vendored
|
@ -14,7 +14,7 @@ env:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
CodeQL-Build:
|
CodeQL-Build:
|
||||||
runs-on: windows-2022
|
runs-on: windows-latest
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
security-events: write
|
security-events: write
|
||||||
|
|
2
.github/workflows/coverity.yml
vendored
2
.github/workflows/coverity.yml
vendored
|
@ -45,8 +45,6 @@ jobs:
|
||||||
|
|
||||||
- name: Add MSBuild to PATH
|
- name: Add MSBuild to PATH
|
||||||
uses: microsoft/setup-msbuild@v1.1
|
uses: microsoft/setup-msbuild@v1.1
|
||||||
with:
|
|
||||||
msbuild-architecture: x64
|
|
||||||
|
|
||||||
- name: Build with Coverity
|
- name: Build with Coverity
|
||||||
run: |
|
run: |
|
||||||
|
|
2
.github/workflows/vs2022.yml
vendored
2
.github/workflows/vs2022.yml
vendored
|
@ -31,7 +31,7 @@ env:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
VS2022-Build:
|
VS2022-Build:
|
||||||
runs-on: windows-2022
|
runs-on: windows-latest
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
|
|
15
src/format.c
15
src/format.c
|
@ -1884,7 +1884,7 @@ out:
|
||||||
DWORD WINAPI FormatThread(void* param)
|
DWORD WINAPI FormatThread(void* param)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
BOOL ret, use_large_fat32, windows_to_go, actual_lock_drive = lock_drive;
|
BOOL ret, use_large_fat32, windows_to_go, actual_lock_drive = lock_drive, write_as_ext = FALSE;
|
||||||
// Windows 11 and VDS (which I suspect is what fmifs.dll's FormatEx() is now calling behind the scenes)
|
// Windows 11 and VDS (which I suspect is what fmifs.dll's FormatEx() is now calling behind the scenes)
|
||||||
// require us to unlock the physical drive to format the drive, else access denied is returned.
|
// require us to unlock the physical drive to format the drive, else access denied is returned.
|
||||||
BOOL need_logical = FALSE, must_unlock_physical = (use_vds || nWindowsVersion >= WINDOWS_11);
|
BOOL need_logical = FALSE, must_unlock_physical = (use_vds || nWindowsVersion >= WINDOWS_11);
|
||||||
|
@ -1931,6 +1931,9 @@ DWORD WINAPI FormatThread(void* param)
|
||||||
// were, meaning that we also can't lock the drive without incurring errors...
|
// were, meaning that we also can't lock the drive without incurring errors...
|
||||||
if ((nWindowsVersion >= WINDOWS_11) && extra_partitions)
|
if ((nWindowsVersion >= WINDOWS_11) && extra_partitions)
|
||||||
actual_lock_drive = FALSE;
|
actual_lock_drive = FALSE;
|
||||||
|
// Fixed drives + ext2/ext3 don't play nice and require the same handling as ESPs
|
||||||
|
write_as_ext = (fs_type >= FS_EXT2 && fs_type <= FS_EXT4) &&
|
||||||
|
(GetDriveTypeFromIndex(DriveIndex) == DRIVE_FIXED);
|
||||||
|
|
||||||
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);
|
||||||
|
@ -1993,7 +1996,7 @@ DWORD WINAPI FormatThread(void* param)
|
||||||
goto out;
|
goto out;
|
||||||
// If the call succeeds (and we don't get a NULL logical handle as returned for
|
// If the call succeeds (and we don't get a NULL logical handle as returned for
|
||||||
// unpartitioned drives), try to unmount the volume.
|
// unpartitioned drives), try to unmount the volume.
|
||||||
} else if ((hLogicalVolume == NULL) && (!UnmountVolume(hLogicalVolume))) {
|
} else if ((hLogicalVolume != NULL) && (!UnmountVolume(hLogicalVolume))) {
|
||||||
uprintf("Trying to continue regardless...");
|
uprintf("Trying to continue regardless...");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2139,8 +2142,8 @@ DWORD WINAPI FormatThread(void* param)
|
||||||
// Wait for the logical drive we just created to appear
|
// Wait for the logical drive we just created to appear
|
||||||
uprintf("Waiting for logical drive to reappear...");
|
uprintf("Waiting for logical drive to reappear...");
|
||||||
Sleep(200);
|
Sleep(200);
|
||||||
if (write_as_esp) {
|
if (write_as_esp || write_as_ext) {
|
||||||
// Can't format the ESP unless we mount it ourself
|
// Can't format ESPs or ext2/ext3 partitions unless we mount them ourselves
|
||||||
volume_name = AltMountVolume(DriveIndex, partition_offset[PI_MAIN], FALSE);
|
volume_name = AltMountVolume(DriveIndex, partition_offset[PI_MAIN], FALSE);
|
||||||
if (volume_name == NULL) {
|
if (volume_name == NULL) {
|
||||||
FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | APPERR(ERROR_CANT_ASSIGN_LETTER);
|
FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | APPERR(ERROR_CANT_ASSIGN_LETTER);
|
||||||
|
@ -2214,7 +2217,7 @@ DWORD WINAPI FormatThread(void* param)
|
||||||
}
|
}
|
||||||
Sleep(200);
|
Sleep(200);
|
||||||
|
|
||||||
if (!write_as_esp) {
|
if (!write_as_esp && !write_as_ext) {
|
||||||
WaitForLogical(DriveIndex, 0);
|
WaitForLogical(DriveIndex, 0);
|
||||||
// Try to continue
|
// Try to continue
|
||||||
CHECK_FOR_USER_CANCEL;
|
CHECK_FOR_USER_CANCEL;
|
||||||
|
@ -2409,7 +2412,7 @@ DWORD WINAPI FormatThread(void* param)
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (write_as_esp && volume_name != NULL)
|
if ((write_as_esp || write_as_ext) && volume_name != NULL)
|
||||||
AltUnmountVolume(volume_name, TRUE);
|
AltUnmountVolume(volume_name, TRUE);
|
||||||
else
|
else
|
||||||
safe_free(volume_name);
|
safe_free(volume_name);
|
||||||
|
|
10
src/rufus.rc
10
src/rufus.rc
|
@ -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.19.1891"
|
CAPTION "Rufus 3.19.1892"
|
||||||
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,19,1891,0
|
FILEVERSION 3,19,1892,0
|
||||||
PRODUCTVERSION 3,19,1891,0
|
PRODUCTVERSION 3,19,1892,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.19.1891"
|
VALUE "FileVersion", "3.19.1892"
|
||||||
VALUE "InternalName", "Rufus"
|
VALUE "InternalName", "Rufus"
|
||||||
VALUE "LegalCopyright", "© 2011-2022 Pete Batard (GPL v3)"
|
VALUE "LegalCopyright", "© 2011-2022 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.19.exe"
|
VALUE "OriginalFilename", "rufus-3.19.exe"
|
||||||
VALUE "ProductName", "Rufus"
|
VALUE "ProductName", "Rufus"
|
||||||
VALUE "ProductVersion", "3.19.1891"
|
VALUE "ProductVersion", "3.19.1892"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|
Loading…
Reference in a new issue