static void test_COM_graph(void) { IDirectMusicGraph *dmg = (IDirectMusicGraph*)0xdeadbeef; IDirectMusicObject *dmo; IPersistStream *ps; IUnknown *unk; ULONG refcount; HRESULT hr; /* COM aggregation */ hr = CoCreateInstance(&CLSID_DirectMusicGraph, (IUnknown*)&dmg, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&dmg); ok(hr == CLASS_E_NOAGGREGATION, "DirectMusicGraph create failed: %08x, expected CLASS_E_NOAGGREGATION\n", hr); ok(!dmg, "dmg = %p\n", dmg); /* Invalid RIID */ hr = CoCreateInstance(&CLSID_DirectMusicGraph, NULL, CLSCTX_INPROC_SERVER, &IID_IClassFactory, (void**)&dmg); ok(hr == E_NOINTERFACE, "DirectMusicGraph create failed: %08x, expected E_NOINTERFACE\n", hr); /* Same refcount for all DirectMusicGraph interfaces */ hr = CoCreateInstance(&CLSID_DirectMusicGraph, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusicGraph, (void**)&dmg); ok(hr == S_OK, "DirectMusicGraph create failed: %08x, expected S_OK\n", hr); refcount = IDirectMusicGraph_AddRef(dmg); ok(refcount == 2, "refcount == %u, expected 2\n", refcount); hr = IDirectMusicGraph_QueryInterface(dmg, &IID_IDirectMusicObject, (void**)&dmo); if (hr == E_NOINTERFACE) { win_skip("DirectMusicGraph without IDirectMusicObject\n"); return; } ok(hr == S_OK, "QueryInterface for IID_IDirectMusicObject failed: %08x\n", hr); refcount = IDirectMusicObject_AddRef(dmo); ok(refcount == 4, "refcount == %u, expected 4\n", refcount); refcount = IDirectMusicObject_Release(dmo); hr = IDirectMusicGraph_QueryInterface(dmg, &IID_IPersistStream, (void**)&ps); ok(hr == S_OK, "QueryInterface for IID_IPersistStream failed: %08x\n", hr); refcount = IPersistStream_AddRef(ps); ok(refcount == 5, "refcount == %u, expected 5\n", refcount); refcount = IPersistStream_Release(ps); hr = IDirectMusicGraph_QueryInterface(dmg, &IID_IUnknown, (void**)&unk); ok(hr == S_OK, "QueryInterface for IID_IUnknown failed: %08x\n", hr); refcount = IUnknown_AddRef(unk); ok(refcount == 6, "refcount == %u, expected 6\n", refcount); refcount = IUnknown_Release(unk); while (IDirectMusicGraph_Release(dmg)); }
static HRESULT WINAPI IDirectMusicPerformance8Impl_SetGraph (LPDIRECTMUSICPERFORMANCE8 iface, IDirectMusicGraph* pGraph) { IDirectMusicPerformance8Impl *This = (IDirectMusicPerformance8Impl *)iface; FIXME("(%p, %p): to check\n", This, pGraph); if (NULL != This->pToolGraph) { /* Todo clean buffers and tools before */ IDirectMusicGraph_Release(This->pToolGraph); } This->pToolGraph = pGraph; if (NULL != This->pToolGraph) { IDirectMusicGraph_AddRef(This->pToolGraph); } return S_OK; }
static HRESULT WINAPI IDirectMusicPerformance8Impl_SetGraph(IDirectMusicPerformance8 *iface, IDirectMusicGraph *pGraph) { IDirectMusicPerformance8Impl *This = impl_from_IDirectMusicPerformance8(iface); FIXME("(%p, %p): to check\n", This, pGraph); if (NULL != This->pToolGraph) { /* Todo clean buffers and tools before */ IDirectMusicGraph_Release(This->pToolGraph); } This->pToolGraph = pGraph; if (NULL != This->pToolGraph) { IDirectMusicGraph_AddRef(This->pToolGraph); } return S_OK; }
static HRESULT WINAPI IDirectMusicAudioPathImpl_IDirectMusicAudioPath_GetObjectInPath (LPDIRECTMUSICAUDIOPATH iface, DWORD dwPChannel, DWORD dwStage, DWORD dwBuffer, REFGUID guidObject, WORD dwIndex, REFGUID iidInterface, void** ppObject) { ICOM_THIS_MULTI(IDirectMusicAudioPathImpl, AudioPathVtbl, iface); FIXME("(%p, %d, %d, %d, %s, %d, %s, %p): stub\n", This, dwPChannel, dwStage, dwBuffer, debugstr_dmguid(guidObject), dwIndex, debugstr_dmguid(iidInterface), ppObject); switch (dwStage) { case DMUS_PATH_BUFFER: { 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"); } } break; case DMUS_PATH_PRIMARY_BUFFER: { if (IsEqualIID (iidInterface, &IID_IDirectSound3DListener)) { IDirectSoundBuffer8_QueryInterface (This->pPrimary, &IID_IDirectSound3DListener, ppObject); return S_OK; } else { FIXME("bad iid...\n"); } } break; case DMUS_PATH_AUDIOPATH_GRAPH: { if (IsEqualIID (iidInterface, &IID_IDirectMusicGraph)) { if (NULL == This->pToolGraph) { IDirectMusicGraphImpl* pGraph; DMUSIC_CreateDirectMusicGraphImpl (&IID_IDirectMusicGraph, (LPVOID*)&pGraph, NULL); This->pToolGraph = (IDirectMusicGraph*) pGraph; } *ppObject = This->pToolGraph; IDirectMusicGraph_AddRef((LPDIRECTMUSICGRAPH) *ppObject); return S_OK; } } break; case DMUS_PATH_AUDIOPATH_TOOL: { /* TODO */ } break; case DMUS_PATH_PERFORMANCE: { /* TODO check wanted GUID */ *ppObject = This->pPerf; IUnknown_AddRef((LPUNKNOWN) *ppObject); return S_OK; } break; case DMUS_PATH_PERFORMANCE_GRAPH: { IDirectMusicGraph* pPerfoGraph = NULL; IDirectMusicPerformance8_GetGraph(This->pPerf, &pPerfoGraph); if (NULL == pPerfoGraph) { IDirectMusicGraphImpl* pGraph = NULL; DMUSIC_CreateDirectMusicGraphImpl (&IID_IDirectMusicGraph, (LPVOID*)&pGraph, NULL); IDirectMusicPerformance8_SetGraph(This->pPerf, (IDirectMusicGraph*) pGraph); /* we need release as SetGraph do an AddRef */ IDirectMusicGraph_Release((LPDIRECTMUSICGRAPH) pGraph); pPerfoGraph = (LPDIRECTMUSICGRAPH) pGraph; } *ppObject = pPerfoGraph; return S_OK; } break; case DMUS_PATH_PERFORMANCE_TOOL: default: break; } *ppObject = NULL; return E_INVALIDARG; }