如何以编程方式在Windows 7和Vista中为本机C ++应用程序禁用程序兼容性助手? [英] How to programmatically disable Program Compatibility Assistant in Windows 7 and Vista for a native C++ application?

查看:206
本文介绍了如何以编程方式在Windows 7和Vista中为本机C ++应用程序禁用程序兼容性助手?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用C ++ / ATL构建的自定义安装程序。该应用程序的目标平台是XP3,VS解决方案由静态lib和exe项目组成。总是要以高权限启动该应用程序,例如,以管理员身份启动

I have a custom installer application built with C++/ATL. The application's target platform is XP3, VS solution consists of static lib and exe projects. The application always to be started elevated, i.e. as Administrator

当我从Visual Studio中运行它(VS本身以管理员身份启动)时,一切都很好,PCA从不显示。当我在资源管理器的同一台计算机上运行它时,也永远不会显示PCA。

When I run it from Visual Studio (VS itself is started as Administrator) then everything is fine, PCA is never shown. When I run it on the same machine from Explorer then PCA is also never shown.

但是,当我在新的Windows 7计算机上运行时,总是显示PCA,

However, when I run it on a fresh Windows 7 machine then PCA is always shown, no matter if I start it from elevated or non-elevated Explorer.

项目属性中与清单相关的部分设置如下: http://screencast.com/t/70GOcbf243

Manifest-related section in project properties is set like this: http://screencast.com/t/70GOcbf243

我该怎么做摆脱第二台计算机上的PCA?
谢谢!

What do I do in order to get rid of PCA on the second machine? Thank you!

推荐答案

我认为您应该重命名应用程序。有一些强制使用PCA的硬编码名称,例如:

I think you should rename your application. There are some hard-coded names which forces the PCA... like:


  • 产品名称包含 instal 设置更新

  • 公司名称包含 安装设置更新

  • 内部名称包含 安装,且应用未命名为 TrustedInstaller.exe

  • 原始文件名包含 instal ,应用未命名为 TrustedInstaller.exe

  • 文件描述包含 instal 和应用未命名为 TrustedInstaller.exe

  • 文件名包含 instal 且未命名为 TrustedInstaller.exe
  • 导出名称包含 setup.exe或 install.exe或 stub32或 stub32.exe或 signstub.exe

  • 文件名包含 补丁设置未安装更新或 lhaca * .exe

  • 文件描述包含 安装设置更新不inst

  • 原始文件名包含 设置更新

  • 原始文件名包含 设置更新

  • Productname contains "instal" or "setup" or "update"
  • Companyname contains "instal" or "setup" or "update"
  • Internalname contains "instal" and app is not named "TrustedInstaller.exe"
  • Originalfilename contains "instal" and app is not named "TrustedInstaller.exe"
  • Filedescription contains "instal" and app is not named "TrustedInstaller.exe"
  • Filename contains "instal" and is not named "TrustedInstaller.exe"
  • Exportname contains "setup.exe" or "install.exe" or "stub32″ or "stub32.exe" or "signstub.exe"
  • Filename contains "patch" or "setup" or "uninst" or "update" or "lhaca*.exe"
  • Filedescription contains "instal" or "setup" or "update" or "uninst"
  • Originalfilename contains "setup" or "update"
  • Originalfilename contains "setup" or "update"

另请参见: 没有警告对话框的自定义安装程序…(TrustedInstaller .exe)

作为替代方案,您可以在应用程序清单中添加OS兼容性部分以防止PCA。将以下内容添加到您的应用清单中:

As an alternativ, you can add the OS compatibility section in your application manifest to prevent the PCA. Ad the following to your application manifest:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> 
  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> 
    <application> 
      <!--The ID below indicates application support for Windows Vista --> 
      <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/> 
      <!--The ID below indicates application support for Windows 7 --> 
      <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/> 
    </application> 
  </compatibility>
</assembly>

有关更多信息,另请参见应用清单

For more info, see also Application Manifest

这篇关于如何以编程方式在Windows 7和Vista中为本机C ++应用程序禁用程序兼容性助手?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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