1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-11-23 21:34:53 +02:00

Check the minimum Windows version before trying to load the CEF binaries

Fix for issue #452
This commit is contained in:
salvadordf
2023-04-15 14:59:17 +02:00
parent ec6dfa64e2
commit a0e2bcfbd8
4 changed files with 70 additions and 3 deletions

View File

@@ -367,6 +367,7 @@ type
function CheckCEFResources : boolean; virtual;
{$IFDEF MSWINDOWS}
function CheckCEFDLL : boolean; virtual;
function CheckWindowsVersion: boolean; virtual;
{$ENDIF}
procedure ShowErrorMessageDlg(const aError : string); virtual;
function ParseProcessType : TCefProcessType;
@@ -1205,6 +1206,23 @@ begin
ShowErrorMessageDlg(FLastErrorMessage);
end;
end;
function TCefApplicationCore.CheckWindowsVersion : boolean;
begin
// Chromium 109 requires Windows 10 or later.
// https://github.com/salvadordf/CEF4Delphi/issues/452
if CheckRealWindowsVersion(10, 0) then
Result := True
else
begin
Result := False;
FStatus := asErrorWindowsVersion;
FLastErrorMessage := 'Unsupported Windows version !' +
CRLF + CRLF +
'Chromium requires Windows 10 or later.';
ShowErrorMessageDlg(FLastErrorMessage);
end;
end;
{$ENDIF}
function TCefApplicationCore.CheckCEFLibrary : boolean;
@@ -1223,8 +1241,10 @@ begin
chdir(GetModulePath);
end;
Result := CheckCEFResources
{$IFDEF MSWINDOWS}and CheckCEFDLL{$ENDIF};
Result := CheckCEFResources;
{$IFDEF MSWINDOWS}
Result := Result and CheckWindowsVersion and CheckCEFDLL;
{$ENDIF}
if FSetCurrentDir then chdir(TempOldDir);
end;