Getting display event notification in kmdf mode driver

I am trying to retrieve the display event notification, for that I am using IoRegisterPlugPlayNotification and I am registering this event GUID_DISPLAY_DEVICE_ARRIVAL. So during the device hardware preparation, I am registering this. And the callback is defined is global scope and during release hardware, I am un-registering this. Using this approach, I am able to see the display event notification but only during restart that is s0 state. It was expected to notify the display device arrival and removal in hibernate case also. I did some changes and instead of registering the event in prepare hardware, we did registration in self managed io initialization and unregistered the same in self managed io suspend. After this change, I am able to see the display event notification in hibernate case also, with delay. I have tried using GUID_CONSOLE_DISPLAY_STATE for monitor off and on status retrieval. I am still not sure which guid I should use for display event notification. Any leads will be highly appreciated. Thanks, Aditya

You will, of course, not get any notifications during hibernation, because the power is off. You should get a notification when the machine comes out of hibernation if the state is different than when it went under. If you plug and then unplug, you won’t get any notification, because no one was awake to know that.

I tried your way and it worked, thanks for sharing