UAC thinks my Application is an installer Part 2
I have been trying to deal with the Windows UAC 'feature' that looks for the word 'setup' or 'install' in an application and automatically believes it's an installer.
I tried adding 开发者_如何学Pythona embedded manifest, as suggested in this stackoverflow question, and that fixes my problem on Vista and 7, but breaks my application on Server 2003.
I also tried some fixes I have found on a few other sites. One suggestion I found on Microsoft's site was to use .config, instead of .exe.config. It worked great, but that is not an option as it goes against the convention of all of our other applications.
The other option was to add the assemblyIdentity node to the manfiest. I tryed this and was unable to get this to work.
Below is my manifest as it looks now. Any ideas?
<?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>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="" publicKeyToken="6595b64144ccf1df" language="*"></assemblyIdentity>
</dependentAssembly>
</dependency>
</compatibility>
</assembly>
Note: This is a managed C# application. And the manifest has to be embedded into the executable.
Thanks,
PeteRefer the MSDN documentation, you are very likely to have crafted the manifest incorrectly if this breaks on Server 2003. Unfortunately I've only ever dealt with manifests for native code so I'm not sure where to start for C#
Installer Detection Technology
Installation programs are applications designed to deploy software, and most write to system directories and registry keys. These protected system locations are typically writeable only by an administrator user, which means that standard users do not have sufficient access to install programs. Windows Vista heuristically detects installation programs and requests administrator credentials or approval from the administrator user in order to run with access privileges. Windows Vista also heuristically detects updater and uninstallation programs. Note that a design goal of UAC is to prevent installations from being executed without the user's knowledge and consent since they write to protected areas of the file system and registry.
Installer Detection only applies to:
- bit executables
- Applications without a requestedExecutionLevel
- 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.
You should add <requestedExecutionLevel>
element to your application manifest as described in this article (See section “Building and Embedding a Manifest with Microsoft Visual Studio® 2005 for Windows XP and Windows Vista Applications”; this method will work both in Vista/7 and in XP/2003 server), and set its level
attribute to asInvoker
value.
Thus you'll eliminate the option 2 from the installer detection algorithm quoted in this answer.
精彩评论