如何在Windows防火墙中编程确定规则是否是预定的?

发布于 2025-01-28 07:09:20 字数 517 浏览 2 评论 0原文

当我几乎完成写作时但是我决定将其发布到无论如何,因为它仍然对别人有用。

促使我问这个问题的原因是我想确定预定义 /内置 /默认的防火墙规则,即那些表明黄色横幅说“这是一个预定义的规则,其某些属性无法修改)。 。”当您在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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文