Stopping a Driver Stack
If a device is removed, NDIS stops a driver stack. A driver stack stop operation proceeds as follows:
NDIS pauses the driver stack. For more information about pausing the driver stack, see Pausing a Driver Stack.
NDIS calls the protocol driver's ProtocolUnbindAdapterEx function.
The binding enters the Closing state. After outstanding OID and send requests are complete and all receive data is returned, the binding enters the Unbound state.
NDIS detaches all the filter modules, beginning from the top of the stack and progressing down to the miniport driver.
After NDIS calls a filter driver's FilterDetach function and the filter driver releases all the resources for a filter module, the filter module is in the Detached state.
NDIS halts the miniport adapter.
After NDIS calls the miniport driver's MiniportHaltEx function, the miniport driver releases all the resources for the miniport adapter and the miniport adapter is in the Halted state.
If all of a filter driver's modules are detached, the system can unload the filter driver.
If all the miniport adapters that a miniport driver manages are halted, the system can unload the miniport driver.