Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

How can I find out a logical disk to which physical disk belongs?

smr78smr78 Member Posts: 2
I have used CreateFile() and DeviceIOControl() APU functions and I managed to get a list of harddisks and their partitions ... something like :
HARDDISK : 0
SIGNATURE : 1152140459

StartingOffset : 32,256
PartitionLength : 3,248,953,344
PartitionNumber : 1

StartingOffset : 3,249,017,856
PartitionLength : 5,198,344,704
PartitionNumber : 2
--------------
The problem is that I don't know the labels of the partitions.
So ... I need to find out which logical disk belongs to which physical disk.
Thanks in advance for any help.

Comments

  • MasterijnMasterijn Member Posts: 188
    : I have used CreateFile() and DeviceIOControl() APU functions and I managed to get a list of harddisks and their partitions ... something like :
    : HARDDISK : 0
    : SIGNATURE : 1152140459
    :
    : StartingOffset : 32,256
    : PartitionLength : 3,248,953,344
    : PartitionNumber : 1
    :
    : StartingOffset : 3,249,017,856
    : PartitionLength : 5,198,344,704
    : PartitionNumber : 2
    : --------------
    : The problem is that I don't know the labels of the partitions.
    : So ... I need to find out which logical disk belongs to which physical disk.
    : Thanks in advance for any help.
    :
    This is a tuff one (i haven't done this my self). You probably started with physical drives. But how about starting with volumes first and searching for the physical ones next? This will give you easier access to volume information.
    You can use GetLogicalDrives or GetLogicalDriveStrings
    Then get a volumehandle with CreateFile()
    and the volumename with GetVolumeInformation
    then use DeviceIOControl(IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS) for getting the physical ones.



  • smr78smr78 Member Posts: 2
    : : I have used CreateFile() and DeviceIOControl() APU functions and I managed to get a list of harddisks and their partitions ... something like :
    : : HARDDISK : 0
    : : SIGNATURE : 1152140459
    : :
    : : StartingOffset : 32,256
    : : PartitionLength : 3,248,953,344
    : : PartitionNumber : 1
    : :
    : : StartingOffset : 3,249,017,856
    : : PartitionLength : 5,198,344,704
    : : PartitionNumber : 2
    : : --------------
    : : The problem is that I don't know the labels of the partitions.
    : : So ... I need to find out which logical disk belongs to which physical disk.
    : : Thanks in advance for any help.
    : :
    : This is a tuff one (i haven't done this my self). You probably started with physical drives. But how about starting with volumes first and searching for the physical ones next? This will give you easier access to volume information.
    : You can use GetLogicalDrives or GetLogicalDriveStrings
    : Then get a volumehandle with CreateFile()
    : and the volumename with GetVolumeInformation
    : then use DeviceIOControl(IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS) for getting the physical ones.
    :
    :
    :
    :

    Thank you very much.
    I managed to use IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS and get the physical drives starting with the volumes.
    The problem was the in Delphi Win32 Developer's Reference IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS is not documented, but I have founded an example and I managed to extract what I needed.
    Thanks again.

Sign In or Register to comment.