- NSIS Discussion
- Inconsistency/bug? with 'SetShellVarContext all '
Archive: Inconsistency/bug? with 'SetShellVarContext all '
Lilla
13th June 2003 03:06 UTC
Inconsistency/bug? with 'SetShellVarContext all '
Observation, with latest CVS, just downloaded
under Win98SE, the code below adds
desktop shortcuts to c:\Windows\All Users\Desktop
*but adds*
startmenu shortcuts to c:\Windows\StartMenu
Is this inconsistency a bug?
SetShellVarContext all
;Create startmenu shortcuts
CreateDirectory "$SMPROGRAMS\${MUI_PRODUCT}"
CreateShortCut "$SMPROGRAMS\${MUI_PRODUCT}\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
CreateShortcut "$SMPROGRAMS\${MUI_PRODUCT}\cleanNdefrag.lnk" "$INSTDIR\Gui4Cli.exe" '-instance cleanNdefrag "$INSTDIR\cleanNdefrag\cleanNdefrag.gui"'
;Create desktop shortcuts
CreateShortcut "$DESKTOP\cleanNdefrag.lnk" "$INSTDIR\Gui4Cli.exe" '-instance cleanNdefrag "$INSTDIR\cleanNdefrag\cleanNdefrag.gui"'
kichik
13th June 2003 10:28 UTC
Isn't C:\Windows\StartMenu the start menu directory for all users? What do you get with SetShellVarContext current?
virtlink
13th June 2003 11:49 UTC
At my computer (Win XP), the Start Menu is in the 'All users'-directory.
Lilla
13th June 2003 18:42 UTC
To read a summary of the NSIS problem jump to the end of this post.
It looks like Office XP created the c:\WINDOWS\All Users\... folders that appear on this Win98SE system, as explained below.
This Win98SE system is a recent clean install on a freshly formatted drive. It includes IE6, Office XP, DUN 1.4, Jet4SP6, and a number of other updates. I am the only user of this system so it is a good model system. This system has (and has always had the same) one user/profile defined.
This system has the folders shown below...
It is important to note that Office XP has placed two files in the C:\WINDOWS\All Users\...\Data folder (namely Data.dat and Data.bak) and *all* other 'All Users' folders are totally empty. This is with 'Show All Files' setting.
---
The All Users folders...
C:\WINDOWS
C:\WINDOWS\All Users
C:\WINDOWS\All Users\Application Data\Microsoft
C:\WINDOWS\All Users\Application Data\Microsoft\HTML Help
C:\WINDOWS\All Users\Application Data\Microsoft\Office
C:\WINDOWS\All Users\Application Data\Microsoft\Office\Data
C:\WINDOWS\All Users\Desktop
C:\WINDOWS\All Users\DRM
C:\WINDOWS\All Users\Start Menu
C:\WINDOWS\All Users\Start Menu\Programs
C:\WINDOWS\All Users\Start Menu\Programs\Startup
----
The normal folders...
C:\WINDOWS\Application Data\ ... lots of entries below here
C:\WINDOWS\Desktop\
C:\WINDOWS\Start Menu
C:\WINDOWS\Start Menu\Programs\ ... lots of entries below here
C:\WINDOWS\Start Menu\Programs\Startup
---------------
NSIS documentation says...
SetShellVarContext
current|all
Sets the context of $SMPROGRAMS and other shell folders. If set to 'current' (the default), the current user's shell folders are used. If set to 'all', the 'all users' shell folder is used. The all users folder may not be supported on all OSes. If the all users folder is not found, the current user folder will be used. Please take into consideration that a "normal user" has no rights to write in the all users area. Only admins have full access rights to the all users area. You can check this by using the UserInfo Plugin. See Contrib\UserInfo\UserInfo.nsi for an example.
---
To summarize the problem with the latest NSIS CVS:
Currently, when 'all' is set on a Win98SE system with Office XP installed, NSIS adds shortcuts inconsistently
- NSIS adds desktop shortcuts to the 'All Users' folder
(c:\WINDOWS\All Users\Desktop)
- NSIS adds start menu shortcuts to the 'Current User' (C:\WINDOWS\Start Menu)
- Futher, the uninstall does not remove the desktop shortcuts that it placed in the 'All Users' folder.
Thus, the new information that NSIS needs to take into consideration is that a Win9x system with Office XP installed will have an 'All Users' folder, but you should *not* use it (at least that is how it appears to me).
I hope this additional information is helpful,
Lilla
kichik
15th June 2003 17:48 UTC
I don't know what Microsoft XP thinks it's doing but "C:\WINDOWS\Start Menu" can't a certain user's start menu folder, there is no user name there... SetShellVarContext works fine on my Windows 98 and Windows XP.
Lilla
15th June 2003 19:30 UTC
Kichik, I believe the problem I am reporting will be seen on any Win9x machine that has Office XP install (I haven't tested Office 2000, so I cannot say if same is true there, but it might be.)
To workaround this, I have added this test to my code:
Call GetWindowsVersion
Pop $7 ; at this point $7 is "NT 4.0" or whatnot
!define WIN_VER $7 ; create a global variable
; MessageBox MB_OK "GetWindowsVersion ${WIN_VER}"
StrCmp ${WIN_VER} "95" CurrentUser
StrCmp ${WIN_VER} "98" CurrentUser
StrCmp ${WIN_VER} "98 SE" CurrentUser
SetShellVarContext all
CurrentUser: ; current is the default
Lilla
deguix
15th June 2003 19:55 UTC
Occur EXATLY that he/she say with my computer too (I have Office XP and Win 98 SE).
kichik
15th June 2003 19:56 UTC
BTW, as for the uninstaller, SetShellVarContext isn't remember from the installer, you have to set it again.
deguix
15th June 2003 20:09 UTC
Is not a NSIS bug, because lack a reg string that say the All Users Start Menu, so NSIS will use the current one (but if you use the $SMSTARTUP or $DESKTOP, see that will be used the All Users folder).
Lilla
16th June 2003 20:48 UTC
kichik, that's for that extra information.
I will add it to my uninstall.
I think it would be great if there were an Example for AddRemovePrograms.
Lilla
Joost Verburg
16th June 2003 21:23 UTC
Check Appendix C.3 of the Users Manual for an Add/Remove Programs example & info.
Lilla
17th June 2003 03:15 UTC
My Add/Remove example is working fine now.
Appendix C is good. Still, I think that a basic functional example would be helpful to many people. Just a thought.
Your examples have helped me immensely, they make it easy to get started. Thank you for doing them!
Lilla