delphi – 当我的EXE文件名包含单词“update”时,如何避免UAC?
我注意到以下现象:
使用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网站:
此外,默认情况下,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> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |