Author: greatlrd
Date: Wed May 24 20:54:51 2006
New Revision: 22010
URL:
http://svn.reactos.ru/svn/reactos?rev=22010&view=rev
Log:
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.
Modified:
trunk/reactos/subsystems/win32/win32k/objects/dibobj.c
Modified: trunk/reactos/subsystems/win32/win32k/objects/dibobj.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/dibobj.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/dibobj.c Wed May 24 20:54:51 2006
@@ -758,17 +758,41 @@
{
PDC Dc;
HBITMAP Bmp;
-
- Dc = DC_LockDc(hDc);
- if (NULL == Dc)
- {
- SetLastWin32Error(ERROR_INVALID_HANDLE);
- return NULL;
- }
-
- Bmp = IntCreateDIBitmap(Dc, Header, Init, Bits, Data, ColorUse);
-
- DC_UnlockDc(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
+ {
+ Dc = DC_LockDc(hDc);
+ if (Dc == NULL)
+ {
+ SetLastWin32Error(ERROR_INVALID_HANDLE);
+ return NULL;
+ }
+ Bmp = IntCreateDIBitmap(Dc, Header, Init, Bits, Data, ColorUse);
+ DC_UnlockDc(Dc);
+ }
+
+
return Bmp;
}