mirror of
				https://github.com/pbatard/rufus.git
				synced 2024-08-14 23:57:05 +00:00 
			
		
		
		
	[misc] display image and disk size in the log
* Also fix 2 Coverity warnings * Also remove unneeded LFs in drive.c
This commit is contained in:
		
							parent
							
								
									4a213c3ba0
								
							
						
					
					
						commit
						c22b378f9a
					
				
					 5 changed files with 70 additions and 65 deletions
				
			
		|  | @ -5,8 +5,8 @@ o Version 2.17 (2017.09.??) | |||
|     Strengthen download update checks, to prevent attack scenarios that leverage user unawareness | ||||
|     Fix an issue with Spanish translation prompts not displaying properly | ||||
|     Fix an issue with Windows To Go support on some non-official Windows ISOs | ||||
|     Fix an issue with using A: or B: as flash drive letters | ||||
|     Fix an issue with log autoscrolling | ||||
|     Fix an issue when using A: or B: as drive letters | ||||
|   | ||||
| o Version 2.16 (2017.07.31) | ||||
|     Add an audiovisual cue on completion/error | ||||
|  |  | |||
							
								
								
									
										108
									
								
								src/drive.c
									
										
									
									
									
								
							
							
						
						
									
										108
									
								
								src/drive.c
									
										
									
									
									
								
							|  | @ -158,7 +158,7 @@ static HANDLE GetHandle(char* Path, BOOL bLockDrive, BOOL bWriteAccess, BOOL bWr | |||
| 		Sleep(DRIVE_ACCESS_TIMEOUT / DRIVE_ACCESS_RETRIES); | ||||
| 	} | ||||
| 	if (hDrive == INVALID_HANDLE_VALUE) { | ||||
| 		uprintf("Could not open %s: %s\n", Path, WindowsErrorString()); | ||||
| 		uprintf("Could not open %s: %s", Path, WindowsErrorString()); | ||||
| 		goto out; | ||||
| 	} | ||||
| 
 | ||||
|  | @ -168,7 +168,7 @@ static HANDLE GetHandle(char* Path, BOOL bLockDrive, BOOL bWriteAccess, BOOL bWr | |||
| 
 | ||||
| 	if (bLockDrive) { | ||||
| 		if (DeviceIoControl(hDrive, FSCTL_ALLOW_EXTENDED_DASD_IO, NULL, 0, NULL, 0, &size, NULL)) { | ||||
| 			uprintf("I/O boundary checks disabled\n"); | ||||
| 			uprintf("I/O boundary checks disabled"); | ||||
| 		} | ||||
| 
 | ||||
| 		uprintf("Requesting lock..."); | ||||
|  | @ -247,13 +247,13 @@ char* GetLogicalName(DWORD DriveIndex, BOOL bKeepTrailingBackslash, BOOL bSilent | |||
| 		if (i == 0) { | ||||
| 			hVolume = FindFirstVolumeA(volume_name, sizeof(volume_name)); | ||||
| 			if (hVolume == INVALID_HANDLE_VALUE) { | ||||
| 				suprintf("Could not access first GUID volume: %s\n", WindowsErrorString()); | ||||
| 				suprintf("Could not access first GUID volume: %s", WindowsErrorString()); | ||||
| 				goto out; | ||||
| 			} | ||||
| 		} else { | ||||
| 			if (!FindNextVolumeA(hVolume, volume_name, sizeof(volume_name))) { | ||||
| 				if (GetLastError() != ERROR_NO_MORE_FILES) { | ||||
| 					suprintf("Could not access next GUID volume: %s\n", WindowsErrorString()); | ||||
| 					suprintf("Could not access next GUID volume: %s", WindowsErrorString()); | ||||
| 				} | ||||
| 				goto out; | ||||
| 			} | ||||
|  | @ -262,7 +262,7 @@ char* GetLogicalName(DWORD DriveIndex, BOOL bKeepTrailingBackslash, BOOL bSilent | |||
| 		// Sanity checks
 | ||||
| 		len = safe_strlen(volume_name); | ||||
| 		if ((len <= 1) || (safe_strnicmp(volume_name, volume_start, 4) != 0) || (volume_name[len-1] != '\\')) { | ||||
| 			suprintf("'%s' is not a GUID volume name\n", volume_name); | ||||
| 			suprintf("'%s' is not a GUID volume name", volume_name); | ||||
| 			continue; | ||||
| 		} | ||||
| 
 | ||||
|  | @ -273,27 +273,27 @@ char* GetLogicalName(DWORD DriveIndex, BOOL bKeepTrailingBackslash, BOOL bSilent | |||
| 		volume_name[len-1] = 0; | ||||
| 
 | ||||
| 		if (QueryDosDeviceA(&volume_name[4], path, sizeof(path)) == 0) { | ||||
| 			suprintf("Failed to get device path for GUID volume '%s': %s\n", volume_name, WindowsErrorString()); | ||||
| 			suprintf("Failed to get device path for GUID volume '%s': %s", volume_name, WindowsErrorString()); | ||||
| 			continue; | ||||
| 		} | ||||
| 
 | ||||
| 		for (j=0; (j<ARRAYSIZE(ignore_device)) && | ||||
| 			(_strnicmp(path, ignore_device[j], safe_strlen(ignore_device[j])) != 0); j++); | ||||
| 		if (j < ARRAYSIZE(ignore_device)) { | ||||
| 			suprintf("Skipping GUID volume for '%s'\n", path); | ||||
| 			suprintf("Skipping GUID volume for '%s'", path); | ||||
| 			continue; | ||||
| 		} | ||||
| 
 | ||||
| 		hDrive = CreateFileA(volume_name, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, | ||||
| 			NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); | ||||
| 		if (hDrive == INVALID_HANDLE_VALUE) { | ||||
| 			suprintf("Could not open GUID volume '%s': %s\n", volume_name, WindowsErrorString()); | ||||
| 			suprintf("Could not open GUID volume '%s': %s", volume_name, WindowsErrorString()); | ||||
| 			continue; | ||||
| 		} | ||||
| 
 | ||||
| 		if ((!DeviceIoControl(hDrive, IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS, NULL, 0, | ||||
| 			&DiskExtents, sizeof(DiskExtents), &size, NULL)) || (size <= 0)) { | ||||
| 			suprintf("Could not get Disk Extents: %s\n", WindowsErrorString()); | ||||
| 			suprintf("Could not get Disk Extents: %s", WindowsErrorString()); | ||||
| 			safe_closehandle(hDrive); | ||||
| 			continue; | ||||
| 		} | ||||
|  | @ -331,7 +331,7 @@ BOOL WaitForLogical(DWORD DriveIndex) | |||
| 			return FALSE; | ||||
| 		Sleep(DRIVE_ACCESS_TIMEOUT/DRIVE_ACCESS_RETRIES); | ||||
| 	} while (GetTickCount() < EndTime); | ||||
| 	uprintf("Timeout while waiting for logical drive\n"); | ||||
| 	uprintf("Timeout while waiting for logical drive"); | ||||
| 	return FALSE; | ||||
| } | ||||
| 
 | ||||
|  | @ -346,7 +346,7 @@ HANDLE GetLogicalHandle(DWORD DriveIndex, BOOL bLockDrive, BOOL bWriteAccess, BO | |||
| 	char* LogicalPath = GetLogicalName(DriveIndex, FALSE, FALSE); | ||||
| 
 | ||||
| 	if (LogicalPath == NULL) { | ||||
| 		uprintf("No logical drive found (unpartitioned?)\n"); | ||||
| 		uprintf("No logical drive found (unpartitioned?)"); | ||||
| 		return NULL; | ||||
| 	} | ||||
| 
 | ||||
|  | @ -418,11 +418,11 @@ static BOOL _GetDriveLettersAndType(DWORD DriveIndex, char* drive_letters, UINT* | |||
| 	// always, as each drive string is at least 4 chars long anyway.
 | ||||
| 	size = GetLogicalDriveStringsA(sizeof(drives), drives); | ||||
| 	if (size == 0) { | ||||
| 		uprintf("GetLogicalDriveStrings failed: %s\n", WindowsErrorString()); | ||||
| 		uprintf("GetLogicalDriveStrings failed: %s", WindowsErrorString()); | ||||
| 		goto out; | ||||
| 	} | ||||
| 	if (size > sizeof(drives)) { | ||||
| 		uprintf("GetLogicalDriveStrings: Buffer too small (required %d vs. %d)\n", size, sizeof(drives)); | ||||
| 		uprintf("GetLogicalDriveStrings: Buffer too small (required %d vs. %d)", size, sizeof(drives)); | ||||
| 		goto out; | ||||
| 	} | ||||
| 
 | ||||
|  | @ -445,7 +445,7 @@ static BOOL _GetDriveLettersAndType(DWORD DriveIndex, char* drive_letters, UINT* | |||
| 		hDrive = CreateFileA(logical_drive, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, | ||||
| 			NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); | ||||
| 		if (hDrive == INVALID_HANDLE_VALUE) { | ||||
| //			uprintf("Warning: could not open drive %c: %s\n", drive[0], WindowsErrorString());
 | ||||
| //			uprintf("Warning: could not open drive %c: %s", drive[0], WindowsErrorString());
 | ||||
| 			continue; | ||||
| 		} | ||||
| 
 | ||||
|  | @ -491,11 +491,11 @@ char GetUnusedDriveLetter(void) | |||
| 
 | ||||
| 	size = GetLogicalDriveStringsA(sizeof(drives), drives); | ||||
| 	if (size == 0) { | ||||
| 		uprintf("GetLogicalDriveStrings failed: %s\n", WindowsErrorString()); | ||||
| 		uprintf("GetLogicalDriveStrings failed: %s", WindowsErrorString()); | ||||
| 		goto out; | ||||
| 	} | ||||
| 	if (size > sizeof(drives)) { | ||||
| 		uprintf("GetLogicalDriveStrings: Buffer too small (required %d vs. %d)\n", size, sizeof(drives)); | ||||
| 		uprintf("GetLogicalDriveStrings: Buffer too small (required %d vs. %d)", size, sizeof(drives)); | ||||
| 		goto out; | ||||
| 	} | ||||
| 
 | ||||
|  | @ -544,11 +544,11 @@ BOOL GetDriveLabel(DWORD DriveIndex, char* letters, char** label) | |||
| 	if (DeviceIoControl(hPhysical, IOCTL_STORAGE_CHECK_VERIFY, NULL, 0, NULL, 0, &size, NULL)) | ||||
| 		AutorunLabel = get_token_data_file("label", AutorunPath); | ||||
| 	else if (GetLastError() == ERROR_NOT_READY) | ||||
| 		uprintf("Ignoring autorun.inf label for drive %c: %s\n", letters[0], | ||||
| 		uprintf("Ignoring autorun.inf label for drive %c: %s", letters[0], | ||||
| 		(HRESULT_CODE(GetLastError()) == ERROR_NOT_READY)?"No media":WindowsErrorString()); | ||||
| 	safe_closehandle(hPhysical); | ||||
| 	if (AutorunLabel != NULL) { | ||||
| 		uprintf("Using autorun.inf label for drive %c: '%s'\n", letters[0], AutorunLabel); | ||||
| 		uprintf("Using autorun.inf label for drive %c: '%s'", letters[0], AutorunLabel); | ||||
| 		static_strcpy(VolumeLabel, AutorunLabel); | ||||
| 		safe_free(AutorunLabel); | ||||
| 		*label = VolumeLabel; | ||||
|  | @ -630,17 +630,17 @@ BOOL AnalyzeMBR(HANDLE hPhysicalDrive, const char* TargetName) | |||
| 	set_bytes_per_sector(SelectedDrive.SectorSize); | ||||
| 
 | ||||
| 	if (!is_br(fp)) { | ||||
| 		uprintf("%s does not have an x86 %s\n", TargetName, mbr_name); | ||||
| 		uprintf("%s does not have an x86 %s", TargetName, mbr_name); | ||||
| 		return FALSE; | ||||
| 	} | ||||
| 	for (i=0; i<ARRAYSIZE(known_mbr); i++) { | ||||
| 		if (known_mbr[i].fn(fp)) { | ||||
| 			uprintf("%s has a %s %s\n", TargetName, known_mbr[i].str, mbr_name); | ||||
| 			uprintf("%s has a %s %s", TargetName, known_mbr[i].str, mbr_name); | ||||
| 			return TRUE; | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	uprintf("%s has an unknown %s\n", TargetName, mbr_name); | ||||
| 	uprintf("%s has an unknown %s", TargetName, mbr_name); | ||||
| 	return TRUE; | ||||
| } | ||||
| 
 | ||||
|  | @ -666,20 +666,20 @@ BOOL AnalyzePBR(HANDLE hLogicalVolume) | |||
| 	set_bytes_per_sector(SelectedDrive.SectorSize); | ||||
| 
 | ||||
| 	if (!is_br(fp)) { | ||||
| 		uprintf("Volume does not have an x86 %s\n", pbr_name); | ||||
| 		uprintf("Volume does not have an x86 %s", pbr_name); | ||||
| 		return FALSE; | ||||
| 	} | ||||
| 
 | ||||
| 	if (is_fat_16_br(fp) || is_fat_32_br(fp)) { | ||||
| 		for (i=0; i<ARRAYSIZE(known_pbr); i++) { | ||||
| 			if (known_pbr[i].fn(fp)) { | ||||
| 				uprintf("Drive has a %s %s\n", known_pbr[i].str, pbr_name); | ||||
| 				uprintf("Drive has a %s %s", known_pbr[i].str, pbr_name); | ||||
| 				return TRUE; | ||||
| 			} | ||||
| 		} | ||||
| 		uprintf("Volume has an unknown FAT16 or FAT32 %s\n", pbr_name); | ||||
| 		uprintf("Volume has an unknown FAT16 or FAT32 %s", pbr_name); | ||||
| 	} else { | ||||
| 		uprintf("Volume has an unknown %s\n", pbr_name); | ||||
| 		uprintf("Volume has an unknown %s", pbr_name); | ||||
| 	} | ||||
| 	return TRUE; | ||||
| } | ||||
|  | @ -710,7 +710,7 @@ BOOL GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSys | |||
| 	FileSystemName[0] = 0; | ||||
| 	volume_name = GetLogicalName(DriveIndex, TRUE, FALSE); | ||||
| 	if ((volume_name == NULL) || (!GetVolumeInformationA(volume_name, NULL, 0, NULL, NULL, NULL, FileSystemName, FileSystemNameSize))) { | ||||
| 		suprintf("No volume information for drive 0x%02x\n", DriveIndex); | ||||
| 		suprintf("No volume information for drive 0x%02x", DriveIndex); | ||||
| 	} | ||||
| 	safe_free(volume_name); | ||||
| 
 | ||||
|  | @ -721,7 +721,7 @@ BOOL GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSys | |||
| 	r = DeviceIoControl(hPhysical, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX, | ||||
| 			NULL, 0, geometry, sizeof(geometry), &size, NULL); | ||||
| 	if (!r || size <= 0) { | ||||
| 		suprintf("Could not get geometry for drive 0x%02x: %s\n", DriveIndex, WindowsErrorString()); | ||||
| 		suprintf("Could not get geometry for drive 0x%02x: %s", DriveIndex, WindowsErrorString()); | ||||
| 		safe_closehandle(hPhysical); | ||||
| 		return 0; | ||||
| 	} | ||||
|  | @ -729,22 +729,22 @@ BOOL GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSys | |||
| 	SelectedDrive.SectorSize = DiskGeometry->Geometry.BytesPerSector; | ||||
| 	SelectedDrive.FirstDataSector = MAXDWORD; | ||||
| 	if (SelectedDrive.SectorSize < 512) { | ||||
| 		suprintf("Warning: Drive 0x%02x reports a sector size of %d - Correcting to 512 bytes.\n", | ||||
| 		suprintf("Warning: Drive 0x%02x reports a sector size of %d - Correcting to 512 bytes.", | ||||
| 			DriveIndex, SelectedDrive.SectorSize); | ||||
| 		SelectedDrive.SectorSize = 512; | ||||
| 	} | ||||
| 	SelectedDrive.SectorsPerTrack = DiskGeometry->Geometry.SectorsPerTrack; | ||||
| 	SelectedDrive.MediaType = DiskGeometry->Geometry.MediaType; | ||||
| 
 | ||||
| 	suprintf("Disk type: %s, Sector Size: %d bytes\n", (SelectedDrive.MediaType == FixedMedia)?"FIXED":"Removable", | ||||
| 		SelectedDrive.SectorSize); | ||||
| 	suprintf("Cylinders: %" PRIi64 ", TracksPerCylinder: %d, SectorsPerTrack: %d\n", | ||||
| 	suprintf("Disk type: %s, Disk size: %s, Sector size: %d bytes", (SelectedDrive.MediaType == FixedMedia)?"FIXED":"Removable", | ||||
| 		SizeToHumanReadable(SelectedDrive.DiskSize, FALSE, TRUE), SelectedDrive.SectorSize); | ||||
| 	suprintf("Cylinders: %" PRIi64 ", Tracks per cylinder: %d, Sectors per track: %d", | ||||
| 		DiskGeometry->Geometry.Cylinders, DiskGeometry->Geometry.TracksPerCylinder, DiskGeometry->Geometry.SectorsPerTrack); | ||||
| 
 | ||||
| 	r = DeviceIoControl(hPhysical, IOCTL_DISK_GET_DRIVE_LAYOUT_EX, | ||||
| 			NULL, 0, layout, sizeof(layout), &size, NULL ); | ||||
| 	if (!r || size <= 0) { | ||||
| 		suprintf("Could not get layout for drive 0x%02x: %s\n", DriveIndex, WindowsErrorString()); | ||||
| 		suprintf("Could not get layout for drive 0x%02x: %s", DriveIndex, WindowsErrorString()); | ||||
| 		safe_closehandle(hPhysical); | ||||
| 		return 0; | ||||
| 	} | ||||
|  | @ -767,9 +767,9 @@ BOOL GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSys | |||
| 			suprintf("Partition type: SFD (Super Floppy Disk) or Unpartitioned"); | ||||
| 			super_floppy_disk = TRUE; | ||||
| 		} else { | ||||
| 			suprintf("Partition type: MBR, NB Partitions: %d\n", SelectedDrive.nPartitions); | ||||
| 			suprintf("Partition type: MBR, NB Partitions: %d", SelectedDrive.nPartitions); | ||||
| 			SelectedDrive.has_mbr_uefi_marker = (DriveLayout->Mbr.Signature == MBR_UEFI_MARKER); | ||||
| 			suprintf("Disk ID: 0x%08X %s\n", DriveLayout->Mbr.Signature, SelectedDrive.has_mbr_uefi_marker ? "(UEFI target)" : ""); | ||||
| 			suprintf("Disk ID: 0x%08X %s", DriveLayout->Mbr.Signature, SelectedDrive.has_mbr_uefi_marker ? "(UEFI target)" : ""); | ||||
| 			AnalyzeMBR(hPhysical, "Drive"); | ||||
| 		} | ||||
| 		for (i=0; i<DriveLayout->PartitionCount; i++) { | ||||
|  | @ -777,7 +777,7 @@ BOOL GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSys | |||
| 				part_type = DriveLayout->PartitionEntry[i].Mbr.PartitionType; | ||||
| 				isUefiNtfs = (i == 1) && (part_type == 0xef) && | ||||
| 					(DriveLayout->PartitionEntry[i].PartitionLength.QuadPart <= 1*MB); | ||||
| 				suprintf("Partition %d%s:\n", i+(super_floppy_disk?0:1), isUefiNtfs?" (UEFI:NTFS)":""); | ||||
| 				suprintf("Partition %d%s:", i+(super_floppy_disk?0:1), isUefiNtfs?" (UEFI:NTFS)":""); | ||||
| 				for (j=0; j<ARRAYSIZE(mbr_mountable); j++) { | ||||
| 					if (part_type == mbr_mountable[j]) { | ||||
| 						ret = TRUE; | ||||
|  | @ -803,17 +803,17 @@ BOOL GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSys | |||
| 		break; | ||||
| 	case PARTITION_STYLE_GPT: | ||||
| 		SelectedDrive.PartitionType = PARTITION_STYLE_GPT; | ||||
| 		suprintf("Partition type: GPT, NB Partitions: %d\n", DriveLayout->PartitionCount); | ||||
| 		suprintf("Disk GUID: %s\n", GuidToString(&DriveLayout->Gpt.DiskId)); | ||||
| 		suprintf("Max parts: %d, Start Offset: %" PRIi64 ", Usable = %" PRIi64 " bytes\n", | ||||
| 		suprintf("Partition type: GPT, NB Partitions: %d", DriveLayout->PartitionCount); | ||||
| 		suprintf("Disk GUID: %s", GuidToString(&DriveLayout->Gpt.DiskId)); | ||||
| 		suprintf("Max parts: %d, Start Offset: %" PRIi64 ", Usable = %" PRIi64 " bytes", | ||||
| 			DriveLayout->Gpt.MaxPartitionCount, DriveLayout->Gpt.StartingUsableOffset.QuadPart, DriveLayout->Gpt.UsableLength.QuadPart); | ||||
| 		for (i=0; i<DriveLayout->PartitionCount; i++) { | ||||
| 			SelectedDrive.nPartitions++; | ||||
| 			tmp[0] = 0; | ||||
| 			wchar_to_utf8_no_alloc(DriveLayout->PartitionEntry[i].Gpt.Name, tmp, sizeof(tmp)); | ||||
| 			suprintf("Partition %d:\r\n  Type: %s\r\n  Name: '%s'\n", i+1, | ||||
| 			suprintf("Partition %d:\r\n  Type: %s\r\n  Name: '%s'", i+1, | ||||
| 				GuidToString(&DriveLayout->PartitionEntry[i].Gpt.PartitionType), tmp); | ||||
| 			suprintf("  ID: %s\r\n  Size: %s (%" PRIi64 " bytes)\r\n  Start Sector: %" PRIi64 ", Attributes: 0x%016" PRIX64 "\n", | ||||
| 			suprintf("  ID: %s\r\n  Size: %s (%" PRIi64 " bytes)\r\n  Start Sector: %" PRIi64 ", Attributes: 0x%016" PRIX64, | ||||
| 				GuidToString(&DriveLayout->PartitionEntry[i].Gpt.PartitionId), | ||||
| 				SizeToHumanReadable(DriveLayout->PartitionEntry[i].PartitionLength.QuadPart, TRUE, FALSE), | ||||
| 				DriveLayout->PartitionEntry[i].PartitionLength, | ||||
|  | @ -833,7 +833,7 @@ BOOL GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSys | |||
| 		break; | ||||
| 	default: | ||||
| 		SelectedDrive.PartitionType = PARTITION_STYLE_MBR; | ||||
| 		suprintf("Partition type: RAW\n"); | ||||
| 		suprintf("Partition type: RAW"); | ||||
| 		break; | ||||
| 	} | ||||
| #if defined(__GNUC__) | ||||
|  | @ -857,12 +857,12 @@ static BOOL FlushDrive(char drive_letter) | |||
| 	hDrive = CreateFileA(logical_drive, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, | ||||
| 		NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); | ||||
| 	if (hDrive == INVALID_HANDLE_VALUE) { | ||||
| 		uprintf("Failed to open %c: for flushing: %s\n", drive_letter, WindowsErrorString()); | ||||
| 		uprintf("Failed to open %c: for flushing: %s", drive_letter, WindowsErrorString()); | ||||
| 		goto out; | ||||
| 	} | ||||
| 	r = FlushFileBuffers(hDrive); | ||||
| 	if (r == FALSE) | ||||
| 		uprintf("Failed to flush %c: %s\n", drive_letter, WindowsErrorString()); | ||||
| 		uprintf("Failed to flush %c: %s", drive_letter, WindowsErrorString()); | ||||
| 
 | ||||
| out: | ||||
| 	safe_closehandle(hDrive); | ||||
|  | @ -877,7 +877,7 @@ BOOL UnmountVolume(HANDLE hDrive) | |||
| 	DWORD size; | ||||
| 
 | ||||
| 	if (!DeviceIoControl(hDrive, FSCTL_DISMOUNT_VOLUME, NULL, 0, NULL, 0, &size, NULL)) { | ||||
| 		uprintf("Could not unmount drive: %s\n", WindowsErrorString()); | ||||
| 		uprintf("Could not unmount drive: %s", WindowsErrorString()); | ||||
| 		return FALSE; | ||||
| 	} | ||||
| 	return TRUE; | ||||
|  | @ -899,7 +899,7 @@ BOOL MountVolume(char* drive_name, char *drive_guid) | |||
| 	// than the one we want. If that's the case, we need to unmount first.
 | ||||
| 	if ( (GetVolumePathNamesForVolumeNameA(drive_guid, mounted_letter, sizeof(mounted_letter), &size)) | ||||
| 	  && (size > 1) && (mounted_letter[0] != drive_name[0]) ) { | ||||
| 		uprintf("Volume is already mounted, but as %c: instead of %c: - Unmounting...\n", mounted_letter[0], drive_name[0]); | ||||
| 		uprintf("Volume is already mounted, but as %c: instead of %c: - Unmounting...", mounted_letter[0], drive_name[0]); | ||||
| 		if (!DeleteVolumeMountPointA(mounted_letter)) | ||||
| 			uprintf("Failed to unmount volume: %s", WindowsErrorString()); | ||||
| 		// Also delete the destination mountpoint if needed (Don't care about errors)
 | ||||
|  | @ -912,16 +912,16 @@ BOOL MountVolume(char* drive_name, char *drive_guid) | |||
| 		// with ERROR_DIR_NOT_EMPTY. If that's the case, just check that mountpoints match
 | ||||
| 		if (GetLastError() == ERROR_DIR_NOT_EMPTY) { | ||||
| 			if (!GetVolumeNameForVolumeMountPointA(drive_name, mounted_guid, sizeof(mounted_guid))) { | ||||
| 				uprintf("%s already mounted, but volume GUID could not be checked: %s\n", | ||||
| 				uprintf("%s already mounted, but volume GUID could not be checked: %s", | ||||
| 					drive_name, WindowsErrorString()); | ||||
| 				return FALSE; | ||||
| 			} | ||||
| 			if (safe_strcmp(drive_guid, mounted_guid) != 0) { | ||||
| 				uprintf("%s already mounted, but volume GUID doesn't match:\r\n  expected %s, got %s\n", | ||||
| 				uprintf("%s already mounted, but volume GUID doesn't match:\r\n  expected %s, got %s", | ||||
| 					drive_name, drive_guid, mounted_guid); | ||||
| 				return FALSE; | ||||
| 			} | ||||
| 			uprintf("%s was already mounted as %s\n", drive_guid, drive_name); | ||||
| 			uprintf("%s was already mounted as %s", drive_guid, drive_name); | ||||
| 		} else { | ||||
| 			return FALSE; | ||||
| 		} | ||||
|  | @ -1179,7 +1179,7 @@ BOOL CreatePartition(HANDLE hDrive, int partition_style, int file_system, BOOL m | |||
| 			DriveLayoutEx.PartitionEntry[pn].Mbr.PartitionType = 0x0c;	// FAT32 LBA
 | ||||
| 			break; | ||||
| 		default: | ||||
| 			uprintf("Unsupported file system\n"); | ||||
| 			uprintf("Unsupported file system"); | ||||
| 			return FALSE; | ||||
| 		} | ||||
| 	} else { | ||||
|  | @ -1274,14 +1274,14 @@ BOOL CreatePartition(HANDLE hDrive, int partition_style, int file_system, BOOL m | |||
| 	size = sizeof(CreateDisk); | ||||
| 	r = DeviceIoControl(hDrive, IOCTL_DISK_CREATE_DISK, (BYTE*)&CreateDisk, size, NULL, 0, &size, NULL ); | ||||
| 	if (!r) { | ||||
| 		uprintf("Could not reset disk: %s\n", WindowsErrorString()); | ||||
| 		uprintf("Could not reset disk: %s", WindowsErrorString()); | ||||
| 		return FALSE; | ||||
| 	} | ||||
| 
 | ||||
| 	size = sizeof(DriveLayoutEx) - ((partition_style == PARTITION_STYLE_GPT)?((4-pn)*sizeof(PARTITION_INFORMATION_EX)):0); | ||||
| 	r = DeviceIoControl(hDrive, IOCTL_DISK_SET_DRIVE_LAYOUT_EX, (BYTE*)&DriveLayoutEx, size, NULL, 0, &size, NULL ); | ||||
| 	if (!r) { | ||||
| 		uprintf("Could not set drive layout: %s\n", WindowsErrorString()); | ||||
| 		uprintf("Could not set drive layout: %s", WindowsErrorString()); | ||||
| 		return FALSE; | ||||
| 	} | ||||
| 
 | ||||
|  | @ -1299,7 +1299,7 @@ BOOL RefreshDriveLayout(HANDLE hDrive) | |||
| 	// Diskpart does call the following IOCTL this after updating the partition table, so we do too
 | ||||
| 	r = DeviceIoControl(hDrive, IOCTL_DISK_UPDATE_PROPERTIES, NULL, 0, NULL, 0, &size, NULL ); | ||||
| 	if (!r) | ||||
| 		uprintf("Could not refresh drive layout: %s\n", WindowsErrorString()); | ||||
| 		uprintf("Could not refresh drive layout: %s", WindowsErrorString()); | ||||
| 	return r; | ||||
| } | ||||
| 
 | ||||
|  | @ -1316,14 +1316,14 @@ BOOL InitializeDisk(HANDLE hDrive) | |||
| 	r = DeviceIoControl(hDrive, IOCTL_DISK_CREATE_DISK, | ||||
| 			(BYTE*)&CreateDisk, size, NULL, 0, &size, NULL ); | ||||
| 	if (!r) { | ||||
| 		uprintf("Could not delete drive layout: %s\n", WindowsErrorString()); | ||||
| 		uprintf("Could not delete drive layout: %s", WindowsErrorString()); | ||||
| 		safe_closehandle(hDrive); | ||||
| 		return FALSE; | ||||
| 	} | ||||
| 
 | ||||
| 	r = DeviceIoControl(hDrive, IOCTL_DISK_UPDATE_PROPERTIES, NULL, 0, NULL, 0, &size, NULL ); | ||||
| 	if (!r) { | ||||
| 		uprintf("Could not refresh drive layout: %s\n", WindowsErrorString()); | ||||
| 		uprintf("Could not refresh drive layout: %s", WindowsErrorString()); | ||||
| 		safe_closehandle(hDrive); | ||||
| 		return FALSE; | ||||
| 	} | ||||
|  |  | |||
							
								
								
									
										12
									
								
								src/pki.c
									
										
									
									
									
								
							
							
						
						
									
										12
									
								
								src/pki.c
									
										
									
									
									
								
							|  | @ -157,12 +157,12 @@ char* GetSignatureName(const char* path) | |||
| 		hm = GetModuleHandle(NULL); | ||||
| 		if (hm == NULL) { | ||||
| 			uprintf("PKI: Could not get current executable handle: %s", WinPKIErrorString()); | ||||
| 			return NULL; | ||||
| 			goto out; | ||||
| 		} | ||||
| 		dwSize = GetModuleFileNameW(hm, szFileName, MAX_PATH); | ||||
| 		if ((dwSize == 0) || ((dwSize == MAX_PATH) && (GetLastError() == ERROR_INSUFFICIENT_BUFFER))) { | ||||
| 			uprintf("PKI: Could not get module filename: %s", WinPKIErrorString()); | ||||
| 			return NULL; | ||||
| 			goto out; | ||||
| 		} | ||||
| 		mpath = wchar_to_utf8(szFileName); | ||||
| 	} else { | ||||
|  | @ -308,10 +308,14 @@ static uint64_t GetNestedRFC3161TimeStamp(PCMSG_SIGNER_INFO pSignerInfo) | |||
| 
 | ||||
| 	// Loop through unauthenticated attributes for szOID_NESTED_SIGNATURE OID
 | ||||
| 	for (n = 0; ; n++) { | ||||
| 		if (pNestedSignature != NULL) | ||||
| 		if (pNestedSignature != NULL) { | ||||
| 			LocalFree(pNestedSignature); | ||||
| 		if (hMsg != NULL) | ||||
| 			pNestedSignature = NULL; | ||||
| 		} | ||||
| 		if (hMsg != NULL) { | ||||
| 			CryptMsgClose(hMsg); | ||||
| 			hMsg = NULL; | ||||
| 		} | ||||
| 		safe_free(pNestedSignerInfo); | ||||
| 		if (n >= pSignerInfo->UnauthAttrs.cAttr) | ||||
| 			break; | ||||
|  |  | |||
|  | @ -1089,7 +1089,8 @@ DWORD WINAPI ISOScanThread(LPVOID param) | |||
| 		} | ||||
| 		if (!dont_display_image_name) { | ||||
| 			for (i = (int)safe_strlen(image_path); (i > 0) && (image_path[i] != '\\'); i--); | ||||
| 			PrintStatusDebug(0, MSG_205, &image_path[i + 1]); | ||||
| 			PrintStatus(0, MSG_205, &image_path[i + 1]); | ||||
| 			uprintf("Using image: %s (%s)", &image_path[i + 1], SizeToHumanReadable(img_report.image_size, FALSE, FALSE)); | ||||
| 		} | ||||
| 		// Lose the focus on the select ISO (but place it on Close)
 | ||||
| 		SendMessage(hMainDialog, WM_NEXTDLGCTL, (WPARAM)FALSE, 0); | ||||
|  |  | |||
							
								
								
									
										10
									
								
								src/rufus.rc
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								src/rufus.rc
									
										
									
									
									
								
							|  | @ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL | |||
| IDD_DIALOG DIALOGEX 12, 12, 242, 376 | ||||
| STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | ||||
| EXSTYLE WS_EX_ACCEPTFILES | ||||
| CAPTION "Rufus 2.17.1193" | ||||
| CAPTION "Rufus 2.17.1194" | ||||
| FONT 8, "Segoe UI Symbol", 400, 0, 0x0 | ||||
| BEGIN | ||||
|     LTEXT           "Device",IDS_DEVICE_TXT,9,6,200,8 | ||||
|  | @ -366,8 +366,8 @@ END | |||
| // | ||||
| 
 | ||||
| VS_VERSION_INFO VERSIONINFO | ||||
|  FILEVERSION 2,17,1193,0 | ||||
|  PRODUCTVERSION 2,17,1193,0 | ||||
|  FILEVERSION 2,17,1194,0 | ||||
|  PRODUCTVERSION 2,17,1194,0 | ||||
|  FILEFLAGSMASK 0x3fL | ||||
| #ifdef _DEBUG | ||||
|  FILEFLAGS 0x1L | ||||
|  | @ -384,13 +384,13 @@ BEGIN | |||
|         BEGIN | ||||
|             VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" | ||||
|             VALUE "FileDescription", "Rufus" | ||||
|             VALUE "FileVersion", "2.17.1193" | ||||
|             VALUE "FileVersion", "2.17.1194" | ||||
|             VALUE "InternalName", "Rufus" | ||||
|             VALUE "LegalCopyright", "© 2011-2017 Pete Batard (GPL v3)" | ||||
|             VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" | ||||
|             VALUE "OriginalFilename", "rufus.exe" | ||||
|             VALUE "ProductName", "Rufus" | ||||
|             VALUE "ProductVersion", "2.17.1193" | ||||
|             VALUE "ProductVersion", "2.17.1194" | ||||
|         END | ||||
|     END | ||||
|     BLOCK "VarFileInfo" | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue