The IoRegisterLastChanceShutdownNotification routine registers a driver to receive an IRP_MJ_SHUTDOWN IRP when the system is shut down, after all file systems have been flushed.
NTSTATUS IoRegisterLastChanceShutdownNotification( PDEVICE_OBJECT DeviceObject );
Pointer to the device object of the device for which the driver requests shutdown notification. The system passes this pointer to the driver's DispatchShutdown routine.
IoRegisterLastChanceShutdownNotification returns STATUS_SUCCESS on success, or the appropriate NTSTATUS error code on failure.
The IoRegisterLastChanceShutdownNotification routine registers the driver to receive an IRP_MJ_SHUTDOWN IRP for the specified device when the system shuts down. The driver receives one such IRP for each device it registers to receive notification for. Drivers handle IRP_MJ_SHUTDOWN IRPs within their DispatchShutdown routines.
For any device that is registered with this routine, the system sends the IRP_MJ_SHUTDOWN IRP after all file systems are flushed. Only one driver in a device stack should register to receive shutdown notification, by calling either IoRegisterShutdownNotification or IoRegisterLastChanceShutdownNotification.
If the driver ceases to require shutdown notification for that device, use IoUnregisterShutdownNotification to remove the driver from the shutdown notification queue.
A driver that calls IoRegisterLastChanceShutdownNotification must satisfy the following restrictions in its DispatchShutdown routine:
- The DispatchShutdown routine must not call any pageable routines.
- The DispatchShutdown routine must not access pageable memory.
- The DispatchShutdown routine must not perform any file I/O operations.
The registered DispatchShutdown routine is called before the power manager sends an IRP_MN_SET_POWER request for PowerSystemShutdown. The DispatchShutdown routine is not called for transitions to any other power states.
|Minimum supported client||Available in Windows 2000 and later versions of Windows. Not available in Microsoft Windows 98/Me.|
|Header||wdm.h (include Wdm.h, Ntddk.h, Ntifs.h)|
|DDI compliance rules||PowerIrpDDis, HwStorPortProhibitedDDIs|