mirror of
				https://github.com/pbatard/rufus.git
				synced 2024-08-14 23:57:05 +00:00 
			
		
		
		
	[ui] fix disabling of Quick Format checkbox
* Closes #1211 * Also fix MBR analysis report displayed each time the user changes boot selection
This commit is contained in:
		
							parent
							
								
									204908f8e0
								
							
						
					
					
						commit
						790b188b3d
					
				
					 6 changed files with 30 additions and 28 deletions
				
			
		
							
								
								
									
										10
									
								
								src/drive.c
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								src/drive.c
									
										
									
									
									
								
							|  | @ -635,7 +635,7 @@ const struct {int (*fn)(FILE *fp); char* str;} known_mbr[] = { | |||
| }; | ||||
| 
 | ||||
| // Returns TRUE if the drive seems bootable, FALSE otherwise
 | ||||
| BOOL AnalyzeMBR(HANDLE hPhysicalDrive, const char* TargetName) | ||||
| BOOL AnalyzeMBR(HANDLE hPhysicalDrive, const char* TargetName, BOOL bSilent) | ||||
| { | ||||
| 	const char* mbr_name = "Master Boot Record"; | ||||
| 	FAKE_FD fake_fd = { 0 }; | ||||
|  | @ -646,17 +646,17 @@ BOOL AnalyzeMBR(HANDLE hPhysicalDrive, const char* TargetName) | |||
| 	set_bytes_per_sector(SelectedDrive.SectorSize); | ||||
| 
 | ||||
| 	if (!is_br(fp)) { | ||||
| 		uprintf("%s does not have an x86 %s", TargetName, mbr_name); | ||||
| 		suprintf("%s does not have an x86 %s", TargetName, mbr_name); | ||||
| 		return FALSE; | ||||
| 	} | ||||
| 	for (i=0; i<ARRAYSIZE(known_mbr); i++) { | ||||
| 		if (known_mbr[i].fn(fp)) { | ||||
| 			uprintf("%s has a %s %s", TargetName, known_mbr[i].str, mbr_name); | ||||
| 			suprintf("%s has a %s %s", TargetName, known_mbr[i].str, mbr_name); | ||||
| 			return TRUE; | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	uprintf("%s has an unknown %s", TargetName, mbr_name); | ||||
| 	suprintf("%s has an unknown %s", TargetName, mbr_name); | ||||
| 	return TRUE; | ||||
| } | ||||
| 
 | ||||
|  | @ -784,7 +784,7 @@ BOOL GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSys | |||
| 			suprintf("Partition type: MBR, NB Partitions: %d", SelectedDrive.nPartitions); | ||||
| 			SelectedDrive.has_mbr_uefi_marker = (DriveLayout->Mbr.Signature == MBR_UEFI_MARKER); | ||||
| 			suprintf("Disk ID: 0x%08X %s", DriveLayout->Mbr.Signature, SelectedDrive.has_mbr_uefi_marker?"(UEFI target)":""); | ||||
| 			AnalyzeMBR(hPhysical, "Drive"); | ||||
| 			AnalyzeMBR(hPhysical, "Drive", bSilent); | ||||
| 		} | ||||
| 		for (i=0; i<DriveLayout->PartitionCount; i++) { | ||||
| 			isUefiNtfs = FALSE; | ||||
|  |  | |||
|  | @ -116,7 +116,7 @@ char GetUnusedDriveLetter(void); | |||
| BOOL GetDriveLabel(DWORD DriveIndex, char* letter, char** label); | ||||
| uint64_t GetDriveSize(DWORD DriveIndex); | ||||
| BOOL IsMediaPresent(DWORD DriveIndex); | ||||
| BOOL AnalyzeMBR(HANDLE hPhysicalDrive, const char* TargetName); | ||||
| BOOL AnalyzeMBR(HANDLE hPhysicalDrive, const char* TargetName, BOOL bSilent); | ||||
| BOOL AnalyzePBR(HANDLE hLogicalVolume); | ||||
| BOOL GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSystemNameSize, BOOL bSilent); | ||||
| BOOL UnmountVolume(HANDLE hDrive); | ||||
|  |  | |||
|  | @ -890,7 +890,7 @@ static BOOL WriteMBR(HANDLE hPhysicalDrive) | |||
| 	FILE* fp = (FILE*)&fake_fd; | ||||
| 	const char* using_msg = "Using %s MBR\n"; | ||||
| 
 | ||||
| 	AnalyzeMBR(hPhysicalDrive, "Drive"); | ||||
| 	AnalyzeMBR(hPhysicalDrive, "Drive", FALSE); | ||||
| 
 | ||||
| 	if (SelectedDrive.SectorSize < 512) | ||||
| 		goto out; | ||||
|  | @ -1818,7 +1818,7 @@ DWORD WINAPI FormatThread(void* param) | |||
| 
 | ||||
| 	if (!zero_drive && !write_as_image) { | ||||
| 		PrintInfoDebug(0, MSG_226); | ||||
| 		AnalyzeMBR(hPhysicalDrive, "Drive"); | ||||
| 		AnalyzeMBR(hPhysicalDrive, "Drive", FALSE); | ||||
| 		if ((hLogicalVolume != NULL) && (hLogicalVolume != INVALID_HANDLE_VALUE)) { | ||||
| 			AnalyzePBR(hLogicalVolume); | ||||
| 		} | ||||
|  |  | |||
							
								
								
									
										22
									
								
								src/rufus.c
									
										
									
									
									
								
							
							
						
						
									
										22
									
								
								src/rufus.c
									
										
									
									
									
								
							|  | @ -687,17 +687,18 @@ static void EnableQuickFormat(BOOL enable) | |||
| 
 | ||||
| 	// Disable/restore the quick format control depending on large FAT32 or ReFS
 | ||||
| 	if (((fs == FS_FAT32) && ((SelectedDrive.DiskSize > LARGE_FAT32_SIZE) || (force_large_fat32))) || (fs == FS_REFS)) { | ||||
| 		if (IsWindowEnabled(hCtrl)) { | ||||
| 		enable = FALSE; | ||||
| 	} | ||||
| 
 | ||||
| 	if (IsWindowEnabled(hCtrl) && !enable) { | ||||
| 		uQFChecked = IsChecked(IDC_QUICK_FORMAT); | ||||
| 		CheckDlgButton(hMainDialog, IDC_QUICK_FORMAT, BST_CHECKED); | ||||
| 			EnableWindow(hCtrl, FALSE); | ||||
| 		} | ||||
| 	} else { | ||||
| 		if (!IsWindowEnabled(hCtrl)) { | ||||
| 	} else if (!IsWindowEnabled(hCtrl) && enable) { | ||||
| 		CheckDlgButton(hMainDialog, IDC_QUICK_FORMAT, uQFChecked); | ||||
| 	} | ||||
| 
 | ||||
| 	// Now enable or disable the control
 | ||||
| 	EnableWindow(hCtrl, enable); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| static void EnableBootOptions(BOOL enable, BOOL remove_checkboxes) | ||||
|  | @ -2106,9 +2107,8 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | |||
| 			if ((HIWORD(wParam) != CBN_SELCHANGE) && (HIWORD(wParam) != CBN_SELCHANGE_INTERNAL)) | ||||
| 				break; | ||||
| 			set_selected_fs = (HIWORD(wParam) == CBN_SELCHANGE); | ||||
| 			fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem)); | ||||
| 			fs = IsWindowEnabled(hFileSystem) ? (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem)) : -1;  | ||||
| 			SetClusterSizes(fs); | ||||
| 			EnableQuickFormat(TRUE); | ||||
| 			if (fs < 0) { | ||||
| 				EnableBootOptions(TRUE, TRUE); | ||||
| 				SetMBRProps(); | ||||
|  | @ -2119,8 +2119,10 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | |||
| 					IGNORE_RETVAL(ComboBox_SetCurSel(hBootType, 1)); | ||||
| 				} | ||||
| 				break; | ||||
| 			} else if (set_selected_fs) { | ||||
| 			} else { | ||||
| 				EnableQuickFormat(TRUE); | ||||
| 				// Try to keep track of user selection
 | ||||
| 				if (set_selected_fs) | ||||
| 					selected_fs = fs; | ||||
| 			} | ||||
| 			EnableMBRBootOptions(TRUE, FALSE); | ||||
|  |  | |||
							
								
								
									
										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.4.1402" | ||||
| CAPTION "Rufus 3.4.1403" | ||||
| FONT 9, "Segoe UI Symbol", 400, 0, 0x0 | ||||
| BEGIN | ||||
|     LTEXT           "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP | ||||
|  | @ -392,8 +392,8 @@ END | |||
| // | ||||
| 
 | ||||
| VS_VERSION_INFO VERSIONINFO | ||||
|  FILEVERSION 3,4,1402,0 | ||||
|  PRODUCTVERSION 3,4,1402,0 | ||||
|  FILEVERSION 3,4,1403,0 | ||||
|  PRODUCTVERSION 3,4,1403,0 | ||||
|  FILEFLAGSMASK 0x3fL | ||||
| #ifdef _DEBUG | ||||
|  FILEFLAGS 0x1L | ||||
|  | @ -411,13 +411,13 @@ BEGIN | |||
|             VALUE "Comments", "https://akeo.ie" | ||||
|             VALUE "CompanyName", "Akeo Consulting" | ||||
|             VALUE "FileDescription", "Rufus" | ||||
|             VALUE "FileVersion", "3.4.1402" | ||||
|             VALUE "FileVersion", "3.4.1403" | ||||
|             VALUE "InternalName", "Rufus" | ||||
|             VALUE "LegalCopyright", "© 2011-2018 Pete Batard (GPL v3)" | ||||
|             VALUE "LegalTrademarks", "https://www.gnu.org/copyleft/gpl.html" | ||||
|             VALUE "OriginalFilename", "rufus-3.4.exe" | ||||
|             VALUE "ProductName", "Rufus" | ||||
|             VALUE "ProductVersion", "3.4.1402" | ||||
|             VALUE "ProductVersion", "3.4.1403" | ||||
|         END | ||||
|     END | ||||
|     BLOCK "VarFileInfo" | ||||
|  |  | |||
|  | @ -287,7 +287,7 @@ BOOL IsBootableImage(const char* path) | |||
| 
 | ||||
| 	is_bootable_img = (BOOLEAN)IsCompressedBootableImage(path); | ||||
| 	if (img_report.compression_type == BLED_COMPRESSION_NONE) | ||||
| 		is_bootable_img = (BOOLEAN)AnalyzeMBR(handle, "  Image"); | ||||
| 		is_bootable_img = (BOOLEAN)AnalyzeMBR(handle, "  Image", FALSE); | ||||
| 
 | ||||
| 	if (!GetFileSizeEx(handle, &liImageSize)) { | ||||
| 		uprintf("  Could not get image size: %s", WindowsErrorString()); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue