IFWXSession::SetDataFilterFactory method

Applies to: desktop apps only

The SetDataFilterFactory method allows a filter to set a data filter factory for events for which the filter is not registered. This method can be used to reduce the number of events for which a filter registers.


HRESULT SetDataFilterFactory(
  FwxFirewallEventType eProxyEvent,
  [in]   LPSOCKADDR Address,
  [in]   DWORD AddressLength,
  [in]   IClassFactory *pIClassFactory,
  [in]   FwxDataFilterPriorityClass PriorityClass,
  [in]   IUnknown *punkFilterContext,
  DWORD dwFlags,
  [out]  IFWXFirewallAction **ppFirewallAction


  • eProxyEvent
    The type of event for which the data filter factory is set. Can have a value from the FwxFirewallEventType enumerated type.

  • Address [in]
    Pointer to a sockaddr structure that contains the address and port for events which should cause a data filter to be instantiated and attached. If eProxyEvent is fwx_Connect_Tcp or fwx_Udp_Destination, the address is the remote address. If eProxyEvent is fwx_Bind_Udp or fwx_AcceptedConnection, the address is the bind address. The address must be of type AF_INET, and can be either a specific IP address or INADDR_ANY.

  • AddressLength [in]
    Length, in bytes, of the structure pointed to by the Address parameter.

  • pIClassFactory [in]
    Pointer to a class factory for objects that support the IFWXDataFilter interface.

  • PriorityClass [in]
    Priority class in which the data filter created will be attached. This is a value from the FwxDataFilterPriorityClass enumerated type.

  • punkFilterContext [in]
    Pointer to an optional interface that can be used to pass context information to the data filter. This interface will be passed to IFWXDataFilter::SetSockets. This parameter can be NULL.

  • dwFlags
    Specifies the flags for the call. Any combination of the following values is acceptable for the dwFlags parameter.

    Value Meaning

    The connection for which the data filter is needed may be created by a different process by using the same address.


  • ppFirewallAction [out]
    Address of a buffer that received a pointer to the IFWXFirewallAction interface on the proxy action object created as a result of this call. This parameter can be NULL.

Return value

This method returns S_OK if the call is successful; otherwise, it returns an error code.


This method is an alternative to registering to the corresponding event, comparing the address, and calling IFWXConnection::AttachDataFilter. The Microsoft Firewall service creates a data filter by using the COM IClassFactory interface, when the specified event is detected. The data filter is then attached to the appropriate connection.


Minimum supported client

None supported

Minimum supported server

Windows Server 2008 R2, Windows Server 2008 with SP2 (64-bit only)


Forefront Threat Management Gateway (TMG) 2010





See also




Build date: 7/12/2010