I have the world’s simplest driver, it’s loaded at boot time and it’s an ordinary WDM driver and everything’s just peach with it, it works fine. I’m creating an FDO and a symbolic link into the DOS namespace, and I can open my device with an application.
HOWEVER - now I want to have this device broadcast (register) a device interface. I’ve been trying to do this two different ways, and neither of them seem to work.
First way: in the driver’s AddDevice() routine, I make the following calls in order:
status = IoRegisterDeviceInterface(…, &name); // name is a PUNICODE_STRING
status = IoSetDeviceInterfaceState(&name, TRUE);
When I look at the behavior of this sequence of calls using a test application (which is written in C, and uses CreateFile() to open the device), when I use the SetupDiEnumClassDevs() request, I get the following results:
if DIGCF_PRESENT is set, and I use the ClassGuid for my device, I see it.
if DIGCF_ALLCLASSES | DIGCF_DEVICE_INTERFACE is set, I see my Interface GUID in the list.
if DIGCF_ALLCLASSES | DIGCF_DEVICE_INTERFACE | DIGCF_PRESENT is set, I see nothing, the enum immediately returns with an 0x103 (end of list).
So, this suggests to me, that the SetupDiXxx functionality may not be doing what I think they are (based on the documentation, which we all know is miserably incomplete).
Here is what I think should happen: if I call SetupDiEnumClassDevs with the interfaceGuid and only DIGCF_PRESENT | DIGCF_DEVICE_INTERFACE set, it should return a device information set with precisely one element (which should be my interface).
And instead, I get an empty information set.
Any ideas?
The real question is, how can I tell whether my device interface (class) is being properly broadcast into the registry? I also tried this a different way, using AddInterface directives in a .INF file, and that way had some horrible results, but the bottom line is the interface GUID appears nowhere in the registry even when the driver installs properly and even after the same interface is thereafter registered inside the driver.
??? (confused)