[DSOUND] fix capture test for old version of DirectX

Robert Reif reif at earthlink.net
Thu Feb 24 06:28:21 CST 2005


Try old buffer description structure on failure with new one.
-------------- next part --------------
Index: dlls/dsound/tests/capture.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/tests/capture.c,v
retrieving revision 1.18
diff -u -p -r1.18 capture.c
--- dlls/dsound/tests/capture.c	23 Feb 2005 12:43:38 -0000	1.18
+++ dlls/dsound/tests/capture.c	24 Feb 2005 12:21:43 -0000
@@ -434,9 +434,10 @@ static BOOL WINAPI dscenum_callback(LPGU
         if (winetest_interactive)
 	    trace("  Testing the capture buffer at %s\n", format_string(&wfx));
 	rc=IDirectSoundCapture_CreateCaptureBuffer(dsco,&bufdesc,&dscbo,NULL);
-	ok(((rc==DS_OK)&&(dscbo!=NULL))||(rc==DSERR_BADFORMAT)||(rc==DSERR_ALLOCATED),
+	ok(((rc==DS_OK)&&(dscbo!=NULL))||(rc==DSERR_BADFORMAT)||
+           (rc==DSERR_ALLOCATED)||(rc==E_INVALIDARG),
            "IDirectSoundCapture_CreateCaptureBuffer() failed to create a "
-           "capture buffer: %s\n",DXGetErrorString8(rc));
+           "%s capture buffer: %s\n",format_string(&wfx),DXGetErrorString8(rc));
 	if (rc==DS_OK) {
 	    test_capture_buffer(dsco, dscbo, winetest_interactive);
 	    ref=IDirectSoundCaptureBuffer_Release(dscbo);
@@ -448,8 +449,29 @@ static BOOL WINAPI dscenum_callback(LPGU
                "capture buffer: format listed as supported but using it failed\n");
             if (!(dsccaps.dwFormats & formats[f][3]))
                 trace("  Format not supported: %s\n", format_string(&wfx));
-        } else if (rc==DSERR_ALLOCATED)
+        } else if (rc==DSERR_ALLOCATED) {
             trace("  Already In Use\n");
+        } else if (rc==E_INVALIDARG) { /* try the old version struct */
+            DSCBUFFERDESC1 bufdesc1;
+	    ZeroMemory(&bufdesc1, sizeof(bufdesc1));
+	    bufdesc1.dwSize=sizeof(bufdesc1);
+	    bufdesc1.dwFlags=0;
+	    bufdesc1.dwBufferBytes=wfx.nAvgBytesPerSec;
+	    bufdesc1.dwReserved=0;
+	    bufdesc1.lpwfxFormat=&wfx;
+	    rc=IDirectSoundCapture_CreateCaptureBuffer(dsco,
+                (DSCBUFFERDESC*)&bufdesc1,&dscbo,NULL);
+	    ok(rc==DS_OK,
+               "IDirectSoundCapture_CreateCaptureBuffer() failed to create a "
+               "%s capture buffer: %s\n",format_string(&wfx),
+               DXGetErrorString8(rc));
+            if (rc==DS_OK) {
+	        test_capture_buffer(dsco, dscbo, winetest_interactive);
+	        ref=IDirectSoundCaptureBuffer_Release(dscbo);
+	        ok(ref==0,"IDirectSoundCaptureBuffer_Release() has %d "
+                   "references, should have 0\n",ref);
+            }
+        }
     }
 
     /* try a non PCM format */


More information about the wine-patches mailing list