Get drive letter of Hard drive
-
Hi all, My application is for windows Vista and XP. There are more than on Hard drive connected to my machine. I need to get Drive Letters of the Hard drive from which my system is booting. By using GetLogicalDriveStrings Function I can get the drive letters of all Hard drives. But how can I differentiate that this particular drive letter is the partition name of my booting Hard drive? The structure of disks are: disk0(Booting with this)- C D G disk1- E F H disk2- I J I need to get the C,D,G only. Thanks Madan
-
Hi all, My application is for windows Vista and XP. There are more than on Hard drive connected to my machine. I need to get Drive Letters of the Hard drive from which my system is booting. By using GetLogicalDriveStrings Function I can get the drive letters of all Hard drives. But how can I differentiate that this particular drive letter is the partition name of my booting Hard drive? The structure of disks are: disk0(Booting with this)- C D G disk1- E F H disk2- I J I need to get the C,D,G only. Thanks Madan
Call
GetLogicalDrives
to get all the available drive letters. CallGetSystemDirectory
to get the drive which contains the OS. Open the volume usingCreateFile("\\.\C:", ...
Here replace C: with the drive letter returned inGetSystemDirectory
. CallDeviceIControl
of the returned handle with theIOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS
code to get the hard disk number. Now you know the hard disk number of the drive containing the OS. Repeat theCreateFile
andDeviceIoControl
on all the other drive letters and compare the hard disk number with the one you got earlier.«_Superman_» I love work. It gives me something to do between weekends.
-
Call
GetLogicalDrives
to get all the available drive letters. CallGetSystemDirectory
to get the drive which contains the OS. Open the volume usingCreateFile("\\.\C:", ...
Here replace C: with the drive letter returned inGetSystemDirectory
. CallDeviceIControl
of the returned handle with theIOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS
code to get the hard disk number. Now you know the hard disk number of the drive containing the OS. Repeat theCreateFile
andDeviceIoControl
on all the other drive letters and compare the hard disk number with the one you got earlier.«_Superman_» I love work. It gives me something to do between weekends.
Thanks for your kind support. I will apply it today. Thanks Madan