FwpsAllocateNetBufferAndNetBufferList0 function

The FwpsAllocateNetBufferAndNetBufferList0 function allocates a new NET_BUFFER_LIST structure.

Note  FwpsAllocateNetBufferAndNetBufferList0 is a specific version of FwpsAllocateNetBufferAndNetBufferList. See WFP Version-Independent Names and Targeting Specific Versions of Windows for more information.
 

Syntax

NTSTATUS FwpsAllocateNetBufferAndNetBufferList0(
  NDIS_HANDLE     poolHandle,
  USHORT          contextSize,
  USHORT          contextBackFill,
  MDL             *mdlChain,
  ULONG           dataOffset,
  SIZE_T          dataLength,
  NET_BUFFER_LIST **netBufferList
);

Parameters

poolHandle

A NET_BUFFER_LIST pool handle that was obtained from a previous call to the NdisAllocateNetBufferListPool function.

contextSize

The size, in bytes, of used data space in the NET_BUFFER_LIST_CONTEXT structure to reserve for the callout driver. The value of this parameter must be a multiple of the value defined by MEMORY_ALLOCATION_ALIGNMENT.

contextBackFill

The size, in bytes, of unused data space (backfill space) that the callout driver requires. The FwpsAllocateNetBufferAndNetBufferList0 function adds this value to the value specified in the ContextSize parameter and allocates additional space. The value of this parameter must be a multiple of the value defined by MEMORY_ALLOCATION_ALIGNMENT.

mdlChain

A pointer to an MDL chain that is used to initialize the preallocated NET_BUFFER structure. This parameter is optional and can be NULL.

dataOffset

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.

dataLength

The length, in bytes, of the used data space in the MDL chain.

netBufferList

A pointer to a variable that receives a pointer to the new NET_BUFFER_LIST structure.

Return Value

The FwpsAllocateNetBufferAndNetBufferList0 function returns one of the following NTSTATUS codes.

Return code Description
STATUS_SUCCESS
The new NET_BUFFER_LIST structure was successfully allocated.
Other status codes
An error occurred.

Remarks

A callout driver calls the FwpsAllocateNetBufferAndNetBufferList0 function to allocate a new NET_BUFFER_LIST structure.

This function is a wrapper around the NdisAllocateNetBufferAndNetBufferList function, but it is specialized for use by WFP packet injection functions.

After the data described by the new NET_BUFFER_LIST structure has been successfully injected into the network stack, the callout driver frees the new NET_BUFFER_LIST structure by calling the FwpsFreeNetBufferList0 function.

Requirements

   
Minimum supported client Available starting with Windows Vista.
Target Platform Universal
Header fwpsk.h (include Fwpsk.h)
Library Fwpkclnt.lib
IRQL "<= DISPATCH_LEVEL"

See Also

FwpsFreeNetBufferList0

NET_BUFFER_LIST

NET_BUFFER_LIST_CONTEXT

NdisAllocateNetBufferAndNetBufferList NdisAllocateNetBufferListPool

Packet Injection Functions