- NSIS Discussion
- Uninstall with MultiUser.nsh
Archive: Uninstall with MultiUser.nsh
GlibReaper
14th March 2008 11:43 UTC
Uninstall with MultiUser.nsh
Hi.
I'm fairly new to NSIS, so I might be missing a trick, but I've checked the forums, the interweb, etc and I can't find an answer. I'm running NSIS 2.35 and I just played with the MultiUser options. By using MULTIUSER_PAGE_INSTALLMODE I can ask the user where he wants to install my application to. But the uninstall doesn't work properly. If I use MULTIUSER_INSTALLMODE_COMMANDLINE then the uninstall works perfectly for All User installations, but it doesn't work for Current User. And if I use MULTIUSER_INSTALLMODE_DEFAULT_CURRENTUSER it's the opposite: it works fine for the current user, but not for all users.
Any ideas?
Glib
kichik
16th March 2008 20:52 UTC
Is it the same as the following?
http://sourceforge.net/tracker/index...49&atid=373085
Joost Verburg
16th March 2008 21:43 UTC
No, it's not related to that bug.
The uninstaller should know whether the application it's linked to is installed for the current user or for all users. Note that a system-wide and current-user version may be installed at the same time.
A simple solution is to add the /CurrentUser or /AllUsers command-line switch to your uninstaller location for the Windows Add/Remove programs control panel.
bwinterscheidt
17th March 2008 04:21 UTC
I'm having similar troubles on uninstall with multiuser.nsh...
I don't have MULTIUSER_INSTALLMODE_COMMANDLINE or MULTIUSER_INSTALLMODE_DEFAULT_CURRENTUSER defined, but the uninstaller always runs in 'current' context when installed for AllUsers, in 'all' context when installed for current user.
@kichik: the bug you link to is noted as fixed, but the current code (2.35) still appears as Ivan described. do we need to implement his fix ourselves until the next release?
I've tried swapping these around, and it doesn't seem to have any affect?
bwinterscheidt
17th March 2008 05:24 UTC
After throwing messageboxes into each macro to see if it fires, I'm noticing that things are breaking somewhere in MULTIUSER_INIT_CHECKS Un un., and it's never calling the MULTIUSER_INSTALLMODE_ALLUSERS/CURRENTUSER macros where SetShallVarContext is set.
bwinterscheidt
17th March 2008 06:02 UTC
Hmm. These are always undefined (install *and* uninstall)...
!ifdef MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY & MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME
Are these *designed* to be different values than the MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY & MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME ?
bwinterscheidt
17th March 2008 06:08 UTC
Okay, my problem is fixed with these steps:
1) Implement Ivan's suggestion, swapping the CurrentUser/AllUsers at lines 256 and 264 of NSIS 2.35's MultiUser.nsh
2) add two lines as follows into my script:
!define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY "${MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY}"
!define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME "${MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME}"
Thanks for letting me post to myself. Hopefully someone else finds this useful. ;)
Joost Verburg
18th March 2008 14:24 UTC
For the uninstaller I would recommend you to also implement what I suggested in my previous post. A registry key won't work for uninstallation if both a per-user as well as a per-machine installation exists.
bwinterscheidt
21st March 2008 05:51 UTC
Thanks. Is this switch added to the UninstallString registry value? Or somewhere else?
Joost Verburg
21st March 2008 14:16 UTC
Yes, that's right. You also need to set MULTIUSER_INSTALLMODE_COMMANDLINE.