mirror of
https://github.com/pbatard/rufus.git
synced 2025-05-19 09:25:12 -04:00
[ui] ui improvements
* fixed DOS selected on init for exFAT and NTFS in certain cases * improved progress and status reports * other minor improvements
This commit is contained in:
parent
17132c35a4
commit
e78f07cda6
6 changed files with 39 additions and 40 deletions
1
TODO
1
TODO
|
@ -1,5 +1,4 @@
|
||||||
o create a report file with failed block details when bad blocks are found
|
o create a report file with failed block details when bad blocks are found
|
||||||
o progress bar during quick format / partitioning / MS-DOS files copy
|
|
||||||
o use the umount/remount trick to make the volume reappear post formatting
|
o use the umount/remount trick to make the volume reappear post formatting
|
||||||
o set keyboard according to locale in DOS
|
o set keyboard according to locale in DOS
|
||||||
o allow selection of one of the existing compatible volume (keep existing MBR) / full repartitioning (overwrite MBR)
|
o allow selection of one of the existing compatible volume (keep existing MBR) / full repartitioning (overwrite MBR)
|
||||||
|
|
|
@ -361,9 +361,8 @@ static void print_status(void)
|
||||||
percent = calc_percent((unsigned long) currently_testing,
|
percent = calc_percent((unsigned long) currently_testing,
|
||||||
(unsigned long) num_blocks);
|
(unsigned long) num_blocks);
|
||||||
percent = (percent/2.0f) + ((cur_op==OP_READ)? 50.0f : 0.0f);
|
percent = (percent/2.0f) + ((cur_op==OP_READ)? 50.0f : 0.0f);
|
||||||
PrintStatus(0, "BB PASS %d/%d(%c): %0.2f%% done. (%d/%d/%d errors)",
|
PrintStatus(0, "Bad Blocks: PASS %d/%d - %0.2f%% (%d/%d/%d errors)",
|
||||||
cur_pattern, nr_pattern,
|
cur_pattern, nr_pattern,
|
||||||
(cur_op==OP_READ)?'R':'W',
|
|
||||||
percent,
|
percent,
|
||||||
num_read_errors,
|
num_read_errors,
|
||||||
num_write_errors,
|
num_write_errors,
|
||||||
|
@ -393,8 +392,8 @@ static void pattern_fill(unsigned char *buffer, unsigned int pattern,
|
||||||
for (ptr = buffer; ptr < buffer + n; ptr++) {
|
for (ptr = buffer; ptr < buffer + n; ptr++) {
|
||||||
(*ptr) = rand() % (1 << (8 * sizeof(char)));
|
(*ptr) = rand() % (1 << (8 * sizeof(char)));
|
||||||
}
|
}
|
||||||
PrintStatus(3500, "Testing with random pattern: ");
|
PrintStatus(3500, "Bad Blocks: Testing with random pattern.");
|
||||||
uprintf("Testing with random pattern: ");
|
uprintf("Bad Blocks: Testing with random pattern.");
|
||||||
} else {
|
} else {
|
||||||
bpattern[0] = 0;
|
bpattern[0] = 0;
|
||||||
for (i = 0; i < sizeof(bpattern); i++) {
|
for (i = 0; i < sizeof(bpattern); i++) {
|
||||||
|
@ -411,8 +410,8 @@ static void pattern_fill(unsigned char *buffer, unsigned int pattern,
|
||||||
else
|
else
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
PrintStatus(3500, "Testing with pattern 0x%02X", bpattern[i]);
|
PrintStatus(3500, "Bad Blocks: Testing with pattern 0x%02X.", bpattern[i]);
|
||||||
uprintf("Testing with pattern 0x%02X", bpattern[i]);
|
uprintf("Bad Blocks: Testing with pattern 0x%02X.", bpattern[i]);
|
||||||
cur_pattern++;
|
cur_pattern++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
24
src/format.c
24
src/format.c
|
@ -47,7 +47,8 @@ badblocks_report report;
|
||||||
static float format_percent = 0.0f;
|
static float format_percent = 0.0f;
|
||||||
static int task_number = 0;
|
static int task_number = 0;
|
||||||
/* Number of steps for each FS for FCC_STRUCTURE_PROGRESS */
|
/* Number of steps for each FS for FCC_STRUCTURE_PROGRESS */
|
||||||
const int nb_steps[FS_MAX] = { 4, 4, 11, 9 };
|
const int nb_steps[FS_MAX] = { 5, 5, 12, 10 };
|
||||||
|
static int fs_index = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* FormatEx callback. Return FALSE to halt operations
|
* FormatEx callback. Return FALSE to halt operations
|
||||||
|
@ -62,30 +63,30 @@ static BOOLEAN __stdcall FormatExCallback(FILE_SYSTEM_CALLBACK_COMMAND Command,
|
||||||
case FCC_PROGRESS:
|
case FCC_PROGRESS:
|
||||||
// TODO: send this percentage to the status bar
|
// TODO: send this percentage to the status bar
|
||||||
percent = (DWORD*)pData;
|
percent = (DWORD*)pData;
|
||||||
uprintf("%d percent completed.\n", *percent);
|
PrintStatus(0, "Formatting: %d%% completed.\n", *percent);
|
||||||
format_percent = 1.0f * (*percent);
|
// uprintf("%d percent completed.\n", *percent);
|
||||||
UpdateProgress(OP_FORMAT_LONG, format_percent);
|
UpdateProgress(OP_FORMAT, 1.0f * (*percent));
|
||||||
break;
|
break;
|
||||||
case FCC_STRUCTURE_PROGRESS: // No progress on quick format
|
case FCC_STRUCTURE_PROGRESS: // No progress on quick format
|
||||||
uprintf("Format task %d/%d completed.\n", ++task_number,
|
PrintStatus(0, "Creating file system: Task %d/%d completed.\n", ++task_number, nb_steps[fs_index]);
|
||||||
nb_steps[ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem))]);
|
uprintf("Create FS: Task %d/%d completed.\n", task_number, nb_steps[fs_index]);
|
||||||
// TODO: figure out likely values
|
format_percent += 100.0f / (1.0f * nb_steps[fs_index]);
|
||||||
format_percent += 100.0f / (1.0f * nb_steps[ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem))]);
|
UpdateProgress(OP_CREATE_FS, format_percent);
|
||||||
UpdateProgress(OP_FORMAT_QUICK, format_percent);
|
|
||||||
break;
|
break;
|
||||||
case FCC_DONE:
|
case FCC_DONE:
|
||||||
|
PrintStatus(0, "Creating file system: Task %d/%d completed.\n", nb_steps[fs_index], nb_steps[fs_index]);
|
||||||
|
uprintf("Create FS: Task %d/%d completed.\n", nb_steps[fs_index], nb_steps[fs_index]);
|
||||||
|
UpdateProgress(OP_CREATE_FS, 100.0f);
|
||||||
if(*(BOOLEAN*)pData == FALSE) {
|
if(*(BOOLEAN*)pData == FALSE) {
|
||||||
uprintf("Error while formatting.\n");
|
uprintf("Error while formatting.\n");
|
||||||
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_GEN_FAILURE;
|
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_GEN_FAILURE;
|
||||||
}
|
}
|
||||||
UpdateProgress(OP_FORMAT_DONE, 100.0f);
|
|
||||||
break;
|
break;
|
||||||
case FCC_DONE_WITH_STRUCTURE: // We get this message when formatting Small FAT16
|
case FCC_DONE_WITH_STRUCTURE: // We get this message when formatting Small FAT16
|
||||||
// pData Seems to be a struct with at least one (32 BIT!!!) string pointer to the size in MB
|
// pData Seems to be a struct with at least one (32 BIT!!!) string pointer to the size in MB
|
||||||
uprintf("Done with that sort of things: Action=%d pData=%0p\n", Action, pData);
|
uprintf("Done with that sort of things: Action=%d pData=%0p\n", Action, pData);
|
||||||
DumpBufferHex(pData, 8);
|
DumpBufferHex(pData, 8);
|
||||||
uprintf("Volume size: %s MB\n", (char*)(LONG_PTR)(*(ULONG32*)pData));
|
uprintf("Volume size: %s MB\n", (char*)(LONG_PTR)(*(ULONG32*)pData));
|
||||||
UpdateProgress(OP_FORMAT_DONE, 100.0f);
|
|
||||||
break;
|
break;
|
||||||
case FCC_INCOMPATIBLE_FILE_SYSTEM:
|
case FCC_INCOMPATIBLE_FILE_SYSTEM:
|
||||||
uprintf("Incompatible File System\n");
|
uprintf("Incompatible File System\n");
|
||||||
|
@ -163,6 +164,7 @@ static BOOL FormatDrive(char DriveLetter)
|
||||||
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)));
|
||||||
format_percent = 0.0f;
|
format_percent = 0.0f;
|
||||||
task_number = 0;
|
task_number = 0;
|
||||||
|
fs_index = ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem));
|
||||||
pfFormatEx(wDriveRoot, SelectedDrive.Geometry.MediaType, 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);
|
||||||
|
|
24
src/rufus.c
24
src/rufus.c
|
@ -558,7 +558,8 @@ static BOOL GetUSBDevices(void)
|
||||||
}
|
}
|
||||||
IGNORE_RETVAL(ComboBox_SetCurSel(hDeviceList, 0));
|
IGNORE_RETVAL(ComboBox_SetCurSel(hDeviceList, 0));
|
||||||
SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE<<16) | IDC_DEVICE, 0);
|
SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE<<16) | IDC_DEVICE, 0);
|
||||||
|
SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE<<16) | IDC_FILESYSTEM,
|
||||||
|
ComboBox_GetCurSel(hFileSystem));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -584,11 +585,10 @@ static void InitProgress(void)
|
||||||
}
|
}
|
||||||
nb_slots[OP_PARTITION] = 1;
|
nb_slots[OP_PARTITION] = 1;
|
||||||
nb_slots[OP_FIX_MBR] = 1;
|
nb_slots[OP_FIX_MBR] = 1;
|
||||||
nb_slots[OP_FORMAT_QUICK] =
|
nb_slots[OP_CREATE_FS] =
|
||||||
nb_steps[ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem))];
|
nb_steps[ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem))];
|
||||||
nb_slots[OP_FORMAT_DONE] = 1;
|
|
||||||
if (!IsChecked(IDC_QUICKFORMAT)) {
|
if (!IsChecked(IDC_QUICKFORMAT)) {
|
||||||
nb_slots[OP_FORMAT_LONG] = -1;
|
nb_slots[OP_FORMAT] = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=0; i<OP_MAX; i++) {
|
for (i=0; i<OP_MAX; i++) {
|
||||||
|
@ -866,14 +866,6 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
||||||
KillTimer(hMainDialog, TID_APP_TIMER);
|
KillTimer(hMainDialog, TID_APP_TIMER);
|
||||||
// Close the cancel MessageBox if active
|
// Close the cancel MessageBox if active
|
||||||
SendMessage(FindWindowA(MAKEINTRESOURCEA(32770), RUFUS_CANCELBOX_TITLE), WM_COMMAND, IDNO, 0);
|
SendMessage(FindWindowA(MAKEINTRESOURCEA(32770), RUFUS_CANCELBOX_TITLE), WM_COMMAND, IDNO, 0);
|
||||||
if (FormatStatus) {
|
|
||||||
SendMessage(hProgress, PBM_SETPOS, 0, 0);
|
|
||||||
} else {
|
|
||||||
// This is the only way to achieve instantenous progress transition
|
|
||||||
SendMessage(hProgress, PBM_SETRANGE, 0, (MAX_PROGRESS+1)<<16);
|
|
||||||
SendMessage(hProgress, PBM_SETPOS, (MAX_PROGRESS+1), 0);
|
|
||||||
SendMessage(hProgress, PBM_SETRANGE, 0, MAX_PROGRESS<<16);
|
|
||||||
}
|
|
||||||
EnableControls(TRUE);
|
EnableControls(TRUE);
|
||||||
GetUSBDevices();
|
GetUSBDevices();
|
||||||
if (!IS_ERROR(FormatStatus)) {
|
if (!IS_ERROR(FormatStatus)) {
|
||||||
|
@ -885,6 +877,14 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
||||||
PrintStatus(0, "FAILED");
|
PrintStatus(0, "FAILED");
|
||||||
Notification(MSG_ERROR, "Error", "Error: %s", StrError(FormatStatus));
|
Notification(MSG_ERROR, "Error", "Error: %s", StrError(FormatStatus));
|
||||||
}
|
}
|
||||||
|
if (FormatStatus) {
|
||||||
|
SendMessage(hProgress, PBM_SETPOS, 0, 0);
|
||||||
|
} else {
|
||||||
|
// This is the only way to achieve instantenous progress transition
|
||||||
|
SendMessage(hProgress, PBM_SETRANGE, 0, (MAX_PROGRESS+1)<<16);
|
||||||
|
SendMessage(hProgress, PBM_SETPOS, (MAX_PROGRESS+1), 0);
|
||||||
|
SendMessage(hProgress, PBM_SETRANGE, 0, MAX_PROGRESS<<16);
|
||||||
|
}
|
||||||
return (INT_PTR)TRUE;
|
return (INT_PTR)TRUE;
|
||||||
}
|
}
|
||||||
return (INT_PTR)FALSE;
|
return (INT_PTR)FALSE;
|
||||||
|
|
|
@ -94,9 +94,8 @@ enum action_type {
|
||||||
OP_BADBLOCKS,
|
OP_BADBLOCKS,
|
||||||
OP_ZERO_MBR,
|
OP_ZERO_MBR,
|
||||||
OP_PARTITION,
|
OP_PARTITION,
|
||||||
OP_FORMAT_LONG,
|
OP_FORMAT,
|
||||||
OP_FORMAT_QUICK,
|
OP_CREATE_FS,
|
||||||
OP_FORMAT_DONE,
|
|
||||||
OP_FIX_MBR,
|
OP_FIX_MBR,
|
||||||
OP_DOS,
|
OP_DOS,
|
||||||
OP_MAX
|
OP_MAX
|
||||||
|
|
14
src/rufus.rc
14
src/rufus.rc
|
@ -30,7 +30,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL
|
||||||
IDD_DIALOG DIALOGEX 12, 12, 206, 278
|
IDD_DIALOG DIALOGEX 12, 12, 206, 278
|
||||||
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.2.85 (Beta)"
|
CAPTION "Rufus v1.0.2.86 (Beta)"
|
||||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||||
BEGIN
|
BEGIN
|
||||||
DEFPUSHBUTTON "Start",IDC_START,94,236,50,14
|
DEFPUSHBUTTON "Start",IDC_START,94,236,50,14
|
||||||
|
@ -47,7 +47,7 @@ BEGIN
|
||||||
GROUPBOX "Format Options",IDC_STATIC,7,149,189,52
|
GROUPBOX "Format Options",IDC_STATIC,7,149,189,52
|
||||||
EDITTEXT IDC_LABEL,7,131,190,13,ES_AUTOHSCROLL
|
EDITTEXT IDC_LABEL,7,131,190,13,ES_AUTOHSCROLL
|
||||||
CONTROL "&Quick Format",IDC_QUICKFORMAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,161,58,10
|
CONTROL "&Quick Format",IDC_QUICKFORMAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,161,58,10
|
||||||
CONTROL "Create an &MS-DOS startup disk",IDC_DOS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,173,115,10
|
CONTROL "Create a &DOS bootable disk",IDC_DOS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,173,115,10
|
||||||
LTEXT "New volume &label",IDC_STATIC,9,121,105,10
|
LTEXT "New volume &label",IDC_STATIC,9,121,105,10
|
||||||
CONTROL "",IDC_PROGRESS,"msctls_progress32",PBS_SMOOTH | WS_BORDER,7,210,189,9
|
CONTROL "",IDC_PROGRESS,"msctls_progress32",PBS_SMOOTH | WS_BORDER,7,210,189,9
|
||||||
CONTROL "Check device for bad blocks",IDC_BADBLOCKS,
|
CONTROL "Check device for bad blocks",IDC_BADBLOCKS,
|
||||||
|
@ -65,7 +65,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.2 (Build 85)",IDC_STATIC,46,19,78,8
|
LTEXT "Version 1.0.2 (Build 86)",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
|
||||||
|
@ -164,8 +164,8 @@ END
|
||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 1,0,2,85
|
FILEVERSION 1,0,2,86
|
||||||
PRODUCTVERSION 1,0,2,85
|
PRODUCTVERSION 1,0,2,86
|
||||||
FILEFLAGSMASK 0x3fL
|
FILEFLAGSMASK 0x3fL
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
FILEFLAGS 0x1L
|
FILEFLAGS 0x1L
|
||||||
|
@ -182,13 +182,13 @@ BEGIN
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "CompanyName", "akeo.ie"
|
VALUE "CompanyName", "akeo.ie"
|
||||||
VALUE "FileDescription", "Rufus"
|
VALUE "FileDescription", "Rufus"
|
||||||
VALUE "FileVersion", "1.0.2.85"
|
VALUE "FileVersion", "1.0.2.86"
|
||||||
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.2.85"
|
VALUE "ProductVersion", "1.0.2.86"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue