Re: How do you get the number of physically installed hard disks (Win32)?

fine. you can get total number of physical drives and also the interface
name (in form guid) by calling another setup API func. Are you aware of any
function which can give me indivual device name in form of
\.\PHYSICALDRIVN.

thanks

-----Original Message-----
From: Ralf Buschmann [mailto:xxxxx@backmagic.de]
Sent: Thursday, October 10, 2002 10:59 AM
To: NT Developers Interest List
Subject: [ntdev] Re: How do you get the number of physically installed
hard disks (Win32)?

Nate,

you wrote on Thursday, October 10, 2002, 19:31:38:

NB> I’m trying to remember a Win32 API that returns the number of
NB> physical hard disks that are installed. I have a feeling it’s
NB> something like GetSystemInfo() and that the number of installed
NB> drives is one of the fields of a returned struct. Does anyone
NB> remember how to get this info?

Sounds like you remember NtQuerySystemInformation() with info class
SystemConfigurationInformation…

But the IMHO recommended way to do this is the Setup API:

#include <windows.h>
#include <initguid.h>
#include <setupapi.h>
#include <devguid.h>

hDevInfoSet = SetupDiGetClassDevs(
&GUID_DEVCLASS_DISKDRIVE,
0, 0, DIGCF_PRESENT
);

DevInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
dwDisks = 0;

while ( SetupDiEnumDeviceInfo(hDevInfoSet, dwDisks, &DevInfoData) )
{
dwDisks++;
}

SetupDiDestroyDeviceInfoList(hDevInfoSet);

BTW, you don’t have relatives in Germany, do you? It’s just that the
names translate perfectly … :wink:

Ralf.



You are currently subscribed to ntdev as: xxxxx@Legato.COM
To unsubscribe send a blank email to %%email.unsub%%</devguid.h></setupapi.h></initguid.h></windows.h>