mirror of
				https://github.com/pbatard/rufus.git
				synced 2024-08-14 23:57:05 +00:00 
			
		
		
		
	[core] don't clean up partition data before writing a disk image
* This workaround seems to be needed for the upcoming Windows 10 rs2_release (see #883) * Also some minor fixes * Closes #883
This commit is contained in:
		
							parent
							
								
									f7b839c596
								
							
						
					
					
						commit
						c72aa7be0a
					
				
					 4 changed files with 13 additions and 11 deletions
				
			
		|  | @ -126,7 +126,7 @@ static HANDLE GetHandle(char* Path, BOOL bWriteAccess, BOOL bLockDrive) | ||||||
| 	if (Path == NULL) | 	if (Path == NULL) | ||||||
| 		goto out; | 		goto out; | ||||||
| 	hDrive = CreateFileA(Path, GENERIC_READ|(bWriteAccess?GENERIC_WRITE:0), | 	hDrive = CreateFileA(Path, GENERIC_READ|(bWriteAccess?GENERIC_WRITE:0), | ||||||
| 		FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); | 		FILE_SHARE_READ|(bWriteAccess?FILE_SHARE_WRITE:0), NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); | ||||||
| 	if (hDrive == INVALID_HANDLE_VALUE) { | 	if (hDrive == INVALID_HANDLE_VALUE) { | ||||||
| 		uprintf("Could not open drive %s: %s\n", Path, WindowsErrorString()); | 		uprintf("Could not open drive %s: %s\n", Path, WindowsErrorString()); | ||||||
| 		goto out; | 		goto out; | ||||||
|  | @ -1286,9 +1286,9 @@ BOOL InitializeDisk(HANDLE hDrive) | ||||||
| 		uprintf("Could not refresh drive layout: %s\n", WindowsErrorString()); | 		uprintf("Could not refresh drive layout: %s\n", WindowsErrorString()); | ||||||
| 		safe_closehandle(hDrive); | 		safe_closehandle(hDrive); | ||||||
| 		return FALSE; | 		return FALSE; | ||||||
| } | 	} | ||||||
| 
 | 
 | ||||||
| return TRUE; | 	return TRUE; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
|  |  | ||||||
|  | @ -1558,7 +1558,7 @@ static BOOL WriteDrive(HANDLE hPhysicalDrive, HANDLE hSourceImage) | ||||||
| 				if (s) | 				if (s) | ||||||
| 					uprintf("write error: Wrote %d bytes, expected %d bytes", wSize, rSize); | 					uprintf("write error: Wrote %d bytes, expected %d bytes", wSize, rSize); | ||||||
| 				else | 				else | ||||||
| 					uprintf("write error: %s", WindowsErrorString()); | 					uprintf("write error at sector %d: %s", wb / SelectedDrive.SectorSize, WindowsErrorString()); | ||||||
| 				if (i < WRITE_RETRIES - 1) { | 				if (i < WRITE_RETRIES - 1) { | ||||||
| 					li.QuadPart = wb; | 					li.QuadPart = wb; | ||||||
| 					uprintf("  RETRYING...\n"); | 					uprintf("  RETRYING...\n"); | ||||||
|  | @ -1570,6 +1570,7 @@ static BOOL WriteDrive(HANDLE hPhysicalDrive, HANDLE hSourceImage) | ||||||
| 					FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | ERROR_WRITE_FAULT; | 					FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | ERROR_WRITE_FAULT; | ||||||
| 					goto out; | 					goto out; | ||||||
| 				} | 				} | ||||||
|  | 				Sleep(200); | ||||||
| 			} | 			} | ||||||
| 			if (i >= WRITE_RETRIES) goto out; | 			if (i >= WRITE_RETRIES) goto out; | ||||||
| 		} | 		} | ||||||
|  | @ -1714,7 +1715,7 @@ DWORD WINAPI FormatThread(void* param) | ||||||
| 	// Note, Microsoft's way of cleaning partitions (IOCTL_DISK_CREATE_DISK, which is what we apply
 | 	// Note, Microsoft's way of cleaning partitions (IOCTL_DISK_CREATE_DISK, which is what we apply
 | ||||||
| 	// in InitializeDisk) is *NOT ENOUGH* to reset a disk and can render it inoperable for partitioning
 | 	// in InitializeDisk) is *NOT ENOUGH* to reset a disk and can render it inoperable for partitioning
 | ||||||
| 	// or formatting under Windows. See https://github.com/pbatard/rufus/issues/759 for details.
 | 	// or formatting under Windows. See https://github.com/pbatard/rufus/issues/759 for details.
 | ||||||
| 	if (nWindowsVersion > WINDOWS_XP) { | 	if ((nWindowsVersion > WINDOWS_XP) && ((!IsChecked(IDC_BOOT)) || (bt != BT_IMG)))  { | ||||||
| 		if ((!ClearMBRGPT(hPhysicalDrive, SelectedDrive.DiskSize, SelectedDrive.SectorSize, use_large_fat32)) || | 		if ((!ClearMBRGPT(hPhysicalDrive, SelectedDrive.DiskSize, SelectedDrive.SectorSize, use_large_fat32)) || | ||||||
| 			(!InitializeDisk(hPhysicalDrive))) { | 			(!InitializeDisk(hPhysicalDrive))) { | ||||||
| 			uprintf("Could not reset partitions\n"); | 			uprintf("Could not reset partitions\n"); | ||||||
|  | @ -2151,6 +2152,7 @@ DWORD WINAPI SaveImageThread(void* param) | ||||||
| 				FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_WRITE_FAULT; | 				FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_WRITE_FAULT; | ||||||
| 				goto out; | 				goto out; | ||||||
| 			} | 			} | ||||||
|  | 			Sleep(200); | ||||||
| 		} | 		} | ||||||
| 		if (i >= WRITE_RETRIES) goto out; | 		if (i >= WRITE_RETRIES) goto out; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -3154,7 +3154,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine | ||||||
| 			uprintf("Could not get AutoMount status"); | 			uprintf("Could not get AutoMount status"); | ||||||
| 			automount = TRUE;	// So that we don't try to change its status on exit
 | 			automount = TRUE;	// So that we don't try to change its status on exit
 | ||||||
| 		} else if (!automount) { | 		} else if (!automount) { | ||||||
| 			uprintf("AutoMount was detected as disabled - temporary re-enabling it"); | 			uprintf("AutoMount was detected as disabled - temporarily re-enabling it"); | ||||||
| 			if (!SetAutoMount(TRUE)) | 			if (!SetAutoMount(TRUE)) | ||||||
| 				uprintf("Failed to enable AutoMount"); | 				uprintf("Failed to enable AutoMount"); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
							
								
								
									
										10
									
								
								src/rufus.rc
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								src/rufus.rc
									
										
									
									
									
								
							|  | @ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL | ||||||
| IDD_DIALOG DIALOGEX 12, 12, 242, 376 | IDD_DIALOG DIALOGEX 12, 12, 242, 376 | ||||||
| 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 2.12.1059" | CAPTION "Rufus 2.12.1060" | ||||||
| FONT 8, "Segoe UI Symbol", 400, 0, 0x0 | FONT 8, "Segoe UI Symbol", 400, 0, 0x0 | ||||||
| BEGIN | BEGIN | ||||||
|     LTEXT           "Device",IDS_DEVICE_TXT,9,6,200,8 |     LTEXT           "Device",IDS_DEVICE_TXT,9,6,200,8 | ||||||
|  | @ -334,8 +334,8 @@ END | ||||||
| // | // | ||||||
| 
 | 
 | ||||||
| VS_VERSION_INFO VERSIONINFO | VS_VERSION_INFO VERSIONINFO | ||||||
|  FILEVERSION 2,12,1059,0 |  FILEVERSION 2,12,1060,0 | ||||||
|  PRODUCTVERSION 2,12,1059,0 |  PRODUCTVERSION 2,12,1060,0 | ||||||
|  FILEFLAGSMASK 0x3fL |  FILEFLAGSMASK 0x3fL | ||||||
| #ifdef _DEBUG | #ifdef _DEBUG | ||||||
|  FILEFLAGS 0x1L |  FILEFLAGS 0x1L | ||||||
|  | @ -352,13 +352,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.12.1059" |             VALUE "FileVersion", "2.12.1060" | ||||||
|             VALUE "InternalName", "Rufus" |             VALUE "InternalName", "Rufus" | ||||||
|             VALUE "LegalCopyright", "© 2011-2017 Pete Batard (GPL v3)" |             VALUE "LegalCopyright", "© 2011-2017 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.12.1059" |             VALUE "ProductVersion", "2.12.1060" | ||||||
|         END |         END | ||||||
|     END |     END | ||||||
|     BLOCK "VarFileInfo" |     BLOCK "VarFileInfo" | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue