NTSTATUS
IoRegisterShutdownNotification(
IN PDEVICE_OBJECT DeviceObject
);
IoRegisterShutdownNotification registers a driver-supplied DispatchShutdown routine to be called before system shutdown. The driver gains control before the system is fully shut down.
IoRegisterShutdownNotification returns STATUS_SUCCESS when the shutdown routine is registered.
Only highest-level drivers chained above an underlying nonmass-storage device can register their shutdown routines by calling IoRegisterShutdownNotification. For mass-storage drivers, an FSD handles shutdown requests and calls lower drivers to flush cached or buffered data out to the device before the system is shut down.
Callers of IoRegisterShutdownNotification must be running at IRQL PASSIVE_LEVEL.