mirror of
				https://github.com/pbatard/rufus.git
				synced 2024-08-14 23:57:05 +00:00 
			
		
		
		
	[misc] remove no longer needed XP workarounds
This commit is contained in:
		
							parent
							
								
									c5f4e5a2ee
								
							
						
					
					
						commit
						903ac993f2
					
				
					 23 changed files with 299 additions and 937 deletions
				
			
		|  | @ -1,6 +1,3 @@ | ||||||
| @echo off | @echo off | ||||||
| "C:\Program Files (x86)\Windows Kits\10\bin\x64\signtool" sign /v /sha1 655f6413a8f721e3286ace95025c9e0ea132a984 /fd SHA1 /tr http://timestamp.comodoca.com/rfc3161 /td SHA1 %1 | "C:\Program Files (x86)\Windows Kits\10\bin\x64\signtool" sign /v /sha1 5759b23dc8f45e9120a7317f306e5b6890b612f0 /fd SHA256 /tr http://timestamp.comodoca.com/rfc3161 /td SHA256 %1 | ||||||
| if ERRORLEVEL 1 goto out |  | ||||||
| "C:\Program Files (x86)\Windows Kits\10\bin\x64\signtool" sign /as /v /sha1 5759b23dc8f45e9120a7317f306e5b6890b612f0 /fd SHA256 /tr http://timestamp.comodoca.com/rfc3161 /td SHA256 %1 |  | ||||||
| :out |  | ||||||
| exit | exit | ||||||
|  |  | ||||||
							
								
								
									
										4
									
								
								configure
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								configure
									
										
									
									
										vendored
									
									
								
							|  | @ -3813,9 +3813,7 @@ esac | ||||||
| $as_echo "#define _GNU_SOURCE /**/" >>confdefs.h | $as_echo "#define _GNU_SOURCE /**/" >>confdefs.h | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| # Clang needs an explicit WIN32_WINNT defined else it produces warnings | AM_CFLAGS="${AM_CFLAGS} -DWINVER=0x601 -D_WIN32_WINNT=0x601 -D_WIN32_IE=0x800" | ||||||
| # in msapi_utf8.h - including winver.h only doesn't work |  | ||||||
| AM_CFLAGS="${AM_CFLAGS} -DWINVER=0x501 -D_WIN32_IE=0x501 -D_WIN32_WINNT=0x501" |  | ||||||
| # "-Wl,--nxcompat" to enable DEP (Data Execution Prevention) | # "-Wl,--nxcompat" to enable DEP (Data Execution Prevention) | ||||||
| AM_LDFLAGS="${AM_LDFLAGS} -Wl,-no-undefined -Wl,--nxcompat" | AM_LDFLAGS="${AM_LDFLAGS} -Wl,-no-undefined -Wl,--nxcompat" | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -17,9 +17,7 @@ AC_CHECK_TOOL(WINDRES, windres, windres) | ||||||
| AC_C_INLINE | AC_C_INLINE | ||||||
| AC_DEFINE([_GNU_SOURCE], [], [Use GNU extensions]) | AC_DEFINE([_GNU_SOURCE], [], [Use GNU extensions]) | ||||||
| 
 | 
 | ||||||
| # Clang needs an explicit WIN32_WINNT defined else it produces warnings | AM_CFLAGS="${AM_CFLAGS} -DWINVER=0x601 -D_WIN32_WINNT=0x601 -D_WIN32_IE=0x800" | ||||||
| # in msapi_utf8.h - including winver.h only doesn't work |  | ||||||
| AM_CFLAGS="${AM_CFLAGS} -DWINVER=0x501 -D_WIN32_IE=0x501 -D_WIN32_WINNT=0x501" |  | ||||||
| # "-Wl,--nxcompat" to enable DEP (Data Execution Prevention) | # "-Wl,--nxcompat" to enable DEP (Data Execution Prevention) | ||||||
| AM_LDFLAGS="${AM_LDFLAGS} -Wl,-no-undefined -Wl,--nxcompat" | AM_LDFLAGS="${AM_LDFLAGS} -Wl,-no-undefined -Wl,--nxcompat" | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										
											BIN
										
									
								
								res/down.ico
									
										
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								res/down.ico
									
										
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 1.1 KiB | 
							
								
								
									
										
											BIN
										
									
								
								res/up.ico
									
										
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								res/up.ico
									
										
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 1.1 KiB | 
|  | @ -15,4 +15,4 @@ rufus_SOURCES = badblocks.c checksum.c dev.c dos.c dos_locale.c drive.c format.c | ||||||
| rufus_CFLAGS = -I./ms-sys/inc -I./syslinux/libfat -I./syslinux/libinstaller -I./syslinux/win -I./libcdio $(AM_CFLAGS) | rufus_CFLAGS = -I./ms-sys/inc -I./syslinux/libfat -I./syslinux/libinstaller -I./syslinux/win -I./libcdio $(AM_CFLAGS) | ||||||
| rufus_LDFLAGS = $(AM_LDFLAGS) -mwindows | rufus_LDFLAGS = $(AM_LDFLAGS) -mwindows | ||||||
| rufus_LDADD = rufus_rc.o bled/libbled.a ms-sys/libmssys.a syslinux/libfat/libfat.a syslinux/libinstaller/libinstaller.a syslinux/win/libwin.a \ | rufus_LDADD = rufus_rc.o bled/libbled.a ms-sys/libmssys.a syslinux/libfat/libfat.a syslinux/libinstaller/libinstaller.a syslinux/win/libwin.a \ | ||||||
| 	libcdio/iso9660/libiso9660.a libcdio/udf/libudf.a libcdio/driver/libdriver.a -lsetupapi -lole32 -lgdi32 -lwininet -lshlwapi -lcrypt32 -lwintrust -lcomdlg32 -luuid -lpsapi | 	libcdio/iso9660/libiso9660.a libcdio/udf/libudf.a libcdio/driver/libdriver.a -lsetupapi -lole32 -lgdi32 -lwininet -lshlwapi -lcrypt32 -lwintrust -lcomdlg32 -lcomctl32 -luuid -lpsapi | ||||||
|  |  | ||||||
|  | @ -276,7 +276,7 @@ rufus_SOURCES = badblocks.c checksum.c dev.c dos.c dos_locale.c drive.c format.c | ||||||
| rufus_CFLAGS = -I./ms-sys/inc -I./syslinux/libfat -I./syslinux/libinstaller -I./syslinux/win -I./libcdio $(AM_CFLAGS) | rufus_CFLAGS = -I./ms-sys/inc -I./syslinux/libfat -I./syslinux/libinstaller -I./syslinux/win -I./libcdio $(AM_CFLAGS) | ||||||
| rufus_LDFLAGS = $(AM_LDFLAGS) -mwindows | rufus_LDFLAGS = $(AM_LDFLAGS) -mwindows | ||||||
| rufus_LDADD = rufus_rc.o bled/libbled.a ms-sys/libmssys.a syslinux/libfat/libfat.a syslinux/libinstaller/libinstaller.a syslinux/win/libwin.a \
 | rufus_LDADD = rufus_rc.o bled/libbled.a ms-sys/libmssys.a syslinux/libfat/libfat.a syslinux/libinstaller/libinstaller.a syslinux/win/libwin.a \
 | ||||||
| 	libcdio/iso9660/libiso9660.a libcdio/udf/libudf.a libcdio/driver/libdriver.a -lsetupapi -lole32 -lgdi32 -lwininet -lshlwapi -lcrypt32 -lwintrust -lcomdlg32 -luuid -lpsapi | 	libcdio/iso9660/libiso9660.a libcdio/udf/libudf.a libcdio/driver/libdriver.a -lsetupapi -lole32 -lgdi32 -lwininet -lshlwapi -lcrypt32 -lwintrust -lcomdlg32 -lcomctl32 -luuid -lpsapi | ||||||
| 
 | 
 | ||||||
| all: all-recursive | all: all-recursive | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -350,7 +350,7 @@ static void pattern_fill(unsigned char *buffer, unsigned int pattern, | ||||||
| 	unsigned char	bpattern[sizeof(pattern)], *ptr; | 	unsigned char	bpattern[sizeof(pattern)], *ptr; | ||||||
| 
 | 
 | ||||||
| 	if (pattern == (unsigned int) ~0) { | 	if (pattern == (unsigned int) ~0) { | ||||||
| 		srand((unsigned int)_GetTickCount64()); | 		srand((unsigned int)GetTickCount64()); | ||||||
| 		for (ptr = buffer; ptr < buffer + n; ptr++) { | 		for (ptr = buffer; ptr < buffer + n; ptr++) { | ||||||
| 			// coverity[dont_call]
 | 			// coverity[dont_call]
 | ||||||
| 			(*ptr) = rand() % (1 << (8 * sizeof(char))); | 			(*ptr) = rand() % (1 << (8 * sizeof(char))); | ||||||
|  | @ -452,7 +452,7 @@ static unsigned int test_rw(HANDLE hDrive, blk_t last_block, size_t block_size, | ||||||
| 	cur_pattern = 0; | 	cur_pattern = 0; | ||||||
| 
 | 
 | ||||||
| 	for (pat_idx = 0; pat_idx < nb_passes; pat_idx++) { | 	for (pat_idx = 0; pat_idx < nb_passes; pat_idx++) { | ||||||
| 		srand((unsigned int)_GetTickCount64()); | 		srand((unsigned int)GetTickCount64()); | ||||||
| 		if (cancel_ops) goto out; | 		if (cancel_ops) goto out; | ||||||
| 		// coverity[dont_call]
 | 		// coverity[dont_call]
 | ||||||
| 		id_offset = rand() * (block_size-sizeof(blk_t)) / RAND_MAX; | 		id_offset = rand() * (block_size-sizeof(blk_t)) / RAND_MAX; | ||||||
|  |  | ||||||
|  | @ -929,8 +929,8 @@ DWORD WINAPI SumThread(void* param) | ||||||
| 	read_size[0] = 1;	// Don't trigger the first loop break
 | 	read_size[0] = 1;	// Don't trigger the first loop break
 | ||||||
| 	for (rb = 0; ;rb += read_size[_bufnum]) { | 	for (rb = 0; ;rb += read_size[_bufnum]) { | ||||||
| 		// Update the progress and check for cancel
 | 		// Update the progress and check for cancel
 | ||||||
| 		if (_GetTickCount64() > LastRefresh + MAX_REFRESH) { | 		if (GetTickCount64() > LastRefresh + MAX_REFRESH) { | ||||||
| 			LastRefresh = _GetTickCount64(); | 			LastRefresh = GetTickCount64(); | ||||||
| 			format_percent = (100.0f*rb) / (1.0f*img_report.image_size); | 			format_percent = (100.0f*rb) / (1.0f*img_report.image_size); | ||||||
| 			PrintInfo(0, MSG_271, format_percent); | 			PrintInfo(0, MSG_271, format_percent); | ||||||
| 			SendMessage(hProgress, PBM_SETPOS, (WPARAM)((format_percent / 100.0f)*MAX_PROGRESS), 0); | 			SendMessage(hProgress, PBM_SETPOS, (WPARAM)((format_percent / 100.0f)*MAX_PROGRESS), 0); | ||||||
|  |  | ||||||
|  | @ -136,7 +136,7 @@ BOOL ResetDevice(int index) | ||||||
| 	USB_CYCLE_PORT_PARAMS cycle_port; | 	USB_CYCLE_PORT_PARAMS cycle_port; | ||||||
| 
 | 
 | ||||||
| 	// Wait at least 10 secs between resets
 | 	// Wait at least 10 secs between resets
 | ||||||
| 	if (_GetTickCount64() < LastReset + 10000ULL) { | 	if (GetTickCount64() < LastReset + 10000ULL) { | ||||||
| 		uprintf("You must wait at least 10 seconds before trying to reset a device"); | 		uprintf("You must wait at least 10 seconds before trying to reset a device"); | ||||||
| 		return FALSE; | 		return FALSE; | ||||||
| 	} | 	} | ||||||
|  | @ -144,7 +144,7 @@ BOOL ResetDevice(int index) | ||||||
| 	if (DriveHub.String[index] == NULL) | 	if (DriveHub.String[index] == NULL) | ||||||
| 		return FALSE; | 		return FALSE; | ||||||
| 
 | 
 | ||||||
| 	LastReset = _GetTickCount64(); | 	LastReset = GetTickCount64(); | ||||||
| 
 | 
 | ||||||
| 	handle = CreateFileA(DriveHub.String[index], GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL); | 	handle = CreateFileA(DriveHub.String[index], GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL); | ||||||
| 	if (handle == INVALID_HANDLE_VALUE) { | 	if (handle == INVALID_HANDLE_VALUE) { | ||||||
|  | @ -432,9 +432,7 @@ BOOL GetDevices(DWORD devnum) | ||||||
| 
 | 
 | ||||||
| 	// Build a single list of Device IDs from all the storage enumerators we know of
 | 	// Build a single list of Device IDs from all the storage enumerators we know of
 | ||||||
| 	full_list_size = 0; | 	full_list_size = 0; | ||||||
| 	ulFlags = CM_GETIDLIST_FILTER_SERVICE; | 	ulFlags = CM_GETIDLIST_FILTER_SERVICE | CM_GETIDLIST_FILTER_PRESENT; | ||||||
| 	if (nWindowsVersion >= WINDOWS_7) |  | ||||||
| 		ulFlags |= CM_GETIDLIST_FILTER_PRESENT; |  | ||||||
| 	for (s=0; s<ARRAYSIZE(usbstor_name); s++) { | 	for (s=0; s<ARRAYSIZE(usbstor_name); s++) { | ||||||
| 		// Get a list of device IDs for all USB storage devices
 | 		// Get a list of device IDs for all USB storage devices
 | ||||||
| 		// This will be used to find if a device is UASP
 | 		// This will be used to find if a device is UASP
 | ||||||
|  |  | ||||||
							
								
								
									
										18
									
								
								src/drive.c
									
										
									
									
									
								
							
							
						
						
									
										18
									
								
								src/drive.c
									
										
									
									
									
								
							|  | @ -121,7 +121,8 @@ static HANDLE GetHandle(char* Path, BOOL bLockDrive, BOOL bWriteAccess, BOOL bWr | ||||||
| { | { | ||||||
| 	int i; | 	int i; | ||||||
| 	BYTE access_mask = 0; | 	BYTE access_mask = 0; | ||||||
| 	DWORD size, EndTime; | 	DWORD size; | ||||||
|  | 	uint64_t EndTime; | ||||||
| 	HANDLE hDrive = INVALID_HANDLE_VALUE; | 	HANDLE hDrive = INVALID_HANDLE_VALUE; | ||||||
| 	char DevPath[MAX_PATH]; | 	char DevPath[MAX_PATH]; | ||||||
| 
 | 
 | ||||||
|  | @ -172,14 +173,14 @@ static HANDLE GetHandle(char* Path, BOOL bLockDrive, BOOL bWriteAccess, BOOL bWr | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		uprintf("Requesting lock..."); | 		uprintf("Requesting lock..."); | ||||||
| 		EndTime = GetTickCount() + DRIVE_ACCESS_TIMEOUT; | 		EndTime = GetTickCount64() + DRIVE_ACCESS_TIMEOUT; | ||||||
| 		do { | 		do { | ||||||
| 			if (DeviceIoControl(hDrive, FSCTL_LOCK_VOLUME, NULL, 0, NULL, 0, &size, NULL)) | 			if (DeviceIoControl(hDrive, FSCTL_LOCK_VOLUME, NULL, 0, NULL, 0, &size, NULL)) | ||||||
| 				goto out; | 				goto out; | ||||||
| 			if (IS_ERROR(FormatStatus))	// User cancel
 | 			if (IS_ERROR(FormatStatus))	// User cancel
 | ||||||
| 				break; | 				break; | ||||||
| 			Sleep(DRIVE_ACCESS_TIMEOUT / DRIVE_ACCESS_RETRIES); | 			Sleep(DRIVE_ACCESS_TIMEOUT / DRIVE_ACCESS_RETRIES); | ||||||
| 		} while (GetTickCount() < EndTime); | 		} while (GetTickCount64() < EndTime); | ||||||
| 		// If we reached this section, either we didn't manage to get a lock or the user cancelled
 | 		// If we reached this section, either we didn't manage to get a lock or the user cancelled
 | ||||||
| 		uprintf("Could not lock access to %s: %s", Path, WindowsErrorString()); | 		uprintf("Could not lock access to %s: %s", Path, WindowsErrorString()); | ||||||
| 		// See if we can report the processes are accessing the drive
 | 		// See if we can report the processes are accessing the drive
 | ||||||
|  | @ -315,12 +316,12 @@ out: | ||||||
| /* Wait for a logical drive to reappear - Used when a drive has just been repartitioned */ | /* Wait for a logical drive to reappear - Used when a drive has just been repartitioned */ | ||||||
| BOOL WaitForLogical(DWORD DriveIndex) | BOOL WaitForLogical(DWORD DriveIndex) | ||||||
| { | { | ||||||
| 	DWORD EndTime; | 	uint64_t EndTime; | ||||||
| 	char* LogicalPath = NULL; | 	char* LogicalPath = NULL; | ||||||
| 
 | 
 | ||||||
| 	// GetLogicalName() calls may be slow, so use the system time to
 | 	// GetLogicalName() calls may be slow, so use the system time to
 | ||||||
| 	// make sure we don't spend more than DRIVE_ACCESS_TIMEOUT in wait.
 | 	// make sure we don't spend more than DRIVE_ACCESS_TIMEOUT in wait.
 | ||||||
| 	EndTime = GetTickCount() + DRIVE_ACCESS_TIMEOUT; | 	EndTime = GetTickCount64() + DRIVE_ACCESS_TIMEOUT; | ||||||
| 	do { | 	do { | ||||||
| 		LogicalPath = GetLogicalName(DriveIndex, FALSE, TRUE); | 		LogicalPath = GetLogicalName(DriveIndex, FALSE, TRUE); | ||||||
| 		if (LogicalPath != NULL) { | 		if (LogicalPath != NULL) { | ||||||
|  | @ -330,7 +331,7 @@ BOOL WaitForLogical(DWORD DriveIndex) | ||||||
| 		if (IS_ERROR(FormatStatus))	// User cancel
 | 		if (IS_ERROR(FormatStatus))	// User cancel
 | ||||||
| 			return FALSE; | 			return FALSE; | ||||||
| 		Sleep(DRIVE_ACCESS_TIMEOUT/DRIVE_ACCESS_RETRIES); | 		Sleep(DRIVE_ACCESS_TIMEOUT/DRIVE_ACCESS_RETRIES); | ||||||
| 	} while (GetTickCount() < EndTime); | 	} while (GetTickCount64() < EndTime); | ||||||
| 	uprintf("Timeout while waiting for logical drive"); | 	uprintf("Timeout while waiting for logical drive"); | ||||||
| 	return FALSE; | 	return FALSE; | ||||||
| } | } | ||||||
|  | @ -826,8 +827,7 @@ BOOL GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSys | ||||||
| 				 (CompareGUID(&DriveLayout->PartitionEntry[i].Gpt.PartitionType, &PARTITION_MSFT_RESERVED_GUID)) || | 				 (CompareGUID(&DriveLayout->PartitionEntry[i].Gpt.PartitionType, &PARTITION_MSFT_RESERVED_GUID)) || | ||||||
| 				 (CompareGUID(&DriveLayout->PartitionEntry[i].Gpt.PartitionType, &PARTITION_SYSTEM_GUID)) ) | 				 (CompareGUID(&DriveLayout->PartitionEntry[i].Gpt.PartitionType, &PARTITION_SYSTEM_GUID)) ) | ||||||
| 				--SelectedDrive.nPartitions; | 				--SelectedDrive.nPartitions; | ||||||
| 			if ( (memcmp(&PARTITION_BASIC_DATA_GUID, &DriveLayout->PartitionEntry[i].Gpt.PartitionType, sizeof(GUID)) == 0) && | 			if (memcmp(&PARTITION_BASIC_DATA_GUID, &DriveLayout->PartitionEntry[i].Gpt.PartitionType, sizeof(GUID)) == 0) | ||||||
| 				 (nWindowsVersion >= WINDOWS_VISTA) ) |  | ||||||
| 				ret = TRUE; | 				ret = TRUE; | ||||||
| 		} | 		} | ||||||
| 		break; | 		break; | ||||||
|  | @ -1242,7 +1242,7 @@ BOOL CreatePartition(HANDLE hDrive, int partition_style, int file_system, BOOL m | ||||||
| 		// This helps us reselect the partition scheme option that was used when creating the
 | 		// This helps us reselect the partition scheme option that was used when creating the
 | ||||||
| 		// drive in Rufus. As far as I can tell, Windows doesn't care much if this signature
 | 		// drive in Rufus. As far as I can tell, Windows doesn't care much if this signature
 | ||||||
| 		// isn't unique for USB drives.
 | 		// isn't unique for USB drives.
 | ||||||
| 		CreateDisk.Mbr.Signature = mbr_uefi_marker?MBR_UEFI_MARKER:(DWORD)_GetTickCount64(); | 		CreateDisk.Mbr.Signature = mbr_uefi_marker?MBR_UEFI_MARKER:(DWORD)GetTickCount64(); | ||||||
| 
 | 
 | ||||||
| 		DriveLayoutEx.PartitionStyle = PARTITION_STYLE_MBR; | 		DriveLayoutEx.PartitionStyle = PARTITION_STYLE_MBR; | ||||||
| 		DriveLayoutEx.PartitionCount = 4;	// Must be multiple of 4 for MBR
 | 		DriveLayoutEx.PartitionCount = 4;	// Must be multiple of 4 for MBR
 | ||||||
|  |  | ||||||
							
								
								
									
										33
									
								
								src/format.c
									
										
									
									
									
								
							
							
						
						
									
										33
									
								
								src/format.c
									
										
									
									
									
								
							|  | @ -607,8 +607,8 @@ static BOOL FormatFAT32(DWORD DriveIndex) | ||||||
| 
 | 
 | ||||||
| 	format_percent = 0.0f; | 	format_percent = 0.0f; | ||||||
| 	for (i=0; i<(SystemAreaSize+BurstSize-1); i+=BurstSize) { | 	for (i=0; i<(SystemAreaSize+BurstSize-1); i+=BurstSize) { | ||||||
| 		if (_GetTickCount64() > LastRefresh + MAX_REFRESH) { | 		if (GetTickCount64() > LastRefresh + MAX_REFRESH) { | ||||||
| 			LastRefresh = _GetTickCount64(); | 			LastRefresh = GetTickCount64(); | ||||||
| 			format_percent = (100.0f*i)/(1.0f*(SystemAreaSize+BurstSize)); | 			format_percent = (100.0f*i)/(1.0f*(SystemAreaSize+BurstSize)); | ||||||
| 			PrintInfo(0, MSG_217, format_percent); | 			PrintInfo(0, MSG_217, format_percent); | ||||||
| 			UpdateProgress(OP_FORMAT, format_percent); | 			UpdateProgress(OP_FORMAT, format_percent); | ||||||
|  | @ -1516,8 +1516,8 @@ static BOOL SetupWinToGo(const char* drive_name, BOOL use_ms_efi) | ||||||
| 
 | 
 | ||||||
| static void update_progress(const uint64_t processed_bytes) | static void update_progress(const uint64_t processed_bytes) | ||||||
| { | { | ||||||
| 	if (_GetTickCount64() > LastRefresh + MAX_REFRESH) { | 	if (GetTickCount64() > LastRefresh + MAX_REFRESH) { | ||||||
| 		LastRefresh = _GetTickCount64(); | 		LastRefresh = GetTickCount64(); | ||||||
| 		format_percent = (100.0f*processed_bytes)/(1.0f*img_report.image_size); | 		format_percent = (100.0f*processed_bytes)/(1.0f*img_report.image_size); | ||||||
| 		PrintInfo(0, MSG_261, format_percent); | 		PrintInfo(0, MSG_261, format_percent); | ||||||
| 		UpdateProgress(OP_FORMAT, format_percent); | 		UpdateProgress(OP_FORMAT, format_percent); | ||||||
|  | @ -1574,8 +1574,8 @@ static BOOL WriteDrive(HANDLE hPhysicalDrive, HANDLE hSourceImage) | ||||||
| 		// 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 < (uint64_t)SelectedDrive.DiskSize; wb += wSize) { | ||||||
| 			if (_GetTickCount64() > LastRefresh + MAX_REFRESH) { | 			if (GetTickCount64() > LastRefresh + MAX_REFRESH) { | ||||||
| 				LastRefresh = _GetTickCount64(); | 				LastRefresh = GetTickCount64(); | ||||||
| 				format_percent = (100.0f*wb) / (1.0f*target_size); | 				format_percent = (100.0f*wb) / (1.0f*target_size); | ||||||
| 				PrintInfo(0, hSourceImage?MSG_261:MSG_286, format_percent); | 				PrintInfo(0, hSourceImage?MSG_261:MSG_286, format_percent); | ||||||
| 				UpdateProgress(OP_FORMAT, format_percent); | 				UpdateProgress(OP_FORMAT, format_percent); | ||||||
|  | @ -1661,11 +1661,6 @@ DWORD WINAPI FormatThread(void* param) | ||||||
| 	char kolibri_dst[] = "?:\\MTLD_F32"; | 	char kolibri_dst[] = "?:\\MTLD_F32"; | ||||||
| 	char grub4dos_dst[] = "?:\\grldr"; | 	char grub4dos_dst[] = "?:\\grldr"; | ||||||
| 
 | 
 | ||||||
| 	PF_TYPE_DECL(WINAPI, LANGID, GetThreadUILanguage, (void)); |  | ||||||
| 	PF_TYPE_DECL(WINAPI, LANGID, SetThreadUILanguage, (LANGID)); |  | ||||||
| 	PF_INIT(GetThreadUILanguage, Kernel32); |  | ||||||
| 	PF_INIT(SetThreadUILanguage, Kernel32); |  | ||||||
| 
 |  | ||||||
| 	fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem)); | 	fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem)); | ||||||
| 	bt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType)); | 	bt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType)); | ||||||
| 	pt = GETPARTTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme))); | 	pt = GETPARTTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme))); | ||||||
|  | @ -1751,10 +1746,6 @@ DWORD WINAPI FormatThread(void* param) | ||||||
| 		UpdateProgress(OP_ANALYZE_MBR, -1.0f); | 		UpdateProgress(OP_ANALYZE_MBR, -1.0f); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	// Yet another half-workaround needed for XP...
 |  | ||||||
| 	if (nWindowsVersion <= WINDOWS_XP) |  | ||||||
| 		InitializeDisk(hPhysicalDrive); |  | ||||||
| 
 |  | ||||||
| 	if (zero_drive) { | 	if (zero_drive) { | ||||||
| 		WriteDrive(hPhysicalDrive, NULL); | 		WriteDrive(hPhysicalDrive, NULL); | ||||||
| 		goto out; | 		goto out; | ||||||
|  | @ -1764,7 +1755,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) && ((!IsChecked(IDC_BOOT)) || (bt != BT_IMG)))  { | 	if ((!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"); | ||||||
|  | @ -2068,9 +2059,9 @@ DWORD WINAPI FormatThread(void* param) | ||||||
| 		// NTFS fixup (WinPE/AIK images don't seem to boot without an extra checkdisk)
 | 		// NTFS fixup (WinPE/AIK images don't seem to boot without an extra checkdisk)
 | ||||||
| 		if ((bt == BT_ISO) && (fs == FS_NTFS)) { | 		if ((bt == BT_ISO) && (fs == FS_NTFS)) { | ||||||
| 			// Try to ensure that all messages from Checkdisk will be in English
 | 			// Try to ensure that all messages from Checkdisk will be in English
 | ||||||
| 			if ((pfGetThreadUILanguage != NULL) && (PRIMARYLANGID(pfGetThreadUILanguage()) != LANG_ENGLISH)) { | 			if (PRIMARYLANGID(GetThreadUILanguage()) != LANG_ENGLISH) { | ||||||
| 				pfSetThreadUILanguage(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); | 				SetThreadUILanguage(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); | ||||||
| 				if (PRIMARYLANGID(pfGetThreadUILanguage()) != LANG_ENGLISH) | 				if (PRIMARYLANGID(GetThreadUILanguage()) != LANG_ENGLISH) | ||||||
| 					uprintf("Note: CheckDisk messages may be localized"); | 					uprintf("Note: CheckDisk messages may be localized"); | ||||||
| 			} | 			} | ||||||
| 			CheckDisk(drive_name[0]); | 			CheckDisk(drive_name[0]); | ||||||
|  | @ -2169,8 +2160,8 @@ DWORD WINAPI SaveImageThread(void* param) | ||||||
| 		} | 		} | ||||||
| 		if (rSize == 0) | 		if (rSize == 0) | ||||||
| 			break; | 			break; | ||||||
| 		if (_GetTickCount64() > LastRefresh + MAX_REFRESH) { | 		if (GetTickCount64() > LastRefresh + MAX_REFRESH) { | ||||||
| 			LastRefresh = _GetTickCount64(); | 			LastRefresh = GetTickCount64(); | ||||||
| 			format_percent = (100.0f*wb)/(1.0f*img_save->DeviceSize); | 			format_percent = (100.0f*wb)/(1.0f*img_save->DeviceSize); | ||||||
| 			PrintInfo(0, MSG_261, format_percent); | 			PrintInfo(0, MSG_261, format_percent); | ||||||
| 			UpdateProgress(OP_FORMAT, format_percent); | 			UpdateProgress(OP_FORMAT, format_percent); | ||||||
|  |  | ||||||
|  | @ -32,6 +32,7 @@ | ||||||
| #include <errno.h> | #include <errno.h> | ||||||
| #include <direct.h> | #include <direct.h> | ||||||
| #include <ctype.h> | #include <ctype.h> | ||||||
|  | #include <virtdisk.h> | ||||||
| 
 | 
 | ||||||
| #include <cdio/cdio.h> | #include <cdio/cdio.h> | ||||||
| #include <cdio/logging.h> | #include <cdio/logging.h> | ||||||
|  |  | ||||||
|  | @ -447,7 +447,7 @@ static void CALLBACK OutputMessageTimeout(HWND hWnd, UINT uMsg, UINT_PTR idEvent | ||||||
| 	KillTimer(hMainDialog, idEvent); | 	KillTimer(hMainDialog, idEvent); | ||||||
| 	bOutputTimerArmed[i] = FALSE; | 	bOutputTimerArmed[i] = FALSE; | ||||||
| 	PrintMessage[i](output_msg[i]); | 	PrintMessage[i](output_msg[i]); | ||||||
| 	last_msg_time[i] = _GetTickCount64(); | 	last_msg_time[i] = GetTickCount64(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static void OutputMessage(BOOL info, char* msg) | static void OutputMessage(BOOL info, char* msg) | ||||||
|  | @ -460,7 +460,7 @@ static void OutputMessage(BOOL info, char* msg) | ||||||
| 		output_msg[i] = msg; | 		output_msg[i] = msg; | ||||||
| 	} else { | 	} else { | ||||||
| 		// Find if we need to arm a timer
 | 		// Find if we need to arm a timer
 | ||||||
| 		delta = _GetTickCount64() - last_msg_time[i]; | 		delta = GetTickCount64() - last_msg_time[i]; | ||||||
| 		if (delta < (2 * MAX_REFRESH)) { | 		if (delta < (2 * MAX_REFRESH)) { | ||||||
| 			// Not enough time has elapsed since our last output => arm a timer
 | 			// Not enough time has elapsed since our last output => arm a timer
 | ||||||
| 			output_msg[i] = msg; | 			output_msg[i] = msg; | ||||||
|  | @ -468,7 +468,7 @@ static void OutputMessage(BOOL info, char* msg) | ||||||
| 			bOutputTimerArmed[i] = TRUE; | 			bOutputTimerArmed[i] = TRUE; | ||||||
| 		} else { | 		} else { | ||||||
| 			PrintMessage[i](msg); | 			PrintMessage[i](msg); | ||||||
| 			last_msg_time[i] = _GetTickCount64(); | 			last_msg_time[i] = GetTickCount64(); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
							
								
								
									
										453
									
								
								src/missing.h
									
										
									
									
									
								
							
							
						
						
									
										453
									
								
								src/missing.h
									
										
									
									
									
								
							|  | @ -18,10 +18,6 @@ | ||||||
| */ | */ | ||||||
| 
 | 
 | ||||||
| #include <windows.h> | #include <windows.h> | ||||||
| #include <commctrl.h> |  | ||||||
| #include <shlobj.h> |  | ||||||
| #include <wininet.h> |  | ||||||
| #include <stdint.h> |  | ||||||
| 
 | 
 | ||||||
| #pragma once | #pragma once | ||||||
| 
 | 
 | ||||||
|  | @ -106,461 +102,14 @@ static __inline void *_reallocf(void *ptr, size_t size) { | ||||||
| #define _RT_RCDATA			MAKEINTRESOURCEA(10) | #define _RT_RCDATA			MAKEINTRESOURCEA(10) | ||||||
| #define _RT_GROUP_ICON		MAKEINTRESOURCEA((ULONG_PTR)(MAKEINTRESOURCEA(3) + 11)) | #define _RT_GROUP_ICON		MAKEINTRESOURCEA((ULONG_PTR)(MAKEINTRESOURCEA(3) + 11)) | ||||||
| 
 | 
 | ||||||
| /* UI redefinitions for MinGW */ | /* MinGW doesn't know these */ | ||||||
| #ifndef PBM_SETSTATE |  | ||||||
| #define PBM_SETSTATE (WM_USER+16) |  | ||||||
| #endif |  | ||||||
| #ifndef PBST_NORMAL |  | ||||||
| #define PBST_NORMAL 1 |  | ||||||
| #endif |  | ||||||
| #ifndef PBST_ERROR |  | ||||||
| #define PBST_ERROR 2 |  | ||||||
| #endif |  | ||||||
| #ifndef PBST_PAUSED |  | ||||||
| #define PBST_PAUSED 3 |  | ||||||
| #endif |  | ||||||
| #ifndef BUTTON_IMAGELIST_ALIGN_CENTER |  | ||||||
| #define BUTTON_IMAGELIST_ALIGN_CENTER 4 |  | ||||||
| #endif |  | ||||||
| #ifndef BCM_SETIMAGELIST |  | ||||||
| #define BCM_SETIMAGELIST 0x1602 |  | ||||||
| #endif |  | ||||||
| #ifndef DBT_CUSTOMEVENT |  | ||||||
| #define DBT_CUSTOMEVENT 0x8006 |  | ||||||
| #endif |  | ||||||
| #ifndef ERROR_FILE_TOO_LARGE |  | ||||||
| #define ERROR_FILE_TOO_LARGE 223 |  | ||||||
| #endif |  | ||||||
| #ifndef MSGFLT_ADD |  | ||||||
| #define MSGFLT_ADD 1 |  | ||||||
| #endif |  | ||||||
| #ifndef WM_CLIENTSHUTDOWN | #ifndef WM_CLIENTSHUTDOWN | ||||||
| #define WM_CLIENTSHUTDOWN 0x3B | #define WM_CLIENTSHUTDOWN 0x3B | ||||||
| #endif | #endif | ||||||
| #ifndef WM_COPYGLOBALDATA | #ifndef WM_COPYGLOBALDATA | ||||||
| #define WM_COPYGLOBALDATA 0x49 | #define WM_COPYGLOBALDATA 0x49 | ||||||
| #endif | #endif | ||||||
| #ifndef PBS_MARQUEE |  | ||||||
| #define PBS_MARQUEE 0x08 |  | ||||||
| #endif |  | ||||||
| #ifndef PBM_SETMARQUEE |  | ||||||
| #define PBM_SETMARQUEE (WM_USER+10) |  | ||||||
| #endif |  | ||||||
| 
 |  | ||||||
| typedef struct { |  | ||||||
| 	HIMAGELIST himl; |  | ||||||
| 	RECT margin; |  | ||||||
| 	UINT uAlign; |  | ||||||
| } MY_BUTTON_IMAGELIST; |  | ||||||
| 
 |  | ||||||
| typedef struct |  | ||||||
| { |  | ||||||
| 	LPCITEMIDLIST pidl; |  | ||||||
| 	BOOL fRecursive; |  | ||||||
| } MY_SHChangeNotifyEntry; |  | ||||||
| 
 | 
 | ||||||
| /* The following is used for native ISO mounting in Windows 8 or later */ | /* The following is used for native ISO mounting in Windows 8 or later */ | ||||||
| #define VIRTUAL_STORAGE_TYPE_VENDOR_MICROSOFT \ | #define VIRTUAL_STORAGE_TYPE_VENDOR_MICROSOFT \ | ||||||
| 	{ 0xEC984AECL, 0xA0F9, 0x47e9, { 0x90, 0x1F, 0x71, 0x41, 0x5A, 0x66, 0x34, 0x5B } } | 	{ 0xEC984AECL, 0xA0F9, 0x47e9, { 0x90, 0x1F, 0x71, 0x41, 0x5A, 0x66, 0x34, 0x5B } } | ||||||
| 
 |  | ||||||
| typedef enum _VIRTUAL_DISK_ACCESS_MASK { |  | ||||||
| 	VIRTUAL_DISK_ACCESS_NONE = 0x00000000, |  | ||||||
| 	VIRTUAL_DISK_ACCESS_ATTACH_RO = 0x00010000, |  | ||||||
| 	VIRTUAL_DISK_ACCESS_ATTACH_RW = 0x00020000, |  | ||||||
| 	VIRTUAL_DISK_ACCESS_DETACH = 0x00040000, |  | ||||||
| 	VIRTUAL_DISK_ACCESS_GET_INFO = 0x00080000, |  | ||||||
| 	VIRTUAL_DISK_ACCESS_CREATE = 0x00100000, |  | ||||||
| 	VIRTUAL_DISK_ACCESS_METAOPS = 0x00200000, |  | ||||||
| 	VIRTUAL_DISK_ACCESS_READ = 0x000d0000, |  | ||||||
| 	VIRTUAL_DISK_ACCESS_ALL = 0x003f0000, |  | ||||||
| 	VIRTUAL_DISK_ACCESS_WRITABLE = 0x00320000 |  | ||||||
| } VIRTUAL_DISK_ACCESS_MASK; |  | ||||||
| 
 |  | ||||||
| typedef enum _OPEN_VIRTUAL_DISK_FLAG { |  | ||||||
| 	OPEN_VIRTUAL_DISK_FLAG_NONE = 0x00000000, |  | ||||||
| 	OPEN_VIRTUAL_DISK_FLAG_NO_PARENTS = 0x00000001, |  | ||||||
| 	OPEN_VIRTUAL_DISK_FLAG_BLANK_FILE = 0x00000002, |  | ||||||
| 	OPEN_VIRTUAL_DISK_FLAG_BOOT_DRIVE = 0x00000004, |  | ||||||
| 	OPEN_VIRTUAL_DISK_FLAG_CACHED_IO = 0x00000008, |  | ||||||
| 	OPEN_VIRTUAL_DISK_FLAG_CUSTOM_DIFF_CHAIN = 0x00000010 |  | ||||||
| } OPEN_VIRTUAL_DISK_FLAG; |  | ||||||
| 
 |  | ||||||
| typedef enum _OPEN_VIRTUAL_DISK_VERSION { |  | ||||||
| 	OPEN_VIRTUAL_DISK_VERSION_UNSPECIFIED = 0, |  | ||||||
| 	OPEN_VIRTUAL_DISK_VERSION_1 = 1, |  | ||||||
| 	OPEN_VIRTUAL_DISK_VERSION_2 = 2 |  | ||||||
| } OPEN_VIRTUAL_DISK_VERSION; |  | ||||||
| 
 |  | ||||||
| typedef enum _ATTACH_VIRTUAL_DISK_FLAG { |  | ||||||
| 	ATTACH_VIRTUAL_DISK_FLAG_NONE = 0x00000000, |  | ||||||
| 	ATTACH_VIRTUAL_DISK_FLAG_READ_ONLY = 0x00000001, |  | ||||||
| 	ATTACH_VIRTUAL_DISK_FLAG_NO_DRIVE_LETTER = 0x00000002, |  | ||||||
| 	ATTACH_VIRTUAL_DISK_FLAG_PERMANENT_LIFETIME = 0x00000004, |  | ||||||
| 	ATTACH_VIRTUAL_DISK_FLAG_NO_LOCAL_HOST = 0x00000008 |  | ||||||
| } ATTACH_VIRTUAL_DISK_FLAG; |  | ||||||
| 
 |  | ||||||
| typedef enum _ATTACH_VIRTUAL_DISK_VERSION { |  | ||||||
| 	ATTACH_VIRTUAL_DISK_VERSION_UNSPECIFIED = 0, |  | ||||||
| 	ATTACH_VIRTUAL_DISK_VERSION_1 = 1 |  | ||||||
| } ATTACH_VIRTUAL_DISK_VERSION; |  | ||||||
| 
 |  | ||||||
| typedef enum _DETACH_VIRTUAL_DISK_FLAG { |  | ||||||
| 	DETACH_VIRTUAL_DISK_FLAG_NONE = 0x00000000 |  | ||||||
| } DETACH_VIRTUAL_DISK_FLAG; |  | ||||||
| 
 |  | ||||||
| #ifndef _VIRTUAL_STORAGE_TYPE_DEFINED |  | ||||||
| #define _VIRTUAL_STORAGE_TYPE_DEFINED |  | ||||||
| typedef struct _VIRTUAL_STORAGE_TYPE { |  | ||||||
| 	ULONG DeviceId; |  | ||||||
| 	GUID  VendorId; |  | ||||||
| } VIRTUAL_STORAGE_TYPE, *PVIRTUAL_STORAGE_TYPE; |  | ||||||
| #endif |  | ||||||
| 
 |  | ||||||
| typedef struct _OPEN_VIRTUAL_DISK_PARAMETERS { |  | ||||||
| 	OPEN_VIRTUAL_DISK_VERSION Version; |  | ||||||
| 	union { |  | ||||||
| 		struct { |  | ||||||
| 			ULONG RWDepth; |  | ||||||
| 		} Version1; |  | ||||||
| 		struct { |  | ||||||
| 			BOOL GetInfoOnly; |  | ||||||
| 			BOOL ReadOnly; |  | ||||||
| 			GUID ResiliencyGuid; |  | ||||||
| 		} Version2; |  | ||||||
| 	}; |  | ||||||
| } OPEN_VIRTUAL_DISK_PARAMETERS, *POPEN_VIRTUAL_DISK_PARAMETERS; |  | ||||||
| 
 |  | ||||||
| typedef struct _ATTACH_VIRTUAL_DISK_PARAMETERS { |  | ||||||
| 	ATTACH_VIRTUAL_DISK_VERSION Version; |  | ||||||
| 	union { |  | ||||||
| 		struct { |  | ||||||
| 			ULONG Reserved; |  | ||||||
| 		} Version1; |  | ||||||
| 	}; |  | ||||||
| } ATTACH_VIRTUAL_DISK_PARAMETERS, *PATTACH_VIRTUAL_DISK_PARAMETERS; |  | ||||||
| 
 |  | ||||||
| /* Networking constants missing from MinGW */ |  | ||||||
| #if !defined(ERROR_INTERNET_DISCONNECTED) |  | ||||||
| #define ERROR_INTERNET_DISCONNECTED (INTERNET_ERROR_BASE + 163) |  | ||||||
| #endif |  | ||||||
| #if !defined(ERROR_INTERNET_SERVER_UNREACHABLE) |  | ||||||
| #define ERROR_INTERNET_SERVER_UNREACHABLE (INTERNET_ERROR_BASE + 164) |  | ||||||
| #endif |  | ||||||
| #if !defined(ERROR_INTERNET_PROXY_SERVER_UNREACHABLE) |  | ||||||
| #define ERROR_INTERNET_PROXY_SERVER_UNREACHABLE (INTERNET_ERROR_BASE + 165) |  | ||||||
| #endif |  | ||||||
| #if !defined(ERROR_INTERNET_BAD_AUTO_PROXY_SCRIPT) |  | ||||||
| #define ERROR_INTERNET_BAD_AUTO_PROXY_SCRIPT (INTERNET_ERROR_BASE + 166) |  | ||||||
| #endif |  | ||||||
| #if !defined(ERROR_INTERNET_UNABLE_TO_DOWNLOAD_SCRIPT) |  | ||||||
| #define ERROR_INTERNET_UNABLE_TO_DOWNLOAD_SCRIPT (INTERNET_ERROR_BASE + 167) |  | ||||||
| #endif |  | ||||||
| #if !defined(ERROR_INTERNET_FAILED_DUETOSECURITYCHECK) |  | ||||||
| #define ERROR_INTERNET_FAILED_DUETOSECURITYCHECK (INTERNET_ERROR_BASE + 171) |  | ||||||
| #endif |  | ||||||
| #if !defined(ERROR_INTERNET_NOT_INITIALIZED) |  | ||||||
| #define ERROR_INTERNET_NOT_INITIALIZED (INTERNET_ERROR_BASE + 172) |  | ||||||
| #endif |  | ||||||
| #if !defined(ERROR_INTERNET_NEED_MSN_SSPI_PKG) |  | ||||||
| #define ERROR_INTERNET_NEED_MSN_SSPI_PKG (INTERNET_ERROR_BASE + 173) |  | ||||||
| #endif |  | ||||||
| #if !defined(ERROR_INTERNET_LOGIN_FAILURE_DISPLAY_ENTITY_BODY) |  | ||||||
| #define ERROR_INTERNET_LOGIN_FAILURE_DISPLAY_ENTITY_BODY (INTERNET_ERROR_BASE + 174) |  | ||||||
| #endif |  | ||||||
| 
 |  | ||||||
| /*
 |  | ||||||
|  * IFile[Open]Dialog interface for Vista and later (from MinGW headers) |  | ||||||
|  */ |  | ||||||
| #ifndef __IFileDialog_INTERFACE_DEFINED__ |  | ||||||
| #define __IFileDialog_INTERFACE_DEFINED__ |  | ||||||
| 
 |  | ||||||
| enum _FILEOPENDIALOGOPTIONS { |  | ||||||
| 	FOS_OVERWRITEPROMPT = 0x2, |  | ||||||
| 	FOS_STRICTFILETYPES = 0x4, |  | ||||||
| 	FOS_NOCHANGEDIR = 0x8, |  | ||||||
| 	FOS_PICKFOLDERS = 0x20, |  | ||||||
| 	FOS_FORCEFILESYSTEM = 0x40, |  | ||||||
| 	FOS_ALLNONSTORAGEITEMS = 0x80, |  | ||||||
| 	FOS_NOVALIDATE = 0x100, |  | ||||||
| 	FOS_ALLOWMULTISELECT = 0x200, |  | ||||||
| 	FOS_PATHMUSTEXIST = 0x800, |  | ||||||
| 	FOS_FILEMUSTEXIST = 0x1000, |  | ||||||
| 	FOS_CREATEPROMPT = 0x2000, |  | ||||||
| 	FOS_SHAREAWARE = 0x4000, |  | ||||||
| 	FOS_NOREADONLYRETURN = 0x8000, |  | ||||||
| 	FOS_NOTESTFILECREATE = 0x10000, |  | ||||||
| 	FOS_HIDEMRUPLACES = 0x20000, |  | ||||||
| 	FOS_HIDEPINNEDPLACES = 0x40000, |  | ||||||
| 	FOS_NODEREFERENCELINKS = 0x100000, |  | ||||||
| 	FOS_DONTADDTORECENT = 0x2000000, |  | ||||||
| 	FOS_FORCESHOWHIDDEN = 0x10000000, |  | ||||||
| 	FOS_DEFAULTNOMINIMODE = 0x20000000, |  | ||||||
| 	FOS_FORCEPREVIEWPANEON = 0x40000000 |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| typedef enum FDAP { |  | ||||||
| 	FDAP_BOTTOM = 0, |  | ||||||
| 	FDAP_TOP = 1 |  | ||||||
| } FDAP; |  | ||||||
| 
 |  | ||||||
| typedef DWORD FILEOPENDIALOGOPTIONS; |  | ||||||
| 
 |  | ||||||
| DEFINE_GUID(IID_IFileDialog, 0x42f85136, 0xdb7e, 0x439c, 0x85, 0xf1, 0xe4, 0x07, 0x5d, 0x13, 0x5f, 0xc8); |  | ||||||
| 
 |  | ||||||
| typedef struct IFileDialogVtbl { |  | ||||||
| 	BEGIN_INTERFACE |  | ||||||
| 
 |  | ||||||
| 		/*** IUnknown methods ***/ |  | ||||||
| 		HRESULT(STDMETHODCALLTYPE *QueryInterface)( |  | ||||||
| 			IFileDialog* This, |  | ||||||
| 			REFIID riid, |  | ||||||
| 			void **ppvObject); |  | ||||||
| 
 |  | ||||||
| 	ULONG(STDMETHODCALLTYPE *AddRef)( |  | ||||||
| 		IFileDialog* This); |  | ||||||
| 
 |  | ||||||
| 	ULONG(STDMETHODCALLTYPE *Release)( |  | ||||||
| 		IFileDialog* This); |  | ||||||
| 
 |  | ||||||
| 	/*** IModalWindow methods ***/ |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *Show)( |  | ||||||
| 		IFileDialog* This, |  | ||||||
| 		HWND hwndOwner); |  | ||||||
| 
 |  | ||||||
| 	/*** IFileDialog methods ***/ |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *SetFileTypes)( |  | ||||||
| 		IFileDialog* This, |  | ||||||
| 		UINT cFileTypes, |  | ||||||
| 		const COMDLG_FILTERSPEC *rgFilterSpec); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *SetFileTypeIndex)( |  | ||||||
| 		IFileDialog* This, |  | ||||||
| 		UINT iFileType); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *GetFileTypeIndex)( |  | ||||||
| 		IFileDialog* This, |  | ||||||
| 		UINT *piFileType); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *Advise)( |  | ||||||
| 		IFileDialog* This, |  | ||||||
| 		IFileDialogEvents *pfde, |  | ||||||
| 		DWORD *pdwCookie); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *Unadvise)( |  | ||||||
| 		IFileDialog* This, |  | ||||||
| 		DWORD dwCookie); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *SetOptions)( |  | ||||||
| 		IFileDialog* This, |  | ||||||
| 		FILEOPENDIALOGOPTIONS fos); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *GetOptions)( |  | ||||||
| 		IFileDialog* This, |  | ||||||
| 		FILEOPENDIALOGOPTIONS *pfos); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *SetDefaultFolder)( |  | ||||||
| 		IFileDialog* This, |  | ||||||
| 		IShellItem *psi); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *SetFolder)( |  | ||||||
| 		IFileDialog* This, |  | ||||||
| 		IShellItem *psi); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *GetFolder)( |  | ||||||
| 		IFileDialog* This, |  | ||||||
| 		IShellItem **ppsi); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *GetCurrentSelection)( |  | ||||||
| 		IFileDialog* This, |  | ||||||
| 		IShellItem **ppsi); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *SetFileName)( |  | ||||||
| 		IFileDialog* This, |  | ||||||
| 		LPCWSTR pszName); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *GetFileName)( |  | ||||||
| 		IFileDialog* This, |  | ||||||
| 		LPWSTR *pszName); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *SetTitle)( |  | ||||||
| 		IFileDialog* This, |  | ||||||
| 		LPCWSTR pszTitle); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *SetOkButtonLabel)( |  | ||||||
| 		IFileDialog* This, |  | ||||||
| 		LPCWSTR pszText); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *SetFileNameLabel)( |  | ||||||
| 		IFileDialog* This, |  | ||||||
| 		LPCWSTR pszLabel); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *GetResult)( |  | ||||||
| 		IFileDialog* This, |  | ||||||
| 		IShellItem **ppsi); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *AddPlace)( |  | ||||||
| 		IFileDialog* This, |  | ||||||
| 		IShellItem *psi, |  | ||||||
| 		FDAP fdap); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *SetDefaultExtension)( |  | ||||||
| 		IFileDialog* This, |  | ||||||
| 		LPCWSTR pszDefaultExtension); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *Close)( |  | ||||||
| 		IFileDialog* This, |  | ||||||
| 		HRESULT hr); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *SetClientGuid)( |  | ||||||
| 		IFileDialog* This, |  | ||||||
| 		REFGUID guid); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *ClearClientData)( |  | ||||||
| 		IFileDialog* This); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *SetFilter)( |  | ||||||
| 		IFileDialog* This, |  | ||||||
| 		IShellItemFilter *pFilter); |  | ||||||
| 
 |  | ||||||
| 	END_INTERFACE |  | ||||||
| } IFileDialogVtbl; |  | ||||||
| interface IFileDialog { |  | ||||||
| 	CONST_VTBL IFileDialogVtbl* lpVtbl; |  | ||||||
| }; |  | ||||||
| #endif |  | ||||||
| 
 |  | ||||||
| #ifndef __IFileOpenDialog_INTERFACE_DEFINED__ |  | ||||||
| #define __IFileOpenDialog_INTERFACE_DEFINED__ |  | ||||||
| 
 |  | ||||||
| DEFINE_GUID(IID_IFileOpenDialog, 0xd57c7288, 0xd4ad, 0x4768, 0xbe, 0x02, 0x9d, 0x96, 0x95, 0x32, 0xd9, 0x60); |  | ||||||
| 
 |  | ||||||
| typedef struct IFileOpenDialogVtbl { |  | ||||||
| 	BEGIN_INTERFACE |  | ||||||
| 
 |  | ||||||
| 		/*** IUnknown methods ***/ |  | ||||||
| 		HRESULT(STDMETHODCALLTYPE *QueryInterface)( |  | ||||||
| 			IFileOpenDialog* This, |  | ||||||
| 			REFIID riid, |  | ||||||
| 			void **ppvObject); |  | ||||||
| 
 |  | ||||||
| 	ULONG(STDMETHODCALLTYPE *AddRef)( |  | ||||||
| 		IFileOpenDialog* This); |  | ||||||
| 
 |  | ||||||
| 	ULONG(STDMETHODCALLTYPE *Release)( |  | ||||||
| 		IFileOpenDialog* This); |  | ||||||
| 
 |  | ||||||
| 	/*** IModalWindow methods ***/ |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *Show)( |  | ||||||
| 		IFileOpenDialog* This, |  | ||||||
| 		HWND hwndOwner); |  | ||||||
| 
 |  | ||||||
| 	/*** IFileDialog methods ***/ |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *SetFileTypes)( |  | ||||||
| 		IFileOpenDialog* This, |  | ||||||
| 		UINT cFileTypes, |  | ||||||
| 		const COMDLG_FILTERSPEC *rgFilterSpec); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *SetFileTypeIndex)( |  | ||||||
| 		IFileOpenDialog* This, |  | ||||||
| 		UINT iFileType); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *GetFileTypeIndex)( |  | ||||||
| 		IFileOpenDialog* This, |  | ||||||
| 		UINT *piFileType); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *Advise)( |  | ||||||
| 		IFileOpenDialog* This, |  | ||||||
| 		IFileDialogEvents *pfde, |  | ||||||
| 		DWORD *pdwCookie); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *Unadvise)( |  | ||||||
| 		IFileOpenDialog* This, |  | ||||||
| 		DWORD dwCookie); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *SetOptions)( |  | ||||||
| 		IFileOpenDialog* This, |  | ||||||
| 		FILEOPENDIALOGOPTIONS fos); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *GetOptions)( |  | ||||||
| 		IFileOpenDialog* This, |  | ||||||
| 		FILEOPENDIALOGOPTIONS *pfos); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *SetDefaultFolder)( |  | ||||||
| 		IFileOpenDialog* This, |  | ||||||
| 		IShellItem *psi); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *SetFolder)( |  | ||||||
| 		IFileOpenDialog* This, |  | ||||||
| 		IShellItem *psi); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *GetFolder)( |  | ||||||
| 		IFileOpenDialog* This, |  | ||||||
| 		IShellItem **ppsi); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *GetCurrentSelection)( |  | ||||||
| 		IFileOpenDialog* This, |  | ||||||
| 		IShellItem **ppsi); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *SetFileName)( |  | ||||||
| 		IFileOpenDialog* This, |  | ||||||
| 		LPCWSTR pszName); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *GetFileName)( |  | ||||||
| 		IFileOpenDialog* This, |  | ||||||
| 		LPWSTR *pszName); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *SetTitle)( |  | ||||||
| 		IFileOpenDialog* This, |  | ||||||
| 		LPCWSTR pszTitle); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *SetOkButtonLabel)( |  | ||||||
| 		IFileOpenDialog* This, |  | ||||||
| 		LPCWSTR pszText); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *SetFileNameLabel)( |  | ||||||
| 		IFileOpenDialog* This, |  | ||||||
| 		LPCWSTR pszLabel); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *GetResult)( |  | ||||||
| 		IFileOpenDialog* This, |  | ||||||
| 		IShellItem **ppsi); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *AddPlace)( |  | ||||||
| 		IFileOpenDialog* This, |  | ||||||
| 		IShellItem *psi, |  | ||||||
| 		FDAP fdap); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *SetDefaultExtension)( |  | ||||||
| 		IFileOpenDialog* This, |  | ||||||
| 		LPCWSTR pszDefaultExtension); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *Close)( |  | ||||||
| 		IFileOpenDialog* This, |  | ||||||
| 		HRESULT hr); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *SetClientGuid)( |  | ||||||
| 		IFileOpenDialog* This, |  | ||||||
| 		REFGUID guid); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *ClearClientData)( |  | ||||||
| 		IFileOpenDialog* This); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *SetFilter)( |  | ||||||
| 		IFileOpenDialog* This, |  | ||||||
| 		IShellItemFilter *pFilter); |  | ||||||
| 
 |  | ||||||
| 	/*** IFileOpenDialog methods ***/ |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *GetResults)( |  | ||||||
| 		IFileOpenDialog* This, |  | ||||||
| 		IShellItemArray **ppenum); |  | ||||||
| 
 |  | ||||||
| 	HRESULT(STDMETHODCALLTYPE *GetSelectedItems)( |  | ||||||
| 		IFileOpenDialog* This, |  | ||||||
| 		IShellItemArray **ppsai); |  | ||||||
| 
 |  | ||||||
| 	END_INTERFACE |  | ||||||
| } IFileOpenDialogVtbl; |  | ||||||
| interface IFileOpenDialog { |  | ||||||
| 	CONST_VTBL IFileOpenDialogVtbl* lpVtbl; |  | ||||||
| }; |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|  | @ -13,8 +13,6 @@ | ||||||
| #define IDD_CHECKSUM                    109 | #define IDD_CHECKSUM                    109 | ||||||
| #define IDD_LIST                        110 | #define IDD_LIST                        110 | ||||||
| #define IDI_ICON                        120 | #define IDI_ICON                        120 | ||||||
| #define IDI_UP                          121 |  | ||||||
| #define IDI_DOWN                        122 |  | ||||||
| #define IDD_DIALOG_XP                   151 | #define IDD_DIALOG_XP                   151 | ||||||
| #define IDD_ABOUTBOX_XP                 152 | #define IDD_ABOUTBOX_XP                 152 | ||||||
| #define IDD_NOTIFICATION_XP             153 | #define IDD_NOTIFICATION_XP             153 | ||||||
|  |  | ||||||
							
								
								
									
										123
									
								
								src/rufus.c
									
										
									
									
									
								
							
							
						
						
									
										123
									
								
								src/rufus.c
									
										
									
									
									
								
							|  | @ -47,14 +47,6 @@ | ||||||
| #include "../res/grub/grub_version.h" | #include "../res/grub/grub_version.h" | ||||||
| #include "../res/grub2/grub2_version.h" | #include "../res/grub2/grub2_version.h" | ||||||
| 
 | 
 | ||||||
| // ImageList calls are unavailable on XP
 |  | ||||||
| PF_TYPE_DECL(WINAPI, HIMAGELIST, ImageList_Create, (int, int, UINT, int, int)); |  | ||||||
| PF_TYPE_DECL(WINAPI, int, ImageList_AddIcon, (HIMAGELIST, HICON)); |  | ||||||
| PF_TYPE_DECL(WINAPI, int, ImageList_ReplaceIcon, (HIMAGELIST, int, HICON)); |  | ||||||
| 
 |  | ||||||
| PF_TYPE_DECL(WINAPI, BOOL, SHChangeNotifyDeregister, (ULONG)); |  | ||||||
| PF_TYPE_DECL(WINAPI, ULONG, SHChangeNotifyRegister, (HWND, int, LONG, UINT, int, const MY_SHChangeNotifyEntry*)); |  | ||||||
| 
 |  | ||||||
| const char* cmdline_hogger = "rufus.com"; | const char* cmdline_hogger = "rufus.com"; | ||||||
| const char* FileSystemLabel[FS_MAX] = { "FAT", "FAT32", "NTFS", "UDF", "exFAT", "ReFS" }; | const char* FileSystemLabel[FS_MAX] = { "FAT", "FAT32", "NTFS", "UDF", "exFAT", "ReFS" }; | ||||||
| const char* ep_reg = "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer"; | const char* ep_reg = "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer"; | ||||||
|  | @ -92,8 +84,7 @@ char msgbox[1024], msgbox_title[32], *ini_file = NULL; | ||||||
| OPENED_LIBRARIES_VARS; | OPENED_LIBRARIES_VARS; | ||||||
| HINSTANCE hMainInstance; | HINSTANCE hMainInstance; | ||||||
| HWND hMainDialog, hLangToolbar = NULL, hUpdatesDlg = NULL; | HWND hMainDialog, hLangToolbar = NULL, hUpdatesDlg = NULL; | ||||||
| MY_BUTTON_IMAGELIST bi_iso = { 0 }, bi_up = { 0 }, bi_down = { 0 }; | BUTTON_IMAGELIST bi_iso = { 0 }, bi_up = { 0 }, bi_down = { 0 }; | ||||||
| GetTickCount64_t pfGetTickCount64 = NULL; |  | ||||||
| char szFolderPath[MAX_PATH], app_dir[MAX_PATH], system_dir[MAX_PATH], temp_dir[MAX_PATH], sysnative_dir[MAX_PATH]; | char szFolderPath[MAX_PATH], app_dir[MAX_PATH], system_dir[MAX_PATH], temp_dir[MAX_PATH], sysnative_dir[MAX_PATH]; | ||||||
| char* image_path = NULL; | char* image_path = NULL; | ||||||
| float fScale = 1.0f; | float fScale = 1.0f; | ||||||
|  | @ -265,8 +256,7 @@ static BOOL DefineClusterSizes(void) | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		// exFAT (requires KB955704 installed on XP => don't bother)
 | 		// exFAT
 | ||||||
| 		if (nWindowsVersion > WINDOWS_XP) { |  | ||||||
| 		SelectedDrive.ClusterSize[FS_EXFAT].Allowed = 0x03FFFE00; | 		SelectedDrive.ClusterSize[FS_EXFAT].Allowed = 0x03FFFE00; | ||||||
| 		if (SelectedDrive.DiskSize < 256*MB)	// < 256 MB
 | 		if (SelectedDrive.DiskSize < 256*MB)	// < 256 MB
 | ||||||
| 			SelectedDrive.ClusterSize[FS_EXFAT].Default = 4*KB; | 			SelectedDrive.ClusterSize[FS_EXFAT].Default = 4*KB; | ||||||
|  | @ -274,13 +264,10 @@ static BOOL DefineClusterSizes(void) | ||||||
| 			SelectedDrive.ClusterSize[FS_EXFAT].Default = 32*KB; | 			SelectedDrive.ClusterSize[FS_EXFAT].Default = 32*KB; | ||||||
| 		else | 		else | ||||||
| 			SelectedDrive.ClusterSize[FS_EXFAT].Default = 128*KB; | 			SelectedDrive.ClusterSize[FS_EXFAT].Default = 128*KB; | ||||||
| 		} |  | ||||||
| 
 | 
 | ||||||
| 		// UDF (only supported for Vista and later)
 | 		// UDF
 | ||||||
| 		if (nWindowsVersion >= WINDOWS_VISTA) { |  | ||||||
| 		SelectedDrive.ClusterSize[FS_UDF].Allowed = SINGLE_CLUSTERSIZE_DEFAULT; | 		SelectedDrive.ClusterSize[FS_UDF].Allowed = SINGLE_CLUSTERSIZE_DEFAULT; | ||||||
| 		SelectedDrive.ClusterSize[FS_UDF].Default = 1; | 		SelectedDrive.ClusterSize[FS_UDF].Default = 1; | ||||||
| 		} |  | ||||||
| 
 | 
 | ||||||
| 		// ReFS (only supported for Windows 8.1 and later and for fixed disks)
 | 		// ReFS (only supported for Windows 8.1 and later and for fixed disks)
 | ||||||
| 		if (SelectedDrive.DiskSize >= 512*MB) { | 		if (SelectedDrive.DiskSize >= 512*MB) { | ||||||
|  | @ -445,10 +432,7 @@ static BOOL SetDriveInfo(int ComboIndex) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	for (i=0; i<3; i++) { | 	for (i=0; i<3; i++) { | ||||||
| 		// Populate MBR/BIOS, MBR/UEFI and GPT/UEFI targets, with an exception
 | 		// Populate MBR/BIOS, MBR/UEFI and GPT/UEFI targets
 | ||||||
| 		// for XP, as it doesn't support GPT at all
 |  | ||||||
| 		if ((i == 2) && (nWindowsVersion <= WINDOWS_XP)) |  | ||||||
| 			continue; |  | ||||||
| 		pt = (i==2)?PARTITION_STYLE_GPT:PARTITION_STYLE_MBR; | 		pt = (i==2)?PARTITION_STYLE_GPT:PARTITION_STYLE_MBR; | ||||||
| 		if (i==0) { | 		if (i==0) { | ||||||
| 			SetMBRForUEFI(FALSE); | 			SetMBRForUEFI(FALSE); | ||||||
|  | @ -820,8 +804,8 @@ void UpdateProgress(int op, float percent) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	// Reduce the refresh rate, to avoid weird effects on the sliding part of progress bar
 | 	// Reduce the refresh rate, to avoid weird effects on the sliding part of progress bar
 | ||||||
| 	if (_GetTickCount64() > LastRefresh + (2 * MAX_REFRESH)) { | 	if (GetTickCount64() > LastRefresh + (2 * MAX_REFRESH)) { | ||||||
| 		LastRefresh = _GetTickCount64(); | 		LastRefresh = GetTickCount64(); | ||||||
| 		SendMessage(hProgress, PBM_SETPOS, (WPARAM)pos, 0); | 		SendMessage(hProgress, PBM_SETPOS, (WPARAM)pos, 0); | ||||||
| 		SetTaskbarProgressValue(pos, MAX_PROGRESS); | 		SetTaskbarProgressValue(pos, MAX_PROGRESS); | ||||||
| 	} | 	} | ||||||
|  | @ -1708,10 +1692,6 @@ static void InitDialog(HWND hDlg) | ||||||
| 	ShowWindow(GetDlgItem(hDlg, IDC_TEST), SW_SHOW); | 	ShowWindow(GetDlgItem(hDlg, IDC_TEST), SW_SHOW); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 	PF_INIT(ImageList_Create, Comctl32); |  | ||||||
| 	PF_INIT(ImageList_AddIcon, Comctl32); |  | ||||||
| 	PF_INIT(ImageList_ReplaceIcon, Comctl32); |  | ||||||
| 
 |  | ||||||
| 	// Quite a burden to carry around as parameters
 | 	// Quite a burden to carry around as parameters
 | ||||||
| 	hMainDialog = hDlg; | 	hMainDialog = hDlg; | ||||||
| 	MainThreadId = GetCurrentThreadId(); | 	MainThreadId = GetCurrentThreadId(); | ||||||
|  | @ -1748,7 +1728,7 @@ static void InitDialog(HWND hDlg) | ||||||
| 
 | 
 | ||||||
| 	// Create the font and brush for the Info edit box
 | 	// Create the font and brush for the Info edit box
 | ||||||
| 	hInfoFont = CreateFontA(lfHeight, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET, | 	hInfoFont = CreateFontA(lfHeight, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET, | ||||||
| 		0, 0, PROOF_QUALITY, 0, (nWindowsVersion >= WINDOWS_VISTA)?"Segoe UI":"Arial Unicode MS"); | 		0, 0, PROOF_QUALITY, 0, "Segoe UI"); | ||||||
| 	SendDlgItemMessageA(hDlg, IDC_INFO, WM_SETFONT, (WPARAM)hInfoFont, TRUE); | 	SendDlgItemMessageA(hDlg, IDC_INFO, WM_SETFONT, (WPARAM)hInfoFont, TRUE); | ||||||
| 	hInfoBrush = CreateSolidBrush(GetSysColor(COLOR_BTNFACE)); | 	hInfoBrush = CreateSolidBrush(GetSysColor(COLOR_BTNFACE)); | ||||||
| 	HideCaret(hInfo); | 	HideCaret(hInfo); | ||||||
|  | @ -1853,22 +1833,15 @@ static void InitDialog(HWND hDlg) | ||||||
| 		hIconLang = (HICON)LoadImage(hINetCplDllInst, MAKEINTRESOURCE(1313), IMAGE_ICON, s16, s16, LR_DEFAULTCOLOR | LR_SHARED); | 		hIconLang = (HICON)LoadImage(hINetCplDllInst, MAKEINTRESOURCE(1313), IMAGE_ICON, s16, s16, LR_DEFAULTCOLOR | LR_SHARED); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (nWindowsVersion >= WINDOWS_VISTA) { |  | ||||||
| 	hIconDown = (HICON)LoadImage(hShell32DllInst, MAKEINTRESOURCE(16750), IMAGE_ICON, s16, s16, LR_DEFAULTCOLOR | LR_SHARED); | 	hIconDown = (HICON)LoadImage(hShell32DllInst, MAKEINTRESOURCE(16750), IMAGE_ICON, s16, s16, LR_DEFAULTCOLOR | LR_SHARED); | ||||||
| 	hIconUp = (HICON)LoadImage(hShell32DllInst, MAKEINTRESOURCE(16749), IMAGE_ICON, s16, s16, LR_DEFAULTCOLOR | LR_SHARED); | 	hIconUp = (HICON)LoadImage(hShell32DllInst, MAKEINTRESOURCE(16749), IMAGE_ICON, s16, s16, LR_DEFAULTCOLOR | LR_SHARED); | ||||||
| 	} else { |  | ||||||
| 		hIconDown = (HICON)LoadImage(hMainInstance, MAKEINTRESOURCE(IDI_DOWN), IMAGE_ICON, 16, 16, 0); |  | ||||||
| 		hIconUp = (HICON)LoadImage(hMainInstance, MAKEINTRESOURCE(IDI_UP), IMAGE_ICON, 16, 16, 0); |  | ||||||
| 	} |  | ||||||
| 
 | 
 | ||||||
| 	// Create the language toolbar
 | 	// Create the language toolbar
 | ||||||
| 	hLangToolbar = CreateWindowExW(0, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_TABSTOP | TBSTYLE_TRANSPARENT | CCS_NOPARENTALIGN | | 	hLangToolbar = CreateWindowExW(0, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_TABSTOP | TBSTYLE_TRANSPARENT | CCS_NOPARENTALIGN | | ||||||
| 		CCS_NORESIZE | CCS_NODIVIDER, 0, 0, 0, 0, hMainDialog, NULL, hMainInstance, NULL); | 		CCS_NORESIZE | CCS_NODIVIDER, 0, 0, 0, 0, hMainDialog, NULL, hMainInstance, NULL); | ||||||
| 	if ((pfImageList_Create != NULL) && (pfImageList_AddIcon != NULL)) { | 	hLangToolbarImageList = ImageList_Create(i16, i16, ILC_COLOR32, 1, 0); | ||||||
| 		hLangToolbarImageList = pfImageList_Create(i16, i16, ILC_COLOR32, 1, 0); | 	ImageList_AddIcon(hLangToolbarImageList, hIconLang); | ||||||
| 		pfImageList_AddIcon(hLangToolbarImageList, hIconLang); |  | ||||||
| 	SendMessage(hLangToolbar, TB_SETIMAGELIST, (WPARAM)0, (LPARAM)hLangToolbarImageList); | 	SendMessage(hLangToolbar, TB_SETIMAGELIST, (WPARAM)0, (LPARAM)hLangToolbarImageList); | ||||||
| 	} |  | ||||||
| 	SendMessage(hLangToolbar, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0); | 	SendMessage(hLangToolbar, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0); | ||||||
| 	memset(tbLangToolbarButtons, 0, sizeof(TBBUTTON)); | 	memset(tbLangToolbarButtons, 0, sizeof(TBBUTTON)); | ||||||
| 	tbLangToolbarButtons[0].idCommand = lang_button_id; | 	tbLangToolbarButtons[0].idCommand = lang_button_id; | ||||||
|  | @ -1917,25 +1890,22 @@ static void InitDialog(HWND hDlg) | ||||||
| 	info_original_proc = (WNDPROC)SetWindowLongPtr(hInfo, GWLP_WNDPROC, (LONG_PTR)InfoCallback); | 	info_original_proc = (WNDPROC)SetWindowLongPtr(hInfo, GWLP_WNDPROC, (LONG_PTR)InfoCallback); | ||||||
| 
 | 
 | ||||||
| 	// Set the icons on the the buttons
 | 	// Set the icons on the the buttons
 | ||||||
| 	if ((pfImageList_Create != NULL) && (pfImageList_ReplaceIcon != NULL)) { | 	bi_iso.himl = ImageList_Create(i16, i16, ILC_COLOR32 | ILC_MASK, 1, 0); | ||||||
| 
 | 	ImageList_ReplaceIcon(bi_iso.himl, -1, hIconDisc); | ||||||
| 		bi_iso.himl = pfImageList_Create(i16, i16, ILC_COLOR32 | ILC_MASK, 1, 0); |  | ||||||
| 		pfImageList_ReplaceIcon(bi_iso.himl, -1, hIconDisc); |  | ||||||
| 	SetRect(&bi_iso.margin, 0, 1, 0, 0); | 	SetRect(&bi_iso.margin, 0, 1, 0, 0); | ||||||
| 	bi_iso.uAlign = BUTTON_IMAGELIST_ALIGN_CENTER; | 	bi_iso.uAlign = BUTTON_IMAGELIST_ALIGN_CENTER; | ||||||
| 		bi_down.himl = pfImageList_Create(i16, i16, ILC_COLOR32 | ILC_MASK, 1, 0); | 	bi_down.himl = ImageList_Create(i16, i16, ILC_COLOR32 | ILC_MASK, 1, 0); | ||||||
| 		pfImageList_ReplaceIcon(bi_down.himl, -1, hIconDown); | 	ImageList_ReplaceIcon(bi_down.himl, -1, hIconDown); | ||||||
| 	SetRect(&bi_down.margin, 0, 0, 0, 0); | 	SetRect(&bi_down.margin, 0, 0, 0, 0); | ||||||
| 	bi_down.uAlign = BUTTON_IMAGELIST_ALIGN_CENTER; | 	bi_down.uAlign = BUTTON_IMAGELIST_ALIGN_CENTER; | ||||||
| 		bi_up.himl = pfImageList_Create(i16, i16, ILC_COLOR32 | ILC_MASK, 1, 0); | 	bi_up.himl = ImageList_Create(i16, i16, ILC_COLOR32 | ILC_MASK, 1, 0); | ||||||
| 		pfImageList_ReplaceIcon(bi_up.himl, -1, hIconUp); | 	ImageList_ReplaceIcon(bi_up.himl, -1, hIconUp); | ||||||
| 	SetRect(&bi_up.margin, 0, 0, 0, 0); | 	SetRect(&bi_up.margin, 0, 0, 0, 0); | ||||||
| 	bi_up.uAlign = BUTTON_IMAGELIST_ALIGN_CENTER; | 	bi_up.uAlign = BUTTON_IMAGELIST_ALIGN_CENTER; | ||||||
| 
 | 
 | ||||||
| 	SendMessage(hSelectISO, BCM_SETIMAGELIST, 0, (LPARAM)&bi_iso); | 	SendMessage(hSelectISO, BCM_SETIMAGELIST, 0, (LPARAM)&bi_iso); | ||||||
| 	SendMessage(GetDlgItem(hDlg, IDC_ADVANCED), BCM_SETIMAGELIST, 0, | 	SendMessage(GetDlgItem(hDlg, IDC_ADVANCED), BCM_SETIMAGELIST, 0, | ||||||
| 		(LPARAM)(advanced_mode?&bi_up:&bi_down)); | 		(LPARAM)(advanced_mode?&bi_up:&bi_down)); | ||||||
| 	} |  | ||||||
| 
 | 
 | ||||||
| 	// Set the various tooltips
 | 	// Set the various tooltips
 | ||||||
| 	CreateTooltip(hFileSystem, lmprintf(MSG_157), -1); | 	CreateTooltip(hFileSystem, lmprintf(MSG_157), -1); | ||||||
|  | @ -1960,10 +1930,8 @@ static void InitDialog(HWND hDlg) | ||||||
| 	CreateTooltip(hLangToolbar, lmprintf(MSG_273), -1); | 	CreateTooltip(hLangToolbar, lmprintf(MSG_273), -1); | ||||||
| 
 | 
 | ||||||
| 	// Set a label for the Advanced Mode and Select Image button for screen readers
 | 	// Set a label for the Advanced Mode and Select Image button for screen readers
 | ||||||
| 	if (nWindowsVersion > WINDOWS_XP) { |  | ||||||
| 	SetWindowTextU(GetDlgItem(hDlg, IDC_ADVANCED), lmprintf(MSG_160)); | 	SetWindowTextU(GetDlgItem(hDlg, IDC_ADVANCED), lmprintf(MSG_160)); | ||||||
| 	SetWindowTextU(hSelectISO, lmprintf(MSG_165)); | 	SetWindowTextU(hSelectISO, lmprintf(MSG_165)); | ||||||
| 	} |  | ||||||
| 
 | 
 | ||||||
| 	if (!advanced_mode)	// Hide as needed, since we display the advanced controls by default
 | 	if (!advanced_mode)	// Hide as needed, since we display the advanced controls by default
 | ||||||
| 		ToggleAdvanced(FALSE); | 		ToggleAdvanced(FALSE); | ||||||
|  | @ -2195,7 +2163,7 @@ static BOOL CheckDriveAccess(DWORD dwTimeOut) | ||||||
| 	char *PhysicalPath = NULL, DevPath[MAX_PATH]; | 	char *PhysicalPath = NULL, DevPath[MAX_PATH]; | ||||||
| 	char drive_letter[27], drive_name[] = "?:"; | 	char drive_letter[27], drive_name[] = "?:"; | ||||||
| 	char *message, title[128]; | 	char *message, title[128]; | ||||||
| 	DWORD cur_time, end_time = GetTickCount() + dwTimeOut; | 	uint64_t cur_time, end_time = GetTickCount64() + dwTimeOut; | ||||||
| 
 | 
 | ||||||
| 	// Get the current selected device
 | 	// Get the current selected device
 | ||||||
| 	DWORD DeviceNum = (DWORD)ComboBox_GetItemData(hDeviceList, ComboBox_GetCurSel(hDeviceList)); | 	DWORD DeviceNum = (DWORD)ComboBox_GetItemData(hDeviceList, ComboBox_GetCurSel(hDeviceList)); | ||||||
|  | @ -2225,10 +2193,10 @@ static BOOL CheckDriveAccess(DWORD dwTimeOut) | ||||||
| 		drive_name[0] = drive_letter[i]; | 		drive_name[0] = drive_letter[i]; | ||||||
| 		if (QueryDosDeviceA(drive_name, DevPath, sizeof(DevPath)) != 0) { | 		if (QueryDosDeviceA(drive_name, DevPath, sizeof(DevPath)) != 0) { | ||||||
| 			StrArrayClear(&BlockingProcess); | 			StrArrayClear(&BlockingProcess); | ||||||
| 			cur_time = GetTickCount(); | 			cur_time = GetTickCount64(); | ||||||
| 			if (cur_time >= end_time) | 			if (cur_time >= end_time) | ||||||
| 				break; | 				break; | ||||||
| 			access_mask = SearchProcess(DevPath, end_time - cur_time, TRUE, TRUE, TRUE); | 			access_mask = SearchProcess(DevPath, (DWORD)(end_time - cur_time), TRUE, TRUE, TRUE); | ||||||
| 			CHECK_FOR_USER_CANCEL; | 			CHECK_FOR_USER_CANCEL; | ||||||
| 			// Ignore if all we have is read-only
 | 			// Ignore if all we have is read-only
 | ||||||
| 			if ((access_mask & 0x06) || (access_mask == 0x80)) { | 			if ((access_mask & 0x06) || (access_mask == 0x80)) { | ||||||
|  | @ -2272,7 +2240,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 	static BOOL first_log_display = TRUE, isMarquee = FALSE, queued_hotplug_event = FALSE; | 	static BOOL first_log_display = TRUE, isMarquee = FALSE, queued_hotplug_event = FALSE; | ||||||
| 	static ULONG ulRegister = 0; | 	static ULONG ulRegister = 0; | ||||||
| 	static LPITEMIDLIST pidlDesktop = NULL; | 	static LPITEMIDLIST pidlDesktop = NULL; | ||||||
| 	static MY_SHChangeNotifyEntry NotifyEntry; | 	static SHChangeNotifyEntry NotifyEntry; | ||||||
| 	static DWORD_PTR thread_affinity[4]; | 	static DWORD_PTR thread_affinity[4]; | ||||||
| 	DRAWITEMSTRUCT* pDI; | 	DRAWITEMSTRUCT* pDI; | ||||||
| 	HDROP droppedFileInfo; | 	HDROP droppedFileInfo; | ||||||
|  | @ -2316,7 +2284,6 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 		switch(LOWORD(wParam)) { | 		switch(LOWORD(wParam)) { | ||||||
| 		case IDOK:			// close application
 | 		case IDOK:			// close application
 | ||||||
| 		case IDCANCEL: | 		case IDCANCEL: | ||||||
| 			PF_INIT(SHChangeNotifyDeregister, Shell32); |  | ||||||
| 			EnableWindow(GetDlgItem(hDlg, IDCANCEL), FALSE); | 			EnableWindow(GetDlgItem(hDlg, IDCANCEL), FALSE); | ||||||
| 			if (format_thid != NULL) { | 			if (format_thid != NULL) { | ||||||
| 				if ((no_confirmation_on_cancel) || (MessageBoxExU(hMainDialog, lmprintf(MSG_105), lmprintf(MSG_049), | 				if ((no_confirmation_on_cancel) || (MessageBoxExU(hMainDialog, lmprintf(MSG_105), lmprintf(MSG_049), | ||||||
|  | @ -2343,8 +2310,8 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 				PrintInfo(0, MSG_201); | 				PrintInfo(0, MSG_201); | ||||||
| 				return (INT_PTR)TRUE; | 				return (INT_PTR)TRUE; | ||||||
| 			} | 			} | ||||||
| 			if ((pfSHChangeNotifyDeregister != NULL) && (ulRegister != 0)) | 			if (ulRegister != 0) | ||||||
| 				pfSHChangeNotifyDeregister(ulRegister); | 				SHChangeNotifyDeregister(ulRegister); | ||||||
| 			PostQuitMessage(0); | 			PostQuitMessage(0); | ||||||
| 			StrArrayDestroy(&DriveID); | 			StrArrayDestroy(&DriveID); | ||||||
| 			StrArrayDestroy(&DriveLabel); | 			StrArrayDestroy(&DriveLabel); | ||||||
|  | @ -2711,7 +2678,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 			case DBT_DEVICEARRIVAL: | 			case DBT_DEVICEARRIVAL: | ||||||
| 			case DBT_DEVICEREMOVECOMPLETE: | 			case DBT_DEVICEREMOVECOMPLETE: | ||||||
| 			case DBT_CUSTOMEVENT:	// Sent by our timer refresh function or for card reader media change
 | 			case DBT_CUSTOMEVENT:	// Sent by our timer refresh function or for card reader media change
 | ||||||
| 				LastRefresh = _GetTickCount64(); | 				LastRefresh = GetTickCount64(); | ||||||
| 				KillTimer(hMainDialog, TID_REFRESH_TIMER); | 				KillTimer(hMainDialog, TID_REFRESH_TIMER); | ||||||
| 				if (!format_op_in_progress) { | 				if (!format_op_in_progress) { | ||||||
| 					queued_hotplug_event = FALSE; | 					queued_hotplug_event = FALSE; | ||||||
|  | @ -2724,8 +2691,8 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 				return (INT_PTR)TRUE; | 				return (INT_PTR)TRUE; | ||||||
| 			case DBT_DEVNODES_CHANGED: | 			case DBT_DEVNODES_CHANGED: | ||||||
| 				// If it's been more than a second since last device refresh, arm a refresh timer
 | 				// If it's been more than a second since last device refresh, arm a refresh timer
 | ||||||
| 				if (_GetTickCount64() > LastRefresh + 1000) { | 				if (GetTickCount64() > LastRefresh + 1000) { | ||||||
| 					LastRefresh = _GetTickCount64(); | 					LastRefresh = GetTickCount64(); | ||||||
| 					SetTimer(hMainDialog, TID_REFRESH_TIMER, 1000, RefreshTimer); | 					SetTimer(hMainDialog, TID_REFRESH_TIMER, 1000, RefreshTimer); | ||||||
| 				} | 				} | ||||||
| 				break; | 				break; | ||||||
|  | @ -2736,7 +2703,6 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 		break; | 		break; | ||||||
| 
 | 
 | ||||||
| 	case WM_INITDIALOG: | 	case WM_INITDIALOG: | ||||||
| 		PF_INIT(SHChangeNotifyRegister, shell32); |  | ||||||
| 		// Make sure fScale is set before the first call to apply localization, so that move/resize scale appropriately
 | 		// Make sure fScale is set before the first call to apply localization, so that move/resize scale appropriately
 | ||||||
| 		hDC = GetDC(hDlg); | 		hDC = GetDC(hDlg); | ||||||
| 		fScale = GetDeviceCaps(hDC, LOGPIXELSX) / 96.0f; | 		fScale = GetDeviceCaps(hDC, LOGPIXELSX) / 96.0f; | ||||||
|  | @ -2753,12 +2719,12 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 		GetDevices(0); | 		GetDevices(0); | ||||||
| 		CheckForUpdates(FALSE); | 		CheckForUpdates(FALSE); | ||||||
| 		// Register MEDIA_INSERTED/MEDIA_REMOVED notifications for card readers
 | 		// Register MEDIA_INSERTED/MEDIA_REMOVED notifications for card readers
 | ||||||
| 		if ((pfSHChangeNotifyRegister != NULL) && (SUCCEEDED(SHGetSpecialFolderLocation(0, CSIDL_DESKTOP, &pidlDesktop)))) { | 		if (SUCCEEDED(SHGetSpecialFolderLocation(0, CSIDL_DESKTOP, &pidlDesktop))) { | ||||||
| 			NotifyEntry.pidl = pidlDesktop; | 			NotifyEntry.pidl = pidlDesktop; | ||||||
| 			NotifyEntry.fRecursive = TRUE; | 			NotifyEntry.fRecursive = TRUE; | ||||||
| 			// NB: The following only works if the media is already formatted.
 | 			// NB: The following only works if the media is already formatted.
 | ||||||
| 			// If you insert a blank card, notifications will not be sent... :(
 | 			// If you insert a blank card, notifications will not be sent... :(
 | ||||||
| 			ulRegister = pfSHChangeNotifyRegister(hDlg, 0x0001 | 0x0002 | 0x8000, | 			ulRegister = SHChangeNotifyRegister(hDlg, 0x0001 | 0x0002 | 0x8000, | ||||||
| 				SHCNE_MEDIAINSERTED | SHCNE_MEDIAREMOVED, UM_MEDIA_CHANGE, 1, &NotifyEntry); | 				SHCNE_MEDIAINSERTED | SHCNE_MEDIAREMOVED, UM_MEDIA_CHANGE, 1, &NotifyEntry); | ||||||
| 		} | 		} | ||||||
| 		// Bring our Window on top. We have to go through all *THREE* of these, or Far Manager hides our window :(
 | 		// Bring our Window on top. We have to go through all *THREE* of these, or Far Manager hides our window :(
 | ||||||
|  | @ -3039,7 +3005,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine | ||||||
| 	char *tmp, *locale_name = NULL, **argv = NULL; | 	char *tmp, *locale_name = NULL, **argv = NULL; | ||||||
| 	wchar_t **wenv, **wargv; | 	wchar_t **wenv, **wargv; | ||||||
| 	PF_TYPE_DECL(CDECL, int, __wgetmainargs, (int*, wchar_t***, wchar_t***, int, int*)); | 	PF_TYPE_DECL(CDECL, int, __wgetmainargs, (int*, wchar_t***, wchar_t***, int, int*)); | ||||||
| 	PF_TYPE_DECL(WINAPI, BOOL, ChangeWindowMessageFilter, (UINT message, DWORD dwFlag)); |  | ||||||
| 	HANDLE mutex = NULL, hogmutex = NULL, hFile = NULL; | 	HANDLE mutex = NULL, hogmutex = NULL, hFile = NULL; | ||||||
| 	HWND hDlg = NULL; | 	HWND hDlg = NULL; | ||||||
| 	HDC hDC; | 	HDC hDC; | ||||||
|  | @ -3058,7 +3023,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine | ||||||
| 	SetDllDirectoryA(""); | 	SetDllDirectoryA(""); | ||||||
| 
 | 
 | ||||||
| 	uprintf("*** " APPLICATION_NAME " init ***\n"); | 	uprintf("*** " APPLICATION_NAME " init ***\n"); | ||||||
| 	PF_INIT(GetTickCount64, kernel32); |  | ||||||
| 
 | 
 | ||||||
| 	// Reattach the console, if we were started from commandline
 | 	// Reattach the console, if we were started from commandline
 | ||||||
| 	if (AttachConsole(ATTACH_PARENT_PROCESS) != 0) { | 	if (AttachConsole(ATTACH_PARENT_PROCESS) != 0) { | ||||||
|  | @ -3239,6 +3203,19 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine | ||||||
| 	} | 	} | ||||||
| 	selected_langid = get_language_id(selected_locale); | 	selected_langid = get_language_id(selected_locale); | ||||||
| 
 | 
 | ||||||
|  | 	// Set the Windows version
 | ||||||
|  | 	GetWindowsVersion(); | ||||||
|  | 
 | ||||||
|  | 	// ...and nothing of value was lost
 | ||||||
|  | 	if (nWindowsVersion < WINDOWS_7) { | ||||||
|  | 		// Load the translation before we print the error
 | ||||||
|  | 		get_loc_data_file(loc_file, selected_locale); | ||||||
|  | 		right_to_left_mode = ((selected_locale->ctrl_id) & LOC_RIGHT_TO_LEFT); | ||||||
|  | 		// Set MB_SYSTEMMODAL to prevent Far Manager from stealing focus...
 | ||||||
|  | 		MessageBoxExU(NULL, lmprintf(MSG_294), lmprintf(MSG_293), MB_ICONSTOP | MB_IS_RTL | MB_SYSTEMMODAL, selected_langid); | ||||||
|  | 		goto out; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	// This is needed as there appears to be a *FLAW* in Windows allowing the app to run unelevated with some
 | 	// This is needed as there appears to be a *FLAW* in Windows allowing the app to run unelevated with some
 | ||||||
| 	// weirdly configured user accounts, even as we explicitly set 'requireAdministrator' in the manifest...
 | 	// weirdly configured user accounts, even as we explicitly set 'requireAdministrator' in the manifest...
 | ||||||
| 	if (!IsCurrentProcessElevated()) { | 	if (!IsCurrentProcessElevated()) { | ||||||
|  | @ -3280,9 +3257,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine | ||||||
| 		uprintf("Could not load RichEdit library - some dialogs may not display: %s\n", WindowsErrorString()); | 		uprintf("Could not load RichEdit library - some dialogs may not display: %s\n", WindowsErrorString()); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	// Set the Windows version
 |  | ||||||
| 	GetWindowsVersion(); |  | ||||||
| 
 |  | ||||||
| 	// Increase the application privileges (SE_DEBUG_PRIVILEGE), so that we can report
 | 	// Increase the application privileges (SE_DEBUG_PRIVILEGE), so that we can report
 | ||||||
| 	// the Windows Services preventing access to the disk or volume we want to format.
 | 	// the Windows Services preventing access to the disk or volume we want to format.
 | ||||||
| 	EnablePrivileges(); | 	EnablePrivileges(); | ||||||
|  | @ -3291,7 +3265,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine | ||||||
| 	// 0x9e disables removable and fixed drive notifications
 | 	// 0x9e disables removable and fixed drive notifications
 | ||||||
| 	lgp_set = SetLGP(FALSE, &existing_key, ep_reg, "NoDriveTypeAutorun", 0x9e); | 	lgp_set = SetLGP(FALSE, &existing_key, ep_reg, "NoDriveTypeAutorun", 0x9e); | ||||||
| 
 | 
 | ||||||
| 	if (nWindowsVersion > WINDOWS_XP) { |  | ||||||
| 	// Re-enable AutoMount if needed
 | 	// Re-enable AutoMount if needed
 | ||||||
| 	if (!GetAutoMount(&automount)) { | 	if (!GetAutoMount(&automount)) { | ||||||
| 		uprintf("Could not get AutoMount status"); | 		uprintf("Could not get AutoMount status"); | ||||||
|  | @ -3301,7 +3274,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine | ||||||
| 		if (!SetAutoMount(TRUE)) | 		if (!SetAutoMount(TRUE)) | ||||||
| 			uprintf("Failed to enable AutoMount"); | 			uprintf("Failed to enable AutoMount"); | ||||||
| 	} | 	} | ||||||
| 	} |  | ||||||
| 
 | 
 | ||||||
| relaunch: | relaunch: | ||||||
| 	ubprintf("Localization set to '%s'", selected_locale->txt[0]); | 	ubprintf("Localization set to '%s'", selected_locale->txt[0]); | ||||||
|  | @ -3329,18 +3301,11 @@ relaunch: | ||||||
| 	if ((relaunch_rc.left > -65536) && (relaunch_rc.top > -65536)) | 	if ((relaunch_rc.left > -65536) && (relaunch_rc.top > -65536)) | ||||||
| 		SetWindowPos(hDlg, HWND_TOP, relaunch_rc.left, relaunch_rc.top, 0, 0, SWP_NOSIZE); | 		SetWindowPos(hDlg, HWND_TOP, relaunch_rc.left, relaunch_rc.top, 0, 0, SWP_NOSIZE); | ||||||
| 
 | 
 | ||||||
| 	// Enable drag-n-drop through the message filter (for Vista or later)
 | 	// Enable drag-n-drop through the message filter
 | ||||||
| 	if (nWindowsVersion >= WINDOWS_VISTA) { | 	ChangeWindowMessageFilter(WM_DROPFILES, MSGFLT_ADD); | ||||||
| 		PF_INIT(ChangeWindowMessageFilter, user32); | 	ChangeWindowMessageFilter(WM_COPYDATA, MSGFLT_ADD); | ||||||
| 		if (pfChangeWindowMessageFilter != NULL) { |  | ||||||
| 			// NB: We use ChangeWindowMessageFilter() here because
 |  | ||||||
| 			// ChangeWindowMessageFilterEx() is not available on Vista
 |  | ||||||
| 			pfChangeWindowMessageFilter(WM_DROPFILES, MSGFLT_ADD); |  | ||||||
| 			pfChangeWindowMessageFilter(WM_COPYDATA, MSGFLT_ADD); |  | ||||||
| 	// CopyGlobalData is needed sine we are running elevated
 | 	// CopyGlobalData is needed sine we are running elevated
 | ||||||
| 			pfChangeWindowMessageFilter(WM_COPYGLOBALDATA, MSGFLT_ADD); | 	ChangeWindowMessageFilter(WM_COPYGLOBALDATA, MSGFLT_ADD); | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 
 | 
 | ||||||
| 	// Set the hook to automatically close Windows' "You need to format the disk in drive..." prompt
 | 	// Set the hook to automatically close Windows' "You need to format the disk in drive..." prompt
 | ||||||
| 	if (!SetFormatPromptHook()) | 	if (!SetFormatPromptHook()) | ||||||
|  | @ -3596,7 +3561,7 @@ out: | ||||||
| 	} | 	} | ||||||
| 	if (lgp_set) | 	if (lgp_set) | ||||||
| 		SetLGP(TRUE, &existing_key, ep_reg, "NoDriveTypeAutorun", 0); | 		SetLGP(TRUE, &existing_key, ep_reg, "NoDriveTypeAutorun", 0); | ||||||
| 	if ((nWindowsVersion > WINDOWS_XP) && (!automount) && (!SetAutoMount(FALSE))) | 	if ((!automount) && (!SetAutoMount(FALSE))) | ||||||
| 		uprintf("Failed to restore AutoMount to disabled"); | 		uprintf("Failed to restore AutoMount to disabled"); | ||||||
| 	ubflush(); | 	ubflush(); | ||||||
| 	// Unconditional delete with retry, just in case...
 | 	// Unconditional delete with retry, just in case...
 | ||||||
|  |  | ||||||
|  | @ -21,8 +21,8 @@ | ||||||
| 
 | 
 | ||||||
| #if defined(_MSC_VER) | #if defined(_MSC_VER) | ||||||
| // Disable some VS Code Analysis warnings
 | // Disable some VS Code Analysis warnings
 | ||||||
| #pragma warning(disable: 4996)		// Ignore deprecated (eg. GetVersionEx()), as we have to contend with XP
 | #pragma warning(disable: 4996)		// Ignore deprecated
 | ||||||
| #pragma warning(disable: 28159)		// We use GetTickCount64() where possible, but it's not available on XP
 | #pragma warning(disable: 28159)		// I'll keep using GetVersionEx(), thank you very much!
 | ||||||
| #pragma warning(disable: 6258)		// I know what I'm using TerminateThread for
 | #pragma warning(disable: 6258)		// I know what I'm using TerminateThread for
 | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | @ -599,7 +599,3 @@ static __inline HMODULE GetLibraryHandle(char* szLibraryName) { | ||||||
| #define ERROR_CANT_ASSIGN_LETTER       0x120B | #define ERROR_CANT_ASSIGN_LETTER       0x120B | ||||||
| #define ERROR_CANT_MOUNT_VOLUME        0x120C | #define ERROR_CANT_MOUNT_VOLUME        0x120C | ||||||
| 
 | 
 | ||||||
| /* GetTickCount64 not being available on XP is a massive bother */ |  | ||||||
| PF_TYPE(WINAPI, ULONGLONG, GetTickCount64, (void)); |  | ||||||
| extern GetTickCount64_t pfGetTickCount64; |  | ||||||
| #define _GetTickCount64() ((pfGetTickCount64 != NULL)?(uint64_t)pfGetTickCount64():(uint64_t)GetTickCount()) |  | ||||||
|  |  | ||||||
							
								
								
									
										14
									
								
								src/rufus.rc
									
										
									
									
									
								
							
							
						
						
									
										14
									
								
								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.18.1214" | CAPTION "Rufus 2.18.1215" | ||||||
| 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 | ||||||
|  | @ -366,8 +366,8 @@ END | ||||||
| // | // | ||||||
| 
 | 
 | ||||||
| VS_VERSION_INFO VERSIONINFO | VS_VERSION_INFO VERSIONINFO | ||||||
|  FILEVERSION 2,18,1214,0 |  FILEVERSION 2,18,1215,0 | ||||||
|  PRODUCTVERSION 2,18,1214,0 |  PRODUCTVERSION 2,18,1215,0 | ||||||
|  FILEFLAGSMASK 0x3fL |  FILEFLAGSMASK 0x3fL | ||||||
| #ifdef _DEBUG | #ifdef _DEBUG | ||||||
|  FILEFLAGS 0x1L |  FILEFLAGS 0x1L | ||||||
|  | @ -384,13 +384,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.18.1214" |             VALUE "FileVersion", "2.18.1215" | ||||||
|             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.18.1214" |             VALUE "ProductVersion", "2.18.1215" | ||||||
|         END |         END | ||||||
|     END |     END | ||||||
|     BLOCK "VarFileInfo" |     BLOCK "VarFileInfo" | ||||||
|  | @ -409,10 +409,6 @@ END | ||||||
| // remains consistent on all systems. | // remains consistent on all systems. | ||||||
| IDI_ICON                ICON                    "../res/rufus.ico" | IDI_ICON                ICON                    "../res/rufus.ico" | ||||||
| 
 | 
 | ||||||
| IDI_UP                  ICON                    "../res/up.ico" |  | ||||||
| 
 |  | ||||||
| IDI_DOWN                ICON                    "../res/down.ico" |  | ||||||
| 
 |  | ||||||
| #endif    // Neutral resources | #endif    // Neutral resources | ||||||
| ///////////////////////////////////////////////////////////////////////////// | ///////////////////////////////////////////////////////////////////////////// | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -36,8 +36,6 @@ int  nWindowsVersion = WINDOWS_UNDEFINED; | ||||||
| int  nWindowsBuildNumber = -1; | int  nWindowsBuildNumber = -1; | ||||||
| char WindowsVersionStr[128] = "Windows "; | char WindowsVersionStr[128] = "Windows "; | ||||||
| 
 | 
 | ||||||
| PF_TYPE_DECL(WINAPI, int, LCIDToLocaleName, (LCID, LPWSTR, int, DWORD)); |  | ||||||
| 
 |  | ||||||
| /*
 | /*
 | ||||||
|  * Hash table functions - modified From glibc 2.3.2: |  * Hash table functions - modified From glibc 2.3.2: | ||||||
|  * [Aho,Sethi,Ullman] Compilers: Principles, Techniques and Tools, 1986 |  * [Aho,Sethi,Ullman] Compilers: Principles, Techniques and Tools, 1986 | ||||||
|  | @ -900,11 +898,7 @@ char* GetCurrentMUI(void) | ||||||
| 	static char mui_str[LOCALE_NAME_MAX_LENGTH]; | 	static char mui_str[LOCALE_NAME_MAX_LENGTH]; | ||||||
| 	wchar_t wmui_str[LOCALE_NAME_MAX_LENGTH]; | 	wchar_t wmui_str[LOCALE_NAME_MAX_LENGTH]; | ||||||
| 
 | 
 | ||||||
| 	// Of course LCIDToLocaleName() is not available on XP... grrrr!
 | 	if (LCIDToLocaleName(GetUserDefaultUILanguage(), wmui_str, LOCALE_NAME_MAX_LENGTH, 0) > 0) { | ||||||
| 	PF_INIT(LCIDToLocaleName, kernel32); |  | ||||||
| 
 |  | ||||||
| 	if ( (pfLCIDToLocaleName != NULL) && |  | ||||||
| 		 (pfLCIDToLocaleName(GetUserDefaultUILanguage(), wmui_str, LOCALE_NAME_MAX_LENGTH, 0) > 0) ) { |  | ||||||
| 		wchar_to_utf8_no_alloc(wmui_str, mui_str, LOCALE_NAME_MAX_LENGTH); | 		wchar_to_utf8_no_alloc(wmui_str, mui_str, LOCALE_NAME_MAX_LENGTH); | ||||||
| 	} else { | 	} else { | ||||||
| 		static_strcpy(mui_str, "en-US"); | 		static_strcpy(mui_str, "en-US"); | ||||||
|  |  | ||||||
|  | @ -381,7 +381,8 @@ BOOL WriteFileWithRetry(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWr | ||||||
| // This is needed, for instance, if you are waiting for a thread that may issue uprintf's
 | // This is needed, for instance, if you are waiting for a thread that may issue uprintf's
 | ||||||
| DWORD WaitForSingleObjectWithMessages(HANDLE hHandle, DWORD dwMilliseconds) | DWORD WaitForSingleObjectWithMessages(HANDLE hHandle, DWORD dwMilliseconds) | ||||||
| { | { | ||||||
| 	DWORD res, dwCurTime, dwEndTime = GetTickCount() + dwMilliseconds; | 	uint64_t CurTime, EndTime = GetTickCount64() + dwMilliseconds; | ||||||
|  | 	DWORD res; | ||||||
| 	MSG msg; | 	MSG msg; | ||||||
| 
 | 
 | ||||||
| 	do { | 	do { | ||||||
|  | @ -399,11 +400,11 @@ DWORD WaitForSingleObjectWithMessages(HANDLE hHandle, DWORD dwMilliseconds) | ||||||
| 		res = MsgWaitForMultipleObjects(1, &hHandle, FALSE, dwMilliseconds, QS_ALLINPUT); | 		res = MsgWaitForMultipleObjects(1, &hHandle, FALSE, dwMilliseconds, QS_ALLINPUT); | ||||||
| 
 | 
 | ||||||
| 		if (dwMilliseconds != INFINITE) { | 		if (dwMilliseconds != INFINITE) { | ||||||
| 			dwCurTime = GetTickCount(); | 			CurTime = GetTickCount64(); | ||||||
| 			// Account for the case where we may reach the timeout condition while
 | 			// Account for the case where we may reach the timeout condition while
 | ||||||
| 			// processing timestamps
 | 			// processing timestamps
 | ||||||
| 			if (dwCurTime < dwEndTime) | 			if (CurTime < EndTime) | ||||||
| 				dwMilliseconds = dwEndTime - dwCurTime; | 				dwMilliseconds = (DWORD) (EndTime - CurTime); | ||||||
| 			else | 			else | ||||||
| 				res = WAIT_TIMEOUT; | 				res = WAIT_TIMEOUT; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
							
								
								
									
										150
									
								
								src/stdlg.c
									
										
									
									
									
								
							
							
						
						
									
										150
									
								
								src/stdlg.c
									
										
									
									
									
								
							|  | @ -42,12 +42,6 @@ | ||||||
| #include "settings.h" | #include "settings.h" | ||||||
| #include "license.h" | #include "license.h" | ||||||
| 
 | 
 | ||||||
| PF_TYPE_DECL(WINAPI, HRESULT, SHCreateItemFromParsingName, (PCWSTR, IBindCtx*, REFIID, void **)); |  | ||||||
| PF_TYPE_DECL(WINAPI, LPITEMIDLIST, SHSimpleIDListFromPath, (PCWSTR pszPath)); |  | ||||||
| #define INIT_VISTA_SHELL32         PF_INIT(SHCreateItemFromParsingName, Shell32) |  | ||||||
| #define INIT_XP_SHELL32            PF_INIT(SHSimpleIDListFromPath, Shell32) |  | ||||||
| #define IS_VISTA_SHELL32_AVAILABLE (pfSHCreateItemFromParsingName != NULL) |  | ||||||
| 
 |  | ||||||
| /* Globals */ | /* Globals */ | ||||||
| static HICON hMessageIcon = (HICON)INVALID_HANDLE_VALUE; | static HICON hMessageIcon = (HICON)INVALID_HANDLE_VALUE; | ||||||
| static char* szMessageText = NULL; | static char* szMessageText = NULL; | ||||||
|  | @ -107,21 +101,15 @@ INT CALLBACK BrowseInfoCallback(HWND hDlg, UINT message, LPARAM lParam, LPARAM p | ||||||
| 		hBrowseEdit = FindWindowExA(hDlg, NULL, "Edit", NULL); | 		hBrowseEdit = FindWindowExA(hDlg, NULL, "Edit", NULL); | ||||||
| 		SetWindowTextU(hBrowseEdit, szFolderPath); | 		SetWindowTextU(hBrowseEdit, szFolderPath); | ||||||
| 		SetDialogFocus(hDlg, hBrowseEdit); | 		SetDialogFocus(hDlg, hBrowseEdit); | ||||||
| 		// On XP, BFFM_SETSELECTION can't be used with a Unicode Path in SendMessageW
 |  | ||||||
| 		// or a pidl (at least with MinGW) => must use SendMessageA
 |  | ||||||
| 		if (nWindowsVersion <= WINDOWS_XP) { |  | ||||||
| 			SendMessageLU(hDlg, BFFM_SETSELECTION, (WPARAM)TRUE, szFolderPath); |  | ||||||
| 		} else { |  | ||||||
| 		// On Windows 7, MinGW only properly selects the specified folder when using a pidl
 | 		// On Windows 7, MinGW only properly selects the specified folder when using a pidl
 | ||||||
| 		wpath = utf8_to_wchar(szFolderPath); | 		wpath = utf8_to_wchar(szFolderPath); | ||||||
| 			pidl = (*pfSHSimpleIDListFromPath)(wpath); | 		pidl = SHSimpleIDListFromPath(wpath); | ||||||
| 		safe_free(wpath); | 		safe_free(wpath); | ||||||
| 		// NB: see http://connect.microsoft.com/VisualStudio/feedback/details/518103/bffm-setselection-does-not-work-with-shbrowseforfolder-on-windows-7
 | 		// NB: see http://connect.microsoft.com/VisualStudio/feedback/details/518103/bffm-setselection-does-not-work-with-shbrowseforfolder-on-windows-7
 | ||||||
| 		// for details as to why we send BFFM_SETSELECTION twice.
 | 		// for details as to why we send BFFM_SETSELECTION twice.
 | ||||||
| 		SendMessageW(hDlg, BFFM_SETSELECTION, (WPARAM)FALSE, (LPARAM)pidl); | 		SendMessageW(hDlg, BFFM_SETSELECTION, (WPARAM)FALSE, (LPARAM)pidl); | ||||||
| 		Sleep(100); | 		Sleep(100); | ||||||
| 		PostMessageW(hDlg, BFFM_SETSELECTION, (WPARAM)FALSE, (LPARAM)pidl); | 		PostMessageW(hDlg, BFFM_SETSELECTION, (WPARAM)FALSE, (LPARAM)pidl); | ||||||
| 		} |  | ||||||
| 		break; | 		break; | ||||||
| 	case BFFM_SELCHANGED: | 	case BFFM_SELCHANGED: | ||||||
| 		// Update the status
 | 		// Update the status
 | ||||||
|  | @ -136,7 +124,6 @@ INT CALLBACK BrowseInfoCallback(HWND hDlg, UINT message, LPARAM lParam, LPARAM p | ||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
|  * Browse for a folder and update the folder edit box |  * Browse for a folder and update the folder edit box | ||||||
|  * Will use the newer IFileOpenDialog if *compiled* for Vista or later |  | ||||||
|  */ |  */ | ||||||
| void BrowseForFolder(void) { | void BrowseForFolder(void) { | ||||||
| 
 | 
 | ||||||
|  | @ -152,9 +139,6 @@ void BrowseForFolder(void) { | ||||||
| 	char* tmp_path = NULL; | 	char* tmp_path = NULL; | ||||||
| 
 | 
 | ||||||
| 	dialog_showing++; | 	dialog_showing++; | ||||||
| 	if (nWindowsVersion >= WINDOWS_VISTA) { |  | ||||||
| 		INIT_VISTA_SHELL32; |  | ||||||
| 		if (IS_VISTA_SHELL32_AVAILABLE) { |  | ||||||
| 	hr = CoCreateInstance(&CLSID_FileOpenDialog, NULL, CLSCTX_INPROC, | 	hr = CoCreateInstance(&CLSID_FileOpenDialog, NULL, CLSCTX_INPROC, | ||||||
| 		&IID_IFileOpenDialog, (LPVOID)&pfod); | 		&IID_IFileOpenDialog, (LPVOID)&pfod); | ||||||
| 	if (FAILED(hr)) { | 	if (FAILED(hr)) { | ||||||
|  | @ -181,7 +165,7 @@ void BrowseForFolder(void) { | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 			hr = (*pfSHCreateItemFromParsingName)(wpath, NULL, &IID_IShellItem, (LPVOID)&si_path); | 	hr = SHCreateItemFromParsingName(wpath, NULL, &IID_IShellItem, (LPVOID)&si_path); | ||||||
| 	if (SUCCEEDED(hr)) { | 	if (SUCCEEDED(hr)) { | ||||||
| 		if (wpath != NULL) { | 		if (wpath != NULL) { | ||||||
| 			pfod->lpVtbl->SetFolder(pfod, si_path); | 			pfod->lpVtbl->SetFolder(pfod, si_path); | ||||||
|  | @ -216,14 +200,11 @@ void BrowseForFolder(void) { | ||||||
| 	pfod->lpVtbl->Release(pfod); | 	pfod->lpVtbl->Release(pfod); | ||||||
| 	dialog_showing--; | 	dialog_showing--; | ||||||
| 	return; | 	return; | ||||||
| 		} |  | ||||||
| fallback: | fallback: | ||||||
| 	if (pfod != NULL) { | 	if (pfod != NULL) { | ||||||
| 		pfod->lpVtbl->Release(pfod); | 		pfod->lpVtbl->Release(pfod); | ||||||
| 	} | 	} | ||||||
| 	} |  | ||||||
| 
 | 
 | ||||||
| 	INIT_XP_SHELL32; |  | ||||||
| 	memset(&bi, 0, sizeof(BROWSEINFOW)); | 	memset(&bi, 0, sizeof(BROWSEINFOW)); | ||||||
| 	bi.hwndOwner = hMainDialog; | 	bi.hwndOwner = hMainDialog; | ||||||
| 	bi.lpszTitle = utf8_to_wchar(lmprintf(MSG_106)); | 	bi.lpszTitle = utf8_to_wchar(lmprintf(MSG_106)); | ||||||
|  | @ -241,11 +222,10 @@ fallback: | ||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
|  * Return the UTF8 path of a file selected through a load or save dialog |  * Return the UTF8 path of a file selected through a load or save dialog | ||||||
|  * Will use the newer IFileOpenDialog if *compiled* for Vista or later |  | ||||||
|  * All string parameters are UTF-8 |  * All string parameters are UTF-8 | ||||||
|  * IMPORTANT NOTE: On Vista and later, remember that you need to call |  * IMPORTANT NOTE: Remember that you need to call CoInitializeEx() for | ||||||
|  * CoInitializeEx() for *EACH* thread you invoke FileDialog from, as |  * *EACH* thread you invoke FileDialog from, as GetDisplayName() will | ||||||
|  * GetDisplayName() will return error 0x8001010E otherwise. |  * return error 0x8001010E otherwise. | ||||||
|  */ |  */ | ||||||
| char* FileDialog(BOOL save, char* path, const ext_t* ext, DWORD options) | char* FileDialog(BOOL save, char* path, const ext_t* ext, DWORD options) | ||||||
| { | { | ||||||
|  | @ -267,10 +247,8 @@ char* FileDialog(BOOL save, char* path, const ext_t* ext, DWORD options) | ||||||
| 		return NULL; | 		return NULL; | ||||||
| 	dialog_showing++; | 	dialog_showing++; | ||||||
| 
 | 
 | ||||||
| 	if (nWindowsVersion >= WINDOWS_VISTA) { |  | ||||||
| 		INIT_VISTA_SHELL32; |  | ||||||
| 	filter_spec = (COMDLG_FILTERSPEC*)calloc(ext->count + 1, sizeof(COMDLG_FILTERSPEC)); | 	filter_spec = (COMDLG_FILTERSPEC*)calloc(ext->count + 1, sizeof(COMDLG_FILTERSPEC)); | ||||||
| 		if ((IS_VISTA_SHELL32_AVAILABLE) && (filter_spec != NULL)) { | 	if (filter_spec != NULL) { | ||||||
| 		// Setup the file extension filter table
 | 		// Setup the file extension filter table
 | ||||||
| 		for (i = 0; i < ext->count; i++) { | 		for (i = 0; i < ext->count; i++) { | ||||||
| 			filter_spec[i].pszSpec = utf8_to_wchar(ext->extension[i]); | 			filter_spec[i].pszSpec = utf8_to_wchar(ext->extension[i]); | ||||||
|  | @ -294,7 +272,7 @@ char* FileDialog(BOOL save, char* path, const ext_t* ext, DWORD options) | ||||||
| 
 | 
 | ||||||
| 		// Set the default directory
 | 		// Set the default directory
 | ||||||
| 		wpath = utf8_to_wchar(path); | 		wpath = utf8_to_wchar(path); | ||||||
| 			hr = (*pfSHCreateItemFromParsingName)(wpath, NULL, &IID_IShellItem, (LPVOID)&si_path); | 		hr = SHCreateItemFromParsingName(wpath, NULL, &IID_IShellItem, (LPVOID)&si_path); | ||||||
| 		if (SUCCEEDED(hr)) { | 		if (SUCCEEDED(hr)) { | ||||||
| 			pfd->lpVtbl->SetFolder(pfd, si_path); | 			pfd->lpVtbl->SetFolder(pfd, si_path); | ||||||
| 		} | 		} | ||||||
|  | @ -342,12 +320,12 @@ char* FileDialog(BOOL save, char* path, const ext_t* ext, DWORD options) | ||||||
| 		dialog_showing--; | 		dialog_showing--; | ||||||
| 		return filepath; | 		return filepath; | ||||||
| 	} | 	} | ||||||
| 	fallback: | 
 | ||||||
|  | fallback: | ||||||
| 	safe_free(filter_spec); | 	safe_free(filter_spec); | ||||||
| 	if (pfd != NULL) { | 	if (pfd != NULL) { | ||||||
| 		pfd->lpVtbl->Release(pfd); | 		pfd->lpVtbl->Release(pfd); | ||||||
| 	} | 	} | ||||||
| 	} |  | ||||||
| 
 | 
 | ||||||
| 	memset(&ofn, 0, sizeof(ofn)); | 	memset(&ofn, 0, sizeof(ofn)); | ||||||
| 	ofn.lStructSize = sizeof(ofn); | 	ofn.lStructSize = sizeof(ofn); | ||||||
|  | @ -433,7 +411,7 @@ void CreateStatusBar(void) | ||||||
| 	// Set the font we'll use to display the '#' sign in the toolbar button
 | 	// Set the font we'll use to display the '#' sign in the toolbar button
 | ||||||
| 	hFont = CreateFontA(-MulDiv(10, GetDeviceCaps(GetDC(hMainDialog), LOGPIXELSY), 72), | 	hFont = CreateFontA(-MulDiv(10, GetDeviceCaps(GetDC(hMainDialog), LOGPIXELSY), 72), | ||||||
| 		0, 0, 0, FW_MEDIUM, FALSE, FALSE, FALSE, DEFAULT_CHARSET, | 		0, 0, 0, FW_MEDIUM, FALSE, FALSE, FALSE, DEFAULT_CHARSET, | ||||||
| 		0, 0, PROOF_QUALITY, 0, (nWindowsVersion >= WINDOWS_VISTA)?"Segoe UI":"Arial Unicode MS"); | 		0, 0, PROOF_QUALITY, 0, "Segoe UI"); | ||||||
| 
 | 
 | ||||||
| 	// Find the width of our hash sign
 | 	// Find the width of our hash sign
 | ||||||
| 	hDC = GetDC(hMainDialog); | 	hDC = GetDC(hMainDialog); | ||||||
|  | @ -458,10 +436,6 @@ void CreateStatusBar(void) | ||||||
| 
 | 
 | ||||||
| 	// Compute the dimensions for the hash button
 | 	// Compute the dimensions for the hash button
 | ||||||
| 	x = edge[0]; | 	x = edge[0]; | ||||||
| 	if (nWindowsVersion <= WINDOWS_XP) { |  | ||||||
| 		x -= 1; |  | ||||||
| 		height -= 2; |  | ||||||
| 	} |  | ||||||
| 	y = rect.bottom - height + 1; | 	y = rect.bottom - height + 1; | ||||||
| 	width = edge[1] - edge[0] - 1; | 	width = edge[1] - edge[0] - 1; | ||||||
| 	// How I wish there was a way to figure out how to make Windows controls look good
 | 	// How I wish there was a way to figure out how to make Windows controls look good
 | ||||||
|  | @ -721,7 +695,6 @@ INT_PTR CALLBACK NotificationCallback(HWND hDlg, UINT message, WPARAM wParam, LP | ||||||
| 
 | 
 | ||||||
| 	switch (message) { | 	switch (message) { | ||||||
| 	case WM_INITDIALOG: | 	case WM_INITDIALOG: | ||||||
| 		if (nWindowsVersion >= WINDOWS_VISTA) {	// of course, this stuff doesn't work on XP!
 |  | ||||||
| 		// Get the system message box font. See http://stackoverflow.com/a/6057761
 | 		// Get the system message box font. See http://stackoverflow.com/a/6057761
 | ||||||
| 		ncm.cbSize = sizeof(ncm); | 		ncm.cbSize = sizeof(ncm); | ||||||
| 		// If we're compiling with the Vista SDK or later, the NONCLIENTMETRICS struct
 | 		// If we're compiling with the Vista SDK or later, the NONCLIENTMETRICS struct
 | ||||||
|  | @ -737,7 +710,6 @@ INT_PTR CALLBACK NotificationCallback(HWND hDlg, UINT message, WPARAM wParam, LP | ||||||
| 		SendMessage(GetDlgItem(hDlg, IDC_MORE_INFO), WM_SETFONT, (WPARAM)hDlgFont, MAKELPARAM(TRUE, 0)); | 		SendMessage(GetDlgItem(hDlg, IDC_MORE_INFO), WM_SETFONT, (WPARAM)hDlgFont, MAKELPARAM(TRUE, 0)); | ||||||
| 		SendMessage(GetDlgItem(hDlg, IDYES), WM_SETFONT, (WPARAM)hDlgFont, MAKELPARAM(TRUE, 0)); | 		SendMessage(GetDlgItem(hDlg, IDYES), WM_SETFONT, (WPARAM)hDlgFont, MAKELPARAM(TRUE, 0)); | ||||||
| 		SendMessage(GetDlgItem(hDlg, IDNO), WM_SETFONT, (WPARAM)hDlgFont, MAKELPARAM(TRUE, 0)); | 		SendMessage(GetDlgItem(hDlg, IDNO), WM_SETFONT, (WPARAM)hDlgFont, MAKELPARAM(TRUE, 0)); | ||||||
| 		} |  | ||||||
| 
 | 
 | ||||||
| 		apply_localization(IDD_NOTIFICATION, hDlg); | 		apply_localization(IDD_NOTIFICATION, hDlg); | ||||||
| 		background_brush = CreateSolidBrush(GetSysColor(COLOR_WINDOW)); | 		background_brush = CreateSolidBrush(GetSysColor(COLOR_WINDOW)); | ||||||
|  | @ -878,11 +850,9 @@ INT_PTR CALLBACK SelectionCallback(HWND hDlg, UINT message, WPARAM wParam, LPARA | ||||||
| 		// If we're compiling with the Vista SDK or later, the NONCLIENTMETRICS struct
 | 		// If we're compiling with the Vista SDK or later, the NONCLIENTMETRICS struct
 | ||||||
| 		// will be the wrong size for previous versions, so we need to adjust it.
 | 		// will be the wrong size for previous versions, so we need to adjust it.
 | ||||||
| #if defined(_MSC_VER) && (_MSC_VER >= 1500) && (_WIN32_WINNT >= _WIN32_WINNT_VISTA) | #if defined(_MSC_VER) && (_MSC_VER >= 1500) && (_WIN32_WINNT >= _WIN32_WINNT_VISTA) | ||||||
| 		if (nWindowsVersion >= WINDOWS_VISTA) { |  | ||||||
| 		// In versions of Windows prior to Vista, the iPaddedBorderWidth member
 | 		// In versions of Windows prior to Vista, the iPaddedBorderWidth member
 | ||||||
| 		// is not present, so we need to subtract its size from cbSize.
 | 		// is not present, so we need to subtract its size from cbSize.
 | ||||||
| 		ncm.cbSize -= sizeof(ncm.iPaddedBorderWidth); | 		ncm.cbSize -= sizeof(ncm.iPaddedBorderWidth); | ||||||
| 		} |  | ||||||
| #endif | #endif | ||||||
| 		SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0); | 		SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0); | ||||||
| 		hDlgFont = CreateFontIndirect(&(ncm.lfMessageFont)); | 		hDlgFont = CreateFontIndirect(&(ncm.lfMessageFont)); | ||||||
|  | @ -1020,11 +990,9 @@ INT_PTR CALLBACK ListCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa | ||||||
| 		// If we're compiling with the Vista SDK or later, the NONCLIENTMETRICS struct
 | 		// If we're compiling with the Vista SDK or later, the NONCLIENTMETRICS struct
 | ||||||
| 		// will be the wrong size for previous versions, so we need to adjust it.
 | 		// will be the wrong size for previous versions, so we need to adjust it.
 | ||||||
| #if defined(_MSC_VER) && (_MSC_VER >= 1500) && (_WIN32_WINNT >= _WIN32_WINNT_VISTA) | #if defined(_MSC_VER) && (_MSC_VER >= 1500) && (_WIN32_WINNT >= _WIN32_WINNT_VISTA) | ||||||
| 		if (nWindowsVersion >= WINDOWS_VISTA) { |  | ||||||
| 		// In versions of Windows prior to Vista, the iPaddedBorderWidth member
 | 		// In versions of Windows prior to Vista, the iPaddedBorderWidth member
 | ||||||
| 		// is not present, so we need to subtract its size from cbSize.
 | 		// is not present, so we need to subtract its size from cbSize.
 | ||||||
| 		ncm.cbSize -= sizeof(ncm.iPaddedBorderWidth); | 		ncm.cbSize -= sizeof(ncm.iPaddedBorderWidth); | ||||||
| 		} |  | ||||||
| #endif | #endif | ||||||
| 		SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0); | 		SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0); | ||||||
| 		hDlgFont = CreateFontIndirect(&(ncm.lfMessageFont)); | 		hDlgFont = CreateFontIndirect(&(ncm.lfMessageFont)); | ||||||
|  | @ -1290,97 +1258,15 @@ LONG GetEntryWidth(HWND hDropDown, const char *entry) | ||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
|  * Windows 7 taskbar icon handling (progress bar overlay, etc) |  * Windows 7 taskbar icon handling (progress bar overlay, etc) | ||||||
|  * Some platforms don't have these, so we redefine |  | ||||||
|  */ |  */ | ||||||
| typedef enum MY_STPFLAG | static ITaskbarList3* ptbl = NULL; | ||||||
| { |  | ||||||
| 	MY_STPF_NONE = 0, |  | ||||||
| 	MY_STPF_USEAPPTHUMBNAILALWAYS = 0x1, |  | ||||||
| 	MY_STPF_USEAPPTHUMBNAILWHENACTIVE = 0x2, |  | ||||||
| 	MY_STPF_USEAPPPEEKALWAYS = 0x4, |  | ||||||
| 	MY_STPF_USEAPPPEEKWHENACTIVE = 0x8 |  | ||||||
| } MY_STPFLAG; |  | ||||||
| 
 |  | ||||||
| typedef enum MY_THUMBBUTTONMASK |  | ||||||
| { |  | ||||||
| 	MY_THB_BITMAP = 0x1, |  | ||||||
| 	MY_THB_ICON = 0x2, |  | ||||||
| 	MY_THB_TOOLTIP = 0x4, |  | ||||||
| 	MY_THB_FLAGS = 0x8 |  | ||||||
| } MY_THUMBBUTTONMASK; |  | ||||||
| 
 |  | ||||||
| typedef enum MY_THUMBBUTTONFLAGS |  | ||||||
| { |  | ||||||
| 	MY_THBF_ENABLED = 0, |  | ||||||
| 	MY_THBF_DISABLED = 0x1, |  | ||||||
| 	MY_THBF_DISMISSONCLICK = 0x2, |  | ||||||
| 	MY_THBF_NOBACKGROUND = 0x4, |  | ||||||
| 	MY_THBF_HIDDEN = 0x8, |  | ||||||
| 	MY_THBF_NONINTERACTIVE = 0x10 |  | ||||||
| } MY_THUMBBUTTONFLAGS; |  | ||||||
| 
 |  | ||||||
| typedef struct MY_THUMBBUTTON |  | ||||||
| { |  | ||||||
| 	MY_THUMBBUTTONMASK dwMask; |  | ||||||
| 	UINT iId; |  | ||||||
| 	UINT iBitmap; |  | ||||||
| 	HICON hIcon; |  | ||||||
| 	WCHAR szTip[260]; |  | ||||||
| 	MY_THUMBBUTTONFLAGS dwFlags; |  | ||||||
| } MY_THUMBBUTTON; |  | ||||||
| 
 |  | ||||||
| /*
 |  | ||||||
| typedef enum MY_TBPFLAG |  | ||||||
| { |  | ||||||
| 	TASKBAR_NOPROGRESS = 0, |  | ||||||
| 	TASKBAR_INDETERMINATE = 0x1, |  | ||||||
| 	TASKBAR_NORMAL = 0x2, |  | ||||||
| 	TASKBAR_ERROR = 0x4, |  | ||||||
| 	TASKBAR_PAUSED = 0x8 |  | ||||||
| } MY_TBPFLAG; |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| #pragma push_macro("INTERFACE") |  | ||||||
| #undef  INTERFACE |  | ||||||
| #define INTERFACE my_ITaskbarList3 |  | ||||||
| DECLARE_INTERFACE_(my_ITaskbarList3, IUnknown) { |  | ||||||
| 	STDMETHOD (QueryInterface) (THIS_ REFIID riid, LPVOID *ppvObj) PURE; |  | ||||||
| 	STDMETHOD_(ULONG, AddRef) (THIS) PURE; |  | ||||||
| 	STDMETHOD_(ULONG, Release) (THIS) PURE; |  | ||||||
| 	STDMETHOD (HrInit) (THIS) PURE; |  | ||||||
| 	STDMETHOD (AddTab) (THIS_ HWND hwnd) PURE; |  | ||||||
| 	STDMETHOD (DeleteTab) (THIS_ HWND hwnd) PURE; |  | ||||||
| 	STDMETHOD (ActivateTab) (THIS_ HWND hwnd) PURE; |  | ||||||
| 	STDMETHOD (SetActiveAlt) (THIS_ HWND hwnd) PURE; |  | ||||||
| 	STDMETHOD (MarkFullscreenWindow) (THIS_ HWND hwnd, int fFullscreen) PURE; |  | ||||||
| 	STDMETHOD (SetProgressValue) (THIS_ HWND hwnd, ULONGLONG ullCompleted, ULONGLONG ullTotal) PURE; |  | ||||||
| 	STDMETHOD (SetProgressState) (THIS_ HWND hwnd, TASKBAR_PROGRESS_FLAGS tbpFlags) PURE; |  | ||||||
| 	STDMETHOD (RegisterTab) (THIS_ HWND hwndTab,HWND hwndMDI) PURE; |  | ||||||
| 	STDMETHOD (UnregisterTab) (THIS_ HWND hwndTab) PURE; |  | ||||||
| 	STDMETHOD (SetTabOrder) (THIS_ HWND hwndTab, HWND hwndInsertBefore) PURE; |  | ||||||
| 	STDMETHOD (SetTabActive) (THIS_ HWND hwndTab, HWND hwndMDI, DWORD dwReserved) PURE; |  | ||||||
| 	STDMETHOD (ThumbBarAddButtons) (THIS_ HWND hwnd, UINT cButtons, MY_THUMBBUTTON* pButton) PURE; |  | ||||||
| 	STDMETHOD (ThumbBarUpdateButtons) (THIS_ HWND hwnd, UINT cButtons, MY_THUMBBUTTON* pButton) PURE; |  | ||||||
| 	STDMETHOD (ThumbBarSetImageList) (THIS_ HWND hwnd, HIMAGELIST himl) PURE; |  | ||||||
| 	STDMETHOD (SetOverlayIcon) (THIS_ HWND hwnd, HICON hIcon, LPCWSTR pszDescription) PURE; |  | ||||||
| 	STDMETHOD (SetThumbnailTooltip) (THIS_ HWND hwnd, LPCWSTR pszTip) PURE; |  | ||||||
| 	STDMETHOD (SetThumbnailClip) (THIS_ HWND hwnd, RECT *prcClip) PURE; |  | ||||||
| }; |  | ||||||
| const IID my_IID_ITaskbarList3 = |  | ||||||
| 	{ 0xea1afb91, 0x9e28, 0x4b86, { 0x90, 0xe9, 0x9e, 0x9f, 0x8a, 0x5e, 0xef, 0xaf } }; |  | ||||||
| const IID my_CLSID_TaskbarList = |  | ||||||
| 	{ 0x56fdf344, 0xfd6d, 0x11d0, { 0x95, 0x8a ,0x0, 0x60, 0x97, 0xc9, 0xa0 ,0x90 } }; |  | ||||||
| 
 |  | ||||||
| static my_ITaskbarList3* ptbl = NULL; |  | ||||||
| 
 | 
 | ||||||
| // Create a taskbar icon progressbar
 | // Create a taskbar icon progressbar
 | ||||||
| BOOL CreateTaskbarList(void) | BOOL CreateTaskbarList(void) | ||||||
| { | { | ||||||
| 	HRESULT hr; | 	HRESULT hr; | ||||||
| 	if (nWindowsVersion < WINDOWS_7) | 
 | ||||||
| 		// Only valid for Windows 7 or later
 | 	hr = CoCreateInstance(&CLSID_TaskbarList, NULL, CLSCTX_ALL, &IID_ITaskbarList3, (LPVOID)&ptbl); | ||||||
| 		return FALSE; |  | ||||||
| 	hr = CoCreateInstance(&my_CLSID_TaskbarList, NULL, CLSCTX_ALL, &my_IID_ITaskbarList3, (LPVOID)&ptbl); |  | ||||||
| 	if (FAILED(hr)) { | 	if (FAILED(hr)) { | ||||||
| 		uprintf("CoCreateInstance for TaskbarList failed: error %X\n", hr); | 		uprintf("CoCreateInstance for TaskbarList failed: error %X\n", hr); | ||||||
| 		ptbl = NULL; | 		ptbl = NULL; | ||||||
|  | @ -1402,8 +1288,6 @@ BOOL SetTaskbarProgressValue(ULONGLONG ullCompleted, ULONGLONG ullTotal) | ||||||
| 		return FALSE; | 		return FALSE; | ||||||
| 	return !FAILED(ptbl->lpVtbl->SetProgressValue(ptbl, hMainDialog, ullCompleted, ullTotal)); | 	return !FAILED(ptbl->lpVtbl->SetProgressValue(ptbl, hMainDialog, ullCompleted, ullTotal)); | ||||||
| } | } | ||||||
| #pragma pop_macro("INTERFACE") |  | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
|  * Update policy and settings dialog callback |  * Update policy and settings dialog callback | ||||||
|  | @ -1523,7 +1407,7 @@ INT_PTR CALLBACK UpdateCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM l | ||||||
| BOOL SetUpdateCheck(void) | BOOL SetUpdateCheck(void) | ||||||
| { | { | ||||||
| 	BOOL enable_updates; | 	BOOL enable_updates; | ||||||
| 	uint64_t commcheck = _GetTickCount64(); | 	uint64_t commcheck = GetTickCount64(); | ||||||
| 	notification_info more_info = { IDD_UPDATE_POLICY, UpdateCallback }; | 	notification_info more_info = { IDD_UPDATE_POLICY, UpdateCallback }; | ||||||
| 	char filename[MAX_PATH] = "", exename[] = APPLICATION_NAME ".exe"; | 	char filename[MAX_PATH] = "", exename[] = APPLICATION_NAME ".exe"; | ||||||
| 	size_t fn_len, exe_len; | 	size_t fn_len, exe_len; | ||||||
|  | @ -1837,7 +1721,7 @@ LPCDLGTEMPLATE GetDialogTemplate(int Dialog_ID) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	// All our dialogs are set to use 'Segoe UI Symbol' by default:
 | 	// All our dialogs are set to use 'Segoe UI Symbol' by default:
 | ||||||
| 	// 1. So that we can replace the font name with 'MS Shell Dlg' (XP) or 'Segoe UI'
 | 	// 1. So that we can replace the font name with 'Segoe UI'
 | ||||||
| 	// 2. So that Thai displays properly on RTF controls as it won't work with regular
 | 	// 2. So that Thai displays properly on RTF controls as it won't work with regular
 | ||||||
| 	// 'Segoe UI'... but Cyrillic won't work with 'Segoe UI Symbol'
 | 	// 'Segoe UI'... but Cyrillic won't work with 'Segoe UI Symbol'
 | ||||||
| 
 | 
 | ||||||
|  | @ -1865,12 +1749,8 @@ LPCDLGTEMPLATE GetDialogTemplate(int Dialog_ID) | ||||||
| 		// We can't simply zero the characters we don't want, as the size of the font
 | 		// We can't simply zero the characters we don't want, as the size of the font
 | ||||||
| 		// string determines the next item lookup. So we must memmove the remaining of
 | 		// string determines the next item lookup. So we must memmove the remaining of
 | ||||||
| 		// our buffer. Oh, and those items are DWORD aligned.
 | 		// our buffer. Oh, and those items are DWORD aligned.
 | ||||||
| 		if ((nWindowsVersion > WINDOWS_XP) && IsFontAvailable("Segoe UI")) { |  | ||||||
| 		// 'Segoe UI Symbol' -> 'Segoe UI'
 | 		// 'Segoe UI Symbol' -> 'Segoe UI'
 | ||||||
| 		wBuf[8] = 0; | 		wBuf[8] = 0; | ||||||
| 		} else { |  | ||||||
| 			wcscpy(wBuf, L"MS Shell Dlg"); |  | ||||||
| 		} |  | ||||||
| 		len = wcslen(wBuf); | 		len = wcslen(wBuf); | ||||||
| 		wBuf[len + 1] = 0; | 		wBuf[len + 1] = 0; | ||||||
| 		dst = (uintptr_t)&wBuf[len + 2]; | 		dst = (uintptr_t)&wBuf[len + 2]; | ||||||
|  |  | ||||||
|  | @ -590,12 +590,12 @@ DWORD WINAPI WimProgressCallback(DWORD dwMsgId, WPARAM wParam, LPARAM lParam, PV | ||||||
| 			wim_nb_files++; | 			wim_nb_files++; | ||||||
| 		} else { | 		} else { | ||||||
| 			wim_proc_files++; | 			wim_proc_files++; | ||||||
| 			if (_GetTickCount64() > LastRefresh + 100) { | 			if (GetTickCount64() > LastRefresh + 100) { | ||||||
| 				// At the end of an actual apply, the WIM API re-lists a bunch of directories it
 | 				// At the end of an actual apply, the WIM API re-lists a bunch of directories it
 | ||||||
| 				// already processed, so we end up with more entries than counted - ignore those.
 | 				// already processed, so we end up with more entries than counted - ignore those.
 | ||||||
| 				if (wim_proc_files > wim_nb_files) | 				if (wim_proc_files > wim_nb_files) | ||||||
| 					wim_proc_files = wim_nb_files; | 					wim_proc_files = wim_nb_files; | ||||||
| 				LastRefresh = _GetTickCount64(); | 				LastRefresh = GetTickCount64(); | ||||||
| 				// x^3 progress, so as not to give a better idea right from the onset
 | 				// x^3 progress, so as not to give a better idea right from the onset
 | ||||||
| 				// as to the dismal speed with which the WIM API can actually apply files...
 | 				// as to the dismal speed with which the WIM API can actually apply files...
 | ||||||
| 				apply_percent = 4.636942595f * ((float)wim_proc_files) / ((float)wim_nb_files); | 				apply_percent = 4.636942595f * ((float)wim_proc_files) / ((float)wim_nb_files); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue