diff --git a/DDrawCompat/Gdi/User32WndProcs.cpp b/DDrawCompat/Gdi/User32WndProcs.cpp index 422e8ea..5519de0 100644 --- a/DDrawCompat/Gdi/User32WndProcs.cpp +++ b/DDrawCompat/Gdi/User32WndProcs.cpp @@ -184,9 +184,15 @@ namespace if (std::string(className) == "CompatWindowDesktopReplacement") { // Disable VirtualizeDesktopPainting shim - return 0; + return FALSE; } - return origDefWindowProc(hwnd, msg, wParam, lParam); + + LRESULT result = origDefWindowProc(hwnd, msg, wParam, lParam); + if (result) + { + Gdi::WinProc::onCreateWindow(hwnd); + } + return result; } case WM_NCLBUTTONDOWN: @@ -559,7 +565,8 @@ namespace { LOG_FUNC(procName.c_str(), Compat::WindowMessageStruct(hwnd, uMsg, wParam, lParam)); LRESULT result = wndProcHook(hwnd, uMsg, wParam, lParam, oldWndProcTrampoline); - if (WM_CREATE == uMsg && -1 != result) + if (WM_CREATE == uMsg && -1 != result || + WM_NCCREATE == uMsg && result) { Gdi::WinProc::onCreateWindow(hwnd); } diff --git a/DDrawCompat/Gdi/Window.cpp b/DDrawCompat/Gdi/Window.cpp index 5c73f14..5812dcc 100644 --- a/DDrawCompat/Gdi/Window.cpp +++ b/DDrawCompat/Gdi/Window.cpp @@ -404,6 +404,7 @@ namespace Gdi std::vector getVisibleLayeredWindows() { + D3dDdi::ScopedCriticalSection lock; std::vector layeredWindows; for (auto it = g_windowZOrder.rbegin(); it != g_windowZOrder.rend(); ++it) { @@ -425,6 +426,7 @@ namespace Gdi std::vector getVisibleOverlayWindows() { + D3dDdi::ScopedCriticalSection lock; std::vector layeredWindows; RECT wr = {}; auto statsWindow = GuiThread::getStatsWindow();