2010-08-10 21:29:32 UTC
enumeration code (see below).
It works on all WinXP machines we tried it on, except one.
Unfortunately that is a customer's machine so I can't hack it freely,
need some concrete ideas to act upon.
In short, I call SetupDiGetClassDevs(&MY_GUID,... DIGCF_INTERFACEDEVICE)
to get devices with my interface. There is exactly one such device,
created by my driver. This call returns success.
Then I call SetupDiEnumDeviceInterfaces again for my interface GUID -
and it fails with GetLastError=ERROR_NO_MORE_ITEMS ???
I know that the driver successfully enabled this interface, it
shows up in the registry, with correct reference count and so on.
What can be wrong here? Why SetupDiEnumDeviceInterfaces can fail?
This machine is loaded with lots of various software, but generally behaves
The function below is in a DLL, loaded by a console app, both compiled wih
---------- code -------
#pragma comment(lib, "setupapi")
#define _MAX_DEVINTERFACE_NAME_CCH 512
int openDriver( HANDLE *hnd )
// Get list of devices with our class GUID:
HDEVINFO classDevs = SetupDiGetClassDevs( &MY_GUID,
NULL, NULL, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE );
if ( (INVALID_HANDLE_VALUE == classDevs) || (NULL == classDevs) )
dprintWarn("No supported devices found\n");
ifdata.cbSize = sizeof(ifdata);
if( !SetupDiEnumDeviceInterfaces(classDevs, NULL, &MY_GUID, 0,
//<<< HERE IT FAILS GetLastError=ERROR_NO_MORE_ITEMS
dprintWarn("OpenDriver: No supported devices found\n");
// Get the name for CreateFile