Microsoft Windows CE 3.0  

MiniportTransferData

Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

MiniportTransferDatais a required function in network adapter drivers that do not indicate multipacket receives and/or media-specific information with NdisMIndicateReceivePacketand in those that do not support WAN media.

NDIS_STATUS
MiniportTransferData(
OUT PNDIS_PACKET
Packet
,
OUT PUINT
BytesTransferred
,
IN NDIS_HANDLE
MiniportAdapterContext
,
IN NDIS_HANDLE
MiniportReceiveContext
,
IN UINT
ByteOffset
,
IN UINT
BytesToTransfer
);

Parameters

Packet
Points to a packet descriptor with chained buffers into which MiniportTransferDatashould copy the received data.
BytesTransferred
Points to a variable that MiniportTransferDatasets to the number of bytes it copied into the packet. This value is meaningless if MiniportTransferDatareturns NDIS_STATUS_PENDING.
MiniportAdapterContext
Specifies the handle to a miniport-allocated context area in which the driver maintains per-network adapter state, set up by MiniportInitialize.
MiniportReceiveContext
Specifies the context handle previously passed to NdisM..IndicateReceive. The miniport can examine this value to determine which receive to copy.
ByteOffset
Specifies the offset within the received packet at which MiniportTransferDatashould begin the copy. If the entire packet is be copied, ByteOffsetis zero.
BytesToTransfer
Specifies how many bytes to copy. The sum of ByteOffsetand BytesToTransfershould be less than or equal to the packet size that was specified in the miniport's receive indication. This value can be zero.

Return Values

MiniportTransferDatacan return one of the the following:

NDIS_STATUS_SUCCESS

MiniportTransferDatacopied the requested data into the protocol-supplied packet, and it set BytesTransferredto the number of bytes copied.

NDIS_STATUS_PENDING

The driver will complete the transfer asynchronously with a call to NdisMTransferDataComplete.

NDIS_STATUS_FAILURE

Either the data could not be copied or the input transfer range was invalid.

Remarks

MiniportTransferDatacopies the contents of the received packet to a given protocol-allocated packet.

NDIS calls MiniportTransferDatawhen a ProtocolReceivefunction calls NdisTransferData. The media header associated with a packet cannot be copied; only the data portion of a packet can be copied. The range passed to NdisTransferDatanever includes the media header. Usually, the ByteOffsetinput to MiniportTransferDataexcludes data that the miniport already indicated in the lookahead buffer.

A miniport must be prepared to copy a given packet more than once. If its network adapter supports reading a given packet only once, the miniport must copy each received network packet to a staging buffer.

MiniportTransferDatacan call NdisQueryPacketto determine how many buffer descriptors the allocating protocol has provided. The protocol is responsible for supplying a packet descriptor that accommodates the transfer it requested. MiniportTransferDatacan call NdisQueryBufferto determine how much data to copy into each protocol-supplied buffer.

MiniportTransferDatacan fail a request if the given ByteOffsetand BytesToTransferexceed the packet size originally indicated. Alternatively, MiniportTransferDatacan simply transfer all available data starting at any valid ByteOffset.

Because MiniportTransferDatais asynchronous, a miniport that has this function cannot deliver receive indications while a transfer is pending. If MiniportTransferDatareturns NDIS_STATUS_PENDING, the miniport must call NdisMTransferDataCompletewhen the transfer is complete.

A driver that indicates packets with NdisMIndicateReceivePacketdoes not need a MiniportTransferDatafunction because such a driver always indicates full packets to bound protocols.

Interrupts are still disabled when MiniportTransferDatais called.

Requirements

Runs on Versions Defined in Include Link to
Windows CE OS 2.0 and later Ndis.h   Ndislib.lib
Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

MiniportInitialize, NdisGetFirstBufferFromPacket, NdisGetNextBuffer, NdisMIndicateReceivePacket, NdisMoveMemory, NdisMTransferDataComplete, NdisQueryBuffer, NdisQueryPacket, NdisTransferData, ProtocolReceive