Processing the Surprise Removal of 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.
NDIS participates in the surprise removal of a NIC as follows:
The PnP manager issues an IRP_MN_SURPRISE_REMOVAL request to the device stack for the NIC.
If the NIC's miniport driver exports a MiniportPnPEventNotify function and if the miniport driver was successfully initialized, NDIS calls this function with an event code of NdisDevicePnPEventSurpriseRemoved. The miniport driver should note that the device has been physically removed. If the miniport driver is an NDIS-WDM driver, it should cancel any pending IRPs that it sent down to the underlying bus driver. If the miniport driver was not successfully initialized, processing continues with Step 5.
NDIS calls the ProtocolUnbindAdapter function of all protocol drivers that are bound to the NIC.
After all protocol drivers are unbound from the NIC, NDIS calls the miniport driver's MiniportHalt function.
NDIS sends the IRP_MN_SURPRISE_REMOVAL request to the next lower device object in the stack. After receiving the returned IRP_MN_SURPRISE_REMOVAL request from the next lower device object in the stack, NDIS completes the IRP_MN_SURPRISE_REMOVAL request.
The PnP manager issues an IRP_MN_REMOVE_DEVICE request to remove the software representation (device objects, and so forth) for the NIC.
NDIS sends the IRP_MN_REMOVE_DEVICE request to the next lower device object in the stack.
On receiving the completed IRP_MN_REMOVE_DEVICE request from the next lower device object in the stack, NDIS destroys the functional device object that it created for the NIC.