gpt4 book ai didi

delphi - 当我的 EXE 文件名包含单词 "update"时,如何避免 UAC?

转载 作者:行者123 更新时间:2023-12-03 14:33:47 25 4
gpt4 key购买 nike

我注意到以下现象:

使用 Delphi 7 构建的可执行文件以及部分名称包含“Update”(例如“UpdateMyApp.exe”)会导致 UAC 介入并显示警告,例如“您是否希望允许程序对您的计算机进行更改” ”。

这发生在一个简单的 hello world 应用程序中。在资源管理器中显示文件会显示覆盖在应用程序图标上的盾牌符号。

一旦您重命名该 exe,屏蔽就会消失,并且应用程序会在没有警告的情况下启动。

如上所述,这只发生在使用 Delphi 7 构建并在 Windows 7 上启动的程序(我假设在 Vista 上也是如此),但在例如 Windows 7 上则不会发生这种情况。 WinXP。

用 Delphi 2007 快速检查表明这个问题已经消失。

有趣...可怕...

除了重命名文件之外,我还能采取什么措施来防止这种情况发生?

最佳答案

导致此行为的原因是默认情况下使用 Delphi 7 构建的应用程序没有 list ,或者没有 list requestedExecutionLevel属性。因此,当您的应用程序名称包含 SetupUpdate 等字词时,Windows认为您需要管理员访问权限>。这个过程称为Installer Detection Technology并与 Windows Vista 一起引入 UAC。

来自 MSDN 站点:

Installer Detection only applies to:

  1. 32 bit executables

  2. Applications without a requestedExecutionLevel

  3. Interactive processes running as a Standard User with LUA enabled

Before a 32 bit process is created, the following attributes are checked to determine whether it is an installer:

  • Filename includes keywords like "install," "setup," "update," etc.
  • Keywords in the following Versioning Resource fields: Vendor, Company Name, Product Name, File Description, Original Filename, Internal Name, and Export Name.
  • Keywords in the side-by-side manifest embedded in the executable.
  • Keywords in specific StringTable entries linked in the executable.
  • Key attributes in the RC data linked in the executable.
  • Targeted sequences of bytes within the executable.

此外,Delphi 2007 默认情况下在您的应用程序中包含一个带有 requestedExecutionLevel 键的 list 。

这是一个由 delphi 2007 创建的示例 list 。您可以看到该 list 的内容中有 requestedExecutionLevel 属性。

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
type="win32"
name="CodeGear RAD Studio"
version="11.0.2902.10471"
processorArchitecture="*"/>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
publicKeyToken="6595b64144ccf1df"
language="*"
processorArchitecture="*"/>
</dependentAssembly>
</dependency>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="asInvoker"
uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>

关于delphi - 当我的 EXE 文件名包含单词 "update"时,如何避免 UAC?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4133337/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com