Annotation of embedaddon/smartmontools/os_win32/installer.nsi, revision 1.1.1.1

1.1       misho       1: ;
                      2: ; smartmontools install NSIS script
                      3: ;
                      4: ; Home page of code is: http://smartmontools.sourceforge.net
                      5: ;
                      6: ; Copyright (C) 2006-11 Christian Franke <smartmontools-support@lists.sourceforge.net>
                      7: ;
                      8: ; This program is free software; you can redistribute it and/or modify
                      9: ; it under the terms of the GNU General Public License as published by
                     10: ; the Free Software Foundation; either version 2, or (at your option)
                     11: ; any later version.
                     12: ;
                     13: ; You should have received a copy of the GNU General Public License
                     14: ; (for example COPYING); If not, see <http://www.gnu.org/licenses/>.
                     15: ;
                     16: ; $Id: installer.nsi 3457 2011-10-20 16:36:47Z chrfranke $
                     17: ;
                     18: 
                     19: 
                     20: ;--------------------------------------------------------------------
                     21: ; Command line arguments:
                     22: ; makensis -DINPDIR=<input-dir> -DOUTFILE=<output-file> -DVERSTR=<version-string> installer.nsi
                     23: 
                     24: !ifndef INPDIR
                     25:   !define INPDIR "."
                     26: !endif
                     27: 
                     28: !ifndef OUTFILE
                     29:   !define OUTFILE "smartmontools.win32-setup.exe"
                     30: !endif
                     31: 
                     32: ;--------------------------------------------------------------------
                     33: ; General
                     34: 
                     35: Name "smartmontools"
                     36: OutFile "${OUTFILE}"
                     37: 
                     38: SetCompressor /solid lzma
                     39: 
                     40: XPStyle on
                     41: InstallColors /windows
                     42: 
                     43: InstallDir "$PROGRAMFILES\smartmontools"
                     44: InstallDirRegKey HKLM "Software\smartmontools" "Install_Dir"
                     45: 
                     46: Var EDITOR
                     47: Var UBCDDIR
                     48: 
                     49: LicenseData "${INPDIR}\doc\COPYING.txt"
                     50: 
                     51: !include "FileFunc.nsh"
                     52: !include "Sections.nsh"
                     53: 
                     54: !insertmacro GetParameters
                     55: !insertmacro GetOptions
                     56: 
                     57: RequestExecutionLevel admin
                     58: 
                     59: ;--------------------------------------------------------------------
                     60: ; Pages
                     61: 
                     62: Page license
                     63: Page components
                     64: Page directory SkipProgPath "" ""
                     65: PageEx directory
                     66:   PageCallbacks SkipUBCDPath "" ""
                     67:   DirText "Setup will install the UBCD4Win plugin in the following folder."
                     68:   DirVar $UBCDDIR
                     69: PageExEnd
                     70: Page instfiles
                     71: 
                     72: UninstPage uninstConfirm
                     73: UninstPage instfiles
                     74: 
                     75: InstType "Full"
                     76: InstType "Extract files only"
                     77: InstType "Drive menu"
                     78: InstType "UBCD4Win plugin"
                     79: 
                     80: 
                     81: ;--------------------------------------------------------------------
                     82: ; Sections
                     83: 
                     84: SectionGroup "!Program files"
                     85: 
                     86:   Section "smartctl" SMARTCTL_SECTION
                     87: 
                     88:     SectionIn 1 2
                     89: 
                     90:     SetOutPath "$INSTDIR\bin"
                     91:     File "${INPDIR}\bin\smartctl.exe"
                     92: 
                     93:   SectionEnd
                     94: 
                     95:   Section "smartd" SMARTD_SECTION
                     96: 
                     97:     SectionIn 1 2
                     98: 
                     99:     SetOutPath "$INSTDIR\bin"
                    100: 
                    101:     ; Stop service ?
                    102:     StrCpy $1 ""
                    103:     IfFileExists "$INSTDIR\bin\smartd.exe" 0 nosrv
                    104:       ReadRegStr $0 HKLM "System\CurrentControlSet\Services\smartd" "ImagePath"
                    105:       StrCmp $0 "" nosrv
                    106:         ExecWait "net stop smartd" $1
                    107:   nosrv:
                    108:     File "${INPDIR}\bin\smartd.exe"
                    109: 
                    110:     IfFileExists "$INSTDIR\bin\smartd.conf" 0 +2
                    111:       MessageBox MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2 "Replace existing configuration file$\n$INSTDIR\bin\smartd.conf ?" IDYES 0 IDNO +2
                    112:         File "${INPDIR}\doc\smartd.conf"
                    113: 
                    114:     IfFileExists "$WINDIR\system32\cmd.exe" 0 +2
                    115:       File /nonfatal "${INPDIR}\bin\syslogevt.exe"
                    116: 
                    117:     ; Restart service ?
                    118:     StrCmp $1 "0" 0 +3
                    119:       MessageBox MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2  "Restart smartd service ?" IDYES 0 IDNO +2
                    120:         ExecWait "net start smartd"
                    121: 
                    122:   SectionEnd
                    123: 
                    124:   Section "smartctl-nc (GSmartControl)" SMARTCTL_NC_SECTION
                    125: 
                    126:     SectionIn 1 2
                    127: 
                    128:     SetOutPath "$INSTDIR\bin"
                    129:     File "${INPDIR}\bin\smartctl-nc.exe"
                    130: 
                    131:   SectionEnd
                    132: 
                    133:   Section "drivedb.h (Drive Database)" DRIVEDB_SECTION
                    134: 
                    135:     SectionIn 1 2
                    136: 
                    137:     SetOutPath "$INSTDIR\bin"
                    138:     File "${INPDIR}\bin\drivedb.h"
                    139:     File "${INPDIR}\bin\update-smart-drivedb.exe"
                    140: 
                    141:   SectionEnd
                    142: 
                    143: SectionGroupEnd
                    144: 
                    145: Section "!Documentation" DOC_SECTION
                    146: 
                    147:   SectionIn 1 2
                    148: 
                    149:   SetOutPath "$INSTDIR\doc"
                    150:   File "${INPDIR}\doc\AUTHORS.txt"
                    151:   File "${INPDIR}\doc\CHANGELOG.txt"
                    152:   File "${INPDIR}\doc\COPYING.txt"
                    153:   File "${INPDIR}\doc\INSTALL.txt"
                    154:   File "${INPDIR}\doc\NEWS.txt"
                    155:   File "${INPDIR}\doc\README.txt"
                    156:   File "${INPDIR}\doc\TODO.txt"
                    157:   File "${INPDIR}\doc\WARNINGS.txt"
                    158:   File "${INPDIR}\doc\checksums.txt"
                    159:   File "${INPDIR}\doc\smartctl.8.html"
                    160:   File "${INPDIR}\doc\smartctl.8.txt"
                    161:   File "${INPDIR}\doc\smartd.8.html"
                    162:   File "${INPDIR}\doc\smartd.8.txt"
                    163:   File "${INPDIR}\doc\smartd.conf"
                    164:   File "${INPDIR}\doc\smartd.conf.5.html"
                    165:   File "${INPDIR}\doc\smartd.conf.5.txt"
                    166: 
                    167: SectionEnd
                    168: 
                    169: Section "Uninstaller" UNINST_SECTION
                    170: 
                    171:   SectionIn 1
                    172:   AddSize 35
                    173: 
                    174:   CreateDirectory "$INSTDIR"
                    175: 
                    176:   ; Save installation location
                    177:   WriteRegStr HKLM "Software\smartmontools" "Install_Dir" "$INSTDIR"
                    178: 
                    179:   ; Write uninstall keys and program
                    180:   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\smartmontools" "DisplayName" "smartmontools"
                    181: !ifdef VERSTR
                    182:   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\smartmontools" "DisplayVersion" "${VERSTR}"
                    183: !endif
                    184:   ;WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\smartmontools" "Publisher" "smartmontools"
                    185:   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\smartmontools" "UninstallString" '"$INSTDIR\uninst-smartmontools.exe"'
                    186:   ;WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\smartmontools" "URLInfoAbout" "http://smartmontools.sourceforge.net/"
                    187:   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\smartmontools" "HelpLink"     "http://smartmontools.sourceforge.net/"
                    188:   ;WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\smartmontools" "URLUpdateInfo" "http://sourceforge.net/project/showfiles.php?group_id=64297"
                    189:   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\smartmontools" "URLUpdateInfo" "http://smartmontools-win32.dyndns.org/"
                    190:   WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\smartmontools" "NoModify" 1
                    191:   WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\smartmontools" "NoRepair" 1
                    192:   WriteUninstaller "uninst-smartmontools.exe"
                    193: 
                    194: SectionEnd
                    195: 
                    196: Section "Start Menu Shortcuts" MENU_SECTION
                    197: 
                    198:   SectionIn 1
                    199: 
                    200:   SetShellVarContext all
                    201: 
                    202:   CreateDirectory "$SMPROGRAMS\smartmontools"
                    203: 
                    204:   !macro CreateAdminShortCut link target args
                    205:     CreateShortCut '${link}' '${target}' '${args}'
                    206:     push '${link}'
                    207:     Call ShellLinkSetRunAs
                    208:   !macroend
                    209: 
                    210:   ; runcmdu
                    211:   IfFileExists "$INSTDIR\bin\smartctl.exe" 0 +2
                    212:   IfFileExists "$INSTDIR\bin\smartd.exe" 0 +4
                    213:     SetOutPath "$INSTDIR\bin"
                    214:     File "${INPDIR}\bin\runcmdu.exe"
                    215:     File "${INPDIR}\bin\runcmdu.exe.manifest"
                    216: 
                    217:   ; smartctl
                    218:   IfFileExists "$INSTDIR\bin\smartctl.exe" 0 noctl
                    219:     SetOutPath "$INSTDIR\bin"
                    220:     IfFileExists "$WINDIR\system32\cmd.exe" 0 nocmd
                    221:       !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartctl (Admin CMD).lnk" "$WINDIR\system32\cmd.exe" '/k PATH=$INSTDIR\bin;%PATH%&cd /d "$INSTDIR\bin"'
                    222:     nocmd:
                    223:     CreateDirectory "$SMPROGRAMS\smartmontools\smartctl Examples"
                    224:     FileOpen $0 "$SMPROGRAMS\smartmontools\smartctl Examples\!Read this first!.txt" "w"
                    225:     FileWrite $0 "All the example commands in this directory$\r$\napply to the first drive (sda).$\r$\n"
                    226:     FileClose $0
                    227:     !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\All info (-a).lnk"                    "$INSTDIR\bin\runcmdu.exe" "smartctl -a sda"
                    228:     !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\Identify drive (-i).lnk"              "$INSTDIR\bin\runcmdu.exe" "smartctl -i sda"
                    229:     !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\SMART attributes (-A).lnk"            "$INSTDIR\bin\runcmdu.exe" "smartctl -A sda"
                    230:     !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\SMART capabilities (-c).lnk"          "$INSTDIR\bin\runcmdu.exe" "smartctl -c sda"
                    231:     !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\SMART health status (-H).lnk"         "$INSTDIR\bin\runcmdu.exe" "smartctl -H sda"
                    232:     !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\SMART error log (-l error).lnk"       "$INSTDIR\bin\runcmdu.exe" "smartctl -l error sda"
                    233:     !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\SMART selftest log (-l selftest).lnk" "$INSTDIR\bin\runcmdu.exe" "smartctl -l selftest sda"
                    234:     !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\Start long selftest (-t long).lnk"    "$INSTDIR\bin\runcmdu.exe" "smartctl -t long sda"
                    235:     !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\Start offline test (-t offline).lnk"  "$INSTDIR\bin\runcmdu.exe" "smartctl -t offline sda"
                    236:     !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\Start short selftest (-t short).lnk"  "$INSTDIR\bin\runcmdu.exe" "smartctl -t short sda"
                    237:     !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\Stop(Abort) selftest (-X).lnk"        "$INSTDIR\bin\runcmdu.exe" "smartctl -X sda"
                    238:     !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\Turn SMART off (-s off).lnk"          "$INSTDIR\bin\runcmdu.exe" "smartctl -s off sda"
                    239:     !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\Turn SMART on (-s on).lnk"            "$INSTDIR\bin\runcmdu.exe" "smartctl -s on sda"
                    240:   noctl:
                    241: 
                    242:   ; smartd
                    243:   IfFileExists "$INSTDIR\bin\smartd.exe" 0 nod
                    244:     SetOutPath "$INSTDIR\bin"
                    245:     CreateDirectory "$SMPROGRAMS\smartmontools\smartd Examples"
                    246:     !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Daemon start, smartd.log.lnk"           "$INSTDIR\bin\runcmdu.exe" "smartd -l local0"
                    247:     !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Daemon start, eventlog.lnk"             "$INSTDIR\bin\runcmdu.exe" "smartd"
                    248:     !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Daemon stop.lnk"                        "$INSTDIR\bin\runcmdu.exe" "smartd stop"
                    249:     !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Do all tests once (-q onecheck).lnk"    "$INSTDIR\bin\runcmdu.exe" "smartd -q onecheck"
                    250:     !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Debug mode (-d).lnk"                    "$INSTDIR\bin\runcmdu.exe" "smartd -d"
                    251:     !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartd Examples\smartd.conf (edit).lnk" "$EDITOR" "$INSTDIR\bin\smartd.conf"
                    252:     CreateShortCut "$SMPROGRAMS\smartmontools\smartd Examples\smartd.conf (view).lnk"                   "$EDITOR" "$INSTDIR\bin\smartd.conf"
                    253:     CreateShortCut "$SMPROGRAMS\smartmontools\smartd Examples\smartd.log (view).lnk"                    "$EDITOR" "$INSTDIR\bin\smartd.log"
                    254: 
                    255:     ; smartd service (not on 9x/ME)
                    256:     IfFileExists "$WINDIR\system32\cmd.exe" 0 nosvc
                    257:       !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Service install, eventlog, 30min.lnk"   "$INSTDIR\bin\runcmdu.exe" "smartd install"
                    258:       !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Service install, smartd.log, 10min.lnk" "$INSTDIR\bin\runcmdu.exe" "smartd install -l local0 -i 600"
                    259:       !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Service install, smartd.log, 30min.lnk" "$INSTDIR\bin\runcmdu.exe" "smartd install -l local0"
                    260:       !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Service remove.lnk"                     "$INSTDIR\bin\runcmdu.exe" "smartd remove"
                    261:       !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Service start.lnk"                      "$INSTDIR\bin\runcmdu.exe" "net start smartd"
                    262:       !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Service stop.lnk"                       "$INSTDIR\bin\runcmdu.exe" "net stop smartd"
                    263:     nosvc:
                    264:   nod:
                    265: 
                    266:   ; Documentation
                    267:   IfFileExists "$INSTDIR\doc\README.TXT" 0 nodoc
                    268:     SetOutPath "$INSTDIR\doc"
                    269:     CreateDirectory "$SMPROGRAMS\smartmontools\Documentation"
                    270:     CreateShortCut "$SMPROGRAMS\smartmontools\Documentation\smartctl manual page (html).lnk"    "$INSTDIR\doc\smartctl.8.html"
                    271:     CreateShortCut "$SMPROGRAMS\smartmontools\Documentation\smartd manual page (html).lnk"      "$INSTDIR\doc\smartd.8.html"
                    272:     CreateShortCut "$SMPROGRAMS\smartmontools\Documentation\smartd.conf manual page (html).lnk" "$INSTDIR\doc\smartd.conf.5.html"
                    273:     CreateShortCut "$SMPROGRAMS\smartmontools\Documentation\smartctl manual page (txt).lnk"     "$INSTDIR\doc\smartctl.8.txt"
                    274:     CreateShortCut "$SMPROGRAMS\smartmontools\Documentation\smartd manual page (txt).lnk"       "$INSTDIR\doc\smartd.8.txt"
                    275:     CreateShortCut "$SMPROGRAMS\smartmontools\Documentation\smartd.conf manual page (txt).lnk"  "$INSTDIR\doc\smartd.conf.5.txt"
                    276:     CreateShortCut "$SMPROGRAMS\smartmontools\Documentation\smartd.conf sample.lnk" "$EDITOR" "$INSTDIR\doc\smartd.conf"
                    277:     IfFileExists "$INSTDIR\bin\drivedb.h" 0 nodb
                    278:         CreateShortCut "$SMPROGRAMS\smartmontools\Documentation\drivedb.h (view).lnk" "$EDITOR" "$INSTDIR\bin\drivedb.h"
                    279:         !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\Documentation\drivedb-add.h (create, edit).lnk" "$EDITOR" "$INSTDIR\bin\drivedb-add.h"
                    280:     nodb:
                    281:     CreateShortCut "$SMPROGRAMS\smartmontools\Documentation\AUTHORS.lnk"   "$INSTDIR\doc\AUTHORS.txt"
                    282:     CreateShortCut "$SMPROGRAMS\smartmontools\Documentation\CHANGELOG.lnk" "$INSTDIR\doc\CHANGELOG.txt"
                    283:     CreateShortCut "$SMPROGRAMS\smartmontools\Documentation\COPYING.lnk"   "$INSTDIR\doc\COPYING.txt"
                    284:     CreateShortCut "$SMPROGRAMS\smartmontools\Documentation\INSTALL.lnk"   "$INSTDIR\doc\INSTALL.txt"
                    285:     CreateShortCut "$SMPROGRAMS\smartmontools\Documentation\NEWS.lnk"      "$INSTDIR\doc\NEWS.txt"
                    286:     CreateShortCut "$SMPROGRAMS\smartmontools\Documentation\README.lnk"    "$INSTDIR\doc\README.txt"
                    287:     CreateShortCut "$SMPROGRAMS\smartmontools\Documentation\TODO.lnk"      "$INSTDIR\doc\TODO.txt"
                    288:     CreateShortCut "$SMPROGRAMS\smartmontools\Documentation\WARNINGS.lnk"  "$INSTDIR\doc\WARNINGS.txt"
                    289:     CreateShortCut "$SMPROGRAMS\smartmontools\Documentation\Windows version download page.lnk" "http://smartmontools-win32.dyndns.org/smartmontools/"
                    290:   nodoc:
                    291: 
                    292:   ; Homepage
                    293:   CreateShortCut "$SMPROGRAMS\smartmontools\smartmontools Home Page.lnk" "http://smartmontools.sourceforge.net/"
                    294: 
                    295:   ; drivedb.h update
                    296:   IfFileExists "$INSTDIR\bin\update-smart-drivedb.exe" 0 noupdb
                    297:     SetOutPath "$INSTDIR\bin"
                    298:     !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\drivedb.h update.lnk" "$INSTDIR\bin\update-smart-drivedb.exe" ""
                    299:   noupdb:
                    300: 
                    301:   ; Uninstall
                    302:   IfFileExists "$INSTDIR\uninst-smartmontools.exe" 0 noinst
                    303:     SetOutPath "$INSTDIR"
                    304:     !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\Uninstall smartmontools.lnk" "$INSTDIR\uninst-smartmontools.exe" ""
                    305:   noinst:
                    306: 
                    307: SectionEnd
                    308: 
                    309: Section "Add install dir to PATH" PATH_SECTION
                    310: 
                    311:   SectionIn 1
                    312: 
                    313:   IfFileExists "$WINDIR\system32\cmd.exe" 0 +3
                    314:     Push "$INSTDIR\bin"
                    315:     Call AddToPath
                    316:  
                    317: SectionEnd
                    318: 
                    319: SectionGroup "Add smartctl to drive menu"
                    320: 
                    321: !macro DriveMenuRemove
                    322:   DetailPrint "Remove drive menu entries"
                    323:   DeleteRegKey HKCR "Drive\shell\smartctl0"
                    324:   DeleteRegKey HKCR "Drive\shell\smartctl1"
                    325:   DeleteRegKey HKCR "Drive\shell\smartctl2"
                    326:   DeleteRegKey HKCR "Drive\shell\smartctl3"
                    327:   DeleteRegKey HKCR "Drive\shell\smartctl4"
                    328:   DeleteRegKey HKCR "Drive\shell\smartctl5"
                    329: !macroend
                    330: 
                    331:   Section "Remove existing entries first" DRIVE_REMOVE_SECTION
                    332:     SectionIn 3
                    333:     !insertmacro DriveMenuRemove
                    334:   SectionEnd
                    335: 
                    336: !macro DriveSection id name args
                    337:   Section 'smartctl ${args} ...' DRIVE_${id}_SECTION
                    338:     SectionIn 3
                    339:     Call CheckRunCmdA
                    340:     DetailPrint 'Add drive menu entry "${name}": smartctl ${args} ...'
                    341:     WriteRegStr HKCR "Drive\shell\smartctl${id}" "" "${name}"
                    342:     WriteRegStr HKCR "Drive\shell\smartctl${id}\command" "" '"$INSTDIR\bin\runcmda.exe" "$INSTDIR\bin\smartctl.exe" ${args} %L'
                    343:   SectionEnd
                    344: !macroend
                    345: 
                    346:   !insertmacro DriveSection 0 "SMART all info"       "-a"
                    347:   !insertmacro DriveSection 1 "SMART status"         "-Hc"
                    348:   !insertmacro DriveSection 2 "SMART attributes"     "-A"
                    349:   !insertmacro DriveSection 3 "SMART short selftest" "-t short"
                    350:   !insertmacro DriveSection 4 "SMART long selftest"  "-t long"
                    351:   !insertmacro DriveSection 5 "SMART continue selective selftest"  '-t "selective,cont"'
                    352: 
                    353: SectionGroupEnd
                    354: 
                    355: Section "UBCD4Win Plugin" UBCD_SECTION
                    356: 
                    357:   SectionIn 4
                    358: 
                    359:   SetOutPath "$UBCDDIR"
                    360:   DetailPrint "Create file: smartmontools.inf"
                    361:   FileOpen $0 "$UBCDDIR\smartmontools.inf" "w"
                    362:   FileWrite $0 '; smartmontools.inf$\r$\n; PE Builder v3 plug-in INF file$\r$\n'
                    363:   FileWrite $0 '; Created by smartmontools installer$\r$\n'
                    364:   FileWrite $0 '; http://smartmontools.sourceforge.net/$\r$\n$\r$\n'
                    365:   FileWrite $0 '[Version]$\r$\nSignature= "$$Windows NT$$"$\r$\n$\r$\n'
                    366:   FileWrite $0 '[PEBuilder]$\r$\nName="Disk -Diagnostic: smartmontools"$\r$\n'
                    367:   FileWrite $0 'Enable=1$\r$\nHelp="files\smartctl.8.html"$\r$\n$\r$\n'
                    368:   FileWrite $0 '[WinntDirectories]$\r$\na=Programs\smartmontools,2$\r$\n$\r$\n'
                    369:   FileWrite $0 '[SourceDisksFolders]$\r$\nfiles=a,,1$\r$\n$\r$\n'
                    370:   FileWrite $0 '[Append]$\r$\nnu2menu.xml, smartmontools_nu2menu.xml$\r$\n'
                    371:   FileClose $0
                    372: 
                    373:   DetailPrint "Create file: smartmontools_nu2menu.xml"
                    374:   FileOpen $0 "$UBCDDIR\smartmontools_nu2menu.xml" "w"
                    375:   FileWrite $0 '<!-- Nu2Menu entry for smartmontools -->$\r$\n<NU2MENU>$\r$\n'
                    376:   FileWrite $0 '$\t<MENU ID="Programs">$\r$\n$\t$\t<MITEM TYPE="POPUP" MENUID="Disk Tools">'
                    377:   FileWrite $0 'Disk Tools</MITEM>$\r$\n$\t</MENU>$\r$\n$\t<MENU ID="Disk Tools">$\r$\n'
                    378:   FileWrite $0 '$\t$\t<MITEM TYPE="POPUP" MENUID="Diagnostic">Diagnostic</MITEM>$\r$\n$\t</MENU>'
                    379:   FileWrite $0 '$\r$\n$\t<MENU ID="Diagnostic">$\r$\n$\t$\t<MITEM TYPE="ITEM" DISABLED="'
                    380:   FileWrite $0 '@Not(@FileExists(@GetProgramDrive()\Programs\smartmontools\smartctl.exe))" '
                    381:   FileWrite $0 'CMD="RUN" FUNC="cmd.exe /k cd /d @GetProgramDrive()\Programs\smartmontools&'
                    382:   FileWrite $0 'set PATH=@GetProgramDrive()\Programs\smartmontools;%PATH%  ">'
                    383:   FileWrite $0 'smartctl</MITEM>$\r$\n$\t</MENU>$\r$\n</NU2MENU>$\r$\n'
                    384:   FileClose $0
                    385:   
                    386:   SetOutPath "$UBCDDIR\files"
                    387:   File "${INPDIR}\bin\smartctl.exe"
                    388:   File "${INPDIR}\bin\smartd.exe"
                    389:   File "${INPDIR}\doc\smartctl.8.html"
                    390:   File "${INPDIR}\doc\smartctl.8.txt"
                    391:   File "${INPDIR}\doc\smartd.8.html"
                    392:   File "${INPDIR}\doc\smartd.8.txt"
                    393:   File "${INPDIR}\doc\smartd.conf"
                    394: 
                    395: SectionEnd
                    396: 
                    397: 
                    398: ;--------------------------------------------------------------------
                    399: 
                    400: Section "Uninstall"
                    401:   
                    402:   ; Stop & remove service
                    403:   IfFileExists "$INSTDIR\bin\smartd.exe" 0 nosrv
                    404:     ReadRegStr $0 HKLM "System\CurrentControlSet\Services\smartd" "ImagePath"
                    405:     StrCmp $0 "" nosrv
                    406:       ExecWait "net stop smartd"
                    407:       MessageBox MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2  "Remove smartd service ?" IDYES 0 IDNO nosrv
                    408:         ExecWait "$INSTDIR\bin\smartd.exe remove"
                    409:   nosrv:
                    410: 
                    411:   ; Remove installer registry keys
                    412:   DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\smartmontools"
                    413:   DeleteRegKey HKLM "Software\smartmontools"
                    414: 
                    415:   ; Remove conf file ?
                    416:   IfFileExists "$INSTDIR\bin\smartd.conf" 0 noconf
                    417:     ; Assume unchanged if timestamp is equal to sample file
                    418:     GetFileTime "$INSTDIR\bin\smartd.conf" $0 $1
                    419:     GetFileTime "$INSTDIR\doc\smartd.conf" $2 $3
                    420:     StrCmp "$0:$1" "$2:$3" +2 0
                    421:       MessageBox MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2  "Delete configuration file$\n$INSTDIR\bin\smartd.conf ?" IDYES 0 IDNO noconf
                    422:         Delete "$INSTDIR\bin\smartd.conf"
                    423:   noconf:
                    424: 
                    425:   ; Remove log file ?
                    426:   IfFileExists "$INSTDIR\bin\smartd.log" 0 +3
                    427:     MessageBox MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2  "Delete log file$\n$INSTDIR\bin\smartd.log ?" IDYES 0 IDNO +2
                    428:       Delete "$INSTDIR\bin\smartd.log"
                    429: 
                    430:   ; Remove drivedb-add file ?
                    431:   IfFileExists "$INSTDIR\bin\drivedb-add.h" 0 +3
                    432:     MessageBox MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2  "Delete local drive database file$\n$INSTDIR\bin\drivedb-add.h ?" IDYES 0 IDNO +2
                    433:       Delete "$INSTDIR\bin\drivedb-add.h"
                    434: 
                    435:   ; Remove files
                    436:   Delete "$INSTDIR\bin\smartctl.exe"
                    437:   Delete "$INSTDIR\bin\smartctl-nc.exe"
                    438:   Delete "$INSTDIR\bin\smartd.exe"
                    439:   Delete "$INSTDIR\bin\syslogevt.exe"
                    440:   Delete "$INSTDIR\bin\drivedb.h"
                    441:   Delete "$INSTDIR\bin\drivedb.h.error"
                    442:   Delete "$INSTDIR\bin\drivedb.h.lastcheck"
                    443:   Delete "$INSTDIR\bin\drivedb.h.old"
                    444:   Delete "$INSTDIR\bin\update-smart-drivedb.exe"
                    445:   Delete "$INSTDIR\bin\smartctl-run.bat"
                    446:   Delete "$INSTDIR\bin\smartd-run.bat"
                    447:   Delete "$INSTDIR\bin\net-run.bat"
                    448:   Delete "$INSTDIR\bin\runcmda.exe"
                    449:   Delete "$INSTDIR\bin\runcmda.exe.manifest"
                    450:   Delete "$INSTDIR\bin\runcmdu.exe"
                    451:   Delete "$INSTDIR\bin\runcmdu.exe.manifest"
                    452:   Delete "$INSTDIR\doc\AUTHORS.txt"
                    453:   Delete "$INSTDIR\doc\CHANGELOG.txt"
                    454:   Delete "$INSTDIR\doc\COPYING.txt"
                    455:   Delete "$INSTDIR\doc\INSTALL.txt"
                    456:   Delete "$INSTDIR\doc\NEWS.txt"
                    457:   Delete "$INSTDIR\doc\README.txt"
                    458:   Delete "$INSTDIR\doc\TODO.txt"
                    459:   Delete "$INSTDIR\doc\WARNINGS.txt"
                    460:   Delete "$INSTDIR\doc\checksums.txt"
                    461:   Delete "$INSTDIR\doc\smartctl.8.html"
                    462:   Delete "$INSTDIR\doc\smartctl.8.txt"
                    463:   Delete "$INSTDIR\doc\smartd.8.html"
                    464:   Delete "$INSTDIR\doc\smartd.8.txt"
                    465:   Delete "$INSTDIR\doc\smartd.conf"
                    466:   Delete "$INSTDIR\doc\smartd.conf.5.html"
                    467:   Delete "$INSTDIR\doc\smartd.conf.5.txt"
                    468:   Delete "$INSTDIR\uninst-smartmontools.exe"
                    469: 
                    470:   ; Remove shortcuts
                    471:   SetShellVarContext all
                    472:   Delete "$SMPROGRAMS\smartmontools\*.*"
                    473:   Delete "$SMPROGRAMS\smartmontools\Documentation\*.*"
                    474:   Delete "$SMPROGRAMS\smartmontools\smartctl Examples\*.*"
                    475:   Delete "$SMPROGRAMS\smartmontools\smartd Examples\*.*"
                    476: 
                    477:   ; Remove folders
                    478:   RMDir  "$SMPROGRAMS\smartmontools\Documentation"
                    479:   RMDir  "$SMPROGRAMS\smartmontools\smartctl Examples"
                    480:   RMDir  "$SMPROGRAMS\smartmontools\smartd Examples"
                    481:   RMDir  "$SMPROGRAMS\smartmontools"
                    482:   RMDir  "$INSTDIR\bin"
                    483:   RMDir  "$INSTDIR\doc"
                    484:   RMDir  "$INSTDIR"
                    485: 
                    486:   ; Remove install dir from PATH
                    487:   IfFileExists "$WINDIR\system32\cmd.exe" 0 +3
                    488:     Push "$INSTDIR\bin"
                    489:     Call un.RemoveFromPath
                    490: 
                    491:   ; Remove drive menu registry entries
                    492:   !insertmacro DriveMenuRemove
                    493: 
                    494:   ; Check for still existing entries
                    495:   IfFileExists "$INSTDIR\bin\smartd.exe" 0 +3
                    496:     MessageBox MB_OK|MB_ICONEXCLAMATION "$INSTDIR\bin\smartd.exe could not be removed.$\nsmartd is possibly still running."
                    497:     Goto +3
                    498:   IfFileExists "$INSTDIR" 0 +2
                    499:     MessageBox MB_OK "Note: $INSTDIR could not be removed."
                    500: 
                    501:   IfFileExists "$SMPROGRAMS\smartmontools" 0 +2
                    502:     MessageBox MB_OK "Note: $SMPROGRAMS\smartmontools could not be removed."
                    503: 
                    504: SectionEnd
                    505: 
                    506: ;--------------------------------------------------------------------
                    507: ; Functions
                    508: 
                    509: Function .onInit
                    510: 
                    511:   ; Use Notepad++ if installed
                    512:   StrCpy $EDITOR "$PROGRAMFILES\Notepad++\notepad++.exe"
                    513:   IfFileExists "$EDITOR" +2 0
                    514:     StrCpy $EDITOR "notepad.exe"
                    515: 
                    516:   ; Get UBCD4Win install location
                    517:   ReadRegStr $0 HKLM "Software\UBCD4Win" "InstallPath"
                    518:   StrCmp $0 "" 0 +2
                    519:     StrCpy $0 "C:\UBCD4Win"
                    520:   StrCpy $UBCDDIR "$0\plugin\Disk\Diagnostic\smartmontools"
                    521: 
                    522:   ; Hide "Add install dir to PATH" on 9x/ME
                    523:   IfFileExists "$WINDIR\system32\cmd.exe" +2 0
                    524:     SectionSetText ${PATH_SECTION} ""
                    525: 
                    526:   Call ParseCmdLine
                    527: FunctionEnd
                    528: 
                    529: ; Command line parsing
                    530: !macro CheckCmdLineOption name section
                    531:   StrCpy $allopts "$allopts,${name}"
                    532:   Push ",$opts,"
                    533:   Push ",${name},"
                    534:   Call StrStr
                    535:   Pop $0
                    536:   StrCmp $0 "" 0 sel_${name}
                    537:   !insertmacro UnselectSection ${section}
                    538:   Goto done_${name}
                    539: sel_${name}:
                    540:   !insertmacro SelectSection ${section}
                    541:   StrCpy $nomatch ""
                    542: done_${name}:
                    543: !macroend
                    544: 
                    545: Function ParseCmdLine
                    546:   ; get /SO option
                    547:   Var /global opts
                    548:   ${GetParameters} $R0
                    549:   ${GetOptions} $R0 "/SO" $opts
                    550:   IfErrors 0 +2
                    551:     Return
                    552:   Var /global allopts
                    553:   StrCpy $allopts ""
                    554:   Var /global nomatch
                    555:   StrCpy $nomatch "t"
                    556:   ; turn sections on or off
                    557:   !insertmacro CheckCmdLineOption "smartctl" ${SMARTCTL_SECTION}
                    558:   !insertmacro CheckCmdLineOption "smartd" ${SMARTD_SECTION}
                    559:   !insertmacro CheckCmdLineOption "smartctlnc" ${SMARTCTL_NC_SECTION}
                    560:   !insertmacro CheckCmdLineOption "drivedb" ${DRIVEDB_SECTION}
                    561:   !insertmacro CheckCmdLineOption "doc" ${DOC_SECTION}
                    562:   !insertmacro CheckCmdLineOption "uninst" ${UNINST_SECTION}
                    563:   !insertmacro CheckCmdLineOption "menu" ${MENU_SECTION}
                    564:   !insertmacro CheckCmdLineOption "path" ${PATH_SECTION}
                    565:   !insertmacro CheckCmdLineOption "driveremove" ${DRIVE_REMOVE_SECTION}
                    566:   !insertmacro CheckCmdLineOption "drive0" ${DRIVE_0_SECTION}
                    567:   !insertmacro CheckCmdLineOption "drive1" ${DRIVE_1_SECTION}
                    568:   !insertmacro CheckCmdLineOption "drive2" ${DRIVE_2_SECTION}
                    569:   !insertmacro CheckCmdLineOption "drive3" ${DRIVE_3_SECTION}
                    570:   !insertmacro CheckCmdLineOption "drive4" ${DRIVE_4_SECTION}
                    571:   !insertmacro CheckCmdLineOption "drive5" ${DRIVE_5_SECTION}
                    572:   !insertmacro CheckCmdLineOption "ubcd" ${UBCD_SECTION}
                    573:   StrCmp $opts "-" done
                    574:   StrCmp $nomatch "" done
                    575:     StrCpy $0 "$allopts,-" "" 1
                    576:     MessageBox MB_OK "Usage: smartmontools-VERSION.win32-setup [/S] [/SO component,...] [/D=INSTDIR]$\n$\ncomponents:$\n  $0"
                    577:     Abort
                    578: done:
                    579: FunctionEnd
                    580: 
                    581: ; Directory page callbacks
                    582: 
                    583: !macro CheckSection section
                    584:   SectionGetFlags ${section} $0
                    585:   IntOp $0 $0 & 1
                    586:   IntCmp $0 1 done
                    587: !macroend
                    588: 
                    589: Function SkipProgPath
                    590:   !insertmacro CheckSection ${SMARTCTL_SECTION}
                    591:   !insertmacro CheckSection ${SMARTCTL_NC_SECTION}
                    592:   !insertmacro CheckSection ${SMARTD_SECTION}
                    593:   !insertmacro CheckSection ${DRIVEDB_SECTION}
                    594:   !insertmacro CheckSection ${DOC_SECTION}
                    595:   !insertmacro CheckSection ${MENU_SECTION}
                    596:   !insertmacro CheckSection ${PATH_SECTION}
                    597:   !insertmacro CheckSection ${DRIVE_0_SECTION}
                    598:   !insertmacro CheckSection ${DRIVE_1_SECTION}
                    599:   !insertmacro CheckSection ${DRIVE_2_SECTION}
                    600:   !insertmacro CheckSection ${DRIVE_3_SECTION}
                    601:   !insertmacro CheckSection ${DRIVE_4_SECTION}
                    602:   !insertmacro CheckSection ${DRIVE_5_SECTION}
                    603:   Abort
                    604: done:
                    605: FunctionEnd
                    606: 
                    607: Function SkipUBCDPath
                    608:   !insertmacro CheckSection ${UBCD_SECTION}
                    609:   Abort
                    610: done:
                    611: FunctionEnd
                    612: 
                    613: 
                    614: ; Install runcmda.exe if missing
                    615: 
                    616: Function CheckRunCmdA
                    617:   IfFileExists "$INSTDIR\bin\runcmda.exe" done 0
                    618:     SetOutPath "$INSTDIR\bin"
                    619:     File "${INPDIR}\bin\runcmda.exe"
                    620:     File "${INPDIR}\bin\runcmda.exe.manifest"
                    621:   done:
                    622: FunctionEnd
                    623: 
                    624: 
                    625: ;--------------------------------------------------------------------
                    626: ; Path functions
                    627: ;
                    628: ; Based on example from:
                    629: ; http://nsis.sourceforge.net/Path_Manipulation
                    630: ;
                    631: 
                    632: 
                    633: !include "WinMessages.nsh"
                    634: 
                    635: ; Registry Entry for environment (NT4,2000,XP)
                    636: ; All users:
                    637: ;!define Environ 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
                    638: ; Current user only:
                    639: !define Environ 'HKCU "Environment"'
                    640: 
                    641: 
                    642: ; AddToPath - Appends dir to PATH
                    643: ;   (does not work on Win9x/ME)
                    644: ;
                    645: ; Usage:
                    646: ;   Push "dir"
                    647: ;   Call AddToPath
                    648: 
                    649: Function AddToPath
                    650:   Exch $0
                    651:   Push $1
                    652:   Push $2
                    653:   Push $3
                    654: 
                    655:   ReadRegStr $1 ${Environ} "PATH"
                    656:   Push "$1;"
                    657:   Push "$0;"
                    658:   Call StrStr
                    659:   Pop $2
                    660:   StrCmp $2 "" 0 done
                    661:   Push "$1;"
                    662:   Push "$0\;"
                    663:   Call StrStr
                    664:   Pop $2
                    665:   StrCmp $2 "" 0 done
                    666: 
                    667:   DetailPrint "Add to PATH: $0"
                    668:   StrCpy $2 $1 1 -1
                    669:   StrCmp $2 ";" 0 +2
                    670:     StrCpy $1 $1 -1 ; remove trailing ';'
                    671:   StrCmp $1 "" +2   ; no leading ';'
                    672:     StrCpy $0 "$1;$0"
                    673:   WriteRegExpandStr ${Environ} "PATH" $0
                    674:   SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
                    675: 
                    676: done:
                    677:   Pop $3
                    678:   Pop $2
                    679:   Pop $1
                    680:   Pop $0
                    681: FunctionEnd
                    682: 
                    683: 
                    684: ; RemoveFromPath - Removes dir from PATH
                    685: ;
                    686: ; Usage:
                    687: ;   Push "dir"
                    688: ;   Call RemoveFromPath
                    689: 
                    690: Function un.RemoveFromPath
                    691:   Exch $0
                    692:   Push $1
                    693:   Push $2
                    694:   Push $3
                    695:   Push $4
                    696:   Push $5
                    697:   Push $6
                    698: 
                    699:   ReadRegStr $1 ${Environ} "PATH"
                    700:   StrCpy $5 $1 1 -1
                    701:   StrCmp $5 ";" +2
                    702:     StrCpy $1 "$1;" ; ensure trailing ';'
                    703:   Push $1
                    704:   Push "$0;"
                    705:   Call un.StrStr
                    706:   Pop $2 ; pos of our dir
                    707:   StrCmp $2 "" done
                    708: 
                    709:   DetailPrint "Remove from PATH: $0"
                    710:   StrLen $3 "$0;"
                    711:   StrLen $4 $2
                    712:   StrCpy $5 $1 -$4 ; $5 is now the part before the path to remove
                    713:   StrCpy $6 $2 "" $3 ; $6 is now the part after the path to remove
                    714:   StrCpy $3 "$5$6"
                    715:   StrCpy $5 $3 1 -1
                    716:   StrCmp $5 ";" 0 +2
                    717:     StrCpy $3 $3 -1 ; remove trailing ';'
                    718:   WriteRegExpandStr ${Environ} "PATH" $3
                    719:   SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
                    720: 
                    721: done:
                    722:   Pop $6
                    723:   Pop $5
                    724:   Pop $4
                    725:   Pop $3
                    726:   Pop $2
                    727:   Pop $1
                    728:   Pop $0
                    729: FunctionEnd
                    730:  
                    731: 
                    732: ; StrStr - find substring in a string
                    733: ;
                    734: ; Usage:
                    735: ;   Push "this is some string"
                    736: ;   Push "some"
                    737: ;   Call StrStr
                    738: ;   Pop $0 ; "some string"
                    739: 
                    740: !macro StrStr un
                    741: Function ${un}StrStr
                    742:   Exch $R1 ; $R1=substring, stack=[old$R1,string,...]
                    743:   Exch     ;                stack=[string,old$R1,...]
                    744:   Exch $R2 ; $R2=string,    stack=[old$R2,old$R1,...]
                    745:   Push $R3
                    746:   Push $R4
                    747:   Push $R5
                    748:   StrLen $R3 $R1
                    749:   StrCpy $R4 0
                    750:   ; $R1=substring, $R2=string, $R3=strlen(substring)
                    751:   ; $R4=count, $R5=tmp
                    752:   loop:
                    753:     StrCpy $R5 $R2 $R3 $R4
                    754:     StrCmp $R5 $R1 done
                    755:     StrCmp $R5 "" done
                    756:     IntOp $R4 $R4 + 1
                    757:     Goto loop
                    758: done:
                    759:   StrCpy $R1 $R2 "" $R4
                    760:   Pop $R5
                    761:   Pop $R4
                    762:   Pop $R3
                    763:   Pop $R2
                    764:   Exch $R1 ; $R1=old$R1, stack=[result,...]
                    765: FunctionEnd
                    766: !macroend
                    767: !insertmacro StrStr ""
                    768: !insertmacro StrStr "un."
                    769: 
                    770: 
                    771: ;--------------------------------------------------------------------
                    772: ; Set Run As Administrator flag in shortcut
                    773: ;
                    774: ; Slightly modified version from:
                    775: ; http://nsis.sourceforge.net/IShellLink_Set_RunAs_flag
                    776: ;
                    777: 
                    778: !include "LogicLib.nsh"
                    779: 
                    780: !define IPersistFile {0000010b-0000-0000-c000-000000000046}
                    781: !define CLSID_ShellLink {00021401-0000-0000-C000-000000000046}
                    782: !define IID_IShellLinkA {000214EE-0000-0000-C000-000000000046}
                    783: !define IID_IShellLinkW {000214F9-0000-0000-C000-000000000046}
                    784: !define IShellLinkDataList {45e2b4ae-b1c3-11d0-b92f-00a0c90312e1}
                    785: !ifdef NSIS_UNICODE
                    786:   !define IID_IShellLink ${IID_IShellLinkW}
                    787: !else
                    788:   !define IID_IShellLink ${IID_IShellLinkA}
                    789: !endif
                    790: 
                    791: Function ShellLinkSetRunAs
                    792:   System::Store S ; push $0-$9, $R0-$R9
                    793:   pop $9
                    794:   ; $0 = CoCreateInstance(CLSID_ShellLink, 0, CLSCTX_INPROC_SERVER, IID_IShellLink, &$1)
                    795:   System::Call "ole32::CoCreateInstance(g'${CLSID_ShellLink}',i0,i1,g'${IID_IShellLink}',*i.r1)i.r0"
                    796:   ${If} $0 = 0
                    797:     System::Call "$1->0(g'${IPersistFile}',*i.r2)i.r0" ; $0 = $1->QueryInterface(IPersistFile, &$2)
                    798:     ${If} $0 = 0
                    799:       System::Call "$2->5(w '$9',i 0)i.r0" ; $0 = $2->Load($9, STGM_READ)
                    800:       ${If} $0 = 0
                    801:         System::Call "$1->0(g'${IShellLinkDataList}',*i.r3)i.r0" ; $0 = $1->QueryInterface(IShellLinkDataList, &$3)
                    802:         ${If} $0 = 0
                    803:           System::Call "$3->6(*i.r4)i.r0"; $0 = $3->GetFlags(&$4)
                    804:           ${If} $0 = 0
                    805:             System::Call "$3->7(i $4|0x2000)i.r0" ; $0 = $3->SetFlags($4|SLDF_RUNAS_USER)
                    806:             ${If} $0 = 0
                    807:               System::Call "$2->6(w '$9',i1)i.r0" ; $2->Save($9, TRUE)
                    808:             ${EndIf}
                    809:           ${EndIf}
                    810:           System::Call "$3->2()" ; $3->Release()
                    811:         ${EndIf}
                    812:         System::Call "$2->2()" ; $2->Release()
                    813:       ${EndIf}
                    814:     ${EndIf}
                    815:     System::Call "$1->2()" ; $1->Release()
                    816:   ${EndIf}
                    817:   ${If} $0 <> 0
                    818:     DetailPrint "Set RunAsAdmin: $9 failed ($0)"
                    819:   ${Else}
                    820:     DetailPrint "Set RunAsAdmin: $9"
                    821:   ${EndIf}
                    822:   System::Store L ; push $0-$9, $R0-$R9
                    823: FunctionEnd

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>