Check for windows shutdown/restart in device Driver

T

Thomas Johansen

Hi

1: I just wonder if it's possible to check in an device driver, that a
system restart/shutdown has been issued by the system ?

2: I know I can get an notification by using IoRegisterShutdownNotification
but when is my ShutDown function called ?
Is it as soon a restart/shutdown har been issued or when windows think
it's time to close my driver ?

3: Can I gen a notification as soon an system restart/shutdown has bee
issued ?


I need to check in my watchdog driver if a reboot has been started to catch
any reboots/shutdowns thats failes.. (Its sometimes does)

Thomas
 
M

Maxim S. Shatskih

1: I just wonder if it's possible to check in an device driver, that a
system restart/shutdown has been issued by the system ?

Yes. The power IRP path for a System power IRP.
2: I know I can get an notification by using IoRegisterShutdownNotification
but when is my ShutDown function called ?

If you're not in the disk stack - then it is called when FSDs are still up.
Otherwise, it is called just after cache flush, when FSD is already down.

The MJ_POWER mechanism is employed only after these calls.
Is it as soon a restart/shutdown har been issued or when windows think
it's time to close my driver ?

Closes are not related to power management. At all.
3: Can I gen a notification as soon an system restart/shutdown has bee
issued ?

Yes. See answer 1.
 
T

Thomas Johansen

Thanks...


Maxim S. Shatskih said:
Yes. The power IRP path for a System power IRP.


If you're not in the disk stack - then it is called when FSDs are still up.
Otherwise, it is called just after cache flush, when FSD is already down.

The MJ_POWER mechanism is employed only after these calls.


Closes are not related to power management. At all.


Yes. See answer 1.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
(e-mail address removed)
http://www.storagecraft.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top