Stopping a NIC (NDIS 5.1)
Note NDIS 5. x has been deprecated and is superseded by NDIS 6. x. For new NDIS driver development, see Network Drivers Starting with Windows Vista. For information about porting NDIS 5. x drivers to NDIS 6. x, see Porting NDIS 5.x Drivers to NDIS 6.0.
The PnP manager stops a NIC so that it can reconfigure or rebalance the hardware resources that it assigned to the NIC. NDIS participates in the stopping of a NIC as follows:
The PnP manager issues an IRP_MN_QUERY_STOP_DEVICE request.
On receiving this IRP, NDIS calls the ProtocolPnPEvent function of all protocol drivers that are bound to the adapter. In this call, NDIS specifies an event code of NetEventQueryRemoveDevice.
If a protocol driver fails the NetEventQueryRemoveDevice event by returning a failure code from ProtocolPnPEvent, the PnP manager might ignore the failure and subsequently succeed the IRP_MN_QUERY_STOP_DEVICE request. A protocol driver must therefore be prepared to handle the removal of the NIC even though the protocol driver failed the NetEventQueryRemoveDevice event.
The PnP manager issues an IRP_MN_STOP_DEVICE request to stop the device or an IRP_MN_CANCEL_STOP_DEVICE request to cancel the pending stop.
If the PnP manager issues an IRP_MN_CANCEL_STOP_DEVICE request, NDIS calls the ProtocolPnPEvent function of all protocol drivers that are bound to the adapter with an event code of NetEventCancelRemoveDevice.
If the PnP manager issues an IRP_MN_STOP_DEVICE request, NDIS calls the ProtocolUnbindAdapter function of all protocol drivers bound to the NIC.
After all protocol drivers are unbound from the NIC, NDIS calls the miniport driver's MiniportHalt function.
When processing an IRP_MN_STOP_DEVICE request, NDIS does not destroy the functional device object that it created for the NIC when the NIC was added to the system. NDIS destroys the device object only after receiving an IRP_MN_REMOVE_DEVICE request sent to the device object.