Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 19th February 2007, 15:00   #1
TJK
Junior Member
 
Join Date: Jun 2006
Posts: 17
Problems creating shortcuts on Vista (32 bit) in "current" user context

Using NSIS 2.22 on to create an installer that I then run on Windows Vista I create two shortcuts during installation, one in the "all" context and another in the "current" context as follows:

SetShellVarContext all
CreateDirectory "$SMPROGRAMS\FolderName"
CreateShortCut "$SMPROGRAMS\FolderName\ShortcutName.lnk" "$INSTDIR\AppName.exe" "L=$(LanguageTLA)" "$INSTDIR\Console.exe" 0
SetShellVarContext current
CreateDirectory "$SMPROGRAMS\FolderName"
CreateShortCut "$SMPROGRAMS\FolderName\ShortcutName2.lnk" "$INSTDIR\AppName2.exe" "L=$(LanguageTLA)" "$INSTDIR\AppName2.exe" 0

(Actually, for the "current" context shortcut I do use a language string for the shortcut name - but I have tried with a normal string as in the above extract and the symptoms are unchanged).

Though the "FolderName" folder _is_ correctly created in both the "all" context (C:\ProgramData\Microsoft\Windows\Start Menu\Programs\FolderName) and the "current" context (C:\Users\testpc1\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\FolderName) _both_ shortcuts are created in the "all" folder.

I have used MessageBox to show that $SMPROGRAMS is being correctly expanded dependent on the preceeding SetShellVarContext in both sections.

Further, when I uninstall I do the following:

SetShellVarContext all
Delete "$SMPROGRAMS\FolderName\ShortcutName.lnk"
RMDir "$SMPROGRAMS\FolderName"

SetShellVarContext current
Delete "$SMPROGRAMS\FolderName\ShortcutName2.lnk"
RMDir "$SMPROGRAMS\FolderName"

and I find that ShortcutName.lnk is deleted but that ShortcutName2.lnk is not deleted.

Has anyone else seen this and if so did they find out why and how to avoid this behaviour as I can't figure it out I'd appreciate any advice.

Thanks

Tim
TJK is offline   Reply With Quote
Old 19th February 2007, 17:38   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
Sounds like some kind of legacy redirection

Try using "RequestExecutionLevel admin" (or highest)

And if you are a standard user and elevate with UAC, you will be running as the admin and not "yourself" so you should not use "SetShellVarContext current" at all because it probably will not resolve to the correct folders for you

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump