INetFwMgr::IsIcmpTypeAllowed method (netfw.h)

[The Windows Firewall API is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions. For Windows Vista and later, use of the Windows Firewall with Advanced Security API is recommended.]

Determines whether the specified ICMP type is allowed.

Syntax

HRESULT IsIcmpTypeAllowed(
  [in]  NET_FW_IP_VERSION ipVersion,
  [in]  BSTR              localAddress,
  [in]  BYTE              type,
  [out] VARIANT           *allowed,
  [out] VARIANT           *restricted
);

Parameters

[in] ipVersion

IP version of the traffic. This cannot be NET_FW_IP_VERSION_ANY.

IP version of the traffic. This cannot be NET_FW_IP_VERSION_ANY.

[in] localAddress

Either a dotted-decimal IPv4 address or an IPv6 hex address specifying the local address of the traffic. Typically, this is the address passed to bind. If localAddress is NULL, the function determines whether the port is allowed for all interfaces.

[in] type

ICMP type. For a list of possible ICMP types, see ICMP Type Numbers.

[out] allowed

Indicates by a value of VARIANT_TRUE or VARIANT_FALSE whether the port is allowed for at least some local interfaces and remote addresses.

[out] restricted

Indicates by a value of VARIANT_TRUE or VARIANT_FALSE whether some local interfaces or remote addresses are blocked for this port. For example, if the port is restricted to the local subnet only.

Return value

C++

Return code Description
E_ACCESSDENIED
The operation was stopped because of permissions issues.
E_INVALIDARG
The method failed because a parameter was not valid.
E_OUTOFMEMORY
The method was unable to allocate required memory.
E_POINTER
The method failed because a pointer was not valid.
 

VB

If the method succeeds the return value is S_OK.

If the method fails, the return value is one of the following error codes.

Return code Description
E_ACCESSDENIED
The operation was stopped because of permissions issues.
E_INVALIDARG
The method failed because a parameter was not valid.
E_OUTOFMEMORY
The method was unable to allocate required memory.
E_POINTER
The method failed because a pointer was not valid.

Remarks

The INetFwPolicy2::IsRuleGroupEnabled method is generally recommended in place of this method.

Requirements

Requirement Value
Minimum supported client Windows Vista, Windows XP with SP2 [desktop apps only]
Minimum supported server Windows Server 2003 with SP1 [desktop apps only]
Target Platform Windows
Header netfw.h
DLL FirewallAPI.dll; Hnetcfg.dll on Windows XP with SP2

See also

INetFwMgr

NET_FW_IP_VERSION