1
0
mirror of https://github.com/wine-mirror/wine synced 2024-06-29 06:14:34 +00:00

gdi.exe16: Fix some incorrect usage of NtGdiDdDDICreateDCFromMemory.

This commit is contained in:
Rémi Bernon 2024-06-06 08:56:09 +02:00 committed by Alexandre Julliard
parent 3a0376f8b5
commit 7292edaf55

View File

@ -1189,10 +1189,11 @@ HDC16 WINAPI CreateDC16( LPCSTR driver, LPCSTR device, LPCSTR output,
D3DKMT_CREATEDCFROMMEMORY desc =
{
.Width = info->bmiHeader.biWidth,
.Height = info->bmiHeader.biHeight,
.Pitch = info->bmiHeader.biWidth * info->bmiHeader.biBitCount / 8,
.Height = abs( info->bmiHeader.biHeight ),
.Pitch = info->bmiHeader.biSizeImage / abs( info->bmiHeader.biHeight ),
};
struct saved_bitmap *bitmap;
UINT status;
int color;
if (info->bmiHeader.biBitCount <= 8)
@ -1230,7 +1231,14 @@ HDC16 WINAPI CreateDC16( LPCSTR driver, LPCSTR device, LPCSTR output,
desc.pMemory = &info->bmiColors[0];
}
if (NtGdiDdDDICreateDCFromMemory( &desc )) return 0;
if (!(desc.hDeviceDc = NtGdiCreateCompatibleDC( 0 ))) return 0;
if ((status = NtGdiDdDDICreateDCFromMemory( &desc )))
{
NtGdiDeleteObjectApp( desc.hDeviceDc );
ERR( "Failed to create HBITMAP over memory, status %#x\n", status );
return 0;
}
NtGdiDeleteObjectApp( desc.hDeviceDc );
if ((bitmap = HeapAlloc( GetProcessHeap(), 0, sizeof(*bitmap) )))
{