you wrote on Thursday, October 10, 2002, 20:04:17:
PK> fine. you can get total number of physical drives and also the
PK> interface name (in form guid) by calling another setup API func.
Right, that would be an interface class enumeration calling
SetupDiGetClassDevs() for GUID_DEVINTERFACE_DISK with flag
DIGCF_INTERFACEDEVICE. You the use SetupDiEnumDeviceInterfaces() to
enumerate and can subsequently call SetupDiGetDeviceInterfaceDetail() to
obtain a Win32 device name that you can pass directly to CreateFile() to
obtain a handle to the device.
PK> Are you aware of any function which can give me indivual device name
PK> in form of \.\PHYSICALDRIVN.
In my experience the enumeration index of a disk device in either
SetupDiEnumDeviceInterfaces() or SetupDiEnumDeviceInfo() just is it’s
physical drive number. So based on the code I posted, you could also do
RE: [ntdev] Re: How do you get the number of physically installed hard disks (Win32)?Have you looked at using WMI class, Win32_DiskDrive? There is a field in this class, ‘DeviceId’, which gives the device name in the form that you are expecting. I have not tried this in SAN env, but surely with the disk arrays I am getting pretty useful/correct information. I strongly feel, it will give you correct information. Using WMI is pretty simple, you will be required to perform some standard steps, and open a connection with cimv2 repository, and then query to Win32_DiskDrive class. If you want I can provide you some sample code.
Pankaj
“Pashupati Kumar” wrote in message news:xxxxx@ntdev… 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:
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 …
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>