mirror of
				https://github.com/pbatard/rufus.git
				synced 2024-08-14 23:57:05 +00:00 
			
		
		
		
	[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
This commit is contained in:
		
							parent
							
								
									c56a1c87de
								
							
						
					
					
						commit
						2e817ae944
					
				
					 11 changed files with 124 additions and 58 deletions
				
			
		|  | @ -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_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_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_189 "This ISO image is not compatible with the selected filesystem" | ||||||
| t MSG_190 "No image selected" |  | ||||||
| t MSG_191 "Write pass" | t MSG_191 "Write pass" | ||||||
| t MSG_192 "Read 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 | # Status messages - these messages will appear on the status bar | ||||||
| t MSG_201 "Cancelling - Please wait..." | 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_250 "%s enabled" | ||||||
| t MSG_251 "%s disabled" | t MSG_251 "%s disabled" | ||||||
| t MSG_252 "Size checks" | 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_254 "Force large FAT32 formatting" | ||||||
| t MSG_255 "NoDriveTypeAutorun will be deleted on exit" | t MSG_255 "NoDriveTypeAutorun will be deleted on exit" | ||||||
| t MSG_256 "Fake drive detection" | t MSG_256 "Fake drive detection" | ||||||
|  | @ -448,6 +451,8 @@ t MSG_261 "Writing image: %0.1f%% completed" | ||||||
| t MSG_262 "ISO Support" | 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! | # 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_263 "Use PROPER size units" | ||||||
|  | t MSG_264 "Deleting directory '%s'" | ||||||
|  | t MSG_265 "VMWare disk detection" | ||||||
| ################################################################################ | ################################################################################ | ||||||
| ############################# TRANSLATOR END COPY ############################## | ############################# TRANSLATOR END COPY ############################## | ||||||
| ################################################################################ | ################################################################################ | ||||||
|  |  | ||||||
|  | @ -755,7 +755,7 @@ out: | ||||||
| 		} | 		} | ||||||
| 		if (iso_report.has_grub2) { | 		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
 | 			// 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)) { | 			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); | 				size = (size_t)ExtractISOFile(src_iso, "boot/grub/i386-pc/normal.mod", path, FILE_ATTRIBUTE_NORMAL); | ||||||
| 				buf = (char*)calloc(size, 1); | 				buf = (char*)calloc(size, 1); | ||||||
|  | @ -770,7 +770,10 @@ out: | ||||||
| 				free(buf); | 				free(buf); | ||||||
| 				_unlink(path); | 				_unlink(path); | ||||||
| 			} | 			} | ||||||
|  | 			if (iso_report.grub2_version[0] != 0) | ||||||
| 				uprintf("Detected Grub version: %s", iso_report.grub2_version); | 				uprintf("Detected Grub version: %s", iso_report.grub2_version); | ||||||
|  | 			else | ||||||
|  | 				uprintf("Could not detect Grub2 version"); | ||||||
| 		} | 		} | ||||||
| 		StrArrayDestroy(&config_path); | 		StrArrayDestroy(&config_path); | ||||||
| 		StrArrayDestroy(&isolinux_path); | 		StrArrayDestroy(&isolinux_path); | ||||||
|  |  | ||||||
|  | @ -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 |  * The following calls help display a localized message on the info field or status bar as well as its | ||||||
|  * log (if debug is set). If duration is non zero, ensures that message is displayed for at |  * _English_ counterpart in the log (if debug is set). | ||||||
|  * least duration ms, regardless of any other incoming message |  * 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; | 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; | 	if (info) | ||||||
| 	// potentially display lower priority message that was overridden
 | 		SetWindowTextU(hInfo, msg); | ||||||
| 	SendMessageLU(GetDlgItem(hMainDialog, IDC_STATUS), SB_SETTEXTW, SBT_OWNERDRAW, szStatusMessage); | 	else | ||||||
| 	KillTimer(hMainDialog, TID_MESSAGE); | 		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; | 	bStatusTimerArmed = FALSE; | ||||||
| 	SetWindowTextU(hInfo, szStatusMessage); | 	// We're going to print high priority message, so restore our pointer
 | ||||||
| 	KillTimer(hMainDialog, TID_MESSAGE); | 	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, ...) | 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; | 	va_list args; | ||||||
| 
 | 
 | ||||||
| 	if (msg_id < 0) { | 	if (msg_id < 0) { | ||||||
| 		// A negative msg_id clears the text area
 | 		// A negative msg_id clears the message
 | ||||||
| 		szStatusMessage[0] = 0; | 		msg_hi[0] = 0; | ||||||
| 		if (info) | 		OutputMessage(info, msg_hi); | ||||||
| 			SetWindowTextU(hInfo, szStatusMessage); |  | ||||||
| 		else |  | ||||||
| 			SendMessageLU(GetDlgItem(hMainDialog, IDC_STATUS), SB_SETTEXTW, SBT_OWNERDRAW, szStatusMessage); |  | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -437,29 +449,32 @@ void PrintStatusInfo(BOOL info, BOOL debug, unsigned int duration, int msg_id, . | ||||||
| 		return; | 		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]; | 	format = msg_table[msg_id - MSG_000]; | ||||||
| 	if (format == NULL) { | 	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; | 		return; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	va_start(args, msg_id); | 	va_start(args, msg_id); | ||||||
| 	safe_vsnprintf(szStatusMessage, sizeof(szStatusMessage), format, args); | 	safe_vsnprintf(msg_cur, MSG_LEN, format, args); | ||||||
| 	va_end(args); | 	va_end(args); | ||||||
| 	szStatusMessage[sizeof(szStatusMessage)-1] = '\0'; | 	msg_cur[MSG_LEN-1] = '\0'; | ||||||
| 
 | 
 | ||||||
| 	if ((duration != 0) || (!bStatusTimerArmed)) { | 	if ((duration != 0) || (!bStatusTimerArmed)) | ||||||
| 		if (info) | 		OutputMessage(info, msg_cur); | ||||||
| 			SetWindowTextU(hInfo, szStatusMessage); |  | ||||||
| 		else |  | ||||||
| 			SendMessageLU(GetDlgItem(hMainDialog, IDC_STATUS), SB_SETTEXTW, SBT_OWNERDRAW, szStatusMessage); |  | ||||||
| 	} |  | ||||||
| 
 | 
 | ||||||
| 	if (duration != 0) { | 	if (duration != 0) { | ||||||
| 		SetTimer(hMainDialog, TID_MESSAGE, duration, (info)?PrintInfoTimeout:PrintStatusTimeout); | 		SetTimer(hMainDialog, (info)?TID_MESSAGE_INFO:TID_MESSAGE_STATUS, duration, PrintMessageTimeout); | ||||||
| 		bStatusTimerArmed = TRUE; | 		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) { | 	if (debug) { | ||||||
| 		format = default_msg_table[msg_id - MSG_000]; | 		format = default_msg_table[msg_id - MSG_000]; | ||||||
| 		if (format == NULL) { | 		if (format == NULL) { | ||||||
|  | @ -467,8 +482,9 @@ void PrintStatusInfo(BOOL info, BOOL debug, unsigned int duration, int msg_id, . | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		va_start(args, msg_id); | 		va_start(args, msg_id); | ||||||
| 		safe_vsnprintf(buf, sizeof(szStatusMessage)-1, format, args); | 		safe_vsnprintf(buf, MSG_LEN, format, args); | ||||||
| 		va_end(args); | 		va_end(args); | ||||||
|  | 		buf[MSG_LEN-1] = '\0'; | ||||||
| 		uprintf(buf); | 		uprintf(buf); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -360,6 +360,8 @@ const loc_control_id control_id[] = { | ||||||
| 	LOC_CTRL(MSG_261), | 	LOC_CTRL(MSG_261), | ||||||
| 	LOC_CTRL(MSG_262), | 	LOC_CTRL(MSG_262), | ||||||
| 	LOC_CTRL(MSG_263), | 	LOC_CTRL(MSG_263), | ||||||
|  | 	LOC_CTRL(MSG_264), | ||||||
|  | 	LOC_CTRL(MSG_265), | ||||||
| 	LOC_CTRL(MSG_MAX), | 	LOC_CTRL(MSG_MAX), | ||||||
| 	LOC_CTRL(IDOK), | 	LOC_CTRL(IDOK), | ||||||
| 	LOC_CTRL(IDCANCEL), | 	LOC_CTRL(IDCANCEL), | ||||||
|  |  | ||||||
|  | @ -39,7 +39,9 @@ cat > cmd.sed <<\_EOF | ||||||
| const loc_control_id control_id[] = {\ | const loc_control_id control_id[] = {\ | ||||||
| 	// The dialog IDs must come first | 	// 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),/ | s/^#define \([I|M][D|S][D|C|S|G]_[^ ]*\) .*/\	LOC_CTRL(\1),/ | ||||||
| 
 | 
 | ||||||
| # Add standard IDs from windows.h and close table | # Add standard IDs from windows.h and close table | ||||||
|  | @ -71,6 +73,8 @@ cat > cmd.sed <<\_EOF | ||||||
| loc_dlg_list loc_dlg[] = { | loc_dlg_list loc_dlg[] = { | ||||||
| 
 | 
 | ||||||
| # Add the dialog entries - must start with IDD_ | # Add the dialog entries - must start with IDD_ | ||||||
|  | s/^.* IDD_.*_RTL .*// | ||||||
|  | s/^.* IDD_.*_XP .*// | ||||||
| s/^#define \(IDD_[^ ]*\) .*/\	LOC_DLG(\1),/ | s/^#define \(IDD_[^ ]*\) .*/\	LOC_DLG(\1),/ | ||||||
| 
 | 
 | ||||||
| # Close the table | # Close the table | ||||||
|  |  | ||||||
|  | @ -499,6 +499,21 @@ static __inline int SHCreateDirectoryExU(HWND hwnd, const char* pszPath, SECURIT | ||||||
| 	return ret; | 	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) | static __inline BOOL ShellExecuteExU(SHELLEXECUTEINFOA* lpExecInfo) | ||||||
| { | { | ||||||
| 	BOOL ret = FALSE; | 	BOOL ret = FALSE; | ||||||
|  |  | ||||||
|  | @ -396,7 +396,9 @@ | ||||||
| #define MSG_261                         3261 | #define MSG_261                         3261 | ||||||
| #define MSG_262                         3262 | #define MSG_262                         3262 | ||||||
| #define MSG_263                         3263 | #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
 | // Next default values for new objects
 | ||||||
| // 
 | // 
 | ||||||
|  |  | ||||||
							
								
								
									
										30
									
								
								src/rufus.c
									
										
									
									
									
								
							
							
						
						
									
										30
									
								
								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 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 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 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; | int dialog_showing = 0; | ||||||
| uint16_t rufus_version[4], embedded_sl_version[2]; | uint16_t rufus_version[4], embedded_sl_version[2]; | ||||||
| char embedded_sl_version_str[2][12] = { "?.??", "?.??" }; | char embedded_sl_version_str[2][12] = { "?.??", "?.??" }; | ||||||
|  | @ -137,7 +137,7 @@ char embedded_grub_version[] = GRUB4DOS_VERSION; | ||||||
| char embedded_grub2_version[] = GRUB2_PACKAGE_VERSION; | char embedded_grub2_version[] = GRUB2_PACKAGE_VERSION; | ||||||
| RUFUS_UPDATE update = { {0,0,0,0}, {0,0}, NULL, NULL}; | RUFUS_UPDATE update = { {0,0,0,0}, {0,0}, NULL, NULL}; | ||||||
| StrArray DriveID, DriveLabel; | StrArray DriveID, DriveLabel; | ||||||
| extern char szStatusMessage[256]; | extern char* szStatusMessage; | ||||||
| 
 | 
 | ||||||
| static HANDLE format_thid = NULL; | static HANDLE format_thid = NULL; | ||||||
| static HWND hBoot = NULL, hSelectISO = NULL; | static HWND hBoot = NULL, hSelectISO = NULL; | ||||||
|  | @ -953,6 +953,7 @@ DWORD WINAPI ISOScanThread(LPVOID param) | ||||||
| 		PrintInfo(0, MSG_081); | 		PrintInfo(0, MSG_081); | ||||||
| 		MessageBoxU(hMainDialog, lmprintf(MSG_082), lmprintf(MSG_081), MB_OK|MB_ICONINFORMATION|MB_IS_RTL); | 		MessageBoxU(hMainDialog, lmprintf(MSG_082), lmprintf(MSG_081), MB_OK|MB_ICONINFORMATION|MB_IS_RTL); | ||||||
| 		safe_free(image_path); | 		safe_free(image_path); | ||||||
|  | 		PrintStatus(0, MSG_086); | ||||||
| 		SetMBRProps(); | 		SetMBRProps(); | ||||||
| 	} else { | 	} else { | ||||||
| 		// Enable bootable and set Target System and FS accordingly
 | 		// Enable bootable and set Target System and FS accordingly
 | ||||||
|  | @ -1137,7 +1138,8 @@ static BOOL BootCheck(void) | ||||||
| 			return FALSE; | 			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
 | 			// We may have to download a different Grub2 version if we can find one
 | ||||||
| 			IGNORE_RETVAL(_chdirU(app_dir)); | 			IGNORE_RETVAL(_chdirU(app_dir)); | ||||||
| 			IGNORE_RETVAL(_mkdir(FILES_DIR)); | 			IGNORE_RETVAL(_mkdir(FILES_DIR)); | ||||||
|  | @ -1173,9 +1175,11 @@ static BOOL BootCheck(void) | ||||||
| 					PromptOnError = FALSE; | 					PromptOnError = FALSE; | ||||||
| 					grub2_len = (long)DownloadFile(tmp, &tmp[sizeof(FILES_URL)], hMainDialog); | 					grub2_len = (long)DownloadFile(tmp, &tmp[sizeof(FILES_URL)], hMainDialog); | ||||||
| 					PromptOnError = TRUE; | 					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); | 						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"); | 						fd = fopen(&tmp[sizeof(FILES_URL)], "rb"); | ||||||
| 						grub2_buf = malloc(grub2_len); | 						grub2_buf = malloc(grub2_len); | ||||||
| 						if ((fd == NULL) || (grub2_buf == NULL) || (fread(grub2_buf, 1, (size_t)grub2_len, fd) != (size_t)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); | 					image_path = FileDialog(FALSE, NULL, &iso_ext, 0); | ||||||
| 				if (image_path == NULL) { | 				if (image_path == NULL) { | ||||||
| 					CreateTooltip(hSelectISO, lmprintf(MSG_173), -1); | 					CreateTooltip(hSelectISO, lmprintf(MSG_173), -1); | ||||||
| 					PrintStatus(0, MSG_190); | 					PrintStatus(0, MSG_086); | ||||||
| 					break; | 					break; | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
|  | @ -2583,6 +2587,20 @@ relaunch: | ||||||
| 			GetUSBDevices(0); | 			GetUSBDevices(0); | ||||||
| 			continue; | 			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); | 		TranslateMessage(&msg); | ||||||
| 		DispatchMessage(&msg); | 		DispatchMessage(&msg); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -146,7 +146,8 @@ typedef struct { | ||||||
| 
 | 
 | ||||||
| /* Timers used throughout the program */ | /* Timers used throughout the program */ | ||||||
| enum timer_type { | enum timer_type { | ||||||
| 	TID_MESSAGE = 0x1000, | 	TID_MESSAGE_INFO = 0x1000, | ||||||
|  | 	TID_MESSAGE_STATUS, | ||||||
| 	TID_BADBLOCKS_UPDATE, | 	TID_BADBLOCKS_UPDATE, | ||||||
| 	TID_APP_TIMER, | 	TID_APP_TIMER, | ||||||
| 	TID_BLOCKING_TIMER, | 	TID_BLOCKING_TIMER, | ||||||
|  |  | ||||||
							
								
								
									
										24
									
								
								src/rufus.rc
									
										
									
									
									
								
							
							
						
						
									
										24
									
								
								src/rufus.rc
									
										
									
									
									
								
							|  | @ -32,7 +32,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL | ||||||
| 
 | 
 | ||||||
| IDD_DIALOG DIALOGEX 12, 12, 242, 354 | IDD_DIALOG DIALOGEX 12, 12, 242, 354 | ||||||
| STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | 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 | FONT 8, "Segoe UI", 400, 0, 0x1 | ||||||
| BEGIN | BEGIN | ||||||
|     DEFPUSHBUTTON   "Start",IDC_START,127,314,50,14 |     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 |     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 |     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 |     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      "About...",IDC_ABOUT,8,314,50,14 | ||||||
|     PUSHBUTTON      "Log",IDC_LOG,63,314,21,14 |     PUSHBUTTON      "Log",IDC_LOG,63,314,21,14 | ||||||
|     PUSHBUTTON      "T",IDC_TEST,90,314,12,14,NOT WS_VISIBLE |     PUSHBUTTON      "T",IDC_TEST,90,314,12,14,NOT WS_VISIBLE | ||||||
|  | @ -155,7 +155,7 @@ END | ||||||
| 
 | 
 | ||||||
| IDD_DIALOG_XP DIALOGEX 12, 12, 242, 354 | IDD_DIALOG_XP DIALOGEX 12, 12, 242, 354 | ||||||
| STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | 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 | FONT 8, "MS Shell Dlg", 400, 0, 0x1 | ||||||
| BEGIN | BEGIN | ||||||
|     DEFPUSHBUTTON   "Start",IDC_START,127,314,50,14 |     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 |     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 |     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 |     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      "About...",IDC_ABOUT,8,314,50,14 | ||||||
|     PUSHBUTTON      "Log",IDC_LOG,63,314,21,14 |     PUSHBUTTON      "Log",IDC_LOG,63,314,21,14 | ||||||
|     PUSHBUTTON      "T",IDC_TEST,90,314,12,14,NOT WS_VISIBLE |     PUSHBUTTON      "T",IDC_TEST,90,314,12,14,NOT WS_VISIBLE | ||||||
|  | @ -279,7 +279,7 @@ END | ||||||
| IDD_DIALOG_RTL DIALOGEX 12, 12, 242, 354 | IDD_DIALOG_RTL DIALOGEX 12, 12, 242, 354 | ||||||
| STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | 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 | 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 | FONT 8, "Segoe UI", 400, 0, 0x1 | ||||||
| BEGIN | BEGIN | ||||||
|     DEFPUSHBUTTON   "Start",IDC_START,127,314,50,14 |     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 |     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 |     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 |     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      "About...",IDC_ABOUT,8,314,50,14 | ||||||
|     PUSHBUTTON      "Log",IDC_LOG,63,314,21,14 |     PUSHBUTTON      "Log",IDC_LOG,63,314,21,14 | ||||||
|     PUSHBUTTON      "T",IDC_TEST,90,314,12,14,NOT WS_VISIBLE |     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 | IDD_DIALOG_RTL_XP DIALOGEX 12, 12, 242, 354 | ||||||
| STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | 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 | 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 | FONT 8, "MS Shell Dlg", 400, 0, 0x1 | ||||||
| BEGIN | BEGIN | ||||||
|     DEFPUSHBUTTON   "Start",IDC_START,127,314,50,14 |     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 |     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 |     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 |     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      "About...",IDC_ABOUT,8,314,50,14 | ||||||
|     PUSHBUTTON      "Log",IDC_LOG,63,314,21,14 |     PUSHBUTTON      "Log",IDC_LOG,63,314,21,14 | ||||||
|     PUSHBUTTON      "T",IDC_TEST,90,314,12,14,NOT WS_VISIBLE |     PUSHBUTTON      "T",IDC_TEST,90,314,12,14,NOT WS_VISIBLE | ||||||
|  | @ -661,8 +661,8 @@ END | ||||||
| // | // | ||||||
| 
 | 
 | ||||||
| VS_VERSION_INFO VERSIONINFO | VS_VERSION_INFO VERSIONINFO | ||||||
|  FILEVERSION 2,0,0,566 |  FILEVERSION 2,0,0,567 | ||||||
|  PRODUCTVERSION 2,0,0,566 |  PRODUCTVERSION 2,0,0,567 | ||||||
|  FILEFLAGSMASK 0x3fL |  FILEFLAGSMASK 0x3fL | ||||||
| #ifdef _DEBUG | #ifdef _DEBUG | ||||||
|  FILEFLAGS 0x1L |  FILEFLAGS 0x1L | ||||||
|  | @ -679,13 +679,13 @@ BEGIN | ||||||
|         BEGIN |         BEGIN | ||||||
|             VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" |             VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" | ||||||
|             VALUE "FileDescription", "Rufus" |             VALUE "FileDescription", "Rufus" | ||||||
|             VALUE "FileVersion", "2.0.0.566" |             VALUE "FileVersion", "2.0.0.567" | ||||||
|             VALUE "InternalName", "Rufus" |             VALUE "InternalName", "Rufus" | ||||||
|             VALUE "LegalCopyright", "© 2011-2015 Pete Batard (GPL v3)" |             VALUE "LegalCopyright", "© 2011-2015 Pete Batard (GPL v3)" | ||||||
|             VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" |             VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" | ||||||
|             VALUE "OriginalFilename", "rufus.exe" |             VALUE "OriginalFilename", "rufus.exe" | ||||||
|             VALUE "ProductName", "Rufus" |             VALUE "ProductName", "Rufus" | ||||||
|             VALUE "ProductVersion", "2.0.0.566" |             VALUE "ProductVersion", "2.0.0.567" | ||||||
|         END |         END | ||||||
|     END |     END | ||||||
|     BLOCK "VarFileInfo" |     BLOCK "VarFileInfo" | ||||||
|  |  | ||||||
|  | @ -41,7 +41,7 @@ | ||||||
| #include "usb.h" | #include "usb.h" | ||||||
| 
 | 
 | ||||||
| extern StrArray DriveID, DriveLabel; | 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 |  * Get the VID, PID and current device speed | ||||||
|  | @ -112,10 +112,10 @@ static __inline BOOL IsVHD(const char* buffer) | ||||||
| 		"Arsenal_________Virtual_", | 		"Arsenal_________Virtual_", | ||||||
| 		"KernSafeVirtual_________", | 		"KernSafeVirtual_________", | ||||||
| 		"Msft____Virtual_Disk____", | 		"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) | 		if (safe_strstr(buffer, vhd_name[i]) != NULL) | ||||||
| 			return TRUE; | 			return TRUE; | ||||||
| 	return FALSE; | 	return FALSE; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue