[PATCH] dmime: Support more interfaces in IDirectMusicAudioPath.GetObjectInPath
Alistair Leslie-Hughes
leslie_alistair at hotmail.com
Wed Jun 28 05:50:52 CDT 2017
was: dmime: Query the Sound buffer for supported interfaces
v2: Fix compile warning.
v3: Add More tests. - Thanks michael
Restricted to only some interfaces.
Changed topic to reflect the updated patch.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
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 04f0af03d0..cc7e4d12c9 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 a154eac50b..62a977eeb7 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);
--
2.11.0
More information about the wine-patches
mailing list