4.3 Enumerating the Firewall Rules

To enumerate the firewall rules that the server is enforcing in the store, the client calls the RRPC_FWEnumFirewallRules (Opnum 9) method. The protocol sequence that enumerates firewall rules from the policy store is as follows:

Enumerating firewall rules

Figure 4: Enumerating firewall rules

In this case example, the client enumerates rules in the current profile and filters by FW_RULE_STATUS_CLASS_OK and FW_RULE_STATUS_CLASS_PARTIALLY_IGNORED.

 PFW_RULE pRules = NULL;
 DWORD dwNumRules = 0;
  
     DWORD 
     RRPC_FWEnumFirewallRules(
         [in] FW_CONN_HANDLE          rpcConnHandle = rpcBinding ,
         [in] FW_POLICY_STORE_HANDLE  hPolicyStore = hStore, 
         [in] DWORD                   dwFilteredByStatus =
  FW_RULE_STATUS_CLASS_OK | FW_RULE_STATUS_CLASS_PARTIALLY_IGNORED,
         [in] DWORD                   dwProfileFilter = FW_PROFILE_TYPE_CURRENT,
         [in] WORD                    wFlags = 0
         [out, ref] DWORD            *pdwNumRules = &dwNumRules,
         [out] PFW_RULE         *ppRules = &pRules
         );