Compartir a través de


NdisCopyBuffer function

Note   NDIS 5. x has been deprecated and is superseded by NDIS 6. x. For new NDIS driver development, see Network Drivers Starting with Windows Vista. For information about porting NDIS 5. x drivers to NDIS 6. x, see Porting NDIS 5.x Drivers to NDIS 6.0.

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.

Syntax

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

Parameters

  • Status [out]
    Pointer 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 [out]
    Pointer 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]
    Pointer 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 value

None

Remarks

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 or 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

Target platform

Universal

Version

Not supported for NDIS 6.0 drivers in Windows Vista. Supported for NDIS 5.1 drivers in Windows Vista and Windows XP.

Header

Ndis.h (include Ndis.h)

Library

Ndis.lib

IRQL

<= DISPATCH_LEVEL.

See also

NdisAllocateBufferPool

NdisFreeBuffer

NdisGetNextBuffer

NdisQueryBuffer

NdisQueryBufferSafe

NdisReleaseSpinLock

 

 

Send comments about this topic to Microsoft