mirror of
				https://github.com/pbatard/rufus.git
				synced 2024-08-14 23:57:05 +00:00 
			
		
		
		
	[ui] added cluster size selection
This commit is contained in:
		
							parent
							
								
									d35d37cf20
								
							
						
					
					
						commit
						b541496e7e
					
				
					 4 changed files with 43 additions and 12 deletions
				
			
		|  | @ -11,7 +11,7 @@ | ||||||
| #define IDC_FILESYSTEM                  1002 | #define IDC_FILESYSTEM                  1002 | ||||||
| #define IDC_START                       1003 | #define IDC_START                       1003 | ||||||
| #define IDC_CAPACITY                    1004 | #define IDC_CAPACITY                    1004 | ||||||
| #define IDC_ALLOCSIZE                   1005 | #define IDC_CLUSTERSIZE                 1005 | ||||||
| #define IDC_STATUS                      1006 | #define IDC_STATUS                      1006 | ||||||
| #define IDC_ABOUT                       1007 | #define IDC_ABOUT                       1007 | ||||||
| #define IDC_LABEL                       1008 | #define IDC_LABEL                       1008 | ||||||
|  |  | ||||||
							
								
								
									
										39
									
								
								rufus.c
									
										
									
									
									
								
							
							
						
						
									
										39
									
								
								rufus.c
									
										
									
									
									
								
							|  | @ -81,7 +81,7 @@ struct { | ||||||
| 	enum _FSType FSType; | 	enum _FSType FSType; | ||||||
| } SelectedDrive; | } SelectedDrive; | ||||||
| 
 | 
 | ||||||
| static HWND hDeviceList, hCapacity, hFileSystem, hLabel; | static HWND hDeviceList, hCapacity, hFileSystem, hClusterSize, hLabel; | ||||||
| static HWND hDeviceTooltip = NULL, hFSTooltip = NULL; | static HWND hDeviceTooltip = NULL, hFSTooltip = NULL; | ||||||
| static StrArray DriveID, DriveLabel; | static StrArray DriveID, DriveLabel; | ||||||
| static DWORD FormatStatus; | static DWORD FormatStatus; | ||||||
|  | @ -246,6 +246,34 @@ static BOOL GetDriveLabel(DWORD DriveIndex, char* letter, char** label) | ||||||
| 	return TRUE; | 	return TRUE; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | static void SetClusterSizes(enum _FSType FSType) | ||||||
|  | { | ||||||
|  | 	IGNORE_RETVAL(ComboBox_ResetContent(hClusterSize)); | ||||||
|  | 	// Don't ask me - just following the MS standard here
 | ||||||
|  | 	IGNORE_RETVAL(ComboBox_SetItemData(hClusterSize, ComboBox_AddStringU(hClusterSize, "Default allocation size"), 0x8000)); | ||||||
|  | 	// TODO set value above according to FS selected and default cluster sizes from
 | ||||||
|  | 	// http://support.microsoft.com/kb/140365
 | ||||||
|  | 	IGNORE_RETVAL(ComboBox_SetItemData(hClusterSize, ComboBox_AddStringU(hClusterSize, "512 bytes"), 0x200)); | ||||||
|  | 	IGNORE_RETVAL(ComboBox_SetItemData(hClusterSize, ComboBox_AddStringU(hClusterSize, "1024 bytes"), 0x400)); | ||||||
|  | 	IGNORE_RETVAL(ComboBox_SetItemData(hClusterSize, ComboBox_AddStringU(hClusterSize, "2048 bytes"), 0x800)); | ||||||
|  | 	IGNORE_RETVAL(ComboBox_SetItemData(hClusterSize, ComboBox_AddStringU(hClusterSize, "4096 bytes"), 0x1000)); | ||||||
|  | 	IGNORE_RETVAL(ComboBox_SetItemData(hClusterSize, ComboBox_AddStringU(hClusterSize, "8192 bytes"), 0x2000)); | ||||||
|  | 	IGNORE_RETVAL(ComboBox_SetItemData(hClusterSize, ComboBox_AddStringU(hClusterSize, "16 kilobytes"), 0x4000)); | ||||||
|  | 	IGNORE_RETVAL(ComboBox_SetItemData(hClusterSize, ComboBox_AddStringU(hClusterSize, "32 kilobytes"), 0x8000)); | ||||||
|  | 	IGNORE_RETVAL(ComboBox_SetItemData(hClusterSize, ComboBox_AddStringU(hClusterSize, "64 kilobytes"), 0x10000)); | ||||||
|  | 	IGNORE_RETVAL(ComboBox_SetItemData(hClusterSize, ComboBox_AddStringU(hClusterSize, "128 kilobytes"), 0x20000)); | ||||||
|  | 	IGNORE_RETVAL(ComboBox_SetItemData(hClusterSize, ComboBox_AddStringU(hClusterSize, "256 kilobytes"), 0x40000)); | ||||||
|  | 	IGNORE_RETVAL(ComboBox_SetItemData(hClusterSize, ComboBox_AddStringU(hClusterSize, "512 kilobytes"), 0x80000)); | ||||||
|  | 	IGNORE_RETVAL(ComboBox_SetItemData(hClusterSize, ComboBox_AddStringU(hClusterSize, "1024 kilobytes"), 0x100000)); | ||||||
|  | 	IGNORE_RETVAL(ComboBox_SetItemData(hClusterSize, ComboBox_AddStringU(hClusterSize, "2048 kilobytes"), 0x200000)); | ||||||
|  | 	IGNORE_RETVAL(ComboBox_SetItemData(hClusterSize, ComboBox_AddStringU(hClusterSize, "4096 kilobytes"), 0x400000)); | ||||||
|  | 	IGNORE_RETVAL(ComboBox_SetItemData(hClusterSize, ComboBox_AddStringU(hClusterSize, "8192 kilobytes"), 0x800000)); | ||||||
|  | 	IGNORE_RETVAL(ComboBox_SetItemData(hClusterSize, ComboBox_AddStringU(hClusterSize, "16 megabytes"), 0x1000000)); | ||||||
|  | 	IGNORE_RETVAL(ComboBox_SetItemData(hClusterSize, ComboBox_AddStringU(hClusterSize, "32 megabytes"), 0x2000000)); | ||||||
|  | 	// TODO set value according to disk props
 | ||||||
|  | 	IGNORE_RETVAL(ComboBox_SetCurSel(hClusterSize, 0)); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| /*
 | /*
 | ||||||
|  * Fill the drive properties (size, FS, etc) |  * Fill the drive properties (size, FS, etc) | ||||||
|  */ |  */ | ||||||
|  | @ -337,6 +365,7 @@ static BOOL GetDriveInfo(void) | ||||||
| 			SelectedDrive.FSType = FS_DEFAULT; | 			SelectedDrive.FSType = FS_DEFAULT; | ||||||
| 	} | 	} | ||||||
| 	IGNORE_RETVAL(ComboBox_SetCurSel(hFileSystem, SelectedDrive.FSType)); | 	IGNORE_RETVAL(ComboBox_SetCurSel(hFileSystem, SelectedDrive.FSType)); | ||||||
|  | 	SetClusterSizes(SelectedDrive.FSType); | ||||||
| 
 | 
 | ||||||
| 	return TRUE; | 	return TRUE; | ||||||
| } | } | ||||||
|  | @ -354,6 +383,7 @@ static BOOL PopulateProperties(int ComboIndex) | ||||||
| 
 | 
 | ||||||
| 	IGNORE_RETVAL(ComboBox_ResetContent(hCapacity)); | 	IGNORE_RETVAL(ComboBox_ResetContent(hCapacity)); | ||||||
| 	IGNORE_RETVAL(ComboBox_ResetContent(hFileSystem)); | 	IGNORE_RETVAL(ComboBox_ResetContent(hFileSystem)); | ||||||
|  | 	IGNORE_RETVAL(ComboBox_ResetContent(hClusterSize)); | ||||||
| 	SetWindowTextA(hLabel, ""); | 	SetWindowTextA(hLabel, ""); | ||||||
| 	DestroyTooltip(hDeviceTooltip); | 	DestroyTooltip(hDeviceTooltip); | ||||||
| 	DestroyTooltip(hFSTooltip); | 	DestroyTooltip(hFSTooltip); | ||||||
|  | @ -556,7 +586,7 @@ static BOOLEAN __stdcall FormatExCallback(FILE_SYSTEM_CALLBACK_COMMAND Command, | ||||||
| 		break; | 		break; | ||||||
| 	case FCC_CLUSTER_SIZE_TOO_BIG: | 	case FCC_CLUSTER_SIZE_TOO_BIG: | ||||||
| 	case FCC_CLUSTER_SIZE_TOO_SMALL: | 	case FCC_CLUSTER_SIZE_TOO_SMALL: | ||||||
| 		uprintf("Allocation unit size is too %s\n", FCC_CLUSTER_SIZE_TOO_BIG?"big":"small"); | 		uprintf("Unsupported cluster size\n"); | ||||||
| 		FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_INVALID_CLUSTER_SIZE; | 		FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_INVALID_CLUSTER_SIZE; | ||||||
| 		break; | 		break; | ||||||
| 	case FCC_VOLUME_TOO_BIG: | 	case FCC_VOLUME_TOO_BIG: | ||||||
|  | @ -593,9 +623,9 @@ static BOOL FormatDrive(char DriveLetter) | ||||||
| 	// TODO: properly set MediaType
 | 	// TODO: properly set MediaType
 | ||||||
| 	GetWindowTextW(hFileSystem, wFSType, ARRAYSIZE(wFSType)); | 	GetWindowTextW(hFileSystem, wFSType, ARRAYSIZE(wFSType)); | ||||||
| 	GetWindowTextW(hLabel, wLabel, ARRAYSIZE(wLabel)); | 	GetWindowTextW(hLabel, wLabel, ARRAYSIZE(wLabel)); | ||||||
| 	// TODO set sector size
 | 	uprintf("Using cluster size: %d bytes\n", ComboBox_GetItemData(hClusterSize, ComboBox_GetCurSel(hClusterSize))); | ||||||
| 	pfFormatEx(wDriveRoot, RemovableMedia, wFSType, wLabel, | 	pfFormatEx(wDriveRoot, RemovableMedia, wFSType, wLabel, | ||||||
| 		IsChecked(IDC_QUICKFORMAT), 4096, FormatExCallback); | 		IsChecked(IDC_QUICKFORMAT), ComboBox_GetItemData(hClusterSize, ComboBox_GetCurSel(hClusterSize)), FormatExCallback); | ||||||
| 	if (!IS_ERROR(FormatStatus)) { | 	if (!IS_ERROR(FormatStatus)) { | ||||||
| 		uprintf("Format completed.\n"); | 		uprintf("Format completed.\n"); | ||||||
| 		r = TRUE; | 		r = TRUE; | ||||||
|  | @ -813,6 +843,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 		hDeviceList = GetDlgItem(hDlg, IDC_DEVICE); | 		hDeviceList = GetDlgItem(hDlg, IDC_DEVICE); | ||||||
| 		hCapacity = GetDlgItem(hDlg, IDC_CAPACITY); | 		hCapacity = GetDlgItem(hDlg, IDC_CAPACITY); | ||||||
| 		hFileSystem = GetDlgItem(hDlg, IDC_FILESYSTEM); | 		hFileSystem = GetDlgItem(hDlg, IDC_FILESYSTEM); | ||||||
|  | 		hClusterSize = GetDlgItem(hDlg, IDC_CLUSTERSIZE); | ||||||
| 		hLabel = GetDlgItem(hDlg, IDC_LABEL); | 		hLabel = GetDlgItem(hDlg, IDC_LABEL); | ||||||
| 		hProgress = GetDlgItem(hDlg, IDC_PROGRESS); | 		hProgress = GetDlgItem(hDlg, IDC_PROGRESS); | ||||||
| 		// High DPI scaling
 | 		// High DPI scaling
 | ||||||
|  |  | ||||||
							
								
								
									
										2
									
								
								rufus.h
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								rufus.h
									
										
									
									
									
								
							|  | @ -21,7 +21,7 @@ | ||||||
| 
 | 
 | ||||||
| #define RUFUS_DEBUG | #define RUFUS_DEBUG | ||||||
| 
 | 
 | ||||||
| #define APP_VERSION                 "Rufus v1.0.0.41" | #define APP_VERSION                 "Rufus v1.0.0.42" | ||||||
| #define STR_NO_LABEL                "NO_LABEL" | #define STR_NO_LABEL                "NO_LABEL" | ||||||
| #define RUFUS_CANCELBOX_TITLE       "Rufus - Cancellation" | #define RUFUS_CANCELBOX_TITLE       "Rufus - Cancellation" | ||||||
| #define DRIVE_INDEX_MIN             0x80 | #define DRIVE_INDEX_MIN             0x80 | ||||||
|  |  | ||||||
							
								
								
									
										12
									
								
								rufus.rc
									
										
									
									
									
								
							
							
						
						
									
										12
									
								
								rufus.rc
									
										
									
									
									
								
							|  | @ -41,7 +41,7 @@ BEGIN | ||||||
|     LTEXT           "&File system",IDC_STATIC,17,65,51,10 |     LTEXT           "&File system",IDC_STATIC,17,65,51,10 | ||||||
|     COMBOBOX        IDC_CAPACITY,16,47,190,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP |     COMBOBOX        IDC_CAPACITY,16,47,190,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP | ||||||
|     LTEXT           "Ca&pacity",IDC_STATIC,17,36,29,8 |     LTEXT           "Ca&pacity",IDC_STATIC,17,36,29,8 | ||||||
|     COMBOBOX        IDC_ALLOCSIZE,16,105,190,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP |     COMBOBOX        IDC_CLUSTERSIZE,16,105,190,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | ||||||
|     LTEXT           "&Allocation unit size",IDC_STATIC,17,94,105,10 |     LTEXT           "&Allocation unit size",IDC_STATIC,17,94,105,10 | ||||||
|     PUSHBUTTON      "About...",IDC_ABOUT,16,224,50,14 |     PUSHBUTTON      "About...",IDC_ABOUT,16,224,50,14 | ||||||
|     GROUPBOX        "Format Options",IDC_STATIC,15,150,189,40 |     GROUPBOX        "Format Options",IDC_STATIC,15,150,189,40 | ||||||
|  | @ -63,7 +63,7 @@ BEGIN | ||||||
|     DEFPUSHBUTTON   "OK",IDOK,231,175,50,14,WS_GROUP |     DEFPUSHBUTTON   "OK",IDOK,231,175,50,14,WS_GROUP | ||||||
|     CONTROL         "<a href=""https://github.com/pbatard/rufus/wiki/Rufus"">https://github.com/pbatard/rufus</a>",IDC_ABOUT_RUFUS_URL, |     CONTROL         "<a href=""https://github.com/pbatard/rufus/wiki/Rufus"">https://github.com/pbatard/rufus</a>",IDC_ABOUT_RUFUS_URL, | ||||||
|                     "SysLink",WS_TABSTOP,46,47,114,9 |                     "SysLink",WS_TABSTOP,46,47,114,9 | ||||||
|     LTEXT           "Version 1.0.0 (Build 41)",IDC_STATIC,46,19,78,8 |     LTEXT           "Version 1.0.0 (Build 42)",IDC_STATIC,46,19,78,8 | ||||||
|     PUSHBUTTON      "License...",IDC_ABOUT_LICENSE,46,175,50,14,WS_GROUP |     PUSHBUTTON      "License...",IDC_ABOUT_LICENSE,46,175,50,14,WS_GROUP | ||||||
|     EDITTEXT        IDC_ABOUT_COPYRIGHTS,46,107,235,63,ES_MULTILINE | ES_READONLY | WS_VSCROLL |     EDITTEXT        IDC_ABOUT_COPYRIGHTS,46,107,235,63,ES_MULTILINE | ES_READONLY | WS_VSCROLL | ||||||
|     LTEXT           "Report bugs or request enhancements at:",IDC_STATIC,46,66,187,8 |     LTEXT           "Report bugs or request enhancements at:",IDC_STATIC,46,66,187,8 | ||||||
|  | @ -162,8 +162,8 @@ END | ||||||
| // | // | ||||||
| 
 | 
 | ||||||
| VS_VERSION_INFO VERSIONINFO | VS_VERSION_INFO VERSIONINFO | ||||||
|  FILEVERSION 1,0,0,41 |  FILEVERSION 1,0,0,42 | ||||||
|  PRODUCTVERSION 1,0,0,41 |  PRODUCTVERSION 1,0,0,42 | ||||||
|  FILEFLAGSMASK 0x3fL |  FILEFLAGSMASK 0x3fL | ||||||
| #ifdef _DEBUG | #ifdef _DEBUG | ||||||
|  FILEFLAGS 0x1L |  FILEFLAGS 0x1L | ||||||
|  | @ -180,13 +180,13 @@ BEGIN | ||||||
|         BEGIN |         BEGIN | ||||||
|             VALUE "CompanyName", "akeo.ie" |             VALUE "CompanyName", "akeo.ie" | ||||||
|             VALUE "FileDescription", "Rufus" |             VALUE "FileDescription", "Rufus" | ||||||
|             VALUE "FileVersion", "1.0.0.41" |             VALUE "FileVersion", "1.0.0.42" | ||||||
|             VALUE "InternalName", "Rufus" |             VALUE "InternalName", "Rufus" | ||||||
|             VALUE "LegalCopyright", "© 2011 Pete Batard (GPL v3)" |             VALUE "LegalCopyright", "© 2011 Pete Batard (GPL v3)" | ||||||
|             VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" |             VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" | ||||||
|             VALUE "OriginalFilename", "rufus.exe" |             VALUE "OriginalFilename", "rufus.exe" | ||||||
|             VALUE "ProductName", "Rufus" |             VALUE "ProductName", "Rufus" | ||||||
|             VALUE "ProductVersion", "1.0.0.41" |             VALUE "ProductVersion", "1.0.0.42" | ||||||
|         END |         END | ||||||
|     END |     END | ||||||
|     BLOCK "VarFileInfo" |     BLOCK "VarFileInfo" | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue