FirewallCreateRule

This function creates a new firewall rule.

Security Note   The IP Firewall handles fragments in a manner that helps to prevent attacks on the private host stack. Do not add a rule to allow traffic to a host if the host's stack does not support these defense mechanisms. The following list shows these defense mechanisms:

  • If no rule allows traffic to the packet destination, the firewall blocks fragments to that destination.
  • If a fragment contains a transport layer header, the firewall drops the fragment.
DWORD FirewallCreateRule(
  FW_RULE* pRule, 
  BOOL bPersist
);

Parameters

  • pRule
    [out] Pointer to the FW_RULE structure that specifies the rule to create.
  • bPersist
    [in] Specifies whether to save the rule in the registry so that it is preserved when a reboot occurs. TRUE saves the rule, or FALSE does not save the rule.

Return Values

Returns ERROR_SUCCESS if operation succeeds.

Remarks

On success, this function sets HRULE to the rule handle for this new rule.

Requirements

OS Versions: Windows CE .NET 4.2 and later.
Header: Fwapi.h.
Link Library: Fwapi.lib.

See Also

Firewall Functions | System Errors - Alphabetical Order

 Last updated on Tuesday, May 18, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.