How to prevent Vista from requiring elevation on patch.exe?

The problem is that your application does not contain an assembly manifest with a requestedExectutionLevel.

Background

All correctly written Windows applications are required to have an assembly manifest. And starting in 2006 one of the elements you’re required to have is a requestedExecutionLevel that specifies if your application can only function if the user is an administrator.

If your application does not have an assembly manifest, or if it does not have a requestedExecutionLevel Windows will assume it is a legacy application, and do things to hopefully keep it running.

One compatibility thing for legacy applications is that some of them might be an installer, or an udpater, and can only function when run as administrator. Windows tries to guess these applications by their filenames:

  • setup
  • update
  • patch

Are all examples of filenames caught by compatibility heuristics that are trying to automatically elevate for the user.

If the application has no assembly manifest, then it is not a validly written Windows application.

The correct solution

The correct solution is to add the assembly manifest that all correct applications will have. This disabled the heuristics.

A sample UAC “asInvoker” manifest:

<?xml version="1.0" encoding="utf-8"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
   <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
      <security>
         <requestedPrivileges>
            <requestedExecutionLevel level="asInvoker" />
         </requestedPrivileges>
      </security>
   </trustInfo>
</assembly> 

Leave a Comment