- NSIS Discussion
- Remove shortcuts issue
Archive: Remove shortcuts issue
brv
12th March 2003 09:44 UTC
Remove shortcuts issue
Hello,
I'm stucked with a remove shortcuts issue:
If user A installs MyApp and user B removes it, I end up with user A having all shortcuts on his desktop and start menu undeleted. Any ideea how to fix this problem ?
Thanks,
Radu Ban
Joost Verburg
12th March 2003 12:44 UTC
SetShellVarContext all
brv
12th March 2003 13:55 UTC
Thanks for your reply.
But what happens if both users A and B are power users?
AFAIK, setting SetShellVarContext all will work only for administrative accounts.
Also, deleting the links for "all" setting will delete it only if it was installed in the "All Users" path ...
The only solution I come up is to save the $DESKTOP and $SMPROGRAMS used for installation in the registry under the uninstaller keys and to use them on uninstall instead of $DESKTOP and $SMPROGRAMS.
Thanks,
Radu Ban
Joost Verburg
12th March 2003 13:58 UTC
Using SetShellVarContext all automatically sets $SMPROGRAMS to the "All Users" path.
brv
12th March 2003 14:16 UTC
Yes, but the settings for user A are saved in the user A profile not in the "All Users" path. The uninstaller will try to remove the settings from "All Users" and not remove the settings from user A profile ...
Thanks,
Radu Ban
Joost Verburg
12th March 2003 14:27 UTC
In this situation you should put the shortcuts in the "All Users" dir. B has probably no rights to delete A's files.
flizebogen
12th March 2003 14:51 UTC
;try this
;in the installer
ReadEnvStr $1 USERNAME
;reads the username
WriteIniStr $INSTDIR\settings.ini
Common User "$1"
;writes it to the ini file
Section Uninstall
ReadIniStr $1 $INSTDIR\settings.ini Common "User"
ReadEnvStr $2 USERNAME
Strcmp "$1" "$2" "" "leave_uninst"
here goes the real uninstal stuff
:leave_uninst
MessageBox MB_OK "The program was installed by $1 and can only be uninstalled with this User. Please Login as $1 and start uninstaller"
abort
SectionEnd
this is the only way i know to know both account names and compare them
hope it helps
brv
12th March 2003 14:54 UTC
As I wrote, users A and B are both Power Users. User A can't install in the "All Users" profile because it has no administrative privileges. In this case the app will be invisible for user B since all the shortcuts are on user's A profile. However, the uninstall will be visible in the control panel, so if B removes it(and it can because it's also an Power User) is preferable to do a clean uninstall.
brv
12th March 2003 15:01 UTC
Originally posted by flizebogen
;try this
;in the installer
ReadEnvStr $1 USERNAME
;reads the username
WriteIniStr $INSTDIR\settings.ini
Common User "$1"
;writes it to the ini file
Section Uninstall
ReadIniStr $1 $INSTDIR\settings.ini Common "User"
ReadEnvStr $2 USERNAME
Strcmp "$1" "$2" "" "leave_uninst"
here goes the real uninstal stuff
:leave_uninst
MessageBox MB_OK "The program was installed by $1 and can only be uninstalled with this User. Please Login as $1 and start uninstaller"
abort
SectionEnd
this is the only way i know to know both account names and compare them
hope it helps
Thanks for your reply. In the end I solved the problem by saving the $DESKTOP and $SMPROGRAMS in the registry
under the uninstall key on install and read them back on uninstall so user B can do a clean remove. I have no intention to forbid user B to remove the application if he wants it - but I want an clean uninstall.
Thanks,
Radu Ban
flizebogen
12th March 2003 19:01 UTC
i don't understand
the uninstall section residents in HKLM but the normal user has no write permission to this key AFAIK. And in addition user A can not access the documents and settings folder of user b. I know there a exceptions but assumed that both users are USERS than a clean uninstall should fail
kichik
12th March 2003 21:28 UTC
You can also write the uninstall key in HKCU instead of HKLM. That way user B will not see it in his Add/Remove control panel.