Search code examples
windows-7windows-vistauacinno-setup

Install files to original user's My Docs folder via Inno Setup on Windows Vista/7


In the [Run] section of an Inno Setup script, there's a flag runasoriginaluser that allows the script to run a process as the original user:

the spawned process will execute with the (normally non-elevated) credentials of the user that started Setup initially (i.e., the "pre-UAC dialog" credentials).

Is there an equivalent flag or workaround for the {userdocs} shell folder constant?

This is apparently a known limitation within Inno Setup (and other installers, generally), but I'm hoping someone knows a workaround.

Excerpt from the Inno Setup help file:

The "user" constants refer to the profile of the user running Setup. This user is often not the same as the currently logged-in user, so use the "user" constants with caution.


Solution

  • The workaround I came up with was using an external script to perform the data copy and calling the script using the ExecAsOriginalUser function in the wpReady page of the NextButtonClick event function.

    I'll provide more details if anyone is interested.