Create a new device instance that is initially disabled?

I’ve written a virtual display driver, and I’m using SwDeviceCreate to enumerate/create multiple instances. After each device is started (CM_NOTIFY_ACTION_DEVICEINSTANCESTARTED), Windows recognizes it and does something (based up cached info or lack thereof in the registry). Since I’m creating multiple instances, there’s considerable chaos as Windows encounters these new displays and potentially adds them to the desktop.

Enumerating/creating these devices seems to take considerably longer than just enabling a previously-created device in the disabled state. What I’d like to do is defer all of that “Windows desktop chaos” until I have all adapters created in a disabled state, then quickly enable them and set their display settings all at once.

I could call CM_Disable_DevNode right after I see the Started notification, but I’ve seen timing issues previously where such calls sometimes fail silently.

I’m using SwDeviceCreate to enumerate the devices, and Microsoft’s documentation is really minimal. You can pass in an array of DEVPROPERTIES to set the device’s initial state, but looking through the DEVPKEY_Device_* values, I don’t see anything obvious that would govern whether the device is initially disabled or enabled.

Can anyone offer suggestions, or point me to prior art? (Google for SwDeviceCreate, and you’ll pretty much hear crickets)

Why create multiple instances of an virtual IddCx graphics adapter using SwDeviceCreate?
Why not create multiple display monitors on one virtual IddCx graphics adpater instead?
Then it is very easy to enable/disable each display monitor using IddCxMonitorArrival and IddCxMonitorDeparture methods.

Marcel Ruedinger
datronicsoft

@Marcel - The one-monitor-per-adapter choice was made early on (for initial simplicity), and I honestly hadn’t reconsidered it since, due to schedule pressure.

Thanks for reminding me! I’m going to experiment with this.