Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- outfile "nsistest.exe"
- requestexecutionlevel user
- showinstdetails show
- completedtext "Done (NSIS ${NSIS_VERSION}, Win $9)"
- !include LogicLib.nsh
- !include WinVer.nsh
- !ifndef CSIDL_DESKTOP
- !define CSIDL_DESKTOP 0
- !endif
- !ifndef CSIDL_DESKTOPDIRECTORY
- !define CSIDL_DESKTOPDIRECTORY 0x10
- !endif
- Section
- SetOutPath $temp
- Detailprint $$Desktop=$Desktop
- System::Call 'SHELL32::SHGetFolderPathA(i$hwndparent,i${CSIDL_DESKTOPDIRECTORY},i0,i1,m.r1)'
- DetailPrint SHGetFolderPathA:SHGFP_TYPE_DEFAULT=$1
- !macro save id
- System::Call '$2->06(w "$desktop\test_${id}.lnk",i1)i.r0'
- StrCpy $9 NO
- ${IfThen} ${FileExists} "$desktop\test_${id}.lnk" ${|} StrCpy $9 YES ${|}
- DetailPrint 'Saved ${id}="$desktop\test_${id}.lnk"|hr=$0|exists=$9|lastop=$3'
- !macroend
- System::Call 'OLE32::CoCreateInstance(g "{00021401-0000-0000-c000-000000000046}",i 0,i 1,g "{000214ee-0000-0000-c000-000000000046}",*i0r1)'
- ${If} $1 <> 0
- System::Call '$1->0(g "{0000010b-0000-0000-C000-000000000046}",*i0r2)'
- ${If} $2 <> 0
- System::Call '$1->20(t "$sysdir\calc.exe")i.r3' ;SetPath
- !insertmacro save 1
- System::Call '$1->9(t "$temp")i.r3' ;SetWorkingDirectory
- !insertmacro save 2
- System::Call '$1->11 (t "")i.r3' ;SetArguments
- !insertmacro save 3
- System::Call '$1->7 (t)i.r3' ;SetDescription
- !insertmacro save 4
- ${EndIf}
- ${EndIf}
- StrCpy $9 NO
- ClearErrors
- CreateShortcut "$desktop\test_0.lnk" "$sysdir\calc.exe"
- ${IfThen} ${Errors} ${|} StrCpy $9 YES ${|}
- DetailPrint "Saved normal, error=$9"
- ${WinVerGetMajor} $1
- ${WinVerGetMinor} $2
- ${WinVerGetBuild} $3
- ${WinVerGetServicePackLevel} $4
- System::Call 'kernel32::IsWow64Process(i-1,*i 0 r5)'
- StrCpy $9 "$1.$2.$3 SP=$4 IsWow64=$5"
- SectionEnd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement