Archive: Bug when installing for non-admin user (?)


Bug when installing for non-admin user (?)
Hey guys,

I am not quite sure whether this is a bug or desired functionality...
I am using the variable $LOCALAPPDATA when installing an app.

I am requesting administrator permissions when installing ( RequestExecutionLevel admin
)

I noticed something weird: when installing for a user which is not the admin, I get a popup requesting the administrator password. That's fine, only that I later find that the app was installed on the admin's profile instead of the current user's profile.

How come?

Ilan


RequestExecutionLevel admin: Install to $ProgramFiles and HKLM (Don't forget "SetShellVarContext all")

RequestExecutionLevel user: Install to $[Local]Appdata and HKCU ("SetShellVarContext current" is the default)

If you mix and match you will run into issues, when elevating with UAC you can end up running as the "wrong user" etc.


Thank you,

1. Can you further elaborate on the difference between the admin execution level and the user execution level? Maybe I don't really need the admin execution level..

2. You say if I use the admin level, then everything should be installed in the $ProgramFiles folder? Not using appData folder at all ?


1) If you need to install a driver, NT service or write to HKLM/system files then you need to be elevated, otherwise it really depends on how you want your installer to operate (Machine/All users vs Single User/"Just Me" type of installs)

2) If you use RequestExecutionLevel admin and the user is not admin then they have to elevate with a (different) admin user and the installer process then runs as that admin user and all per-user folders in the profile belong to that admin user and not the "correct user".

If you are doing a all users install and your application needs some per-user data in %appdata% based on some template then you should store that template data in the all users appdata (SetShellVarContext all + $appdata) or in $programfiles and when the application runs for the first time it should copy the data it needs to %appdata%...


RequestExecutionLevel just changes the exe manifest that controls UAC operation when starting the program. This is not NSIS specific so you can read more about UAC on MSDN:

http://msdn.microsoft.com/en-us/library/bb530410.aspx
http://msdn.microsoft.com/en-us/library/aa905330.aspx
http://msdn.microsoft.com/en-us/libr.../bb384608.aspx
http://technet.microsoft.com/en-us/l...e-b18ff918c281
http://msdn.microsoft.com/en-us/magazine/cc163486.aspx