amstream: Check filename pointer in IAMMultiMediaStreamImpl_OpenFile.

This commit is contained in:
Christian Costa 2012-10-12 07:15:58 +02:00 committed by Alexandre Julliard
parent 9bdf981718
commit 7272256a60
2 changed files with 10 additions and 3 deletions

View File

@ -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);

View File

@ -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)