Direct Draw device enumeration

Michael Karcher michael.karcher at dpk.berlin.fido.de
Sun Jul 21 11:25:46 CDT 2002


Hello developers,

the following patch shows applications using a pre-DirectX-6 Enumeration
call the correct length of a struct DDSURFACEDESC. At the Diablo II video
test checks the length and ignores all video modes with wrong DDSURFACEDESC
length. The patch to the include file is a matter of taste, but IMHO it
should by applied.

Michael Karcher

Index: dlls/ddraw/ddraw/thunks.c
===================================================================
RCS file: /home/wine/wine/dlls/ddraw/ddraw/thunks.c,v
retrieving revision 1.9
diff -u -r1.9 thunks.c
--- dlls/ddraw/ddraw/thunks.c	3 Jul 2002 21:06:58 -0000	1.9
+++ dlls/ddraw/ddraw/thunks.c	21 Jul 2002 16:19:35 -0000
@@ -326,9 +326,13 @@
 static HRESULT CALLBACK
 EnumDisplayModesCallbackThunk(LPDDSURFACEDESC2 pDDSD2, LPVOID context)
 {
+    DDSURFACEDESC DDSD;
     struct displaymodescallback_context *cbcontext = context;
 
-    return cbcontext->func((LPDDSURFACEDESC)pDDSD2, cbcontext->context);
+    memcpy(&DDSD,pDDSD2,sizeof DDSD);
+    DDSD.dwSize = sizeof DDSD;
+
+    return cbcontext->func(&DDSD, cbcontext->context);
 }
 
 static HRESULT WINAPI
Index: include/ddraw.h
===================================================================
RCS file: /home/wine/wine/include/ddraw.h,v
retrieving revision 1.40
diff -u -r1.40 ddraw.h
--- include/ddraw.h	31 May 2002 23:06:48 -0000	1.40
+++ include/ddraw.h	21 Jul 2002 16:19:38 -0000
@@ -979,7 +979,7 @@
 
 typedef struct _DDSURFACEDESC2
 {
-	DWORD	dwSize;		/* 0: size of the DDSURFACEDESC structure*/
+	DWORD	dwSize;		/* 0: size of the DDSURFACEDESC2 structure*/
 	DWORD	dwFlags;	/* 4: determines what fields are valid*/
 	DWORD	dwHeight;	/* 8: height of surface to be created*/
 	DWORD	dwWidth;	/* C: width of input surface*/



More information about the wine-patches mailing list