加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

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

发布时间:2020-12-15 10:18:52 所属栏目:大数据 来源:网络整理
导读:我注意到以下现象: 使用Delphi 7构建的可执行文件,其中包括“Update”(例如“UpdateMyApp.exe”)的名称的一部分使UAC能够显示“您是否允许程序更改您的计算机”的警告。 这是一个简单的hello world应用程序。在资源管理器中显示文件显示覆盖到应用程序图标
我注意到以下现象:

使用Delphi 7构建的可执行文件,其中包括“Update”(例如“UpdateMyApp.exe”)的名称的一部分使UAC能够显示“您是否允许程序更改您的计算机”的警告。

这是一个简单的hello world应用程序。在资源管理器中显示文件显示覆盖到应用程序图标的屏蔽符号。

一旦你重命名exe,屏蔽消失,应用程序开始没有警告。

如上所述,只有在使用Delphi 7构建的程序中才会发生,并在Windows 7上启动(我在Vista上假设相同),而不是在例如WinXP。

Delphi 2007快速检查显示,这个问题已经消失了。

有趣…可怕…

除了重命名文件,我该怎么办以防止这种情况?

解决方法

这是因为默认情况下使用Delphi 7生成的应用程序没有清单,或者没有 requestedExecutionLevel属性的应用程序。因为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键来显示一个清单。

这是由delphi 2007创建的示例清单。您可以看到此清单在内容中具有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>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读