VOID
NdisAllocateBuffer(
OUT PNDIS_STATUS Status,
OUT PNDIS_BUFFER *Buffer,
IN NDIS_HANDLE PoolHandle,
IN PVOID VirtualAddress,
IN UINT Length
);
NdisAllocateBuffer creates a buffer descriptor mapping a specified virtual (sub)range within an already allocated, nonpaged memory block.
NdisAllocateBuffer 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 a NIC receive buffer.
Buffer descriptor allocation draws on the buffer pool that NdisAllocateBufferPool creates. A driver can call NdisAllocateBuffer 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 it is currently holding before calling NdisAllocateBuffer.
All lower-level NDIS drivers must allocate all buffer descriptors that they chain to packets from 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 NdisXxx functions.
Callers of NdisAllocateBuffer run at IRQL <= DISPATCH_LEVEL.