Running CustomAction in wix as elevated user

泄露秘密 提交于 2019-12-10 17:47:57

问题


As I see it - WiX supports two kinds of CustomActions:

  • Deferred - The user running this action is (by default) elevated, but it is not the user who ran the install (for example, LocalSystem, or some user like that).

  • Immediate - The user running this action is (by default) not elevated - it's the user who ran the installer in the first place.

I need something quite in the middle - I want the elevated form (UAC) of the user who ran the installer.

The reason I need this is to access databases that can only be accessed by the user installing the package in its elevated form (LocalSystem is not accessible).


回答1:


This does not exist. There are only two possible contexts for custom actions to run in. One is the launching user (often via impersonation). The other is the elevated context of the Windows Installer service. On some machines (such as Windows XP, or machines with UAC disabled), or with elevating bootstraps, the launching user is an adminstrative user; you can check for this case with a combination of the MSIUSEREALADMINDETECTION and AdminUser properties. But in no case is there a third context.



来源:https://stackoverflow.com/questions/11736330/running-customaction-in-wix-as-elevated-user

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