NdisCopyBuffer

VOID
   NdisCopyBuffer(

       OUT PNDIS_STATUS Status,
       OUT PNDIS_BUFFER  *Buffer,
       IN NDIS_HANDLE PoolHandle,
       IN PVOID MemoryDescriptor,
       IN UINT Offset,
       IN UINT Length
       );

NdisCopyBuffer 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.

Parameters

Status

Points to a caller-supplied variable in which this function returns the final status of the buffer descriptor copy operation, which can be one of the following:

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.

Buffer

Points to a caller-supplied variable in which this function returns a pointer to the new buffer descriptor if the call is successful.

PoolHandle

Specifies the handle returned by a preceding call to NdisAllocateBufferPool.

MemoryDescriptor

Points to the memory descriptor, which can be of type NDIS_BUFFER.

Offset

Specifies the byte offset within the memory block at which to start the copy.

Length

Specifies the number of bytes to copy.

Comments

NdisCopyBuffer creates a buffer descriptor mapping a (sub)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 NdisQueryBuffer 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.

Callers of NdisCopyBuffer run at IRQL PASSIVE_LEVEL.

See Also

NdisAllocateBufferPool, NdisFreeBuffer, NdisGetNextBuffer, NdisQueryBuffer, NdisReleaseSpinLock