win32u: Create a real bitmap object for display DCs.

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
This commit is contained in:
Zhiyi Zhang 2023-12-19 11:12:56 +08:00 committed by Alexandre Julliard
parent a47e2a5e1f
commit 1922902041
2 changed files with 2 additions and 5 deletions

View file

@ -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),

View file

@ -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 ));