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: | ||||
|   CodeQL-Build: | ||||
|     runs-on: windows-2022 | ||||
|     runs-on: windows-latest | ||||
| 
 | ||||
|     permissions: | ||||
|       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 | ||||
|       uses: microsoft/setup-msbuild@v1.1 | ||||
|       with: | ||||
|         msbuild-architecture: x64 | ||||
| 
 | ||||
|     - name: Build with Coverity | ||||
|       run: |  | ||||
|  |  | |||
							
								
								
									
										2
									
								
								.github/workflows/vs2022.yml
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/vs2022.yml
									
										
									
									
										vendored
									
									
								
							|  | @ -31,7 +31,7 @@ env: | |||
| 
 | ||||
| jobs: | ||||
|   VS2022-Build: | ||||
|     runs-on: windows-2022 | ||||
|     runs-on: windows-latest | ||||
| 
 | ||||
|     strategy: | ||||
|       matrix: | ||||
|  |  | |||
							
								
								
									
										15
									
								
								src/format.c
									
										
									
									
									
								
							
							
						
						
									
										15
									
								
								src/format.c
									
										
									
									
									
								
							|  | @ -1884,7 +1884,7 @@ out: | |||
| DWORD WINAPI FormatThread(void* param) | ||||
| { | ||||
| 	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)
 | ||||
| 	// 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); | ||||
|  | @ -1931,6 +1931,9 @@ DWORD WINAPI FormatThread(void* param) | |||
| 	// were, meaning that we also can't lock the drive without incurring errors...
 | ||||
| 	if ((nWindowsVersion >= WINDOWS_11) && extra_partitions) | ||||
| 		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); | ||||
| 	hPhysicalDrive = GetPhysicalHandle(DriveIndex, actual_lock_drive, FALSE, !actual_lock_drive); | ||||
|  | @ -1993,7 +1996,7 @@ DWORD WINAPI FormatThread(void* param) | |||
| 			goto out; | ||||
| 		// If the call succeeds (and we don't get a NULL logical handle as returned for
 | ||||
| 		// unpartitioned drives), try to unmount the volume.
 | ||||
| 		} else if ((hLogicalVolume == NULL) && (!UnmountVolume(hLogicalVolume))) { | ||||
| 		} else if ((hLogicalVolume != NULL) && (!UnmountVolume(hLogicalVolume))) { | ||||
| 			uprintf("Trying to continue regardless..."); | ||||
| 		} | ||||
| 	} | ||||
|  | @ -2139,8 +2142,8 @@ DWORD WINAPI FormatThread(void* param) | |||
| 	// Wait for the logical drive we just created to appear
 | ||||
| 	uprintf("Waiting for logical drive to reappear..."); | ||||
| 	Sleep(200); | ||||
| 	if (write_as_esp) { | ||||
| 		// Can't format the ESP unless we mount it ourself
 | ||||
| 	if (write_as_esp || write_as_ext) { | ||||
| 		// Can't format ESPs or ext2/ext3 partitions unless we mount them ourselves
 | ||||
| 		volume_name = AltMountVolume(DriveIndex, partition_offset[PI_MAIN], FALSE); | ||||
| 		if (volume_name == NULL) { | ||||
| 			FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | APPERR(ERROR_CANT_ASSIGN_LETTER); | ||||
|  | @ -2214,7 +2217,7 @@ DWORD WINAPI FormatThread(void* param) | |||
| 	} | ||||
| 	Sleep(200); | ||||
| 
 | ||||
| 	if (!write_as_esp) { | ||||
| 	if (!write_as_esp && !write_as_ext) { | ||||
| 		WaitForLogical(DriveIndex, 0); | ||||
| 		// Try to continue
 | ||||
| 		CHECK_FOR_USER_CANCEL; | ||||
|  | @ -2409,7 +2412,7 @@ DWORD WINAPI FormatThread(void* param) | |||
| 	} | ||||
| 
 | ||||
| out: | ||||
| 	if (write_as_esp && volume_name != NULL) | ||||
| 	if ((write_as_esp || write_as_ext) && volume_name != NULL) | ||||
| 		AltUnmountVolume(volume_name, TRUE); | ||||
| 	else | ||||
| 		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 | ||||
| STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | ||||
| EXSTYLE WS_EX_ACCEPTFILES | ||||
| CAPTION "Rufus 3.19.1891" | ||||
| CAPTION "Rufus 3.19.1892" | ||||
| FONT 9, "Segoe UI Symbol", 400, 0, 0x0 | ||||
| BEGIN | ||||
|     LTEXT           "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP | ||||
|  | @ -395,8 +395,8 @@ END | |||
| // | ||||
| 
 | ||||
| VS_VERSION_INFO VERSIONINFO | ||||
|  FILEVERSION 3,19,1891,0 | ||||
|  PRODUCTVERSION 3,19,1891,0 | ||||
|  FILEVERSION 3,19,1892,0 | ||||
|  PRODUCTVERSION 3,19,1892,0 | ||||
|  FILEFLAGSMASK 0x3fL | ||||
| #ifdef _DEBUG | ||||
|  FILEFLAGS 0x1L | ||||
|  | @ -414,13 +414,13 @@ BEGIN | |||
|             VALUE "Comments", "https://rufus.ie" | ||||
|             VALUE "CompanyName", "Akeo Consulting" | ||||
|             VALUE "FileDescription", "Rufus" | ||||
|             VALUE "FileVersion", "3.19.1891" | ||||
|             VALUE "FileVersion", "3.19.1892" | ||||
|             VALUE "InternalName", "Rufus" | ||||
|             VALUE "LegalCopyright", "© 2011-2022 Pete Batard (GPL v3)" | ||||
|             VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html" | ||||
|             VALUE "OriginalFilename", "rufus-3.19.exe" | ||||
|             VALUE "ProductName", "Rufus" | ||||
|             VALUE "ProductVersion", "3.19.1891" | ||||
|             VALUE "ProductVersion", "3.19.1892" | ||||
|         END | ||||
|     END | ||||
|     BLOCK "VarFileInfo" | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue