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

[ui] remove "Default allocation size" entry to use "(Default)" suffix instead

* also properly set media type when formatting
This commit is contained in:
Pete Batard 2011-12-04 20:13:51 +00:00
parent 5065c02d63
commit 3e3126667e
3 changed files with 16 additions and 19 deletions

View file

@ -139,7 +139,6 @@ static BOOL FormatDrive(char DriveLetter)
PrintStatus("Formatting..."); PrintStatus("Formatting...");
PF_INIT_OR_OUT(FormatEx, fmifs); PF_INIT_OR_OUT(FormatEx, fmifs);
// TODO: properly set MediaType
GetWindowTextW(hFileSystem, wFSType, ARRAYSIZE(wFSType)); GetWindowTextW(hFileSystem, wFSType, ARRAYSIZE(wFSType));
// We may have a " (Default)" trail // We may have a " (Default)" trail
for (i=0; i<wcslen(wFSType); i++) { for (i=0; i<wcslen(wFSType); i++) {
@ -150,7 +149,7 @@ static BOOL FormatDrive(char DriveLetter)
} }
GetWindowTextW(hLabel, wLabel, ARRAYSIZE(wLabel)); GetWindowTextW(hLabel, wLabel, ARRAYSIZE(wLabel));
uprintf("Using cluster size: %d bytes\n", ComboBox_GetItemData(hClusterSize, ComboBox_GetCurSel(hClusterSize))); uprintf("Using cluster size: %d bytes\n", ComboBox_GetItemData(hClusterSize, ComboBox_GetCurSel(hClusterSize)));
pfFormatEx(wDriveRoot, RemovableMedia, wFSType, wLabel, pfFormatEx(wDriveRoot, SelectedDrive.Geometry.MediaType, wFSType, wLabel,
IsChecked(IDC_QUICKFORMAT), (ULONG)ComboBox_GetItemData(hClusterSize, ComboBox_GetCurSel(hClusterSize)), IsChecked(IDC_QUICKFORMAT), (ULONG)ComboBox_GetItemData(hClusterSize, ComboBox_GetCurSel(hClusterSize)),
FormatExCallback); FormatExCallback);
if (!IS_ERROR(FormatStatus)) { if (!IS_ERROR(FormatStatus)) {

20
rufus.c
View file

@ -181,8 +181,8 @@ out:
*/ */
static BOOL SetClusterSizes(int FSType) static BOOL SetClusterSizes(int FSType)
{ {
char szDefault[64]; char szClustSize[64];
int i; int i, default_index = 0;
ULONG j; ULONG j;
IGNORE_RETVAL(ComboBox_ResetContent(hClusterSize)); IGNORE_RETVAL(ComboBox_ResetContent(hClusterSize));
@ -198,20 +198,18 @@ static BOOL SetClusterSizes(int FSType)
return FALSE; return FALSE;
} }
// Yes, I know there exist more efficient ways...
for(i=0,j=SelectedDrive.ClusterSize[FSType].Default>>10;j;i++,j>>=1);
safe_sprintf(szDefault, sizeof(szDefault), "Default allocation size (%s)", ClusterSizeLabel[i]);
IGNORE_RETVAL(ComboBox_SetItemData(hClusterSize, ComboBox_AddStringU(hClusterSize, szDefault),
SelectedDrive.ClusterSize[FSType].Default));
for(i=0,j=0x200;j<0x10000000;i++,j<<=1) { for(i=0,j=0x200;j<0x10000000;i++,j<<=1) {
if (j & SelectedDrive.ClusterSize[FSType].Allowed) { if (j & SelectedDrive.ClusterSize[FSType].Allowed) {
IGNORE_RETVAL(ComboBox_SetItemData(hClusterSize, ComboBox_AddStringU(hClusterSize, ClusterSizeLabel[i]), j)); safe_sprintf(szClustSize, sizeof(szClustSize), "%s", ClusterSizeLabel[i]);
if (j == SelectedDrive.ClusterSize[FSType].Default) {
safe_strcat(szClustSize, sizeof(szClustSize), " (Default)");
default_index = i;
}
IGNORE_RETVAL(ComboBox_SetItemData(hClusterSize, ComboBox_AddStringU(hClusterSize, szClustSize), j));
} }
} }
IGNORE_RETVAL(ComboBox_SetCurSel(hClusterSize, 0)); IGNORE_RETVAL(ComboBox_SetCurSel(hClusterSize, default_index));
return TRUE; return TRUE;
} }

View file

@ -30,7 +30,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 206, 263 IDD_DIALOG DIALOGEX 12, 12, 206, 263
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW EXSTYLE WS_EX_APPWINDOW
CAPTION "Rufus v1.0.0.66" CAPTION "Rufus v1.0.0.67"
FONT 8, "MS Shell Dlg", 400, 0, 0x1 FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN BEGIN
DEFPUSHBUTTON "Start",IDC_START,94,223,50,14 DEFPUSHBUTTON "Start",IDC_START,94,223,50,14
@ -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 66)",IDC_STATIC,46,19,78,8 LTEXT "Version 1.0.0 (Build 67)",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,66 FILEVERSION 1,0,0,67
PRODUCTVERSION 1,0,0,66 PRODUCTVERSION 1,0,0,67
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.66" VALUE "FileVersion", "1.0.0.67"
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.66" VALUE "ProductVersion", "1.0.0.67"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"