Commit 7272256a authored by Christian Costa's avatar Christian Costa Committed by Alexandre Julliard

amstream: Check filename pointer in IAMMultiMediaStreamImpl_OpenFile.

parent 9bdf9817
......@@ -397,7 +397,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_AddMediaStream(IAMMultiMediaStream
return hr;
}
static HRESULT WINAPI IAMMultiMediaStreamImpl_OpenFile(IAMMultiMediaStream* iface, LPCWSTR pszFileName, DWORD dwFlags)
static HRESULT WINAPI IAMMultiMediaStreamImpl_OpenFile(IAMMultiMediaStream* iface, LPCWSTR filename, DWORD flags)
{
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
HRESULT ret = S_OK;
......@@ -407,14 +407,17 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_OpenFile(IAMMultiMediaStream* ifac
PIN_DIRECTION pin_direction;
const WCHAR sourceW[] = {'S','o','u','r','c','e',0};
TRACE("(%p/%p)->(%s,%x)\n", This, iface, debugstr_w(pszFileName), dwFlags);
TRACE("(%p/%p)->(%s,%x)\n", This, iface, debugstr_w(filename), flags);
if (!filename)
return E_POINTER;
/* If Initialize was not called before, we do it here */
if (!This->pFilterGraph)
ret = IAMMultiMediaStream_Initialize(iface, STREAMTYPE_READ, 0, NULL);
if (SUCCEEDED(ret))
ret = IGraphBuilder_AddSourceFilter(This->pFilterGraph, pszFileName, sourceW, &BaseFilter);
ret = IGraphBuilder_AddSourceFilter(This->pFilterGraph, filename, sourceW, &BaseFilter);
if (SUCCEEDED(ret))
ret = IBaseFilter_EnumPins(BaseFilter, &EnumPins);
......
......@@ -412,6 +412,10 @@ static void test_media_streams(void)
}
}
/* Test open file with no filename */
hr = IAMMultiMediaStream_OpenFile(pams, NULL, 0);
ok(hr == E_POINTER, "IAMMultiMediaStream_OpenFile returned %x instead of %x\n", hr, E_POINTER);
if (video_stream)
IMediaStream_Release(video_stream);
if (audio_stream)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment