避免 Windows 防火墙弹出窗口

发布于 2024-09-15 10:44:20 字数 545 浏览 2 评论 0原文

我的组织生产了一套利用网络的 Windows 应用程序,因此当用户第一次运行我们的软件时,Windows 防火墙(如果正在运行)会弹出一个弹出窗口,通知用户我们的应用程序)正在尝试使用网络,提示用户允许或拒绝访问。

许多其他应用程序(例如 Spotify)都会出现这种情况,但我们希望阻止这些弹出窗口的发生,因为它们可能会给我们的用户带来一些问题。某些应用程序(MSN Messenger、GoogeTalk)在运行时不会导致防火墙向用户发出警报,我们也希望这样做。

我们已经在 Windows XP 上成功完成了此操作,方法是让安装程序在以下位置写入适当的注册表项:

HKLM\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\AuthorizedApplications\List

但是,这在 Windows 7 上没有相同的效果- 防火墙弹出窗口仍然出现。

我们有什么想法可以做到这一点吗? (我们的安装程序和软件均经过数字签名。)

谢谢 汤姆·戴维斯

My organisation produces a suite of Windows applications that make use of networking, and so when users run our software for the first time, the Windows Firewall (if it is running) brings up a pop-up, informing the user that our app(s) are trying to use the network, prompting the user to allow or deny access.

This occurs with plenty of other apps (Spotify, to give one example), but ee'd like to prevent these popups from happening, as they can be a bit problematic for our users. Some Applications (MSN Messenger, GoogeTalk) operate without ever causing the Firewall to alert the user, and we'd like to do the same.

We've successfully done this on Windows XP by having our installer write appropriate registry keys at:

HKLM\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\AuthorizedApplications\List

However, this does not have the same effect on Windows 7 - the Firewall popups still take place.

Any ideas how we can do this? (Our installers and software are all digitally signed.)

Thanks
Tom Davies

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

少女七分熟 2024-09-22 10:44:20

您可以通过 shell 向 Windows 内置的实用程序 netsh 添加 Windows 防火墙例外,但该实用程序在 Windows XP 和 Windows 7 上的工作方式不同。以下是我使用的命令:

Windows XP:

添加:
netsh firewall add allowedprogram mode=ENABLE profile=ALL name=[例外名称]program=[程序路径]

删除:
netsh 防火墙删除 allowedprogram profile=ALL 程序=[程序路径]

Windows 7:

添加:
netsh advfirewall 防火墙添加规则操作=允许配置文件=任何协议=任何启用=是方向=[in|out]名称=[异常名称]程序=[程序路径]

删除:
advfirewall防火墙删除规则配置文件=任意名称=[例外名称]

You can add exceptions to Windows Firewall by shelling out to netsh, a utility built into Windows, but the utility works differently on Windows XP and Windows 7. Here are the commands I used:

Windows XP:

add:
netsh firewall add allowedprogram mode=ENABLE profile=ALL name=[exception name] program=[program path]

remove:
netsh firewall delete allowedprogram profile=ALL program=[program path]

Windows 7:

add:
netsh advfirewall firewall add rule action=allow profile=any protocol=any enable=yes direction=[in|out] name=[exception name] program=[program path]

remove:
advfirewall firewall delete rule profile=any name=[exception name]

甚是思念 2024-09-22 10:44:20

实际上,我建议不要将此作为安装程序问题,原因如下:

  • 有多个软件防火墙
    在那里;你无法编码和测试
    对于所有这些。

  • 一些(例如内置窗口
    防火墙)有 API,但不会
    允许您配置端口
    禁用固件时出现异常。
    如果用户稍后启用FW,您
    再次被冲洗。

  • 可能有外部防火墙
    这仍然让你困惑。

相反,我更喜欢将其作为文档工作,以便用户和管理员充分了解网络要求。我曾经不得不谷歌苹果的网站来弄清楚 iTunes 需要哪些端口,我向上帝发誓,他们真的很难找到它,因为他们试图为消费者提供一切便利。

但是,如果您想尽最大努力进行安装,WiX 有一个自定义操作扩展,用于与防火墙交互,而不是编写您自己的自定义操作。即使您正在使用其他工具(例如 InstallShield),您也可以将此行为封装在 WiX 合并模块中,然后使用您选择的主要工具使用它。

您可以在此处阅读相关内容:

Joy Of Setup 博客

WiX 文档

I actually advise against making this an installer issue for several reasons:

  • There are multiple software firewalls
    out there; you can't code and test
    for all of them.

  • Some (such as the built-in windows
    firewall ) have API's that won't
    allow you to configure port
    exceptions when the FW is disabled.
    If the user later enables the FW you
    are hosed again.

  • There could be external firewalls
    that still get you.

Instead I prefer to make this a documentation effort so that users and administrators are fully aware of the networking requirements. I once had to goole Apple's website to figure out what ports iTunes needed and I swear to God they made it really hard to find as they tried to soften everything up for consumers.

However, if you want to give it a best faith effort in the install, WiX has a Custom Action extension for interacting with the firewall rather then writing your own Custom Action. Even if you are using another tool such as InstallShield, you can wrap this behavior up in a WiX merge module and then consume it with your primary tool of choice.

You can read about it here at:

Joy Of Setup Blog

and

WiX Documentation

维持三分热 2024-09-22 10:44:20

在安装程序中(即作为提升的管理员),您需要编写代码来访问 Windows 防火墙 API 并将您的应用添加为例外

In your installer (i.e. as elevated admin), you need to write code to access the Windows Firewall APIs and add your app as an exception

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文