![]() |
|
|||||||
| Notices |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Feb 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
![]() OS:
|
Opening USB device from application
Hi,
I am trying to open a USB mass storage device from a windows application. To use CreateFile(), I needed the device name. So I did the following. hardwareDeviceInfo = SetupDiGetClassDevs(&UsbClassGuid, NULL, // Define no enumerator (global) NULL, // Define no DIGCF_PRESENT| DIGCF_DEVICEINTERFACE // Only Devices present ); // Function class devices. if (hardwareDeviceInfo == INVALID_HANDLE_VALUE) { return INVALID_HANDLE_VALUE; } else printf(" SetupDiGetClassDevs returned a valid handle!\n"); //Get Device Interface Data deviceInterfaceData.cbSize = sizeof(deviceInterfaceData); (SetupDiEnumDeviceInterfaces(hardwareDeviceInfo, NULL, &UsbClassGuid, 0, &deviceInterfaceData)) The call to SetupDiEnumDeviceInterfaces() fails. Any ideas on what the problem could be? I got the USB GUID from the windows system defined GUID list for disk drives. Odomae |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
< Windows Help - MS Office Help - Hardware Support >
| New To Site? | Need Help? |