From 3ec0b056d58109bd732f887d05adcceec87be376 Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Tue, 17 Jan 2012 01:54:53 +0100 Subject: [PATCH] dsound: Support IKsPropertySet in the primary buffer too. --- dlls/dsound/buffer.c | 8 ++++++-- dlls/dsound/primary.c | 7 +++++-- dlls/dsound/tests/ds3d.c | 31 +++++++++++++------------------ 3 files changed, 24 insertions(+), 22 deletions(-) diff --git a/dlls/dsound/buffer.c b/dlls/dsound/buffer.c index a1546aab4d..690d10473b 100644 --- a/dlls/dsound/buffer.c +++ b/dlls/dsound/buffer.c @@ -1159,8 +1159,12 @@ static ULONG WINAPI IKsPropertySetImpl_Release(IKsPropertySet *iface) TRACE("(%p) ref was %d\n", This, ref + 1); - if (!ref && !InterlockedDecrement(&This->numIfaces)) - secondarybuffer_destroy(This); + if (!ref && !InterlockedDecrement(&This->numIfaces)) { + if (is_primary_buffer(This)) + primarybuffer_destroy(This); + else + secondarybuffer_destroy(This); + } return ref; } diff --git a/dlls/dsound/primary.c b/dlls/dsound/primary.c index 9363a31eb1..5c74353f21 100644 --- a/dlls/dsound/primary.c +++ b/dlls/dsound/primary.c @@ -1165,8 +1165,9 @@ static HRESULT WINAPI PrimaryBufferImpl_QueryInterface(IDirectSoundBuffer *iface } if ( IsEqualGUID( &IID_IKsPropertySet, riid ) ) { - FIXME("app requested IKsPropertySet on primary buffer\n"); - return E_NOINTERFACE; + *ppobj = &This->IKsPropertySet_iface; + IKsPropertySet_AddRef(&This->IKsPropertySet_iface); + return S_OK; } FIXME( "Unknown IID %s\n", debugstr_guid( riid ) ); @@ -1220,10 +1221,12 @@ HRESULT primarybuffer_create(DirectSoundDevice *device, IDirectSoundBufferImpl * dsb->ref = 0; dsb->ref3D = 0; + dsb->refiks = 0; dsb->numIfaces = 0; dsb->device = device; dsb->IDirectSoundBuffer8_iface.lpVtbl = (IDirectSoundBuffer8Vtbl *)&dspbvt; dsb->IDirectSound3DListener_iface.lpVtbl = &ds3dlvt; + dsb->IKsPropertySet_iface.lpVtbl = &iksbvt; dsb->dsbd = *dsbd; /* IDirectSound3DListener */ diff --git a/dlls/dsound/tests/ds3d.c b/dlls/dsound/tests/ds3d.c index 3e56c8aa9e..0fbbfe87ce 100644 --- a/dlls/dsound/tests/ds3d.c +++ b/dlls/dsound/tests/ds3d.c @@ -1213,15 +1213,13 @@ static HRESULT test_primary_3d_with_listener(LPGUID lpGuid) !(dscaps.dwFlags & DSCAPS_EMULDRIVER),1.0,0, listener,0,0,FALSE,0); - todo_wine { - temp_buffer = NULL; - rc=IDirectSound3DListener_QueryInterface(listener, - &IID_IKsPropertySet,(LPVOID *)&temp_buffer); - ok(rc==DS_OK && temp_buffer!=NULL, - "IDirectSound3DListener_QueryInterface didn't handle IKsPropertySet: ret = %08x\n", rc); - if(temp_buffer) - IKsPropertySet_Release(temp_buffer); - } + temp_buffer = NULL; + rc = IDirectSound3DListener_QueryInterface(listener, &IID_IKsPropertySet, + (void **)&temp_buffer); + ok(rc==DS_OK && temp_buffer!=NULL, + "IDirectSound3DListener_QueryInterface didn't handle IKsPropertySet: ret = %08x\n", rc); + if(temp_buffer) + IKsPropertySet_Release(temp_buffer); } /* Testing the reference counting */ @@ -1230,15 +1228,12 @@ static HRESULT test_primary_3d_with_listener(LPGUID lpGuid) "references, should have 0\n",ref); } - todo_wine { - temp_buffer = NULL; - rc=IDirectSoundBuffer_QueryInterface(primary, - &IID_IKsPropertySet,(LPVOID *)&temp_buffer); - ok(rc==DS_OK && temp_buffer!=NULL, - "IDirectSoundBuffer_QueryInterface didn't handle IKsPropertySet on primary buffer: ret = %08x\n", rc); - if(temp_buffer) - IKsPropertySet_Release(temp_buffer); - } + temp_buffer = NULL; + rc = IDirectSoundBuffer_QueryInterface(primary, &IID_IKsPropertySet, (void **)&temp_buffer); + ok(rc==DS_OK && temp_buffer!=NULL, + "IDirectSoundBuffer_QueryInterface didn't handle IKsPropertySet on primary buffer: ret = %08x\n", rc); + if(temp_buffer) + IKsPropertySet_Release(temp_buffer); /* Testing the reference counting */ ref=IDirectSoundBuffer_Release(primary);