Overriding UAC heuristics

x86 programs run in Windows Vista/7/8 might get detected as needing UAC permissions. If they don’t actually need them, it’s possible to override the detection so it stop asking.

The Problem

Programs that require administrator permissions need to elevate via UAC in Windows Vista and later. Older programs aren’t marked as needing UAC, so Microsoft added detection of things that “look like” they might need admin permissions, such as having the words “setup” or “patch”.

This often works, but sometimes programs are “detected” as needing UAC when they don’t actually need it – for example, the Installshield X program for creating installers. Having it prompt for UAC elevation unnecessarily can be annoying, but you can add a manifest to the executable to override the detection.

The Solution

Create a text file called custom.manifest with the contents:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> 
  <!-- Identify the application security requirements. -->
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">

Then use the MT tool to embed that manifest in the executable:

mt.exe -nologo -manifest "program.exe.manifest" -outputresource:"program.exe;#1"

Mt comes with the Microsoft Platform SDK.