如何在Windows防火墙中编程确定规则是否是预定的?
当我几乎完成写作时但是我决定将其发布到无论如何,因为它仍然对别人有用。
促使我问这个问题的原因是我想确定预定义 /内置 /默认的防火墙规则,即那些表明黄色横幅说“这是一个预定义的规则,其某些属性无法修改)。 。”当您在Windows Firewall UI中调用它们时。 When I stumbled across HKLM\SYSTEM\CurrentControlSet\Services\SharedAccess\Defaults\FirewallPolicy\FirewallRules
I thought I had found my solution only to then realize that the INetFw*
-APIs到目前为止,我一直在使用我无法明确地将这些规则与我已经获得的规则匹配。同样,依靠注册表内部列表无论如何似乎都是一个非常好的长期战略……
因此,是否有使用任何API来识别这些预定义规则的“官方”(或至少是一种更可持续的)方法(最好是<<代码> inetfw*,但不限于它)?
When I was almost done writing How to unambiguously identify rules returned from INetFwRules? I realized that I was probably asking the wrong question, but I decided to post that one anyway because it still might be useful to someone else.
What prompted me to ask that question however was that I would like to identify firewall rules that are predefined / built-in / default, i.e. the ones that show that yellow banner saying "This is a predefined rule and some of its properties cannot be modified." when you call them up in the Windows Firewall UI. When I stumbled across HKLM\SYSTEM\CurrentControlSet\Services\SharedAccess\Defaults\FirewallPolicy\FirewallRules
I thought I had found my solution only to then realize that the INetFw*
-APIs I had been using so far offered me no way to unambiguously match those rules to what I already got. Also, relying on registry internals does not necessarily seem like a very good long-term strategy anyway...
So, is there an "official" (or at least a more sustainable) way to identify these predefined rules using any API (preferably INetFw*
but not limited to it)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论