FwpmSystemPortsUnsubscribe0 function (fwpmu.h)

The FwpmSystemPortsUnsubscribe0 function is used to cancel a system port subscription and stop receiving notifications.

Syntax

DWORD FwpmSystemPortsUnsubscribe0(
  [in, optional] HANDLE engineHandle,
  [in, out]      HANDLE sysPortsHandle
);

Parameters

[in, optional] engineHandle

Type: HANDLE

Handle for an open session to the filter engine. Call FwpmEngineOpen0 to open a session to the filter engine.

[in, out] sysPortsHandle

Type: HANDLE

Handle of the subscribed system port notification. This is the returned handle from the call to FwpmSystemPortsSubscribe0.

Return value

Type: DWORD

Return code/value Description
ERROR_SUCCESS
0
The subscription was deleted successfully.
FWP_E_* error code
0x80320001—0x80320039
A Windows Filtering Platform (WFP) specific error. See WFP Error Codes for details.
RPC_* error code
0x80010001—0x80010122
Failure to communicate with the remote or local firewall engine.

Remarks

Unsubscribing with an invalid object handle will result in a return value of ERROR_SUCCESS, but the actual subscription will persist until the unsubscribe API is called with valid parameters.

If the callback is currently being invoked, this function will not return until it completes. Thus, when calling this function, you must not hold any locks that the callback may also try to acquire lest you deadlock.

It is not necessary to unsubscribe before closing a session; all subscriptions are automatically canceled when the subscribing session terminates.

This function cannot be called from within a transaction. It will fail with FWP_E_TXN_IN_PROGRESS. See Object Management for more information about transactions.

FwpmSystemPortsUnsubscribe0 is a specific implementation of FwpmSystemPortsUnsubscribe. See WFP Version-Independent Names and Targeting Specific Versions of Windows for more information.

Requirements

Requirement Value
Minimum supported client Windows 7 [desktop apps only]
Minimum supported server Windows Server 2008 R2 [desktop apps only]
Target Platform Windows
Header fwpmu.h
Library Fwpuclnt.lib
DLL Fwpuclnt.dll

See also

FwpmSystemPortsSubscribe0