Old 8th February 2006, 09:37   #1
kan.izh
Junior Member
 
Join Date: Feb 2006
Posts: 5
Question 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?
kan.izh is offline   Reply With Quote
Old 8th February 2006, 10:02   #2
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
I am not sure, but SHCTX from Manual, F.7 2.06 does this in gegistry instructions. May be this also works with attributes?
Takhir is offline   Reply With Quote
Old 8th February 2006, 13:37   #3
kan.izh
Junior Member
 
Join Date: Feb 2006
Posts: 5
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?
kan.izh is offline   Reply With Quote
Old 8th February 2006, 15:02   #4
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
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
Takhir is offline   Reply With Quote
Old 8th February 2006, 18:22   #5
kan.izh
Junior Member
 
Join Date: Feb 2006
Posts: 5
It works! Thanks!
But InstallDirRegKey seems useless in this situation.
kan.izh is offline   Reply With Quote
Old 9th February 2006, 10:39   #6
onad
Senior Member
 
onad's Avatar
 
Join Date: Dec 2004
Location: Turkey
Posts: 447
correct , feel fee to improve the NSIS source to improve the behaviour...

"Just do it"
onad is offline   Reply With Quote
Old 9th February 2006, 11:11   #7
kan.izh
Junior Member
 
Join Date: Feb 2006
Posts: 5
"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 is offline   Reply With Quote
Old 9th February 2006, 13:30   #8
kan.izh
Junior Member
 
Join Date: Feb 2006
Posts: 5
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?
kan.izh is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump