C# - How to chceck if external firewall is enabled?

好久不见. 提交于 2019-11-29 12:32:01

For non-Windows firewalls, you can use WMI API to detect the presence of a firewall if it's registered with Windows.

Namespace = "Root\SecurityCenter2"  (might be "Root\SecurityCenter" on pre-vista)
Query = "SELECT * From FirewallProduct"

And you can use this little gem to detect if it's actually on or off.

For Windows Firewall detection, it's INetFwMgr and friends.

Maybe just check if you can establish connection, if you can't - display a message that user should check firewall if it's installed?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!