Share via


Removing 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 removal of a NIC as follows:

  1. The PnP manager issues an IRP_MN_QUERY_REMOVE_DEVICE request to query whether the NIC can be removed without disrupting the machine.

  2. 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 NDIS_STATUS_FAILURE from ProtocolPnPEvent, the PnP manager might ignore the failure and subsequently succeed the IRP_MN_QUERY_REMOVE_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.

  3. The PnP manager issues an IRP_MN_REMOVE_DEVICE request to remove the software representation (device objects, and so forth) for the NIC or an IRP_MN_CANCEL_REMOVE_DEVICE request to cancel the pending removal. Note that an IRP_MN_REMOVE_DEVICE request is not always preceded by an IRP_MN_QUERY_REMOVE_DEVICE request.

  4. If the PnP manager issues an IRP_MN_CANCEL_REMOVE_DEVICE request, NDIS calls the ProtocolPnPEvent function of all protocol drivers bound to the adapter with an event code of NetEventCancelRemoveDevice. This ends the removal sequence.

  5. If the PnP manager issues an IRP_MN_REMOVE_DEVICE request and if the miniport driver was successfully initialized, NDIS calls the ProtocolUnbindAdapter function of all protocol drivers bound to the NIC. If the miniport driver was not successfully initialized, processing continues with Step 7.

  6. After all protocol drivers are unbound from the NIC, NDIS calls the miniport driver's MiniportHalt function.

  7. NDIS sends the IRP_MN_REMOVE_DEVICE request to the next lower device object in the stack.

  8. 8.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.

 

 

Send comments about this topic to Microsoft