From 050efa1da29b93388f09cf40dba02f287e692da2 Mon Sep 17 00:00:00 2001 From: Magnus Olsen Date: Wed, 24 May 2006 16:54:51 +0000 Subject: [PATCH] Fixing two fail from wine gdi32 test, When HDC is NULL to NtGdiCreateDIBitmap we need create a hdc and delete the hdc when we are done. svn path=/trunk/; revision=22010 --- .../subsystems/win32/win32k/objects/dibobj.c | 40 +++++++++++++++---- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/reactos/subsystems/win32/win32k/objects/dibobj.c b/reactos/subsystems/win32/win32k/objects/dibobj.c index b870c61ecb0..b968db2aaa4 100644 --- a/reactos/subsystems/win32/win32k/objects/dibobj.c +++ b/reactos/subsystems/win32/win32k/objects/dibobj.c @@ -758,17 +758,41 @@ HBITMAP STDCALL NtGdiCreateDIBitmap(HDC hDc, const BITMAPINFOHEADER *Header, { PDC Dc; HBITMAP Bmp; - - Dc = DC_LockDc(hDc); - if (NULL == Dc) + + + if (NULL == hDc) + { + hDc = IntGdiCreateDC(NULL, NULL, NULL, NULL,FALSE); + if (hDc == NULL) + { + SetLastWin32Error(ERROR_INVALID_HANDLE); + return NULL; + } + Dc = DC_LockDc(hDc); + if (Dc == NULL) + { + NtGdiDeleteObjectApp(hDc); + SetLastWin32Error(ERROR_INVALID_HANDLE); + return NULL; + } + + Bmp = IntCreateDIBitmap(Dc, Header, Init, Bits, Data, ColorUse); + DC_UnlockDc(Dc); + NtGdiDeleteObjectApp(hDc); + } + else { - SetLastWin32Error(ERROR_INVALID_HANDLE); - return NULL; + Dc = DC_LockDc(hDc); + if (Dc == NULL) + { + SetLastWin32Error(ERROR_INVALID_HANDLE); + return NULL; + } + Bmp = IntCreateDIBitmap(Dc, Header, Init, Bits, Data, ColorUse); + DC_UnlockDc(Dc); } - Bmp = IntCreateDIBitmap(Dc, Header, Init, Bits, Data, ColorUse); - - DC_UnlockDc(Dc); + return Bmp; }