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

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

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