175 lines
4.0 KiB
Plaintext
175 lines
4.0 KiB
Plaintext
;NSIS Modern User Interface
|
|
;Basic Example Script
|
|
;Written by Joost Verburg
|
|
|
|
;--------------------------------
|
|
;Include Modern UI
|
|
|
|
!include "MUI2.nsh"
|
|
|
|
;--------------------------------
|
|
; Password
|
|
!define Password "sic2023"
|
|
;PasswordBox ID
|
|
!define IDC_PASSWORD 1214
|
|
|
|
;--------------------------------
|
|
;General
|
|
|
|
!getdllversion "sicui\sicui.exe" ver
|
|
|
|
;Name and file
|
|
Name "Sic Evaluation Edition v${ver1}.${ver2}.${ver3}.${ver4}"
|
|
OutFile "Sic_EVE_Setup_v${ver1}.${ver2}.${ver3}.${ver4}.exe"
|
|
|
|
;Default installation folder
|
|
;InstallDir "$LOCALAPPDATA\Modern UI Test"
|
|
InstallDir "C:\Sic"
|
|
|
|
;Get installation folder from registry if available
|
|
InstallDirRegKey HKCU "Software\Sicentury\CVD" ""
|
|
|
|
;Request application privileges for Windows Vista
|
|
RequestExecutionLevel user
|
|
|
|
;--------------------------------
|
|
;Interface Settings
|
|
|
|
!define MUI_ABORTWARNING
|
|
|
|
;--------------------------------
|
|
;Pages@
|
|
|
|
Page Custom PasswordPageShow PasswordPageLeave
|
|
!insertmacro MUI_PAGE_LICENSE "License.txt"
|
|
!insertmacro MUI_PAGE_COMPONENTS
|
|
!insertmacro MUI_PAGE_DIRECTORY
|
|
!insertmacro MUI_PAGE_INSTFILES
|
|
|
|
!insertmacro MUI_UNPAGE_CONFIRM
|
|
!insertmacro MUI_UNPAGE_INSTFILES
|
|
|
|
|
|
|
|
;--------------------------------
|
|
;Languages
|
|
|
|
!insertmacro MUI_LANGUAGE "English"
|
|
|
|
;--------------------------------
|
|
;Installer Sections
|
|
|
|
Section "Control Apps" SecControlApp
|
|
|
|
SetOutPath "$INSTDIR"
|
|
|
|
;ADD YOUR OWN FILES HERE...
|
|
SetOutPath "$INSTDIR\SicUI"
|
|
File /r "SicUI\*"
|
|
|
|
SetOutPath "$INSTDIR\SicRT"
|
|
File /r "SicRT\*"
|
|
|
|
;Store installation folder
|
|
WriteRegStr HKCU "Software\Sicentury\CVD" "" $INSTDIR
|
|
|
|
;Create uninstaller
|
|
WriteUninstaller "$INSTDIR\Uninstall.exe"
|
|
|
|
;CreateShortCut "$DESKTOP\SicRTIPConfig.lnk" "$INSTDIR\SicUI\SicUI.exe" "--is-set-rt-ip" "$INSTDIR\SicUI\RtIpAddressSetting.ico" 0
|
|
CreateShortCut "$DESKTOP\SicUI.lnk" "$INSTDIR\SicUI\SicUI.exe"
|
|
|
|
SectionEnd
|
|
|
|
|
|
Section "Simulator" SecSim
|
|
|
|
SetOutPath "$INSTDIR"
|
|
|
|
;ADD YOUR OWN FILES HERE...
|
|
SetOutPath "$INSTDIR\SicSimulator"
|
|
File /r "SicSimulator\*"
|
|
|
|
;Store installation folder
|
|
WriteRegStr HKCU "Software\Sicentury\CVD" "" $INSTDIR
|
|
|
|
;Create uninstaller
|
|
WriteUninstaller "$INSTDIR\Uninstall.exe"
|
|
|
|
CreateShortCut "$DESKTOP\SicSimulator.lnk" "$INSTDIR\SicSimulator\SicSimulator.exe"
|
|
|
|
SectionEnd
|
|
|
|
;--------------------------------
|
|
;Descriptions
|
|
|
|
;Language strings
|
|
LangString DESC_SecControlApp ${LANG_ENGLISH} "Install SicRT and SicUI."
|
|
LangString DESC_SecSim ${LANG_ENGLISH} "Install Simulator."
|
|
|
|
;Assign language strings to sections
|
|
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
|
!insertmacro MUI_DESCRIPTION_TEXT ${SecControlApp} $(DESC_SecControlApp)
|
|
!insertmacro MUI_DESCRIPTION_TEXT ${SecSim} $(DESC_SecSim)
|
|
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
|
|
|
;--------------------------------
|
|
;Uninstaller Section
|
|
|
|
Section "Uninstall"
|
|
|
|
;ADD YOUR OWN FILES HERE...
|
|
|
|
Delete "$INSTDIR\Uninstall.exe"
|
|
Delete "$DESKTOP\SicRTIPConfig.lnk"
|
|
Delete "$DESKTOP\SicUI.lnk"
|
|
Delete "$DESKTOP\SicSimulator.lnk"
|
|
|
|
RMDir /r "$INSTDIR\SicUI"
|
|
RMDir /r "$INSTDIR\SicRT"
|
|
RMDir /r "$INSTDIR\SicSimulator"
|
|
|
|
DeleteRegKey /ifempty HKCU "Software\Sicentury\CVD"
|
|
|
|
SectionEnd
|
|
|
|
;--------------------------------
|
|
; Password Dialog Functions
|
|
|
|
## Displays the password dialog
|
|
Function PasswordPageShow
|
|
|
|
!insertmacro MUI_HEADER_TEXT "CAUTION!" "This is an EVALUATION version for testing or training purposes, DO NOT use it in a production environment!"
|
|
|
|
PassDialog::InitDialog Password /HEADINGTEXT "Enter a password to install"
|
|
Pop $R0 # Page HWND
|
|
|
|
# Use the following code to set a custom password character
|
|
;GetDlgItem $R1 $R0 ${IDC_PASSWORD}
|
|
;SendMessage $R1 ${EM_SETPASSWORDCHAR} 178 0
|
|
|
|
PassDialog::Show
|
|
|
|
FunctionEnd
|
|
|
|
## Validate password
|
|
Function PasswordPageLeave
|
|
|
|
## Pop password from stack
|
|
Pop $R0
|
|
|
|
## A bit of validation
|
|
StrCmp $R0 '${Password}' +3
|
|
MessageBox MB_OK|MB_ICONEXCLAMATION "The password is incorrect!"
|
|
Abort
|
|
|
|
FunctionEnd
|
|
|
|
Function ComponentsPageShow
|
|
|
|
## Disable the Back button
|
|
GetDlgItem $R0 $HWNDPARENT 3
|
|
EnableWindow $R0 0
|
|
|
|
FunctionEnd
|