Signed-off-by: Gijs Vermeulen gijsvrm@gmail.com --- dlls/amstream/ddrawstream.c | 14 +++++++++----- dlls/amstream/tests/amstream.c | 3 +-- 2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/dlls/amstream/ddrawstream.c b/dlls/amstream/ddrawstream.c index 15bd3af0a9..56230ca4e6 100644 --- a/dlls/amstream/ddrawstream.c +++ b/dlls/amstream/ddrawstream.c @@ -218,6 +218,13 @@ static HRESULT WINAPI ddraw_IAMMediaStream_Initialize(IAMMediaStream *iface, IUn && FAILED(hr = IUnknown_QueryInterface(source_object, &IID_IDirectDraw, (void **)&stream->ddraw))) FIXME("Stream object doesn't implement IDirectDraw interface, hr %#x.\n", hr);
+ if (!source_object) + { + if (FAILED(hr = DirectDrawCreate(NULL, &stream->ddraw, NULL))) + return hr; + IDirectDraw_SetCooperativeLevel(stream->ddraw, NULL, DDSCL_NORMAL); + } + return S_OK; }
@@ -381,13 +388,10 @@ static HRESULT WINAPI ddraw_IDirectDrawMediaStream_GetDirectDraw(IDirectDrawMedi if (!ddraw) return E_POINTER;
- *ddraw = NULL; if (!stream->ddraw) { - HRESULT hr = DirectDrawCreate(NULL, &stream->ddraw, NULL); - if (FAILED(hr)) - return hr; - IDirectDraw_SetCooperativeLevel(stream->ddraw, NULL, DDSCL_NORMAL); + *ddraw = NULL; + return S_OK; }
IDirectDraw_AddRef(stream->ddraw); diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index 3578ecc6cd..363c92fcca 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -4803,8 +4803,7 @@ static void test_ddrawstream_getsetdirectdraw(void)
hr = IDirectDrawMediaStream_GetDirectDraw(ddraw_stream, &ddraw3); ok(hr == S_OK, "Got hr %#x.\n", hr); - todo_wine ok(ddraw3 == NULL, "Expected NULL, got %p.\n", ddraw3); - if (ddraw3) IDirectDraw_Release(ddraw3); + ok(ddraw3 == NULL, "Expected NULL, got %p.\n", ddraw3);
hr = IDirectDrawMediaStream_SetDirectDraw(ddraw_stream, ddraw2); ok(hr == S_OK, "Got hr %#x.\n", hr);