Установка ClamAV 0.94.2 порт для Win32. Порт собран в MinGW.
Программа достаточно "капризна" особенно при обновлении, и правильно поставить её с использованием иного кода - sorry... В оригинальном ClamAV такого я не наблюдал, здесь явно что-то изменено, но пока я исходники не сравнивал, а изменения в них.
[more=Программа, вырезана только личная часть кода не влияющая на исполнение]!define PRODUCT_NAME "ClamAV Win32"
!define PRODUCT_VERSION "0.94.2"
!define PRODUCT_PUBLISHER "Copyright © 2008 - Gianluigi Tiesi [sherpya@netfarm.it] - Netfarm S.r.l."
!define PRODUCT_WEB_SITE "http://oss.netfarm.it/clamav/"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\clamav.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
!define PRODUCT_STARTMENU_REGVAL "NSIS:StartMenuDir"
SetCompressor /solid lzma
!include "MUI.nsh"
!include "TextReplace.nsh"
!include "ProcLib.nsh"
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install-blue-full.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall-blue-full.ico"
!define MUI_WELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\InnoSetupWiz.bmp"
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\InnoSetupWiz.bmp"
!define MUI_LANGDLL_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
!define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
!define MUI_LANGDLL_REGISTRY_VALUENAME "NSIS:Language"
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "ClamAV\gpl.txt"
var ICONS_GROUP
!define MUI_STARTMENUPAGE_NODISABLE
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "ClamAV"
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${PRODUCT_STARTMENU_REGVAL}"
!insertmacro MUI_PAGE_STARTMENU Application $ICONS_GROUP
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_RUN "$INSTDIR\clamav.exe"
!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\readme.txt"
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "Russian"
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "clamav-setup.exe"
InstallDir "$PROGRAMFILES\ClamAV"
InstallDirRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\clamav.exe" "Path"
RequestExecutionLevel admin
BrandingText "ClamAV 0.94.2 Antivirus Native Win32 Port"
ShowInstDetails hide
ShowUnInstDetails hide
XPStyle on
/*
*/
!define HAVE_UPX
!ifdef HAVE_UPX
!packhdr tmpexe.tmp "UPX --best -q --compress-icons=0 tmpexe.tmp"
!endif
Function syserrm
StrCmp $LANGUAGE 1049 +1 +2
MessageBox MB_OK|MB_ICONSTOP "Извините, но возникла системная ошибка с кодом $0 и Установка прервана.$\nПожалуйста, обратитесь к Администратору для решения этой проблемы." IDOK +2
MessageBox MB_OK|MB_ICONSTOP "Sorry, but detected is system error code is $0 and Setup is aborted.$\nPlease, take to Administrator for resolving this problem."
Quit
Return
FunctionEnd
Function unsuppm
StrCmp $LANGUAGE 1049 +1 +2
MessageBox MB_OK|MB_ICONSTOP "Извините, но это не поддерживаемая версия Windows.$\nУстановка ClamAV на этой платформе невозможна." IDOK +2
MessageBox MB_OK|MB_ICONSTOP "Sorry, but this unsupported Windows version.$\nSetting up ClamAV on this platform is impossible." IDOK +1
Quit
Return
FunctionEnd
Function acessd
StrCmp $LANGUAGE 1049 +1 +2
MessageBox MB_OK|MB_ICONSTOP "Извините, но у Вас нет прав для продолжения Установки.$\nПожалуйста, обратитесь к Администратору для предоставления Вам необходимых прав." IDOK +2
MessageBox MB_OK|MB_ICONSTOP "Sorry, but Your don't have rights for continue Setup.$\nPlease, take to Administrator for get Your needed rights."
Quit
Return
FunctionEnd
Function manterm
StrCmp $LANGUAGE 1049 +1 +2
MessageBox MB_OK|MB_ICONSTOP "Извините, но некоторые процессы не удалось завершить$\nавтоматически. Пожалуйста, завершите их вручную ипользуя$\nДиспетчер задач и запустите Установку снова." IDOK +2
MessageBox MB_OK|MB_ICONSTOP "Sorry, but some proces is automatical terminate is$\nfiled. Please, close this program manually using Task Manager$\nand run Setup again if Your whole continue."
Quit
Return
FunctionEnd
Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
${nsProcess::FindProcess} "update.exe" $0
StrCmp $0 0 +7
${nsProcess::FindProcess} "install.exe" $0
StrCmp $0 0 +5
${nsProcess::FindProcess} "upgrade.exe" $0
StrCmp $0 0 +3
${nsProcess::FindProcess} "msiexec.exe" $0
StrCmp $0 0 +1 +6
StrCmp $LANGUAGE 1049 +1 +2
MessageBox MB_OK|MB_ICONEXCLAMATION "Внимание! Запущена другая программа установки.$\nУстановка прекращает свою работу. Пожалуйста,$\nзапустите Установку после её завершения." IDOK +2
MessageBox MB_OK|MB_ICONEXCLAMATION "Waring! An over installer already running.$\nSetup can't continue. Please, run this$\nSetup then an over setup is finished."
Quit
StrCpy $0 0
UserInfo::GetAccountType
Pop $0
StrCmp $0 "Admin" +6 +1
StrCmp $LANGUAGE 1049 +1 +2
MessageBox MB_OK|MB_ICONEXCLAMATION "Извините, но у Вас недостаточно прав для установки ClamAV.$\nУстановка прекращена. Пожалуйста, обратитесь к Администратору для предоставления Вам необходимых прав." IDOK +2
MessageBox MB_OK|MB_ICONEXCLAMATION "Sorry, but Your don't have required rigths for continue installation ClamAV.$\nSetup is aborted. Please, take to Administrator for get Your needed rigths."
Quit
MoreInfo::GetProductVersion "$INSTDIR\clamd.exe"
Push "0,94,2,0"
xtInfo::CompareVersion
Pop $0
StrCmp $0 -1 +1 +6
StrCmp $LANGUAGE 1049 +2
MessageBox MB_ICONINFORMATION|MB_OK "You have nevest version ClamAV. Setup is terminated." IDOK +2
MessageBox MB_ICONINFORMATION|MB_OK "У Вас стоит более новая версия ClamAV. Установка прервана." IDOK +1
Quit
FunctionEnd
Section "-check"
nsSCM::Stop /NOUNLOAD "ClamD"
Pop $0
IntCmp $0 1 -2 +1 -2
nsSCM::Stop /NOUNLOAD "FreshClam"
Pop $0
IntCmp $0 1 -2 +1 -2
${nsProcess::FindProcess} "exeScanner.exe" $0
IntCmp $0 603 +2 +1 lblerr
${nsProcess::KillProcess} "exeScanner.exe" $0
StrCmp $0 0 +4 +1
IntCmp $0 603 +2 +1 lblerr
Call manterm
${nsProcess::FindProcess} "clamscan.exe" $0
IntCmp $0 603 +2 +1 lblerr
${nsProcess::KillProcess} "clamscan.exe" $0
StrCmp $0 0 +4 +1
IntCmp $0 603 +2 +1 lblerr
Call manterm
${nsProcess::FindProcess} "clamdscan.exe" $0
IntCmp $0 603 +2 +1 lblerr
${nsProcess::KillProcess} "clamdscan.exe" $0
StrCmp $0 0 +4 +1
IntCmp $0 603 +2 +1 lblerr
Call manterm
${nsProcess::FindProcess} "clamav.exe" $0
IntCmp $0 603 +2 +1 lblerr
${nsProcess::KillProcess} "clamav.exe" $0
StrCmp $0 0 +4 +1
IntCmp $0 603 +2 +1 lblerr
Call manterm
${nsProcess::FindProcess} "sigtool.exe" $0
IntCmp $0 603 +2 +1 lblerr
${nsProcess::KillProcess} "sigtool.exe" $0
StrCmp $0 0 +4 +1
IntCmp $0 603 +13 +1 lblerr
Call manterm
lblerr:
StrCmp $0 605 +6
IntCmp $0 606 +4 +1 +4
StrCmp $0 601 +5
StrCmp $0 602 +5
Call syserrm
Call unsuppm
Call acessd
Call manterm
${nsProcess::Unload}
SectionEnd
Section "Main" SEC01
SetOverwrite try
SetOutPath "$INSTDIR"
File "ClamAV\libclamunrar_iface.dll"
File "ClamAV\libclamunrar.dll"
File "ClamAV\libclamav.dll"
File "ClamAV\freshclam.exe"
File "ClamAV\exeScanner.exe"
File "ClamAV\clamscan.exe"
File "ClamAV\clamdscan.exe"
File "ClamAV\clamd.exe"
File "ClamAV\clamav.exe"
File "ClamAV\sigtool.exe"
File "ClamAV\SeDebug-Restore.exe"
SetOverwrite on
File "ClamAV\clamd.conf"
File "ClamAV\freshclam.conf"
File "ClamAV\gpl.txt"
File "ClamAV\readme.txt"
SectionEnd
Section -Post
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
SetShellVarContext All
CreateDirectory "$SMPROGRAMS\$ICONS_GROUP"
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\ClamAV.lnk" "$INSTDIR\clamav.exe"
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Read Me.lnk" "$INSTDIR\readme.txt"
WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\WEB Site.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk" "$INSTDIR\uninst.exe"
!insertmacro MUI_STARTMENU_WRITE_END
WriteUninstaller "$INSTDIR\uninst.exe"
WriteRegStr HKLM "System\CurrentControlSet\Services\ClamD" "DisplayName" "ClamWin Free Antivirus Scanner Service"
WriteRegStr HKLM "System\CurrentControlSet\Services\ClamD" "Description" "Provides virus scanning facilities for ClamWin Free Antivirus application"
WriteRegStr HKLM "System\CurrentControlSet\Services\FreshClam" "DisplayName" "ClamWin Free Antivirus Database Updater"
WriteRegStr HKLM "System\CurrentControlSet\Services\FreshClam" "Description" "Updates virus pattern database for ClamWin Free Antivirus application"
WriteRegStr HKLM "SOFTWARE\ClamAV" "ConfigDir" "$INSTDIR"
WriteRegStr HKLM "SOFTWARE\ClamAV" "DataDir" "$INSTDIR"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "Path" "$INSTDIR"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\clam.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "ClamAV native win32 port"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\freshclam.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
StrCpy $0 $INSTDIR 1
${textreplace::ReplaceInFile} "$INSTDIR\clamd.conf" "$INSTDIR\clamd.conf" "c:\" "$0:\" "/AO=1" $0
${textreplace::Unload}
nsSCM::Install /NOUNLOAD "ClamD" "ClamWin Free Antivirus Scanner Service" 16 2 "$INSTDIR\clamd.exe --daemon"
nsSCM::Install /NOUNLOAD "FreshClam" "ClamWin Free Antivirus Database Updater" 16 3 "$INSTDIR\freshclam.exe --daemon"
nsSCM::Start /NOUNLOAD "ClamD"
nsSCM::Start "FreshClam"
StrCpy $0 $EXEPATH 3
Delete "$0libclamunrar_iface.dll"
Delete "$0libclamunrar.dll"
Delete "$0libclamav.dll"
Delete "$0freshclam.exe"
Delete "$0exeScanner.exe"
Delete "$0clamscan.exe"
Delete "$0clamdscan.exe"
Delete "$0clamd.exe"
Delete "$0clamav.exe"
Delete "$0sigtool.exe"
Delete "$0SeDebug-Restore.exe"
Delete "$0clamd.conf"
Delete "$0freshclam.conf"
Delete "$0gpl.txt"
Delete "$0readme.txt"
SetAutoClose true
SectionEnd
Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "Удаление программы $(^Name) было успешно завершено."
FunctionEnd
Function un.onInit
!insertmacro MUI_UNGETLANGUAGE
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Вы уверены в том, что желаете удалить $(^Name) и все компоненты программы?" IDYES +2
Abort
FunctionEnd
Section Uninstall
nsSCM::Stop /NOUNLOAD "ClamD"
nsSCM::Stop /NOUNLOAD "FreshClam"
nsSCM::Remove /NOUNLOAD "ClamD"
nsSCM::Remove "FreshClam"
Pop $0
StrCmp $0 success +1 -2
${nsProcess::KillProcess} "clamscan.exe" $0
${nsProcess::KillProcess} "clamdscan.exe" $0
${nsProcess::KillProcess} "clamav.exe" $0
${nsProcess::FindProcess} "sigtool.exe" $0
${nsProcess::KillProcess} "sigtool.exe" $0
${nsProcess::Unload}
SetShellVarContext All
!insertmacro MUI_STARTMENU_GETFOLDER "Application" $ICONS_GROUP
Delete "$INSTDIR\${PRODUCT_NAME}.url"
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\readme.txt"
Delete "$INSTDIR\SeDebug-Restore.exe"
Delete "$INSTDIR\sigtool.exe"
Delete "$INSTDIR\clamav.exe"
Delete "$INSTDIR\clamd.conf"
Delete "$INSTDIR\clamd.exe"
Delete "$INSTDIR\clamdscan.exe"
Delete "$INSTDIR\clamscan.exe"
Delete "$INSTDIR\daily.cvd"
Delete "$INSTDIR\exeScanner.exe"
Delete "$INSTDIR\freshclam.conf"
Delete "$INSTDIR\freshclam.exe"
Delete "$INSTDIR\gpl.txt"
Delete "$INSTDIR\libclamav.dll"
Delete "$INSTDIR\libclamunrar.dll"
Delete "$INSTDIR\libclamunrar_iface.dll"
Delete "$INSTDIR\main.cvd"
Delete "$INSTDIR\mirrors.dat"
Delete "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk"
Delete "$SMPROGRAMS\$ICONS_GROUP\Website.lnk"
Delete "$SMPROGRAMS\$ICONS_GROUP\Read Me.lnk"
Delete "$SMPROGRAMS\$ICONS_GROUP\ClamAV.lnk"
RMDir "$SMPROGRAMS\$ICONS_GROUP"
RMDir "$INSTDIR"
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKLM "SOFTWARE\ClamAV"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
SetAutoClose true
SectionEnd[/more]
Код программы написан в среде NSIS 2.41 Update 1
Программа достаточно "капризна" особенно при обновлении, и правильно поставить её с использованием иного кода - sorry... В оригинальном ClamAV такого я не наблюдал, здесь явно что-то изменено, но пока я исходники не сравнивал, а изменения в них.
[more=Программа, вырезана только личная часть кода не влияющая на исполнение]!define PRODUCT_NAME "ClamAV Win32"
!define PRODUCT_VERSION "0.94.2"
!define PRODUCT_PUBLISHER "Copyright © 2008 - Gianluigi Tiesi [sherpya@netfarm.it] - Netfarm S.r.l."
!define PRODUCT_WEB_SITE "http://oss.netfarm.it/clamav/"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\clamav.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
!define PRODUCT_STARTMENU_REGVAL "NSIS:StartMenuDir"
SetCompressor /solid lzma
!include "MUI.nsh"
!include "TextReplace.nsh"
!include "ProcLib.nsh"
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install-blue-full.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall-blue-full.ico"
!define MUI_WELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\InnoSetupWiz.bmp"
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\InnoSetupWiz.bmp"
!define MUI_LANGDLL_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
!define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
!define MUI_LANGDLL_REGISTRY_VALUENAME "NSIS:Language"
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "ClamAV\gpl.txt"
var ICONS_GROUP
!define MUI_STARTMENUPAGE_NODISABLE
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "ClamAV"
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${PRODUCT_STARTMENU_REGVAL}"
!insertmacro MUI_PAGE_STARTMENU Application $ICONS_GROUP
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_RUN "$INSTDIR\clamav.exe"
!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\readme.txt"
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "Russian"
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "clamav-setup.exe"
InstallDir "$PROGRAMFILES\ClamAV"
InstallDirRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\clamav.exe" "Path"
RequestExecutionLevel admin
BrandingText "ClamAV 0.94.2 Antivirus Native Win32 Port"
ShowInstDetails hide
ShowUnInstDetails hide
XPStyle on
/*
*/
!define HAVE_UPX
!ifdef HAVE_UPX
!packhdr tmpexe.tmp "UPX --best -q --compress-icons=0 tmpexe.tmp"
!endif
Function syserrm
StrCmp $LANGUAGE 1049 +1 +2
MessageBox MB_OK|MB_ICONSTOP "Извините, но возникла системная ошибка с кодом $0 и Установка прервана.$\nПожалуйста, обратитесь к Администратору для решения этой проблемы." IDOK +2
MessageBox MB_OK|MB_ICONSTOP "Sorry, but detected is system error code is $0 and Setup is aborted.$\nPlease, take to Administrator for resolving this problem."
Quit
Return
FunctionEnd
Function unsuppm
StrCmp $LANGUAGE 1049 +1 +2
MessageBox MB_OK|MB_ICONSTOP "Извините, но это не поддерживаемая версия Windows.$\nУстановка ClamAV на этой платформе невозможна." IDOK +2
MessageBox MB_OK|MB_ICONSTOP "Sorry, but this unsupported Windows version.$\nSetting up ClamAV on this platform is impossible." IDOK +1
Quit
Return
FunctionEnd
Function acessd
StrCmp $LANGUAGE 1049 +1 +2
MessageBox MB_OK|MB_ICONSTOP "Извините, но у Вас нет прав для продолжения Установки.$\nПожалуйста, обратитесь к Администратору для предоставления Вам необходимых прав." IDOK +2
MessageBox MB_OK|MB_ICONSTOP "Sorry, but Your don't have rights for continue Setup.$\nPlease, take to Administrator for get Your needed rights."
Quit
Return
FunctionEnd
Function manterm
StrCmp $LANGUAGE 1049 +1 +2
MessageBox MB_OK|MB_ICONSTOP "Извините, но некоторые процессы не удалось завершить$\nавтоматически. Пожалуйста, завершите их вручную ипользуя$\nДиспетчер задач и запустите Установку снова." IDOK +2
MessageBox MB_OK|MB_ICONSTOP "Sorry, but some proces is automatical terminate is$\nfiled. Please, close this program manually using Task Manager$\nand run Setup again if Your whole continue."
Quit
Return
FunctionEnd
Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
${nsProcess::FindProcess} "update.exe" $0
StrCmp $0 0 +7
${nsProcess::FindProcess} "install.exe" $0
StrCmp $0 0 +5
${nsProcess::FindProcess} "upgrade.exe" $0
StrCmp $0 0 +3
${nsProcess::FindProcess} "msiexec.exe" $0
StrCmp $0 0 +1 +6
StrCmp $LANGUAGE 1049 +1 +2
MessageBox MB_OK|MB_ICONEXCLAMATION "Внимание! Запущена другая программа установки.$\nУстановка прекращает свою работу. Пожалуйста,$\nзапустите Установку после её завершения." IDOK +2
MessageBox MB_OK|MB_ICONEXCLAMATION "Waring! An over installer already running.$\nSetup can't continue. Please, run this$\nSetup then an over setup is finished."
Quit
StrCpy $0 0
UserInfo::GetAccountType
Pop $0
StrCmp $0 "Admin" +6 +1
StrCmp $LANGUAGE 1049 +1 +2
MessageBox MB_OK|MB_ICONEXCLAMATION "Извините, но у Вас недостаточно прав для установки ClamAV.$\nУстановка прекращена. Пожалуйста, обратитесь к Администратору для предоставления Вам необходимых прав." IDOK +2
MessageBox MB_OK|MB_ICONEXCLAMATION "Sorry, but Your don't have required rigths for continue installation ClamAV.$\nSetup is aborted. Please, take to Administrator for get Your needed rigths."
Quit
MoreInfo::GetProductVersion "$INSTDIR\clamd.exe"
Push "0,94,2,0"
xtInfo::CompareVersion
Pop $0
StrCmp $0 -1 +1 +6
StrCmp $LANGUAGE 1049 +2
MessageBox MB_ICONINFORMATION|MB_OK "You have nevest version ClamAV. Setup is terminated." IDOK +2
MessageBox MB_ICONINFORMATION|MB_OK "У Вас стоит более новая версия ClamAV. Установка прервана." IDOK +1
Quit
FunctionEnd
Section "-check"
nsSCM::Stop /NOUNLOAD "ClamD"
Pop $0
IntCmp $0 1 -2 +1 -2
nsSCM::Stop /NOUNLOAD "FreshClam"
Pop $0
IntCmp $0 1 -2 +1 -2
${nsProcess::FindProcess} "exeScanner.exe" $0
IntCmp $0 603 +2 +1 lblerr
${nsProcess::KillProcess} "exeScanner.exe" $0
StrCmp $0 0 +4 +1
IntCmp $0 603 +2 +1 lblerr
Call manterm
${nsProcess::FindProcess} "clamscan.exe" $0
IntCmp $0 603 +2 +1 lblerr
${nsProcess::KillProcess} "clamscan.exe" $0
StrCmp $0 0 +4 +1
IntCmp $0 603 +2 +1 lblerr
Call manterm
${nsProcess::FindProcess} "clamdscan.exe" $0
IntCmp $0 603 +2 +1 lblerr
${nsProcess::KillProcess} "clamdscan.exe" $0
StrCmp $0 0 +4 +1
IntCmp $0 603 +2 +1 lblerr
Call manterm
${nsProcess::FindProcess} "clamav.exe" $0
IntCmp $0 603 +2 +1 lblerr
${nsProcess::KillProcess} "clamav.exe" $0
StrCmp $0 0 +4 +1
IntCmp $0 603 +2 +1 lblerr
Call manterm
${nsProcess::FindProcess} "sigtool.exe" $0
IntCmp $0 603 +2 +1 lblerr
${nsProcess::KillProcess} "sigtool.exe" $0
StrCmp $0 0 +4 +1
IntCmp $0 603 +13 +1 lblerr
Call manterm
lblerr:
StrCmp $0 605 +6
IntCmp $0 606 +4 +1 +4
StrCmp $0 601 +5
StrCmp $0 602 +5
Call syserrm
Call unsuppm
Call acessd
Call manterm
${nsProcess::Unload}
SectionEnd
Section "Main" SEC01
SetOverwrite try
SetOutPath "$INSTDIR"
File "ClamAV\libclamunrar_iface.dll"
File "ClamAV\libclamunrar.dll"
File "ClamAV\libclamav.dll"
File "ClamAV\freshclam.exe"
File "ClamAV\exeScanner.exe"
File "ClamAV\clamscan.exe"
File "ClamAV\clamdscan.exe"
File "ClamAV\clamd.exe"
File "ClamAV\clamav.exe"
File "ClamAV\sigtool.exe"
File "ClamAV\SeDebug-Restore.exe"
SetOverwrite on
File "ClamAV\clamd.conf"
File "ClamAV\freshclam.conf"
File "ClamAV\gpl.txt"
File "ClamAV\readme.txt"
SectionEnd
Section -Post
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
SetShellVarContext All
CreateDirectory "$SMPROGRAMS\$ICONS_GROUP"
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\ClamAV.lnk" "$INSTDIR\clamav.exe"
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Read Me.lnk" "$INSTDIR\readme.txt"
WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\WEB Site.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk" "$INSTDIR\uninst.exe"
!insertmacro MUI_STARTMENU_WRITE_END
WriteUninstaller "$INSTDIR\uninst.exe"
WriteRegStr HKLM "System\CurrentControlSet\Services\ClamD" "DisplayName" "ClamWin Free Antivirus Scanner Service"
WriteRegStr HKLM "System\CurrentControlSet\Services\ClamD" "Description" "Provides virus scanning facilities for ClamWin Free Antivirus application"
WriteRegStr HKLM "System\CurrentControlSet\Services\FreshClam" "DisplayName" "ClamWin Free Antivirus Database Updater"
WriteRegStr HKLM "System\CurrentControlSet\Services\FreshClam" "Description" "Updates virus pattern database for ClamWin Free Antivirus application"
WriteRegStr HKLM "SOFTWARE\ClamAV" "ConfigDir" "$INSTDIR"
WriteRegStr HKLM "SOFTWARE\ClamAV" "DataDir" "$INSTDIR"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "Path" "$INSTDIR"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\clam.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "ClamAV native win32 port"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\freshclam.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
StrCpy $0 $INSTDIR 1
${textreplace::ReplaceInFile} "$INSTDIR\clamd.conf" "$INSTDIR\clamd.conf" "c:\" "$0:\" "/AO=1" $0
${textreplace::Unload}
nsSCM::Install /NOUNLOAD "ClamD" "ClamWin Free Antivirus Scanner Service" 16 2 "$INSTDIR\clamd.exe --daemon"
nsSCM::Install /NOUNLOAD "FreshClam" "ClamWin Free Antivirus Database Updater" 16 3 "$INSTDIR\freshclam.exe --daemon"
nsSCM::Start /NOUNLOAD "ClamD"
nsSCM::Start "FreshClam"
StrCpy $0 $EXEPATH 3
Delete "$0libclamunrar_iface.dll"
Delete "$0libclamunrar.dll"
Delete "$0libclamav.dll"
Delete "$0freshclam.exe"
Delete "$0exeScanner.exe"
Delete "$0clamscan.exe"
Delete "$0clamdscan.exe"
Delete "$0clamd.exe"
Delete "$0clamav.exe"
Delete "$0sigtool.exe"
Delete "$0SeDebug-Restore.exe"
Delete "$0clamd.conf"
Delete "$0freshclam.conf"
Delete "$0gpl.txt"
Delete "$0readme.txt"
SetAutoClose true
SectionEnd
Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "Удаление программы $(^Name) было успешно завершено."
FunctionEnd
Function un.onInit
!insertmacro MUI_UNGETLANGUAGE
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Вы уверены в том, что желаете удалить $(^Name) и все компоненты программы?" IDYES +2
Abort
FunctionEnd
Section Uninstall
nsSCM::Stop /NOUNLOAD "ClamD"
nsSCM::Stop /NOUNLOAD "FreshClam"
nsSCM::Remove /NOUNLOAD "ClamD"
nsSCM::Remove "FreshClam"
Pop $0
StrCmp $0 success +1 -2
${nsProcess::KillProcess} "clamscan.exe" $0
${nsProcess::KillProcess} "clamdscan.exe" $0
${nsProcess::KillProcess} "clamav.exe" $0
${nsProcess::FindProcess} "sigtool.exe" $0
${nsProcess::KillProcess} "sigtool.exe" $0
${nsProcess::Unload}
SetShellVarContext All
!insertmacro MUI_STARTMENU_GETFOLDER "Application" $ICONS_GROUP
Delete "$INSTDIR\${PRODUCT_NAME}.url"
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\readme.txt"
Delete "$INSTDIR\SeDebug-Restore.exe"
Delete "$INSTDIR\sigtool.exe"
Delete "$INSTDIR\clamav.exe"
Delete "$INSTDIR\clamd.conf"
Delete "$INSTDIR\clamd.exe"
Delete "$INSTDIR\clamdscan.exe"
Delete "$INSTDIR\clamscan.exe"
Delete "$INSTDIR\daily.cvd"
Delete "$INSTDIR\exeScanner.exe"
Delete "$INSTDIR\freshclam.conf"
Delete "$INSTDIR\freshclam.exe"
Delete "$INSTDIR\gpl.txt"
Delete "$INSTDIR\libclamav.dll"
Delete "$INSTDIR\libclamunrar.dll"
Delete "$INSTDIR\libclamunrar_iface.dll"
Delete "$INSTDIR\main.cvd"
Delete "$INSTDIR\mirrors.dat"
Delete "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk"
Delete "$SMPROGRAMS\$ICONS_GROUP\Website.lnk"
Delete "$SMPROGRAMS\$ICONS_GROUP\Read Me.lnk"
Delete "$SMPROGRAMS\$ICONS_GROUP\ClamAV.lnk"
RMDir "$SMPROGRAMS\$ICONS_GROUP"
RMDir "$INSTDIR"
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKLM "SOFTWARE\ClamAV"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
SetAutoClose true
SectionEnd[/more]
Код программы написан в среде NSIS 2.41 Update 1