mirror of
				https://github.com/pbatard/rufus.git
				synced 2024-08-14 23:57:05 +00:00 
			
		
		
		
	[enum] added FS type retrieval
This commit is contained in:
		
							parent
							
								
									cccc469ca9
								
							
						
					
					
						commit
						9cdce54ad9
					
				
					 1 changed files with 17 additions and 7 deletions
				
			
		
							
								
								
									
										24
									
								
								usbdos.c
									
										
									
									
									
								
							
							
						
						
									
										24
									
								
								usbdos.c
									
										
									
									
									
								
							|  | @ -44,7 +44,7 @@ | ||||||
|  * Globals |  * Globals | ||||||
|  */ |  */ | ||||||
| static HINSTANCE hMainInstance; | static HINSTANCE hMainInstance; | ||||||
| static HWND hDialog, hDeviceList, hCapacity; | static HWND hDialog, hDeviceList, hCapacity, hFileSystem; | ||||||
| 
 | 
 | ||||||
| #ifdef USBDOS_DEBUG | #ifdef USBDOS_DEBUG | ||||||
| static void _uprintf(const char *format, ...) | static void _uprintf(const char *format, ...) | ||||||
|  | @ -161,7 +161,7 @@ static BOOL GetDriveLabel(DWORD num, char* letter, char** label) | ||||||
| { | { | ||||||
| 	HANDLE hDrive; | 	HANDLE hDrive; | ||||||
| 	char DrivePath[] = "#:\\"; | 	char DrivePath[] = "#:\\"; | ||||||
| 	char volume_label[MAX_PATH]; | 	char volume_label[MAX_PATH+1]; | ||||||
| 
 | 
 | ||||||
| 	*label = "NO_LABEL"; | 	*label = "NO_LABEL"; | ||||||
| 
 | 
 | ||||||
|  | @ -170,7 +170,7 @@ static BOOL GetDriveLabel(DWORD num, char* letter, char** label) | ||||||
| 	safe_closehandle(hDrive); | 	safe_closehandle(hDrive); | ||||||
| 
 | 
 | ||||||
| 	if (!GetVolumeInformationA(DrivePath, volume_label, sizeof(volume_label), NULL, NULL, NULL, NULL, 0)) { | 	if (!GetVolumeInformationA(DrivePath, volume_label, sizeof(volume_label), NULL, NULL, NULL, NULL, 0)) { | ||||||
| 		uprintf("GetVolumeInformation failed: %s\n", WindowsErrorString(0)); | 		uprintf("GetVolumeInformation (Label) failed: %s\n", WindowsErrorString(0)); | ||||||
| 		return FALSE; | 		return FALSE; | ||||||
| 	} | 	} | ||||||
| 	*label = volume_label; | 	*label = volume_label; | ||||||
|  | @ -182,16 +182,17 @@ static BOOL GetDriveLabel(DWORD num, char* letter, char** label) | ||||||
| /*
 | /*
 | ||||||
|  * Returns the drive letter and volume label |  * Returns the drive letter and volume label | ||||||
|  */ |  */ | ||||||
| static BOOL GetDriveInfo(DWORD num, LONGLONG* DriveSize) | static BOOL GetDriveInfo(DWORD num, LONGLONG* DriveSize, char* FSType, DWORD FSTypeSize) | ||||||
| { | { | ||||||
| 	BOOL r; | 	BOOL r; | ||||||
| 	HANDLE hDrive; | 	HANDLE hDrive; | ||||||
| 	DWORD size; | 	DWORD size; | ||||||
| 	BYTE geometry[128]; | 	BYTE geometry[128]; | ||||||
|  | 	char DrivePath[] = "#:\\"; | ||||||
| 
 | 
 | ||||||
| 	*DriveSize = 0; | 	*DriveSize = 0; | ||||||
| 
 | 
 | ||||||
| 	if (!GetDriveHandle(num, &hDrive, NULL)) | 	if (!GetDriveHandle(num, &hDrive, DrivePath)) | ||||||
| 		return FALSE; | 		return FALSE; | ||||||
| 
 | 
 | ||||||
| 	r = DeviceIoControl(hDrive, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX,  | 	r = DeviceIoControl(hDrive, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX,  | ||||||
|  | @ -205,6 +206,11 @@ static BOOL GetDriveInfo(DWORD num, LONGLONG* DriveSize) | ||||||
| 
 | 
 | ||||||
| 	safe_closehandle(hDrive); | 	safe_closehandle(hDrive); | ||||||
| 
 | 
 | ||||||
|  | 	if (!GetVolumeInformationA(DrivePath, NULL, 0, NULL, NULL, NULL, FSType, FSTypeSize)) { | ||||||
|  | 		uprintf("GetVolumeInformation (Properties) failed: %s\n", WindowsErrorString(0)); | ||||||
|  | 		return FALSE; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	return TRUE; | 	return TRUE; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -213,17 +219,18 @@ static BOOL PopulateProperties(int index) | ||||||
| 	double HumanReadableSize; | 	double HumanReadableSize; | ||||||
| 	LONGLONG DiskSize; | 	LONGLONG DiskSize; | ||||||
| 	DWORD DeviceNumber; | 	DWORD DeviceNumber; | ||||||
| 	char capacity[64]; | 	char capacity[64], FSType[32]; | ||||||
| 	char* suffix[] = { "KB", "MB", "GB", "TB", "PB"}; | 	char* suffix[] = { "KB", "MB", "GB", "TB", "PB"}; | ||||||
| 	int i; | 	int i; | ||||||
| 
 | 
 | ||||||
| 	IGNORE_RETVAL(ComboBox_ResetContent(hCapacity)); | 	IGNORE_RETVAL(ComboBox_ResetContent(hCapacity)); | ||||||
|  | 	IGNORE_RETVAL(ComboBox_ResetContent(hFileSystem)); | ||||||
| 	if (index < 0) { | 	if (index < 0) { | ||||||
| 		return TRUE; | 		return TRUE; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	DeviceNumber = (DWORD)ComboBox_GetItemData(hDeviceList, index); | 	DeviceNumber = (DWORD)ComboBox_GetItemData(hDeviceList, index); | ||||||
| 	if (!GetDriveInfo(DeviceNumber, &DiskSize)) | 	if (!GetDriveInfo(DeviceNumber, &DiskSize, FSType, sizeof(FSType))) | ||||||
| 		return FALSE; | 		return FALSE; | ||||||
| 
 | 
 | ||||||
| 	HumanReadableSize = (double)DiskSize; | 	HumanReadableSize = (double)DiskSize; | ||||||
|  | @ -236,6 +243,8 @@ static BOOL PopulateProperties(int index) | ||||||
| 	} | 	} | ||||||
| 	IGNORE_RETVAL(ComboBox_AddStringU(hCapacity, capacity)); | 	IGNORE_RETVAL(ComboBox_AddStringU(hCapacity, capacity)); | ||||||
| 	IGNORE_RETVAL(ComboBox_SetCurSel(hCapacity, 0)); | 	IGNORE_RETVAL(ComboBox_SetCurSel(hCapacity, 0)); | ||||||
|  | 	IGNORE_RETVAL(ComboBox_AddStringU(hFileSystem, FSType)); | ||||||
|  | 	IGNORE_RETVAL(ComboBox_SetCurSel(hFileSystem, 0)); | ||||||
| 	return TRUE; | 	return TRUE; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -357,6 +366,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 		hDialog = hDlg; | 		hDialog = hDlg; | ||||||
| 		hDeviceList = GetDlgItem(hDlg, IDC_DEVICE); | 		hDeviceList = GetDlgItem(hDlg, IDC_DEVICE); | ||||||
| 		hCapacity = GetDlgItem(hDlg, IDC_CAPACITY); | 		hCapacity = GetDlgItem(hDlg, IDC_CAPACITY); | ||||||
|  | 		hFileSystem = GetDlgItem(hDlg, IDC_FILESYSTEM); | ||||||
| 		GetUSBDevices(); | 		GetUSBDevices(); | ||||||
| 		return (INT_PTR)TRUE; | 		return (INT_PTR)TRUE; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue