Advertisement
Guest User

NSIS:Dbg:$desktop shortcut, part 2

a guest
Oct 29th, 2012
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. outfile "nsistest.exe"
  2. requestexecutionlevel user
  3. showinstdetails show
  4. completedtext "Done (NSIS ${NSIS_VERSION}, Win $9)"
  5. !include LogicLib.nsh
  6. !include WinVer.nsh
  7. !ifndef CSIDL_DESKTOP
  8. !define CSIDL_DESKTOP 0
  9. !endif
  10. !ifndef CSIDL_DESKTOPDIRECTORY
  11. !define CSIDL_DESKTOPDIRECTORY 0x10
  12. !endif
  13.  
  14. Section
  15. SetOutPath $temp
  16. Detailprint $$Desktop=$Desktop
  17. System::Call 'SHELL32::SHGetFolderPathA(i$hwndparent,i${CSIDL_DESKTOPDIRECTORY},i0,i1,m.r1)'
  18. DetailPrint SHGetFolderPathA:SHGFP_TYPE_DEFAULT=$1
  19.  
  20. !macro save id
  21. System::Call '$2->06(w "$desktop\test_${id}.lnk",i1)i.r0'
  22. StrCpy $9 NO
  23. ${IfThen} ${FileExists} "$desktop\test_${id}.lnk" ${|} StrCpy $9 YES ${|}
  24. DetailPrint 'Saved ${id}="$desktop\test_${id}.lnk"|hr=$0|exists=$9|lastop=$3'
  25. !macroend
  26.  
  27. System::Call 'OLE32::CoCreateInstance(g "{00021401-0000-0000-c000-000000000046}",i 0,i 1,g "{000214ee-0000-0000-c000-000000000046}",*i0r1)'
  28. ${If} $1 <> 0
  29.     System::Call '$1->0(g "{0000010b-0000-0000-C000-000000000046}",*i0r2)'
  30.     ${If} $2 <> 0
  31.         System::Call '$1->20(t "$sysdir\calc.exe")i.r3' ;SetPath
  32.         !insertmacro save 1
  33.         System::Call '$1->9(t "$temp")i.r3' ;SetWorkingDirectory
  34.         !insertmacro save 2
  35.         System::Call '$1->11 (t "")i.r3' ;SetArguments
  36.         !insertmacro save 3
  37.         System::Call '$1->7 (t)i.r3' ;SetDescription
  38.         !insertmacro save 4
  39.     ${EndIf}
  40. ${EndIf}
  41.  
  42. StrCpy $9 NO
  43. ClearErrors
  44. CreateShortcut "$desktop\test_0.lnk" "$sysdir\calc.exe"
  45. ${IfThen} ${Errors} ${|} StrCpy $9 YES ${|}
  46. DetailPrint "Saved normal, error=$9"
  47.  
  48.  
  49. ${WinVerGetMajor} $1
  50. ${WinVerGetMinor} $2
  51. ${WinVerGetBuild} $3
  52. ${WinVerGetServicePackLevel} $4
  53. System::Call 'kernel32::IsWow64Process(i-1,*i 0 r5)'
  54. StrCpy $9 "$1.$2.$3 SP=$4 IsWow64=$5"
  55. SectionEnd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement