diff --git a/res/localization/rufus.loc b/res/localization/rufus.loc index 0138952c..96fd60dc 100644 --- a/res/localization/rufus.loc +++ b/res/localization/rufus.loc @@ -126,12 +126,6 @@ t IDS_NEW_VERSION_DOWNLOAD_GRP "Download" t IDC_DOWNLOAD "Download" t IDCANCEL "Close" -# Dialog that appears when scanning/extracting ISO files -g IDD_ISO_EXTRACT -t IDD_ISO_EXTRACT "Copying ISO files..." -t IDC_ISO_FILENAME "Opening ISO image - please wait..." -t IDC_ISO_ABORT "Cancel" - # Messages used throughout the application t MSG_001 "Other instance detected" t MSG_002 "Another Rufus application is running.\n" @@ -366,6 +360,9 @@ t MSG_186 "Rufus does not install or run background services, therefore update c t MSG_187 "Invalid image for selected boot option" t MSG_188 "The current image doesn't match the boot option selected. Please use a different image or choose a different boot option." t MSG_189 "This ISO image is not compatible with the selected filesystem" +t MSG_190 "No image selected" +t MSG_191 "Write pass" +t MSG_192 "Read pass" # Status messages - these messages will appear on the status bar t MSG_201 "Cancelling - Please wait..." @@ -373,8 +370,8 @@ t MSG_202 "Scanning image..." t MSG_203 "Failed to scan image" # Parameter: the name of an obsolete Syslinux .c32 module. eg: "Obsolete vesamenu.c32 detected" t MSG_204 "Obsolete %s detected" -# Display the name of the ISO selected. eg: "Using ISO: en_win7_x64_sp1.iso" -t MSG_205 "Using ISO: %s" +# Display the name of the image selected. eg: "Using image: en_win7_x64_sp1.iso" +t MSG_205 "Using image: %s" # Typically "Missing ldlinux.c32 file" t MSG_206 "Missing %s file" # The name proposed by Windows' Computer Management -> Disk Management when you try to format a drive @@ -383,9 +380,9 @@ t MSG_207 "New Volume" # Same message, once for singular and plural ("1 device found", "2 devices found") t MSG_208 "%d device found" t MSG_209 "%d devices found" -t MSG_210 "DONE" +t MSG_210 "READY" t MSG_211 "Cancelled" -t MSG_212 "FAILED" +t MSG_212 "Failed" # Used when a new update has been downloaded and launched t MSG_213 "Launching new application..." t MSG_214 "Failed to launch new application" @@ -416,8 +413,9 @@ t MSG_232 "Win7 EFI boot setup (this may take a while)..." t MSG_233 "Finalizing, please wait..." # Takes a Syslinux version as parameter, eg. "Installing Syslinux v5.10..." t MSG_234 "Installing Syslinux %s..." -# Bad blocks status. eg: "Bad Blocks: PASS 1/2 - 12.34% (0/0/1 errors)" -t MSG_235 "Bad Blocks: PASS %d/%d - %0.2f%% (%d/%d/%d errors)" +# Bad blocks status. eg: "Bad Blocks: Write pass 1/2 - 12.34% (0/0/1 errors)" +# See MSG_191/192 for "Write pass"/"Read pass" translation +t MSG_235 "Bad Blocks: %s %d/%d - %0.2f%% (%d/%d/%d errors)" t MSG_236 "Bad Blocks: Testing with random pattern" t MSG_237 "Bad Blocks: Testing with pattern 0x%02X" # eg. "Partitioning (MBR)..." diff --git a/src/badblocks.c b/src/badblocks.c index 5288bb5b..b476171b 100644 --- a/src/badblocks.c +++ b/src/badblocks.c @@ -7,7 +7,7 @@ * * Copyright 1995, 1996, 1997, 1998, 1999 by Theodore Ts'o * Copyright 1999 by David Beattie - * Copyright 2011-2013 by Pete Batard + * Copyright 2011-2015 by Pete Batard * * This file is based on the minix file system programs fsck and mkfs * written and copyrighted by Linus Torvalds @@ -327,13 +327,13 @@ static void print_status(void) percent = calc_percent((unsigned long) currently_testing, (unsigned long) num_blocks); - percent = (percent/2.0f) + ((cur_op==OP_READ)? 50.0f : 0.0f); - PrintStatus(0, FALSE, MSG_235, + PrintInfo(0, MSG_235, lmprintf(MSG_191 + ((cur_op==OP_WRITE)?0:1)), cur_pattern, nr_pattern, percent, num_read_errors, num_write_errors, num_corruption_errors); + percent = (percent/2.0f) + ((cur_op==OP_READ)? 50.0f : 0.0f); UpdateProgress(OP_BADBLOCKS, (((cur_pattern-1)*100.0f) + percent) / nr_pattern); } @@ -359,7 +359,7 @@ static void pattern_fill(unsigned char *buffer, unsigned int pattern, for (ptr = buffer; ptr < buffer + n; ptr++) { (*ptr) = rand() % (1 << (8 * sizeof(char))); } - PrintStatus(3500, FALSE, MSG_236); + PrintInfo(3500, MSG_236); } else { bpattern[0] = 0; for (i = 0; i < sizeof(bpattern); i++) { @@ -376,7 +376,7 @@ static void pattern_fill(unsigned char *buffer, unsigned int pattern, else i--; } - PrintStatus(3500, FALSE, MSG_237, bpattern[i]); + PrintInfo(3500, MSG_237, bpattern[i]); cur_pattern++; } } diff --git a/src/bled/bled.c b/src/bled/bled.c index 08d70a2c..9e87b794 100644 --- a/src/bled/bled.c +++ b/src/bled/bled.c @@ -1,7 +1,7 @@ /* * Bled (Busybox Library for Easy Decompression) * - * Copyright © 2014 Pete Batard + * Copyright © 2014-2015 Pete Batard * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ @@ -22,6 +22,7 @@ smallint bb_got_signal; uint64_t bb_total_rb; printf_t bled_printf = NULL; progress_t bled_progress = NULL; +unsigned long* bled_cancel_request; static bool bled_initialized = 0; jmp_buf bb_error_jmp; @@ -124,20 +125,31 @@ int64_t bled_uncompress_with_handles(HANDLE hSrc, HANDLE hDst, int type) return unpacker[type](&xstate); } -int bled_init(printf_t print_function, progress_t progress_function) +/* Initialize the library. + * When the parameters are not NULL you can: + * - specify the printf-like function you want to use to output message + * void print_function(const char* format, ...); + * - specify the function you want to use to display progress, based on number of source archive bytes read + * void progress_function(const uint64_t read_bytes); + * - point to an unsigned long variable, to be used to cancel operations when set to non zero + */ +int bled_init(printf_t print_function, progress_t progress_function, unsigned long* cancel_request) { if (bled_initialized) return -1; bled_initialized = true; bled_printf = print_function; bled_progress = progress_function; + bled_cancel_request = cancel_request; return 0; } +/* This call frees any resource used by the library */ void bled_exit(void) { bled_printf = NULL; bled_progress = NULL; + bled_cancel_request = NULL; if (global_crc32_table) free(global_crc32_table); bled_initialized = false; diff --git a/src/bled/bled.h b/src/bled/bled.h index 99562238..c315efe6 100644 --- a/src/bled/bled.h +++ b/src/bled/bled.h @@ -1,7 +1,7 @@ /* * Bled (Busybox Library for Easy Decompression) * - * Copyright © 2014 Pete Batard + * Copyright © 2014-2015 Pete Batard * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ @@ -12,11 +12,11 @@ #pragma once #ifndef ARRAYSIZE -#define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0])) +#define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0])) #endif typedef void (*printf_t) (const char* format, ...); -typedef void (*progress_t) (const uint64_t processed_bytes); +typedef void (*progress_t) (const uint64_t read_bytes); typedef enum { BLED_COMPRESSION_NONE = 0, @@ -33,9 +33,18 @@ typedef enum { /* Uncompress file 'src', compressed using 'type', to file 'dst' */ int64_t bled_uncompress(const char* src, const char* dst, int type); +/* Uncompress using Windows handles */ int64_t bled_uncompress_with_handles(HANDLE hSrc, HANDLE hDst, int type); -/* Initialize the library */ -int bled_init(printf_t print_function, progress_t progress_function); +/* Initialize the library. + * When the parameters are not NULL you can: + * - specify the printf-like function you want to use to output message + * void print_function(const char* format, ...); + * - specify the function you want to use to display progress, based on number of source archive bytes read + * void progress_function(const uint64_t read_bytes); + * - point to an unsigned long variable, to be used to cancel operations when set to non zero + */ +int bled_init(printf_t print_function, progress_t progress_function, unsigned long* cancel_request); +/* This call frees any resource used by the library */ void bled_exit(void); diff --git a/src/bled/decompress_unxz.c b/src/bled/decompress_unxz.c index 54d68889..c4dc284c 100644 --- a/src/bled/decompress_unxz.c +++ b/src/bled/decompress_unxz.c @@ -1,7 +1,8 @@ /* * unxz implementation for busybox * - * Based on xz-embedded (C) Lasse Collin - Public Domain + * Copyright © 2014-2015 Pete Batard + * Based on xz-embedded © Lasse Collin - Public Domain * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ @@ -46,9 +47,8 @@ IF_DESKTOP(long long) int FAST_FUNC unpack_xz_stream(transformer_state_t *xstate */ s = xz_dec_init(XZ_DYNALLOC, 1 << 26); if (!s) - bb_error_msg_and_err("memory allocation failed"); + bb_error_msg_and_err("memory allocation error"); - // TODO: this is set very low on Windows... in = xmalloc(BUFSIZ); out = xmalloc(BUFSIZ); @@ -63,7 +63,7 @@ IF_DESKTOP(long long) int FAST_FUNC unpack_xz_stream(transformer_state_t *xstate if (b.in_pos == b.in_size) { b.in_size = safe_read(xstate->src_fd, in, BUFSIZ); if ((int)b.in_size < 0) - bb_error_msg_and_err(bb_msg_read_error); + bb_error_msg_and_err("read error (errno: %d)", errno); b.in_pos = 0; } ret = xz_dec_run(s, &b); @@ -72,7 +72,7 @@ IF_DESKTOP(long long) int FAST_FUNC unpack_xz_stream(transformer_state_t *xstate nwrote = transformer_write(xstate, b.out, b.out_pos); if (nwrote == (ssize_t)-1) { ret = XZ_DATA_ERROR; - bb_error_msg_and_err("write error"); + bb_error_msg_and_err("write error (errno: %d)", errno); } IF_DESKTOP(n += nwrote;) b.out_pos = 0; @@ -91,7 +91,7 @@ IF_DESKTOP(long long) int FAST_FUNC unpack_xz_stream(transformer_state_t *xstate nwrote = transformer_write(xstate, b.out, b.out_pos); if (nwrote == (ssize_t)-1) { ret = XZ_DATA_ERROR; - bb_error_msg_and_err("write error"); + bb_error_msg_and_err("write error (errno: %d)", errno); } IF_DESKTOP(n += nwrote;) @@ -101,24 +101,24 @@ IF_DESKTOP(long long) int FAST_FUNC unpack_xz_stream(transformer_state_t *xstate goto out; case XZ_MEM_ERROR: - bb_error_msg_and_err("memory allocation failed"); + bb_error_msg_and_err("memory allocation error"); case XZ_MEMLIMIT_ERROR: - bb_error_msg_and_err("memory usage limit reached"); + bb_error_msg_and_err("memory usage limit error"); case XZ_FORMAT_ERROR: bb_error_msg_and_err("not a .xz file"); case XZ_OPTIONS_ERROR: - bb_error_msg_and_err("unsupported options in the .xz headers"); + bb_error_msg_and_err("unsupported XZ header option"); case XZ_DATA_ERROR: - bb_error_msg_and_err("file is corrupt"); + bb_error_msg_and_err("corrupted archive"); case XZ_BUF_ERROR: - bb_error_msg_and_err("buf is corrupt"); + bb_error_msg_and_err("corrupted buffer"); default: - bb_error_msg_and_err("bug!"); + bb_error_msg_and_err("XZ decompression bug!"); } } diff --git a/src/bled/libbb.h b/src/bled/libbb.h index 0cdc92bb..fe5e8add 100644 --- a/src/bled/libbb.h +++ b/src/bled/libbb.h @@ -2,7 +2,7 @@ * Library header for busybox * * Rewritten for Bled (Busybox Library for Easy Decompression) - * Copyright © 2014 Pete Batard + * Copyright © 2014-2015 Pete Batard * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ @@ -135,6 +135,7 @@ typedef struct _llist_t { extern void (*bled_printf) (const char* format, ...); extern void (*bled_progress) (const uint64_t processed_bytes); +extern unsigned long* bled_cancel_request; #define xfunc_die() longjmp(bb_error_jmp, 1) #define bb_printf(...) do { if (bled_printf != NULL) bled_printf(__VA_ARGS__); \ @@ -171,7 +172,13 @@ static inline pid_t wait(int* status) { *status = 4; return -1; } /* This override enables the display of a progress based on the number of bytes read */ extern uint64_t bb_total_rb; static inline ssize_t full_read(int fd, void *buf, size_t count) { - ssize_t rb = _read(fd, buf, count); + ssize_t rb; + if ((bled_cancel_request != NULL) && (*bled_cancel_request != 0)) { + errno = EINTR; + return -1; + } + + rb = _read(fd, buf, count); if (rb > 0) { bb_total_rb += rb; if (bled_progress != NULL) diff --git a/src/drive.c b/src/drive.c index a5463b79..09501210 100644 --- a/src/drive.c +++ b/src/drive.c @@ -1,7 +1,7 @@ /* * Rufus: The Reliable USB Formatting Utility * Drive access function calls - * Copyright © 2011-2014 Pete Batard + * Copyright © 2011-2015 Pete Batard * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -915,7 +915,7 @@ BOOL CreatePartition(HANDLE hDrive, int partition_style, int file_system, BOOL m DWORD size, bufsize; LONGLONG size_in_sectors, extra_size_in_tracks = 1; - PrintStatus(0, TRUE, MSG_238, PartitionTypeName[partition_style]); + PrintInfoDebug(0, MSG_238, PartitionTypeName[partition_style]); if (uefi_togo_size == 0) uefi_togo_size = GetResourceSize(hMainInstance, MAKEINTRESOURCEA(IDR_UEFI_TOGO), _RT_RCDATA, "uefi-togo.img"); @@ -1117,7 +1117,7 @@ BOOL DeletePartitions(HANDLE hDrive) DWORD size; CREATE_DISK CreateDisk = {PARTITION_STYLE_RAW, {{0}}}; - PrintStatus(0, TRUE, MSG_239); + PrintInfoDebug(0, MSG_239); size = sizeof(CreateDisk); r = DeviceIoControl(hDrive, IOCTL_DISK_CREATE_DISK, diff --git a/src/format.c b/src/format.c index 86893b66..c27610ca 100644 --- a/src/format.c +++ b/src/format.c @@ -2,7 +2,7 @@ * Rufus: The Reliable USB Formatting Utility * Formatting function calls * Copyright © 2007-2009 Tom Thornhill/Ridgecrop - * Copyright © 2011-2014 Pete Batard + * Copyright © 2011-2015 Pete Batard * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -107,18 +107,18 @@ static BOOLEAN __stdcall FormatExCallback(FILE_SYSTEM_CALLBACK_COMMAND Command, switch(Command) { case FCC_PROGRESS: percent = (DWORD*)pData; - PrintStatus(0, FALSE, MSG_217, 1.0f * (*percent)); + PrintInfo(0, MSG_217, 1.0f * (*percent)); UpdateProgress(OP_FORMAT, 1.0f * (*percent)); break; case FCC_STRUCTURE_PROGRESS: // No progress on quick format if (task_number < nb_steps[fs_index] - 1) { - PrintStatus(0, TRUE, MSG_218, ++task_number, nb_steps[fs_index]); + PrintInfoDebug(0, MSG_218, ++task_number, nb_steps[fs_index]); format_percent += 100.0f / (1.0f * nb_steps[fs_index]); UpdateProgress(OP_CREATE_FS, format_percent); } break; case FCC_DONE: - PrintStatus(0, TRUE, MSG_218, nb_steps[fs_index], nb_steps[fs_index]); + PrintInfoDebug(0, MSG_218, nb_steps[fs_index], nb_steps[fs_index]); UpdateProgress(OP_CREATE_FS, 100.0f); if(*(BOOLEAN*)pData == FALSE) { uprintf("Error while formatting"); @@ -198,7 +198,7 @@ static BOOLEAN __stdcall ChkdskCallback(FILE_SYSTEM_CALLBACK_COMMAND Command, DW case FCC_PROGRESS: case FCC_CHECKDISK_PROGRESS: percent = (DWORD*)pData; - PrintStatus(0, FALSE, MSG_219, *percent); + PrintInfo(0, MSG_219, *percent); break; case FCC_DONE: if(*(BOOLEAN*)pData == FALSE) { @@ -414,7 +414,7 @@ static BOOL FormatFAT32(DWORD DriveIndex) // Debug temp vars ULONGLONG FatNeeded, ClusterCount; - PrintStatus(0, TRUE, MSG_222, "Large FAT32"); + PrintInfoDebug(0, MSG_222, "Large FAT32"); LastRefresh = 0; VolumeId = GetVolumeID(); @@ -620,7 +620,7 @@ static BOOL FormatFAT32(DWORD DriveIndex) if (GetTickCount() > LastRefresh + 25) { LastRefresh = GetTickCount(); format_percent = (100.0f*i)/(1.0f*(SystemAreaSize+BurstSize)); - PrintStatus(0, FALSE, MSG_217, format_percent); + PrintInfo(0, MSG_217, format_percent); UpdateProgress(OP_FORMAT, format_percent); } if (IS_ERROR(FormatStatus)) goto out; // For cancellation @@ -645,7 +645,7 @@ static BOOL FormatFAT32(DWORD DriveIndex) } // Must do it here, as have issues when trying to write the PBR after a remount - PrintStatus(0, TRUE, MSG_229); + PrintInfoDebug(0, MSG_229); if (!WritePBR(hLogicalVolume)) { // Non fatal error, but the drive probably won't boot uprintf("Could not write partition boot record - drive may not boot...\n"); @@ -654,7 +654,7 @@ static BOOL FormatFAT32(DWORD DriveIndex) // Set the FAT32 volume label GetWindowTextW(hLabel, wLabel, ARRAYSIZE(wLabel)); ToValidLabel(wLabel, TRUE); - PrintStatus(0, TRUE, MSG_221); + PrintInfoDebug(0, MSG_221); // Handle must be closed for SetVolumeLabel to work safe_closehandle(hLogicalVolume); VolumeName = GetLogicalName(DriveIndex, TRUE, TRUE); @@ -705,9 +705,9 @@ static BOOL FormatDrive(DWORD DriveIndex) } fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem)); if ((fs == FS_UDF) && !((dur_mins == 0) && (dur_secs == 0))) { - PrintStatus(0, TRUE, MSG_220, FSType, dur_mins, dur_secs); + PrintInfoDebug(0, MSG_220, FSType, dur_mins, dur_secs); } else { - PrintStatus(0, TRUE, MSG_222, FSType); + PrintInfoDebug(0, MSG_222, FSType); } VolumeName = GetLogicalName(DriveIndex, TRUE, TRUE); wVolumeName = utf8_to_wchar(VolumeName); @@ -787,7 +787,7 @@ static BOOL CheckDisk(char DriveLetter) size_t i; wDriveRoot[0] = (WCHAR)DriveLetter; - PrintStatus(0, TRUE, MSG_223); + PrintInfoDebug(0, MSG_223); PF_INIT_OR_OUT(Chkdsk, Fmifs); @@ -816,7 +816,7 @@ static BOOL ClearMBRGPT(HANDLE hPhysicalDrive, LONGLONG DiskSize, DWORD SectorSi uint64_t i, last_sector = DiskSize/SectorSize; unsigned char* pBuf = (unsigned char*) calloc(SectorSize, 1); - PrintStatus(0, TRUE, MSG_224); + PrintInfoDebug(0, MSG_224); if (pBuf == NULL) { FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_NOT_ENOUGH_MEMORY; goto out; @@ -1274,7 +1274,7 @@ void update_progress(const uint64_t processed_bytes) if (GetTickCount() > LastRefresh + 25) { LastRefresh = GetTickCount(); format_percent = (100.0f*processed_bytes)/(1.0f*iso_report.projected_size); - PrintStatus(0, FALSE, MSG_261, format_percent); + PrintInfo(0, MSG_261, format_percent); UpdateProgress(OP_FORMAT, format_percent); } } @@ -1326,7 +1326,7 @@ DWORD WINAPI FormatThread(void* param) use_large_fat32 = (fs == FS_FAT32) && ((SelectedDrive.DiskSize > LARGE_FAT32_SIZE) || (force_large_fat32)); add_uefi_togo = (fs == FS_NTFS) && (dt == DT_ISO) && (IS_EFI(iso_report)) && (bt == BT_UEFI); - PrintStatus(0, TRUE, MSG_225); + PrintInfoDebug(0, MSG_225); hPhysicalDrive = GetPhysicalHandle(DriveIndex, TRUE, TRUE); if (hPhysicalDrive == INVALID_HANDLE_VALUE) { FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_OPEN_FAILED; @@ -1382,7 +1382,7 @@ DWORD WINAPI FormatThread(void* param) } CHECK_FOR_USER_CANCEL; - PrintStatus(0, TRUE, MSG_226); + PrintInfoDebug(0, MSG_226); AnalyzeMBR(hPhysicalDrive, "Drive"); if ((hLogicalVolume != NULL) && (hLogicalVolume != INVALID_HANDLE_VALUE)) { AnalyzePBR(hLogicalVolume); @@ -1481,7 +1481,7 @@ DWORD WINAPI FormatThread(void* param) if (iso_report.compression_type != BLED_COMPRESSION_NONE) { uprintf("Writing Compressed Image..."); - bled_init(_uprintf, update_progress); + bled_init(_uprintf, update_progress, &FormatStatus); bled_uncompress_with_handles(hSourceImage, hPhysicalDrive, iso_report.compression_type); bled_exit(); } else { @@ -1512,7 +1512,7 @@ DWORD WINAPI FormatThread(void* param) if (GetTickCount() > LastRefresh + 25) { LastRefresh = GetTickCount(); format_percent = (100.0f*wb)/(1.0f*iso_report.projected_size); - PrintStatus(0, FALSE, MSG_261, format_percent); + PrintInfo(0, MSG_261, format_percent); UpdateProgress(OP_FORMAT, format_percent); } // Don't overflow our projected size (mostly for VHDs) @@ -1571,7 +1571,7 @@ DWORD WINAPI FormatThread(void* param) // Close the (unmounted) volume before formatting if ((hLogicalVolume != NULL) && (hLogicalVolume != INVALID_HANDLE_VALUE)) { - PrintStatus(0, TRUE, MSG_227); + PrintInfoDebug(0, MSG_227); if (!CloseHandle(hLogicalVolume)) { uprintf("Could not close volume: %s\n", WindowsErrorString()); FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_ACCESS_DENIED; @@ -1598,7 +1598,7 @@ DWORD WINAPI FormatThread(void* param) // Thanks to Microsoft, we must fix the MBR AFTER the drive has been formatted if (pt == PARTITION_STYLE_MBR) { - PrintStatus(0, TRUE, MSG_228); // "Writing master boot record..." + PrintInfoDebug(0, MSG_228); // "Writing master boot record..." if ((!WriteMBR(hPhysicalDrive)) || (!WriteSBR(hPhysicalDrive))) { if (!IS_ERROR(FormatStatus)) FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_WRITE_FAULT; @@ -1646,7 +1646,7 @@ DWORD WINAPI FormatThread(void* param) } // NB: if you unmount the logical volume here, XP will report error: // [0x00000456] The media in the drive may have changed - PrintStatus(0, TRUE, MSG_229); + PrintInfoDebug(0, MSG_229); if (!WritePBR(hLogicalVolume)) { if (!IS_ERROR(FormatStatus)) FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_WRITE_FAULT; @@ -1676,7 +1676,7 @@ DWORD WINAPI FormatThread(void* param) if (IsChecked(IDC_BOOT)) { if ((dt == DT_WINME) || (dt == DT_FREEDOS)) { UpdateProgress(OP_DOS, -1.0f); - PrintStatus(0, TRUE, MSG_230); + PrintInfoDebug(0, MSG_230); if (!ExtractDOS(drive_name)) { if (!IS_ERROR(FormatStatus)) FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_CANNOT_COPY; @@ -1691,7 +1691,7 @@ DWORD WINAPI FormatThread(void* param) } else if (dt == DT_ISO) { if (image_path != NULL) { UpdateProgress(OP_DOS, 0.0f); - PrintStatus(0, TRUE, MSG_231); + PrintInfoDebug(0, MSG_231); drive_name[2] = 0; if (!ExtractISO(image_path, drive_name, FALSE)) { if (!IS_ERROR(FormatStatus)) @@ -1707,7 +1707,7 @@ DWORD WINAPI FormatThread(void* param) } } if ((bt == BT_UEFI) && (!iso_report.has_efi) && (iso_report.has_win7_efi)) { - PrintStatus(0, TRUE, MSG_232); + PrintInfoDebug(0, MSG_232); wim_image[0] = drive_name[0]; efi_dst[0] = drive_name[0]; efi_dst[sizeof(efi_dst) - sizeof("\\bootx64.efi")] = 0; @@ -1730,7 +1730,7 @@ DWORD WINAPI FormatThread(void* param) } } UpdateProgress(OP_FINALIZE, -1.0f); - PrintStatus(0, TRUE, MSG_233); + PrintInfoDebug(0, MSG_233); if (IsChecked(IDC_SET_ICON)) SetAutorun(drive_name); // Issue another complete remount before we exit, to ensure we're clean @@ -1751,7 +1751,6 @@ DWORD WINAPI FormatThread(void* param) out: safe_free(guid_volume); safe_free(buffer); - SendMessage(hISOProgressDlg, UM_PROGRESS_EXIT, 0, 0); safe_closehandle(hSourceImage); safe_unlockclose(hLogicalVolume); safe_unlockclose(hPhysicalDrive); // This can take a while @@ -1778,7 +1777,7 @@ DWORD WINAPI SaveImageThread(void* param) uint64_t wb; int i; - PrintStatus(0, TRUE, MSG_225); + PrintInfoDebug(0, MSG_225); LastRefresh = 0; hPhysicalDrive = GetPhysicalHandle(DriveIndex, FALSE, TRUE); if (hPhysicalDrive == INVALID_HANDLE_VALUE) { @@ -1823,7 +1822,7 @@ DWORD WINAPI SaveImageThread(void* param) if (GetTickCount() > LastRefresh + 25) { LastRefresh = GetTickCount(); format_percent = (100.0f*wb)/(1.0f*SelectedDrive.DiskSize); - PrintStatus(0, FALSE, MSG_261, format_percent); + PrintInfo(0, MSG_261, format_percent); UpdateProgress(OP_FORMAT, format_percent); } for (i=0; i + * Copyright © 2011-2015 Pete Batard * Based on libcdio's iso & udf samples: - * Copyright © 2003-2012 Rocky Bernstein + * Copyright © 2003-2014 Rocky Bernstein * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -98,7 +98,7 @@ static __inline char* sanitize_filename(char* filename, BOOL* is_identical) *is_identical = TRUE; ret = safe_strdup(filename); if (ret == NULL) { - uprintf("Couldn't allocate string for sanitized path"); + uprintf("Could not allocate string for sanitized path"); return NULL; } @@ -282,7 +282,8 @@ static void print_extracted_file(char* psz_fullpath, int64_t i_file_length) safe_sprintf(&psz_fullpath[nul_pos], 24, " (%s)", SizeToHumanReadable(i_file_length, TRUE, FALSE)); uprintf("Extracting: %s\n", psz_fullpath); safe_sprintf(&psz_fullpath[nul_pos], 24, " (%s)", SizeToHumanReadable(i_file_length, FALSE, FALSE)); - SetWindowTextU(hISOFileName, psz_fullpath); + SendMessageLU(GetDlgItem(hMainDialog, IDC_STATUS), SB_SETTEXTW, SBT_OWNERDRAW, psz_fullpath); + PrintStatus(0, MSG_000, psz_fullpath); // MSG_000 is "%s" // ISO9660 cannot handle backslashes for (i=0; i= WRITE_RETRIES) goto out; i_file_length -= i_read; - if (nb_blocks++ % PROGRESS_THRESHOLD == 0) { - SendMessage(hISOProgressBar, PBM_SETPOS, (WPARAM)((MAX_PROGRESS*nb_blocks)/total_blocks), 0); + if (nb_blocks++ % PROGRESS_THRESHOLD == 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 // excellent job at compensating for our small blocks read/writes to max out the @@ -533,10 +532,8 @@ static int iso_extract_files(iso9660_t* p_iso, const char *psz_path) } if (j >= WRITE_RETRIES) goto out; i_file_length -= ISO_BLOCKSIZE; - if (nb_blocks++ % PROGRESS_THRESHOLD == 0) { - SendMessage(hISOProgressBar, PBM_SETPOS, (WPARAM)((MAX_PROGRESS*nb_blocks)/total_blocks), 0); + if (nb_blocks++ % PROGRESS_THRESHOLD == 0) UpdateProgress(OP_DOS, 100.0f*nb_blocks/total_blocks); - } } ISO_BLOCKING(safe_closehandle(file_handle)); if (props.is_syslinux_cfg || props.is_grub_cfg) @@ -583,7 +580,6 @@ BOOL ExtractISO(const char* src_iso, const char* dest_dir, BOOL scan) iso9660_t* p_iso = NULL; udf_t* p_udf = NULL; udf_dirent_t* p_udf_root; - LONG progress_style; char *tmp, *buf, *ext; char path[MAX_PATH]; const char* basedir[] = { "i386", "minint" }; @@ -596,24 +592,20 @@ BOOL ExtractISO(const char* src_iso, const char* dest_dir, BOOL scan) scan_only = scan; cdio_log_set_handler(log_handler); psz_extract_dir = dest_dir; - progress_style = GetWindowLong(hISOProgressBar, GWL_STYLE); + // Change progress style to marquee for scanning if (scan_only) { + SendMessage(hMainDialog, UM_PROGRESS_INIT, PBS_MARQUEE, 0); total_blocks = 0; memset(&iso_report, 0, sizeof(iso_report)); has_ldlinux_c32 = FALSE; // String array of all isolinux/syslinux locations StrArrayCreate(&config_path, 8); StrArrayCreate(&isolinux_path, 8); - // Change the Window title and static text - SetWindowTextU(hISOProgressDlg, lmprintf(MSG_202)); - SetWindowTextU(hISOFileName, lmprintf(MSG_202)); - // Change progress style to marquee for scanning - SetWindowLong(hISOProgressBar, GWL_STYLE, progress_style | PBS_MARQUEE); - SendMessage(hISOProgressBar, PBM_SETMARQUEE, TRUE, 0); + PrintInfo(0, MSG_202); } else { uprintf("Extracting files...\n"); IGNORE_RETVAL(_chdirU(app_dir)); - SetWindowTextU(hISOProgressDlg, lmprintf(MSG_231)); + PrintInfo(0, MSG_231); if (total_blocks == 0) { uprintf("Error: ISO has not been properly scanned.\n"); FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|APPERR(ERROR_ISO_SCAN); @@ -621,10 +613,7 @@ BOOL ExtractISO(const char* src_iso, const char* dest_dir, BOOL scan) } nb_blocks = 0; iso_blocking_status = 0; - SetWindowLong(hISOProgressBar, GWL_STYLE, progress_style & (~PBS_MARQUEE)); - SendMessage(hISOProgressBar, PBM_SETPOS, 0, 0); } - SendMessage(hISOProgressDlg, UM_PROGRESS_INIT, 0, 0); /* First try to open as UDF - fallback to ISO if it failed */ p_udf = udf_open(src_iso); @@ -634,7 +623,7 @@ BOOL ExtractISO(const char* src_iso, const char* dest_dir, BOOL scan) p_udf_root = udf_get_root(p_udf, true, 0); if (p_udf_root == NULL) { - uprintf("Couldn't locate UDF root directory\n"); + uprintf("Could not locate UDF root directory\n"); goto out; } if (scan_only) { @@ -785,6 +774,7 @@ out: } StrArrayDestroy(&config_path); StrArrayDestroy(&isolinux_path); + SendMessage(hMainDialog, UM_PROGRESS_EXIT, 0, 0); } else if (HAS_SYSLINUX(iso_report)) { safe_sprintf(path, sizeof(path), "%s\\syslinux.cfg", dest_dir); // Create a /syslinux.cfg (if none exists) that points to the existing isolinux cfg @@ -808,7 +798,6 @@ out: if (fd != NULL) fclose(fd); } - SendMessage(hISOProgressDlg, UM_PROGRESS_EXIT, 0, 0); if (p_iso != NULL) iso9660_close(p_iso); if (p_udf != NULL) @@ -847,12 +836,12 @@ int64_t ExtractISOFile(const char* iso, const char* iso_file, const char* dest_f p_udf_root = udf_get_root(p_udf, true, 0); if (p_udf_root == NULL) { - uprintf("Couldn't locate UDF root directory\n"); + uprintf("Could not locate UDF root directory\n"); goto out; } p_udf_file = udf_fopen(p_udf_root, iso_file); if (!p_udf_file) { - uprintf("Couldn't locate file %s in ISO image\n", iso_file); + uprintf("Could not locate file %s in ISO image\n", iso_file); goto out; } file_length = udf_get_file_length(p_udf_file); diff --git a/src/localization.c b/src/localization.c index 32e26eb0..6ed2ae9e 100644 --- a/src/localization.c +++ b/src/localization.c @@ -1,7 +1,7 @@ /* * Rufus: The Reliable USB Formatting Utility * Localization functions, a.k.a. "Everybody is doing it wrong but me!" - * Copyright © 2013-2014 Pete Batard + * Copyright © 2013-2015 Pete Batard * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -74,14 +74,14 @@ struct list_head locale_list = {NULL, NULL}; char *loc_filename = NULL, *embedded_loc_filename = "embedded.loc"; /* Message table */ -char* default_msg_table[MSG_MAX-MSG_000] = {0}; -char* current_msg_table[MSG_MAX-MSG_000] = {0}; +char* default_msg_table[MSG_MAX-MSG_000] = {"%s", 0}; +char* current_msg_table[MSG_MAX-MSG_000] = {"%s", 0}; char** msg_table = NULL; static void mtab_destroy(BOOL reinit) { size_t j; - for (j=0; j= MSG_MAX)) { - uprintf("PrintStatus: invalid MSG_ID\n"); + if ((msg_id < MSG_000) || (msg_id >= MSG_MAX)) { + uprintf("PrintStatusInfo: invalid MSG_ID\n"); return; } @@ -438,12 +448,15 @@ void PrintStatus(unsigned int duration, BOOL debug, int msg_id, ...) va_end(args); szStatusMessage[sizeof(szStatusMessage)-1] = '\0'; - if ((duration) || (!bStatusTimerArmed)) { - SendMessageLU(GetDlgItem(hMainDialog, IDC_STATUS), SB_SETTEXTW, SBT_OWNERDRAW, szStatusMessage); + if ((duration != 0) || (!bStatusTimerArmed)) { + if (info) + SetWindowTextU(hInfo, szStatusMessage); + else + SendMessageLU(GetDlgItem(hMainDialog, IDC_STATUS), SB_SETTEXTW, SBT_OWNERDRAW, szStatusMessage); } - if (duration) { - SetTimer(hMainDialog, TID_MESSAGE, duration, PrintStatusTimeout); + if (duration != 0) { + SetTimer(hMainDialog, TID_MESSAGE, duration, (info)?PrintInfoTimeout:PrintStatusTimeout); bStatusTimerArmed = TRUE; } diff --git a/src/localization_data.h b/src/localization_data.h index 9593ee37..7fcc6d4f 100644 --- a/src/localization_data.h +++ b/src/localization_data.h @@ -1,7 +1,7 @@ /* * Rufus: The Reliable USB Formatting Utility * Localization tables - autogenerated from resource.h - * Copyright © 2013-2014 Pete Batard + * Copyright © 2013-2015 Pete Batard * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,7 +31,6 @@ const loc_control_id control_id[] = { LOC_CTRL(IDD_ABOUTBOX), LOC_CTRL(IDD_NOTIFICATION), LOC_CTRL(IDD_LICENSE), - LOC_CTRL(IDD_ISO_EXTRACT), LOC_CTRL(IDD_LOG), LOC_CTRL(IDD_UPDATE_POLICY), LOC_CTRL(IDD_NEW_VERSION), @@ -53,8 +52,7 @@ const loc_control_id control_id[] = { LOC_CTRL(IDC_SELECT_ISO), LOC_CTRL(IDC_SET_ICON), LOC_CTRL(IDC_RUFUS_MBR), - LOC_CTRL(IDC_ISO_FILENAME), - LOC_CTRL(IDC_ISO_ABORT), + LOC_CTRL(IDC_INFO), LOC_CTRL(IDC_DISK_ID), LOC_CTRL(IDC_EXTRA_PARTITION), LOC_CTRL(IDC_ENABLE_FIXED_DISKS), @@ -380,7 +378,6 @@ loc_dlg_list loc_dlg[] = { LOC_DLG(IDD_ABOUTBOX), LOC_DLG(IDD_NOTIFICATION), LOC_DLG(IDD_LICENSE), - LOC_DLG(IDD_ISO_EXTRACT), LOC_DLG(IDD_LOG), LOC_DLG(IDD_UPDATE_POLICY), LOC_DLG(IDD_NEW_VERSION), diff --git a/src/localization_data.sh b/src/localization_data.sh index 903b225a..7cb19198 100644 --- a/src/localization_data.sh +++ b/src/localization_data.sh @@ -12,7 +12,7 @@ cat > cmd.sed <<\_EOF 1i /*\ * Rufus: The Reliable USB Formatting Utility\ * Localization tables - autogenerated from resource.h\ - * Copyright © 2013-2014 Pete Batard \ + * Copyright © 2013-2015 Pete Batard \ *\ * This program is free software: you can redistribute it and/or modify\ * it under the terms of the GNU General Public License as published by\ diff --git a/src/net.c b/src/net.c index eb7edcf5..774ddbb6 100644 --- a/src/net.c +++ b/src/net.c @@ -1,7 +1,7 @@ /* * Rufus: The Reliable USB Formatting Utility * Networking functionality (web file download, check for update, etc.) - * Copyright © 2012-2014 Pete Batard + * Copyright © 2012-2015 Pete Batard * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -277,7 +277,7 @@ DWORD DownloadFile(const char* url, const char* file, HWND hProgressDialog) } } - PrintStatus(0, FALSE, MSG_240, &file[last_slash]); + PrintInfo(0, MSG_240, &file[last_slash]); uprintf("Downloading '%s' from %s\n", &file[last_slash], url); if ( (!InternetCrackUrlA(url, (DWORD)safe_strlen(url), 0, &UrlParts)) @@ -357,7 +357,7 @@ DWORD DownloadFile(const char* url, const char* file, HWND hProgressDialog) break; dwSize += dwDownloaded; SendMessage(hProgressBar, PBM_SETPOS, (WPARAM)(MAX_PROGRESS*((1.0f*dwSize)/(1.0f*dwTotalSize))), 0); - PrintStatus(0, FALSE, MSG_241, (100.0f*dwSize)/(1.0f*dwTotalSize)); + PrintInfo(0, MSG_241, (100.0f*dwSize)/(1.0f*dwTotalSize)); if (fwrite(buf, 1, dwDownloaded, fd) != dwDownloaded) { uprintf("Error writing file '%s': %s\n", &file[last_slash], WinInetErrorString()); goto out; @@ -380,7 +380,7 @@ out: if (!r) { _unlink(file); if (PromptOnError) { - PrintStatus(0, FALSE, MSG_242); + PrintInfo(0, MSG_242); SetLastError(error_code); MessageBoxU(hMainDialog, IS_ERROR(FormatStatus)?StrError(FormatStatus, FALSE):WinInetErrorString(), lmprintf(MSG_044), MB_OK|MB_ICONERROR|MB_IS_RTL); @@ -475,7 +475,7 @@ static DWORD WINAPI CheckForUpdatesThread(LPVOID param) } } - PrintStatus(3000, TRUE, MSG_243); + PrintInfoDebug(3000, MSG_243); status++; // 1 if (!GetVersionExA(&os_version)) { @@ -607,14 +607,14 @@ out: if (hSession) InternetCloseHandle(hSession); switch(status) { case 1: - PrintStatus(3000, TRUE, MSG_244); + PrintInfoDebug(3000, MSG_244); break; case 2: - PrintStatus(3000, TRUE, MSG_245); + PrintInfoDebug(3000, MSG_245); break; case 3: case 4: - PrintStatus(3000, FALSE, found_new_version?MSG_246:MSG_247); + PrintInfo(3000, found_new_version?MSG_246:MSG_247); default: break; } diff --git a/src/resource.h b/src/resource.h index df630d71..fbb18851 100644 --- a/src/resource.h +++ b/src/resource.h @@ -6,7 +6,6 @@ #define IDD_ABOUTBOX 102 #define IDD_NOTIFICATION 103 #define IDD_LICENSE 104 -#define IDD_ISO_EXTRACT 105 #define IDD_LOG 106 #define IDD_UPDATE_POLICY 107 #define IDD_NEW_VERSION 108 @@ -17,7 +16,6 @@ #define IDD_ABOUTBOX_XP 152 #define IDD_NOTIFICATION_XP 153 #define IDD_LICENSE_XP 154 -#define IDD_ISO_EXTRACT_XP 155 #define IDD_LOG_XP 156 #define IDD_UPDATE_POLICY_XP 157 #define IDD_NEW_VERSION_XP 158 @@ -25,7 +23,6 @@ #define IDD_ABOUTBOX_RTL 202 #define IDD_NOTIFICATION_RTL 203 #define IDD_LICENSE_RTL 204 -#define IDD_ISO_EXTRACT_RTL 205 #define IDD_LOG_RTL 206 #define IDD_UPDATE_POLICY_RTL 207 #define IDD_NEW_VERSION_RTL 208 @@ -33,7 +30,6 @@ #define IDD_ABOUTBOX_RTL_XP 252 #define IDD_NOTIFICATION_RTL_XP 253 #define IDD_LICENSE_RTL_XP 254 -#define IDD_ISO_EXTRACT_RTL_XP 255 #define IDD_LOG_RTL_XP 256 #define IDD_UPDATE_POLICY_RTL_XP 257 #define IDD_NEW_VERSION_RTL_XP 258 @@ -92,8 +88,7 @@ #define IDC_SELECT_ISO 1016 #define IDC_SET_ICON 1017 #define IDC_RUFUS_MBR 1018 -#define IDC_ISO_FILENAME 1020 -#define IDC_ISO_ABORT 1021 +#define IDC_INFO 1020 #define IDC_DISK_ID 1022 #define IDC_EXTRA_PARTITION 1023 #define IDC_ENABLE_FIXED_DISKS 1024 diff --git a/src/rufus.c b/src/rufus.c index 7951779f..75db12b3 100644 --- a/src/rufus.c +++ b/src/rufus.c @@ -1,6 +1,6 @@ /* * Rufus: The Reliable USB Formatting Utility - * Copyright © 2011-2014 Pete Batard + * Copyright © 2011-2015 Pete Batard * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -124,7 +124,7 @@ float fScale = 1.0f; int default_fs; uint32_t dur_mins, dur_secs; HWND hDeviceList, hPartitionScheme, hFileSystem, hClusterSize, hLabel, hBootType, hNBPasses, hLog = NULL; -HWND hISOProgressDlg = NULL, hLogDlg = NULL, hISOProgressBar, hISOFileName, hDiskID; +HWND hLogDlg = NULL, hProgress = NULL, hInfo, hDiskID; BOOL use_own_c32[NB_OLD_C32] = {FALSE, FALSE}, detect_fakes = TRUE, mbr_selected_by_user = FALSE; BOOL iso_op_in_progress = FALSE, format_op_in_progress = FALSE, right_to_left_mode = FALSE; BOOL enable_HDDs = FALSE, advanced_mode = TRUE, force_update = FALSE, use_fake_units = TRUE; @@ -140,7 +140,7 @@ StrArray DriveID, DriveLabel; extern char szStatusMessage[256]; static HANDLE format_thid = NULL; -static HWND hProgress = NULL, hBoot = NULL, hSelectISO = NULL; +static HWND hBoot = NULL, hSelectISO = NULL; static HICON hIconDisc, hIconDown, hIconUp, hIconLang; static char szTimer[12] = "00:00:00"; static unsigned int timer; @@ -887,65 +887,6 @@ static void CALLBACK BlockingTimer(HWND hWnd, UINT uMsg, UINT_PTR idEvent, DWORD } } -/* Callback for the modeless ISO extraction progress, and other progress dialogs */ -BOOL CALLBACK ISOProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) -{ - switch (message) { - case WM_SHOWWINDOW: - // If we don't do this, the ISO progress dialog will remain visible - // if it was active while the app was minimized - if (wParam && (lParam == SW_PARENTOPENING) && (!iso_op_in_progress)) { - ShowWindow(hDlg, SW_HIDE); - return TRUE; - } - return FALSE; - case WM_INITDIALOG: - apply_localization(IDD_ISO_EXTRACT, hDlg); - hISOProgressBar = GetDlgItem(hDlg, IDC_PROGRESS); - hISOFileName = GetDlgItem(hDlg, IDC_ISO_FILENAME); - // Use maximum granularity for the progress bar - SendMessage(hISOProgressBar, PBM_SETRANGE, 0, (MAX_PROGRESS<<16) & 0xFFFF0000); - return TRUE; - case UM_PROGRESS_INIT: - iso_op_in_progress = TRUE; - EnableWindow(GetDlgItem(hISOProgressDlg, IDC_ISO_ABORT), TRUE); - CenterDialog(hDlg); - // If we try to show the progress dialog while the app is minimized, users won't - // be able to restore the app, so we only show it if it isn't. But this workaround - // means that the progress dialog will never display for users who had the app - // minimized when ISO extraction started, which we don't really care about, since - // we're planning to remove the whole separate progress dialog soon anyway. - if (!IsIconic(hMainDialog)) - ShowWindow(hDlg, SW_SHOW); - UpdateWindow(hDlg); - return TRUE; - case UM_PROGRESS_EXIT: - // Just hide and recenter the dialog - ShowWindow(hDlg, SW_HIDE); - iso_op_in_progress = FALSE; - return TRUE; - case WM_COMMAND: - switch (LOWORD(wParam)) { - case IDC_ISO_ABORT: - FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_CANCELLED; - PrintStatus(0, FALSE, MSG_201); - uprintf("Cancelling (from ISO proc.)\n"); - EnableWindow(GetDlgItem(hISOProgressDlg, IDC_ISO_ABORT), FALSE); - if (format_thid != NULL) - EnableWindow(GetDlgItem(hMainDialog, IDCANCEL), FALSE); - // Start a timer to detect blocking operations during ISO file extraction - if (iso_blocking_status >= 0) { - last_iso_blocking_status = iso_blocking_status; - SetTimer(hMainDialog, TID_BLOCKING_TIMER, 5000, BlockingTimer); - } - return TRUE; - } - case WM_CLOSE: // prevent closure using Alt-F4 - return TRUE; - } - return FALSE; -} - // Report the features of the selected ISO images static const char* YesNo(BOOL b) { return (b) ? "Yes" : "No"; @@ -988,14 +929,15 @@ DWORD WINAPI ISOScanThread(LPVOID param) if (image_path == NULL) goto out; - PrintStatus(0, TRUE, MSG_202); + PrintInfoDebug(0, MSG_202); user_notified = FALSE; EnableControls(FALSE); r = ExtractISO(image_path, "", TRUE) || IsHDImage(image_path); EnableControls(TRUE); if (!r) { - SendMessage(hISOProgressDlg, UM_PROGRESS_EXIT, 0, 0); - PrintStatus(0, TRUE, MSG_203); + // TODO: is that needed? + SendMessage(hMainDialog, UM_PROGRESS_EXIT, 0, 0); + PrintInfoDebug(0, MSG_203); safe_free(image_path); goto out; } @@ -1008,10 +950,10 @@ DWORD WINAPI ISOScanThread(LPVOID param) } if ( (!iso_report.has_bootmgr) && (!HAS_SYSLINUX(iso_report)) && (!IS_WINPE(iso_report.winpe)) && (!IS_GRUB(iso_report)) && (!iso_report.has_efi) && (!IS_REACTOS(iso_report) && (!iso_report.has_kolibrios) && (!iso_report.is_bootable_img)) ) { + PrintInfo(0, MSG_081); MessageBoxU(hMainDialog, lmprintf(MSG_082), lmprintf(MSG_081), MB_OK|MB_ICONINFORMATION|MB_IS_RTL); safe_free(image_path); SetMBRProps(); - PrintStatus(0, FALSE, -1); } else { // Enable bootable and set Target System and FS accordingly CheckDlgButton(hMainDialog, IDC_BOOT, BST_CHECKED); @@ -1029,7 +971,7 @@ DWORD WINAPI ISOScanThread(LPVOID param) ComboBox_GetCurSel(hFileSystem)); } for (i=(int)safe_strlen(image_path); (i>0)&&(image_path[i]!='\\'); i--); - PrintStatus(0, TRUE, MSG_205, &image_path[i+1]); + PrintStatusDebug(0, MSG_205, &image_path[i+1]); // Lose the focus on the select ISO (but place it on Close) SendMessage(hMainDialog, WM_NEXTDLGCTL, (WPARAM)FALSE, 0); // Lose the focus from Close and set it back to Start @@ -1037,7 +979,7 @@ DWORD WINAPI ISOScanThread(LPVOID param) } out: - SendMessage(hISOProgressDlg, UM_PROGRESS_EXIT, 0, 0); + PrintInfo(0, MSG_210); ExitThread(0); } @@ -1074,6 +1016,7 @@ void ToggleAdvanced(void) // Move the status bar up or down MoveCtrlY(hMainDialog, IDC_STATUS, dialog_shift); MoveCtrlY(hMainDialog, IDC_START, dialog_shift); + MoveCtrlY(hMainDialog, IDC_INFO, dialog_shift); MoveCtrlY(hMainDialog, IDC_PROGRESS, dialog_shift); MoveCtrlY(hMainDialog, IDC_ABOUT, dialog_shift); MoveCtrlY(hMainDialog, IDC_LOG, dialog_shift); @@ -1226,10 +1169,9 @@ static BOOL BootCheck(void) static_sprintf(tmp, "%s-%s", grub, iso_report.grub2_version); IGNORE_RETVAL(_mkdir(tmp)); static_sprintf(tmp, "%s/%s-%s/%s", FILES_URL, grub, iso_report.grub2_version, core_img); - SetWindowTextU(hISOProgressDlg, lmprintf(MSG_085, tmp)); - SetWindowTextU(hISOFileName, tmp); + PrintInfoDebug(0, MSG_085, tmp); PromptOnError = FALSE; - grub2_len = (long)DownloadFile(tmp, &tmp[sizeof(FILES_URL)], hISOProgressDlg); + grub2_len = (long)DownloadFile(tmp, &tmp[sizeof(FILES_URL)], hMainDialog); PromptOnError = TRUE; if (grub2_len <= 0) uprintf("%s was not found - will use embedded version\n", tmp); @@ -1265,17 +1207,16 @@ static BOOL BootCheck(void) fclose(fd); use_own_c32[i] = TRUE; } else { - PrintStatus(0, FALSE, MSG_204, old_c32_name[i]); + PrintInfo(0, MSG_204, old_c32_name[i]); if (MessageBoxU(hMainDialog, lmprintf(MSG_084, old_c32_name[i], old_c32_name[i]), lmprintf(MSG_083, old_c32_name[i]), MB_YESNO|MB_ICONWARNING|MB_IS_RTL) == IDYES) { static_sprintf(tmp, "%s-%s", syslinux, embedded_sl_version_str[0]); IGNORE_RETVAL(_mkdir(tmp)); - SetWindowTextU(hISOProgressDlg, lmprintf(MSG_085, old_c32_name[i])); static_sprintf(tmp, "%s/%s-%s/%s", FILES_URL, syslinux, embedded_sl_version_str[0], old_c32_name[i]); - SetWindowTextU(hISOFileName, tmp); - len = DownloadFile(tmp, &tmp[sizeof(FILES_URL)], hISOProgressDlg); + PrintInfo(0, MSG_085, old_c32_name[i]); + len = DownloadFile(tmp, &tmp[sizeof(FILES_URL)], hMainDialog); if (len == 0) { - uprintf("Couldn't download the files - cancelling\n"); + uprintf("Could not download file - cancelling\n"); return FALSE; } use_own_c32[i] = TRUE; @@ -1318,21 +1259,19 @@ static BOOL BootCheck(void) IGNORE_RETVAL(_mkdir(&iso_report.sl_version_ext[1])); IGNORE_RETVAL(_chdir("..")); } - static_sprintf(tmp, "%s.%s %s", ldlinux, ldlinux_ext[i], iso_report.sl_version_str); - SetWindowTextU(hISOProgressDlg, lmprintf(MSG_085, tmp)); static_sprintf(tmp, "%s/%s-%s%s/%s.%s", FILES_URL, syslinux, iso_report.sl_version_str, iso_report.sl_version_ext, ldlinux, ldlinux_ext[i]); - SetWindowTextU(hISOFileName, tmp); + PrintInfo(0, MSG_085, tmp); PromptOnError = (*iso_report.sl_version_ext == 0); - syslinux_ldlinux_len[i] = DownloadFile(tmp, &tmp[sizeof(FILES_URL)], hISOProgressDlg); + syslinux_ldlinux_len[i] = DownloadFile(tmp, &tmp[sizeof(FILES_URL)], hMainDialog); PromptOnError = TRUE; if ((syslinux_ldlinux_len[i] == 0) && (DownloadStatus == 404) && (*iso_report.sl_version_ext != 0)) { // Couldn't locate the file on the server => try to download without the version extra uprintf("Extended version was not found, trying main version\n"); static_sprintf(tmp, "%s/%s-%s/%s.%s", FILES_URL, syslinux, iso_report.sl_version_str, ldlinux, ldlinux_ext[i]); - SetWindowTextU(hISOFileName, tmp); - syslinux_ldlinux_len[i] = DownloadFile(tmp, &tmp[sizeof(FILES_URL)], hISOProgressDlg); + PrintInfo(0, MSG_085, tmp); + syslinux_ldlinux_len[i] = DownloadFile(tmp, &tmp[sizeof(FILES_URL)], hMainDialog); if (syslinux_ldlinux_len[i] != 0) { // Duplicate the file so that the user won't be prompted to download again static_sprintf(tmp, "%s-%s\\%s.%s", syslinux, iso_report.sl_version_str, ldlinux, ldlinux_ext[i]); @@ -1342,7 +1281,7 @@ static BOOL BootCheck(void) } } if (syslinux_ldlinux_len[i] == 0) { - uprintf("Couldn't download the files - cancelling\n"); + uprintf("Could not download the file - cancelling\n"); return FALSE; } } @@ -1360,7 +1299,7 @@ static BOOL BootCheck(void) fclose(fd); } else { static_sprintf(tmp, "%s.%s", ldlinux, ldlinux_ext[2]); - PrintStatus(0, FALSE, MSG_206, tmp); + PrintInfo(0, MSG_206, tmp); // MSG_104: "Syslinux v5.0 or later requires a '%s' file to be installed" r = MessageBoxU(hMainDialog, lmprintf(MSG_104, "Syslinux v5.0", tmp, "Syslinux v5+", tmp), lmprintf(MSG_103, tmp), MB_YESNOCANCEL|MB_ICONWARNING|MB_IS_RTL); @@ -1370,9 +1309,8 @@ static BOOL BootCheck(void) static_sprintf(tmp, "%s-%s", syslinux, embedded_sl_version_str[1]); IGNORE_RETVAL(_mkdir(tmp)); static_sprintf(tmp, "%s/%s-%s/%s.%s", FILES_URL, syslinux, embedded_sl_version_str[1], ldlinux, ldlinux_ext[2]); - SetWindowTextU(hISOProgressDlg, lmprintf(MSG_085, tmp)); - SetWindowTextU(hISOFileName, tmp); - DownloadFile(tmp, &tmp[sizeof(FILES_URL)], hISOProgressDlg); + PrintInfo(0, MSG_085, tmp); + DownloadFile(tmp, &tmp[sizeof(FILES_URL)], hMainDialog); } } } else if (dt == DT_WINME) { @@ -1392,7 +1330,7 @@ static BOOL BootCheck(void) fclose(fd); } else { static_sprintf(tmp, "grldr"); - PrintStatus(0, FALSE, MSG_206, tmp); + PrintInfo(0, MSG_206, tmp); r = MessageBoxU(hMainDialog, lmprintf(MSG_104, "Grub4DOS 0.4", tmp, "Grub4DOS", tmp), lmprintf(MSG_103, tmp), MB_YESNOCANCEL|MB_ICONWARNING|MB_IS_RTL); if (r == IDCANCEL) @@ -1400,9 +1338,8 @@ static BOOL BootCheck(void) if (r == IDYES) { IGNORE_RETVAL(_mkdir("grub4dos")); static_sprintf(tmp, "%s/grub4dos/grldr", FILES_URL); - SetWindowTextU(hISOProgressDlg, lmprintf(MSG_085, tmp)); - SetWindowTextU(hISOFileName, tmp); - DownloadFile(tmp, &tmp[sizeof(FILES_URL)], hISOProgressDlg); + PrintInfo(0, MSG_085, tmp); + DownloadFile(tmp, &tmp[sizeof(FILES_URL)], hMainDialog); } } } @@ -1423,11 +1360,12 @@ static __inline const char* IsAlphaOrBeta(void) void InitDialog(HWND hDlg) { HINSTANCE hDllInst; + HFONT hf; DWORD len; SIZE sz; HWND hCtrl; HDC hDC; - int i, i16, s16; + int i, i16, s16, lfHeight; char tmp[128], *token, *buf, *ext; wchar_t wtmp[128] = {0}; static char* resource[2] = { MAKEINTRESOURCEA(IDR_SL_LDLINUX_V4_SYS), MAKEINTRESOURCEA(IDR_SL_LDLINUX_V6_SYS) }; @@ -1444,6 +1382,7 @@ void InitDialog(HWND hDlg) hClusterSize = GetDlgItem(hDlg, IDC_CLUSTERSIZE); hLabel = GetDlgItem(hDlg, IDC_LABEL); hProgress = GetDlgItem(hDlg, IDC_PROGRESS); + hInfo = GetDlgItem(hDlg, IDC_INFO); hBoot = GetDlgItem(hDlg, IDC_BOOT); hBootType = GetDlgItem(hDlg, IDC_BOOTTYPE); hSelectISO = GetDlgItem(hDlg, IDC_SELECT_ISO); @@ -1454,6 +1393,7 @@ void InitDialog(HWND hDlg) i16 = GetSystemMetrics(SM_CXSMICON); hDC = GetDC(hDlg); fScale = GetDeviceCaps(hDC, LOGPIXELSX) / 96.0f; + lfHeight = -MulDiv(8, GetDeviceCaps(hDC, LOGPIXELSY), 72); ReleaseDC(hDlg, hDC); // Adjust icon size lookup s16 = i16; @@ -1466,6 +1406,15 @@ void InitDialog(HWND hDlg) else if (s16 >= 20) s16 = 24; + // Change the font of the Info edit box +#if defined(COLOURED_INFO) + hf = CreateFontA(lfHeight, 0, 0, 0, FW_BOLD, FALSE, FALSE, FALSE, +#else + hf = CreateFontA(lfHeight, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, +#endif + DEFAULT_CHARSET, 0, 0, PROOF_QUALITY, 0, "Arial Unicode MS"); + SendDlgItemMessageA(hDlg, IDC_INFO, WM_SETFONT, (WPARAM)hf, TRUE); + // Create the title bar icon SetTitleBarIcon(hDlg); GetWindowTextA(hDlg, tmp, sizeof(tmp)); @@ -1617,11 +1566,13 @@ void InitDialog(HWND hDlg) // Simulate a button click for ISO selection PostMessage(hDlg, WM_COMMAND, IDC_SELECT_ISO, 0); } + + PrintInfo(0, MSG_210); } static void PrintStatus2000(const char* str, BOOL val) { - PrintStatus(2000, FALSE, (val)?MSG_250:MSG_251, str); + PrintStatus(2000, (val)?MSG_250:MSG_251, str); } void ShowLanguageMenu(HWND hDlg) @@ -1701,19 +1652,19 @@ void SetBoot(int fs, int bt) /* * Main dialog callback */ -extern int uncompress(const char* src, const char* dst, int type); static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { - DRAWITEMSTRUCT* pDI; - POINT Point; - RECT DialogRect, DesktopRect; - int nDeviceIndex, fs, bt, i, nWidth, nHeight, nb_devices, selected_language; static DWORD DeviceNum = 0, LastRefresh = 0; - char tmp[128]; static BOOL first_log_display = TRUE, user_changed_label = FALSE; static ULONG ulRegister = 0; static LPITEMIDLIST pidlDesktop = NULL; static MY_SHChangeNotifyEntry NotifyEntry; + DRAWITEMSTRUCT* pDI; + POINT Point; + RECT DialogRect, DesktopRect; + LONG progress_style; + int nDeviceIndex, fs, bt, i, nWidth, nHeight, nb_devices, selected_language; + char tmp[128]; loc_cmd* lcmd = NULL; // TODO: Add "*.img;*.vhd" / "All Supported Images" to the list below and use a generic "%s Image" in the .loc EXT_DECL(img_ext, NULL, __VA_GROUP__("*.img", "*.vhd"), __VA_GROUP__(lmprintf(MSG_095), "VHD Image")); @@ -1779,7 +1730,6 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA ulRegister = pfSHChangeNotifyRegister(hDlg, 0x0001|0x0002|0x8000, SHCNE_MEDIAINSERTED|SHCNE_MEDIAREMOVED, UM_MEDIA_CHANGE, 1, &NotifyEntry); } - PostMessage(hMainDialog, UM_PROGRESS_CREATE, 0, 0); // Bring our Window on top. We have to go through all *THREE* of these, or Far Manager hides our window :( SetWindowPos(hMainDialog, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE); SetWindowPos(hMainDialog, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE); @@ -1812,6 +1762,20 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA } break; +#if defined(COLOURED_INFO) + case WM_CTLCOLORSTATIC: + // Must be transparent for XP and non Aero Vista/7 + SetBkMode((HDC)wParam, TRANSPARENT); + if ((HWND)lParam == hInfo) { + SetTextColor((HDC)wParam, RGB(0,192,255)); + return (INT_PTR)CreateSolidBrush(RGB(0,0,0)); + } + // Restore transparency if we don't change the background + SetBkMode((HDC)wParam, OPAQUE); + return (INT_PTR)FALSE; + break; +#endif + case WM_COMMAND: if ((LOWORD(wParam) >= UM_LANGUAGE_MENU) && (LOWORD(wParam) < UM_LANGUAGE_MENU_MAX)) { selected_language = LOWORD(wParam) - UM_LANGUAGE_MENU; @@ -1831,7 +1795,6 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA case IDOK: // close application case IDCANCEL: PF_INIT(SHChangeNotifyDeregister, Shell32); - EnableWindow(GetDlgItem(hISOProgressDlg, IDC_ISO_ABORT), FALSE); EnableWindow(GetDlgItem(hDlg, IDCANCEL), FALSE); if (format_thid != NULL) { if (MessageBoxU(hMainDialog, lmprintf(MSG_105), lmprintf(MSG_049), @@ -1839,8 +1802,8 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA // Operation may have completed in the meantime if (format_thid != NULL) { FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_CANCELLED; - PrintStatus(0, FALSE, MSG_201); - uprintf("Cancelling (from main app)\n"); + PrintInfo(0, MSG_201); + uprintf("Cancelling"); // Start a timer to detect blocking operations during ISO file extraction if (iso_blocking_status >= 0) { last_iso_blocking_status = iso_blocking_status; @@ -1848,7 +1811,6 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA } } } else { - EnableWindow(GetDlgItem(hISOProgressDlg, IDC_ISO_ABORT), TRUE); EnableWindow(GetDlgItem(hDlg, IDCANCEL), TRUE); } return (INT_PTR)TRUE; @@ -1897,8 +1859,6 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA } // Display the log Window log_displayed = !log_displayed; - if (IsShown(hISOProgressDlg)) - SetFocus(hISOProgressDlg); // Set focus on the start button SendMessage(hMainDialog, WM_NEXTDLGCTL, (WPARAM)FALSE, 0); SendMessage(hMainDialog, WM_NEXTDLGCTL, (WPARAM)GetDlgItem(hMainDialog, IDC_START), TRUE); @@ -1945,7 +1905,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA PostMessage(hMainDialog, UM_FORMAT_COMPLETED, 0, 0); } uprintf("\r\nSave to image operation started"); - PrintStatus(0, FALSE, -1); + PrintInfo(0, -1); timer = 0; safe_sprintf(szTimer, sizeof(szTimer), "00:00:00"); SendMessageA(GetDlgItem(hMainDialog, IDC_STATUS), SB_SETTEXTA, @@ -1972,7 +1932,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA if (HIWORD(wParam) != CBN_SELCHANGE) break; nb_devices = ComboBox_GetCount(hDeviceList); - PrintStatus(0, TRUE, (nb_devices==1)?MSG_208:MSG_209, nb_devices); + PrintStatusDebug(0, (nb_devices==1)?MSG_208:MSG_209, nb_devices); PopulateProperties(ComboBox_GetCurSel(hDeviceList)); SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE<<16) | IDC_FILESYSTEM, ComboBox_GetCurSel(hFileSystem)); @@ -2085,6 +2045,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA image_path = FileDialog(FALSE, NULL, &iso_ext, 0); if (image_path == NULL) { CreateTooltip(hSelectISO, lmprintf(MSG_173), -1); + PrintStatus(0, MSG_190); break; } } @@ -2164,7 +2125,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA PostMessage(hMainDialog, UM_FORMAT_COMPLETED, 0, 0); } uprintf("\r\nFormat operation started"); - PrintStatus(0, FALSE, -1); + PrintInfo(0, -1); timer = 0; safe_sprintf(szTimer, sizeof(szTimer), "00:00:00"); SendMessageA(GetDlgItem(hMainDialog, IDC_STATUS), SB_SETTEXTA, @@ -2186,17 +2147,28 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA PostQuitMessage(0); break; - case UM_PROGRESS_CREATE: - // You'd think that Windows would let you instantiate a modeless dialog wherever - // but you'd be wrong. It must be done in the main callback, hence the custom message. - if (!IsWindow(hISOProgressDlg)) { - hISOProgressDlg = CreateDialogW(hMainInstance, MAKEINTRESOURCEW(IDD_ISO_EXTRACT + IDD_OFFSET), - hDlg, (DLGPROC)ISOProc); - - // The window is not visible by default but takes focus => restore it - SetFocus(hDlg); + case UM_PROGRESS_INIT: + if (wParam == PBS_MARQUEE) { + progress_style = GetWindowLong(hProgress, GWL_STYLE); + SetWindowLong(hProgress, GWL_STYLE, progress_style | PBS_MARQUEE); + SendMessage(hProgress, PBM_SETMARQUEE, TRUE, 0); + } else { + SendMessage(hProgress, PBM_SETPOS, 0, 0); } - return (INT_PTR)TRUE; + SetTaskbarProgressState(TASKBAR_NORMAL); + SetTaskbarProgressValue(0, MAX_PROGRESS); + + break; + + case UM_PROGRESS_EXIT: + // Remove marquee style if previously set + progress_style = GetWindowLong(hProgress, GWL_STYLE); + SetWindowLong(hProgress, GWL_STYLE, progress_style & (~PBS_MARQUEE)); + SendMessage(hProgress, PBM_SETSTATE, (WPARAM)PBST_NORMAL, 0); + SetTaskbarProgressState(TASKBAR_NORMAL); + SetTaskbarProgressValue(0, MAX_PROGRESS); + SendMessage(hProgress, PBM_SETPOS, 0, 0); + break; case UM_FORMAT_COMPLETED: format_thid = NULL; @@ -2205,7 +2177,6 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA // Close the cancel MessageBox and Blocking notification if active SendMessage(FindWindowA(MAKEINTRESOURCEA(32770), lmprintf(MSG_049)), WM_COMMAND, IDNO, 0); SendMessage(FindWindowA(MAKEINTRESOURCEA(32770), lmprintf(MSG_049)), WM_COMMAND, IDYES, 0); - EnableWindow(GetDlgItem(hISOProgressDlg, IDC_ISO_ABORT), TRUE); EnableWindow(GetDlgItem(hMainDialog, IDCANCEL), TRUE); EnableControls(TRUE); uprintf("\r\n"); @@ -2216,16 +2187,16 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA SendMessage(hProgress, PBM_SETPOS, (MAX_PROGRESS+1), 0); SendMessage(hProgress, PBM_SETRANGE, 0, (MAX_PROGRESS<<16) & 0xFFFF0000); SetTaskbarProgressState(TASKBAR_NOPROGRESS); - PrintStatus(0, FALSE, MSG_210); + PrintInfo(0, MSG_210); } else if (SCODE_CODE(FormatStatus) == ERROR_CANCELLED) { SendMessage(hProgress, PBM_SETSTATE, (WPARAM)PBST_PAUSED, 0); SetTaskbarProgressState(TASKBAR_PAUSED); - PrintStatus(0, FALSE, MSG_211); + PrintInfo(0, MSG_211); Notification(MSG_INFO, NULL, lmprintf(MSG_211), lmprintf(MSG_041)); } else { SendMessage(hProgress, PBM_SETSTATE, (WPARAM)PBST_ERROR, 0); SetTaskbarProgressState(TASKBAR_ERROR); - PrintStatus(0, FALSE, MSG_212); + PrintInfo(0, MSG_212); Notification(MSG_ERROR, NULL, lmprintf(MSG_042), lmprintf(MSG_043, StrError(FormatStatus, FALSE))); } FormatStatus = 0; @@ -2470,12 +2441,6 @@ relaunch: if (get_loc_data_file(loc_file, selected_locale)) WriteRegistryKeyStr(REGKEY_HKCU, REGKEY_LOCALE, selected_locale->txt[0]); - // Destroy the ISO progress window, if it exists - if (hISOProgressDlg != NULL) { - DestroyWindow(hISOProgressDlg); - hISOProgressDlg = NULL; - } - /* * Create the main Window * @@ -2505,123 +2470,121 @@ relaunch: // Do our own event processing and process "magic" commands while(GetMessage(&msg, NULL, 0, 0)) { - // The following ensures the processing of the ISO progress window messages - if (!IsWindow(hISOProgressDlg) || !IsDialogMessage(hISOProgressDlg, &msg)) { - // Ctrl-A => Select the log data - if ( (IsWindowVisible(hLogDlg)) && (GetKeyState(VK_CONTROL) & 0x8000) && - (msg.message == WM_KEYDOWN) && (msg.wParam == 'A') ) { - // Might also need ES_NOHIDESEL property if you want to select when not active - SendMessage(hLog, EM_SETSEL, 0, -1); - } - // Alt-B => Toggle fake drive detection during bad blocks check - // By default, Rufus will check for fake USB flash drives that mistakenly present - // more capacity than they already have by looping over the flash. This check which - // is enabled by default is performed by writing the block number sequence and reading - // it back during the bad block check. - if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'B')) { - detect_fakes = !detect_fakes; - PrintStatus2000(lmprintf(MSG_256), detect_fakes); - continue; - } - // Alt C => Force the update check to be successful - // This will set the reported current version of Rufus to 0.0.0.0 when performing an update - // check, so that it always succeeds. This is useful for translators. - if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'C')) { - force_update = !force_update; - PrintStatus2000(lmprintf(MSG_259), force_update); - continue; - } - // Alt-D => Delete the NoDriveTypeAutorun key on exit (useful if the app crashed) - // This key is used to disable Windows popup messages when an USB drive is plugged in. - if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'D')) { - PrintStatus(2000, FALSE, MSG_255); - existing_key = FALSE; - continue; - } - // Alt-E => Enhanced installation mode (allow dual UEFI/BIOS mode and FAT32 for Windows) - if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'E')) { - allow_dual_uefi_bios = !allow_dual_uefi_bios; - // TODO: add a localized message - PrintStatus2000("Allow dual UEFI/BIOS mode", allow_dual_uefi_bios); - continue; - } - // Alt-F => Toggle detection of USB HDDs - // By default Rufus does not list USB HDDs. This is a safety feature aimed at avoiding - // unintentional formatting of backup drives instead of USB keys. - // When enabled, Rufus will list and allow the formatting of USB HDDs. - if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'F')) { - enable_HDDs = !enable_HDDs; - PrintStatus2000(lmprintf(MSG_253), enable_HDDs); - GetUSBDevices(0); - CheckDlgButton(hMainDialog, IDC_ENABLE_FIXED_DISKS, enable_HDDs?BST_CHECKED:BST_UNCHECKED); - continue; - } - // Alt-I => Toggle ISO support - // This is useful if you have a dual ISO/DD image and you want to force Rufus to use - // DD-mode when writing the data. - if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'I')) { - enable_iso = !enable_iso; - PrintStatus2000(lmprintf(MSG_262), enable_iso); - if (image_path != NULL) { - iso_provided = TRUE; - PostMessage(hDlg, WM_COMMAND, IDC_SELECT_ISO, 0); - } - continue; - } - // Alt J => Toggle Joliet support for ISO9660 images - // Some ISOs (Ubuntu) have Joliet extensions but expect applications not to use them, - // due to their reliance on filenames that are > 64 chars (the Joliet max length for - // a file name). This option allows users to ignore Joliet when using such images. - if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'J')) { - enable_joliet = !enable_joliet; - PrintStatus2000(lmprintf(MSG_257), enable_joliet); - continue; - } - // Alt K => Toggle Rock Ridge support for ISO9660 images - if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'K')) { - enable_rockridge = !enable_rockridge; - PrintStatus2000(lmprintf(MSG_258), enable_rockridge); - continue; - } - // Alt-L => Force Large FAT32 format to be used on < 32 GB drives - if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'L')) { - force_large_fat32 = !force_large_fat32; - PrintStatus2000(lmprintf(MSG_254), force_large_fat32); - GetUSBDevices(0); - continue; - } - // Alt N => Enable NTFS compression - if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'N')) { - enable_ntfs_compression = !enable_ntfs_compression; - PrintStatus2000(lmprintf(MSG_260), enable_ntfs_compression); - continue; - } - // Alt-R => Remove all the registry keys created by Rufus - if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'R')) { - PrintStatus(2000, FALSE, DeleteRegistryKey(REGKEY_HKCU, COMPANY_NAME "\\" APPLICATION_NAME)?MSG_248:MSG_249); - // Also try to delete the upper key (company name) if it's empty (don't care about the result) - DeleteRegistryKey(REGKEY_HKCU, COMPANY_NAME); - continue; - } - // Alt-S => Disable size limit for ISOs - // By default, Rufus will not copy ISOs that are larger than in size than - // the target USB drive. If this is enabled, the size check is disabled. - if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'S')) { - size_check = !size_check; - PrintStatus2000(lmprintf(MSG_252), size_check); - GetUSBDevices(0); - continue; - } - // Alt-U => Use PROPER size units, instead of this whole Kibi/Gibi nonsense - if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'U')) { - use_fake_units = !use_fake_units; - PrintStatus2000(lmprintf(MSG_263), !use_fake_units); - GetUSBDevices(0); - continue; - } - TranslateMessage(&msg); - DispatchMessage(&msg); + + // Ctrl-A => Select the log data + if ( (IsWindowVisible(hLogDlg)) && (GetKeyState(VK_CONTROL) & 0x8000) && + (msg.message == WM_KEYDOWN) && (msg.wParam == 'A') ) { + // Might also need ES_NOHIDESEL property if you want to select when not active + SendMessage(hLog, EM_SETSEL, 0, -1); } + // Alt-B => Toggle fake drive detection during bad blocks check + // By default, Rufus will check for fake USB flash drives that mistakenly present + // more capacity than they already have by looping over the flash. This check which + // is enabled by default is performed by writing the block number sequence and reading + // it back during the bad block check. + if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'B')) { + detect_fakes = !detect_fakes; + PrintStatus2000(lmprintf(MSG_256), detect_fakes); + continue; + } + // Alt C => Force the update check to be successful + // This will set the reported current version of Rufus to 0.0.0.0 when performing an update + // check, so that it always succeeds. This is useful for translators. + if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'C')) { + force_update = !force_update; + PrintStatus2000(lmprintf(MSG_259), force_update); + continue; + } + // Alt-D => Delete the NoDriveTypeAutorun key on exit (useful if the app crashed) + // This key is used to disable Windows popup messages when an USB drive is plugged in. + if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'D')) { + PrintStatus(2000, MSG_255); + existing_key = FALSE; + continue; + } + // Alt-E => Enhanced installation mode (allow dual UEFI/BIOS mode and FAT32 for Windows) + if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'E')) { + allow_dual_uefi_bios = !allow_dual_uefi_bios; + // TODO: add a localized message + PrintStatus2000("Allow dual UEFI/BIOS mode", allow_dual_uefi_bios); + continue; + } + // Alt-F => Toggle detection of USB HDDs + // By default Rufus does not list USB HDDs. This is a safety feature aimed at avoiding + // unintentional formatting of backup drives instead of USB keys. + // When enabled, Rufus will list and allow the formatting of USB HDDs. + if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'F')) { + enable_HDDs = !enable_HDDs; + PrintStatus2000(lmprintf(MSG_253), enable_HDDs); + GetUSBDevices(0); + CheckDlgButton(hMainDialog, IDC_ENABLE_FIXED_DISKS, enable_HDDs?BST_CHECKED:BST_UNCHECKED); + continue; + } + // Alt-I => Toggle ISO support + // This is useful if you have a dual ISO/DD image and you want to force Rufus to use + // DD-mode when writing the data. + if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'I')) { + enable_iso = !enable_iso; + PrintStatus2000(lmprintf(MSG_262), enable_iso); + if (image_path != NULL) { + iso_provided = TRUE; + PostMessage(hDlg, WM_COMMAND, IDC_SELECT_ISO, 0); + } + continue; + } + // Alt J => Toggle Joliet support for ISO9660 images + // Some ISOs (Ubuntu) have Joliet extensions but expect applications not to use them, + // due to their reliance on filenames that are > 64 chars (the Joliet max length for + // a file name). This option allows users to ignore Joliet when using such images. + if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'J')) { + enable_joliet = !enable_joliet; + PrintStatus2000(lmprintf(MSG_257), enable_joliet); + continue; + } + // Alt K => Toggle Rock Ridge support for ISO9660 images + if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'K')) { + enable_rockridge = !enable_rockridge; + PrintStatus2000(lmprintf(MSG_258), enable_rockridge); + continue; + } + // Alt-L => Force Large FAT32 format to be used on < 32 GB drives + if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'L')) { + force_large_fat32 = !force_large_fat32; + PrintStatus2000(lmprintf(MSG_254), force_large_fat32); + GetUSBDevices(0); + continue; + } + // Alt N => Enable NTFS compression + if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'N')) { + enable_ntfs_compression = !enable_ntfs_compression; + PrintStatus2000(lmprintf(MSG_260), enable_ntfs_compression); + continue; + } + // Alt-R => Remove all the registry keys created by Rufus + if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'R')) { + PrintStatus(2000, DeleteRegistryKey(REGKEY_HKCU, COMPANY_NAME "\\" APPLICATION_NAME)?MSG_248:MSG_249); + // Also try to delete the upper key (company name) if it's empty (don't care about the result) + DeleteRegistryKey(REGKEY_HKCU, COMPANY_NAME); + continue; + } + // Alt-S => Disable size limit for ISOs + // By default, Rufus will not copy ISOs that are larger than in size than + // the target USB drive. If this is enabled, the size check is disabled. + if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'S')) { + size_check = !size_check; + PrintStatus2000(lmprintf(MSG_252), size_check); + GetUSBDevices(0); + continue; + } + // Alt-U => Use PROPER size units, instead of this whole Kibi/Gibi nonsense + if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'U')) { + use_fake_units = !use_fake_units; + PrintStatus2000(lmprintf(MSG_263), !use_fake_units); + GetUSBDevices(0); + continue; + } + TranslateMessage(&msg); + DispatchMessage(&msg); } if (relaunch) { relaunch = FALSE; diff --git a/src/rufus.h b/src/rufus.h index ee2434e8..7c0d2535 100644 --- a/src/rufus.h +++ b/src/rufus.h @@ -1,6 +1,6 @@ /* * Rufus: The Reliable USB Formatting Utility - * Copyright © 2011-2014 Pete Batard + * Copyright © 2011-2015 Pete Batard * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -125,7 +125,6 @@ extern void _uprintf(const char *format, ...); enum user_message_type { UM_FORMAT_COMPLETED = WM_APP, UM_MEDIA_CHANGE, - UM_PROGRESS_CREATE, UM_PROGRESS_INIT, UM_PROGRESS_EXIT, // Start of the WM IDs for the language menu items @@ -331,7 +330,7 @@ enum WindowsVersion { extern HINSTANCE hMainInstance; extern HWND hMainDialog, hLogDlg, hStatus, hDeviceList, hCapacity; extern HWND hPartitionScheme, hFileSystem, hClusterSize, hLabel, hBootType, hNBPasses, hLog; -extern HWND hISOProgressDlg, hISOProgressBar, hISOFileName, hDiskID; +extern HWND hInfo, hProgress, hDiskID; extern float fScale; extern char szFolderPath[MAX_PATH], app_dir[MAX_PATH]; extern char* image_path; @@ -359,7 +358,11 @@ extern BOOL is_x64(void); //extern const char* PrintWindowsVersion(enum WindowsVersion version); extern const char *WindowsErrorString(void); extern void DumpBufferHex(void *buf, size_t size); -extern void PrintStatus(unsigned int duration, BOOL debug, int msg_id, ...); +extern void PrintStatusInfo(BOOL info, BOOL debug, unsigned int duration, int msg_id, ...); +#define PrintStatus(...) PrintStatusInfo(FALSE, FALSE, __VA_ARGS__) +#define PrintStatusDebug(...) PrintStatusInfo(FALSE, TRUE, __VA_ARGS__) +#define PrintInfo(...) PrintStatusInfo(TRUE, FALSE, __VA_ARGS__) +#define PrintInfoDebug(...) PrintStatusInfo(TRUE, TRUE, __VA_ARGS__) extern void UpdateProgress(int op, float percent); extern const char* StrError(DWORD error_code, BOOL use_default_locale); extern char* GuidToString(const GUID* guid); diff --git a/src/rufus.rc b/src/rufus.rc index 3d43d7f4..987a62eb 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -30,12 +30,12 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL // Dialog // -IDD_DIALOG DIALOGEX 12, 12, 242, 329 +IDD_DIALOG DIALOGEX 12, 12, 242, 354 STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Rufus 1.5.0.564" +CAPTION "Rufus 1.5.0.565" FONT 8, "Segoe UI", 400, 0, 0x1 BEGIN - DEFPUSHBUTTON "Start",IDC_START,127,291,50,14 + DEFPUSHBUTTON "Start",IDC_START,127,314,50,14 PUSHBUTTON "...",IDC_SELECT_ISO,207,182,21,14,BS_ICON LTEXT "Device",IDS_DEVICE_TXT,9,6,208,8 PUSHBUTTON "",IDC_LANG,217,2,17,13,BS_TOP | BS_FLAT @@ -63,11 +63,12 @@ BEGIN "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,235,216,10 CONTROL "Use Rufus MBR with BIOS ID",IDC_RUFUS_MBR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,248,112,10 COMBOBOX IDC_DISK_ID,128,246,100,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "",IDC_PROGRESS,"msctls_progress32",PBS_SMOOTH | WS_BORDER,8,272,225,9 - PUSHBUTTON "About...",IDC_ABOUT,8,291,50,14 - PUSHBUTTON "Log",IDC_LOG,63,291,21,14 - PUSHBUTTON "T",IDC_TEST,90,291,12,14,NOT WS_VISIBLE - PUSHBUTTON "Close",IDCANCEL,183,291,50,14 + CONTROL "",IDC_PROGRESS,"msctls_progress32",PBS_SMOOTH | WS_BORDER,8,273,225,9 + EDITTEXT IDC_INFO,8,291,225,11,ES_CENTER | ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER,WS_EX_STATICEDGE + PUSHBUTTON "About...",IDC_ABOUT,8,314,50,14 + PUSHBUTTON "Log",IDC_LOG,63,314,21,14 + PUSHBUTTON "T",IDC_TEST,90,314,12,14,NOT WS_VISIBLE + PUSHBUTTON "Close",IDCANCEL,183,314,50,14 END IDD_ABOUTBOX DIALOGEX 0, 0, 319, 237 @@ -83,16 +84,6 @@ BEGIN CONTROL "",IDC_ABOUT_COPYRIGHTS,"RichEdit20W",ES_MULTILINE | ES_READONLY | WS_VSCROLL,46,115,267,91,WS_EX_STATICEDGE END -IDD_ISO_EXTRACT DIALOGEX 0, 0, 300, 66 -STYLE DS_SETFONT | WS_POPUP | WS_CAPTION -CAPTION "Copying ISO files..." -FONT 8, "Segoe UI", 400, 0, 0x1 -BEGIN - LTEXT "Opening ISO image - please wait...",IDC_ISO_FILENAME,8,10,246,13,SS_PATHELLIPSIS - CONTROL "",IDC_PROGRESS,"msctls_progress32",WS_BORDER,7,26,247,8 - PUSHBUTTON "Cancel",IDC_ISO_ABORT,111,43,50,14 -END - IDD_LICENSE DIALOGEX 0, 0, 335, 205 STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Rufus License" @@ -102,15 +93,15 @@ BEGIN EDITTEXT IDC_LICENSE_TEXT,7,7,321,176,ES_MULTILINE | ES_READONLY | WS_VSCROLL END -IDD_LOG DIALOGEX 0, 0, 366, 329 +IDD_LOG DIALOGEX 0, 0, 366, 354 STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION CAPTION "Log" FONT 8, "Segoe UI", 400, 0, 0x1 BEGIN - EDITTEXT IDC_LOG_EDIT,0,0,366,301,ES_MULTILINE | ES_READONLY | NOT WS_BORDER | WS_VSCROLL,WS_EX_STATICEDGE - PUSHBUTTON "Clear Log",IDC_LOG_CLEAR,198,308,50,14 - PUSHBUTTON "Save Log",IDC_LOG_SAVE,253,308,50,14 - DEFPUSHBUTTON "Close Log",IDCANCEL,308,308,50,14 + EDITTEXT IDC_LOG_EDIT,0,0,366,324,ES_MULTILINE | ES_READONLY | NOT WS_BORDER | WS_VSCROLL,WS_EX_STATICEDGE + PUSHBUTTON "Clear Log",IDC_LOG_CLEAR,198,331,50,14 + PUSHBUTTON "Save Log",IDC_LOG_SAVE,253,331,50,14 + DEFPUSHBUTTON "Close Log",IDCANCEL,308,331,50,14 END IDD_NOTIFICATION DIALOGEX 0, 0, 263, 63 @@ -162,12 +153,12 @@ BEGIN EDITTEXT IDC_DOWNLOAD_URL,15,191,351,13,ES_AUTOHSCROLL | ES_READONLY END -IDD_DIALOG_XP DIALOGEX 12, 12, 242, 329 +IDD_DIALOG_XP DIALOGEX 12, 12, 242, 354 STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Rufus 1.5.0.564" +CAPTION "Rufus 1.5.0.565" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - DEFPUSHBUTTON "Start",IDC_START,127,291,50,14 + DEFPUSHBUTTON "Start",IDC_START,127,314,50,14 PUSHBUTTON "...",IDC_SELECT_ISO,207,182,21,14,BS_ICON LTEXT "Device",IDS_DEVICE_TXT,9,6,208,8 PUSHBUTTON "",IDC_LANG,217,2,17,13,BS_TOP | BS_FLAT @@ -195,11 +186,12 @@ BEGIN "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,235,216,10 CONTROL "Use Rufus MBR with BIOS ID",IDC_RUFUS_MBR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,248,112,10 COMBOBOX IDC_DISK_ID,128,246,100,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "",IDC_PROGRESS,"msctls_progress32",PBS_SMOOTH | WS_BORDER,8,272,225,9 - PUSHBUTTON "About...",IDC_ABOUT,8,291,50,14 - PUSHBUTTON "Log",IDC_LOG,63,291,21,14 - PUSHBUTTON "T",IDC_TEST,90,291,12,14,NOT WS_VISIBLE - PUSHBUTTON "Close",IDCANCEL,183,291,50,14 + CONTROL "",IDC_PROGRESS,"msctls_progress32",PBS_SMOOTH | WS_BORDER,8,273,225,9 + EDITTEXT IDC_INFO,8,291,225,11,ES_CENTER | ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER,WS_EX_STATICEDGE + PUSHBUTTON "About...",IDC_ABOUT,8,314,50,14 + PUSHBUTTON "Log",IDC_LOG,63,314,21,14 + PUSHBUTTON "T",IDC_TEST,90,314,12,14,NOT WS_VISIBLE + PUSHBUTTON "Close",IDCANCEL,183,314,50,14 END IDD_ABOUTBOX_XP DIALOGEX 0, 0, 319, 237 @@ -215,16 +207,6 @@ BEGIN CONTROL "",IDC_ABOUT_COPYRIGHTS,"RichEdit20W",ES_MULTILINE | ES_READONLY | WS_VSCROLL,46,115,267,91,WS_EX_STATICEDGE END -IDD_ISO_EXTRACT_XP DIALOGEX 0, 0, 300, 66 -STYLE DS_SETFONT | WS_POPUP | WS_CAPTION -CAPTION "Copying ISO files..." -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - LTEXT "Opening ISO image - please wait...",IDC_ISO_FILENAME,8,10,246,13,SS_PATHELLIPSIS - CONTROL "",IDC_PROGRESS,"msctls_progress32",WS_BORDER,7,26,247,8 - PUSHBUTTON "Cancel",IDC_ISO_ABORT,111,43,50,14 -END - IDD_LICENSE_XP DIALOGEX 0, 0, 335, 205 STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Rufus License" @@ -234,15 +216,15 @@ BEGIN EDITTEXT IDC_LICENSE_TEXT,7,7,321,176,ES_MULTILINE | ES_READONLY | WS_VSCROLL END -IDD_LOG_XP DIALOGEX 0, 0, 366, 329 +IDD_LOG_XP DIALOGEX 0, 0, 366, 354 STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION CAPTION "Log" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - EDITTEXT IDC_LOG_EDIT,0,0,366,301,ES_MULTILINE | ES_READONLY | NOT WS_BORDER | WS_VSCROLL,WS_EX_STATICEDGE - PUSHBUTTON "Clear Log",IDC_LOG_CLEAR,198,308,50,14 - PUSHBUTTON "Save Log",IDC_LOG_SAVE,253,308,50,14 - DEFPUSHBUTTON "Close Log",IDCANCEL,308,308,50,14 + EDITTEXT IDC_LOG_EDIT,0,0,366,324,ES_MULTILINE | ES_READONLY | NOT WS_BORDER | WS_VSCROLL,WS_EX_STATICEDGE + PUSHBUTTON "Clear Log",IDC_LOG_CLEAR,198,331,50,14 + PUSHBUTTON "Save Log",IDC_LOG_SAVE,253,331,50,14 + DEFPUSHBUTTON "Close Log",IDCANCEL,308,331,50,14 END IDD_NOTIFICATION_XP DIALOGEX 0, 0, 263, 63 @@ -294,13 +276,13 @@ BEGIN EDITTEXT IDC_DOWNLOAD_URL,15,191,351,13,ES_AUTOHSCROLL | ES_READONLY END -IDD_DIALOG_RTL DIALOGEX 12, 12, 242, 329 +IDD_DIALOG_RTL DIALOGEX 12, 12, 242, 354 STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL -CAPTION "Rufus 1.5.0.564" +CAPTION "Rufus 1.5.0.565" FONT 8, "Segoe UI", 400, 0, 0x1 BEGIN - DEFPUSHBUTTON "Start",IDC_START,127,291,50,14 + DEFPUSHBUTTON "Start",IDC_START,127,314,50,14 PUSHBUTTON "...",IDC_SELECT_ISO,207,182,21,14,BS_ICON LTEXT "Device",IDS_DEVICE_TXT,9,6,208,8 PUSHBUTTON "",IDC_LANG,217,2,17,13,BS_TOP | BS_FLAT @@ -328,11 +310,12 @@ BEGIN "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,235,216,10 CONTROL "Use Rufus MBR with BIOS ID",IDC_RUFUS_MBR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,248,112,10 COMBOBOX IDC_DISK_ID,128,246,100,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "",IDC_PROGRESS,"msctls_progress32",PBS_SMOOTH | WS_BORDER,8,272,225,9 - PUSHBUTTON "About...",IDC_ABOUT,8,291,50,14 - PUSHBUTTON "Log",IDC_LOG,63,291,21,14 - PUSHBUTTON "T",IDC_TEST,90,291,12,14,NOT WS_VISIBLE - PUSHBUTTON "Close",IDCANCEL,183,291,50,14 + CONTROL "",IDC_PROGRESS,"msctls_progress32",PBS_SMOOTH | WS_BORDER,8,273,225,9 + EDITTEXT IDC_INFO,8,291,225,11,ES_CENTER | ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER,WS_EX_STATICEDGE + PUSHBUTTON "About...",IDC_ABOUT,8,314,50,14 + PUSHBUTTON "Log",IDC_LOG,63,314,21,14 + PUSHBUTTON "T",IDC_TEST,90,314,12,14,NOT WS_VISIBLE + PUSHBUTTON "Close",IDCANCEL,183,314,50,14 END IDD_ABOUTBOX_RTL DIALOGEX 0, 0, 319, 237 @@ -349,17 +332,6 @@ BEGIN CONTROL "",IDC_ABOUT_COPYRIGHTS,"RichEdit20W",ES_MULTILINE | ES_READONLY | WS_VSCROLL,46,115,267,91,WS_EX_STATICEDGE END -IDD_ISO_EXTRACT_RTL DIALOGEX 0, 0, 300, 66 -STYLE DS_SETFONT | WS_POPUP | WS_CAPTION -EXSTYLE WS_EX_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL -CAPTION "Copying ISO files..." -FONT 8, "Segoe UI", 400, 0, 0x1 -BEGIN - LTEXT "Opening ISO image - please wait...",IDC_ISO_FILENAME,8,10,246,13,SS_PATHELLIPSIS - CONTROL "",IDC_PROGRESS,"msctls_progress32",WS_BORDER,7,26,247,8 - PUSHBUTTON "Cancel",IDC_ISO_ABORT,111,43,50,14 -END - IDD_LICENSE_RTL DIALOGEX 0, 0, 335, 205 STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL @@ -370,16 +342,16 @@ BEGIN EDITTEXT IDC_LICENSE_TEXT,7,7,321,176,ES_RIGHT | ES_MULTILINE | ES_READONLY | WS_VSCROLL,WS_EX_RIGHT | WS_EX_RTLREADING | WS_EX_LEFTSCROLLBAR END -IDD_LOG_RTL DIALOGEX 0, 0, 366, 329 +IDD_LOG_RTL DIALOGEX 0, 0, 366, 354 STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION EXSTYLE WS_EX_APPWINDOW | WS_EX_LAYOUTRTL CAPTION "Log" FONT 8, "Segoe UI", 400, 0, 0x1 BEGIN - EDITTEXT IDC_LOG_EDIT,0,0,366,301,ES_RIGHT | ES_MULTILINE | ES_READONLY | NOT WS_BORDER | WS_VSCROLL,WS_EX_RIGHT | WS_EX_RTLREADING | WS_EX_LEFTSCROLLBAR | WS_EX_STATICEDGE - PUSHBUTTON "Clear Log",IDC_LOG_CLEAR,198,308,50,14 - PUSHBUTTON "Save Log",IDC_LOG_SAVE,253,308,50,14 - DEFPUSHBUTTON "Close Log",IDCANCEL,308,308,50,14 + EDITTEXT IDC_LOG_EDIT,0,0,366,324,ES_MULTILINE | ES_READONLY | NOT WS_BORDER | WS_VSCROLL,WS_EX_STATICEDGE + PUSHBUTTON "Clear Log",IDC_LOG_CLEAR,198,331,50,14 + PUSHBUTTON "Save Log",IDC_LOG_SAVE,253,331,50,14 + DEFPUSHBUTTON "Close Log",IDCANCEL,308,331,50,14 END IDD_NOTIFICATION_RTL DIALOGEX 0, 0, 263, 63 @@ -434,13 +406,13 @@ BEGIN EDITTEXT IDC_DOWNLOAD_URL,15,191,351,13,ES_AUTOHSCROLL | ES_READONLY END -IDD_DIALOG_RTL_XP DIALOGEX 12, 12, 242, 329 +IDD_DIALOG_RTL_XP DIALOGEX 12, 12, 242, 354 STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL -CAPTION "Rufus 1.5.0.564" +CAPTION "Rufus 1.5.0.565" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - DEFPUSHBUTTON "Start",IDC_START,127,291,50,14 + DEFPUSHBUTTON "Start",IDC_START,127,314,50,14 PUSHBUTTON "...",IDC_SELECT_ISO,207,182,21,14,BS_ICON LTEXT "Device",IDS_DEVICE_TXT,9,6,208,8 PUSHBUTTON "",IDC_LANG,217,2,17,13,BS_TOP | BS_FLAT @@ -468,11 +440,12 @@ BEGIN "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,235,216,10 CONTROL "Use Rufus MBR with BIOS ID",IDC_RUFUS_MBR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,248,112,10 COMBOBOX IDC_DISK_ID,128,246,100,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "",IDC_PROGRESS,"msctls_progress32",PBS_SMOOTH | WS_BORDER,8,272,225,9 - PUSHBUTTON "About...",IDC_ABOUT,8,291,50,14 - PUSHBUTTON "Log",IDC_LOG,63,291,21,14 - PUSHBUTTON "T",IDC_TEST,90,291,12,14,NOT WS_VISIBLE - PUSHBUTTON "Close",IDCANCEL,183,291,50,14 + CONTROL "",IDC_PROGRESS,"msctls_progress32",PBS_SMOOTH | WS_BORDER,8,273,225,9 + EDITTEXT IDC_INFO,8,291,225,11,ES_CENTER | ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER,WS_EX_STATICEDGE + PUSHBUTTON "About...",IDC_ABOUT,8,314,50,14 + PUSHBUTTON "Log",IDC_LOG,63,314,21,14 + PUSHBUTTON "T",IDC_TEST,90,314,12,14,NOT WS_VISIBLE + PUSHBUTTON "Close",IDCANCEL,183,314,50,14 END IDD_ABOUTBOX_RTL_XP DIALOGEX 0, 0, 319, 237 @@ -489,17 +462,6 @@ BEGIN CONTROL "",IDC_ABOUT_COPYRIGHTS,"RichEdit20W",ES_MULTILINE | ES_READONLY | WS_VSCROLL,46,115,267,91,WS_EX_STATICEDGE END -IDD_ISO_EXTRACT_RTL_XP DIALOGEX 0, 0, 300, 66 -STYLE DS_SETFONT | WS_POPUP | WS_CAPTION -EXSTYLE WS_EX_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL -CAPTION "Copying ISO files..." -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - LTEXT "Opening ISO image - please wait...",IDC_ISO_FILENAME,8,10,246,13,SS_PATHELLIPSIS - CONTROL "",IDC_PROGRESS,"msctls_progress32",WS_BORDER,7,26,247,8 - PUSHBUTTON "Cancel",IDC_ISO_ABORT,111,43,50,14 -END - IDD_LICENSE_RTL_XP DIALOGEX 0, 0, 335, 205 STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL @@ -510,16 +472,16 @@ BEGIN EDITTEXT IDC_LICENSE_TEXT,7,7,321,176,ES_RIGHT | ES_MULTILINE | ES_READONLY | WS_VSCROLL,WS_EX_RIGHT | WS_EX_RTLREADING | WS_EX_LEFTSCROLLBAR END -IDD_LOG_RTL_XP DIALOGEX 0, 0, 366, 329 +IDD_LOG_RTL_XP DIALOGEX 0, 0, 366, 354 STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION EXSTYLE WS_EX_APPWINDOW | WS_EX_LAYOUTRTL CAPTION "Log" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - EDITTEXT IDC_LOG_EDIT,0,0,366,301,ES_RIGHT | ES_MULTILINE | ES_READONLY | NOT WS_BORDER | WS_VSCROLL,WS_EX_RIGHT | WS_EX_RTLREADING | WS_EX_LEFTSCROLLBAR | WS_EX_STATICEDGE - PUSHBUTTON "Clear Log",IDC_LOG_CLEAR,198,308,50,14 - PUSHBUTTON "Save Log",IDC_LOG_SAVE,253,308,50,14 - DEFPUSHBUTTON "Close Log",IDCANCEL,308,308,50,14 + EDITTEXT IDC_LOG_EDIT,0,0,366,324,ES_MULTILINE | ES_READONLY | NOT WS_BORDER | WS_VSCROLL,WS_EX_STATICEDGE + PUSHBUTTON "Clear Log",IDC_LOG_CLEAR,198,331,50,14 + PUSHBUTTON "Save Log",IDC_LOG_SAVE,253,331,50,14 + DEFPUSHBUTTON "Close Log",IDCANCEL,308,331,50,14 END IDD_NOTIFICATION_RTL_XP DIALOGEX 0, 0, 263, 63 @@ -670,10 +632,6 @@ BEGIN BEGIN END - IDD_ISO_EXTRACT, DIALOG - BEGIN - END - IDD_LICENSE, DIALOG BEGIN END @@ -703,8 +661,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,5,0,564 - PRODUCTVERSION 1,5,0,564 + FILEVERSION 1,5,0,565 + PRODUCTVERSION 1,5,0,565 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -721,13 +679,13 @@ BEGIN BEGIN VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "1.5.0.564" + VALUE "FileVersion", "1.5.0.565" VALUE "InternalName", "Rufus" - VALUE "LegalCopyright", "© 2011-2014 Pete Batard (GPL v3)" + VALUE "LegalCopyright", "© 2011-2015 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" VALUE "OriginalFilename", "rufus.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "1.5.0.564" + VALUE "ProductVersion", "1.5.0.565" END END BLOCK "VarFileInfo" diff --git a/src/stdfn.c b/src/stdfn.c index c6ddfdfd..5437e150 100644 --- a/src/stdfn.c +++ b/src/stdfn.c @@ -1,7 +1,7 @@ /* * Rufus: The Reliable USB Formatting Utility * Standard Windows function calls - * Copyright © 2013-2014 Pete Batard + * Copyright © 2013-2015 Pete Batard * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -474,7 +474,7 @@ BOOL FileIO(BOOL save, char* path, char** buffer, DWORD* size) goto out; } - PrintStatus(0, TRUE, save?MSG_216:MSG_215, path); + PrintInfoDebug(0, save?MSG_216:MSG_215, path); ret = TRUE; out: diff --git a/src/stdlg.c b/src/stdlg.c index d75c0c3e..0ea61db8 100644 --- a/src/stdlg.c +++ b/src/stdlg.c @@ -1,7 +1,7 @@ /* * Rufus: The Reliable USB Formatting Utility * Standard Dialog Routines (Browse for folder, About, etc) - * Copyright © 2011-2014 Pete Batard + * Copyright © 2011-2015 Pete Batard * * Based on zadig_stdlg.c, part of libwdi: http://libwdi.akeo.ie * @@ -1244,11 +1244,11 @@ INT_PTR CALLBACK NewVersionCallback(HWND hDlg, UINT message, WPARAM wParam, LPAR memset(&pi, 0, sizeof(pi)); si.cb = sizeof(si); if (!CreateProcessU(filepath, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) { - PrintStatus(0, FALSE, MSG_214); + PrintInfo(0, MSG_214); // TODO: produce a message box and add a retry, as the file may be scanned by the Antivirus uprintf("Failed to launch new application: %s\n", WindowsErrorString()); } else { - PrintStatus(0, FALSE, MSG_213); + PrintInfo(0, MSG_213); PostMessage(hDlg, WM_COMMAND, (WPARAM)IDCLOSE, 0); PostMessage(hMainDialog, WM_CLOSE, 0, 0); } diff --git a/src/syslinux.c b/src/syslinux.c index 15c414d7..9ca15711 100644 --- a/src/syslinux.c +++ b/src/syslinux.c @@ -2,7 +2,7 @@ * * Copyright 2003 Lars Munch Christensen - All Rights Reserved * Copyright 1998-2008 H. Peter Anvin - All Rights Reserved - * Copyright 2012-2014 Pete Batard + * Copyright 2012-2015 Pete Batard * * Based on the Linux installer program for SYSLINUX by H. Peter Anvin * @@ -98,7 +98,7 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int fs_type) int dt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType)); BOOL use_v5 = (dt == DT_SYSLINUX_V6) || ((dt == DT_ISO) && (SL_MAJOR(iso_report.sl_version) >= 5)); - PrintStatus(0, TRUE, MSG_234, (dt == DT_ISO)?iso_report.sl_version_str:embedded_sl_version_str[use_v5?1:0]); + PrintInfoDebug(0, MSG_234, (dt == DT_ISO)?iso_report.sl_version_str:embedded_sl_version_str[use_v5?1:0]); /* Initialize the ADV -- this should be smarter */ syslinux_reset_adv(syslinux_adv);