2017-09-11 10:49:25 +00:00
|
|
|
|
2023-05-18 12:55:22 +00:00
|
|
|
#define SRC_PATH AddBackslash(SourcePath) + "..\src"
|
2021-01-03 12:24:56 +00:00
|
|
|
|
2021-02-08 09:09:22 +00:00
|
|
|
#include SRC_PATH + "\version\fort_version.h"
|
2017-09-11 10:49:25 +00:00
|
|
|
|
2021-03-31 12:42:36 +00:00
|
|
|
#define APP_EXE_NAME APP_BASE + ".exe"
|
|
|
|
#define APP_ICO_NAME APP_BASE + ".ico"
|
2021-03-31 12:53:03 +00:00
|
|
|
#define APP_SVC_NAME APP_BASE + "Svc"
|
2017-09-11 10:49:25 +00:00
|
|
|
|
2021-03-24 14:05:30 +00:00
|
|
|
#define APP_EXE StringChange("{app}\%exe%", "%exe%", APP_EXE_NAME)
|
2023-05-18 12:55:22 +00:00
|
|
|
|
|
|
|
#define LANG_PATH AddBackslash(SourcePath) + "languages"
|
|
|
|
#define LANG_CUSTOM LANG_PATH + "\custom"
|
2021-03-24 14:05:30 +00:00
|
|
|
|
2017-09-11 10:49:25 +00:00
|
|
|
[Setup]
|
|
|
|
; NOTE: The value of AppId uniquely identifies this application.
|
|
|
|
; Do not use the same AppId value in installers for other applications.
|
|
|
|
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
|
2021-04-01 08:50:58 +00:00
|
|
|
SetupMutex=Global\{#APP_BASE}Setup
|
2021-05-15 18:56:53 +00:00
|
|
|
; TODO: COMPAT: Remove {#APP_NAME} from AppMutex after v4.1.0
|
2021-05-15 08:45:13 +00:00
|
|
|
AppMutex={#APP_NAME},{#APP_BASE}
|
2017-09-11 10:49:25 +00:00
|
|
|
AppName={#APP_NAME}
|
|
|
|
AppVersion={#APP_VERSION_STR}
|
2019-04-24 17:41:11 +00:00
|
|
|
VersionInfoVersion={#APP_VERSION_STR}
|
2023-12-28 13:46:55 +00:00
|
|
|
VersionInfoProductTextVersion={#APP_VERSION_STR}{#APP_VERSION_BUILD_STR}
|
2017-09-11 10:49:25 +00:00
|
|
|
AppVerName={#APP_NAME}
|
2019-04-24 17:41:11 +00:00
|
|
|
AppCopyright={#APP_LEGALCOPYRIGHT}
|
2017-09-11 10:49:25 +00:00
|
|
|
AppPublisher={#APP_PUBLISHER}
|
|
|
|
AppPublisherURL={#APP_URL}
|
|
|
|
AppSupportURL={#APP_URL}
|
|
|
|
AppUpdatesURL={#APP_UPDATES_URL}
|
|
|
|
DefaultGroupName={#APP_NAME}
|
2023-02-10 14:55:35 +00:00
|
|
|
DefaultDirName={pf}\{#APP_NAME}
|
2017-09-11 10:49:25 +00:00
|
|
|
AlwaysShowDirOnReadyPage=yes
|
|
|
|
AlwaysShowGroupOnReadyPage=yes
|
|
|
|
AllowNoIcons=yes
|
2021-05-15 08:21:08 +00:00
|
|
|
OutputDir=out
|
2023-12-28 13:46:55 +00:00
|
|
|
OutputBaseFilename={#APP_BASE}-{#APP_VERSION_STR}{#APP_VERSION_BUILD_STR}
|
2019-03-10 18:03:59 +00:00
|
|
|
Uninstallable=not IsTaskSelected('portable')
|
2017-09-11 10:49:25 +00:00
|
|
|
UninstallFilesDir={app}\uninst
|
2021-01-03 12:24:56 +00:00
|
|
|
UninstallDisplayIcon={uninstallexe}
|
2021-05-10 08:32:58 +00:00
|
|
|
SetupIconFile={#SRC_PATH}\ui_bin\{#APP_ICO_NAME}
|
2017-09-11 10:49:25 +00:00
|
|
|
ArchitecturesInstallIn64BitMode=x64
|
2024-01-15 09:12:12 +00:00
|
|
|
ArchitecturesAllowed={#PROC_ARCHS}
|
2024-01-02 13:35:42 +00:00
|
|
|
Compression=lzma/normal
|
2017-09-11 10:49:25 +00:00
|
|
|
SolidCompression=yes
|
|
|
|
|
|
|
|
[Languages]
|
2023-05-09 10:26:06 +00:00
|
|
|
Name: "en"; MessagesFile: "compiler:Default.isl,{#LANG_CUSTOM}\Default.isl"
|
|
|
|
Name: "de"; MessagesFile: "compiler:Languages\German.isl,{#LANG_CUSTOM}\German.isl"
|
|
|
|
Name: "fr"; MessagesFile: "compiler:Languages\French.isl,{#LANG_CUSTOM}\French.isl"
|
|
|
|
Name: "it"; MessagesFile: "compiler:Languages\Italian.isl,{#LANG_CUSTOM}\Italian.isl"
|
|
|
|
Name: "ko"; MessagesFile: "compiler:Languages\Korean.isl,{#LANG_CUSTOM}\Korean.isl"
|
|
|
|
Name: "pt"; MessagesFile: "compiler:Languages\Portuguese.isl,{#LANG_CUSTOM}\Portuguese.isl"
|
|
|
|
Name: "pt_BR"; MessagesFile: "compiler:Languages\BrazilianPortuguese.isl,{#LANG_CUSTOM}\BrazilianPortuguese.isl"
|
|
|
|
Name: "ru"; MessagesFile: "compiler:Languages\Russian.isl,{#LANG_CUSTOM}\Russian.isl"
|
2023-05-18 12:55:22 +00:00
|
|
|
Name: "sl"; MessagesFile: "compiler:Languages\Slovenian.isl,{#LANG_CUSTOM}\Slovenian.isl"
|
2023-05-09 10:26:06 +00:00
|
|
|
Name: "zh_CN"; MessagesFile: "{#LANG_PATH}\ChineseSimplified.isl,{#LANG_CUSTOM}\ChineseSimplified.isl"
|
2017-09-14 04:33:29 +00:00
|
|
|
|
2019-03-10 18:03:59 +00:00
|
|
|
[Tasks]
|
2021-05-23 19:00:11 +00:00
|
|
|
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"
|
2023-05-07 09:59:14 +00:00
|
|
|
Name: "explorer"; Description: "{cm:WindowsExplorerIntegration}"
|
2023-05-07 21:08:42 +00:00
|
|
|
Name: "service"; Description: "{cm:WindowsService}"
|
|
|
|
Name: "portable"; Description: "{cm:Portable}"; Flags: unchecked
|
2019-03-10 18:03:59 +00:00
|
|
|
|
2017-09-11 10:49:25 +00:00
|
|
|
[Files]
|
2019-04-08 11:39:00 +00:00
|
|
|
Source: "build\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
|
2024-04-23 12:13:43 +00:00
|
|
|
Source: "data\{#APP_EXE_NAME}.example.ini"; DestDir: "{app}"; Flags: ignoreversion
|
|
|
|
Source: "data\qt.conf"; DestDir: "{app}"; Flags: ignoreversion
|
|
|
|
Source: "data\delay-start.bat"; DestDir: "{app}"; Flags: ignoreversion onlyifdoesntexist
|
2017-09-11 10:49:25 +00:00
|
|
|
|
2023-12-22 15:16:52 +00:00
|
|
|
[Dirs]
|
|
|
|
Name: "{app}\Data"; Flags: uninsneveruninstall; Permissions: users-modify; Tasks: portable
|
|
|
|
|
2017-09-11 10:49:25 +00:00
|
|
|
[Icons]
|
|
|
|
; Start menu shortcut
|
2023-03-24 16:42:13 +00:00
|
|
|
Name: "{group}\{#APP_NAME}"; Filename: "{#APP_EXE}"; WorkingDir: "{app}"; \
|
|
|
|
Parameters: "--lang {code:LanguageName}"
|
|
|
|
|
2017-09-13 11:08:27 +00:00
|
|
|
; Uninstaller shortcut
|
2019-04-11 04:58:43 +00:00
|
|
|
Name: "{group}\{cm:UninstallProgram,{#APP_NAME}}"; Filename: "{uninstallexe}"
|
2023-03-24 16:42:13 +00:00
|
|
|
|
2019-03-14 02:50:05 +00:00
|
|
|
; Desktop shortcut
|
2021-03-24 14:05:30 +00:00
|
|
|
Name: "{commondesktop}\{#APP_NAME}"; Filename: "{#APP_EXE}"; WorkingDir: "{app}"; \
|
|
|
|
Parameters: "--lang {code:LanguageName}"; Tasks: desktopicon
|
2017-09-11 10:49:25 +00:00
|
|
|
|
|
|
|
[Run]
|
2021-05-23 19:00:11 +00:00
|
|
|
; 1. Uninstall -> 2. Install Driver -> 3. Portable -> 4. Service
|
2021-05-23 13:44:02 +00:00
|
|
|
Filename: "{#APP_EXE}"; Parameters: "-u"
|
|
|
|
Filename: "{app}\driver\scripts\reinstall.bat"; Description: "Re-install driver"
|
|
|
|
|
|
|
|
Filename: "{#APP_EXE}"; Parameters: "-i portable"; Tasks: portable
|
|
|
|
Filename: "{#APP_EXE}"; Parameters: "-i service"; Tasks: service
|
2023-12-30 09:26:57 +00:00
|
|
|
Filename: "{#APP_EXE}"; Parameters: "-i explorer"; Flags: runasoriginaluser; Tasks: explorer
|
2021-05-23 13:44:02 +00:00
|
|
|
|
|
|
|
Filename: "sc.exe"; Parameters: "start {#APP_SVC_NAME}"; Description: "Start service"; \
|
|
|
|
Flags: nowait; Tasks: service
|
2021-04-22 14:00:06 +00:00
|
|
|
|
2023-12-22 14:51:08 +00:00
|
|
|
Filename: "{#APP_EXE}"; Parameters: "--lang {code:LanguageName}"; \
|
2024-04-25 11:14:43 +00:00
|
|
|
Description: {cm:LaunchProgram,{#APP_NAME}}; Flags: nowait postinstall; Check: ShouldLaunch
|
2017-09-11 10:49:25 +00:00
|
|
|
|
|
|
|
[UninstallRun]
|
2021-05-23 13:44:02 +00:00
|
|
|
Filename: "{#APP_EXE}"; Parameters: "-u"; RunOnceId: "Uninstall"
|
2023-03-24 16:12:31 +00:00
|
|
|
Filename: "{app}\driver\scripts\uninstall.bat"; RunOnceId: "UninsDriver"
|
2017-09-11 10:49:25 +00:00
|
|
|
|
2018-02-19 15:02:13 +00:00
|
|
|
[InstallDelete]
|
2021-03-26 11:48:11 +00:00
|
|
|
Type: filesandordirs; Name: "{app}\driver"
|
|
|
|
Type: filesandordirs; Name: "{app}\i18n"
|
2022-03-30 10:39:21 +00:00
|
|
|
Type: files; Name: "{app}\README*.*"
|
2024-02-26 13:07:35 +00:00
|
|
|
Type: files; Name: "{app}\qt*.*"
|
2021-09-05 08:38:24 +00:00
|
|
|
; TODO: COMPAT: Remove the following 4 lines after v4.1.0
|
2021-03-26 11:48:11 +00:00
|
|
|
Type: filesandordirs; Name: "{app}\plugins"
|
|
|
|
Type: files; Name: "{app}\curl*.*"
|
2021-09-05 08:38:24 +00:00
|
|
|
Type: files; Name: "{app}\ChangeLog"
|
2018-02-19 15:02:13 +00:00
|
|
|
|
2022-05-29 10:03:45 +00:00
|
|
|
[Registry]
|
|
|
|
Root: HKLM; Subkey: "System\CurrentControlSet\Services\EventLog\System\fortfw"; Flags: uninsdeletekey
|
|
|
|
Root: HKLM; Subkey: "System\CurrentControlSet\Services\EventLog\System\fortfw"; \
|
|
|
|
ValueType: string; ValueName: "EventMessageFile"; ValueData: "{#APP_EXE}"
|
|
|
|
Root: HKLM; Subkey: "System\CurrentControlSet\Services\EventLog\System\fortfw"; \
|
|
|
|
ValueType: dword; ValueName: "TypesSupported"; ValueData: "7"
|
|
|
|
|
2023-03-24 16:12:31 +00:00
|
|
|
Root: HKLM; Subkey: "SOFTWARE\{#APP_NAME}"; Flags: dontcreatekey uninsdeletekeyifempty
|
|
|
|
Root: HKLM; Subkey: "SOFTWARE\{#APP_NAME}"; ValueName: "passwordHash"; Flags: dontcreatekey uninsdeletevalue
|
|
|
|
|
2020-01-25 05:54:25 +00:00
|
|
|
[Code]
|
2024-02-20 17:08:56 +00:00
|
|
|
|
2024-04-21 14:00:23 +00:00
|
|
|
function ParamExists(const Value: string): Boolean;
|
|
|
|
var
|
|
|
|
I: Integer;
|
|
|
|
begin
|
|
|
|
Result := False;
|
|
|
|
for I := 1 to ParamCount do
|
|
|
|
if CompareText(ParamStr(I), Value) = 0 then
|
|
|
|
begin
|
|
|
|
Result := True;
|
|
|
|
Exit;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
2024-04-25 11:14:43 +00:00
|
|
|
function ShouldLaunch: Boolean;
|
2024-04-21 14:00:23 +00:00
|
|
|
begin
|
2024-04-25 11:14:43 +00:00
|
|
|
Result := ParamExists('/LAUNCH') or not (ParamExists('/SILENT') or ParamExists('/VERYSILENT'));
|
2024-04-21 14:00:23 +00:00
|
|
|
end;
|
|
|
|
|
2024-02-20 17:08:56 +00:00
|
|
|
#if CHECK_WIN10 == "Y"
|
|
|
|
function IsProcessorFeaturePresent(Feature: Integer): Boolean;
|
|
|
|
external 'IsProcessorFeaturePresent@kernel32.dll stdcall';
|
|
|
|
|
|
|
|
function IsSSE4Supported(): Boolean;
|
|
|
|
begin
|
2024-02-21 10:28:49 +00:00
|
|
|
Result := IsProcessorFeaturePresent(38); // PF_SSE4_2_INSTRUCTIONS_AVAILABLE
|
2024-02-20 17:08:56 +00:00
|
|
|
end;
|
|
|
|
#endif
|
|
|
|
|
2020-01-25 05:54:25 +00:00
|
|
|
function LanguageName(Param: String): String;
|
|
|
|
begin
|
|
|
|
Result := ActiveLanguage;
|
|
|
|
end;
|
2021-04-22 14:00:06 +00:00
|
|
|
|
2023-12-24 10:47:02 +00:00
|
|
|
function GetUninstallString(): String;
|
2023-12-21 17:55:51 +00:00
|
|
|
var
|
2023-12-24 10:47:02 +00:00
|
|
|
UninstallKey: String;
|
2023-12-21 17:55:51 +00:00
|
|
|
begin
|
|
|
|
UninstallKey := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting("AppName")}_is1');
|
|
|
|
if not RegQueryStringValue(HKLM, UninstallKey, 'UninstallString', Result) then
|
|
|
|
RegQueryStringValue(HKCU, UninstallKey, 'UninstallString', Result);
|
|
|
|
end;
|
|
|
|
|
|
|
|
function IsUpgrade(): Boolean;
|
|
|
|
begin
|
|
|
|
Result := GetUninstallString() <> '';
|
|
|
|
end;
|
|
|
|
|
2021-04-22 14:00:06 +00:00
|
|
|
function VCRedist86Exists(): Boolean;
|
|
|
|
begin
|
|
|
|
Result := FileExists(ExpandConstant('{syswow64}\vcruntime140.dll'));
|
|
|
|
end;
|
2022-09-23 17:27:25 +00:00
|
|
|
|
2023-05-18 12:55:22 +00:00
|
|
|
function IsWindows10OrNewer(): Boolean;
|
|
|
|
var
|
|
|
|
Version: TWindowsVersion;
|
|
|
|
begin
|
|
|
|
GetWindowsVersionEx(Version);
|
|
|
|
Result := (Version.Major > 10) or ((Version.Major = 10) and (Version.Build > 19040));
|
|
|
|
end;
|
|
|
|
|
2023-12-20 13:00:15 +00:00
|
|
|
function IsWindows7(): Boolean;
|
|
|
|
var
|
|
|
|
Version: TWindowsVersion;
|
|
|
|
begin
|
|
|
|
GetWindowsVersionEx(Version);
|
|
|
|
Result := (Version.Major = 6) and (Version.Minor = 1);
|
|
|
|
end;
|
|
|
|
|
2023-12-24 08:57:02 +00:00
|
|
|
function IsDriverSignatureValid(): Boolean;
|
2023-12-20 13:00:15 +00:00
|
|
|
var
|
2023-12-24 08:57:02 +00:00
|
|
|
DriverPath: String;
|
|
|
|
DriverName: String;
|
|
|
|
WorkingDir: String;
|
|
|
|
Command: String;
|
2023-12-21 17:54:50 +00:00
|
|
|
ResultCode: Integer;
|
2023-12-20 13:00:15 +00:00
|
|
|
begin
|
2023-12-24 08:57:02 +00:00
|
|
|
DriverPath := '{app}\driver\x86';
|
|
|
|
DriverName := 'fortfw.sys';
|
|
|
|
WorkingDir := ExpandConstant('{tmp}\') + DriverPath;
|
|
|
|
|
|
|
|
ExtractTemporaryFiles(DriverPath + '\' + DriverName);
|
|
|
|
|
|
|
|
Command := '-Command "if ((Get-AuthenticodeSignature ' + DriverName
|
|
|
|
+ ').status -eq ''UnknownError'') {exit 2} else {exit 0}"';
|
|
|
|
|
|
|
|
Exec('powershell.exe', Command, WorkingDir, SW_HIDE, ewWaitUntilTerminated, ResultCode)
|
2023-12-21 17:54:50 +00:00
|
|
|
Result := ResultCode = 0;
|
2023-12-20 13:00:15 +00:00
|
|
|
end;
|
|
|
|
|
2022-09-23 17:27:25 +00:00
|
|
|
function HVCIEnabled(): Boolean;
|
|
|
|
var
|
|
|
|
EnabledValue: Cardinal;
|
|
|
|
begin
|
|
|
|
Result := RegQueryDWordValue(HKEY_LOCAL_MACHINE,
|
|
|
|
'SYSTEM\CurrentControlSet\Control\DeviceGuard\Scenarios\HypervisorEnforcedCodeIntegrity',
|
|
|
|
'Enabled', EnabledValue)
|
|
|
|
and (EnabledValue = 1);
|
|
|
|
end;
|
|
|
|
|
2023-03-10 11:04:49 +00:00
|
|
|
function AskPassword(): String;
|
|
|
|
var
|
|
|
|
Form: TSetupForm;
|
|
|
|
OKButton, CancelButton: TButton;
|
|
|
|
PwdEdit: TPasswordEdit;
|
|
|
|
begin
|
|
|
|
Form := CreateCustomForm();
|
|
|
|
try
|
|
|
|
Form.ClientWidth := ScaleX(256);
|
|
|
|
Form.ClientHeight := ScaleY(100);
|
2023-05-08 22:30:53 +00:00
|
|
|
Form.Caption := ExpandConstant('{cm:UninstallPassword}');
|
2023-03-10 11:04:49 +00:00
|
|
|
Form.BorderIcons := [biSystemMenu];
|
|
|
|
Form.BorderStyle := bsDialog;
|
|
|
|
Form.Center;
|
|
|
|
|
|
|
|
OKButton := TButton.Create(Form);
|
|
|
|
OKButton.Parent := Form;
|
|
|
|
OKButton.Width := ScaleX(75);
|
|
|
|
OKButton.Height := ScaleY(23);
|
|
|
|
OKButton.Left := Form.ClientWidth - ScaleX(75 + 6 + 75 + 50);
|
|
|
|
OKButton.Top := Form.ClientHeight - ScaleY(23 + 10);
|
2023-05-08 22:30:53 +00:00
|
|
|
OKButton.Caption := ExpandConstant('{cm:UninstallPasswordOK}');
|
2023-03-10 11:04:49 +00:00
|
|
|
OKButton.ModalResult := mrOk;
|
|
|
|
OKButton.Default := true;
|
|
|
|
|
|
|
|
CancelButton := TButton.Create(Form);
|
|
|
|
CancelButton.Parent := Form;
|
|
|
|
CancelButton.Width := ScaleX(75);
|
|
|
|
CancelButton.Height := ScaleY(23);
|
|
|
|
CancelButton.Left := Form.ClientWidth - ScaleX(75 + 50);
|
|
|
|
CancelButton.Top := Form.ClientHeight - ScaleY(23 + 10);
|
2023-05-08 22:30:53 +00:00
|
|
|
CancelButton.Caption := ExpandConstant('{cm:UninstallPasswordCancel}');
|
2023-03-10 11:04:49 +00:00
|
|
|
CancelButton.ModalResult := mrCancel;
|
|
|
|
CancelButton.Cancel := True;
|
|
|
|
|
|
|
|
PwdEdit := TPasswordEdit.Create(Form);
|
|
|
|
PwdEdit.Parent := Form;
|
|
|
|
PwdEdit.Width := ScaleX(210);
|
|
|
|
PwdEdit.Height := ScaleY(23);
|
|
|
|
PwdEdit.Left := ScaleX(23);
|
|
|
|
PwdEdit.Top := ScaleY(23);
|
|
|
|
|
|
|
|
Form.ActiveControl := PwdEdit;
|
|
|
|
|
|
|
|
if Form.ShowModal() = mrOk then
|
|
|
|
begin
|
2023-03-11 09:11:27 +00:00
|
|
|
Result := PwdEdit.Text;
|
2023-03-10 11:04:49 +00:00
|
|
|
end;
|
|
|
|
finally
|
|
|
|
Form.Free();
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
function CheckPasswordHash(): Boolean;
|
|
|
|
var
|
|
|
|
passwordHash: String;
|
|
|
|
begin
|
|
|
|
RegQueryStringValue(HKEY_LOCAL_MACHINE, ExpandConstant('SOFTWARE\{#APP_NAME}'),
|
|
|
|
'passwordHash', passwordHash);
|
|
|
|
|
|
|
|
if passwordHash = '' then
|
|
|
|
begin
|
|
|
|
Result := True;
|
|
|
|
Exit;
|
|
|
|
end;
|
|
|
|
|
2023-03-11 09:11:27 +00:00
|
|
|
if GetSHA1OfString(AskPassword()) <> passwordHash then
|
2023-03-10 11:04:49 +00:00
|
|
|
begin
|
2023-05-08 22:30:53 +00:00
|
|
|
SuppressibleMsgBox(ExpandConstant('{cm:WrongPassword}'), mbError, MB_OK, IDOK);
|
2023-03-10 11:04:49 +00:00
|
|
|
|
|
|
|
Result := False;
|
|
|
|
Exit;
|
|
|
|
end;
|
|
|
|
|
|
|
|
Result := True;
|
|
|
|
end;
|
|
|
|
|
2023-10-09 16:19:50 +00:00
|
|
|
function StopFortService(var ResultCode: Integer): Boolean;
|
|
|
|
var
|
|
|
|
path: String;
|
|
|
|
begin
|
|
|
|
ResultCode := -1;
|
|
|
|
|
|
|
|
path := ExpandConstant('{#APP_EXE}');
|
|
|
|
|
|
|
|
if not FileExists(path) then
|
|
|
|
begin
|
|
|
|
Result := True;
|
|
|
|
Exit;
|
|
|
|
end;
|
|
|
|
|
|
|
|
Exec(path, '-s', '', SW_SHOW, ewWaitUntilTerminated, ResultCode)
|
|
|
|
|
|
|
|
Result := (ResultCode = 0);
|
|
|
|
end;
|
|
|
|
|
2023-09-30 12:04:00 +00:00
|
|
|
function Unpack(): Boolean;
|
|
|
|
var
|
|
|
|
path: String;
|
|
|
|
params: String;
|
|
|
|
ResultCode: Integer;
|
|
|
|
begin
|
|
|
|
path := ExpandConstant('{param:UNPACK}');
|
|
|
|
|
|
|
|
if path = '' then
|
|
|
|
begin
|
|
|
|
Result := False;
|
|
|
|
Exit;
|
|
|
|
end;
|
|
|
|
|
|
|
|
path := path + ExpandConstant('\{#APP_BASE}');
|
|
|
|
|
|
|
|
if DirExists(path) then
|
|
|
|
begin
|
|
|
|
SuppressibleMsgBox('UNPACK Error: Path already exists: ' + path, mbCriticalError, MB_OK, IDOK);
|
|
|
|
|
|
|
|
Result := True;
|
|
|
|
Exit;
|
|
|
|
end;
|
|
|
|
|
|
|
|
ExtractTemporaryFiles('*.*');
|
|
|
|
|
2024-01-02 12:45:10 +00:00
|
|
|
params := ExpandConstant('"{tmp}') + '\{app}\*" "' + path + '\" /Q /Y /E /H';
|
2023-09-30 12:04:00 +00:00
|
|
|
|
|
|
|
Exec('xcopy.exe', params, GetCurrentDir(), SW_HIDE, ewWaitUntilTerminated, ResultCode)
|
|
|
|
|
|
|
|
Result := True;
|
|
|
|
end;
|
|
|
|
|
2023-12-24 10:47:02 +00:00
|
|
|
function OpenUrl(Url: String): Boolean;
|
|
|
|
var
|
|
|
|
ErrCode: Integer;
|
|
|
|
begin
|
|
|
|
Result := ShellExec('open', Url, '', '', SW_SHOW, ewNoWait, ErrCode);
|
|
|
|
end;
|
|
|
|
|
2022-09-23 17:27:25 +00:00
|
|
|
function InitializeSetup: Boolean;
|
|
|
|
begin
|
2023-09-30 12:04:00 +00:00
|
|
|
if Unpack() then
|
|
|
|
begin
|
|
|
|
Result := False;
|
|
|
|
Exit;
|
|
|
|
end;
|
|
|
|
|
2023-12-21 17:55:51 +00:00
|
|
|
if not CheckPasswordHash() then
|
|
|
|
begin
|
|
|
|
Result := False;
|
|
|
|
Exit;
|
|
|
|
end;
|
|
|
|
|
|
|
|
if IsUpgrade() then
|
|
|
|
begin
|
|
|
|
Result := True;
|
|
|
|
Exit;
|
|
|
|
end;
|
|
|
|
|
2023-05-20 08:37:46 +00:00
|
|
|
#if CHECK_WIN10 == "Y"
|
|
|
|
if not IsWindows10OrNewer() then
|
2023-05-18 12:55:22 +00:00
|
|
|
begin
|
|
|
|
SuppressibleMsgBox(ExpandConstant('{cm:NotCompatibleWithWindows}'), mbCriticalError, MB_OK, IDOK);
|
|
|
|
|
2023-12-20 13:00:15 +00:00
|
|
|
Result := False;
|
|
|
|
Exit;
|
|
|
|
end;
|
2024-02-20 17:08:56 +00:00
|
|
|
|
|
|
|
#if 0
|
|
|
|
if not IsSSE4Supported() then
|
|
|
|
begin
|
|
|
|
SuppressibleMsgBox(ExpandConstant('{cm:NotCompatibleWithSSE4}'), mbCriticalError, MB_OK, IDOK);
|
|
|
|
|
|
|
|
Result := False;
|
|
|
|
Exit;
|
|
|
|
end;
|
|
|
|
#endif
|
2023-12-20 13:00:15 +00:00
|
|
|
#else
|
2023-12-22 16:49:10 +00:00
|
|
|
if not VCRedist86Exists() then
|
|
|
|
begin
|
2023-12-24 10:47:02 +00:00
|
|
|
if SuppressibleMsgBox(ExpandConstant('{cm:InstallVCRedist}'), mbCriticalError, MB_OKCANCEL, IDCANCEL) = IDOK then
|
2023-12-25 09:20:40 +00:00
|
|
|
OpenUrl('https://aka.ms/vs/17/release/vc_redist.x86.exe');
|
2023-12-22 16:49:10 +00:00
|
|
|
|
|
|
|
Result := False;
|
|
|
|
Exit;
|
|
|
|
end;
|
|
|
|
|
2023-12-24 08:57:02 +00:00
|
|
|
if IsWindows7() and not IsDriverSignatureValid() then
|
2023-12-20 13:00:15 +00:00
|
|
|
begin
|
|
|
|
SuppressibleMsgBox(ExpandConstant('{cm:NotCompatibleWithWindows7}'), mbCriticalError, MB_OK, IDOK);
|
|
|
|
|
2023-12-25 09:55:05 +00:00
|
|
|
OpenUrl('https://www.catalog.update.microsoft.com/Search.aspx?q=KB4474419');
|
|
|
|
|
2023-05-18 12:55:22 +00:00
|
|
|
Result := False;
|
|
|
|
Exit;
|
|
|
|
end;
|
2023-05-20 08:37:46 +00:00
|
|
|
#endif
|
2023-05-18 12:55:22 +00:00
|
|
|
|
2022-09-23 17:27:25 +00:00
|
|
|
if HVCIEnabled() then
|
|
|
|
begin
|
2023-05-08 22:30:53 +00:00
|
|
|
SuppressibleMsgBox(ExpandConstant('{cm:NotCompatibleWithHVCI}'), mbCriticalError, MB_OK, IDOK);
|
2022-09-23 17:27:25 +00:00
|
|
|
|
|
|
|
Result := False;
|
|
|
|
Exit;
|
|
|
|
end;
|
|
|
|
|
2023-12-21 17:55:51 +00:00
|
|
|
Result := True;
|
2022-09-23 17:27:25 +00:00
|
|
|
end;
|
|
|
|
|
2023-03-11 09:11:27 +00:00
|
|
|
function InitializeUninstall(): Boolean;
|
|
|
|
begin
|
|
|
|
Result := CheckPasswordHash();
|
|
|
|
end;
|
|
|
|
|
2022-09-23 17:27:25 +00:00
|
|
|
function PrepareToInstall(var NeedsRestart: Boolean): String;
|
|
|
|
var
|
|
|
|
ResultCode: Integer;
|
|
|
|
begin
|
|
|
|
if Exec('sc.exe', ExpandConstant('stop {#APP_SVC_NAME}'), '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then
|
2023-10-09 16:19:50 +00:00
|
|
|
begin
|
|
|
|
if ResultCode <> 0 then StopFortService(ResultCode);
|
|
|
|
|
2022-09-23 17:27:25 +00:00
|
|
|
if ResultCode = 0 then Sleep(100); // Let the service to stop
|
2023-10-09 16:19:50 +00:00
|
|
|
end;
|
2023-03-10 11:04:49 +00:00
|
|
|
|
2023-03-11 09:11:27 +00:00
|
|
|
Result := '';
|
2023-03-10 11:04:49 +00:00
|
|
|
end;
|
2023-03-24 16:42:13 +00:00
|
|
|
|
|
|
|
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
|
|
|
|
begin
|
|
|
|
case CurUninstallStep of
|
|
|
|
usPostUninstall:
|
|
|
|
begin
|
2023-05-08 22:30:53 +00:00
|
|
|
if MsgBox(ExpandConstant('{cm:IsDeleteData}'), mbConfirmation, MB_YESNO or MB_DEFBUTTON2) = IDYES then
|
2023-03-24 16:42:13 +00:00
|
|
|
begin
|
|
|
|
DelTree(ExpandConstant('{%ProgramData}\{#APP_NAME}'), True, True, True);
|
|
|
|
DelTree(ExpandConstant('{localappdata}\{#APP_NAME}'), True, True, True);
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
end;
|