dsound compact fix with test

Robert Reif reif at earthlink.net
Wed Jul 28 07:01:24 CDT 2004


This is a much revised version of my previous patch.

Added error checking to IDirectSound_Compact.
Fixed IDirectSoundImpl_Create to return DSERR_NODRIVER
for a bad device IID.

Refactored common test code into subroutines.
Added tests for correct Compact behavior.
Added tests for all possible IDirectSound[8] creation modes
with good and bad arguments.
Split dsound.c and ds3d.c into separate files for IDirectSound and
IDirectSound8 interfaces and added code to not execute IDirectSound8
tests when run with a dsound.dll of version 7 or earlier.  We should
now be able to run these tests on a Windows system with DX7 or
earlier (untested).
-------------- next part --------------
diff -u wine.cvs/dlls/dsound/dsound.c wine/dlls/dsound/dsound.c
--- wine.cvs/dlls/dsound/dsound.c	2004-07-23 15:06:31.000000000 -0400
+++ wine/dlls/dsound/dsound.c	2004-07-27 19:35:18.000000000 -0400
@@ -612,6 +612,16 @@
     ICOM_THIS(IDirectSoundImpl,iface);
     TRACE("(%p)\n",This);
 
+    if (This->initialized == FALSE) {
+        WARN("not initialized\n");
+        return DSERR_UNINITIALIZED;
+    }
+
+    if (This->priolevel != DSSCL_PRIORITY) {
+        WARN("incorrect priority level\n");
+        return DSERR_PRIOLEVELNEEDED;
+    }
+
     return DS_OK;
 }
 
@@ -746,8 +756,8 @@
     }
 
     if (found == FALSE) {
-        WARN("No device found matching given ID - trying with default one !\n");
-        wod = ds_default_playback;
+        WARN("No device found matching given ID!\n");
+        return DSERR_NODRIVER;
     }
 
     /* DRV_QUERYDSOUNDIFACE is a "Wine extension" to get the DSound interface */
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dsound.tests.diff.gz
Type: application/x-gzip
Size: 14386 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20040728/9307ba60/dsound.tests.diff.bin


More information about the wine-patches mailing list