Jinoh Kang (@iamahuman) commented about include/wine/test_fw.h:
- WINETEST_FW_APP_ADD,
- WINETEST_FW_APP_REMOVE
+};
+static BOOL winetest_set_firewall( const WCHAR *name, enum winetest_firewall_op op ) +{
- HRESULT hr, init;
- INetFwMgr *mgr = NULL;
- INetFwPolicy *policy = NULL;
- INetFwProfile *profile = NULL;
- INetFwAuthorizedApplication *app = NULL;
- INetFwAuthorizedApplications *apps = NULL;
- BSTR str, image = SysAllocStringLen( NULL, MAX_PATH );
- if (!winetest_is_process_elevated()) return FALSE;
- if (!winetest_is_firewall_enabled()) return TRUE;
The order of tests are swapped.
```suggestion:-1+0 if (!winetest_is_firewall_enabled()) return TRUE; if (!winetest_is_process_elevated()) return FALSE; ```
That said, is the process elevation check still needed? If accessing NetFw APIs causes Windows to show a warning dialog or has other undesirable side effects, that should certainly be avoided. Otherwise, we could just use the "ask for forgiveness, not permission" approach, since we no longer have `ok()` tests for calls anymore.