- NSIS Discussion
- Install for all users or current user: Can NSIS help?
Archive: Install for all users or current user: Can NSIS help?
joachim
5th September 2006 16:39 UTC
Install for all users or current user: Can NSIS help?
Hi,
Modern apps should allow the user to install, even without admin rights. A user with admin rights should be given the choice how to install. Depending on what choice the user makes the installer should write to HKEY_LOCAL_MACHINE or to HKEY_CURRENT_USER.
This is expecially important when dlls must be registered, because without admin rights the registration in HKEY_CLASSES_ROOT will usually fail. Instead of HKCR one should use either HKLM\Software\Classes or HKCU\Software\Classes.
Does NSIS provide any support for this?
Is there a page that asks this question or must I create one myself? Is there a standard variable to use during installation and uninstallation?
Cheers,
Joachim
Backland
5th September 2006 16:43 UTC
I have seen some NSIS installers ask this question using a custom page designed with InstallOptions, but I do not beleive there is a built in page to ask this.
Afrow UK
5th September 2006 16:53 UTC
Use InstallOptions to create the dialog and depending on the radio buttons state, SetShellVarContext to all or current.
-Stu
joachim
5th September 2006 23:42 UTC
Thanks for the answers.
I managed to create such a custom page, but of course the strings on this page will remain untranslated.
As for SetShellVarContext I found out, that this information must be saved somewhere, so that it is again available for the uninstall step. This variable I placed in the registry among my other app-settings. "HKCU/Software/Appname/InstalledForAllUsers".
By now it seems to work but I would still appreciate if original dialogs of NSIS could contain something of that kind.
Joachim
TrifonovS
1st October 2009 09:47 UTC
Hi,
I also need to use such a page in my script. Is there already an easier solution (standard page in NSIS, or a plug-in, or something else...)?
Zinthose
1st October 2009 12:29 UTC
NSIS already permits this ability using the "MultiUser" header included. Take a look at:
http://nsis.sourceforge.net/Docs/MultiUser/Readme.html
http://nsis.sourceforge.net/Docs/MultiUser/Readme.html
TrifonovS
6th October 2009 09:11 UTC
Hi guys,
The MultiUser header solved my problem, but here it comes the next one (I don't know if this forum is suitable for such discussion). I have to deliver information to the applications that I installed what kind of installation is selected, because they also must access the corresponding registry area. What is the normal way to do this? I suppose that I have to write a registry value under HKLM that corresponds to the selection... Is this the right way?
MSG
6th October 2009 10:01 UTC
You can use the registry, or write to an ini file in the app's directory, or whatever you prefer.
Of course if it's a single-user install, you can also use HKCU instead of HKLM.
TrifonovS
6th October 2009 10:11 UTC
If I write to HKCU by installation for the current user only, how the applications will know where to find this registry key (HKCU or HKLM)? Isn't correct to write such a common key always in HKLM? Depending on this key the applications can get information in which area they have to work. Sorry for the stupid questions, but I really don't have experience with this...
MSG
6th October 2009 10:22 UTC
Like I said, you can use HKCU if it's a single-user install. If you want things to work the same for all users, then yes of course you have to use HKLM.