The FwpmEngineOpen0 function opens a session to the filter engine.
DWORD FwpmEngineOpen0( const wchar_t *serverName, UINT32 authnService, SEC_WINNT_AUTH_IDENTITY_W *authIdentity, const FWPM_SESSION0 *session, HANDLE *engineHandle );
Type: const wchar_t*
This value must be NULL.
Specifies the authentication service to use. Allowed services are RPC_C_AUTHN_WINNT and RPC_C_AUTHN_DEFAULT.
The authentication and authorization credentials for accessing the filter engine. This pointer is optional and can be NULL. If this pointer is NULL, the calling thread's credentials are used.
Session-specific parameters for the session being opened. This pointer is optional and can be NULL.
Handle for the open session to the filter engine.
||The session was started successfully.|
||A session with the specified sessionKey is already opened.|
||A Windows Filtering Platform (WFP) specific error. See WFP Error Codes for details.|
||Failure to communicate with the remote or local firewall engine.|
A user application must call FwpmEngineOpen0 to obtain a handle for open session to the filter engine before adding or removing any filter objects. A handle for an open session to the filter engine is also required for most of the other Windows Filtering Platform management functions.
The session is automatically closed when the program ends. To explicitly close a session, call FwpmEngineClose0.
If session.flags is set to FWPM_SESSION_FLAG_DYNAMIC, any WFP objects added during the session are automatically deleted when the session ends. If the session is not dynamic, the caller needs to explicitly delete all WFP objects added during the session.
FwpmEngineOpen0 is intended for use in non-impersonated mode only.
FwpmEngineOpen0 is a specific implementation of FwpmEngineOpen. See WFP Version-Independent Names and Targeting Specific Versions of Windows for more information.
The following C++ example uses FwpmEngineOpen0 to open a filter session.
// Open a session to the filter engine HANDLE engineHandle = NULL; DWORD result = ERROR_SUCCESS; printf("Opening the filter engine.\n"); result = FwpmEngineOpen0( NULL, RPC_C_AUTHN_WINNT, NULL, NULL, &engineHandle ); if (result != ERROR_SUCCESS) printf("FwpmEngineOpen0 failed. Return value: %d.\n", result); else printf("Filter engine opened successfully.\n");
|Minimum supported client||Windows Vista [desktop apps only]|
|Minimum supported server||Windows Server 2008 [desktop apps only]|