mirror of
https://github.com/pbatard/rufus.git
synced 2025-05-28 21:54:15 -04:00
[core] fix detection of fixed drives
* Thanks to MS' shortsightedness, neither of IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS or IOCTL_STORAGE_GET_DEVICE_NUMBER alone are enough to retrieve a disk number: IOCTL_STORAGE_GET_DEVICE_NUMBER doesn't work for LVM drives and IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS doesn't work for USB fixed drives, so we must use both. Isn't it great? * Closes #292
This commit is contained in:
parent
07d5a61f2a
commit
8c1dd2ca91
4 changed files with 62 additions and 34 deletions
14
src/drive.h
14
src/drive.h
|
@ -24,11 +24,25 @@
|
|||
|
||||
#define RUFUS_EXTRA_PARTITION_TYPE 0xea
|
||||
|
||||
/* We need a redef of these MS structure */
|
||||
typedef struct {
|
||||
DWORD DeviceType;
|
||||
ULONG DeviceNumber;
|
||||
ULONG PartitionNumber;
|
||||
} STORAGE_DEVICE_NUMBER_REDEF;
|
||||
|
||||
typedef struct {
|
||||
DWORD NumberOfDiskExtents;
|
||||
// The one from MS uses ANYSIZE_ARRAY, which can lead to all kind of problems
|
||||
DISK_EXTENT Extents[8];
|
||||
} VOLUME_DISK_EXTENTS_REDEF;
|
||||
|
||||
char* GetPhysicalName(DWORD DriveIndex);
|
||||
HANDLE GetPhysicalHandle(DWORD DriveIndex, BOOL bWriteAccess, BOOL bLockDrive);
|
||||
char* GetLogicalName(DWORD DriveIndex, BOOL bKeepTrailingBackslash, BOOL bSilent);
|
||||
BOOL WaitForLogical(DWORD DriveIndex);
|
||||
HANDLE GetLogicalHandle(DWORD DriveIndex, BOOL bWriteAccess, BOOL bLockDrive);
|
||||
int GetDriveNumber(HANDLE hDrive, char* path);
|
||||
BOOL GetDriveLetters(DWORD DriveIndex, char* drive_letters);
|
||||
UINT GetDriveTypeFromIndex(DWORD DriveIndex);
|
||||
char GetUnusedDriveLetter(void);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue