mirror of
				https://github.com/pbatard/rufus.git
				synced 2024-08-14 23:57:05 +00:00 
			
		
		
		
	[misc] fix broken DOS, fix invalid labels and UI improvements
* DOS creation was broken due to missing unlock + close * added label validation to prevent errors * added ellipsis to status bar * also bumped version to rufus next and fixed f/non-f
This commit is contained in:
		
							parent
							
								
									e17de3312f
								
							
						
					
					
						commit
						f4ed6e4650
					
				
					 9 changed files with 95 additions and 35 deletions
				
			
		|  | @ -1,9 +1,9 @@ | |||
| #!/bin/sh | ||||
| rm -f rufus*.exe | ||||
| ./configure --without-freedos --without-syslinux | ||||
| ./configure --without-freedos | ||||
| make clean | ||||
| make release -j2 | ||||
| ./configure --with-freedos --without-syslinux | ||||
| ./configure --with-freedos | ||||
| # The only difference between FreeDOS and non FreeDOS is with the RC | ||||
| # => instead of invoking 'make clean, just remove the RC object | ||||
| rm src/rufus_rc.o | ||||
|  |  | |||
							
								
								
									
										21
									
								
								configure
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										21
									
								
								configure
									
										
									
									
										vendored
									
									
								
							|  | @ -1,6 +1,6 @@ | |||
| #! /bin/sh | ||||
| # Guess values for system-dependent variables and create Makefiles. | ||||
| # Generated by GNU Autoconf 2.68 for rufus 1.1.0. | ||||
| # Generated by GNU Autoconf 2.68 for rufus 1.1.1. | ||||
| # | ||||
| # Report bugs to <https://github.com/pbatard/rufus/issues>. | ||||
| # | ||||
|  | @ -559,8 +559,8 @@ MAKEFLAGS= | |||
| # Identity of this package. | ||||
| PACKAGE_NAME='rufus' | ||||
| PACKAGE_TARNAME='rufus' | ||||
| PACKAGE_VERSION='1.1.0' | ||||
| PACKAGE_STRING='rufus 1.1.0' | ||||
| PACKAGE_VERSION='1.1.1' | ||||
| PACKAGE_STRING='rufus 1.1.1' | ||||
| PACKAGE_BUGREPORT='https://github.com/pbatard/rufus/issues' | ||||
| PACKAGE_URL='http://rufus.akeo.ie' | ||||
| 
 | ||||
|  | @ -1205,7 +1205,7 @@ if test "$ac_init_help" = "long"; then | |||
|   # Omit some internal or obsolete options to make the list less imposing. | ||||
|   # This message is too long to be a string in the A/UX 3.1 sh. | ||||
|   cat <<_ACEOF | ||||
| \`configure' configures rufus 1.1.0 to adapt to many kinds of systems. | ||||
| \`configure' configures rufus 1.1.1 to adapt to many kinds of systems. | ||||
| 
 | ||||
| Usage: $0 [OPTION]... [VAR=VALUE]... | ||||
| 
 | ||||
|  | @ -1271,7 +1271,7 @@ fi | |||
| 
 | ||||
| if test -n "$ac_init_help"; then | ||||
|   case $ac_init_help in | ||||
|      short | recursive ) echo "Configuration of rufus 1.1.0:";; | ||||
|      short | recursive ) echo "Configuration of rufus 1.1.1:";; | ||||
|    esac | ||||
|   cat <<\_ACEOF | ||||
| 
 | ||||
|  | @ -1365,7 +1365,7 @@ fi | |||
| test -n "$ac_init_help" && exit $ac_status | ||||
| if $ac_init_version; then | ||||
|   cat <<\_ACEOF | ||||
| rufus configure 1.1.0 | ||||
| rufus configure 1.1.1 | ||||
| generated by GNU Autoconf 2.68 | ||||
| 
 | ||||
| Copyright (C) 2010 Free Software Foundation, Inc. | ||||
|  | @ -1420,7 +1420,7 @@ cat >config.log <<_ACEOF | |||
| This file contains any messages produced by compilers while | ||||
| running configure, to aid debugging if configure makes a mistake. | ||||
| 
 | ||||
| It was created by rufus $as_me 1.1.0, which was | ||||
| It was created by rufus $as_me 1.1.1, which was | ||||
| generated by GNU Autoconf 2.68.  Invocation command line was | ||||
| 
 | ||||
|   $ $0 $@ | ||||
|  | @ -2235,7 +2235,7 @@ fi | |||
| 
 | ||||
| # Define the identity of the package. | ||||
|  PACKAGE='rufus' | ||||
|  VERSION='1.1.0' | ||||
|  VERSION='1.1.1' | ||||
| 
 | ||||
| 
 | ||||
| cat >>confdefs.h <<_ACEOF | ||||
|  | @ -3475,7 +3475,6 @@ fi | |||
| 
 | ||||
| if test "x$with_syslinux" != "xno" ; then | ||||
| 	AM_RCFLAGS="${AM_RCFLAGS} -DWITH_SYSLINUX" | ||||
| 	EXESUFFIX="f" | ||||
| fi | ||||
| 
 | ||||
| # Debug symbols | ||||
|  | @ -4105,7 +4104,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 | |||
| # report actual input values of CONFIG_FILES etc. instead of their | ||||
| # values after options handling. | ||||
| ac_log=" | ||||
| This file was extended by rufus $as_me 1.1.0, which was | ||||
| This file was extended by rufus $as_me 1.1.1, which was | ||||
| generated by GNU Autoconf 2.68.  Invocation command line was | ||||
| 
 | ||||
|   CONFIG_FILES    = $CONFIG_FILES | ||||
|  | @ -4159,7 +4158,7 @@ _ACEOF | |||
| cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 | ||||
| ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" | ||||
| ac_cs_version="\\ | ||||
| rufus config.status 1.1.0 | ||||
| rufus config.status 1.1.1 | ||||
| configured by $0, generated by GNU Autoconf 2.68, | ||||
|   with options \\"\$ac_cs_config\\" | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| AC_INIT([rufus], [1.1.0], [https://github.com/pbatard/rufus/issues], [rufus], [http://rufus.akeo.ie]) | ||||
| AC_INIT([rufus], [1.1.1], [https://github.com/pbatard/rufus/issues], [rufus], [http://rufus.akeo.ie]) | ||||
| AM_INIT_AUTOMAKE([-Wno-portability foreign no-dist no-dependencies]) | ||||
| AC_CONFIG_SRCDIR([src/rufus.c]) | ||||
| AC_CONFIG_MACRO_DIR([m4]) | ||||
|  | @ -38,7 +38,6 @@ AC_ARG_WITH([syslinux], | |||
| 	[with_freedos=yes]) | ||||
| if test "x$with_syslinux" != "xno" ; then | ||||
| 	AM_RCFLAGS="${AM_RCFLAGS} -DWITH_SYSLINUX" | ||||
| 	EXESUFFIX="f" | ||||
| fi | ||||
| 
 | ||||
| # Debug symbols | ||||
|  |  | |||
|  | @ -161,6 +161,11 @@ static BOOL FormatDrive(char DriveLetter) | |||
| 		} | ||||
| 	} | ||||
| 	GetWindowTextW(hLabel, wLabel, ARRAYSIZE(wLabel)); | ||||
| 	// If using FAT/FAT32, truncate the label to 11 characters
 | ||||
| 	// TODO: use a wchar_t to_valid_label() here
 | ||||
| 	if ((wFSType[0] == 'F') && (wFSType[1] == 'A') && (wFSType[2] == 'T')) { | ||||
| 		wLabel[11] = 0; | ||||
| 	} | ||||
| 	uprintf("Using cluster size: %d bytes\n", ComboBox_GetItemData(hClusterSize, ComboBox_GetCurSel(hClusterSize))); | ||||
| 	format_percent = 0.0f; | ||||
| 	task_number = 0; | ||||
|  | @ -533,6 +538,8 @@ DWORD WINAPI FormatThread(LPVOID param) | |||
| 					FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_WRITE_FAULT; | ||||
| 				goto out; | ||||
| 			} | ||||
| 			// We must close and unlock the volume to write files to it
 | ||||
| 			safe_unlockclose(hLogicalVolume); | ||||
| 			break; | ||||
| 		case DT_ISO_FAT: | ||||
| 			PrintStatus(0, TRUE, "Installing Syslinux..."); | ||||
|  | @ -546,7 +553,6 @@ DWORD WINAPI FormatThread(LPVOID param) | |||
| 	// We issue a complete remount of the filesystem at on account of:
 | ||||
| 	// - Ensuring the file explorer properly detects that the volume was updated
 | ||||
| 	// - Ensuring that an NTFS system will be reparsed so that it becomes bootable
 | ||||
| 	// TODO: on cancellation, this can leave the drive unmounted!
 | ||||
| 	if (GetVolumeNameForVolumeMountPointA(drive_name, drive_guid, sizeof(drive_guid))) { | ||||
| 		if (DeleteVolumeMountPointA(drive_name)) { | ||||
| 			Sleep(200); | ||||
|  |  | |||
|  | @ -109,7 +109,7 @@ static int udf_extract_files(udf_t *p_udf, udf_dirent_t *p_udf_dirent, const cha | |||
| 	BOOL r; | ||||
| 	int i_length; | ||||
| 	size_t i, nul_pos; | ||||
| 	char* psz_fullpath; | ||||
| 	char* psz_fullpath = NULL; | ||||
| 	const char* psz_basename; | ||||
| 	udf_dirent_t *p_udf_dirent2; | ||||
| 	uint8_t buf[UDF_BLOCKSIZE]; | ||||
|  |  | |||
|  | @ -127,6 +127,18 @@ static __inline LRESULT SendMessageLU(HWND hWnd, UINT Msg, WPARAM wParam, const | |||
| 	return ret; | ||||
| } | ||||
| 
 | ||||
| static __inline int DrawTextExU(HDC hDC, LPCSTR lpchText, int nCount, LPRECT lpRect, UINT uFormat, LPDRAWTEXTPARAMS lpDTParams) | ||||
| { | ||||
| 	int ret; | ||||
| 	DWORD err = ERROR_INVALID_DATA; | ||||
| 	wconvert(lpchText); | ||||
| 	ret = DrawTextExW(hDC, wlpchText, nCount, lpRect, uFormat, lpDTParams); | ||||
| 	err = GetLastError(); | ||||
| 	wfree(lpchText); | ||||
| 	SetLastError(err); | ||||
| 	return ret; | ||||
| } | ||||
| 
 | ||||
| static __inline BOOL SHGetPathFromIDListU(LPCITEMIDLIST pidl, char* pszPath) | ||||
| { | ||||
| 	BOOL ret = FALSE; | ||||
|  |  | |||
							
								
								
									
										60
									
								
								src/rufus.c
									
										
									
									
									
								
							
							
						
						
									
										60
									
								
								src/rufus.c
									
										
									
									
									
								
							|  | @ -59,6 +59,7 @@ int default_fs; | |||
| HWND hDeviceList, hCapacity, hFileSystem, hClusterSize, hLabel, hDOSType, hNBPasses; | ||||
| HWND hISOProgressDlg = NULL, hISOProgressBar, hISOFileName; | ||||
| BOOL bWithFreeDOS, bWithSyslinux; | ||||
| extern char szStatusMessage[256]; | ||||
| 
 | ||||
| static HANDLE format_thid = NULL; | ||||
| static HWND hDeviceTooltip = NULL, hFSTooltip = NULL, hProgress = NULL; | ||||
|  | @ -951,6 +952,41 @@ BOOL CALLBACK ISOProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) | |||
| 	return FALSE;  | ||||
| }  | ||||
| 
 | ||||
| /*
 | ||||
|  * Converts a name + ext UTF-8 pair to a valid MS filename. | ||||
|  * Returned string is allocated and needs to be freed manually | ||||
|  */ | ||||
| void to_valid_label(char* name) | ||||
| { | ||||
| 	size_t i, j, k; | ||||
| 	BOOL found; | ||||
| 	char unauthorized[] = "*?.,;:/\\|+=<>[]"; | ||||
| 	char to_underscore[] = "\t"; | ||||
| 
 | ||||
| 	if (name == NULL) | ||||
| 		return; | ||||
| 
 | ||||
| 	for (i=0, k=0; i<strlen(name); i++) { | ||||
| 		found = FALSE; | ||||
| 		for (j=0; j<strlen(unauthorized); j++) { | ||||
| 			if (name[i] == unauthorized[j]) { | ||||
| 				found = TRUE; break; | ||||
| 			} | ||||
| 		} | ||||
| 		if (found) continue; | ||||
| 		found = FALSE; | ||||
| 		for (j=0; j<strlen(to_underscore); j++) { | ||||
| 			if (name[i] == to_underscore[j]) { | ||||
| 				name[k++] = '_'; | ||||
| 				found = TRUE; break; | ||||
| 			} | ||||
| 		} | ||||
| 		if (found) continue; | ||||
| 		name[k++] = name[i]; | ||||
| 	} | ||||
| 	name[k] = 0; | ||||
| } | ||||
| 
 | ||||
| // The scanning process can be blocking for message processing => use a thread
 | ||||
| DWORD WINAPI ISOScanThread(LPVOID param) | ||||
| { | ||||
|  | @ -973,10 +1009,11 @@ DWORD WINAPI ISOScanThread(LPVOID param) | |||
| 		safe_free(iso_path); | ||||
| 	} else { | ||||
| 		for (i=(int)safe_strlen(iso_path); (i>0)&&(iso_path[i]!='\\'); i--); | ||||
| 		PrintStatus(0, TRUE, "Using ISO: '%s'\n", &iso_path[i+1]); | ||||
| 		PrintStatus(0, TRUE, "Using ISO: %s\n", &iso_path[i+1]); | ||||
| 		// Some Linux distros, such as Arch Linux, require the USB drive to have
 | ||||
| 		// a specific label => copy the one we got from the ISO image
 | ||||
| 		if (iso_report.label[0] != 0) { | ||||
| 			to_valid_label(iso_report.label); | ||||
| 			SetWindowTextU(hLabel, iso_report.label); | ||||
| 		} | ||||
| 	} | ||||
|  | @ -1122,16 +1159,23 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | |||
| 		GetUSBDevices(); | ||||
| 		return (INT_PTR)TRUE; | ||||
| 
 | ||||
| 	// Change the colour of the version text in the status bar
 | ||||
| 	// The things one must do to get an ellipsis on the status bar...
 | ||||
| 	case WM_DRAWITEM: | ||||
| 		if (wParam == IDC_STATUS) { | ||||
| 			pDI = (DRAWITEMSTRUCT*)lParam; | ||||
| 			SetBkMode(pDI->hDC, TRANSPARENT); | ||||
| 			SetTextColor(pDI->hDC, GetSysColor(COLOR_3DSHADOW)); | ||||
| 			pDI->rcItem.top += (int)(2.0f * fScale); | ||||
| 			pDI->rcItem.left += (int)(4.0f * fScale); | ||||
| 			DrawTextExA(pDI->hDC, szTimer, -1, &pDI->rcItem, DT_LEFT, NULL); | ||||
| 			return (INT_PTR)TRUE; | ||||
| 			SetBkMode(pDI->hDC, TRANSPARENT); | ||||
| 			switch(pDI->itemID) { | ||||
| 			case 0:	// left part
 | ||||
| 				DrawTextExU(pDI->hDC, szStatusMessage, -1, &pDI->rcItem, | ||||
| 					DT_LEFT|DT_END_ELLIPSIS, NULL); | ||||
| 				return (INT_PTR)TRUE; | ||||
| 			case 1:	// right part
 | ||||
| 				SetTextColor(pDI->hDC, GetSysColor(COLOR_3DSHADOW)); | ||||
| 				DrawTextExA(pDI->hDC, szTimer, -1, &pDI->rcItem, DT_LEFT, NULL); | ||||
| 				return (INT_PTR)TRUE; | ||||
| 			} | ||||
| 		} | ||||
| 		break; | ||||
| 
 | ||||
|  | @ -1246,9 +1290,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | |||
| 				break; | ||||
| 			} | ||||
| 			ShowWindow(hSelectISO, SW_SHOW); | ||||
| 			// Fall through if no ISO is selected
 | ||||
| 			if ((iso_path != NULL) || (LOWORD(wParam) == IDC_FILESYSTEM)) | ||||
| 				break; | ||||
| 			break; | ||||
| 		case IDC_SELECT_ISO: | ||||
| 			DestroyTooltip(hISOToolTip); | ||||
| 			safe_free(iso_path); | ||||
|  |  | |||
							
								
								
									
										12
									
								
								src/rufus.rc
									
										
									
									
									
								
							
							
						
						
									
										12
									
								
								src/rufus.rc
									
										
									
									
									
								
							|  | @ -33,7 +33,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL | |||
| IDD_DIALOG DIALOGEX 12, 12, 206, 278 | ||||
| STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU | ||||
| EXSTYLE WS_EX_APPWINDOW | ||||
| CAPTION "Rufus v1.1.0.133" | ||||
| CAPTION "Rufus v1.1.1.134" | ||||
| FONT 8, "MS Shell Dlg", 400, 0, 0x1 | ||||
| BEGIN | ||||
|     DEFPUSHBUTTON   "Start",IDC_START,94,236,50,14 | ||||
|  | @ -71,7 +71,7 @@ BEGIN | |||
|     DEFPUSHBUTTON   "OK",IDOK,231,175,50,14,WS_GROUP | ||||
|     CONTROL         "<a href=""http://rufus.akeo.ie"">http://rufus.akeo.ie</a>",IDC_ABOUT_RUFUS_URL, | ||||
|                     "SysLink",WS_TABSTOP,46,47,114,9 | ||||
|     LTEXT           "Version 1.1.0 (Build 133)",IDC_STATIC,46,19,78,8 | ||||
|     LTEXT           "Version 1.1.1 (Build 134)",IDC_STATIC,46,19,78,8 | ||||
|     PUSHBUTTON      "License...",IDC_ABOUT_LICENSE,46,175,50,14,WS_GROUP | ||||
|     EDITTEXT        IDC_ABOUT_COPYRIGHTS,46,107,235,63,ES_MULTILINE | ES_READONLY | WS_VSCROLL | ||||
|     LTEXT           "Report bugs or request enhancements at:",IDC_STATIC,46,66,187,8 | ||||
|  | @ -222,8 +222,8 @@ END | |||
| // | ||||
| 
 | ||||
| VS_VERSION_INFO VERSIONINFO | ||||
|  FILEVERSION 1,1,0,133 | ||||
|  PRODUCTVERSION 1,1,0,133 | ||||
|  FILEVERSION 1,1,1,134 | ||||
|  PRODUCTVERSION 1,1,1,134 | ||||
|  FILEFLAGSMASK 0x3fL | ||||
| #ifdef _DEBUG | ||||
|  FILEFLAGS 0x1L | ||||
|  | @ -240,13 +240,13 @@ BEGIN | |||
|         BEGIN | ||||
|             VALUE "CompanyName", "akeo.ie" | ||||
|             VALUE "FileDescription", "Rufus" | ||||
|             VALUE "FileVersion", "1.1.0.133" | ||||
|             VALUE "FileVersion", "1.1.1.134" | ||||
|             VALUE "InternalName", "Rufus" | ||||
|             VALUE "LegalCopyright", "© 2011 Pete Batard (GPL v3)" | ||||
|             VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" | ||||
|             VALUE "OriginalFilename", "rufus.exe" | ||||
|             VALUE "ProductName", "Rufus" | ||||
|             VALUE "ProductVersion", "1.1.0.133" | ||||
|             VALUE "ProductVersion", "1.1.1.134" | ||||
|         END | ||||
|     END | ||||
|     BLOCK "VarFileInfo" | ||||
|  |  | |||
|  | @ -128,12 +128,13 @@ static char err_string[256]; | |||
|  * message | ||||
|  */ | ||||
| static BOOL bStatusTimerArmed = FALSE; | ||||
| static char szStatusMessage[256] = { 0 }; | ||||
| char szStatusMessage[256] = { 0 }; | ||||
| static void CALLBACK PrintStatusTimeout(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) | ||||
| { | ||||
| 	bStatusTimerArmed = FALSE; | ||||
| 	// potentially display lower priority message that was overridden
 | ||||
| 	SetDlgItemTextU(hMainDialog, IDC_STATUS, szStatusMessage); | ||||
| 	SendMessageLU(GetDlgItem(hMainDialog, IDC_STATUS), SB_SETTEXTW, | ||||
| 						SBT_OWNERDRAW | 0, szStatusMessage); | ||||
| 	KillTimer(hMainDialog, TID_MESSAGE); | ||||
| } | ||||
| 
 | ||||
|  | @ -158,7 +159,8 @@ void PrintStatus(unsigned int duration, BOOL debug, const char *format, ...) | |||
| 		uprintf("%s\n", szStatusMessage); | ||||
| 
 | ||||
| 	if ((duration) || (!bStatusTimerArmed)) { | ||||
| 		SetDlgItemTextU(hMainDialog, IDC_STATUS, szStatusMessage); | ||||
| 		SendMessageLU(GetDlgItem(hMainDialog, IDC_STATUS), SB_SETTEXTA, | ||||
| 						SBT_OWNERDRAW | 0, szStatusMessage); | ||||
| 	} | ||||
| 
 | ||||
| 	if (duration) { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue