Expand Minimize

IoRegisterShutdownNotification routine

The IoRegisterShutdownNotification routine registers the driver to receive an IRP_MJ_SHUTDOWN IRP when the system is shut down.

Syntax


NTSTATUS IoRegisterShutdownNotification(
  _In_  PDEVICE_OBJECT DeviceObject
);

Parameters

DeviceObject [in]

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.

Return value

IoRegisterShutdownNotification returns STATUS_SUCCESS on success, or the appropriate NTSTATUS error code on failure.

Remarks

The IoRegisterShutdownNotification 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.

If the driver ceases to require shutdown notification for the device, use IoUnregisterShutdownNotification to remove the driver from the shutdown notification queue.

Only one driver in a device stack should register to receive shutdown notification.

The system sends the driver the IRP_MJ_SHUTDOWN request before it flushes the file systems. Some drivers, such as drivers for mass storage devices, can require shutdown notification after the system flushes the file systems. To receive shutdown notification for a device after the file systems are flushed, use the IoRegisterLastChanceShutdownNotification routine instead.

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.

A driver writer can make no assumptions about the order in which the driver's DispatchShutdown routine will be called in relation to other such routines or to other shutdown activities.

A PnP driver might register a shutdown routine to perform certain tasks before system shutdown starts, such as locking down code.

Requirements

Version

Available in Windows 2000 and later versions of Windows. Not available in Microsoft Windows 98/Me.

Header

Wdm.h (include Wdm.h, Ntddk.h, or Ntifs.h)

Library

Ntoskrnl.lib

IRQL

PASSIVE_LEVEL

DDI compliance rules

IrqlIoPassive5, PowerIrpDDis, HwStorPortProhibitedDDIs

See also

DispatchShutdown
IoRegisterLastChanceShutdownNotification
IoUnregisterShutdownNotification

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft