当我的EXE文件名包含单词“ update”时,如何避免UAC? [英] How do I avoid UAC when my EXE file name contains the word "update"?

查看:103
本文介绍了当我的EXE文件名包含单词“ update”时,如何避免UAC?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到以下现象:

使用Delphi 7构建的可执行文件,其名称的一部分包括 Update(例如 UpdateMyApp.exe),导致UAC进入以显示警告,例如您是否要允许程序对计算机进行更改。

An executable built with Delphi 7 and part of the name including "Update" (e.g. "UpdateMyApp.exe") causes UAC to step in to display a warning like "do you want to allow the program to make changes to your computer".

这种情况发生在一个简单的hello world应用程序中。在资源管理器中显示文件后,屏蔽符号将覆盖在应用程序图标上。

This happens with a simple hello world application. Showing the file in explorer shows the shield symbol overlayed to the application icon.

重命名exe后,屏蔽将消失,应用程序启动时不会发出警告。

As soon as you rename the exe the shield disappears and the application starts without warnings.

如上所述,这仅适用于使用Delphi 7构建并在Windows 7上启动的程序(我在Vista上假定相同),但不适用于例如WinXP。

As mentioned this only happens to programs built with Delphi 7 and started on Windows 7 (I assume same on Vista) but not on e.g. WinXP.

对Delphi 2007的快速检查显示此问题已消失。

A quick check with Delphi 2007 shows that this problem is gone.

有趣...令人恐惧...

Funny... scarying...

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

Besides renaming the file, what can I do to prevent this?

推荐答案

这是由于默认情况下使用Delphi 7构建的应用程序没有清单或没有 requestedExecutionLevel 属性。由于该Windows 认为,因此当您的应用程序名称包含诸如 Setup 更新 。此过程称为 安装程序检测技术 ,并与Windows Vista的UAC一起引入。

This behavior is caused because the applications build with Delphi 7 by default does not have a manifest, or have one with no requestedExecutionLevel attribute. Because of that Windows thinks that you need administrator access when your application name contains words like Setup or Update. this process is called Installer Detection Technology and was introduced alongside UAC with Windows Vista.

从MSDN站点:


安装程序检测仅适用于:

Installer Detection only applies to:


  1. 32位可执行文件

  1. 32 bit executables

没有requestExecutionLevel

Applications without a requestedExecutionLevel

以标准用户身份运行的交互式进程的应用程序启用LUA

Interactive processes running as a Standard User with LUA enabled

在创建32位进程之前,请检查
以下属性
以确定它是否是
安装程序:

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


  • 文件名包含诸如安装,设置,更新,

  • 以下版本控制资源字段中的关键字:供应商,
    公司名称,产品名称,文件
    说明,原始文件名,
    输入内部名称和导出名称。

  • 并排嵌入在可执行文件中的清单中的关键字。

  • 链接到的特定StringTable条目中的关键字

  • 链接到可执行文件中的RC数据中的关键属性。

  • 可执行文件中目标字节序列。

  • 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 键。

Moreover Delphi 2007 by default include a manifest in your applications with the requestedExecutionLevel key.

这是由delphi 2007创建的示例清单。您可以看到此清单具有 requestedExecutionLevel 内容中的属性。

This is a sample manifiest created by delphi 2007. You can see that this manifest has the requestedExecutionLevel attribute in the content.

<?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>

这篇关于当我的EXE文件名包含单词“ update”时,如何避免UAC?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆