# Auto-generated by EclipseNSIS Script Wizard
# 2-feb-2011 17.51.32

Name NmapSI4

# General Symbol Definitions
!define REGKEY "SOFTWARE\$(^Name)"
!define VERSION 0.2.1
!define COMPANY "NmapSI4 Project"
!define URL http://www.nmapsi4.org

# MUI Symbol Definitions
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM
!define MUI_STARTMENUPAGE_REGISTRY_KEY ${REGKEY}
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME StartMenuGroup
!define MUI_STARTMENUPAGE_DEFAULTFOLDER NmapSI4
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
!define MUI_UNFINISHPAGE_NOAUTOCLOSE

# Included files
!include Sections.nsh
!include MUI.nsh

# Variables
Var StartMenuGroup

# Installer pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES

# Installer languages
!insertmacro MUI_LANGUAGE Italian

# Installer attributes
OutFile setup.exe
InstallDir $PROGRAMFILES\NmapSI4
CRCCheck on
XPStyle on
ShowInstDetails show
VIProductVersion 0.2.1.0
VIAddVersionKey ProductName NmapSI4
VIAddVersionKey ProductVersion "${VERSION}"
VIAddVersionKey CompanyName "${COMPANY}"
VIAddVersionKey CompanyWebsite "${URL}"
VIAddVersionKey FileVersion "${VERSION}"
VIAddVersionKey FileDescription ""
VIAddVersionKey LegalCopyright ""
InstallDirRegKey HKLM "${REGKEY}" Path
ShowUninstDetails show

# Installer sections
Section -Main SEC0000
    SetOutPath $INSTDIR
    SetOverwrite on
    File nmapsi4-0.2.1-win32\AUTHORS.txt
    File nmapsi4-0.2.1-win32\COPYING.txt
    File nmapsi4-0.2.1-win32\libgcc_s_dw2-1.dll
    File nmapsi4-0.2.1-win32\mingwm10.dll
    File nmapsi4-0.2.1-win32\nmapsi4.exe
    File nmapsi4-0.2.1-win32\nmapsi4.ico
    File nmapsi4-0.2.1-win32\nmapsi4_cs.qm
    File nmapsi4-0.2.1-win32\nmapsi4_de.qm
    File nmapsi4-0.2.1-win32\nmapsi4_es.qm
    File nmapsi4-0.2.1-win32\nmapsi4_fr.qm
    File nmapsi4-0.2.1-win32\nmapsi4_it.qm
    File nmapsi4-0.2.1-win32\nmapsi4_pl.qm
    File nmapsi4-0.2.1-win32\nmapsi4_pt_BR.qm
    File nmapsi4-0.2.1-win32\nmapsi4-logr.exe
    File nmapsi4-0.2.1-win32\nmapsi4-logr_cs.qm
    File nmapsi4-0.2.1-win32\nmapsi4-logr_de.qm
    File nmapsi4-0.2.1-win32\nmapsi4-logr_es.qm
    File nmapsi4-0.2.1-win32\nmapsi4-logr_fr.qm
    File nmapsi4-0.2.1-win32\nmapsi4-logr_it.qm
    File nmapsi4-0.2.1-win32\nmapsi4-logr_pl.qm
    File nmapsi4-0.2.1-win32\phonon4.dll
    File nmapsi4-0.2.1-win32\QtCore4.dll
    File nmapsi4-0.2.1-win32\QtGui4.dll
    File nmapsi4-0.2.1-win32\QtNetwork4.dll
    File nmapsi4-0.2.1-win32\QtWebKit4.dll
    File nmapsi4-0.2.1-win32\README.txt
    SetOutPath $DESKTOP
    CreateShortcut $DESKTOP\NmapSI4.lnk $INSTDIR\nmapsi4.exe "NmapSI4" "nmapsi4-0.2.1-win32\nmapsi4.ico"
	CreateShortcut "$DESKTOP\NmapSI4 Log Reader.lnk" "$INSTDIR\nmapsi4-logr.exe" "NmapSI4" "nmapsi4-0.2.1-win32\nmapsi4.ico"
    WriteRegStr HKLM "${REGKEY}\Components" Main 1
SectionEnd

Section -post SEC0001
    WriteRegStr HKLM "${REGKEY}" Path $INSTDIR
    SetOutPath $INSTDIR
    WriteUninstaller $INSTDIR\uninstall.exe
    !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
    SetOutPath $SMPROGRAMS\$StartMenuGroup
    CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Uninstall $(^Name).lnk" $INSTDIR\uninstall.exe
    !insertmacro MUI_STARTMENU_WRITE_END
    WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayName "$(^Name)"
    WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayVersion "${VERSION}"
    WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" Publisher "${COMPANY}"
    WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" URLInfoAbout "${URL}"
    WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayIcon $INSTDIR\uninstall.exe
    WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" UninstallString $INSTDIR\uninstall.exe
    WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoModify 1
    WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoRepair 1
SectionEnd

# Macro for selecting uninstaller sections
!macro SELECT_UNSECTION SECTION_NAME UNSECTION_ID
    Push $R0
    ReadRegStr $R0 HKLM "${REGKEY}\Components" "${SECTION_NAME}"
    StrCmp $R0 1 0 next${UNSECTION_ID}
    !insertmacro SelectSection "${UNSECTION_ID}"
    GoTo done${UNSECTION_ID}
next${UNSECTION_ID}:
    !insertmacro UnselectSection "${UNSECTION_ID}"
done${UNSECTION_ID}:
    Pop $R0
!macroend

# Uninstaller sections
Section /o -un.Main UNSEC0000
    Delete /REBOOTOK $DESKTOP\NmapSI4.lnk
    Delete /REBOOTOK $INSTDIR\README.txt
    Delete /REBOOTOK $INSTDIR\QtWebKit4.dll
    Delete /REBOOTOK $INSTDIR\QtNetwork4.dll
    Delete /REBOOTOK $INSTDIR\QtGui4.dll
    Delete /REBOOTOK $INSTDIR\QtCore4.dll
    Delete /REBOOTOK $INSTDIR\phonon4.dll
    Delete /REBOOTOK $INSTDIR\nmapsi4-logr_pl.qm
    Delete /REBOOTOK $INSTDIR\nmapsi4-logr_it.qm
    Delete /REBOOTOK $INSTDIR\nmapsi4-logr_fr.qm
    Delete /REBOOTOK $INSTDIR\nmapsi4-logr_es.qm
    Delete /REBOOTOK $INSTDIR\nmapsi4-logr_de.qm
    Delete /REBOOTOK $INSTDIR\nmapsi4-logr_cs.qm
    Delete /REBOOTOK $INSTDIR\nmapsi4-logr.exe
    Delete /REBOOTOK $INSTDIR\nmapsi4_pt_BR.qm
    Delete /REBOOTOK $INSTDIR\nmapsi4_pl.qm
    Delete /REBOOTOK $INSTDIR\nmapsi4_it.qm
    Delete /REBOOTOK $INSTDIR\nmapsi4_fr.qm
    Delete /REBOOTOK $INSTDIR\nmapsi4_es.qm
    Delete /REBOOTOK $INSTDIR\nmapsi4_de.qm
    Delete /REBOOTOK $INSTDIR\nmapsi4_cs.qm
    Delete /REBOOTOK $INSTDIR\nmapsi4.ico
    Delete /REBOOTOK $INSTDIR\nmapsi4.exe
    Delete /REBOOTOK $INSTDIR\mingwm10.dll
    Delete /REBOOTOK $INSTDIR\libgcc_s_dw2-1.dll
    Delete /REBOOTOK $INSTDIR\COPYING.txt
    Delete /REBOOTOK $INSTDIR\AUTHORS.txt
    DeleteRegValue HKLM "${REGKEY}\Components" Main
SectionEnd

Section -un.post UNSEC0001
    DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)"
    Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Uninstall $(^Name).lnk"
    Delete /REBOOTOK $INSTDIR\uninstall.exe
    DeleteRegValue HKLM "${REGKEY}" StartMenuGroup
    DeleteRegValue HKLM "${REGKEY}" Path
    DeleteRegKey /IfEmpty HKLM "${REGKEY}\Components"
    DeleteRegKey /IfEmpty HKLM "${REGKEY}"
    RmDir /REBOOTOK $SMPROGRAMS\$StartMenuGroup
    RmDir /REBOOTOK $INSTDIR
    Push $R0
    StrCpy $R0 $StartMenuGroup 1
    StrCmp $R0 ">" no_smgroup
no_smgroup:
    Pop $R0
SectionEnd

# Installer functions
Function .onInit
    InitPluginsDir
FunctionEnd

# Uninstaller functions
Function un.onInit
    ReadRegStr $INSTDIR HKLM "${REGKEY}" Path
    !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuGroup
    !insertmacro SELECT_UNSECTION Main ${UNSEC0000}
FunctionEnd

