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

 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 24th February 2011, 22:30   #1
o___O
Junior Member
 
Join Date: Mar 2002
Posts: 27
problem with icons, CreateShortcut on 64-bit Windows and "C:\Program Files (x86)"

I've creating an NSIS package and noticed that when a program is installed to the legacy 32-bit folder on 64-bit Windows 7 Ultimate SP1, that "C:\Program Files (x86)" is being translated either by NSIS or Windows to the environmental variable "%ProgramFiles%" which resolves to the 64-bit version of Program Files. Where I'm running into a problem is with CreateShortcut and the custom icon setting. Here's my code for starters:

Quote:
CreateShortcut "$SMPROGRAMS\${APP_NAME}\${APP_NAME}.lnk" "$INSTDIR\online.exe" "" "$INSTDIR\online.exe" "" "" "" "Launches PSOBB"
CreateShortcut "$SMPROGRAMS\${APP_NAME}\Visit schtserv.com.lnk" "http://www.schtserv.com/" "" "$INSTDIR\online.exe" "" "" "" "Visit the SCHTHACK website"
CreateShortcut "$SMPROGRAMS\${APP_NAME}\Register a game account.lnk" "http://www.schtserv.com/bbregister.php" "" "$INSTDIR\online.exe" "" "" "" "You need an account to play PSOBB"
CreateShortcut "$SMPROGRAMS\${APP_NAME}\Community forums and support.lnk" "http://schtserv.com/forum/" "" "$INSTDIR\online.exe" "" "" "" "Join the community"
CreateShortcut "$SMPROGRAMS\${APP_NAME}\Readme.txt.lnk" "$INSTDIR\readme.txt" "" "" 0 "" "" "o_o"
Now if I install the program anywhere inside "C:\Program Files (x86)" and inspect the shortcuts above (right-click->Properties), and choose "Change Icon" it will prompt an error that says "Windows cannot find the file %ProgramFiles%\<installfolder>\online.exe." I did a test and found that if I placed a copy of online.exe in the 64-bit Program Files folder that the shortcut icon was found by Windows Explorer, and I did another test and found that the field was properly filled in if any folder other than C:\Program Files (x86) (such as C:\newtest) was used. What I think is NSIS has some type of code that is converting Program Files path by default to the environmental variable %ProgramFiles%. This might work on 32-bit Windows, but 64-bit Windows uses different folders for 32-bit and 64-bit and this causes the icon path at least for CreateShortcut to be resolved improperly in Windows Explorer (64-bit version).

What I also found is that in some cases the icon on the shortcuts will default back to the missing shortcut icon and you have to reset the icon manually on the shortcut for it to work again, which is how I discovered this problem. It does this every time after a reboot on the first shortcut in the code, the other ones are a bit different (URLs/Internet shortcuts) that don't seem to reset as often (so far). I'm still trying to fix this problem but thought I'd report about my findings, it's obviously a bug that needs fixing somewhere.

NSIS 2.46...
o___O is offline   Reply With Quote
 
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