Merged revision(s) 56180 #9823f61682 from trunk:

win32: fix GetDpiForMonitor SIGSEGV if Shcore is not available (e.g. on MS Windows Server 2012 R2)
........

git-svn-id: branches/fixes_1_8@56238 -
This commit is contained in:
maxim 2017-10-29 22:15:50 +00:00
parent 07c9056e62
commit 643398e6f9

View File

@ -296,19 +296,18 @@ function InitShellScalingStubs: Boolean;
var
hShcore: Windows.HMODULE;
begin
if g_fShellScalingInitDone then
Exit(@g_pfnGetDpiForMonitor <> nil);
hShcore := GetModuleHandle('Shcore');
if hShcore<>0 then
if not g_fShellScalingInitDone then
begin
Pointer(g_pfnGetDpiForMonitor) := GetProcAddress(hShcore, 'GetDpiForMonitor');
hShcore := GetModuleHandle('Shcore');
if hShcore<>0 then
Pointer(g_pfnGetDpiForMonitor) := GetProcAddress(hShcore, 'GetDpiForMonitor')
else
Pointer(g_pfnGetDpiForMonitor) := nil;
g_fShellScalingInitDone := True;
end else
begin
Pointer(g_pfnGetDpiForMonitor) := nil;
end;
Result := (Pointer(g_pfnGetDpiForMonitor)<>nil) and (@g_pfnGetDpiForMonitor <> nil);
end;
function xGetDpiForMonitor(hmonitor: HMONITOR; dpiType: TMonitorDpiType;