rooma
3rd April 2008 17:47 UTC
Mixed-Mode Installation Issue
Hi all,
I'd want to create an installer that allows mixed-mode installation with the new MultiUser.nsh header but I'm stuck with a problematic scenario:
(The installer would use HKLM if launched with Admin priviledge, and use HKCU if launched with User priviledge.)
1. an Admin installs the app to $PROGRAM_FILES\$INSTDIR
=> this creates keys in HKLM
2. a User installs the same app to the same dir
=> this creates keys in HKCU
Then if either of these two user uninstall the app, it will remove it for the other, and leave keys polluting the reg.
How could I prevent the second installation to reuse the path used in the 2nd installation ?
I'm really stuck here, this is a real show stopper for the mixed install mode case...
Thanks,
Rom.
fabian.rap.more
8th April 2008 22:11 UTC
why dont you check and see if the HKCU keys have been created? if they have then you can remove them
rooma
8th April 2008 22:20 UTC
Well, yes in case you're an admin you can always check the HKCU.
However if you're a user you can't check and delete the HKLM, so there's still a problem... unless I'm missing something ;)
fabian.rap.more
8th April 2008 22:24 UTC
then you will have to run it as an admin............either ask the user to do it manually or use a function. i believe there is a plugin but i may be wrong
edit:: here is the link
http://nsis.sourceforge.net/NSIS-RunAs
rooma
8th April 2008 22:31 UTC
Do you mean restrict the installer to be admin only ?
That's what I currently do, but I was actually trying to have a multi-user enabled installer that would work in both admin and user cases.
fabian.rap.more
9th April 2008 00:21 UTC
so since the user can't modify anything in HKLM then u r stuck.
Daniel James
10th April 2008 23:38 UTC
Re: Mixed-Mode Installation Issue
Originally posted by rooma
(The installer would use HKLM if launched with Admin priviledge, and use HKCU if launched with User priviledge.)
1. an Admin installs the app to $PROGRAM_FILES\$INSTDIR
=> this creates keys in HKLM
2. a User installs the same app to the same dir
=> this creates keys in HKCU
Then if either of these two user uninstall the app, it will remove it for the other, and leave keys polluting the reg.
How could I prevent the second installation to reuse the path used in the 2nd installation ?
I would imagine that in most cases the Admin will ensure that the user doesn't have write access to to $PROGRAMFILES so he won't be able to install his copy there. The situation can be avoided by the Admin ensuring that the PC is set up securely.
OK, it's not a perfect world, though. You can't rely on the Admin user knowing what he's doing. ;)
Two different users from the Administrators (or Power Users) group can, of course, ALWAYS screw the system up by installing to the same directory. There's not much you can do about that!
rooma
11th April 2008 07:40 UTC
OK I'll assume the admin/power users are smart guys and I'll allow the problematic case above.
The installer can always try to do it's best to uninstall everything in a clean way (if the uninstaller user is an admin): clean the user reg + the machine reg, clean user shortcuts + all shortcuts.
Thank you all for your replies.