Ganesh E
May 15th, 2006, 02:32 PM
Hello,
I have a problem with SetupDiEnumDeviceInterfaces() after detaching and reattaching USB devices, when DeviceIoControl() fails and therefore GetLastError() is called.
I've built up a DevInfo list containing all my installed devices with
SetupDiGetClassDevs((GUID*) &MY_GUID, NULL, NULL, DIGCF_DEVICEINTERFACE);
I am enumerating my USB devices through SetupDiEnumDeviceInterfaces() by checking the DeviceInterfaceData.Flags value. Also updating the DevInfo list through SetupDiOpenDeviceInterface() woks fine, when I attach/detach my devices.
From SetupDiGetDeviceInterfaceDetail() I obtain the DevicePath for CreateFile().
I keep the handle retrieved from CreateFile() open, to ban multiple access while working with the device. When the device is detached (and also when
reattached) the communication with my device driver through DeviceIoControl() fails with that handle. Therefore I check GetLastError() after every call to DeviceIoControl() returning a 0.
-- Up to here everything is clear. --
After that, I want to determine if the device was reattached, but a call to
SetupDiEnumDeviceInterfaces() or SetupDiOpenDeviceInterface() always returns DeviceInterfaceData.Flags set to 0.
Can anyone explain what happens and what I am doing wrong?
Thanks
I have a problem with SetupDiEnumDeviceInterfaces() after detaching and reattaching USB devices, when DeviceIoControl() fails and therefore GetLastError() is called.
I've built up a DevInfo list containing all my installed devices with
SetupDiGetClassDevs((GUID*) &MY_GUID, NULL, NULL, DIGCF_DEVICEINTERFACE);
I am enumerating my USB devices through SetupDiEnumDeviceInterfaces() by checking the DeviceInterfaceData.Flags value. Also updating the DevInfo list through SetupDiOpenDeviceInterface() woks fine, when I attach/detach my devices.
From SetupDiGetDeviceInterfaceDetail() I obtain the DevicePath for CreateFile().
I keep the handle retrieved from CreateFile() open, to ban multiple access while working with the device. When the device is detached (and also when
reattached) the communication with my device driver through DeviceIoControl() fails with that handle. Therefore I check GetLastError() after every call to DeviceIoControl() returning a 0.
-- Up to here everything is clear. --
After that, I want to determine if the device was reattached, but a call to
SetupDiEnumDeviceInterfaces() or SetupDiOpenDeviceInterface() always returns DeviceInterfaceData.Flags set to 0.
Can anyone explain what happens and what I am doing wrong?
Thanks