How to prevent the Program Compatibility Assistant from appearing on Windows Vista

收藏自:http://blogs.msdn.com/astebner/archive/2007/05/17/2705372.aspx

+http://www.debugman.com/simple/index.php?t325.html

How to prevent the Program Compatibility Assistant from appearing on Windows Vista

While researching the root cause of the issue that can cause a Windows XP SP2 block dialog to appear when trying to install the .NET Framework 3.5 beta 1 on Windows Vista (described in more detail in this blog post ), I learned some useful information about the Program Compatibility Assistant (PCA) that I wanted to summarize here.

What kinds of applications are affected by the Program Compatibility Assistant?

The Program Compatibility Assistant monitors setup applications that it detects are not Windows Vista-aware.  The PCA uses a list of well-known names such as setup.exe, install.exe, etc to try to decide whether or not an application is a setup.  The PCA treats all setup applications that do not have an embedded manifest that specifies a requested execution level (asInvoker, highestAvailable or requireAdministrator).

In the case of the .NET Framework 3.5 beta 1, the setup package did not include an embedded manifest specifying a requested execution level, and it was named dotnetfx35setup.exe, which triggers the Windows Vista legacy setup application detection logic.

When does the Program Compatibility Assistant appear?

Once the Program Compatibility Assistant identifies a non-Windows Vista-aware setup application, it will monitor the Programs and Features control panel (previously known as Add/Remove Programs).  If an entry is not created or removed from the Programs and Features control panel, then the PCA treats the process as a failed setup and displays a dialog after the setup process exits that asks if the user wants to attempt to re-install using recommended settings.  In this case, using recommended settings will cause Windows Vista to re-run the setup using Windows XP SP2 compatibility mode.

In the case of the .NET Framework 3.5 beta 1, because the setup application is treated as a non-Windows Vista-aware setup, whenever it returns without creating or removing a Programs and Features control panel entry, the PCA dialog will appear (even if you simply launch setup and cancel on the End User License Agreement page).

How can I opt out of the Program Compatibility Assistant for my setup?

In order to prevent the Program Compatibility Assistant from appearing, you must include an embedded manifest that specifies a requested execution level for your setup executable.  If you wrap the setup executable in a self-extracting package, you must also include an embedded manifest in the self-extracting package too.  Once you do this, Windows Vista will treat your setup as Windows Vista-aware, and it will no longer show the PCA dialog when setup exits after a failure or cancellation.

Where can I find more detailed documentation?

For more detailed information about the Program Compatibility Assistant, I encourage you to check out the following resources:

Published Thursday, May 17, 2007 9:14 PM by astebner

Comments

Friday, May 18, 2007 3:19 AM by symkt

# re: How to prevent the Program Compatibility Assistant from appearing on Windows Vista

Does PCA's detection of Vista-Awareness depend on whether or not UAC is ON/OFF?

I ask this because I have a setup executable that indeed has a manifest specifying 'requireAdministrator'. When canceling out of my setup, the PCA dialog will appear only when UAC is off. And my manifest should be well-formed, since it invokes a UAC dialog upon launch when UAC is on.

Any tips as to how to prevent the PCA dialog from showing up with UAC off?

Wednesday, May 23, 2007 1:22 PM by astebner

# re: How to prevent the Program Compatibility Assistant from appearing on Windows Vista

Hi Symkt - I haven't heard of this issue until now.  Would it be possible for you to zip and send me your setup.exe so I could take a look at this in more detail?  You can send it to Aaron.Stebner (at) microsoft (dot) com.

Saturday, May 26, 2007 5:09 PM by bp9129

# re: How to prevent the Program Compatibility Assistant from appearing on Windows Vista

Hi, I'm trying to downgrade vista to XP pro sp2, but whenever i click install in the windows xp install menu, that damn program compatibility assistant pops and disallows it. Could you help me out?

Sunday, May 27, 2007 10:30 PM by astebner

# re: How to prevent the Program Compatibility Assistant from appearing on Windows Vista

Hi Bp9129 - I haven't tried to install Windows XP from within Windows Vista before, so I don't know for sure if that is expected to work.  Can you try to boot from your Windows XP CD and install from there instead of running it from within Windows Vista?

Thursday, August 02, 2007 6:21 PM by Aaron Stebner's WebLog

# What to do if VS 2008 or .NET Framework 3.5 beta 2 asks for Windows XP SP2 on Windows Vista

I previously posted a description of a bug in VS 2008 beta 1 and .NET Framework 3.5 beta 1 setup that

Thursday, August 02, 2007 7:05 PM by Noticias externas

# What to do if VS 2008 or .NET Framework 3.5 beta 2 asks for Windows XP SP2 on Windows Vista

I previously posted a description of a bug in VS 2008 beta 1 and .NET Framework 3.5 beta 1 setup that

Tuesday, October 16, 2007 12:17 AM by Aaron Stebner's WebLog

# Narrowing down odd behavior in the Program Compatibility Assistant on Windows Vista

Recently, a fellow Microsoft employee found this blog post that I wrote a while back, and he contacted

# MSDN Blog Postings » Narrowing down odd behavior in the Program Compatibility Assistant on Windows Vista

PingBack from http://msdnrss.thecoderblogs.com/2007/10/16/narrowing-down-odd-behavior-in-the-program-compatibility-assistant-on-windows-vista/

 

 

VC編譯出來的應用程序在vista下運行,有可能因爲權限問題,不能成功運行。

用以下辦法,給應用程序添加一個manifest文件,程序運行時系統就會跳出UAC對話框,獲得管理權限。

1.打開應用程序的源代碼工程

2.添加一個“custom”資源,"resource type"填24,把資源ID改爲1,然後把以下內容複製到資源內容中保存

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
  version="1.0.0.0"
  processorArchitecture="X86"
  name="mulitray.exe.manifest"
  type="win32"
/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
  <security>
    <requestedPrivileges>
        <requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
    </requestedPrivileges>
  </security>
</trustInfo>
</assembly>

3.重新編譯應用程序,此時會發現,廣用程序的圖標在vista下會多出一個小盾標誌。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章