Old 12th November 2010, 14:42   #1
HondaGuy
Junior Member
 
Join Date: Sep 2010
Posts: 8
CreateShortcut Vista Issue

I apologize if this has been answered before. I searched the forum, but didn't find anything exactly like this.

My 'Modern UI' EXE install runs fine on XP. On Vista it runs fine except that it does not create the desktop shortcut unless I right-click the EXE and 'Run as Administrator'. (I am logged in as a user with Admin priviledges.) I thought maybe I needed the NSIS UAC plugin so the script could create the shortcut as Administrator, but after downloading and reading everything, sounds like the user running the install needs the desktop shortcut, not the Administrator, which is the way it is already configured. The user I am logged in as when I run the install can manually create desktop shortcuts without a problem. The script has the code to request user application privileges:

;Request application privileges for Windows Vista
RequestExecutionLevel user

So I'm confused. Any help would be appreciated. Haven't tried it on Windows 7, but am guessing the same issue would occur. This is NSIS version 2.46.

Thanks,
Ken
HondaGuy is offline   Reply With Quote
Old 12th November 2010, 15:11   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,296
Did you call "SetShellVarContext all"? If not, CreateShortcut on $desktop should work with "RequestExecutionLevel user" unless the desktop directory is otherwise locked down.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 12th November 2010, 15:26   #3
HondaGuy
Junior Member
 
Join Date: Sep 2010
Posts: 8
Yes, this is the standard 'Modern UI' example script and it has:

SetShellVarContext all

Should that be removed in this case?
HondaGuy is offline   Reply With Quote
Old 12th November 2010, 15:44   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,296
Well, yes, "SetShellVarContext all" turns $desktop into c:\programdata\... or whatever (all users folder on < Vista, and you need to be admin to write there)

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 12th November 2010, 16:15   #5
HondaGuy
Junior Member
 
Join Date: Sep 2010
Posts: 8
Sorry to be so dense, but are you saying SetShellVarContext functions differently between XP and Vista? Just to clarify, here's the section that creates the desktop shortcut in XP. So if I remove the SetShellVarContext, it should work in both XP and Vista because $DESKTOP doesn't get changed? Just confused about why it works in XP if $DESKTOP is changed by SetShellVarContext. Thanks.

code:
Section "myApp v0.45" SecInst
SetShellVarContext all
CreateDirectory "\myApp"
SetOutPath "$INSTDIR"
;Store installation folder
WriteRegStr HKCU "Software\myApp" "" $INSTDIR
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
; create the desktop shortcut
CreateShortCut "$DESKTOP\myApp.lnk" "$INSTDIR\myApp.jar" "" "$INSTDIR\myApp.ico"
SectionEnd

HondaGuy is offline   Reply With Quote
Old 12th November 2010, 17:16   #6
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Don't use SetShellVarContext all. Also why do you have CreateDirectory "\myApp"? You should never use relative paths.

Stu
Afrow UK is offline   Reply With Quote
Old 12th November 2010, 17:20   #7
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,296
Quote:
Originally Posted by HondaGuy View Post
Sorry to be so dense, but are you saying SetShellVarContext functions differently between XP and Vista?
No it works exactly the same, you just failed to test on XP as non admin

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 12th November 2010, 17:43   #8
HondaGuy
Junior Member
 
Join Date: Sep 2010
Posts: 8
Actually, the test I did on XP was done the same way as the test I did on Vista. As a standard user, but with 'Computer Administrator' privileges. That's why I was confused about the inconsistent results. I'll remove 'SetShellVarContext all' and start another round of testing. (Thought I started with one of the Modern UI examples, but none of them use that command, so not sure where I got the code that has it. Has been a while since I built the script and it has been working for everyone doing XP installs.)

Thanks.
HondaGuy is offline   Reply With Quote
Old 12th November 2010, 21:54   #9
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,296
"As a standard user, but with 'Computer Administrator' privileges" what does that even mean? A standard (aka limited, normal) user is not a member of the administrators group.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 12th November 2010, 22:05   #10
HondaGuy
Junior Member
 
Join Date: Sep 2010
Posts: 8
Start/Control Panel/User Accounts

Looking at the user which is logged on and running the install script:

jsmith
Computer Administrator
Password Protected

This is XP. I'll have to check the Vista machine which had the issue (can't get to it until Monday), but I purposely set it up the same way, so I would expect similar attributes for the user. Administrator privileges means that it is a user other than 'Administrator' which has been given the 'Computer administrator' type instead of 'Limited' type. (Those are the only 2 options at account setup.)
HondaGuy is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Tags
createshortcut, problem, vista

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