Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Home NTDEV
Before Posting...
Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


Create a new device instance that is initially disabled?

scott_smithscott_smith Member Posts: 19

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)


Scott Smith
Windows Developer since 1989

Comments

  • Marcel_RuedingerMarcel_Ruedinger Member Posts: 146

    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

  • scott_smithscott_smith Member Posts: 19

    @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.


    Scott Smith
    Windows Developer since 1989

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Kernel Debugging 30 Mar 2020 OSR Seminar Space
Developing Minifilters 15 Jun 2020 LIVE ONLINE
Writing WDF Drivers 22 June 2020 LIVE ONLINE
Internals & Software Drivers 28 Sept 2020 Dulles, VA