;------------------------------------------------------------------------------- ; Install control function ;------------------------------------------------------------------------------- Function DoInstall ; Prefill some variables StrCpy $DirRequiredDLL "$INSTDIR\Bin\RequiredDll" StrCpy $ProgramName "${APPNAME}-V${VERSIONMAJOR}.${VERSIONMINOR}.${VERSIONREVISION}.${VERSIONBUILD}${EXTENSION}" StrCpy $ProgramNameFQN "$INSTDIR\Bin\$ProgramName" ; First of all create folder structures call InstallFolderStructure ; Then copy some files call InstallBeckhoff call InstallCommonFiles call InstallConfigs call InstallLanguageFiles call InstallProgram call InstallRequiredDll call InstallSherlock ; Modify paths within INI file call InstallModifyINI ; Create uninstaller and integrate program in Windows UI call InstallUninstaller call InstallWindowsRemoveProgram call InstallWindowsUIIntegration FunctionEnd ;------------------------------------------------------------------------------- ; Install default folders ;------------------------------------------------------------------------------- Function InstallFolderStructure ; Set output path to the installation directory. SetOutPath $INSTDIR StrCpy $0 "$INSTDIR\Auftrag" Call MKDir StrCpy $0 "$INSTDIR\Austausch" Call MKDir StrCpy $0 "$INSTDIR\Bin\Program" Call MKDir StrCpy $0 "$INSTDIR\Bin\Sherlock" Call MKDir StrCpy $0 "$INSTDIR\Bin\scripte" Call MKDir StrCpy $0 "$INSTDIR\Images" Call MKDir StrCpy $0 "$INSTDIR\Log" Call MKDir StrCpy $0 "$INSTDIR\Manual" Call MKDir StrCpy $0 "$INSTDIR\StatisticData" Call MKDir FunctionEnd ;------------------------------------------------------------------------------- ; Create directory only, if not exists ;------------------------------------------------------------------------------- Function MKDir ${IF} ${FileExists} "$0" ; ${Else} CreateDirectory $0 ${EndIf} FunctionEnd ;------------------------------------------------------------------------------- ; Install requried DLLs and add folder to PATH variable ;------------------------------------------------------------------------------- Function InstallRequiredDll CreateDirectory "$DirRequiredDLL" SetOutPath "$DirRequiredDLL" SetOverwrite ifnewer File "${__FILEDIR__}\..\${PLATFORM}\${CONFIGURATION}\*.DLL" ${EnvVarUpdate} $1 "PATH" "A" "HKLM" "$DirRequiredDLL" FunctionEnd ;------------------------------------------------------------------------------- ; Install language files ;------------------------------------------------------------------------------- Function InstallLanguageFiles CreateDirectory "$INSTDIR\Languages" SetOutPath "$INSTDIR\Languages" SetOverwrite ifnewer File "${__FILEDIR__}\..\Languages\*.XML" FunctionEnd ;------------------------------------------------------------------------------- ; Install common files ;------------------------------------------------------------------------------- Function InstallCommonFiles SetOutPath "$INSTDIR\Bin" SetOverwrite ifnewer File "${__FILEDIR__}\..\CalcParser.chm" File "${__FILEDIR__}\Templates\Xactools\Bin\ctv_deu.xml" File "${__FILEDIR__}\Templates\Xactools\Bin\ctv_eng.xml" File "${__FILEDIR__}\Templates\Xactools\Bin\Datensicherung.bat" File "${__FILEDIR__}\Templates\Xactools\Bin\Datensicherung_nur_Bilder.bat" File "${__FILEDIR__}\Templates\Xactools\Bin\logo_small.png" File "${__FILEDIR__}\Templates\Xactools\Bin\xactools_background.png" File "${__FILEDIR__}\Templates\Xactools\Bin\xactools_camera_backgroung.png" File "${__FILEDIR__}\Templates\Xactools\Bin\XactoolsViewer.exe" File "${__FILEDIR__}\Templates\Xactools\Bin\xctls.ini" FunctionEnd ;------------------------------------------------------------------------------- ; Install Sherlock files ;------------------------------------------------------------------------------- Function InstallSherlock CreateDirectory "$INSTDIR\Bin\Sherlock" SetOutPath "$INSTDIR\Bin\Sherlock" SetOverwrite ifnewer File "${__FILEDIR__}\Templates\Xactools\Bin\Sherlock\*.ivs" FunctionEnd ;------------------------------------------------------------------------------- ; Install Beckhoff files ;------------------------------------------------------------------------------- Function InstallBeckhoff CreateDirectory "$INSTDIR\Beckhoff" SetOutPath "$INSTDIR\Beckhoff" SetOverwrite ifnewer File "${__FILEDIR__}\Templates\Xactools\Beckhoff\*.tsm" FunctionEnd ;------------------------------------------------------------------------------- ; Install uninstaller ;------------------------------------------------------------------------------- Function InstallUninstaller SetOutPath "$INSTDIR" writeUninstaller "$INSTDIR\${FILENAME_UNINSTALL}" FunctionEnd ;------------------------------------------------------------------------------- ; Install start menu entry, desktop shortcut, ... ;------------------------------------------------------------------------------- Function InstallWindowsUIIntegration SetOutPath "$INSTDIR\Bin\" ; Desktop icon CreateShortcut "$DESKTOP\${LBL_PROGRAM}.lnk" "$ProgramNameFQN" ; Start menu entries CreateDirectory "$SMPrograms\${COMPANYNAME}" CreateShortcut "$SMPROGRAMS\${COMPANYNAME}\${LBL_PROGRAM}.lnk" "$ProgramNameFQN" "" "${APPICON}" CreateShortcut "$SMPROGRAMS\${COMPANYNAME}\${LBL_UNINSTALL}.lnk" "$INSTDIR\${FILENAME_UNINSTALL}" "" "${APPICON}" ; Pin icon to taskbar WinShell::SetLnkAUMI "$SMPROGRAMS\${COMPANYNAME}\${LBL_PROGRAM}.lnk" "${XACTOOLS_APPUSERMODELID}" FunctionEnd ;------------------------------------------------------------------------------- ; Install entry for uninstaller as usual on windows ;------------------------------------------------------------------------------- Function InstallWindowsRemoveProgram WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayName" "${DESCRIPTION}" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "UninstallString" "$INSTDIR\${FILENAME_UNINSTALL}" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "QuietUninstallString" "$INSTDIR\${FILENAME_UNINSTALL} /S" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "InstallLocation" "$INSTDIR" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayIcon" "${APPICON}" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "Publisher" "${COMPANYNAME}" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayVersion" "${VERSIONMAJOR}.${VERSIONMINOR}.${VERSIONREVISION}.${VERSIONBUILD}" WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "VersionMajor" ${VERSIONMAJOR} WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "VersionMinor" ${VERSIONMINOR} WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "HelpLink" "${COMPANY_URL}" WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "Contact" "${COMPANY_URL}" ${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2 IntFmt $0 "0x%08X" $0 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "EstimatedSize" "$0" ; There is no option for modifying or repairing the install WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "NoModify" 1 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "NoRepair" 1 FunctionEnd ;------------------------------------------------------------------------------- ; Install Xactools program ;------------------------------------------------------------------------------- Function InstallProgram SetOutPath "$INSTDIR\Bin\" File /oname=$ProgramName "${__FILEDIR__}\..\${PLATFORM}\${CONFIGURATION}\${APPNAME}${EXTENSION}" FunctionEnd ;------------------------------------------------------------------------------- ; Install config files ;------------------------------------------------------------------------------- Function InstallConfigs CreateDirectory "$INSTDIR\Bin\Config" SetOutPath "$INSTDIR\Bin\Config" SetOverwrite off File "${__FILEDIR__}\Templates\Xactools\Bin\Config\*.ini" File "${__FILEDIR__}\Templates\Xactools\Bin\Config\*.xml" FunctionEnd ;------------------------------------------------------------------------------- ; Install config files ;------------------------------------------------------------------------------- Function InstallModifyINI ${GetRoot} "$INSTDIR" $0 DetailPrint "Update [${XACTOOLS_CONFIG}] with path information." ; Section [Program] ; QrkPath is drive only ReadINIStr $1 "${XACTOOLS_CONFIG}" Program QrkPath WriteINIStr "${XACTOOLS_CONFIG}" Program QrkPath "$0$1" ; Read relative path from "INI template" and write again with installation path ReadINIStr $1 "${XACTOOLS_CONFIG}" Program BmpPath WriteINIStr "${XACTOOLS_CONFIG}" Program BmpPath "$INSTDIR$1" ReadINIStr $1 "${XACTOOLS_CONFIG}" Program ShmPath WriteINIStr "${XACTOOLS_CONFIG}" Program ShmPath "$INSTDIR$1" ReadINIStr $1 "${XACTOOLS_CONFIG}" Program TmpPath WriteINIStr "${XACTOOLS_CONFIG}" Program TmpPath "$INSTDIR$1" ReadINIStr $1 "${XACTOOLS_CONFIG}" Program TxtPath WriteINIStr "${XACTOOLS_CONFIG}" Program TxtPath "$INSTDIR$1" ReadINIStr $1 "${XACTOOLS_CONFIG}" Program Viewer WriteINIStr "${XACTOOLS_CONFIG}" Program Viewer "$INSTDIR$1" ReadINIStr $1 "${XACTOOLS_CONFIG}" Program XmlPath WriteINIStr "${XACTOOLS_CONFIG}" Program XmlPath "$INSTDIR$1" ; Section [CustomScreens] ReadINIStr $1 "${XACTOOLS_CONFIG}" CustomScreens Path WriteINIStr "${XACTOOLS_CONFIG}" CustomScreens Path "$INSTDIR$1" FunctionEnd