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?