I have an installation script which does NOT have a SetShellVarContext in the install section. I would have thought that this would install just for the current user, but it installs for all users, including a Start>AllPrograms menu entry and a destop shortcut in all user accounts.
Here's the section:
Section "MainSection" SEC01Having unexpectedly got an installation in all user accounts I found that the only way to get the Start>AllPrograms menu to be uninstalled/deleted in ALL of the user accounts was to have "SetShellVarContext all" in the uninstall section. BUT the desktop shortcuts were NOT deleted! The only way I could get the desktop shortcuts deleted was to put them in a separate unsinstall section which did NOT have a SetShellVarContext, like this:
SetOutPath "$INSTDIR"
SetOverwrite ifnewer
File "Myprog.exe"
CreateDirectory "$SMPROGRAMS\Myprog"
CreateShortCut "$SMPROGRAMS\Myprog\Myprog.lnk" "$INSTDIR\Myprog.exe"
CreateShortCut "$DESKTOP\Myprog.lnk" "$INSTDIR\Myprog.exe"
SectionEnd
Section un.desktopSo the above was the only way I could get the desktop shortcuts and the Start>AllPrograms menu to be removed for all users.
Delete "$DESKTOP\Myprog.lnk"
SectionEnd
Section Uninstall
SetShellVarContext all
Delete "$INSTDIR\${PRODUCT_NAME}.url"
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\Myprog.exe"
Delete "$SMPROGRAMS\Myprog\Uninstall.lnk"
Delete "$SMPROGRAMS\Myprog\Website.lnk"
Delete "$SMPROGRAMS\Myprog\Myprog.lnk"
RMDir "$SMPROGRAMS\Myprog"
RMDir "$INSTDIR"
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
SetAutoClose true
SectionEnd
This doesn't make sense. I would have expected no SetShellVarContext to cause install/uninstall only for the current user, and "SetShellVarContext all" to install/uninstall for all users.
But the above seems to defy this logic.
Can anyone explain what's going on here?