With fast resume, yes, the application can start running while the driver is powering up. As long as you use power managed queues in your umdf driver to guard access to your hardware access from/to the application, this is not a problem though as UMDF will pend these requests until you power up.
In what callback do you do the “Few initialization operations between the driver and the fw”? if you do this in D0Entry or SelfManagedIoRestart, yes the requests are still pended in the power managed queues
None of this will invalidate the application’s handle to the device driver though. Based on this statement, " This happens in higher frequency if the firmware takes longer time to wake (due to FW code issues)," I am guessing that b/c you have FW code issues the device is falling off of the device bus (is it usb?) and being surprise removed. Is your application registering for notifications on the handle it has opened against your driver? If so, my guess would be that this code which handles the notifications for the device handle has run, closed the handle and the other part of your application is not synchronized with the notification code and is using the handle after you have closed it.
d
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@n-trig.com
Sent: Sunday, December 23, 2007 6:26 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Can an application wake before a user-mode driver?
Hello,
I’m using a UMDF driver.
My application opens a handle to the driver when Windows boots, and keeps using the same handle until Windows shuts down.
Sometimes, when the system wakes from Sleep\Hibernate, the application crashes.
After debugging the issue, it seems that the handle (at the application level) is invalid while waking from the low power state.
This results in an application crash.
This happens in higher frequency if the firmware takes longer time to wake (due to FW code issues).
My questions are -
- Isn’t there a mechanism which is supposed to prevent the application from waking before the driver? Or at least preventing it to try and use the handle?
Maybe because it’s a user mode driver they wake at the same time?
- When the driver wakes, I do a few initialization operations between the driver and the FW (questions and answers, some sort of handshake). Requests arriving from applications at that time are queued, aren’t they?
*** As opposed to the phenomena I’ve mentioned in the past, this time the driver doesn’t crash (so I guess it is not related to the (non) power managed queues issue).
Thanks,
Gadi
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer