[DDraw] Fix 'EnumAttachedSurfaces' function

Lionel Ulmer lionel.ulmer at free.fr
Sun Oct 9 05:49:21 CDT 2005


Changelog:
 - pass a copy of the surface description to the application
 - increase the surface reference count when giving the surface pointer to
   the caller

           Lionel

PS: I also removed Raphael's /** really **/ comment as I checked on Windows
    that it's the real error message :-)

-- 
		 Lionel Ulmer - http://www.bbrox.org/
-------------- next part --------------
Index: dlls/ddraw/surface_main.c
===================================================================
RCS file: /home/wine/wine/dlls/ddraw/surface_main.c,v
retrieving revision 1.6
diff -u -r1.6 surface_main.c
--- dlls/ddraw/surface_main.c	7 Oct 2005 15:01:02 -0000	1.6
+++ dlls/ddraw/surface_main.c	9 Oct 2005 10:44:07 -0000
@@ -459,17 +459,28 @@
 {
     IDirectDrawSurfaceImpl *This = (IDirectDrawSurfaceImpl *)iface;
     IDirectDrawSurfaceImpl* surf;
-
+    DDSURFACEDESC2 desc;
+    
     TRACE("(%p)->(%p,%p)\n",This,context,cb);
 
     for (surf = This->attached; surf != NULL; surf = surf->next_attached)
     {
+	LPDIRECTDRAWSURFACE7 isurf = ICOM_INTERFACE(surf, IDirectDrawSurface7);
+
+	if (TRACE_ON(ddraw)) {
+	    TRACE("  => enumerating surface %p (priv. %p) with description:\n", isurf, surf);
+	    DDRAW_dump_surface_desc(&surf->surface_desc);
+	}
+
+	IDirectDrawSurface7_AddRef(isurf);
+	desc = surf->surface_desc;
 	/* check: != DDENUMRET_OK or == DDENUMRET_CANCEL? */
-	if (cb(ICOM_INTERFACE(surf, IDirectDrawSurface7), &surf->surface_desc,
-	       context) == DDENUMRET_CANCEL)
+	if (cb(isurf, &desc, context) == DDENUMRET_CANCEL)
 	    break;
     }
 
+    TRACE(" end of enumeration.\n");
+    
     return DD_OK;
 }
 
@@ -1097,7 +1108,7 @@
         return DDERR_INVALIDPARAMS;
     }
     if (NULL == pDDSD) {
-        return DDERR_INVALIDPARAMS; /** really ? */
+        return DDERR_INVALIDPARAMS;
     }
 
     /* If the surface is already locked, return busy */


More information about the wine-patches mailing list