1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-06-12 22:07:39 +02:00

Fix for issue #277

- Added attribution links to other projects in the readme file.
This commit is contained in:
Salvador Díaz Fau
2020-05-09 11:41:20 +02:00
parent 1d750fac10
commit e47b526c33
3 changed files with 34 additions and 9 deletions

View File

@ -170,7 +170,6 @@ function PathIsUNCAnsi(pszPath: LPCSTR): BOOL; stdcall; external SHLWAPIDLL name
function PathIsUNCUnicode(pszPath: LPCWSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathIsUNCW';
function PathIsURLAnsi(pszPath: LPCSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathIsURLA';
function PathIsURLUnicode(pszPath: LPCWSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathIsURLW';
function CustomRtlGetVersion(var lpVersionInformation : TOSVersionInfoEx): LongInt; stdcall; external NTDLL name 'RtlGetVersion';
{$IFNDEF DELPHI12_UP}
const
@ -2129,21 +2128,42 @@ begin
end;
function GetWindowsMajorMinorVersion(var wMajorVersion, wMinorVersion : DWORD) : boolean;
type
TRtlGetVersionFunc = function(var lpVersionInformation : TOSVersionInfoEx): LongInt; stdcall;
var
TempHandle : THandle;
TempInfo : TOSVersionInfoEx;
TempRtlGetVersionFunc : TRtlGetVersionFunc;
begin
Result := False;
wMajorVersion := 0;
wMinorVersion := 0;
ZeroMemory(@TempInfo, SizeOf(TOSVersionInfoEx));
try
TempHandle := LoadLibrary(NTDLL);
if (CustomRtlGetVersion(TempInfo) = 0) then
begin
Result := True;
wMajorVersion := TempInfo.dwMajorVersion;
wMinorVersion := TempInfo.dwMinorVersion;
end;
if (TempHandle <> 0) then
try
{$IFDEF FPC}Pointer({$ENDIF}TempRtlGetVersionFunc{$IFDEF FPC}){$ENDIF} := GetProcAddress(TempHandle, 'RtlGetVersion');
if assigned(TempRtlGetVersionFunc) then
begin
ZeroMemory(@TempInfo, SizeOf(TOSVersionInfoEx));
if (TempRtlGetVersionFunc(TempInfo) = 0) then
begin
Result := True;
wMajorVersion := TempInfo.dwMajorVersion;
wMinorVersion := TempInfo.dwMinorVersion;
end;
end;
finally
FreeLibrary(TempHandle);
end;
except
on e : exception do
if CustomExceptionHandler('GetWindowsMajorMinorVersion', e) then raise;
end;
end;
function GetDefaultCEFUserAgent : string;