Workaround for 'Apps & features' in Windows 10 starting a single-user uninstaller elevated

眉间皱痕 提交于 2020-02-29 05:24:18

问题


When users try to uninstall their own single user installation (for example installed using lowestprivileges none and HKCU entries) with 'Add/Remove Programs' in the Control Panel, everything works fine (that is, non-admin users can uninstall their own non-admin installation).

However the uninstaller will be elevated, when users start it from 'Apps & features' (Windows 10).

This seems to be a known Windows 10 bug:
How to prevent uninstaller elevating for Standard Windows 10 user?

Is there a way to work-around this issue when the Inno Setup uninstaller is started from 'Apps & features'? Link this NSIS Workaround for Windows uninstaller elevation bug.


回答1:


You will have to do exactly what that NSIS hack does.

  1. Find out what is the Windows GUI user (and assume that you should uninstall as that user). Alternatively, you can store the username into some file in the installation folder.

  2. Re-execute the installer as that user. That hack uses StdUtils NSIS plug-in with its ExecShellAsUser function. Maybe the DLL can be used from Inno Setup. If not, you can at least reuse its code.

All this is imo to much to ask in a single question. If you have specific problems, consider asking more specific questions.


Simpler alternative would be to preventing the uninstallation, when executed as different user, and show a suggestion the user to go to Control panel instead.

For a similar question, see Uninstaller trouble with standard Windows user.



来源:https://stackoverflow.com/questions/60075239/workaround-for-apps-features-in-windows-10-starting-a-single-user-uninstalle

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