Silence some gdi warnings.

Rein Klazes wijn at wanadoo.nl
Thu May 5 04:52:25 CDT 2005


Hi,

Calling CreateCompatibleDc with NULL argument or the HDC from a memory
DC causes huge amounts of "GDI_GetObjPtr Invalid handle" warnings with
some programs.

Changelog:

dlls/gdi	: dc.c

In CreateCompatibleDC do not generate GDI_GetObjPtr warnings if the hdc
is NULL or handle of a memory DC.

Rein.
-------------- next part --------------
--- wine/dlls/gdi/dc.c	2005-04-14 20:24:55.000000000 +0200
+++ mywine/dlls/gdi/dc.c	2005-04-27 11:24:39.000000000 +0200
@@ -716,7 +716,8 @@ HDC WINAPI CreateCompatibleDC( HDC hdc )
 
     GDI_CheckNotLock();
 
-    if ((origDC = GDI_GetObjPtr( hdc, DC_MAGIC )))
+    origDC = hdc ? GDI_GetObjPtr( hdc, MAGIC_DONTCARE ) : NULL;
+    if ( origDC && ( GDIMAGIC(origDC->header.wMagic) == DC_MAGIC))
     {
         funcs = origDC->funcs;
         physDev = origDC->physDev;
@@ -726,6 +727,7 @@ HDC WINAPI CreateCompatibleDC( HDC hdc )
     else
     {
         static const WCHAR displayW[] = { 'd','i','s','p','l','a','y',0 };
+        if( origDC) GDI_ReleaseObj( hdc );
         funcs = DRIVER_load_driver( displayW );
         physDev = NULL;
     }


More information about the wine-patches mailing list