NSIS 安装程序要求修改计算机

发布于 2024-10-06 07:44:50 字数 371 浏览 5 评论 0原文

我有一个程序,它解压到 TEMP 目录,自行运行,然后从 TEMP 目录中删除自身。当我使用 NSIS 生成的单文件可执行文件尝试运行时,UAC 会询问:“您想要允许来自未知发布者的以下程序修改您的计算机吗?”

澄清一下:安装程序仅解压到 TEMP 目录,并且包含的​​程序不会触发 UAC。我认为这与 NSIS 所做的事情有关,但我不知道什么或如何阻止它。我已经删除了 NSIS 脚本中的几乎所有行,但它仍然激怒了 UAC。

如果重要的话,我在 Windows 7 上的 python2.5 上使用 py2exe 以及 pymunk 和 pygame 库。 (但同样,它只会在通过 NSIS 运行时触发 UAC。)

我如何让它不触发 UAC 所反对的任何内容?我需要签名密钥吗?

I have a program that unpacks to the TEMP directory, runs itself, then deletes itself from the TEMP directory. When the single-file executable that I generated with NSIS tries to run, UAC asks: "Do you want to allow the following program from an unknown publisher to modify your computer?"

To clarify: the installer only unpacks to the TEMP directory, and the program contained does not trigger UAC. I think it has to do with something NSIS does, but I can't figure out what or how to stop it. I've removed almost all of the lines of my NSIS script, and it still angers UAC.

If it matters, I'm using py2exe on python2.5 on Windows 7 with the pymunk and pygame libraries. (But again, it only triggers UAC when run through NSIS.)

How do I make it not trigger whatever UAC is up in arms about? Do I need a signing key?

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

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

发布评论

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

评论(2

负佳期 2024-10-13 07:44:50

RequestExecutionLevel user

发生这种情况是因为 NSIS 被 Windows(错误地)检测为安装程序这需要管理员权限。 MS 甚至没有询问 NSIS 开发人员就添加了此检测!

您可能想使用 $pluginsdir,它会被 nsis 自动删除:

Section
InitPluginsDir
SetOutPath $pluginsdir
File myapp.exe
ExecWait '"$pluginsdir\myapp.exe"'
SetOutPath $temp ;make sure pluginsdir is not locked
SectionEnd

RequestExecutionLevel user

This happens because NSIS is (wrongly) detected by windows as a installer that requires admin rights. MS added this detection without even asking the NSIS developers!

You might want to use $pluginsdir, it is auto deleted by nsis:

Section
InitPluginsDir
SetOutPath $pluginsdir
File myapp.exe
ExecWait '"$pluginsdir\myapp.exe"'
SetOutPath $temp ;make sure pluginsdir is not locked
SectionEnd
混吃等死 2024-10-13 07:44:50

Windows 有“安装程序检测”启发式方法。您可以通过添加一个清单来抑制它们,该清单可以嵌入到 exe 中,也可以位于其旁边,名为whatever.exe.manifest,上面写着“我不需要提升”。 如何防止 Vista 要求 patch.exe 提升? 是我发现的许多涉及此问题的问题中的第一个。

安装程序检测启发式几乎完全基于文件名,因此如果由于某种原因您不想使用清单,请尝试重命名文件,以免包含字符串 setup、update、patch 等。

Windows has "installer detection" heuristics. You can suppress them by adding a manifest, either embedded in the exe or sitting next to it called whatever.exe.manifest, that says "I don't need to elevate". How to prevent Vista from requiring elevation on patch.exe? is the first of many many questions I found that cover this.

Installer detection heuristics are based almost entirely on the name of the file, so if for some reason you don't want to use a manifest, try renaming the file so as not to include the strings setup, update, patch, and the like.

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