Call the NdisAllocateNetBuffer function to allocate and initialize a NET_BUFFER structure from a NET_BUFFER structure pool.
PNET_BUFFER NdisAllocateNetBuffer( NDIS_HANDLE PoolHandle, PMDL MdlChain, ULONG DataOffset, SIZE_T DataLength );
A pointer to an MDL chain that NDIS uses to initialize the new NET_BUFFER structure. MdlChain can be NULL.
The initial offset, in bytes, from the start of the buffer to the start of the used data space in the MDL chain. Data space ahead of this offset is unused data space. Therefore, this value also represents the initial amount of available backfill space in the MDL chain. If MdlChain is NULL, DataOffset must be 0.
The length of the used data space, in bytes, in the MDL chain. If MdlChain is NULL, DataLength must be 0.
NdisAllocateNetBuffer returns a pointer to the NET_BUFFER structure that NDIS allocated. If the allocation was unsuccessful, this pointer is NULL.
For example, if the original MDL chain contains X DataLength and Y DataOffset, and CurrentMdl starts with the second MDL (M) in the original MDL chain, CurrentMdlOffset is Z. The MdlChain field in NET_BUFFER_DATA then needs to point to a new MDL chain that contains X' DataLength and Y' DataOffset. If CurrentMdl starts with the third MDL (M') in the new MDL chain, CurrentMdlOffset is Z', and the following macros need to be used to set fields in NET_BUFFER:
NET_BUFFER_FIRST_MDL(_NB) = New MDL chain; NET_BUFFER_DATA_LENGTH(_NB) = X'; NET_BUFFER_DATA_OFFSET(_NB) = Y'; NET_BUFFER_CURRENT_MDL(_NB) = M'; NET_BUFFER_CURRENT_MDL_OFFSET(_NB) = Z';
|Minimum supported client||Supported in NDIS 6.0 and later.|
|Header||ndis.h (include Ndis.h)|
|DDI compliance rules||Irql_NetBuffer_Function, NdisAllocateNetBuffer|