; Script generated by the HM NIS Edit Script Wizard.
; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "xxx system"
!define PRODUCT_VERSION "1.0"
!define PRODUCT_PUBLISHER "xxx Co., Ltd."
!define PRODUCT_WEB_SITE ""
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\Run.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
; MUI 1.67 compatible ------
!include ""
; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "build\"
!define MUI_UNICON "build\"
; Welcome page
!insertmacro MUI_PAGE_WELCOME
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!define MUI_FINISHPAGE_RUN "$INSTDIR\Run.exe"
!define MUI_FINISHPAGE_SHOWREADME
!define MUI_FINISHPAGE_SHOWREADME_Function AutoBoot
!define MUI_FINISHPAGE_SHOWREADME_TEXT "Automatic startup"
!insertmacro MUI_PAGE_FINISH
; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES
; Language files
!insertmacro MUI_LANGUAGE "SimpChinese"
; MUI end ------
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "xxx system V${PRODUCT_VERSION}-build installation package.exe"
InstallDir "$PROGRAMFILES\xxx System"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
DirText "The installer will install $(^Name) in the following folder. $\r$\n$\r$\nTo be installed in a different folder, click [Browse] and select another folder."
ShowInstDetails show
ShowUnInstDetails show
Section "MainSection" SEC01
SetOutPath "$INSTDIR"
SetOverwrite ifnewer
File /r "build\*";Do not overwrite the following files
SetOverwrite off
File"build\data.db"
File "build\Configuration"
File "build\Configuration"
File "build\Configuration"
File "build\Configuration"
SetOverwrite ifnewer
CreateDirectory "$SMPROGRAMS\xxx System"
CreateShortCut "$SMPROGRAMS\xxx System\xxx System.lnk" "$INSTDIR\Run.exe" "" "$INSTDIR\"
CreateShortCut "$DESKTOP\xxx system.lnk" "$INSTDIR\Run.exe" "" "$INSTDIR\"
SectionEnd
Section -.NET
Call GetNetFrameworkVersion
Pop $R1
${If} $R1 < '4.5.2'
Call DownloadNetFramework4
${EndIf}
SectionEnd
Section -AdditionalIcons
WriteIniStr "$INSTDIR\xxx Co., Ltd." "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
CreateShortCut "$SMPROGRAMS\xxx System\Official Website.lnk" "$INSTDIR\xxx Co., Ltd."
CreateShortCut "$SMPROGRAMS\xxx System\Uninstall.lnk" "$INSTDIR\"
SectionEnd
Section -Post
WriteUninstaller "$INSTDIR\"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\Run.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\Run.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}"
SectionEnd
Function
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) has been successfully removed from your computer."
FunctionEnd
Function
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Do you really want to completely remove $(^Name) , and all the components? All data will be deleted after removal!" IDYES +2
Abort
FunctionEnd
Section Uninstall
Delete "$INSTDIR\*"
Delete "$SMPROGRAMS\xxx System\"
Delete "$SMPROGRAMS\xxx System\"
Delete "$DESKTOP\xxx system.lnk"
Delete "$SMPROGRAMS\xxx System\xxx System.lnk"
RMDir "$SMPROGRAMS\xxx System"
RMDir /r /REBOOTOK "$INSTDIR"
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Run"
SetAutoClose trueSectionEnd
;Get the .Net Framework version, support
Function GetNetFrameworkVersion
Push $1
Push $0
ReadRegDWORD $0 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" "Install"
ReadRegDWORD $1 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" "Version"
StrCmp $0 1 KnowNetFrameworkVersion +1
ReadRegDWORD $0 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5" "Install"
ReadRegDWORD $1 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5" "Version"
StrCmp $0 1 KnowNetFrameworkVersion +1
ReadRegDWORD $0 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0\Setup" "InstallSuccess"
ReadRegDWORD $1 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0\Setup" "Version"
StrCmp $0 1 KnowNetFrameworkVersion +1
ReadRegDWORD $0 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727" "Install"
ReadRegDWORD $1 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727" "Version"
StrCmp $1 "" +1 +2
StrCpy $1 "2.0.50727.832"
StrCmp $0 1 KnowNetFrameworkVersion +1
ReadRegDWORD $0 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322" "Install"
ReadRegDWORD $1 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322" "Version"
StrCmp $1 "" +1 +2
StrCpy $1 "1.1.4322.573"
StrCmp $0 1 KnowNetFrameworkVersion +1
ReadRegDWORD $0 HKLM "SOFTWARE\Microsoft\.NETFramework\policy\v1.0" "Install"
ReadRegDWORD $1 HKLM "SOFTWARE\Microsoft\.NETFramework\policy\v1.0" "Version"
StrCmp $1 "" +1 +2
StrCpy $1 "1.0.3705.0"
StrCmp $0 1 KnowNetFrameworkVersion +1
StrCpy $1 "NO_NetFramework"
KnowNetFrameworkVersion:
Pop $0
Exch $1FunctionEnd
Function DownloadNetFramework4
;Download .NET Framework4.0
; NSISdl::download /TRANSLATE2 'Downloading Running Environment Component %s' 'Connecting...' '(1 second remaining)' '(1 minute remaining)' '(1 hour remaining)' '(Remaining %u seconds)' '(Remaining %u minutes)' '(Remaining %u hours)' 'Completed: %skB(%d%%) Size: %skB Speed: %u.%01ukB/s' /TIMEOUT=7500 /NOIEPROXY 'http://192.168.100.70/net4.5.' '$TEMP\dotNetFx45_Full_setup.exe'
; Pop $R0
; StrCmp $R0 "success" 0 +2
SetDetailsPrint textonly
DetailPrint "Installing the running environment, this may take 1 to several minutes, please wait..."
SetDetailsPrint listonly
ExecWait '$INSTDIR\net4.5. /q /norestart /ChainingPackage FullX64Bootstrapper' $R1
; Delete "$TEMP\dotNetFx45_Full_setup.exe"
FunctionEnd
Function AutoBoot
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "xxx system" "$INSTDIR\Run.exe"
FunctionEnd