kan.izh
8th February 2006 10:37 UTC
Clever installer - administrator/limited user
Is it possible to make an installer which can check permissions of user and make installation in HKLM or HKCU?
E.g. how to make InstallDirRegKey sensitive to current permissions? If user can, installer can use InstallationPath in the HKLM, otherwise put it in the HKCU.
Is it possilbe?
Takhir
8th February 2006 11:02 UTC
I am not sure, but SHCTX from Manual, F.7 2.06 does this in gegistry instructions. May be this also works with attributes?
kan.izh
8th February 2006 14:37 UTC
But how to call it before InstallDirRegKey?
Seems the SetShellVarContext must be in section only:
Error: command SetShellVarContext not valid outside section or function
Or is it possible to put InstallDirRegKey in section?
And also I wanna set SetShellVarContext to 'all' only if admin privileges. Is it possible?
Takhir
8th February 2006 16:02 UTC
InstallDirRegKey if first requested on 'dir' page, while Context might be defined on .onInit function. But I tested InstallDirRegKey attribute parameters and it looks like SHCTX is not accepted. So you need a bit more programming - read $INSTDIR string from HKLM or HKCU depending on the current context (if registry value exists). Few lines of code only ;)
kan.izh
8th February 2006 19:22 UTC
It works! Thanks!
But InstallDirRegKey seems useless in this situation.
onad
9th February 2006 11:39 UTC
correct ;), feel fee to improve the NSIS source to improve the behaviour...
kan.izh
9th February 2006 12:11 UTC
"fee" or "free"? :)
Actually I am not sure how to improve... SetShellVarContext is also function-level stuff, and it is meanless to add SHCTX support for InstallDirRegKey.
kan.izh
9th February 2006 14:30 UTC
I suppose the solution can be something like this:
To allow multiple InstallDirRegKey directives, and it will check registry for a first existing key, install path will be amended to it.
In this case you can write
InstallDirRegKey HKLM ...
InstallDirRegKey HKCU ...
What do you think? Does it make sense?