Bewerken

Delen via


FwpsAllocateNetBufferAndNetBufferList0 function (fwpsk.h)

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(
  [in]           NDIS_HANDLE     poolHandle,
  [in]           USHORT          contextSize,
  [in]           USHORT          contextBackFill,
  [in, optional] MDL             *mdlChain,
  [in]           ULONG           dataOffset,
  [in]           SIZE_T          dataLength,
  [out]          NET_BUFFER_LIST **netBufferList
);

Parameters

[in] poolHandle

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

[in] 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.

[in] 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.

[in, optional] 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.

[in] 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.

[in] dataLength

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

[out] 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

Requirement Value
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