NdisIMSwitchToMiniport

This function allows an intermediate driver function to call NdisMXXX functions normally called only from MiniportXXX functions, as, for example, to make indications up to higher-level protocols.

At a Glance

Header file: Ndis.h
Windows CE versions: 2.0 and later

Syntax

BOOLEAN NdisIMSwitchToMiniport(
IN NDIS_HANDLE
MiniportAdapterHandle,
OUT PNDIS_HANDLE SwitchHandle );

Parameters

MiniportAdapterHandle
Handle input to the MiniportInitialize function.
SwitchHandle
Pointer to a variable in which this function returns a handle if the call succeeds.

Return Values

Returns TRUE if the caller can safely call miniport-only NdisMXXX functions until it makes a reciprocal call to NdisIMRevertBack.

Remarks

An intermediate driver must make indications up to higher-level protocols as if from an NIC driver’s MiniportXXX functions. Attempts to simply forward indications to bound protocols directly from an intermediate driver function that receives them cause deadlocks.

For example, after a successful call to this function, the ProtocolXXX function of an NDIS intermediate driver can safely call NdisMXXX functions commonly called from the MiniportHandleInterrupt or MiniportTimer functions of underlying NIC drivers. In particular, such a ProtocolXXX function can call NdisMXXX functions, such as NdisMIndicateReceivePacket or NdisMIndicateStatus, that indicate up to higher-level protocols bound to the intermediate driver’s virtual NIC.

After a successful call to this function, an intermediate driver should call NdisIMRevertBack as quickly as possible. Until it calls NdisIMRevertBack, the execution of such a ProtocolXXX function prevents other MiniportXXX functions in the same driver from running.

If this function returns FALSE, the intermediate driver should call the NdisIMQueueMiniportCallback function. The MiniportCallback function passed to NdisIMQueueMiniportCallback should do essentially the same work as the caller’s miniport-only code would have done if its call to this function had succeeded. That is, such a MiniportCallback function replaces the miniport-only code bracketed by calls to this function and NdisIMRevertBack, as well as setting up sufficient state to communicate with the nonminiport code paths of the intermediate driver.

If an NDIS intermediate driver has internal functions called by both its ProtocolXXX and MiniportXXX functions, such an internal driver function cannot call this function, NdisIMRevertBack, or NdisIMQueueMiniportCallback. A call to any of these NdisIMXXX functions from a MiniportXXX code path is a fatal error.

A driver that calls this function runs at IRQL <= DISPATCH_LEVEL.

See Also

NdisIMRevertBack, NdisMEthIndicateReceive, NdisMIndicateReceivePacket, NdisMIndicateStatus