From: Rémi Bernon rbernon@codeweavers.com
--- dlls/dmime/performance.c | 33 +++++++++++++++++++++++++++++++-- dlls/dmime/tests/dmime.c | 34 +++++++++++++++++----------------- 2 files changed, 48 insertions(+), 19 deletions(-)
diff --git a/dlls/dmime/performance.c b/dlls/dmime/performance.c index 4085f70cc77..904008954a2 100644 --- a/dlls/dmime/performance.c +++ b/dlls/dmime/performance.c @@ -1293,8 +1293,37 @@ static ULONG WINAPI performance_graph_Release(IDirectMusicGraph *iface) static HRESULT WINAPI performance_graph_StampPMsg(IDirectMusicGraph *iface, DMUS_PMSG *msg) { struct performance *This = impl_from_IDirectMusicGraph(iface); - FIXME("(%p, %p): stub\n", This, msg); - return E_NOTIMPL; + HRESULT hr; + + TRACE("(%p, %p)\n", This, msg); + + if (!msg) return E_POINTER; + + /* FIXME: Implement segment and audio path graphs support */ + if (!This->pToolGraph) hr = DMUS_S_LAST_TOOL; + else if (FAILED(hr = IDirectMusicGraph_StampPMsg(This->pToolGraph, msg))) return hr; + + if (msg->pGraph) + { + IDirectMusicTool_Release(msg->pGraph); + msg->pGraph = NULL; + } + + if (hr == DMUS_S_LAST_TOOL) + { + if (msg->pTool) IDirectMusicTool_Release(msg->pTool); + msg->pTool = &This->IDirectMusicTool_iface; + IDirectMusicTool_AddRef(msg->pTool); + return S_OK; + } + + if (SUCCEEDED(hr)) + { + msg->pGraph = &This->IDirectMusicGraph_iface; + IDirectMusicTool_AddRef(msg->pGraph); + } + + return hr; }
static HRESULT WINAPI performance_graph_InsertTool(IDirectMusicGraph *iface, IDirectMusicTool *tool, diff --git a/dlls/dmime/tests/dmime.c b/dlls/dmime/tests/dmime.c index c9c613a40c5..17f11daf5ac 100644 --- a/dlls/dmime/tests/dmime.c +++ b/dlls/dmime/tests/dmime.c @@ -1544,13 +1544,13 @@ static void test_performance_graph(void)
/* test IDirectMusicGraph_StampPMsg usage */ hr = IDirectMusicGraph_StampPMsg(graph, NULL); - todo_wine ok(hr == E_POINTER, "got %#lx\n", hr); + ok(hr == E_POINTER, "got %#lx\n", hr); memset(&msg, 0, sizeof(msg)); hr = IDirectMusicGraph_StampPMsg(graph, &msg); - todo_wine ok(hr == S_OK, "got %#lx\n", hr); + ok(hr == S_OK, "got %#lx\n", hr); ok(msg.pGraph == NULL, "got %p\n", msg.pGraph); - todo_wine ok(msg.pTool != NULL, "got %p\n", msg.pTool); - if (msg.pTool) check_interface(msg.pTool, &IID_IDirectMusicPerformance, TRUE); + ok(msg.pTool != NULL, "got %p\n", msg.pTool); + check_interface(msg.pTool, &IID_IDirectMusicPerformance, TRUE);
ok(!msg.dwSize, "got %ld\n", msg.dwSize); ok(!msg.rtTime, "got %I64d\n", msg.rtTime); @@ -1564,12 +1564,12 @@ static void test_performance_graph(void) ok(!msg.punkUser, "got %p\n", msg.punkUser);
hr = IDirectMusicGraph_StampPMsg(graph, &msg); - todo_wine ok(hr == S_OK, "got %#lx\n", hr); + ok(hr == S_OK, "got %#lx\n", hr); ok(msg.pGraph == NULL, "got %p\n", msg.pGraph); - todo_wine ok(msg.pTool != NULL, "got %p\n", msg.pTool); - if (msg.pTool) check_interface(msg.pTool, &IID_IDirectMusicPerformance, TRUE); + ok(msg.pTool != NULL, "got %p\n", msg.pTool); + check_interface(msg.pTool, &IID_IDirectMusicPerformance, TRUE);
- if (msg.pTool) IDirectMusicTool_Release(msg.pTool); + IDirectMusicTool_Release(msg.pTool); msg.pTool = NULL;
IDirectMusicGraph_Release(graph); @@ -1604,9 +1604,9 @@ static void test_performance_graph(void)
memset(&msg, 0, sizeof(msg)); hr = IDirectMusicGraph_StampPMsg(graph, &msg); - todo_wine ok(hr == S_OK, "got %#lx\n", hr); - todo_wine ok(msg.pGraph == graph, "got %p\n", msg.pGraph); - todo_wine ok(msg.pTool == tool, "got %p\n", msg.pTool); + ok(hr == S_OK, "got %#lx\n", hr); + ok(msg.pGraph == graph, "got %p\n", msg.pGraph); + ok(msg.pTool == tool, "got %p\n", msg.pTool);
ok(!msg.dwSize, "got %ld\n", msg.dwSize); ok(!msg.rtTime, "got %I64d\n", msg.rtTime); @@ -1620,12 +1620,12 @@ static void test_performance_graph(void) ok(!msg.punkUser, "got %p\n", msg.punkUser);
hr = IDirectMusicGraph_StampPMsg(graph, &msg); - todo_wine ok(hr == S_OK, "got %#lx\n", hr); + ok(hr == S_OK, "got %#lx\n", hr); ok(msg.pGraph == NULL, "got %p\n", msg.pGraph); - todo_wine ok(msg.pTool != NULL, "got %p\n", msg.pTool); - if (msg.pTool) check_interface(msg.pTool, &IID_IDirectMusicPerformance, TRUE); + ok(msg.pTool != NULL, "got %p\n", msg.pTool); + check_interface(msg.pTool, &IID_IDirectMusicPerformance, TRUE);
- if (msg.pTool) IDirectMusicTool_Release(msg.pTool); + IDirectMusicTool_Release(msg.pTool); msg.pTool = NULL;
IDirectMusicGraph_Release(graph); @@ -1871,7 +1871,7 @@ static void test_performance_pmsg(void) hr = IDirectMusicPerformance_QueryInterface(performance, &IID_IDirectMusicGraph, (void **)&graph); ok(hr == S_OK, "got %#lx\n", hr); hr = IDirectMusicGraph_StampPMsg(graph, msg); - todo_wine ok(hr == S_OK, "got %#lx\n", hr); + ok(hr == S_OK, "got %#lx\n", hr); IDirectMusicGraph_Release(graph);
hr = IDirectMusicPerformance_SendPMsg(performance, msg); @@ -1901,7 +1901,7 @@ static void test_performance_pmsg(void) hr = IDirectMusicPerformance_QueryInterface(performance, &IID_IDirectMusicGraph, (void **)&graph); ok(hr == S_OK, "got %#lx\n", hr); hr = IDirectMusicGraph_StampPMsg(graph, msg); - todo_wine ok(hr == S_OK, "got %#lx\n", hr); + ok(hr == S_OK, "got %#lx\n", hr); IDirectMusicGraph_Release(graph);
msg->dwFlags &= ~(DMUS_PMSGF_TOOL_IMMEDIATE | DMUS_PMSGF_TOOL_QUEUE | DMUS_PMSGF_TOOL_ATTIME);