ProtocolOpenAdapterComplete

VOID
    ProtocolOpenAdapterComplete(

        IN NDIS_HANDLE  ProtocolBindingContext,
        IN NDIS_STATUS  Status,
        IN NDIS_STATUS  OpenErrorStatus
        );

ProtocolOpenAdapterComplete is a required driver function that completes processing of a binding operation for which NdisOpenAdapter returned NDIS_STATUS_PENDING.

Parameters

ProtocolBindingContext
Specifies the handle to a protocol-allocated context area in which the protocol driver maintains per-binding runtime state. The driver supplied this handle when it called NdisOpenAdapter.
Status
Specifies the final status of the NIC driver open operation, either NDIS_STATUS_SUCCESS if the binding was established or an error status determined by the underlying driver.

The underlying NIC driver returns NDIS_STATUS_ADAPTER_NOT_READY for any requests it receives while the open operation is pending. After ProtocolOpenAdapterComplete returns control, the underlying driver cannot return this status.

OpenErrorStatus
Specifies additional information about the reason for a failure if the value at Status is not NDIS_STATUS_SUCCESS and if the underlying driver supplied this information. For example, the driver of a Token Ring NIC might return a ring error that NDIS forwards to ProtocolOpenAdapterComplete. This parameter can be NULL.

Comments

When NdisOpenAdapter returns NDIS_STATUS_PENDING to the DriverEntry or ProtocolBindAdapter function of an NDIS protocol driver, NDIS calls that driver’s ProtocolOpenAdapterComplete function when the asynchronous binding operation is complete.

If the input Status is NDIS_STATUS_SUCCESS, ProtocolOpenAdapterComplete carries out whatever driver-determined per-binding operations its DriverEntry or ProtocolBindAdapter function would have done in a synchronous binding operation.

If the driver has a ProtocolBindAdapter function, ProtocolOpenAdapterComplete calls NdisCompleteBindAdapter with NDIS_STATUS_SUCCESS for the Status and OpenStatus arguments and with the BindContext handle stored at ProtocolBindingContext by the ProtocolBindAdapter function. Then, ProtocolOpenAdapterComplete returns control.

Otherwise, ProtocolOpenAdapterComplete cleans up any per-binding state already set up by DriverEntry or ProtocolBindAdapter. After releasing any state set up by ProtocolBindAdapter except for the BindContext handle, it calls NdisCompleteBindAdapter with an appropriate error for Status and the handle before it returns control.

By default, ProtocolOpenAdapterComplete runs at IRQL PASSIVE_LEVEL in the context of a system thread.

See Also

DriverEntry of NDIS Protocol Drivers, NdisCompleteBindAdapter, NdisFreeMemory, NdisOpenAdapter, ProtocolBindAdapter