summaryrefslogtreecommitdiff
path: root/core/src/fxge/win32
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2016-03-02 17:40:00 -0800
committerTom Sepez <tsepez@chromium.org>2016-03-02 17:40:00 -0800
commit75e1a495ecb89461b3a3af2eb084112d9caac2e0 (patch)
treefc8eb2102c2833a82679e31e2bdffc2735fc566f /core/src/fxge/win32
parent73733f079c086562d8e7c2943ed16cf6f95b2c42 (diff)
downloadpdfium-75e1a495ecb89461b3a3af2eb084112d9caac2e0.tar.xz
Don't load GDI+ if GDI is disabled.chromium/2666
This is to fix an issue when win32k lockdown is enabled on PDF content which can cause application crashes. If GDI is disabled then there's little benefit to loading the GDI+ library. BUG=583038 Patch by forshaw@ R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1748163006 .
Diffstat (limited to 'core/src/fxge/win32')
-rw-r--r--core/src/fxge/win32/fx_win32_device.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/core/src/fxge/win32/fx_win32_device.cpp b/core/src/fxge/win32/fx_win32_device.cpp
index e9fee082b9..99b5540774 100644
--- a/core/src/fxge/win32/fx_win32_device.cpp
+++ b/core/src/fxge/win32/fx_win32_device.cpp
@@ -438,14 +438,20 @@ FX_BOOL CFX_Win32FontInfo::GetFontCharset(void* hFont, int& charset) {
charset = tm.tmCharSet;
return TRUE;
}
-IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault(const char** pUnused) {
+static FX_BOOL IsGDIEnabled() {
+ // If GDI is disabled then GetDC for the desktop will fail.
HDC hdc = ::GetDC(NULL);
if (hdc) {
::ReleaseDC(NULL, hdc);
+ return TRUE;
+ }
+ return FALSE;
+}
+IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault(const char** pUnused) {
+ if (IsGDIEnabled()) {
return new CFX_Win32FontInfo;
}
- // If GDI is disabled then GetDC for the desktop will fail. Select the
- // fallback font information class if GDI is disabled.
+ // Select the fallback font information class if GDI is disabled.
CFX_Win32FallbackFontInfo* pInfoFallback = new CFX_Win32FallbackFontInfo;
// Construct the font path manually, SHGetKnownFolderPath won't work under
// a restrictive sandbox.
@@ -464,7 +470,9 @@ void CFX_GEModule::InitPlatform() {
ver.dwOSVersionInfoSize = sizeof(ver);
GetVersionEx(&ver);
pPlatformData->m_bHalfTone = ver.dwMajorVersion >= 5;
- pPlatformData->m_GdiplusExt.Load();
+ if (IsGDIEnabled()) {
+ pPlatformData->m_GdiplusExt.Load();
+ }
m_pPlatformData = pPlatformData;
m_pFontMgr->SetSystemFontInfo(IFX_SystemFontInfo::CreateDefault(nullptr));
}