Archive: Vista - Cannot copy files to non-admin user's Desktop/Pictures


Vista - Cannot copy files to non-admin user's Desktop/Pictures
Hello all,

My installer copies some files to the "$DESKTOP" and "$PICTURES" folder of the current user. I have tested it with Window XP and it works fine for admin and non-admin users. However, it does not work correctly with Vista. No matter which user I am logged in as, the files are always copied into the administrator's folders as opposed to the current user's folders.

I have tried running the "UserInfo.exe" example (that comes with the NSIS installation) as a non-admin user and noticed that UserInfo::GetName and UserInfo::GetAccountType always return the information of the Administrator user whose password was used to authorized the installation. Is this an OS bug? Can I do something to fix this?

I am using the "RequestExecutionLevel admin" command to avoid getting the warning message after the vista installation. Also, I have tried using the "SetShellVarContext current" command just before calling "$PICTURES" but it didnt work as expected.

Any help will be appreciated.


Vista not only elevates installer's process rights (UAC), but makes it running from administrator. This way installer forgets about logged user and executes installer as it was started by admin. Thread with the same problem http://forums.winamp.com/showthread....hreadid=265780
May be Vista SDK can help with process token tricks (new NSIS plug-in required), but SDK "Download Size: 1 KB - 1185.7 MB*" :-( http://www.microsoft.com/downloads/d...displaylang=en