mirror of
				https://github.com/pbatard/rufus.git
				synced 2024-08-14 23:57:05 +00:00 
			
		
		
		
	[core] add log progress report when writing an image/zeroing a drive
* Also simplify a nonsensical condition in format_ext
This commit is contained in:
		
							parent
							
								
									0e43c5f2ea
								
							
						
					
					
						commit
						460ab5dd73
					
				
					 3 changed files with 14 additions and 8 deletions
				
			
		
							
								
								
									
										10
									
								
								src/format.c
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								src/format.c
									
										
									
									
									
								
							|  | @ -1480,6 +1480,7 @@ static BOOL WriteDrive(HANDLE hPhysicalDrive, HANDLE hSourceImage) | ||||||
| 	LARGE_INTEGER li; | 	LARGE_INTEGER li; | ||||||
| 	DWORD i, rSize, wSize, xSize, BufSize; | 	DWORD i, rSize, wSize, xSize, BufSize; | ||||||
| 	uint64_t wb, target_size = hSourceImage?img_report.image_size:SelectedDrive.DiskSize; | 	uint64_t wb, target_size = hSourceImage?img_report.image_size:SelectedDrive.DiskSize; | ||||||
|  | 	uint64_t cur_value, last_value = UINT64_MAX; | ||||||
| 	int64_t bled_ret; | 	int64_t bled_ret; | ||||||
| 	uint8_t* buffer = NULL; | 	uint8_t* buffer = NULL; | ||||||
| 	uint32_t zero_data, *cmp_buffer = NULL; | 	uint32_t zero_data, *cmp_buffer = NULL; | ||||||
|  | @ -1525,7 +1526,7 @@ static BOOL WriteDrive(HANDLE hPhysicalDrive, HANDLE hSourceImage) | ||||||
| 			goto out; | 			goto out; | ||||||
| 		} | 		} | ||||||
| 	} else { | 	} else { | ||||||
| 		uprintf(hSourceImage?"Writing Image...":fast_zeroing?"Fast-zeroing drive...":"Zeroing drive..."); | 		uprintf(hSourceImage?"Writing Image:":fast_zeroing?"Fast-zeroing drive:":"Zeroing drive:"); | ||||||
| 		// Our buffer size must be a multiple of the sector size and *ALIGNED* to the sector size
 | 		// Our buffer size must be a multiple of the sector size and *ALIGNED* to the sector size
 | ||||||
| 		BufSize = ((DD_BUFFER_SIZE + SelectedDrive.SectorSize - 1) / SelectedDrive.SectorSize) * SelectedDrive.SectorSize; | 		BufSize = ((DD_BUFFER_SIZE + SelectedDrive.SectorSize - 1) / SelectedDrive.SectorSize) * SelectedDrive.SectorSize; | ||||||
| 		buffer = (uint8_t*)_mm_malloc(BufSize, SelectedDrive.SectorSize); | 		buffer = (uint8_t*)_mm_malloc(BufSize, SelectedDrive.SectorSize); | ||||||
|  | @ -1553,8 +1554,13 @@ static BOOL WriteDrive(HANDLE hPhysicalDrive, HANDLE hSourceImage) | ||||||
| 		// With Windows' default optimizations, sync read + sync write for sequential operations
 | 		// With Windows' default optimizations, sync read + sync write for sequential operations
 | ||||||
| 		// will be as fast, if not faster, than whatever async scheme you can come up with.
 | 		// will be as fast, if not faster, than whatever async scheme you can come up with.
 | ||||||
| 		rSize = BufSize; | 		rSize = BufSize; | ||||||
| 		for (wb = 0, wSize = 0; wb < (uint64_t)SelectedDrive.DiskSize; wb += wSize) { | 		for (wb = 0, wSize = 0; wb < target_size; wb += wSize) { | ||||||
| 			UpdateProgressWithInfo(OP_FORMAT, hSourceImage ? MSG_261 : fast_zeroing ? MSG_306 : MSG_286, wb, target_size); | 			UpdateProgressWithInfo(OP_FORMAT, hSourceImage ? MSG_261 : fast_zeroing ? MSG_306 : MSG_286, wb, target_size); | ||||||
|  | 			cur_value = (wb * min(80, target_size)) / target_size; | ||||||
|  | 			if (cur_value != last_value) { | ||||||
|  | 				last_value = cur_value; | ||||||
|  | 				uprintfs("+"); | ||||||
|  | 			} | ||||||
| 			if (hSourceImage != NULL) { | 			if (hSourceImage != NULL) { | ||||||
| 				s = ReadFile(hSourceImage, buffer, BufSize, &rSize, NULL); | 				s = ReadFile(hSourceImage, buffer, BufSize, &rSize, NULL); | ||||||
| 				if (!s) { | 				if (!s) { | ||||||
|  |  | ||||||
|  | @ -190,7 +190,7 @@ errcode_t ext2fs_print_progress(int64_t cur_value, int64_t max_value) | ||||||
| 		return 0; | 		return 0; | ||||||
| 	UpdateProgressWithInfo(OP_FORMAT, MSG_217, (uint64_t)((ext2_percent_start * max_value) + (ext2_percent_share * cur_value)), max_value); | 	UpdateProgressWithInfo(OP_FORMAT, MSG_217, (uint64_t)((ext2_percent_start * max_value) + (ext2_percent_share * cur_value)), max_value); | ||||||
| 	cur_value = (int64_t)(((float)cur_value / (float)max_value) * min(ext2_max_marker, (float)max_value)); | 	cur_value = (int64_t)(((float)cur_value / (float)max_value) * min(ext2_max_marker, (float)max_value)); | ||||||
| 	if ((cur_value < last_value) || (cur_value > last_value)) { | 	if (cur_value != last_value) { | ||||||
| 		last_value = cur_value; | 		last_value = cur_value; | ||||||
| 		uprintfs("+"); | 		uprintfs("+"); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
							
								
								
									
										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.13.1725" | CAPTION "Rufus 3.13.1726" | ||||||
| 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 | ||||||
|  | @ -395,8 +395,8 @@ END | ||||||
| // | // | ||||||
| 
 | 
 | ||||||
| VS_VERSION_INFO VERSIONINFO | VS_VERSION_INFO VERSIONINFO | ||||||
|  FILEVERSION 3,13,1725,0 |  FILEVERSION 3,13,1726,0 | ||||||
|  PRODUCTVERSION 3,13,1725,0 |  PRODUCTVERSION 3,13,1726,0 | ||||||
|  FILEFLAGSMASK 0x3fL |  FILEFLAGSMASK 0x3fL | ||||||
| #ifdef _DEBUG | #ifdef _DEBUG | ||||||
|  FILEFLAGS 0x1L |  FILEFLAGS 0x1L | ||||||
|  | @ -414,13 +414,13 @@ BEGIN | ||||||
|             VALUE "Comments", "https://rufus.ie" |             VALUE "Comments", "https://rufus.ie" | ||||||
|             VALUE "CompanyName", "Akeo Consulting" |             VALUE "CompanyName", "Akeo Consulting" | ||||||
|             VALUE "FileDescription", "Rufus" |             VALUE "FileDescription", "Rufus" | ||||||
|             VALUE "FileVersion", "3.13.1725" |             VALUE "FileVersion", "3.13.1726" | ||||||
|             VALUE "InternalName", "Rufus" |             VALUE "InternalName", "Rufus" | ||||||
|             VALUE "LegalCopyright", "© 2011-2020 Pete Batard (GPL v3)" |             VALUE "LegalCopyright", "© 2011-2020 Pete Batard (GPL v3)" | ||||||
|             VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html" |             VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html" | ||||||
|             VALUE "OriginalFilename", "rufus-3.13.exe" |             VALUE "OriginalFilename", "rufus-3.13.exe" | ||||||
|             VALUE "ProductName", "Rufus" |             VALUE "ProductName", "Rufus" | ||||||
|             VALUE "ProductVersion", "3.13.1725" |             VALUE "ProductVersion", "3.13.1726" | ||||||
|         END |         END | ||||||
|     END |     END | ||||||
|     BLOCK "VarFileInfo" |     BLOCK "VarFileInfo" | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue