windowswindows-7windows-7-x64addremoveprograms

UAC in Programs and Features


I have a binary which creates and later removes entries from Program and Features (also comes up in Add/Remove Programs). While I can get UAC permissions when creating the entries, my requirements do not allow me to show a UAC prompt when I need to remove the entries. This makes sense as you should need admin permissions when deleting registry entries from HKLM.

But I have noticed that I am able to uninstall the entries from the Program and Features window without a UAC prompt. How is uninstalling from there, which invokes my binary anyways, different from me invoking my binary directly? Is there some way I can run my binary the same way and avoid the UAC prompt?


Solution

  • By default, UAC gives special treatment to the built-in Windows control panels, allowing them to silently elevate. Because of this, when your uninstaller is launched from Programs and Features it is already elevated and does not need to prompt.

    There is no way to make Windows treat a third-party application in the same way, although the user can change the settings so that all applications elevate silently - or, conversely, so that control panels don't elevate silently.