mirror of
				https://github.com/pbatard/rufus.git
				synced 2024-08-14 23:57:05 +00:00 
			
		
		
		
	[core] fix Win7 EFI boot file extraction when dual BIOS+UEFI is in use
* Closes #1292 * Also add "RISD" (Ricoh IDE SD Card reader) to list of card readers (#551) * Also make running Fido script read-only
This commit is contained in:
		
							parent
							
								
									1ecc771cbd
								
							
						
					
					
						commit
						661ba7b64c
					
				
					 5 changed files with 31 additions and 10 deletions
				
			
		|  | @ -340,7 +340,7 @@ BOOL GetDevices(DWORD devnum) | ||||||
| 		// See http://itdoc.hitachi.co.jp/manuals/3021/30213B5200e/DMDS0094.HTM
 | 		// See http://itdoc.hitachi.co.jp/manuals/3021/30213B5200e/DMDS0094.HTM
 | ||||||
| 		// Also  http://www.carrona.org/dvrref.php. NB: These should be reported
 | 		// Also  http://www.carrona.org/dvrref.php. NB: These should be reported
 | ||||||
| 		// as enumerators by Rufus when Enum Debug is enabled
 | 		// as enumerators by Rufus when Enum Debug is enabled
 | ||||||
| 		"SD", "PCISTOR", "RTSOR", "JMCR", "JMCF", "RIMMPTSK", "RIMSPTSK", "RIXDPTSK", | 		"SD", "PCISTOR", "RTSOR", "JMCR", "JMCF", "RIMMPTSK", "RIMSPTSK", "RISD", "RIXDPTSK", | ||||||
| 		"TI21SONY", "ESD7SK", "ESM7SK", "O2MD", "O2SD", "VIACR" | 		"TI21SONY", "ESD7SK", "ESM7SK", "O2MD", "O2SD", "VIACR" | ||||||
| 	}; | 	}; | ||||||
| 	// Oh, and we also have card devices (e.g. 'SCSI\DiskO2Micro_SD_...') under the SCSI enumerator...
 | 	// Oh, and we also have card devices (e.g. 'SCSI\DiskO2Micro_SD_...') under the SCSI enumerator...
 | ||||||
|  |  | ||||||
|  | @ -2146,7 +2146,7 @@ DWORD WINAPI FormatThread(void* param) | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
| 				// EFI mode selected, with no 'boot###.efi' but Windows 7 x64's 'bootmgr.efi' (bit #0)
 | 				// EFI mode selected, with no 'boot###.efi' but Windows 7 x64's 'bootmgr.efi' (bit #0)
 | ||||||
| 				if ((tt == TT_UEFI) && HAS_WIN7_EFI(img_report)) { | 				if (((tt == TT_UEFI) || allow_dual_uefi_bios) && HAS_WIN7_EFI(img_report)) { | ||||||
| 					PrintInfoDebug(0, MSG_232); | 					PrintInfoDebug(0, MSG_232); | ||||||
| 					img_report.wininst_path[0][0] = drive_name[0]; | 					img_report.wininst_path[0][0] = drive_name[0]; | ||||||
| 					efi_dst[0] = drive_name[0]; | 					efi_dst[0] = drive_name[0]; | ||||||
|  |  | ||||||
|  | @ -694,6 +694,23 @@ static __inline DWORD GetFileAttributesU(const char* lpFileName) | ||||||
| 	return ret; | 	return ret; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | static __inline BOOL SetFileAttributesU(const char* lpFileName, DWORD dwFileAttributes) | ||||||
|  | { | ||||||
|  | 	BOOL ret = FALSE, err = ERROR_INVALID_DATA; | ||||||
|  | 	wconvert(lpFileName); | ||||||
|  | 	// Unlike Microsoft's version, ours doesn't fail if the string is quoted
 | ||||||
|  | 	if ((wlpFileName[0] == L'"') && (wlpFileName[wcslen(wlpFileName) - 1] == L'"')) { | ||||||
|  | 		wlpFileName[wcslen(wlpFileName) - 1] = 0; | ||||||
|  | 		ret = SetFileAttributesW(&wlpFileName[1], dwFileAttributes); | ||||||
|  | 	} else { | ||||||
|  | 		ret = SetFileAttributesW(wlpFileName, dwFileAttributes); | ||||||
|  | 	} | ||||||
|  | 	err = GetLastError(); | ||||||
|  | 	wfree(lpFileName); | ||||||
|  | 	SetLastError(err); | ||||||
|  | 	return ret; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| static __inline int SHCreateDirectoryExU(HWND hwnd, const char* pszPath, SECURITY_ATTRIBUTES *psa) | static __inline int SHCreateDirectoryExU(HWND hwnd, const char* pszPath, SECURITY_ATTRIBUTES *psa) | ||||||
| { | { | ||||||
| 	int ret = ERROR_INVALID_DATA; | 	int ret = ERROR_INVALID_DATA; | ||||||
|  |  | ||||||
							
								
								
									
										10
									
								
								src/net.c
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								src/net.c
									
										
									
									
									
								
							|  | @ -949,7 +949,7 @@ static DWORD WINAPI DownloadISOThread(LPVOID param) | ||||||
| 	assert((fido_script != NULL) && (fido_len != 0)); | 	assert((fido_script != NULL) && (fido_len != 0)); | ||||||
| 
 | 
 | ||||||
| 	static_sprintf(script_path, "%s%s.ps1", temp_dir, GuidToString(&guid)); | 	static_sprintf(script_path, "%s%s.ps1", temp_dir, GuidToString(&guid)); | ||||||
| 	hFile = CreateFileU(script_path, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); | 	hFile = CreateFileU(script_path, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_READONLY, NULL); | ||||||
| 	if (hFile == INVALID_HANDLE_VALUE) { | 	if (hFile == INVALID_HANDLE_VALUE) { | ||||||
| 		uprintf("Unable to create download script '%s': %s", script_path, WindowsErrorString()); | 		uprintf("Unable to create download script '%s': %s", script_path, WindowsErrorString()); | ||||||
| 		goto out; | 		goto out; | ||||||
|  | @ -958,7 +958,8 @@ static DWORD WINAPI DownloadISOThread(LPVOID param) | ||||||
| 		uprintf("Unable to write download script '%s': %s", script_path, WindowsErrorString()); | 		uprintf("Unable to write download script '%s': %s", script_path, WindowsErrorString()); | ||||||
| 		goto out; | 		goto out; | ||||||
| 	} | 	} | ||||||
| 	// TODO: Try to Harden this so that only us and the powershell we launch can access the file
 | 	// Why oh why does PowerShell refuse to open read-only files that haven't been closed?
 | ||||||
|  | 	// Because of this limitation, we can't use LockFileEx() on the file we create...
 | ||||||
| 	safe_closehandle(hFile); | 	safe_closehandle(hFile); | ||||||
| #endif | #endif | ||||||
| 	static_sprintf(powershell_path, "%s\\WindowsPowerShell\\v1.0\\powershell.exe", system_dir); | 	static_sprintf(powershell_path, "%s\\WindowsPowerShell\\v1.0\\powershell.exe", system_dir); | ||||||
|  | @ -973,6 +974,7 @@ static DWORD WINAPI DownloadISOThread(LPVOID param) | ||||||
| 		dwPipeSize, dwPipeSize, 0, NULL); | 		dwPipeSize, dwPipeSize, 0, NULL); | ||||||
| 	if (hPipe == INVALID_HANDLE_VALUE) { | 	if (hPipe == INVALID_HANDLE_VALUE) { | ||||||
| 		uprintf("Could not create pipe '%s': %s", pipe, WindowsErrorString); | 		uprintf("Could not create pipe '%s': %s", pipe, WindowsErrorString); | ||||||
|  | 		goto out; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	static_sprintf(cmdline, "%s -NonInteractive -Sta -NoProfile –ExecutionPolicy Bypass " | 	static_sprintf(cmdline, "%s -NonInteractive -Sta -NoProfile –ExecutionPolicy Bypass " | ||||||
|  | @ -1027,8 +1029,10 @@ out: | ||||||
| 	if (icon_path[0] != 0) | 	if (icon_path[0] != 0) | ||||||
| 		DeleteFileU(icon_path); | 		DeleteFileU(icon_path); | ||||||
| #if !defined(RUFUS_TEST) | #if !defined(RUFUS_TEST) | ||||||
| 	if (script_path[0] != 0) | 	if (script_path[0] != 0) { | ||||||
|  | 		SetFileAttributesU(script_path, FILE_ATTRIBUTE_NORMAL); | ||||||
| 		DeleteFileU(script_path); | 		DeleteFileU(script_path); | ||||||
|  | 	} | ||||||
| #endif | #endif | ||||||
| 	free(url); | 	free(url); | ||||||
| 	SendMessage(hMainDialog, UM_ENABLE_CONTROLS, 0, 0); | 	SendMessage(hMainDialog, UM_ENABLE_CONTROLS, 0, 0); | ||||||
|  |  | ||||||
							
								
								
									
										10
									
								
								src/rufus.rc
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								src/rufus.rc
									
										
									
									
									
								
							|  | @ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL | ||||||
| IDD_DIALOG DIALOGEX 12, 12, 232, 326 | IDD_DIALOG DIALOGEX 12, 12, 232, 326 | ||||||
| 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_ACCEPTFILES | EXSTYLE WS_EX_ACCEPTFILES | ||||||
| CAPTION "Rufus 3.5.1495" | CAPTION "Rufus 3.5.1496" | ||||||
| FONT 9, "Segoe UI Symbol", 400, 0, 0x0 | FONT 9, "Segoe UI Symbol", 400, 0, 0x0 | ||||||
| BEGIN | BEGIN | ||||||
|     LTEXT           "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP |     LTEXT           "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP | ||||||
|  | @ -394,8 +394,8 @@ END | ||||||
| // | // | ||||||
| 
 | 
 | ||||||
| VS_VERSION_INFO VERSIONINFO | VS_VERSION_INFO VERSIONINFO | ||||||
|  FILEVERSION 3,5,1495,0 |  FILEVERSION 3,5,1496,0 | ||||||
|  PRODUCTVERSION 3,5,1495,0 |  PRODUCTVERSION 3,5,1496,0 | ||||||
|  FILEFLAGSMASK 0x3fL |  FILEFLAGSMASK 0x3fL | ||||||
| #ifdef _DEBUG | #ifdef _DEBUG | ||||||
|  FILEFLAGS 0x1L |  FILEFLAGS 0x1L | ||||||
|  | @ -413,13 +413,13 @@ BEGIN | ||||||
|             VALUE "Comments", "https://akeo.ie" |             VALUE "Comments", "https://akeo.ie" | ||||||
|             VALUE "CompanyName", "Akeo Consulting" |             VALUE "CompanyName", "Akeo Consulting" | ||||||
|             VALUE "FileDescription", "Rufus" |             VALUE "FileDescription", "Rufus" | ||||||
|             VALUE "FileVersion", "3.5.1495" |             VALUE "FileVersion", "3.5.1496" | ||||||
|             VALUE "InternalName", "Rufus" |             VALUE "InternalName", "Rufus" | ||||||
|             VALUE "LegalCopyright", "© 2011-2019 Pete Batard (GPL v3)" |             VALUE "LegalCopyright", "© 2011-2019 Pete Batard (GPL v3)" | ||||||
|             VALUE "LegalTrademarks", "https://www.gnu.org/copyleft/gpl.html" |             VALUE "LegalTrademarks", "https://www.gnu.org/copyleft/gpl.html" | ||||||
|             VALUE "OriginalFilename", "rufus-3.5.exe" |             VALUE "OriginalFilename", "rufus-3.5.exe" | ||||||
|             VALUE "ProductName", "Rufus" |             VALUE "ProductName", "Rufus" | ||||||
|             VALUE "ProductVersion", "3.5.1495" |             VALUE "ProductVersion", "3.5.1496" | ||||||
|         END |         END | ||||||
|     END |     END | ||||||
|     BLOCK "VarFileInfo" |     BLOCK "VarFileInfo" | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue