Compartilhar via


FwpsInjectionHandleCreate0 (Compact 2013)

3/26/2014

This function creates a handle that can be used by packet injection functions to insert packet or stream data into the TCP/IP network stack, and by the FwpsQueryPacketInjectionState0 function to query the packet injection state.

Syntax

NTSTATUS NTAPI
  FwpsInjectionHandleCreate0(
    IN OPTIONAL ADDRESS_FAMILY  addressFamily,
    IN UINT32  flags,
    OUT HANDLE  *injectionHandle
    );

Parameters

  • addressFamily
    The address family for which the injection handle is being created. This can be one of the following address families:

    • AF_INET: The IPv4 address family
    • AF_INET6: The IPv6 address family

    For transport, stream, and forward injections, this parameter is optional and can be set to AF_UNSPEC. This indicates an unspecified address family. This value is defined in Ws2def.h.

  • flags
    Flag value set by a callout driver to indicate the type of data to be injected. This flag can have one or more of the following values:

    FWPS_INJECTION_TYPE_FORWARD

    Packet data is injected by calling the FwpsInjectForwardAsync0 function.

    FWPS_INJECTION_TYPE_NETWORK

    Network data is injected by calling either the FwpsInjectNetworkReceiveAsync0 function or the FwpsInjectNetworkSendAsync0 function.

    FWPS_INJECTION_TYPE_STREAM

    Stream data is injected by calling the FwpsStreamInjectAsync0 function.

    FWPS_INJECTION_TYPE_TRANSPORT

    Transport data is injected by calling either the FwpsInjectTransportReceiveAsync00 function or the FwpsInjectTransportSendAsync0 function.

    To create an injection handle to be used by multiple injection functions, combine the injection type bits with bitwise OR**operations. If the flag value is set to zero, the resulting injection handle can be used for transport, stream, and forward injections.

  • injectionHandle
    A pointer to a variable that receives the handle

Return Value

The FwpInjectionHandleCreate0 function returns one of the following NTSTATUS codes:

Value

Description

STATUS_SUCCESS

The injection handle was successfully created.

STATUS_FWP_TCPIP_NOT_READY

The TCP/IP network stack is not ready. A callout driver should call the FwpInjectionHandleCreate0 function again later

Other status codes

An error occurred.

Remarks

A callout driver calls the FwpInjectionHandleCreate0 function to create a handle that can be used for injecting packet or stream data into the TCP/IP network stack and to query the packet injection state. A callout driver passes the created handle to the packet injection functions and FwpsQueryPacketInjectionState0.

After a callout driver has finished by using an injection handle, it must call the FwpsInjectionHandleDestroy0 function to destroy the handle. If pending injections have not yet completed, this function will wait for their completion before it returns.

When injections are being made to the network layer and both IPv4 and IPv6 address families are being filtered, the callout driver must create two injection handles by calling the FwpInjectionHandleCreate0 function two times: one call with addressFamily set to AF_INET, and a second call with addressFamily set to AF_INET6.

Requirements

Header

fwpsk.h

See Also

Reference

Functions Called by Callout Drivers
FwpsInjectForwardAsync0
FwpsInjectNetworkReceiveAsync0
FwpsInjectNetworkSendAsync0
FwpsStreamInjectAsync0
FwpsInjectTransportReceiveAsync0
FwpsInjectTransportSendAsync0
FwpsInjectionHandleDestroy0
FwpsQueryPacketInjectionState0
WFP Callout Driver Functions