NdisCopyBuffer

This function creates a buffer descriptor for a specified virtual sub-range, given a handle for a block of already allocated memory and a pointer to the memory descriptor for the block.

VOID NdisCopyBuffer(
  PNDIS_STATUS Status,
  PNDIS_BUFFER* Buffer,
  NDIS_HANDLE PoolHandle,
  PVOID MemoryDescriptor,
  UINT Offset,
  UINT Length
);

Parameters

  • Status
    [out] Points to a caller-supplied variable in which this function returns the final status of the buffer descriptor copy operation.
  • Buffer
    [out] Points to a caller-supplied variable in which this function returns a pointer to the new buffer descriptor if the call is successful.
  • PoolHandle
    [in] Specifies the handle returned by a preceding call to NdisAllocateBufferPool.
  • MemoryDescriptor
    [in] Points to the memory descriptor, which can be of type NDIS_BUFFER.
  • Offset
    [in] Specifies the byte offset within the memory block at which to start the copy.
  • Length
    [in] Specifies the number of bytes to copy.

Return Values

The following table shows the return values for this function.

Value Description
NDIS_STATUS_SUCCESS The driver can use the buffer descriptor or buffer descriptor chain returned at Buffer.
NDIS_STATUS_FAILURE An attempt to map the given range failed, possibly because of an out-of-range Offset and Length specification.

Remarks

NdisCopyBuffer creates a buffer descriptor mapping a range within a block of memory, described by a given memory descriptor. This function allocates storage for the new buffer descriptor and then copies information from the given MemoryDescriptor into the new buffer descriptor.

If the given memory descriptor contains chained elements, the buffer descriptor that NdisCopyBuffer creates can be the head of a chain of buffer descriptors. A driver can call NdisGetNextBuffer and then NdisQueryBufferSafe to query each chained buffer descriptor.

The driver must release any spin lock it is holding before calling NdisCopyBuffer. The driver must call NdisFreeBuffer to release the buffer descriptor when it is no longer needed.

Requirements

OS Versions: Windows CE .NET 4.0 and later.
Header: Ndis.h.

See Also

NdisAllocateBufferPool | NdisFreeBuffer | NdisGetNextBuffer | NdisQueryBuffer | NdisQueryBufferSafe | NdisReleaseSpinLock

 Last updated on Tuesday, May 18, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.