NdisAllocateBuffer

This function creates a buffer descriptor mapping a specified virtual range or sub-range within an already allocated memory block.

VOID NdisAllocateBuffer(
  PNDIS_STATUS Status,
  PNDIS_BUFFER* Buffer,
  NDIS_HANDLE PoolHandle,
  PVOID VirtualAddress,
  UINT Length
);

Parameters

  • Status
    [out] Pointer to a caller-supplied variable in which this function returns the final status of the buffer allocation.
  • Buffer
    [out] Pointer to a caller-supplied variable in which this function returns a pointer to the allocated buffer descriptor.
  • PoolHandle
    [in] Handle returned by a preceding call to the NdisAllocateBufferPool function.
  • VirtualAddress
    [in] Pointer to the base virtual address of previously allocated system-space memory to be mapped in the returned buffer descriptor.
  • Length
    [in] Specifies the number of bytes to be mapped.

Return Values

NDIS_STATUS_SUCCESS indicates success. NDIS_STATUS_FAILURE indicates failure.

Remarks

This function allocates storage for and initializes a buffer descriptor to map a specified range of previously allocated memory, such as memory used for a packet header or an NIC receive buffer.

Buffer descriptor allocation draws on the buffer pool that NdisAllocateBufferPool creates. A driver can call this function as many times as necessary to allocate the buffer descriptors that it requires if it called NdisAllocateBufferPool during initialization.

The driver must release any spin lock that it is currently holding before calling this function.

All lower-level NDIS drivers must allocate all buffer descriptors that they chain to packets from a buffer pool. Only highest-level protocol drivers can be given OS-dependent descriptors mapping virtual memory ranges, and, if these memory descriptors are equivalent to NDIS buffer descriptors, a highest-level protocol can pass such descriptors as parameters to NDIS functions.

Requirements

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

See Also

NdisAllocateBufferPool | NdisAllocateMemory | NdisFreeBuffer

 Last updated on Tuesday, May 18, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.