Compartir a través de


Protocol Driver Unbinding Operations (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.

A protocol driver calls NdisCloseAdapterfrom its ProtocolUnbindAdapterfunction to unbind from an underlying miniport driver. NDIS calls the protocol driver's ProtocolUnbindAdapterfunction if the underlying NIC is no longer available.

A protocol driver should unbind from an adapter if there is a failure after opening the adapter. For example, the driver should unbind if a failure occurs while allocating a required resource and the driver cannot carry out network operations on the binding.

The protocol driver must not release the per-binding resources until it completes a call to NdisCloseAdaptereither synchronously or asynchronously. If NdisCloseAdapterreturns NDIS_STATUS_PENDING, the protocol driver cannot deallocate any per-binding resources until NDIS calls ProtocolCloseAdapterComplete.

NDIS does not call ProtocolCloseAdapterCompleteuntil all outstanding requests on the binding have completed. After ProtocolCloseAdapterCompletereturns control to NDIS, the ProtocolBindingContexthandle is invalid.

As soon as a protocol driver calls NdisCloseAdapter, the handle in the NdisBindingHandleparameter should be considered invalid by the caller. It is a programming error to pass this handle in any subsequent call to an NdisXxx function.

The protocol driver must do the following before returning synchronously from ProtocolUnbindAdapteror before completing the unbind operation asynchronously with NdisCompleteUnbindAdapter:

  • Finish cleaning up any state that it maintains for the binding.

  • Release any resources that it allocated to establish the binding.

  • Call NdisCloseAdapter.

 

 

Send comments about this topic to Microsoft