Share via


FwpmBfeStateSubscribeChanges0 (Compact 7)

3/12/2014

This function registers a callback function that is called whenever there is a change to the state of the WFP Filter Engine.

Syntax

NTSTATUS NTAPI
  FwpmBfeStateSubscribeChanges0(
    IN OUT void  *deviceObject,
    IN FWPM_SERVICE_STATE_CHANGE_CALLBACK0  callback,
    IN OPTIONAL void  *context,
    OUT HANDLE  *changeHandle
    );

Parameters

  • deviceObject
    A pointer to a device object that was previously created by the callout driver.
  • callback
    A pointer to a callout driver-provided service state change callback function. The filter engine calls this function when there is a change in the state of the filter engine.

    Note

    For information on declaring a service state change callback, see the Remarks section below.

  • context
    A pointer to a callout driver-provided context that is passed to the callback function specified in the callback parameter.
  • changeHandle
    A pointer to a variable that receives a handle that is associated with the registration of the callback function. A callout driver passes this handle to the FwpmBfeStateUnsubscribeChanges0 function to unregister the callback function.

Return Value

The FwpmBfeStateSubscribeChanges0 function returns one of the following NTSTATUS codes:

Value Description

STATUS_SUCCESS

The callback function was successfully registered.

Other status codes

An error occurred.

Remarks

A callout driver calls the FwpmBfeStateSubscribeChanges0 function to register a callback function that is called whenever there is a change to the state of the filter engine. A callout driver cannot open a session to the filter engine unless the filter engine is currently running. A callout driver can use the FWPM_SERVICE_RUNNING notification to open a session to the filter engine so that it can make calls to the other WFP management functions. Similarly, a callout driver can use the FWPM_SERVICE_STOP_PENDING notification to perform any cleanup before the filter engine is stopped.

A callout driver can retrieve the current state of the filter engine at any time by calling the FwpmBfeStateGet0 function.

A callout driver must unregister the callback function by calling the FwpmBfeStateUnsubscribeChanges0 function before the callout driver can be unloaded.

A service state change callback function is declared as follows:

VOID NTAPI
  callback(
    IN OUT void  *context,
    IN FWPM_SERVICE_STATE  newState
    );
  • context
    The pointer that was passed in the context parameter when the callout driver called the FwpmBfeStateSubscribeChanges0 function.
  • newState
    The new state of the filter engine. This parameter contains one of the following values:

    FWPM_SERVICE_STOPPED

    The filter engine is not running.

    FWPM_SERVICE_START_PENDING

    The filter engine is starting.

    FWPM_SERVICE_STOP_PENDING

    The filter engine is stopping.

    FWPM_SERVICE_RUNNING

    The filter engine is running.

Requirements

Header

fwpmk.h

See Also

Reference

Functions Called by Callout Drivers
FwpmBfeStateGet0
FwpmBfeStateUnsubscribeChanges0
WFP Callout Driver Functions