mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[ui] report ISO progress in main/icon progressbar
* Also improve granularity for ISO progress * Also fixes an issue with badblocks report
This commit is contained in:
parent
8d2fd913b0
commit
bb76f1f636
6 changed files with 37 additions and 20 deletions
|
@ -566,6 +566,9 @@ BOOL BadBlocks(HANDLE hPhysicalDrive, ULONGLONG disk_size, size_t block_size,
|
|||
blk_t first_block = 0, last_block = disk_size/block_size;
|
||||
|
||||
if (report == NULL) return FALSE;
|
||||
num_read_errors = 0;
|
||||
num_write_errors = 0;
|
||||
num_corruption_errors = 0;
|
||||
report->bb_count = 0;
|
||||
if (fd != NULL) {
|
||||
log_fd = fd;
|
||||
|
|
12
src/format.c
12
src/format.c
|
@ -659,7 +659,7 @@ static BOOL SetupWinPE(char drive_letter)
|
|||
continue;
|
||||
uprintf(" 0x%08X: '%s' -> '%s'\n", i, &buf[i], patch_str_rep[j]);
|
||||
strcpy(&buf[i], patch_str_rep[j]);
|
||||
i += max(strlen(patch_str_org[j]), strlen(patch_str_rep[j])); // in case org is a substring of rep
|
||||
i += (DWORD)max(strlen(patch_str_org[j]), strlen(patch_str_rep[j])); // in case org is a substring of rep
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -898,8 +898,8 @@ DWORD WINAPI FormatThread(LPVOID param)
|
|||
goto out;
|
||||
|
||||
if (IsChecked(IDC_DOS)) {
|
||||
UpdateProgress(OP_DOS, -1.0f);
|
||||
if ((dt == DT_WINME) || (dt == DT_FREEDOS)) {
|
||||
UpdateProgress(OP_DOS, -1.0f);
|
||||
PrintStatus(0, TRUE, "Copying DOS files...");
|
||||
if (!ExtractDOS(drive_name)) {
|
||||
if (!FormatStatus)
|
||||
|
@ -908,6 +908,7 @@ DWORD WINAPI FormatThread(LPVOID param)
|
|||
}
|
||||
} else if (dt == DT_ISO) {
|
||||
if (iso_path != NULL) {
|
||||
UpdateProgress(OP_DOS, 0.0f);
|
||||
PrintStatus(0, TRUE, "Copying ISO files...");
|
||||
drive_name[2] = 0;
|
||||
if (!ExtractISO(iso_path, drive_name, FALSE)) {
|
||||
|
@ -922,14 +923,17 @@ DWORD WINAPI FormatThread(LPVOID param)
|
|||
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|APPERR(ERROR_CANT_PATCH);
|
||||
}
|
||||
}
|
||||
UpdateProgress(OP_FINALIZE, -1.0f);
|
||||
PrintStatus(0, TRUE, "Finalizing...");
|
||||
if (IsChecked(IDC_SET_ICON))
|
||||
SetAutorun(drive_name);
|
||||
UpdateProgress(OP_DOS, -1.0f);
|
||||
// Issue another complete remount before we exit, to ensure we're clean
|
||||
RemountVolume(drive_name[0]);
|
||||
// NTFS fixup (WinPE/AIK images don't seem to boot without an extra checkdisk)
|
||||
if ((dt == DT_ISO) && (fs == FS_NTFS))
|
||||
if ((dt == DT_ISO) && (fs == FS_NTFS)) {
|
||||
CheckDisk(drive_name[0]);
|
||||
UpdateProgress(OP_FINALIZE, -1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
|
||||
// How often should we update the progress bar (in 2K blocks) as updating
|
||||
// the progress bar for every block will bring extraction to a crawl
|
||||
#define PROGRESS_THRESHOLD 1024
|
||||
#define PROGRESS_THRESHOLD 128
|
||||
#define FOUR_GIGABYTES 4294967296LL
|
||||
|
||||
// Needed for UDF ISO access
|
||||
|
@ -237,6 +237,7 @@ static int udf_extract_files(udf_t *p_udf, udf_dirent_t *p_udf_dirent, const cha
|
|||
i_file_length -= i_read;
|
||||
if (nb_blocks++ % PROGRESS_THRESHOLD == 0) {
|
||||
SendMessage(hISOProgressBar, PBM_SETPOS, (WPARAM)((MAX_PROGRESS*nb_blocks)/total_blocks), 0);
|
||||
UpdateProgress(OP_DOS, 100.0f*nb_blocks/total_blocks);
|
||||
}
|
||||
}
|
||||
// If you have a fast USB 3.0 device, the default Windows buffering does an
|
||||
|
@ -352,6 +353,7 @@ static int iso_extract_files(iso9660_t* p_iso, const char *psz_path)
|
|||
i_file_length -= ISO_BLOCKSIZE;
|
||||
if (nb_blocks++ % PROGRESS_THRESHOLD == 0) {
|
||||
SendMessage(hISOProgressBar, PBM_SETPOS, (WPARAM)((MAX_PROGRESS*nb_blocks)/total_blocks), 0);
|
||||
UpdateProgress(OP_DOS, 100.0f*nb_blocks/total_blocks);
|
||||
}
|
||||
}
|
||||
ISO_BLOCKING(safe_closehandle(file_handle));
|
||||
|
|
25
src/rufus.c
25
src/rufus.c
|
@ -698,9 +698,11 @@ static BOOL GetUSBDevices(DWORD devnum)
|
|||
*/
|
||||
static void InitProgress(void)
|
||||
{
|
||||
int i;
|
||||
int i, dt, fs;
|
||||
float last_end = 0.0f, slots_discrete = 0.0f, slots_analog = 0.0f;
|
||||
|
||||
fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem));
|
||||
dt = (int)ComboBox_GetItemData(hDOSType, ComboBox_GetCurSel(hDOSType));
|
||||
memset(&nb_slots, 0, sizeof(nb_slots));
|
||||
memset(&slot_end, 0, sizeof(slot_end));
|
||||
previous_end = 0.0f;
|
||||
|
@ -711,15 +713,18 @@ static void InitProgress(void)
|
|||
}
|
||||
if (IsChecked(IDC_DOS)) {
|
||||
// 1 extra slot for PBR writing
|
||||
switch (ComboBox_GetItemData(hDOSType, ComboBox_GetCurSel(hDOSType))) {
|
||||
switch (dt) {
|
||||
case DT_WINME:
|
||||
nb_slots[OP_DOS] = 4+1;
|
||||
nb_slots[OP_DOS] = 3+1;
|
||||
break;
|
||||
case DT_FREEDOS:
|
||||
nb_slots[OP_DOS] = 6+1;
|
||||
nb_slots[OP_DOS] = 5+1;
|
||||
break;
|
||||
case DT_ISO:
|
||||
nb_slots[OP_DOS] = -1;
|
||||
break;
|
||||
default:
|
||||
nb_slots[OP_DOS] = 3+1;
|
||||
nb_slots[OP_DOS] = 2+1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -730,6 +735,7 @@ static void InitProgress(void)
|
|||
if (!IsChecked(IDC_QUICKFORMAT)) {
|
||||
nb_slots[OP_FORMAT] = -1;
|
||||
}
|
||||
nb_slots[OP_FINALIZE] = ((dt == DT_ISO) && (fs == FS_NTFS))?2:1;
|
||||
|
||||
for (i=0; i<OP_MAX; i++) {
|
||||
if (nb_slots[i] > 0) {
|
||||
|
@ -1430,6 +1436,11 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
return (INT_PTR)TRUE;
|
||||
}
|
||||
FormatStatus = 0;
|
||||
// Reset all progress bars
|
||||
SendMessage(hProgress, PBM_SETSTATE, (WPARAM)PBST_NORMAL, 0);
|
||||
SetTaskbarProgressState(TASKBAR_NORMAL);
|
||||
SetTaskbarProgressValue(0, MAX_PROGRESS);
|
||||
SendMessage(hProgress, PBM_SETPOS, 0, 0);
|
||||
selection_default = (int)ComboBox_GetItemData(hDOSType, ComboBox_GetCurSel(hDOSType));
|
||||
nDeviceIndex = ComboBox_GetCurSel(hDeviceList);
|
||||
if (nDeviceIndex != CB_ERR) {
|
||||
|
@ -1462,10 +1473,6 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
_snwprintf(wstr, ARRAYSIZE(wstr), L"WARNING: ALL DATA ON DEVICE %s\r\nWILL BE DESTROYED.\r\n"
|
||||
L"To continue with this operation, click OK. To quit click CANCEL.", wtmp);
|
||||
if (MessageBoxW(hMainDialog, wstr, L"Rufus", MB_OKCANCEL|MB_ICONWARNING) == IDOK) {
|
||||
// Reset all progress bars
|
||||
SendMessage(hProgress, PBM_SETSTATE, (WPARAM)PBST_NORMAL, 0);
|
||||
SetTaskbarProgressState(TASKBAR_NORMAL);
|
||||
SetTaskbarProgressValue(0, MAX_PROGRESS);
|
||||
// Disable all controls except cancel
|
||||
EnableControls(FALSE);
|
||||
DeviceNum = (DWORD)ComboBox_GetItemData(hDeviceList, nDeviceIndex);
|
||||
|
|
|
@ -107,6 +107,7 @@ enum action_type {
|
|||
OP_CREATE_FS,
|
||||
OP_FIX_MBR,
|
||||
OP_DOS,
|
||||
OP_FINALIZE,
|
||||
OP_MAX
|
||||
};
|
||||
|
||||
|
|
12
src/rufus.rc
12
src/rufus.rc
|
@ -30,7 +30,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL
|
|||
IDD_DIALOG DIALOGEX 12, 12, 206, 289
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
EXSTYLE WS_EX_APPWINDOW
|
||||
CAPTION "Rufus v1.2.0.164"
|
||||
CAPTION "Rufus v1.2.0.165"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "Start",IDC_START,94,248,50,14
|
||||
|
@ -71,7 +71,7 @@ BEGIN
|
|||
DEFPUSHBUTTON "OK",IDOK,231,175,50,14,WS_GROUP
|
||||
CONTROL "<a href=""http://rufus.akeo.ie"">http://rufus.akeo.ie</a>",IDC_ABOUT_RUFUS_URL,
|
||||
"SysLink",WS_TABSTOP,46,47,114,9
|
||||
LTEXT "Version 1.2.0 (Build 164)",IDC_STATIC,46,19,78,8
|
||||
LTEXT "Version 1.2.0 (Build 165)",IDC_STATIC,46,19,78,8
|
||||
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
|
||||
LTEXT "Report bugs or request enhancements at:",IDC_STATIC,46,66,187,8
|
||||
|
@ -216,8 +216,8 @@ END
|
|||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,2,0,164
|
||||
PRODUCTVERSION 1,2,0,164
|
||||
FILEVERSION 1,2,0,165
|
||||
PRODUCTVERSION 1,2,0,165
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
@ -234,13 +234,13 @@ BEGIN
|
|||
BEGIN
|
||||
VALUE "CompanyName", "akeo.ie"
|
||||
VALUE "FileDescription", "Rufus"
|
||||
VALUE "FileVersion", "1.2.0.164"
|
||||
VALUE "FileVersion", "1.2.0.165"
|
||||
VALUE "InternalName", "Rufus"
|
||||
VALUE "LegalCopyright", "© 2011 Pete Batard (GPL v3)"
|
||||
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
|
||||
VALUE "OriginalFilename", "rufus.exe"
|
||||
VALUE "ProductName", "Rufus"
|
||||
VALUE "ProductVersion", "1.2.0.164"
|
||||
VALUE "ProductVersion", "1.2.0.165"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
|
Loading…
Reference in a new issue