32位的Go二进制文件需要特权升级,而64位的则不需要。

huangapple go评论96阅读模式
英文:

32 bit Go Binary requires privilege escalation, 64 bit does not

问题

使用GoLang 1.7.4,我正在为我的应用程序构建一个目标为windows/amd64的二进制文件。这个二进制文件构建得很好,当运行时,不会出现UAC提示来进行权限提升。

我切换到为windows/386构建二进制文件,但是当构建二进制文件时,现在需要权限提升。更奇怪的是,如果我使用不同的名称构建windows/386的二进制文件,它就不需要提升权限就可以运行,但是一旦我将二进制文件重新命名为通常构建的名称(在Windows资源管理器中进行重命名),它突然又需要提升权限了。

所有这些都是在Windows 10 64位机器上完成的,对于到底发生了什么,有什么想法吗?

英文:

Using GoLang 1.7.4, I was building a binary for my application with the target being windows/amd64, This binary built fine and when ran, did not cause a UAC prompt to appear for privilege escalation.

I switched to building the binary for windows/386, however when the binary is built it now requires privilege escalation, to make it even stranger, if I build the binary for windows/386 using a different name, it does not require escalated privileges to run, however as soon as I rename the binary to the name it is usually built as ( rename is done in Windows Explorer) , it suddenly requires escalated privileges again.

All this was being done on a Windows 10 64 bit machine, any ideas to what exactly is going on?

答案1

得分: 4

原来,Windows会根据文件名自动要求应用程序具有提升的权限。它会检查文件名,以确定是否存在安装程序,因此文件名为“Setup”或“Update”等的文件将需要在32位应用程序上具有提升的权限。

英文:

Turns out Windows automatically requires elevated privileges for apps depending on file name. It checks file names to see if there an installer, so files with names such as "Setup" or "Update" will be required to have elevated privledges on a 32 bit application.

huangapple
  • 本文由 发表于 2017年1月18日 02:07:29
  • 转载请务必保留本文链接:https://go.coder-hub.com/41704057.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定