c++ - Volume to physical drive -


querydosdevice(l"e:", devicename, max_path); 

(e: sd card)

devicename "\device\harddiskvolume3"

how "convert" "\\.\physicaldrive1"

volumes made of 1 or more partitions, reside on disks. so, e: doesn't map single disk in system (think software raid).

the way map volumes physicaldrive names in win32 first open volume , send ioctl_volume_get_volume_disk_extents. give structure has 1 disk_extent entry every partition volume spans:

typedef struct _volume_disk_extents {   dword       numberofdiskextents;   disk_extent extents[anysize_array]; } volume_disk_extents, *pvolume_disk_extents; 

the extents have disk number in them:

typedef struct _disk_extent {   dword         disknumber;   large_integer startingoffset;   large_integer extentlength; } disk_extent, *pdisk_extent; 

the disknumber goes phsyicaldrivex link, can sprintf number "\\.\physicaldrive%d"

-scott


Comments

Popular posts from this blog

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

c++ - Convert big endian to little endian when reading from a binary file -

openssl - Load PKCS#8 binary key into Ruby -