Tuesday, April 9, 2013

How to debug an unexpected UAC prompt

Recently a self created executable showed the UAC prompt and it wasn't clear why. It sure didn't need administrative privileges. So how to debug this?

Wikipedia tells the UAC prompt can be triggered by:

  • the "Run the program as an administrator" compatibility option. Just check the file properties
  • the executable's manifest: if requestedExecutionLevel is present and is not asInvoker, the UAC prompt is triggered. An external manifest can be just opened with a text viewer. Also check for an embedded manifest: open the executable file in Visual Studio and check the RT_MANIFEST resource. If Visual Studio displays an error message that there are no resources, you are fine. Without resources there is no embedded manifest
  • the UAC heuristic: it checks the file name, the string resources, the manifest for keywords that indicate an installer

In my case it was the UAC heuristic. To be specific, the UAC prompt was triggered by the long and cryptic (and automatically generated) file name. Some sequence in it told UAC that this must be an installer. So renaming the file fixed the problem - no UAC prompt any more.

1 comment:

  1. Thanx - even 3 years old, this info was very helpful

    ReplyDelete