I have a program that should create files in the My Document directory during installation. This is a strict fixed requirement, it does not change. The problem is that if the user runs "Run as administrator" in the installation file, innosetups constant {userdocs} points to the directory of the administrator document, and not to the registered user.
So, Googled and found this:
Install the files in the My Documents folder of the original user through Inno Setup in Windows Vista / 7
The answer is incorrect, however, since innosetup even claims that
If the user starts the installation program by right-clicking its EXE file and selecting "Run as administrator", this flag, unfortunately, will not be because the installation program does not have the ability to run any code using the user's original credentials. The same is true if the installer is running with an already elevated process. Please note, however, that this is not an Inno Installation Restriction; Installers on the Windows installer cannot return the original user credentials either in such cases.
I assume that I can recommend the user not to use Run As Administrator, but I do not know how to prevent him from rising.
I thought that perhaps the program itself installed the My Documents \ Program directory on first launch (after installation). Will this work? He will have to copy files from the directory of his program files as a potentially limited user. Is it possible, or will I run into problems in priveleges?
source share