Module: wine Branch: master Commit: f62a891385f3f58925787283254171f2a25e215d URL: http://source.winehq.org/git/wine.git/?a=commit;h=f62a891385f3f5892578728325...
Author: Alistair Leslie-Hughes leslie_alistair@hotmail.com Date: Wed Jun 28 10:50:52 2017 +0000
dmime: Support more interfaces in IDirectMusicAudioPath.GetObjectInPath.
Signed-off-by: Alistair Leslie-Hughes leslie_alistair@hotmail.com Signed-off-by: Michael Stefaniuc mstefani@winehq.org Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/dmime/audiopath.c | 21 ++++++++++----------- dlls/dmime/tests/dmime.c | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 11 deletions(-)
diff --git a/dlls/dmime/audiopath.c b/dlls/dmime/audiopath.c index 04f0af0..cc7e4d1 100644 --- a/dlls/dmime/audiopath.c +++ b/dlls/dmime/audiopath.c @@ -137,17 +137,16 @@ static HRESULT WINAPI IDirectMusicAudioPathImpl_GetObjectInPath (IDirectMusicAud case DMUS_PATH_BUFFER: if (This->pDSBuffer) { - if (IsEqualIID (iidInterface, &IID_IDirectSoundBuffer8)) { - IDirectSoundBuffer8_QueryInterface (This->pDSBuffer, &IID_IDirectSoundBuffer8, ppObject); - TRACE("returning %p\n",*ppObject); - return S_OK; - } else if (IsEqualIID (iidInterface, &IID_IDirectSound3DBuffer)) { - IDirectSoundBuffer8_QueryInterface (This->pDSBuffer, &IID_IDirectSound3DBuffer, ppObject); - TRACE("returning %p\n",*ppObject); - return S_OK; - } else { - FIXME("Bad iid\n"); - } + if (IsEqualIID (iidInterface, &IID_IUnknown) || + IsEqualIID (iidInterface, &IID_IDirectSoundBuffer) || + IsEqualIID (iidInterface, &IID_IDirectSoundBuffer8) || + IsEqualIID (iidInterface, &IID_IDirectSound3DBuffer)) { + return IDirectSoundBuffer8_QueryInterface (This->pDSBuffer, iidInterface, ppObject); + } + + WARN("Unsupported interface %s\n", debugstr_dmguid(iidInterface)); + *ppObject = NULL; + return E_NOINTERFACE; } break;
diff --git a/dlls/dmime/tests/dmime.c b/dlls/dmime/tests/dmime.c index a154eac..62a977e 100644 --- a/dlls/dmime/tests/dmime.c +++ b/dlls/dmime/tests/dmime.c @@ -23,6 +23,7 @@ #include <wine/test.h> #include <dmusici.h> #include <audioclient.h> +#include <guiddef.h>
#define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0]))
@@ -45,8 +46,14 @@ static void test_COM_audiopath(void) IDirectMusicAudioPath *dmap; IUnknown *unk; IDirectMusicPerformance8 *performance; + IDirectSoundBuffer *dsound; + IDirectSoundBuffer8 *dsound8; + IDirectSoundNotify *notify; + IDirectSound3DBuffer *dsound3d; + IKsPropertySet *propset; ULONG refcount; HRESULT hr; + DWORD buffer = 0;
hr = CoCreateInstance(&CLSID_DirectMusicPerformance, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusicPerformance8, (void**)&performance); @@ -89,6 +96,39 @@ static void test_COM_audiopath(void) ok(refcount == 5, "refcount == %u, expected 5\n", refcount); refcount = IUnknown_Release(unk);
+ hr = IDirectMusicAudioPath_GetObjectInPath(dmap, DMUS_PCHANNEL_ALL, DMUS_PATH_BUFFER, buffer, &GUID_NULL, + 0, &IID_IDirectSoundBuffer, (void**)&dsound); + ok(hr == S_OK, "Failed: %08x\n", hr); + IDirectSoundBuffer_Release(dsound); + + hr = IDirectMusicAudioPath_GetObjectInPath(dmap, DMUS_PCHANNEL_ALL, DMUS_PATH_BUFFER, buffer, &GUID_NULL, + 0, &IID_IDirectSoundBuffer8, (void**)&dsound8); + ok(hr == S_OK, "Failed: %08x\n", hr); + IDirectSoundBuffer8_Release(dsound8); + + hr = IDirectMusicAudioPath_GetObjectInPath(dmap, DMUS_PCHANNEL_ALL, DMUS_PATH_BUFFER, buffer, &GUID_NULL, + 0, &IID_IDirectSoundNotify, (void**)¬ify); + ok(hr == E_NOINTERFACE, "Failed: %08x\n", hr); + + hr = IDirectMusicAudioPath_GetObjectInPath(dmap, DMUS_PCHANNEL_ALL, DMUS_PATH_BUFFER, buffer, &GUID_NULL, + 0, &IID_IDirectSound3DBuffer, (void**)&dsound3d); + ok(hr == E_NOINTERFACE, "Failed: %08x\n", hr); + + hr = IDirectMusicAudioPath_GetObjectInPath(dmap, DMUS_PCHANNEL_ALL, DMUS_PATH_BUFFER, buffer, &GUID_NULL, + 0, &IID_IKsPropertySet, (void**)&propset); + todo_wine ok(hr == S_OK, "Failed: %08x\n", hr); + if (propset) + IKsPropertySet_Release(propset); + + hr = IDirectMusicAudioPath_GetObjectInPath(dmap, DMUS_PCHANNEL_ALL, DMUS_PATH_BUFFER, buffer, &GUID_NULL, + 0, &IID_IUnknown, (void**)&unk); + ok(hr == S_OK, "Failed: %08x\n", hr); + IUnknown_Release(unk); + + hr = IDirectMusicAudioPath_GetObjectInPath(dmap, DMUS_PCHANNEL_ALL, DMUS_PATH_BUFFER, buffer, &GUID_NULL, + 0, &GUID_NULL, (void**)&unk); + ok(hr == E_NOINTERFACE, "Failed: %08x\n", hr); + while (IDirectMusicAudioPath_Release(dmap) > 1); /* performance has a reference too */ IDirectMusicPerformance8_CloseDown(performance); IDirectMusicPerformance8_Release(performance);