Refactor: use COM API for windows firewall rules#21
Conversation
|
I'll take a look at this later, thanks. |
|
Did you try publishing the app and running it? command: Seems to be not working, crashes. Might not be trim-compatible. |
|
Tested it without trimming and it worked, so its not trim-compatible due to usage of reflection. Without trim, file size is |
|
Can you test this release (v1.0.4) before I merge this PR? Thanks. It references Interop.NetFwTypeLib.dll COM as a regular assembly and used for static types rather than using |
|
Seems to work just fine! Unrelated but I noticed on that build (and probably on the main app) that the "New version available! Go to releases?" window is showing again every time I change the game from the dropdown and it doesn't get dismissed for the session. It spawns again. Unticking the box in the setting makes it completely disappear. |
Thanks! Yeah the version checker relies on Github API. I haven't created a new release so it will check against v1,0,3. |
As discussed in #17, this PR replaces the Windows firewall block/unblock path with direct
HNetCfg.FwPolicy2/HNetCfg.FWRuleCOM calls instead of spawningcmd.exe -> netsh.exeonce per rule.The previous implementation handled each rule change by launching a separate shell process and waiting for it to finish. That makes block/unblock operations unnecessarily slow, especially when switching games or applying many rule changes in a row. See #17 (comment) for the comparison numbers.
Changes
ResetFirewallAsync()onnetsh advfirewall reset(I wasn't able to find an alternative in the COM API)Notes