changing some variable and function names, also combining conditions for set up wizard behaviour when installation process is not terminated normally due to the absence of deps

This commit is contained in:
Leo Menzies-Ye 2024-02-05 12:51:12 +11:00
parent 799a66e64d
commit 1b7b87a643

View File

@ -96,7 +96,7 @@ const
; Used to store value of whether we have acceptable Visual C++ Runtime components ; Used to store value of whether we have acceptable Visual C++ Runtime components
var var
HasAcceptableVCRuntime : Boolean; HasRequiredVCRuntimeVersion : Boolean;
VCRuntimeMissingOptionsPage : TInputOptionWizardPage; VCRuntimeMissingOptionsPage : TInputOptionWizardPage;
IsInstallationFinishedNormally : Boolean; IsInstallationFinishedNormally : Boolean;
@ -133,7 +133,7 @@ begin
end; end;
end; end;
function IsAcceptableVCRuntimeInstalled() : Boolean; function IsRequiredVCRuntimeVersionInstalled() : Boolean;
var var
cMajor: Cardinal; cMajor: Cardinal;
cMinor: Cardinal; cMinor: Cardinal;
@ -177,9 +177,9 @@ end;
procedure InitializeWizard(); procedure InitializeWizard();
begin begin
HasAcceptableVCRuntime := IsAcceptableVCRuntimeInstalled(); HasRequiredVCRuntimeVersion := IsRequiredVCRuntimeVersionInstalled();
; If the OS is missing required dependencies, the installation process will not go the full length and will be aborted early ; If the OS is missing required dependencies, the installation process will not go the full length and will be aborted early
if not HasAcceptableVCRuntime then begin if not HasRequiredVCRuntimeVersion then begin
IsInstallationFinishedNormally := False; IsInstallationFinishedNormally := False;
VCRuntimeMissingOptionsPage := CreateInputOptionPage(wpWelcome, VCRuntimeMissingOptionsPage := CreateInputOptionPage(wpWelcome,
'Visual C++ Runtime Required', 'Visual C++ Runtime Required',
@ -201,21 +201,17 @@ procedure CurStepChanged(CurStep : TSetupStep);
var var
ErrorCode : Integer; ErrorCode : Integer;
begin begin
if curStep = ssPostInstall then begin if (curStep = ssPostInstall) and not ((WizardForm.Canceled) or (IsInstallationFinishedNormally)) then begin
if not WizardForm.Canceled then begin case VCRuntimeMissingOptionsPage.Values[0] of
if not IsInstallationFinishedNormally then begin 0: begin
case VCRuntimeMissingOptionsPage.Values[0] of { install dependencies now, using Microsoft's perma-link }
0: begin ShellExec('', 'https://aka.ms/vs/17/release/vc_redist.x64.exe', '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode);
{ install dependencies now, using Microsoft's perma-link } Abort;
ShellExec('', 'https://aka.ms/vs/17/release/vc_redist.x64.exe', '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode); end;
Abort; 1: begin
end; { do it later themselves }
1: begin MsgBox('Please install required VC++ dependencies first and try again.', mbInformation, MB_OK);
{ do it later themselves } Abort;
MsgBox('Please install required VC++ dependencies first and try again.', mbInformation, MB_OK);
Abort;
end;
end;
end; end;
end; end;
end; end;