From 2e817ae944c8a9f9487d979fa859ed8c953d04ca Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Thu, 8 Jan 2015 00:22:56 +0000 Subject: [PATCH] [misc] pocketful of enhancement and fixes - part 1 * Add a cheat mode for VMWare disk detection * Add a cheat mode to delete the rufus_files directory * Don't attempt a grub2 download in case we couldn't read the version * Don't use a shared message buffer between info and status and also use a more logical handling of low pri/high pri and timeout * Also fix unwanted selection of info text on restore from minimize * Also fix the localization generation and add more messages --- res/localization/rufus.loc | 9 ++++- src/iso.c | 7 +++- src/localization.c | 76 +++++++++++++++++++++++--------------- src/localization_data.h | 2 + src/localization_data.sh | 6 ++- src/msapi_utf8.h | 15 ++++++++ src/resource.h | 4 +- src/rufus.c | 30 ++++++++++++--- src/rufus.h | 3 +- src/rufus.rc | 24 ++++++------ src/usb.c | 6 +-- 11 files changed, 124 insertions(+), 58 deletions(-) diff --git a/res/localization/rufus.loc b/res/localization/rufus.loc index 96fd60dc..59c6febd 100644 --- a/res/localization/rufus.loc +++ b/res/localization/rufus.loc @@ -360,9 +360,12 @@ 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" +t MSG_193 "Downloaded %s" +t MSG_194 "Could not download %s" +# eg. "Using embedded version of Grub2 file(s)" +t MSG_195 "Using embedded version of %s file(s)" # Status messages - these messages will appear on the status bar t MSG_201 "Cancelling - Please wait..." @@ -435,7 +438,7 @@ t MSG_249 "Failed to delete application registry keys" t MSG_250 "%s enabled" t MSG_251 "%s disabled" t MSG_252 "Size checks" -t MSG_253 "Fixed disks detection" +t MSG_253 "Hard disk detection" t MSG_254 "Force large FAT32 formatting" t MSG_255 "NoDriveTypeAutorun will be deleted on exit" t MSG_256 "Fake drive detection" @@ -448,6 +451,8 @@ t MSG_261 "Writing image: %0.1f%% completed" t MSG_262 "ISO Support" # Cheat mode to force legacy size units, where 1 KB is 1024 bytes and NOT that fake 1000 bytes abomination! t MSG_263 "Use PROPER size units" +t MSG_264 "Deleting directory '%s'" +t MSG_265 "VMWare disk detection" ################################################################################ ############################# TRANSLATOR END COPY ############################## ################################################################################ diff --git a/src/iso.c b/src/iso.c index c4759105..8a651814 100644 --- a/src/iso.c +++ b/src/iso.c @@ -755,7 +755,7 @@ out: } if (iso_report.has_grub2) { // In case we have a GRUB2 based iso, we extract boot/grub/i386-pc/normal.mod to parse its version - strcpy(iso_report.grub2_version, "unknown"); + iso_report.grub2_version[0] = 0; if ((GetTempPathU(sizeof(path), path) != 0) && (GetTempFileNameU(path, APPLICATION_NAME, 0, path) != 0)) { size = (size_t)ExtractISOFile(src_iso, "boot/grub/i386-pc/normal.mod", path, FILE_ATTRIBUTE_NORMAL); buf = (char*)calloc(size, 1); @@ -770,7 +770,10 @@ out: free(buf); _unlink(path); } - uprintf("Detected Grub version: %s", iso_report.grub2_version); + if (iso_report.grub2_version[0] != 0) + uprintf("Detected Grub version: %s", iso_report.grub2_version); + else + uprintf("Could not detect Grub2 version"); } StrArrayDestroy(&config_path); StrArrayDestroy(&isolinux_path); diff --git a/src/localization.c b/src/localization.c index 6ed2ae9e..a4604a6d 100644 --- a/src/localization.c +++ b/src/localization.c @@ -396,39 +396,51 @@ char* lmprintf(int msg_id, ...) } /* - * Display a localized message on the status bar as well as its English counterpart in the - * log (if debug is set). If duration is non zero, ensures that message is displayed for at - * least duration ms, regardless of any other incoming message + * The following calls help display a localized message on the info field or status bar as well as its + * _English_ counterpart in the log (if debug is set). + * If duration is non zero, that message is displayed for at least duration ms, regardless of + * any other incoming message. After that time, the display reverts to the last non-timeout message. */ +// TODO: handle a timeout message overriding a timeout message +#define MSG_LEN 256 +#define MSG_STATUS 0 +#define MSG_INFO 1 +#define MSG_LOW_PRI 0 +#define MSG_HIGH_PRI 1 +char szMessage[2][2][MSG_LEN] = { 0 }; +char* szStatusMessage = szMessage[MSG_STATUS][MSG_HIGH_PRI]; static BOOL bStatusTimerArmed = FALSE; -char szStatusMessage[256] = { 0 }; -static void CALLBACK PrintStatusTimeout(HWND hWnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) + +static __inline OutputMessage(BOOL info, char* msg) { - bStatusTimerArmed = FALSE; - // potentially display lower priority message that was overridden - SendMessageLU(GetDlgItem(hMainDialog, IDC_STATUS), SB_SETTEXTW, SBT_OWNERDRAW, szStatusMessage); - KillTimer(hMainDialog, TID_MESSAGE); + if (info) + SetWindowTextU(hInfo, msg); + else + SendMessageLU(GetDlgItem(hMainDialog, IDC_STATUS), SB_SETTEXTW, SBT_OWNERDRAW, msg); } -static void CALLBACK PrintInfoTimeout(HWND hWnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) +static void CALLBACK PrintMessageTimeout(HWND hWnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) { bStatusTimerArmed = FALSE; - SetWindowTextU(hInfo, szStatusMessage); - KillTimer(hMainDialog, TID_MESSAGE); + // We're going to print high priority message, so restore our pointer + if (idEvent != TID_MESSAGE_INFO) + szStatusMessage = szMessage[MSG_STATUS][MSG_HIGH_PRI]; + OutputMessage((idEvent == TID_MESSAGE_INFO), szMessage[(idEvent == TID_MESSAGE_INFO)?MSG_INFO:MSG_STATUS][MSG_HIGH_PRI]); + KillTimer(hMainDialog, idEvent); } void PrintStatusInfo(BOOL info, BOOL debug, unsigned int duration, int msg_id, ...) { - char *format = NULL, buf[sizeof(szStatusMessage)]; + char *format = NULL, buf[MSG_LEN]; + char *msg_hi = szMessage[info?MSG_INFO:MSG_STATUS][MSG_HIGH_PRI]; + char *msg_lo = szMessage[info?MSG_INFO:MSG_STATUS][MSG_LOW_PRI]; + char *msg_cur = (duration > 0)?msg_lo:msg_hi; va_list args; if (msg_id < 0) { - // A negative msg_id clears the text area - szStatusMessage[0] = 0; - if (info) - SetWindowTextU(hInfo, szStatusMessage); - else - SendMessageLU(GetDlgItem(hMainDialog, IDC_STATUS), SB_SETTEXTW, SBT_OWNERDRAW, szStatusMessage); + // A negative msg_id clears the message + msg_hi[0] = 0; + OutputMessage(info, msg_hi); return; } @@ -437,29 +449,32 @@ void PrintStatusInfo(BOOL info, BOOL debug, unsigned int duration, int msg_id, . return; } + // We need to keep track of where szStatusMessage should point to so that ellipses work + if (!info) + szStatusMessage = szMessage[MSG_STATUS][(duration > 0)?MSG_LOW_PRI:MSG_HIGH_PRI]; + format = msg_table[msg_id - MSG_000]; if (format == NULL) { - safe_sprintf(szStatusMessage, sizeof(szStatusMessage), "MSG_%03d UNTRANSLATED", msg_id - MSG_000); + safe_sprintf(msg_hi, MSG_LEN, "MSG_%03d UNTRANSLATED", msg_id - MSG_000); + uprintf(msg_hi); + OutputMessage(info, msg_hi); return; } va_start(args, msg_id); - safe_vsnprintf(szStatusMessage, sizeof(szStatusMessage), format, args); + safe_vsnprintf(msg_cur, MSG_LEN, format, args); va_end(args); - szStatusMessage[sizeof(szStatusMessage)-1] = '\0'; + msg_cur[MSG_LEN-1] = '\0'; - if ((duration != 0) || (!bStatusTimerArmed)) { - if (info) - SetWindowTextU(hInfo, szStatusMessage); - else - SendMessageLU(GetDlgItem(hMainDialog, IDC_STATUS), SB_SETTEXTW, SBT_OWNERDRAW, szStatusMessage); - } + if ((duration != 0) || (!bStatusTimerArmed)) + OutputMessage(info, msg_cur); if (duration != 0) { - SetTimer(hMainDialog, TID_MESSAGE, duration, (info)?PrintInfoTimeout:PrintStatusTimeout); + SetTimer(hMainDialog, (info)?TID_MESSAGE_INFO:TID_MESSAGE_STATUS, duration, PrintMessageTimeout); bStatusTimerArmed = TRUE; } + // Because we want the log messages in English, we go through the VA business once more, but this time with default_msg_table if (debug) { format = default_msg_table[msg_id - MSG_000]; if (format == NULL) { @@ -467,8 +482,9 @@ void PrintStatusInfo(BOOL info, BOOL debug, unsigned int duration, int msg_id, . return; } va_start(args, msg_id); - safe_vsnprintf(buf, sizeof(szStatusMessage)-1, format, args); + safe_vsnprintf(buf, MSG_LEN, format, args); va_end(args); + buf[MSG_LEN-1] = '\0'; uprintf(buf); } } diff --git a/src/localization_data.h b/src/localization_data.h index 7fcc6d4f..7a208e5c 100644 --- a/src/localization_data.h +++ b/src/localization_data.h @@ -360,6 +360,8 @@ const loc_control_id control_id[] = { LOC_CTRL(MSG_261), LOC_CTRL(MSG_262), LOC_CTRL(MSG_263), + LOC_CTRL(MSG_264), + LOC_CTRL(MSG_265), LOC_CTRL(MSG_MAX), LOC_CTRL(IDOK), LOC_CTRL(IDCANCEL), diff --git a/src/localization_data.sh b/src/localization_data.sh index 7cb19198..6a8a977e 100755 --- a/src/localization_data.sh +++ b/src/localization_data.sh @@ -39,7 +39,9 @@ cat > cmd.sed <<\_EOF const loc_control_id control_id[] = {\ // The dialog IDs must come first -# Add the control entries - must be in IDD_, IDC_, IDS_ or MSG_ +# Add the control entries - must be in IDD_, IDC_, IDS_ or MSG_ (and not contain _XP or _RTL suffix) +s/^.* IDD_.*_RTL .*// +s/^.* IDD_.*_XP .*// s/^#define \([I|M][D|S][D|C|S|G]_[^ ]*\) .*/\ LOC_CTRL(\1),/ # Add standard IDs from windows.h and close table @@ -71,6 +73,8 @@ cat > cmd.sed <<\_EOF loc_dlg_list loc_dlg[] = { # Add the dialog entries - must start with IDD_ +s/^.* IDD_.*_RTL .*// +s/^.* IDD_.*_XP .*// s/^#define \(IDD_[^ ]*\) .*/\ LOC_DLG(\1),/ # Close the table diff --git a/src/msapi_utf8.h b/src/msapi_utf8.h index 578fb2f4..87609fe0 100644 --- a/src/msapi_utf8.h +++ b/src/msapi_utf8.h @@ -499,6 +499,21 @@ static __inline int SHCreateDirectoryExU(HWND hwnd, const char* pszPath, SECURIT return ret; } +static __inline int SHDeleteDirectoryExU(HWND hwnd, const char* pszPath, FILEOP_FLAGS fFlags) +{ + int ret; + // String needs to be double NULL terminated, so we just use the length of the UTF-8 string + // which is always expected to be larger than our UTF-16 one, and add 2 chars for good measure. + size_t wpszPath_len = strlen(pszPath) + 2; + wchar_t* wpszPath = (wchar_t*)calloc(wpszPath_len, sizeof(wchar_t)); + utf8_to_wchar_no_alloc(pszPath, wpszPath, wpszPath_len); + // FOF_SILENT | FOF_NOERRORUI | FOF_NOCONFIRMATION, + SHFILEOPSTRUCTW shfo = { hwnd, FO_DELETE, wpszPath, NULL, fFlags, FALSE, NULL, NULL }; + ret = SHFileOperationW(&shfo); + wfree(pszPath); + return ret; +} + static __inline BOOL ShellExecuteExU(SHELLEXECUTEINFOA* lpExecInfo) { BOOL ret = FALSE; diff --git a/src/resource.h b/src/resource.h index fbb18851..093cf2d2 100644 --- a/src/resource.h +++ b/src/resource.h @@ -396,7 +396,9 @@ #define MSG_261 3261 #define MSG_262 3262 #define MSG_263 3263 -#define MSG_MAX 3264 +#define MSG_264 3264 +#define MSG_265 3265 +#define MSG_MAX 3266 // Next default values for new objects // diff --git a/src/rufus.c b/src/rufus.c index 75db12b3..47dd4381 100644 --- a/src/rufus.c +++ b/src/rufus.c @@ -128,7 +128,7 @@ 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; -BOOL allow_dual_uefi_bios = FALSE; +BOOL allow_dual_uefi_bios = FALSE, enable_vmdk = FALSE; int dialog_showing = 0; uint16_t rufus_version[4], embedded_sl_version[2]; char embedded_sl_version_str[2][12] = { "?.??", "?.??" }; @@ -137,7 +137,7 @@ char embedded_grub_version[] = GRUB4DOS_VERSION; char embedded_grub2_version[] = GRUB2_PACKAGE_VERSION; RUFUS_UPDATE update = { {0,0,0,0}, {0,0}, NULL, NULL}; StrArray DriveID, DriveLabel; -extern char szStatusMessage[256]; +extern char* szStatusMessage; static HANDLE format_thid = NULL; static HWND hBoot = NULL, hSelectISO = NULL; @@ -953,6 +953,7 @@ DWORD WINAPI ISOScanThread(LPVOID param) PrintInfo(0, MSG_081); MessageBoxU(hMainDialog, lmprintf(MSG_082), lmprintf(MSG_081), MB_OK|MB_ICONINFORMATION|MB_IS_RTL); safe_free(image_path); + PrintStatus(0, MSG_086); SetMBRProps(); } else { // Enable bootable and set Target System and FS accordingly @@ -1137,7 +1138,8 @@ static BOOL BootCheck(void) return FALSE; } - if ((iso_report.has_grub2) && (safe_strcmp(iso_report.grub2_version, embedded_grub2_version) != 0)) { + if ((iso_report.has_grub2) && (iso_report.grub2_version[0] != 0) && + (strcmp(iso_report.grub2_version, embedded_grub2_version) != 0)) { // We may have to download a different Grub2 version if we can find one IGNORE_RETVAL(_chdirU(app_dir)); IGNORE_RETVAL(_mkdir(FILES_DIR)); @@ -1173,9 +1175,11 @@ static BOOL BootCheck(void) PromptOnError = FALSE; grub2_len = (long)DownloadFile(tmp, &tmp[sizeof(FILES_URL)], hMainDialog); PromptOnError = TRUE; - if (grub2_len <= 0) + if (grub2_len <= 0) { + PrintInfo(0, MSG_195, "Grub2"); uprintf("%s was not found - will use embedded version\n", tmp); - else { + } else { + PrintInfo(0, MSG_193, tmp); fd = fopen(&tmp[sizeof(FILES_URL)], "rb"); grub2_buf = malloc(grub2_len); if ((fd == NULL) || (grub2_buf == NULL) || (fread(grub2_buf, 1, (size_t)grub2_len, fd) != (size_t)grub2_len)) { @@ -2045,7 +2049,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); + PrintStatus(0, MSG_086); break; } } @@ -2583,6 +2587,20 @@ relaunch: GetUSBDevices(0); continue; } + // Alt-W => Enable VMWare disk detection + if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'W')) { + enable_vmdk = !enable_vmdk; + PrintStatus2000(lmprintf(MSG_265), !enable_vmdk); + GetUSBDevices(0); + continue; + } + // Alt-X => Delete the 'rufus_files' subdirectory + if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'X')) { + static_sprintf(tmp_path, "%s\\%s", app_dir, FILES_DIR); + PrintStatus(2000, MSG_264, tmp_path); + SHDeleteDirectoryExU(NULL, tmp_path, FOF_SILENT | FOF_NOERRORUI | FOF_NOCONFIRMATION); + continue; + } TranslateMessage(&msg); DispatchMessage(&msg); } diff --git a/src/rufus.h b/src/rufus.h index 7c0d2535..b5094efa 100644 --- a/src/rufus.h +++ b/src/rufus.h @@ -146,7 +146,8 @@ typedef struct { /* Timers used throughout the program */ enum timer_type { - TID_MESSAGE = 0x1000, + TID_MESSAGE_INFO = 0x1000, + TID_MESSAGE_STATUS, TID_BADBLOCKS_UPDATE, TID_APP_TIMER, TID_BLOCKING_TIMER, diff --git a/src/rufus.rc b/src/rufus.rc index 08534d9f..949071d4 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -32,7 +32,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL IDD_DIALOG DIALOGEX 12, 12, 242, 354 STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Rufus 2.0.0.566" +CAPTION "Rufus 2.0.0.567" FONT 8, "Segoe UI", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "Start",IDC_START,127,314,50,14 @@ -64,7 +64,7 @@ BEGIN 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,273,225,9 - EDITTEXT IDC_INFO,8,291,225,11,ES_CENTER | ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER,WS_EX_STATICEDGE + EDITTEXT IDC_INFO,8,291,225,11,ES_CENTER | ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP,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 @@ -155,7 +155,7 @@ END 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 2.0.0.566" +CAPTION "Rufus 2.0.0.567" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "Start",IDC_START,127,314,50,14 @@ -187,7 +187,7 @@ BEGIN 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,273,225,9 - EDITTEXT IDC_INFO,8,291,225,11,ES_CENTER | ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER,WS_EX_STATICEDGE + EDITTEXT IDC_INFO,8,291,225,11,ES_CENTER | ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP,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 @@ -279,7 +279,7 @@ END 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 2.0.0.566" +CAPTION "Rufus 2.0.0.567" FONT 8, "Segoe UI", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "Start",IDC_START,127,314,50,14 @@ -311,7 +311,7 @@ BEGIN 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,273,225,9 - EDITTEXT IDC_INFO,8,291,225,11,ES_CENTER | ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER,WS_EX_STATICEDGE + EDITTEXT IDC_INFO,8,291,225,11,ES_CENTER | ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP,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 @@ -409,7 +409,7 @@ END 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 2.0.0.566" +CAPTION "Rufus 2.0.0.567" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "Start",IDC_START,127,314,50,14 @@ -441,7 +441,7 @@ BEGIN 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,273,225,9 - EDITTEXT IDC_INFO,8,291,225,11,ES_CENTER | ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER,WS_EX_STATICEDGE + EDITTEXT IDC_INFO,8,291,225,11,ES_CENTER | ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP,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 @@ -661,8 +661,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,0,0,566 - PRODUCTVERSION 2,0,0,566 + FILEVERSION 2,0,0,567 + PRODUCTVERSION 2,0,0,567 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -679,13 +679,13 @@ BEGIN BEGIN VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "2.0.0.566" + VALUE "FileVersion", "2.0.0.567" VALUE "InternalName", "Rufus" 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", "2.0.0.566" + VALUE "ProductVersion", "2.0.0.567" END END BLOCK "VarFileInfo" diff --git a/src/usb.c b/src/usb.c index 6535a1a3..10c8874b 100644 --- a/src/usb.c +++ b/src/usb.c @@ -41,7 +41,7 @@ #include "usb.h" extern StrArray DriveID, DriveLabel; -extern BOOL enable_HDDs, use_fake_units; +extern BOOL enable_HDDs, use_fake_units, enable_vmdk; /* * Get the VID, PID and current device speed @@ -112,10 +112,10 @@ static __inline BOOL IsVHD(const char* buffer) "Arsenal_________Virtual_", "KernSafeVirtual_________", "Msft____Virtual_Disk____", -// "VMware__VMware_Virtual_S" // Would list primary disks on VMWare instances, so we avoid it + "VMware__VMware_Virtual_S" // Enabled through a cheat mode, as this lists primary disks on VMWare instances }; - for (i = 0; i < ARRAYSIZE(vhd_name); i++) + for (i = 0; i < (int)(ARRAYSIZE(vhd_name)-(enable_vmdk?0:1)); i++) if (safe_strstr(buffer, vhd_name[i]) != NULL) return TRUE; return FALSE;