Fix. Msi, firewall outbound profile (#7704)
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
parent
8231d07706
commit
24ea55b010
@ -272,26 +272,9 @@ HRESULT AddFirewallRuleWithEdgeTraversal(
|
|||||||
goto Cleanup;
|
goto Cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in) {
|
// If you want the rule to avoid public, you can refer to
|
||||||
CurrentProfilesBitMask = NET_FW_PROFILE2_ALL;
|
// https://learn.microsoft.com/en-us/previous-versions/windows/desktop/ics/c-adding-an-outbound-rule
|
||||||
}
|
CurrentProfilesBitMask = NET_FW_PROFILE2_ALL;
|
||||||
else {
|
|
||||||
// Retrieve Current Profiles bitmask
|
|
||||||
hr = pNetFwPolicy2->get_CurrentProfileTypes(&CurrentProfilesBitMask);
|
|
||||||
if (FAILED(hr))
|
|
||||||
{
|
|
||||||
printf("get_CurrentProfileTypes failed: 0x%08lx\n", hr);
|
|
||||||
goto Cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
// When possible we avoid adding firewall rules to the Public profile.
|
|
||||||
// If Public is currently active and it is not the only active profile, we remove it from the bitmask
|
|
||||||
if ((CurrentProfilesBitMask & NET_FW_PROFILE2_PUBLIC) &&
|
|
||||||
(CurrentProfilesBitMask != NET_FW_PROFILE2_PUBLIC))
|
|
||||||
{
|
|
||||||
CurrentProfilesBitMask ^= NET_FW_PROFILE2_PUBLIC;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
hr = pNetFwRule->put_Direction(in ? NET_FW_RULE_DIR_IN : NET_FW_RULE_DIR_OUT);
|
hr = pNetFwRule->put_Direction(in ? NET_FW_RULE_DIR_IN : NET_FW_RULE_DIR_OUT);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user