1
0
mirror of https://github.com/narzoul/DDrawCompat synced 2024-12-30 08:55:36 +01:00

Call WindowFromDC through IAT

GetWindowDC(GetDC(NULL)) may return a special window with a class name of
"CompatWindowDesktopReplacement". Presumably the shim engine installs an
IAT hook for GetWindowDC that replaces this window handle with the normal
desktop window handle.

CALL_ORIG_FUNC(WindowFromDC) returns with an unpatched pointer, therefore
it doesn't perform the above replacement. This results in using the
replacement window's clipping region (whole screen) instead of the desktop
window's clipping region (empty), and things become visible that shouldn't
be, e.g. some character symbols at the top left corner of the screen when
launchning Diablo II.

As a workaround, WindowFromDC is used without CALL_ORIG_FUNC.
This commit is contained in:
narzoul 2016-04-10 20:37:00 +02:00
parent ac9dbc72de
commit 0a05ef1174

View File

@ -166,7 +166,7 @@ namespace CompatGdiDc
return it->second.dc;
}
const HWND hwnd = CALL_ORIG_FUNC(WindowFromDC)(origDc);
const HWND hwnd = WindowFromDC(origDc);
const bool isMenuWindow = hwnd && 0x8000 == GetClassLongPtr(hwnd, GCW_ATOM);
if (isMenuWindow && !isMenuPaintDc)
{