From: Zhiyi Zhang zzhang@codeweavers.com
TightVNC viewer passes the bitmap object from display DCs to GetDIBits() and expect it to succeed. So merely a bitmap handle no longer suffices. Thus create a real bitmap instead.
Fix a regression from 546cbdc.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54381 --- dlls/user32/tests/monitor.c | 3 --- dlls/win32u/dc.c | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/dlls/user32/tests/monitor.c b/dlls/user32/tests/monitor.c index ff9c6f47ed7..e93a84242c4 100644 --- a/dlls/user32/tests/monitor.c +++ b/dlls/user32/tests/monitor.c @@ -2276,9 +2276,7 @@ static void _check_display_dc(INT line, HDC hdc, const DEVMODEA *dm, BOOL allow_ /* Expect GetDIBits() to succeed */ bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); value = GetDIBits(hdc, hbmp, 0, 0, NULL, (LPBITMAPINFO)bmi, DIB_RGB_COLORS); - todo_wine ok(value, "GetDIBits failed, error %#lx.\n", GetLastError()); - todo_wine ok(bmi->bmiHeader.biCompression == BI_BITFIELDS, "Got unexpected biCompression %lu.\n", bmi->bmiHeader.biCompression);
ret = GetObjectA(hbmp, sizeof(bitmap), &bitmap); @@ -2292,7 +2290,6 @@ static void _check_display_dc(INT line, HDC hdc, const DEVMODEA *dm, BOOL allow_ todo_wine ok_(__FILE__, line)(bitmap.bmHeight == GetSystemMetrics(SM_CYVIRTUALSCREEN), "Expected bmHeight %d, got %d.\n", GetSystemMetrics(SM_CYVIRTUALSCREEN), bitmap.bmHeight); - todo_wine ok_(__FILE__, line)(bitmap.bmBitsPixel == 32, "Expected bmBitsPixel %d, got %d.\n", 32, bitmap.bmBitsPixel); ok_(__FILE__, line)(bitmap.bmWidthBytes == get_bitmap_stride(bitmap.bmWidth, bitmap.bmBitsPixel), diff --git a/dlls/win32u/dc.c b/dlls/win32u/dc.c index 2b8a56de5bd..16920e08d33 100644 --- a/dlls/win32u/dc.c +++ b/dlls/win32u/dc.c @@ -278,7 +278,7 @@ void free_dc_ptr( DC *dc ) if (dc->hBitmap) { if (dc->is_display) - NtGdiDeleteClientObj( dc->hBitmap ); + NtGdiDeleteObjectApp( dc->hBitmap ); else GDI_dec_ref_count( dc->hBitmap ); } @@ -731,7 +731,7 @@ HDC WINAPI NtGdiOpenDCW( UNICODE_STRING *device, const DEVMODEW *devmode, UNICOD hdc = dc->hSelf;
if (is_display) - dc->hBitmap = NtGdiCreateClientObj( NTGDI_OBJ_SURF ); + dc->hBitmap = NtGdiCreateCompatibleBitmap( hdc, 1, 1 ); else dc->hBitmap = GDI_inc_ref_count( GetStockObject( DEFAULT_BITMAP ));