From: Jeff Smith Subject: [PATCH] user32: Delay retreival of window style in GetDCEx(). Message-Id: <20200622221602.3261466-1-whydoubt@gmail.com> Date: Mon, 22 Jun 2020 17:16:02 -0500 Signed-off-by: Jeff Smith --- dlls/gdi32/tests/dc.c | 2 ++ dlls/user32/painting.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/dlls/gdi32/tests/dc.c b/dlls/gdi32/tests/dc.c index 6640134d1f..10dd14c413 100644 --- a/dlls/gdi32/tests/dc.c +++ b/dlls/gdi32/tests/dc.c @@ -663,8 +663,10 @@ static void test_DC_bitmap(void) /* fill bitmap data with b&w pattern */ for( i = 0; i < 64; i++) bits[i] = i & 1 ? 0 : 0xffffff; + SetLastError(0xdeadbeef); hdc = GetDC(0); ok( hdc != NULL, "CreateDC rets %p\n", hdc); + ok(GetLastError() == 0xdeadbeef, "expected GetLastError() == 0xdeadbeef, got %#x\n", GetLastError()); bitspixel = GetDeviceCaps( hdc, BITSPIXEL); /* create a memory dc */ hdcmem = CreateCompatibleDC( hdc); diff --git a/dlls/user32/painting.c b/dlls/user32/painting.c index 313c5fa1e6..b7d787ae47 100644 --- a/dlls/user32/painting.c +++ b/dlls/user32/painting.c @@ -987,7 +987,7 @@ HDC WINAPI GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags ) struct dce *dce; BOOL bUpdateVisRgn = TRUE; HWND parent; - LONG window_style = GetWindowLongW( hwnd, GWL_STYLE ); + LONG window_style; if (!hwnd) hwnd = GetDesktopWindow(); else hwnd = WIN_GetFullHandle( hwnd ); @@ -996,6 +996,8 @@ HDC WINAPI GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags ) if (!IsWindow(hwnd)) return 0; + window_style = GetWindowLongW( hwnd, GWL_STYLE ); + /* fixup flags */ if (flags & (DCX_WINDOW | DCX_PARENTCLIP)) flags |= DCX_CACHE; -- 2.23.0