[DDraw] Fix also 'EnumSurfaces'

Lionel Ulmer lionel.ulmer at free.fr
Sun Oct 9 06:39:02 CDT 2005


Changelog:
 - do not pass private data to the application but a copy of it
 - add some more traces

-- 
		 Lionel Ulmer - http://www.bbrox.org/
-------------- next part --------------
? dlls/ddraw/FOO.txt
Index: dlls/ddraw/ddraw_main.c
===================================================================
RCS file: /home/wine/wine/dlls/ddraw/ddraw_main.c,v
retrieving revision 1.10
diff -u -r1.10 ddraw_main.c
--- dlls/ddraw/ddraw_main.c	6 Oct 2005 12:26:04 -0000	1.10
+++ dlls/ddraw/ddraw_main.c	9 Oct 2005 11:36:57 -0000
@@ -874,18 +874,23 @@
 	    || (nomatch != Main_DirectDraw_DDSD_Match(lpDDSD2,
 						      &surf->surface_desc)))
 	{
-	    LPDIRECTDRAWSURFACE7 surface = ICOM_INTERFACE(surf,
-							  IDirectDrawSurface7);
+	    LPDIRECTDRAWSURFACE7 isurf = ICOM_INTERFACE(surf, IDirectDrawSurface7);
+	    DDSURFACEDESC2 desc;
 
-	    /* BOGUS! Violates COM rules, but MSDN says so. */
-	    IDirectDrawSurface7_AddRef(surface);
+	    if (TRACE_ON(ddraw)) {
+		TRACE("  => enumerating surface %p (priv. %p) with description:\n", isurf, surf);
+		DDRAW_dump_surface_desc(&surf->surface_desc);
+	    }
 
-	    if (callback(surface, &surf->surface_desc, context)
-		== DDENUMRET_CANCEL)
+	    IDirectDrawSurface7_AddRef(isurf);
+
+	    desc = surf->surface_desc;
+	    if (callback(isurf, &desc, context)	== DDENUMRET_CANCEL)
 		break;
 	}
     }
-
+    TRACE(" end of enumeration.\n");
+    
     return DD_OK;
 }
 
@@ -921,7 +926,10 @@
     IDirectDrawImpl *This = (IDirectDrawImpl *)iface;
     TRACE("(%p)->(0x%lx, %p, %p, %p)\n", iface, dwFlags, lpDDSD2, context,
 	  callback);
-
+    if (TRACE_ON(ddraw)) {
+	TRACE(" flags: "); DDRAW_dump_DDENUMSURFACES(dwFlags);
+    }
+    
     if (callback == NULL)
 	return DDERR_INVALIDPARAMS;
 
Index: dlls/ddraw/ddraw_private.h
===================================================================
RCS file: /home/wine/wine/dlls/ddraw/ddraw_private.h,v
retrieving revision 1.49
diff -u -r1.49 ddraw_private.h
--- dlls/ddraw/ddraw_private.h	24 Jul 2005 16:17:29 -0000	1.49
+++ dlls/ddraw/ddraw_private.h	9 Oct 2005 11:36:58 -0000
@@ -415,6 +416,7 @@
 extern void DDRAW_dump_lockflag(DWORD lockflag);
 extern void DDRAW_dump_DDCOLORKEY(const DDCOLORKEY *in);
 extern void DDRAW_dump_DDCAPS(const DDCAPS *lpcaps);
+extern void DDRAW_dump_DDENUMSURFACES(DWORD flagmask);
 extern void DDRAW_dump_surface_to_disk(IDirectDrawSurfaceImpl *surface, FILE *f, int scale) ;
 
 /* Used for generic dumping */
Index: dlls/ddraw/ddraw_utils.c
===================================================================
RCS file: /home/wine/wine/dlls/ddraw/ddraw_utils.c,v
retrieving revision 1.2
diff -u -r1.2 ddraw_utils.c
--- dlls/ddraw/ddraw_utils.c	7 Oct 2005 15:01:02 -0000	1.2
+++ dlls/ddraw/ddraw_utils.c	9 Oct 2005 11:36:58 -0000
@@ -838,6 +838,19 @@
     DPRINTF(" - ddsCaps : "); DDRAW_dump_DDSCAPS2(&lpcaps->ddsCaps); DPRINTF("\n");
 }
 
+void DDRAW_dump_DDENUMSURFACES(DWORD flagmask)
+{
+    static const flag_info flags[] =
+	{
+	    FE(DDENUMSURFACES_ALL),
+	    FE(DDENUMSURFACES_MATCH),
+	    FE(DDENUMSURFACES_NOMATCH),
+	    FE(DDENUMSURFACES_CANBECREATED),
+	    FE(DDENUMSURFACES_DOESEXIST)
+	};
+    DDRAW_dump_flags(flagmask, flags, sizeof(flags)/sizeof(flags[0]));
+}
+
 /* Debug function that can be helpful to debug various surface-related problems */
 static int get_shift(DWORD color_mask) {
     int shift = 0;


More information about the wine-patches mailing list