comparison tools/makeinst-script.sh.in @ 5536:f7f10f198735

Set blas switch shortcut to run as admin whe installed for all users (Bug #59118) * tools/makeinst-script.sh.in: add ShellLinkSetRunAs functional and call in non local mode
author John Donoghue <john.donoghue@ieee.org>
date Wed, 16 Sep 2020 11:34:15 -0400
parents c561daaad6eb
children fa6fca3c12d7
comparison
equal deleted inserted replaced
5535:9b92b671cbdc 5536:f7f10f198735
222 !macroend 222 !macroend
223 !define DequoteString '!insertmacro DequoteString ""' 223 !define DequoteString '!insertmacro DequoteString ""'
224 !define un.DequoteString '!insertmacro DequoteString "un."' 224 !define un.DequoteString '!insertmacro DequoteString "un."'
225 225
226 ###################################################################### 226 ######################################################################
227
228 # function code from https://nsis.sourceforge.io/IShellLink_Set_RunAs_flag
229
230
231 !ifndef IPersistFile
232 !define IPersistFile {0000010b-0000-0000-c000-000000000046}
233 !endif
234 !ifndef CLSID_ShellLink
235 !define CLSID_ShellLink {00021401-0000-0000-C000-000000000046}
236 !define IID_IShellLinkA {000214EE-0000-0000-C000-000000000046}
237 !define IID_IShellLinkW {000214F9-0000-0000-C000-000000000046}
238 !define IShellLinkDataList {45e2b4ae-b1c3-11d0-b92f-00a0c90312e1}
239 !ifdef NSIS_UNICODE
240 !define IID_IShellLink \${IID_IShellLinkW}
241 !else
242 !define IID_IShellLink \${IID_IShellLinkA}
243 !endif
244 !endif
245
246 Function ShellLinkSetRunAs
247 System::Store S
248 Pop \$9
249 System::Call "ole32::CoCreateInstance(g'\${CLSID_ShellLink}',i0,i1,g'\${IID_IShellLink}',*i.r1)i.r0"
250 \${If} \$0 = 0
251 System::Call "\$1->0(g'\${IPersistFile}',*i.r2)i.r0" ;QI
252 \${If} \$0 = 0
253 System::Call "\$2->5(w '\$9',i 0)i.r0" ;Load
254 \${If} \$0 = 0
255 System::Call "\$1->0(g'\${IShellLinkDataList}',*i.r3)i.r0" ;QI
256 \${If} \$0 = 0
257 System::Call "\$3->6(*i.r4)i.r0" ;GetFlags
258 \${If} \$0 = 0
259 System::Call "\$3->7(i \$4|0x2000)i.r0" ;SetFlags ;SLDF_RUNAS_USER
260 \${If} $0 = 0
261 System::Call "\$2->6(w '\$9',i1)i.r0" ;Save
262 \${EndIf}
263 \${EndIf}
264 System::Call "\$3->2()" ;Release
265 \${EndIf}
266 System::Call "\$2->2()" ;Release
267 \${EndIf}
268 \${EndIf}
269 System::Call "\$1->2()" ;Release
270 \${EndIf}
271 Push $0
272 System::Store L
273 FunctionEnd
274
275 ######################################################################
227 ; custom options page functions 276 ; custom options page functions
228 277
229 Var InstallShortcuts 278 Var InstallShortcuts
230 Var InstallShortcutsCtrl 279 Var InstallShortcutsCtrl
231 Var RegisterOctaveFileType 280 Var RegisterOctaveFileType
469 # shortcut for cmd win 518 # shortcut for cmd win
470 if [ -f $OCTAVE_SOURCE/cmdshell.bat ]; then 519 if [ -f $OCTAVE_SOURCE/cmdshell.bat ]; then
471 echo "CreateShortCut '\$SMPROGRAMS\\GNU Octave $VERSION\$MultiUser.Local\\Bash Shell.lnk' '\$INSTDIR\\cmdshell.bat' '' '' 0" >> $OUTFILE 520 echo "CreateShortCut '\$SMPROGRAMS\\GNU Octave $VERSION\$MultiUser.Local\\Bash Shell.lnk' '\$INSTDIR\\cmdshell.bat' '' '' 0" >> $OUTFILE
472 fi 521 fi
473 if [ -e $OCTAVE_SOURCE/$OCTAVE_SUBDIR/bin/blas_switch.exe ]; then 522 if [ -e $OCTAVE_SOURCE/$OCTAVE_SUBDIR/bin/blas_switch.exe ]; then
474 echo "CreateShortCut '\$SMPROGRAMS\\GNU Octave $VERSION\$MultiUser.Local\\Blas Switcher.lnk' '\$INSTDIR\\$OCTAVE_SUBDIR\\bin\\blas_switch.exe' '' '' 0" >> $OUTFILE 523 cat >> $OUTFILE << EOF
524 CreateShortCut '\$SMPROGRAMS\\GNU Octave $VERSION\$MultiUser.Local\\Blas Switcher.lnk' '\$INSTDIR\\$OCTAVE_SUBDIR\\bin\\blas_switch.exe' '' '' 0
525 \${If} \$MultiUser.InstallMode != "CurrentUser"
526 Push '\$SMPROGRAMS\\GNU Octave $VERSION\$MultiUser.Local\\Blas Switcher.lnk'
527 Call ShellLinkSetRunAs
528 Pop \$0
529 \${EndIf}
530 EOF
475 fi 531 fi
476 # if we have documentation files, create shortcuts 532 # if we have documentation files, create shortcuts
477 if [ -d $OCTAVE_SOURCE/$OCTAVE_SUBDIR/share/doc/octave ]; then 533 if [ -d $OCTAVE_SOURCE/$OCTAVE_SUBDIR/share/doc/octave ]; then
478 cat >> $OUTFILE << EOF 534 cat >> $OUTFILE << EOF
479 CreateDirectory "\$SMPROGRAMS\\GNU Octave $VERSION\$MultiUser.Local\\Documentation" 535 CreateDirectory "\$SMPROGRAMS\\GNU Octave $VERSION\$MultiUser.Local\\Documentation"