Guidelines for Working with Multiple Profiles
The following list includes best practices that will help you avoid common errors when working with multiple profiles.
- Always assume that more than one firewall profile could be active at a given time.
- Do not pass a bitmask returned by get_CurrentProfileTypes() to a function such as put_FirewallEnabled() which does not support bitmask.
- Do not try to compare the bitmask returned by get_CurrentProfileTypes() to a specific profile value.
- Do not cast the bitmask by get_CurrentProfileTypes() to the enumerated type NET_FW_PROFILE_TYPE2.
- Make sure to properly handle S_FALSE as a possible return value from functions such as LocalPolicyModifyState(), get_IsRuleGroupCurrentlyEnabled(), and IsRuleGroupEnabled().
For an example that illustrates working with multiple profiles, see Working with Multiple Profiles.