How to prevent uninstaller elevating for Standard Windows 10 user?

断了今生、忘了曾经 提交于 2019-11-27 05:59:02

问题


We have an x86 Win32 desktop application. When the installer is run by a Standard (non-Admin) user, we avoid elevating and/or showing a UAC prompt and install under C:\Users\username\AppData\Roaming\... instead of the common Program Files directory.

On Windows 10, when our uninstaller is launched from Control Panel -> Programs -> Programs and Features, no UAC prompt is shown and the uninstaller runs without elevating. This is the desired behaviour. When the same uninstaller is launched from Start -> Settings -> System -> Apps & features, a UAC prompt is shown.

(The same behaviour can be seen in the Opera browser installer/uninstaller. I tested v35.0.2066.37.)

Why does the same uninstaller behave differently when launched from Apps & features versus Programs and Features?

How can the UAC prompt be avoided when the uninstaller is launched from Apps & features?

The manifest of our uninstaller includes this:

<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
   <security>
      <requestedPrivileges>
         <requestedExecutionLevel level="asInvoker" />
      </requestedPrivileges>
   </security>
</trustInfo>

I tried changing the requestedExecutionLevel, and also tried removing trustInfo completely, but there was no change in behaviour either way.

Tested on Windows 10 version 1511 build 10586.104.

Edit: Just to clarify, the case I'm trying to handle is where the user has a Standard account and does not know the password of an Admin account. If they see a UAC prompt when they try to uninstall, they have no choice but to cancel it, and our uninstaller does not get run.


回答1:


This is a bug in "Apps & features" as far as I know. The WiX people have closed this issue as a Windows bug and I assume they have notified the correct people @ Microsoft. The behavior is still the same in Insider build 15042 though so it is probably not going to get fixed in time for the Creators Update.

There is no workaround you can use if the standard user cannot elevate.

If they can elevate then you can use the re-spawn workaround posted in the comments or manually load the user profile and call RegOverridePredefKey but they are both ugly hacks (IMHO).



来源:https://stackoverflow.com/questions/35469595/how-to-prevent-uninstaller-elevating-for-standard-windows-10-user

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!