Can a driver create several WMI instances?

Let’s say I have a device with a number of identical inputs. There’s a single driver for the whole device, but I want each input to be accessible to user-space as a separate WMI instance. Is there a standard practice for doing such a thing?

I’d look at creating a raw PDO for each input and then registering each one with WMI.

Firefly is a good enough starting point to seeing how to create the PDO and add to a static child list.

Thanks for the reply Scott. Maybe I’m expecting more from the Firefly example than I should be (or looking at the wrong thing). I don’t see it creating raw PDOs and adding them to any list. I only see the normal WdfCreateDevice() call then saving off the name of the PDO by doing a WdfDeviceAllocAndQueryProperty() call.

Are you suggesting I do a WdfCreateDevice() for each input, query for each of their names, register each one with WMI, and keep them all in a collection? If so, when my EvtWmiInstanceQueryInstance callback is called I’ll have to do something to associate the WDFWMIINSTANCE to the appropriate input. I’m not sure what that looks like. Any ideas?

When registering each one with WMI, what tells the user which instances relates to which input?

My bad, kbfilter, not firefly. Exact code for creating the raw PDO here.

And, yes, I was thinking create a device for each input and then registering each as a WMI instance. When you create the WMI instance you pass in a WDFDEVICE and in the QueryInstance callback you can get the device from the instance with WdfWmiInstanceGetDevice. Put a context on each device and you can use that to figure out what to return (alternatively you can put a context on the WMI instance when you create it).

Presumably the WMI data block you return has some property that tells the user which input they’re querying.