From b78ea774d7fee32d4db4138acdd281ce0b2e7e29 Mon Sep 17 00:00:00 2001 From: narzoul Date: Sat, 21 May 2016 11:26:55 +0200 Subject: [PATCH] Disabled the VirtualizeDesktopPainting shim --- DDrawCompat/CompatGdiDc.cpp | 7 ++++++- DDrawCompat/CompatGdiPaintHandlers.cpp | 9 +++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/DDrawCompat/CompatGdiDc.cpp b/DDrawCompat/CompatGdiDc.cpp index 1d244d9..185502c 100644 --- a/DDrawCompat/CompatGdiDc.cpp +++ b/DDrawCompat/CompatGdiDc.cpp @@ -124,6 +124,11 @@ namespace void setClippingRegion(HDC compatDc, HDC origDc, HWND hwnd, bool isMenuWindow, const POINT& origin) { + if (GetDesktopWindow() == hwnd) + { + return; + } + HRGN clipRgn = CreateRectRgn(0, 0, 0, 0); if (1 == GetClipRgn(origDc, clipRgn)) { @@ -167,7 +172,7 @@ namespace CompatGdiDc return it->second.dc; } - const HWND hwnd = WindowFromDC(origDc); + const HWND hwnd = CALL_ORIG_FUNC(WindowFromDC)(origDc); const bool isMenuWindow = hwnd && 0x8000 == GetClassLongPtr(hwnd, GCW_ATOM); if (isMenuWindow && !isMenuPaintDc) { diff --git a/DDrawCompat/CompatGdiPaintHandlers.cpp b/DDrawCompat/CompatGdiPaintHandlers.cpp index 28a8410..c18ec2d 100644 --- a/DDrawCompat/CompatGdiPaintHandlers.cpp +++ b/DDrawCompat/CompatGdiPaintHandlers.cpp @@ -83,6 +83,15 @@ namespace LRESULT WINAPI defWindowProcW(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { + if (WM_CREATE == msg) + { + auto className = reinterpret_cast(lParam)->lpszClass; + if (reinterpret_cast(className) > 0xFFFF && + 0 == lstrcmpW(className, L"CompatWindowDesktopReplacement")) + { + return -1; + } + } return defPaintProc(hwnd, msg, wParam, lParam, CALL_ORIG_FUNC(DefWindowProcW), "defWindowProcW"); }