An NDIS miniport driver must register a MiniportShutdownEx function during miniport driver initialization.
NDIS calls an NDIS miniport driver's MiniportShutdownEx function when the system is shutting down. MiniportShutdownEx restores the hardware to a known state.
The ShutdownAction parameter that NDIS passed to MiniportShutdownEx informs the miniport driver of the reason for the shutdown.
The shutdown handler can be called as a result of a user operation, in which case it runs at IRQL = PASSIVE_LEVEL. It can also be called as a result of an unrecoverable system error, in which case it can be running at any IRQL.
MiniportShutdownEx should call no Ndis*Xxx* functions. The miniport driver can call functions for reading and writing I/O ports or disabling the DMA engine to return the hardware to a known state.