Dynamically choose between per-user and per-machine installation [duplicate]

天涯浪子 提交于 2020-01-03 02:21:57

问题


I'm using Inno Setup to deploy an application.

For most cases, a per-user installation that doesn't require admin privileges is fine. However, there are scenarios where I need to install the app for all users, e.g. for Citrix or TSE.

Unfortunately it doesn't seem possible to choose dynamically between per-user and per-machine install. It depends on the PrivilegesRequired setting, which is set at compile time.

My latest workaround attempt almost got me there. Basically I have a setup with PrivilegesRequired set to lowest, and if I need to install for all users, I restart the setup with admin privileges. This works, BUT the uninstall information is still written to HKEY_CURRENT_USER rather than HKEY_LOCAL_MACHINE.

My questions: - is there a way to achieve dual per-user/per-machine install with Inno Setup? (without generating two different installers) - if not, is there a way to write uninstall info to HKEY_LOCAL_MACHINE when PrivilegesRequired is set to lowest?

EDIT: the accepted answer to this question doesn't apply in my case. I want to request UAC elevation only when a specific argument (/AllUsers) is passed on the command line. Without this argument, the UAC prompt shouldn't appear even if the user is an admin. And TLama's answer has the same problem as my current approach.

来源:https://stackoverflow.com/questions/42655340/dynamically-choose-between-per-user-and-per-machine-installation

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