Expand Minimize

FwpsInjectionHandleCreate0 function

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

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

Syntax


NTSTATUS NTAPI FwpsInjectionHandleCreate0(
  _In_opt_  ADDRESS_FAMILY addressFamily,
  _In_      UINT32 flags,
  _Out_     HANDLE *injectionHandle
);

Parameters

addressFamily [in, optional]

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

AF_UNSPEC

The address family is unspecified.

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, which indicates an unspecified address family. This value is defined in Ws2def.h.

flags [in]

A 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 will be injected by calling the FwpsInjectForwardAsync0 function.

FWPS_INJECTION_TYPE_NETWORK

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

FWPS_INJECTION_TYPE_STREAM

Stream data will be injected by calling the FwpsStreamInjectAsync0 function.

FWPS_INJECTION_TYPE_TRANSPORT

Transport data will be injected by calling either the FwpsInjectTransportReceiveAsync0 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 [out]

A pointer to a variable that receives the handle.

Return value

The FwpsInjectionHandleCreate0 function returns one of the following NTSTATUS codes.

Return codeDescription
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 FwpsInjectionHandleCreate0 function again at a later time to create an injection handle.

Other status codes

An error occurred.

 

Remarks

A callout driver calls the FwpsInjectionHandleCreate0 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 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 returning.

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 FwpsInjectionHandleCreate0 function twice: one call with addressFamily set to AF_INET, and a second call with addressFamily set to AF_INET6.

Requirements

Version

Available starting with Windows Vista.

Header

Fwpsk.h (include Fwpsk.h)

IRQL

PASSIVE_LEVEL

See also

FwpsInjectionHandleDestroy0
FwpsQueryPacketInjectionState0
Packet Injection Functions

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft