Tech Support > Microsoft Windows > Development Resources > List Physical Drives (c++ | WINAPI)
List Physical Drives (c++ | WINAPI)
Posted by Alex on April 2nd, 2008


Hello!
I want to list all physical drives on my machine...
anybody knows how to do this?


(win32 api, c++)

Posted by Kellie Fitton on April 2nd, 2008


On Apr 2, 6:16*am, Alex <h4cker_...@hotmail.com> wrote:

Hi,

You can use the following APIs to get the currently available disk
drives on your machine:

GetLogicalDrives()

GetLogicalDriveStrings()

GetDriveType()

http://msdn2.microsoft.com/en-us/library/aa364972.aspx

http://msdn2.microsoft.com/en-us/library/aa364975.aspx

http://msdn2.microsoft.com/en-us/library/aa364939.aspx

Kellie.


Posted by Alex on April 2nd, 2008


sorry but i need physical hard drives and not logical...

Posted by Sten Westerback \(MVP SDK 2005-6 :\) on April 2nd, 2008



"Alex" <h4cker_rus@hotmail.com> wrote in message
news:ft013m$e81$1@aioe.org...
You should tell a bit more specifically what type of information you want.
SCSI ID's?
Anyway, FindFirstVolume() might give you something useful. Or maybe even
FindFirstVolumeMountPoint().
And ofcourse one knows that the physical devices are accessible
(CreateFile()) using paths such as \\.\PHYSICALDRIVE0
Then there is DeviceIoControl with FSCTL_GET_NTFS_VOLUME_DATA and/or
IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS.

And of course there are PnP related API's but i think they are more
appropriate in kernel mode. But try EnumDeviceDrivers and

If on the other hand you want logical drives, check out GetLogicalDrives().

- Sten



Posted by Sebastian G. on April 2nd, 2008


Alex wrote:


Simply enumerate \Device\HarddiskX?

Posted by Alex on April 2nd, 2008


Hi,
i have enumerated "PhysicalDriveX" in CreateFile
then i have tested returned value

but i would find a kind of function which gives
number of physical hard drives or handles to physical drive

Posted by Alex on April 2nd, 2008


Hi,
which information can i obtain with IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS
coz i need the name of hard drive too))
thanks

Posted by Kellie Fitton on April 2nd, 2008


On Apr 2, 7:42*am, Alex <h4cker_...@hotmail.com> wrote:

Hi,

You can use the following WMI class to get the name of the disk
drive manufacturer:

Win32_DiskDrive

http://msdn2.microsoft.com/en-us/lib...32(VS.85).aspx

Kellie.


Posted by Christian ASTOR on April 2nd, 2008


On 2 avr, 15:16, Alex <h4cker_...@hotmail.com> wrote:

SetupDiGetClassDevs() with &DiskClassGuid -SetupDiEnumDeviceInfo()-
SetupDiGetDeviceRegistryProperty()...


Posted by Boris on April 3rd, 2008


"Alex" <h4cker_rus@hotmail.com> wrote in message
news:ft013m$e81$1@aioe.org...

Boris


Posted by Levis on April 3rd, 2008


Boris wrote:
Always avoid WMI and use the method mentioned above.
It is slow and not installed natively on OS like NT.

Posted by Sebastian G. on April 3rd, 2008


Levis wrote:


Microsoft says we shouldn't care about NT4- and Win9x/ME any more, but
rather base everything on the Win32 API as in NT5.

Posted by Levis on April 3rd, 2008


Sebastian G. wrote:
Customers decide, not Microsoft.
Many are running NT4.

Posted by Sten Westerback \(MVP SDK 2005-6 :\) on April 4th, 2008



"Levis" <levis@clarck.com> wrote in message
news:ft3c4e$qjm$1@news.albasani.net...
... and they are stupid as older OS's won't get any hotfixes....

- Sten



Posted by Alex on April 7th, 2008


Hi
i have a linker when using SetupDi functions
(i work under vs2008) can u help me?
which library contains this functions?

Posted by Alex on April 7th, 2008


Hi
i have a linker error when using SetupDi functions
(i work under vs2008) can u help me?
which library contains this functions?

Posted by Christian ASTOR on April 7th, 2008


On 7 avr, 10:48, Alex <h4cker_...@hotmail.com> wrote:

setupapi.lib


Posted by CAHEK on April 8th, 2008


Hi! could u explain me how can i filter the info coz i want
display just physical drives...

Posted by Christian ASTOR on April 8th, 2008


On 8 avr, 10:41, CAHEK <h4cker_...@hotmail.com> wrote:
As I said : &DiskClassGuid or &GUID_DEVINTERFACE_DISK


Similar Posts