; ZC4 64bit setup #include "../version.h" #expr Exec("c:\devel\zc4\installer\mkinstall.bat 64bit") [Setup] AppId=ZC4 AppName=ZC4 AppVersion={#ZC4_VERSION} AppContact=Hans Dijkema AppCopyright=(c) Hans Dijkema AppPublisher=Homeopathie Nederland B.V. AppPublisherURL=http://homeopathie-nederland.nl/ AppSupportURL=info@homeopathie-nederland.nl DefaultDirName={commonpf}\zc4 DefaultGroupName=zc4 UninstallDisplayIcon={app}\zc4.exe Compression=lzma2 SolidCompression=yes OutputDir={#zc4_iss_target_dir} ;OutputBaseFilename=zc4-setup-x64-{#SetupSetting("AppVersion")} OutputBaseFilename=zc4-setup-x64-{#ZC4_VERSION_SUBVERSION} ArchitecturesAllowed=x64 ArchitecturesInstallIn64BitMode=x64 SetupIconFile={#zc4_iss_src_dir}\icons\app-icons\install.ico ;UninstallIconFile={#zc4_iss_src_dir}\icons\app-icons\uninstall.ico WizardImageFile={#zc4_iss_src_dir}\icons\app-icons\inst_splash.bmp WizardSmallImageFile={#zc4_iss_src_dir}\icons\app-icons\install_img.bmp SignTool=sign_setup_bat ;Tools, Configure Sign Tools, add: sign_setup_bat = c:\devel\zc4\installer\sign_setup.bat $f PrivilegesRequired=admin ;PrivilegesRequired=none VersionInfoVersion={#ZC4_VERSION_SUBVERSION} [Tasks] Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; \ GroupDescription: "{cm:AdditionalIcons}" ;Flags: unchecked [Icons] Name: "{commondesktop}\ZC4"; Filename: "{app}\zc4.exe"; Tasks: desktopicon [Languages] Name: "en"; MessagesFile: "compiler:Default.isl" Name: "nl"; MessagesFile: "compiler:Languages\Dutch.isl" Name: "de"; MessagesFile: "compiler:Languages\German.isl" ;;;;;;;;;;;;;;;;;;;; Vanaf hier analyseren [Files] Source: "{#zc4_iss_install_dir_64bit}\*.*"; DestDir: "{app}"; Flags: recursesubdirs Source: "{#zc4_vc_redist_dir}{#zc4_vc_redist_version}\vc_redist.x64.exe"; DestDir: "{app}"; Flags: deleteafterinstall Source: "{#zc4_vc_redist_dir}{#zc4_vc_redist_version}\vc_redist.x86.exe"; DestDir: "{app}"; Flags: deleteafterinstall ; Windows 8 and 10 ;Source: "{#zc4_iss_win_dir_64bit}\msvcp140.dll"; DestDir: "{app}" ;Source: "{#zc4_iss_win_dir_64bit}\vcruntime140.dll"; DestDir: "{app}" ; Windows 7 ;Source: "{#zc4_iss_win_dir_64bit}\msvcr120.dll"; DestDir: "{app}" ;Source: "{#zc4_iss_win_dir_64bit}\msvcp120.dll"; DestDir: "{app}" ; Waarom zouden we de System32 versies nodig hebben voor een 64bit programma? ; Toch lijkt het zo te zijn! ;Source: "{#zc4_iss_win_dir_32bit}\msvcp140.dll"; DestDir: "{app}" ;Source: "{#zc4_iss_win_dir_32bit}\vcruntime140.dll"; DestDir: "{app}" ; Windows 7 ;Source: "{#zc4_iss_win_dir_32bit}\msvcr120.dll"; DestDir: "{app}" ;Source: "{#zc4_iss_win_dir_32bit}\msvcp120.dll"; DestDir: "{app}" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; VC Redists are installed quietly ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Other Source: "{#zc4_iss_lib_dir_64bit}\*.dll"; DestDir: "{app}" Source: "{#zc4_iss_plugins_dir_64bit}\*.*"; DestDir: "{app}\plugins"; Flags: recursesubdirs Source: "{#zc4_iss_qt_dir_64bit}\qml\QtQuick.2\*.*"; DestDir: "{app}\QtQuick.2"; Flags: recursesubdirs Source: "{#zc4_iss_qt_dir_64bit}\qml\QtWebChannel\*.*"; DestDir: "{app}\QtWebChannel"; Flags: recursesubdirs Source: "{#zc4_iss_qt_dir_64bit}\qml\QtWebView\*.*"; DestDir: "{app}\QtWebView"; Flags: recursesubdirs ;Source: "{#zc4_iss_qt_dir_64bit}\qml\QtWebEngine\*.*"; DestDir: "{app}\QtWebEngine"; Flags: recursesubdirs Source: "{#zc4_iss_qt_dir_64bit}\qml\QtWebSockets\*.*"; DestDir: "{app}\QtWebSockets"; Flags: recursesubdirs ;Source: "{#zc4_iss_qt_dir_64bit}\bin\Qt5WebEngineWidgets.dll"; DestDir: "{app}" Source: "{#zc4_iss_src_dir}\fonts\*.*"; Excludes: "\sources"; DestDir: "{app}\fonts"; Flags: recursesubdirs; Source: "{#zc4_iss_src_dir}\languages\*.qm"; Excludes: "\sources"; DestDir: "{app}\languages"; Flags: recursesubdirs; Source: "{#zc4_iss_src_dir}\languages\*.json"; Excludes: "\sources"; DestDir: "{app}\languages"; Flags: recursesubdirs; Source: "{#zc4_iss_src_dir}\rep-icons\*.*"; Excludes: "\sources"; DestDir: "{app}\rep-icons"; Flags: recursesubdirs; Source: "{#zc4_iss_src_dir}\materia-medica\*.*"; Excludes: "\sources,\images"; DestDir: "{app}\materia-medica"; Flags: recursesubdirs; Source: "{#zc4_iss_src_dir}\repertories\kent_en_homned2016.*"; DestDir: "{app}\repertories"; Flags: recursesubdirs [UninstallDelete] Type: filesandordirs; Name: "{app}\*.*" [Icons] Name: "{group}\zc4"; Filename: "{app}\zc4.exe" [Run] Filename: {app}\VC_redist.x64.exe; BeforeInstall: UpdateProgress(25); AfterInstall: UpdateProgress(33); Parameters: "/install /quiet /norestart"; StatusMsg: "Installing 64-bit Windows Universal runtime. This will take some time..."; Flags: waituntilterminated Filename: {app}\VC_redist.x86.exe; BeforeInstall: UpdateProgress(66); AfterInstall: UpdateProgress(100); Parameters: "/install /quiet /norestart"; StatusMsg: "Installing 32-bit Windows Universal runtime. This will take some time..."; Flags: waituntilterminated [Code] ///////////////////////////////////////////////////////////////////// function GetUninstallString(): String; var sUnInstPath: String; sUnInstallString: String; begin sUnInstPath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting("AppId")}_is1'); sUnInstallString := ''; if not RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sUnInstallString) then begin if not RegQueryStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstallString) then begin sUnInstPath := ExpandConstant('Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting("AppId")}_is1'); if not RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sUnInstallString) then RegQueryStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstallString); end; end; Result := sUnInstallString; end; ///////////////////////////////////////////////////////////////////// function IsUpgrade(): Boolean; begin Result := (GetUninstallString() <> ''); end; ///////////////////////////////////////////////////////////////////// function UnInstallOldVersion(): Integer; var sUnInstallString: String; iResultCode: Integer; begin // Return Values: // 1 - uninstall string is empty // 2 - error executing the UnInstallString // 3 - successfully executed the UnInstallString // default return value Result := 0; // get the uninstall string of the old app sUnInstallString := GetUninstallString(); if sUnInstallString <> '' then begin sUnInstallString := RemoveQuotes(sUnInstallString); if Exec(sUnInstallString, '/SILENT /NORESTART /SUPPRESSMSGBOXES','', SW_HIDE, ewWaitUntilTerminated, iResultCode) then Result := 3 else Result := 2; end else Result := 1; end; ///////////////////////////////////////////////////////////////////// // Firewall rule for postgres.exe ///////////////////////////////////////////////////////////////////// const NET_FW_SCOPE_ALL = 0; NET_FW_IP_VERSION_ANY = 2; procedure SetFirewallException(AppName,FileName:string); var FirewallObject: Variant; FirewallManager: Variant; FirewallProfile: Variant; begin try FirewallObject := CreateOleObject('HNetCfg.FwAuthorizedApplication'); FirewallObject.ProcessImageFileName := FileName; FirewallObject.Name := AppName; FirewallObject.Scope := NET_FW_SCOPE_ALL; FirewallObject.IpVersion := NET_FW_IP_VERSION_ANY; FirewallObject.Enabled := True; FirewallManager := CreateOleObject('HNetCfg.FwMgr'); FirewallProfile := FirewallManager.LocalPolicy.CurrentProfile; FirewallProfile.AuthorizedApplications.Add(FirewallObject); except end; end; procedure RemoveFirewallException( FileName:string ); var FirewallManager: Variant; FirewallProfile: Variant; begin try FirewallManager := CreateOleObject('HNetCfg.FwMgr'); FirewallProfile := FirewallManager.LocalPolicy.CurrentProfile; FireWallProfile.AuthorizedApplications.Remove(FileName); except end; end; ///////////////////////////////////////////////////////////////////// procedure CurStepChanged(CurStep: TSetupStep); begin if (CurStep=ssInstall) then begin if (IsUpgrade()) then begin UnInstallOldVersion(); end; end; if CurStep=ssPostInstall then begin SetFirewallException('ZC4 Web', ExpandConstant('{app}\')+'zc4.exe'); end; end; ///////////////////////////////////////////////////////////////////// procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep); begin if CurUninstallStep=usPostUninstall then begin RemoveFirewallException(ExpandConstant('{app}\')+'zc4.exe'); end; end; procedure UpdateProgress(Position: Integer); begin WizardForm.ProgressGauge.Position := Position * WizardForm.ProgressGauge.Max div 100; end;