mirror of
				https://github.com/pbatard/rufus.git
				synced 2024-08-14 23:57:05 +00:00 
			
		
		
		
	[vhd] fix VHD detection on Windows 7
* Revert to using strstr * Also fix a potential issue with GetTextExtentPoint
This commit is contained in:
		
							parent
							
								
									8e8a2bc827
								
							
						
					
					
						commit
						efd22d1fe3
					
				
					 4 changed files with 20 additions and 21 deletions
				
			
		|  | @ -383,7 +383,9 @@ static __inline BOOL GetTextExtentPointU(HDC hdc, const char* lpString, LPSIZE l | |||
| 	BOOL ret = FALSE; | ||||
| 	DWORD err = ERROR_INVALID_DATA; | ||||
| 	wconvert(lpString); | ||||
| 	ret = GetTextExtentPointW(hdc, wlpString, (int)wcslen(wlpString)+1, lpSize); | ||||
| 	if (wlpString == NULL) | ||||
| 		return FALSE; | ||||
| 	ret = GetTextExtentPoint32W(hdc, wlpString, (int)wcslen(wlpString), lpSize); | ||||
| 	err = GetLastError(); | ||||
| 	wfree(lpString); | ||||
| 	SetLastError(err); | ||||
|  |  | |||
							
								
								
									
										16
									
								
								src/rufus.rc
									
										
									
									
									
								
							
							
						
						
									
										16
									
								
								src/rufus.rc
									
										
									
									
									
								
							|  | @ -32,7 +32,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL | |||
| 
 | ||||
| IDD_DIALOG DIALOGEX 12, 12, 242, 329 | ||||
| STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | ||||
| CAPTION "Rufus 1.5.0.552" | ||||
| CAPTION "Rufus 1.5.0.553" | ||||
| FONT 8, "Segoe UI", 400, 0, 0x1 | ||||
| BEGIN | ||||
|     DEFPUSHBUTTON   "Start",IDC_START,127,291,50,14 | ||||
|  | @ -164,7 +164,7 @@ END | |||
| 
 | ||||
| IDD_DIALOG_XP DIALOGEX 12, 12, 242, 329 | ||||
| STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | ||||
| CAPTION "Rufus 1.5.0.552" | ||||
| CAPTION "Rufus 1.5.0.553" | ||||
| FONT 8, "MS Shell Dlg", 400, 0, 0x1 | ||||
| BEGIN | ||||
|     DEFPUSHBUTTON   "Start",IDC_START,127,291,50,14 | ||||
|  | @ -297,7 +297,7 @@ END | |||
| IDD_DIALOG_RTL DIALOGEX 12, 12, 242, 329 | ||||
| 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.552" | ||||
| CAPTION "Rufus 1.5.0.553" | ||||
| FONT 8, "Segoe UI", 400, 0, 0x1 | ||||
| BEGIN | ||||
|     DEFPUSHBUTTON   "Start",IDC_START,127,291,50,14 | ||||
|  | @ -437,7 +437,7 @@ END | |||
| IDD_DIALOG_RTL_XP DIALOGEX 12, 12, 242, 329 | ||||
| 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.552" | ||||
| CAPTION "Rufus 1.5.0.553" | ||||
| FONT 8, "MS Shell Dlg", 400, 0, 0x1 | ||||
| BEGIN | ||||
|     DEFPUSHBUTTON   "Start",IDC_START,127,291,50,14 | ||||
|  | @ -702,8 +702,8 @@ END | |||
| // | ||||
| 
 | ||||
| VS_VERSION_INFO VERSIONINFO | ||||
|  FILEVERSION 1,5,0,552 | ||||
|  PRODUCTVERSION 1,5,0,552 | ||||
|  FILEVERSION 1,5,0,553 | ||||
|  PRODUCTVERSION 1,5,0,553 | ||||
|  FILEFLAGSMASK 0x3fL | ||||
| #ifdef _DEBUG | ||||
|  FILEFLAGS 0x1L | ||||
|  | @ -720,13 +720,13 @@ BEGIN | |||
|         BEGIN | ||||
|             VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" | ||||
|             VALUE "FileDescription", "Rufus" | ||||
|             VALUE "FileVersion", "1.5.0.552" | ||||
|             VALUE "FileVersion", "1.5.0.553" | ||||
|             VALUE "InternalName", "Rufus" | ||||
|             VALUE "LegalCopyright", "© 2011-2014 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.552" | ||||
|             VALUE "ProductVersion", "1.5.0.553" | ||||
|         END | ||||
|     END | ||||
|     BLOCK "VarFileInfo" | ||||
|  |  | |||
|  | @ -867,23 +867,19 @@ LONG GetEntryWidth(HWND hDropDown, const char *entry) | |||
| 	HDC hDC; | ||||
| 	HFONT hFont, hDefFont = NULL; | ||||
| 	SIZE size; | ||||
| 	WCHAR* wentry = NULL; | ||||
| 	int len; | ||||
| 
 | ||||
| 	hDC = GetDC(hDropDown); | ||||
| 	hFont = (HFONT)SendMessage(hDropDown, WM_GETFONT, 0, 0); | ||||
| 	if (hFont != NULL) | ||||
| 		hDefFont = (HFONT)SelectObject(hDC, hFont); | ||||
| 	 | ||||
| 	wentry = utf8_to_wchar(entry); | ||||
| 	len = (int)wcslen(wentry)+1; | ||||
| 	GetTextExtentPoint32W(hDC, wentry, len, &size); | ||||
| 	if (!GetTextExtentPointU(hDC, entry, &size)) | ||||
| 		size.cx = 0; | ||||
| 
 | ||||
| 	if (hFont != NULL) | ||||
| 		SelectObject(hDC, hDefFont); | ||||
| 
 | ||||
| 	ReleaseDC(hDropDown, hDC); | ||||
| 	free(wentry); | ||||
| 	return size.cx; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
							
								
								
									
										13
									
								
								src/usb.c
									
										
									
									
									
								
							
							
						
						
									
										13
									
								
								src/usb.c
									
										
									
									
									
								
							|  | @ -109,15 +109,16 @@ static __inline BOOL IsVHD(const char* buffer) | |||
| 	int i; | ||||
| 	// List of the Friendly Names of the VHD devices we know
 | ||||
| 	const char* vhd_name[] = { | ||||
| 		"Arsenal Virtual SCSI Disk Device", | ||||
| 		"Kernsafe Virtual SCSI Disk Device", | ||||
| 		"Microsoft Virtual Disk", | ||||
| 		"MS Virtual Server SCSI Disk Device", | ||||
| 		"Msft Virtual Disk" | ||||
| 		"Arsenal Virtual", | ||||
| 		"Kernsafe Virtual", | ||||
| 		"Microsoft Virtual", | ||||
| 		"MS Virtual", | ||||
| 		"Msft Virtual", | ||||
| //		"VMware Virtual"	// Would list primary disks on VMWare instances, so we avoid it
 | ||||
| 	}; | ||||
| 
 | ||||
| 	for (i = 0; i < ARRAYSIZE(vhd_name); i++) | ||||
| 		if (safe_stricmp(buffer, vhd_name[i]) == 0) | ||||
| 		if (safe_strstr(buffer, vhd_name[i]) != NULL) | ||||
| 			return TRUE; | ||||
| 	return FALSE; | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue