Currently I am participating in development of a NSIS installer. This installer uses the UAC plugin for elevation to be able to install to a directory inside Program Files. Now, the installer elevates in .onInit, in the very beginning. The user may later choose a path, and even if this path is outside Program Files, the installer is already run as elevated. Is it possible to elevate only after user has chosen a path, if this path requires admin rights? Or is it not recommended?
Asked
Active
Viewed 1,697 times
1 Answers
3
Personally, I would not recommend it, but it has been done, this post has all the links you need.

Anders
- 97,548
- 12
- 110
- 164
-
I don't quite understand one thing in the post you referenced to: "make the inner instance synchronize all important variables and component states". How can the two instances exchange data? – Yulia Rogovaya Mar 03 '11 at 16:15
-
The UAC_AsUser_* macros in uac.nsh can sync variables – Anders Mar 03 '11 at 19:20
-
I've run into a problem following instructions in the post. There is a link to a solution for hiding the outer instance after elevation from an installer page. This solution includes calling GetOuterInstanceHwndParent macro from UAC.nsh. In version 0.2.2 of the plugin, UAC.nsh does not contain this macro anymore. Is there another solution for hiding the outer instance? Thanks in advance – Yulia Rogovaya Mar 04 '11 at 13:52
-
I'm guessing you could just copy $hwndparent to a register and transfer it over – Anders Mar 04 '11 at 16:52
-
the link seems to be broken – mrid Aug 09 '19 at 06:33