Muokkaa

Jaa


Binding to an Adapter

NDIS calls a protocol driver's ProtocolBindAdapterEx function to open a binding whenever an underlying adapter to which the driver can bind becomes available. After NDIS calls ProtocolBindAdapterEx, the binding enters the Opening state. In the Opening state, the protocol driver allocates resources for the binding and opens the adapter.

NDIS passes to ProtocolBindAdapterEx the NDIS context for the binding operation as well as a pointer to an NDIS_BIND_PARAMETERS structure. This structure contains information about the adapter such as:

  • The name of the adapter.

  • The registry location for parameters specific to this binding under protocol service entry in the registry.

  • The physical device object for the adapter.

To open an adapter, protocol drivers call the NdisOpenAdapterEx function. The protocol driver passes the following to NdisOpenAdapterEx:

  • The handle that NDIS returned to the driver at the NdisProtocolHandle parameter of the NdisRegisterProtocolDriver function.

  • The protocol driver's context for this binding.

  • A pointer to a structure of type NDIS_OPEN_PARAMETERS.

NDIS_OPEN_PARAMETERS contains information such as name of the adapter that NdisOpenAdapterEx should open, an array of medium types that the protocol driver supports and, optionally, an array of frame types that the driver can receive on this binding.

If a protocol driver returns NDIS_STATUS_PENDING from ProtocolBindAdapterEx, it must call NdisCompleteBindAdapterEx with the final status to complete the bind request.

If NDIS returns NDIS_STATUS_PENDING from NdisOpenAdapterEx, NDIS later calls the protocol driver's ProtocolOpenAdapterCompleteEx function with the final status after the open request has been completed.

After the driver successfully opens the binding to the adapter, the binding is in the Paused state.

A protocol driver calls the NdisCloseAdapterEx function to close the adapter. The driver can call NdisCloseAdapterEx from the ProtocolBindAdapterEx function or ProtocolUnbindAdapterEx function.

If after opening the adapter and before completing the bind request, ProtocolBindAdapterEx encounters a failure and must close the binding to the adapter, it can call NdisCloseAdapterEx. For more information about closing an adapter, see Unbinding from an Adapter.