Old 11th December 2015, 21:26   #1
jla
Junior Member
 
Join Date: Dec 2015
Posts: 10
No shortcuts in Vista as user

Hi,

I've just started testing out NSIS. I've created an installer using RequestExecutionLevel user and it works great on Windows 7 and 10. On Vista it's not creating the shortcuts though. It is suppose to create one on the desktop and one in the user's start menu. It does create the "program group" $DEFAULT_PROGRAM_FOLDER folder in the start menu. The rest of the program seems to install correctly to the right location of $LOCALAPPDATA for the different OS versions.

${EIT_MUI_PAGE_SHORTCUTS_CreateShortcut} EIT_MUI_SHORTCUT_FOLDER_DESKTOP \
"\My App.lnk" "$INSTDIR\MyApp.exe" \
'"" "$INSTDIR\icon.ico" 0' "$INSTDIR"

${EIT_MUI_PAGE_SHORTCUTS_CreateShortcut} EIT_MUI_SHORTCUT_FOLDER_STARTMENU \
"\My App.lnk" "$INSTDIR\MyApp.exe" \
'"" "$INSTDIR\icon.ico" 0' "$INSTDIR"


I've searched around but the stuff I'm finding talks about it not being able to delete the stuff on uninstall or it being redirected because RequestExecutionLevel wasn't specified. I can't find it being redirected anyway and it fails even when I run it from an account with Administrator privileges. It's not requesting elevation, just as it's configured.

Have you seen this?

Where else can I look for more information or how can I debug this?



Thanks,
--
Jacob
NSIS 2.47
Windows 10
jla is offline   Reply With Quote
Old 11th December 2015, 21:57   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,534
It is not easy to debug this when you have those crazy macros there.

Try this:

Quote:
SetShellVarContext Current ; Just making sure it is not set to ALL
CreateShortcut "$SMPROGRAMS\MyApp.lnk" "$InstDir\MyApp.exe"
if that works then there is something wrong with your macros. If it does not work you can try Process Monitor from Microsoft and see what is going on at the filesystem level...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 14th December 2015, 21:03   #3
jla
Junior Member
 
Join Date: Dec 2015
Posts: 10
Sorry about that, it's all Greek to me. I created the initial installer using Excelsior Installer then exported to NSIS and tried tweaking from there. That is the source of the macros that I also don't yet follow completely.

I added your suggested code after the two other macro calls to create shortcuts and it didn't create a shortcut either. Maybe it wasn't in the right place because I didn't even see it in the nsis_install.log.

I captured the install using Process Monitor and didn't see anything that stood out. Most things were SUCCESS, with some NAME COLLISION hits and a few NAME NOT FOUND entries. I can see it create C:\Users\test\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\MyAppFolder and then log that, but then it spends some time in the registry, which is also logged, and finishes. The log claims that it creates the two shortcuts specified by the macro I first shared and an uninstall link, none of which show up in procmon or in the actual filesystem.

Maybe I need to start again from scratch and try to learn all of NSIS. I was almost there with the Excelsior created nsi and nsh files except for this shortcut issue.
jla is offline   Reply With Quote
Old 14th December 2015, 23:09   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,534
You can turn off the registry output in the toolbar, we only care about the filesystem in this case. You could also set a filter: Include if Path contains "Start".

Your initial post did not say anything about a subfolder. You must make sure the folder exists by using CreateDirectory "$SMPrograms\MyAppFolder" before you create the shortcuts.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 14th December 2015, 23:42   #5
jla
Junior Member
 
Join Date: Dec 2015
Posts: 10
Sorry, the folder bit is also hidden in the macro I guess.

I believe the log is saying that it is creating the folder before the shortcuts, and looking at it closer it isn't putting the start menu shortcut into that directory:

code:
Folder C:\Users\test\AppData\Roaming\Microsoft\Windows\Start Menu
Folder C:\Users\test\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
Folder C:\Users\test\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\MyApDir
File C:\Users\test\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\MyApDir\Uninstall.lnk
File C:\Users\test\Desktop\\MyApp.lnk
File C:\Users\test\AppData\Roaming\Microsoft\Windows\Start Menu\\MyApp.lnk



None of the shortcuts logged as File lines are created, at least I can't find them, and I don't see anything in the process explorer output about them.

The double slashes (\\) in the path for creating the shortcuts are odd but usually Windows is OK with that.

I've still got the Process Monitor output and can filter it back and forth. Were you interested in me posting a copy? If so, in which format?
jla is offline   Reply With Quote
Old 15th December 2015, 02:12   #6
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,534
I don't know what type of log you are talking about, perhaps it is a Excelsior thing. I have no idea what Excelsior Installer but you might want to contact them for support...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 15th December 2015, 17:21   #7
jla
Junior Member
 
Join Date: Dec 2015
Posts: 10
The file is nsis_install.log and it's in my install directory. The name and contents had me thinking it was a NSIS thing and was used to track installed files and paths for the uninstall. I now see that it's another Excelsior macro.

I came across Excelsior from the wiki, http://nsis.sourceforge.net/Excelsior_Installer

Quote:
this product provides NSIS integration, that allows one to use it as a GUI wizard for NSIS to ease NSIS learning curve and simplify basic project creation tasks
I don't think I'll bother asking Excelsior for help debugging a modified version of their NSIS script export from their free installer builder. When I use their program to generate an installer it does create shortcuts, but it forces a run as admin and creates the shortcuts for the selected admin user. Not what I'm after.

I'm really shooting for something simple. A quick no-admin user only install of a program with next to no options, shortcuts, add/remove entry and launching the installed program at the end. I'll try to find a NSIS tutorial and a recipe or two to do this by hand or maybe I'll check out WIX to see if I can grok it faster.

Thanks for giving some suggestions and pointers. I think I'm at a dead end on this collection of NSIS scripts with my current level of understanding.
jla is offline   Reply With Quote
Old 15th December 2015, 18:45   #8
jla
Junior Member
 
Join Date: Dec 2015
Posts: 10
I'm using HM NIS Edit 2.0.3 (nisedit.exe) and decided to give it's wizard a try. It created an installer that did almost what I wanted. I just had to add RequestExecutionLevel user, set PRODUCT_UNINST_ROOT_KEY to HKCU and replace a couple of hard-coded HKLM values with ${PRODUCT_UNINST_ROOT_KEY}.

It runs as limited user, makes an entry in add/remove, creates all directories and puts the File(s) in place, but it also fails to create shortcuts on Vista and Process Monitor doesn't show it trying and failing.

I also added SetShellVarContext Current but it didn't help. I was skeptical about it working since CreateDirectory "$SMPROGRAMS\MyAppDir" always works. It's just the CreateShortCut calls that fail.

code:

Section "MainSection" SEC01
SetOutPath "$INSTDIR"
SetOverwrite ifnewer
SetShellVarContext Current
File "..\InstallerFiles\WinRun4J.exe"
CreateDirectory "$SMPROGRAMS\MyAppDir"
CreateShortCut "$SMPROGRAMS\MyAppDir\MyApp.lnk" "$INSTDIR\WinRun4J.exe"
CreateShortCut "$DESKTOP\MyApp.lnk" "$INSTDIR\WinRun4J.exe"
SetOverwrite try
File "..\InstallerFiles\WinRun4J.ini"
; ... other files ...
SectionEnd



I think that registry stuff in Process Monitor where I expect it to be creating the shortcuts is something to look into, but I'm not sure what it means.
jla is offline   Reply With Quote
Old 15th December 2015, 19:05   #9
jla
Junior Member
 
Join Date: Dec 2015
Posts: 10
The CreateShortCut Vista Issue NSIS Discussion on GitHub sounds like my issue, but the guy was doing SetShellVarContext all and then the conversation veered off course about if they were testing as admin or not on XP.

https://nsis-dev.github.io/NSIS-Foru.../t-323991.html

Is there a simple way to get NSIS to show an output of when things like creating a shortcut fails, like this person shows http://stackoverflow.com/questions/1...cut-on-desktop
jla is offline   Reply With Quote
Old 15th December 2015, 19:29   #10
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,534
I was able to reproduce the issue now on a Vista SP2 machine with all updates.

There seems to be a bug in Windows that causes CoCreateInstance to fail because we now call SetDefaultDllDirectories.

We will have to do yet another release to fix this.

Older threads are probably not relevant because this is a change introduced in 2.47.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 15th December 2015, 19:39   #11
jla
Junior Member
 
Join Date: Dec 2015
Posts: 10
I tried creating a shortcut in the $INSTDIR, before creating the directory in $SMPROGRAMS and it also failed.

CreateShortCut "$INSTDIR\MyApp.lnk" "$INSTDIR\WinRun4J.exe"

The same registry action that happens with the other attempts to create the shortcuts happens here. It gets some COM3 and OLE values then spends a lot of time getting values from HKCR\CLSID\{00021401-0000-0000-C000-000000000046}

I tried not limiting the Process Explorer output to only the installer process ID and still nothing shows up.
jla is offline   Reply With Quote
Old 15th December 2015, 19:43   #12
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,534
Like I just said, it seems to be a bug in Windows and we probably have to skip calling that function on Vista.

Open your setup in a hex editor and change "SetDefaultDllDirectories" to "XetDefaultDllDirectories" and then run yoursetup.exe /NCRC and it should work.

Stick with 2.46 until we release 2.49.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 15th December 2015, 19:52   #13
jla
Junior Member
 
Join Date: Dec 2015
Posts: 10
I was using 2.47 and the target system was Vista with SP2 and almost all updates.

I reverted to 2.46 and recompiled. The installer works on the Vista system.

Thank you for finding that,
--
Jacob
jla 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