Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/amstream/multimedia.c | 6 ++++++ dlls/amstream/tests/amstream.c | 9 +++++++++ 2 files changed, 15 insertions(+)
diff --git a/dlls/amstream/multimedia.c b/dlls/amstream/multimedia.c index 9ca38d9fa4..e62c930a39 100644 --- a/dlls/amstream/multimedia.c +++ b/dlls/amstream/multimedia.c @@ -244,6 +244,12 @@ static HRESULT WINAPI multimedia_stream_Initialize(IAMMultiMediaStream *iface,
TRACE("mmstream %p, type %u, flags %#x, graph %p.\n", mmstream, type, flags, graph);
+ if (graph && mmstream->graph) + { + WARN("Graph already initialized, returning E_INVALIDARG.\n"); + return E_INVALIDARG; + } + if (graph && FAILED(hr = create_graph(mmstream, graph))) return hr;
diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index 3555eff970..e2c00ebc3a 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -1646,6 +1646,15 @@ static void test_initialize(void) ok(hr == S_OK, "Got hr %#x.\n", hr); ok(!got_add_filter, "Got %d calls to IGraphBuilder::AddFilter().\n", got_add_filter);
+ hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_READ, 0, (IGraphBuilder *)&graph); + ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr); + hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_READ, 0, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_WRITE, 0, NULL); + todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr); + hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_TRANSFORM, 0, NULL); + todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr); + IMediaStreamFilter_Release(filter); ref = IAMMultiMediaStream_Release(mmstream); ok(!ref, "Got outstanding refcount %d.\n", ref);