0

I'm trying to write some code which will fetch all the information from my computer's device manager.

I have the following code:

HDEVINFO hDevInfo;
SP_DEVINFO_DATA DeviceInfoData;
DWORD i;
// Create a HDEVINFO with all present devices.
hDevInfo = SetupDiGetClassDevs(NULL,0,0,DIGCF_PRESENT|DIGCF_ALLCLASSES );
// Enumerate through all devices in Set.
DeviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
for (i=0;SetupDiEnumDeviceInfo(hDevInfo,i,&DeviceInfoData);i++)
{
    DWORD DataT;
    LPTSTR buffer = NULL;
    DWORD buffersize = 200;
    buffer = (LPTSTR)LocalAlloc(LPTR,buffersize);
    SetupDiGetDeviceRegistryProperty(hDevInfo,&DeviceInfoData, SPDRP_DEVICEDESC, &DataT,(PBYTE)buffer,buffersize,&buffersize);
    printf("Result:[%s]\n", buffer);

    if (buffer) 
        LocalFree(buffer);
}
// Cleanup
SetupDiDestroyDeviceInfoList(hDevInfo);

But to be honest, that's not what I'm looking for, because the list I'm getting lacks the details which the control panel has.

Any suggestions?

Idanis
  • 1,918
  • 6
  • 38
  • 69
  • Can you explain the information you're looking for versus what you're receiving? – Retired Ninja Dec 24 '14 at 09:36
  • Sure. Chipset, Cpu, Gpu, and I would also like know if my hdd is sata or ssd. – Idanis Dec 24 '14 at 10:08
  • 1
    I think you're using the wrong technology. Try WMI. `SELECT * FROM Win32_Processor` for CPU information (you weren't specific which CPU information you wanted), `SELECT VideoProcessor FROM Win32_VideoController` for GPU information, and `SELECT InterfaceType FROM Win32_DiskDrive` for disk information. – Raymond Chen Dec 24 '14 at 16:53

0 Answers0