[PATCH 2/2] dsound: Fixup IDirectSoundCaptureBuffer_QueryInterface

Andrew Eikum aeikum at codeweavers.com
Mon May 16 09:55:43 CDT 2016


From: Maarten Lankhorst <wine at mblankhorst.nl>

Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
---
 dlls/dsound/capture.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/dlls/dsound/capture.c b/dlls/dsound/capture.c
index 0764261..412b59e 100644
--- a/dlls/dsound/capture.c
+++ b/dlls/dsound/capture.c
@@ -50,7 +50,7 @@ typedef struct IDirectSoundCaptureBufferImpl
     IDirectSoundCaptureBuffer8          IDirectSoundCaptureBuffer8_iface;
     IDirectSoundNotify                  IDirectSoundNotify_iface;
     LONG                                numIfaces; /* "in use interfaces" refcount */
-    LONG                                ref, refn;
+    LONG                                ref, refn, has_dsc8;
     /* IDirectSoundCaptureBuffer fields */
     DirectSoundCaptureDevice            *device;
     DSCBUFFERDESC                       *pdscbd;
@@ -240,8 +240,9 @@ static HRESULT WINAPI IDirectSoundCaptureBufferImpl_QueryInterface(IDirectSoundC
 
     *ppobj = NULL;
 
-    if ( IsEqualGUID( &IID_IDirectSoundCaptureBuffer, riid ) ||
-         IsEqualGUID( &IID_IDirectSoundCaptureBuffer8, riid ) ) {
+    if ( IsEqualIID( &IID_IUnknown, riid ) ||
+         IsEqualIID( &IID_IDirectSoundCaptureBuffer, riid ) ||
+         (This->has_dsc8 && IsEqualIID( &IID_IDirectSoundCaptureBuffer8, riid )) ) {
 	IDirectSoundCaptureBuffer8_AddRef(iface);
         *ppobj = iface;
         return S_OK;
@@ -1233,6 +1234,8 @@ static HRESULT WINAPI IDirectSoundCaptureImpl_CreateCaptureBuffer(IDirectSoundCa
 
     if (hr != DS_OK)
 	WARN("IDirectSoundCaptureBufferImpl_Create failed\n");
+    else
+        This->device->capture_buffer->has_dsc8 = This->has_dsc8;
 
     return hr;
 }
-- 
2.8.2




More information about the wine-patches mailing list