#ifndef AppVersion #define AppVersion "2.2.0" #endif #ifndef AppDist #define AppDist "..\build\native-cmake\release" #endif #ifndef ReleaseDir #define ReleaseDir "..\artifacts" #endif [Setup] AppId={{F4A9EF74-875E-4C47-BC5B-451F169F4D22} AppName=DUO-RDP AppVersion={#AppVersion} AppPublisher=Sogerien DefaultDirName={autopf}\DuoRdp DefaultGroupName=DUO-RDP PrivilegesRequired=admin SetupArchitecture=x64 ArchitecturesAllowed=x64os ArchitecturesInstallIn64BitMode=x64os MinVersion=10.0 DisableDirPage=yes UsePreviousAppDir=no DisableProgramGroupPage=yes DisableWelcomePage=no WizardStyle=modern WizardSizePercent=112 SetupMutex=DuoRdpSetup OutputDir={#ReleaseDir} OutputBaseFilename=DUO-RDP-Setup-{#AppVersion}-x64 Compression=lzma2 SolidCompression=yes UninstallDisplayName=DUO-RDP UninstallDisplayIcon={app}\DuoRdpAdmin.exe CloseApplications=no RestartApplications=no InfoBeforeFile=description.ru.txt VersionInfoVersion={#AppVersion}.0 VersionInfoDescription=DUO-RDP Setup VersionInfoProductName=DUO-RDP [Languages] Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl" Name: "ukrainian"; MessagesFile: "compiler:Languages\Ukrainian.isl" Name: "english"; MessagesFile: "compiler:Default.isl" [Tasks] Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; Flags: unchecked [Files] Source: "{#AppDist}\DuoRdpInstaller.exe"; DestDir: "{app}"; Flags: ignoreversion Source: "{#AppDist}\DuoRdpInstaller.exe"; Flags: dontcopy Source: "{#AppDist}\payload\DuoRdpAuthService.exe"; Flags: dontcopy Source: "{#AppDist}\payload\DuoRdpAdmin.exe"; Flags: dontcopy Source: "{#AppDist}\payload\DuoRdpCredentialProvider.dll"; Flags: dontcopy Source: "{#AppDist}\payload\DUOUnIstall.exe"; Flags: dontcopy Source: "..\LICENSE"; DestDir: "{app}"; Flags: ignoreversion Source: "..\THIRD_PARTY_NOTICES.md"; DestDir: "{app}"; Flags: ignoreversion Source: "README.txt"; DestDir: "{app}"; Flags: ignoreversion [Icons] Name: "{group}\DUO-RDP Admin"; Filename: "{app}\DuoRdpAdmin.exe" Name: "{group}\Uninstall DUO-RDP"; Filename: "{uninstallexe}" Name: "{autodesktop}\DUO-RDP Admin"; Filename: "{app}\DuoRdpAdmin.exe"; Tasks: desktopicon [Run] Filename: "{app}\DuoRdpAdmin.exe"; Description: "DUO-RDP Admin"; Flags: nowait postinstall skipifsilent runascurrentuser [Code] function PrepareToInstall(var NeedsRestart: Boolean): String; var ExitCode: Integer; begin Result := ''; if CompareText(ExpandConstant('{app}'), ExpandConstant('{autopf}\DuoRdp')) <> 0 then begin Result := 'DUO-RDP must be installed in Program Files\DuoRdp. Remove the /DIR override.'; exit; end; // Never overwrite a running service or a DLL loaded by LogonUI. if RegKeyExists(HKLM, 'SYSTEM\CurrentControlSet\Services\DuoRdpAuthService') or FileExists(ExpandConstant('{app}\DuoRdpAuthService.exe')) or FileExists(ExpandConstant('{app}\DuoRdpCredentialProvider.dll')) then begin Result := 'DUO-RDP is already installed. Uninstall the previous version first (config.json and keys are kept), then run Setup again. Restart Windows if a file is locked.'; exit; end; ExtractTemporaryFile('DuoRdpInstaller.exe'); ExtractTemporaryFile('DuoRdpAuthService.exe'); ExtractTemporaryFile('DuoRdpAdmin.exe'); ExtractTemporaryFile('DuoRdpCredentialProvider.dll'); ExtractTemporaryFile('DUOUnIstall.exe'); if not Exec(ExpandConstant('{tmp}\DuoRdpInstaller.exe'), ExpandConstant('--install --no-launch --payload "{tmp}"'), ExpandConstant('{tmp}'), SW_HIDE, ewWaitUntilTerminated, ExitCode) then Result := 'Cannot start the native DUO-RDP installer.' else if ExitCode <> 0 then Result := 'Native installation failed (code ' + IntToStr(ExitCode) + '). Use DUOUnIstall.exe from the portable package for recovery. Setup has not completed.'; end; function InitializeUninstall(): Boolean; var ExitCode: Integer; begin Result := False; // Native recovery removes filter FIRST, then provider/service. Keep config. if not FileExists(ExpandConstant('{app}\DUOUnIstall.exe')) then begin MsgBox('Native recovery executable is missing. Restore DUOUnIstall.exe from the release package before uninstalling.', mbError, MB_OK); exit; end; if Exec(ExpandConstant('{app}\DUOUnIstall.exe'), '--uninstall', ExpandConstant('{app}'), SW_HIDE, ewWaitUntilTerminated, ExitCode) then Result := ExitCode = 0; if not Result then MsgBox('Native uninstall failed. Files and Windows uninstall entry have been kept for recovery.', mbError, MB_OK); end;