Hi, im trying to get information about all hard disks and partitions of computer that im running on. I using
Code:
hDevInfo = SetupDiGetClassDevs( (GUID*)&DiskClassGuid, NULL, NULL, (DIGCF_PRESENT | DIGCF_INTERFACEDEVICE ) );
(some logging)
SP_INTERFACE_DEVICE_DATA hDeviceInterfaceData;
ZeroMemory( &hDeviceInterfaceData, sizeof( SP_INTERFACE_DEVICE_DATA ));
hDeviceInterfaceData.cbSize = sizeof( SP_INTERFACE_DEVICE_DATA );
result = SetupDiEnumDeviceInterfaces( hDevInfo, 0, (GUID*)&DiskClassGuid, index, &hDeviceInterfaceData );
SetupDiGetDeviceInterfaceDetail( hDevInfo, &hDeviceInterfaceData, pInterfaceDetail, dwDetailSize, &dwRequiredSize, 0);
And then in pInterfaceDetail->DevicePath I should have a name of the hard disk that Imable to use in CreateFile(). So I use that name, use CreateFile() and get that handle (no error here), but when using DeviceIoControl with IOCTL_DISK_GET_DRIVE_GEOMETRY_EX I get error INVALID_HANDLE.

Does anyone get a clue what is wrong?

If necessary I can paste all my code here.

Thanks!