Signed-off-by: Paul Gofman pgofman@codeweavers.com --- dlls/quartz/filesource.c | 13 ++++++++----- dlls/quartz/tests/filesource.c | 3 +++ 2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/dlls/quartz/filesource.c b/dlls/quartz/filesource.c index 3b19d6e7df..8983f7317b 100644 --- a/dlls/quartz/filesource.c +++ b/dlls/quartz/filesource.c @@ -64,6 +64,7 @@ struct async_reader LPOLESTR pszFileName; AM_MEDIA_TYPE mt; HANDLE file, port, io_thread; + LARGE_INTEGER file_size; CRITICAL_SECTION sample_cs; BOOL flushing; struct request *requests; @@ -474,6 +475,12 @@ static HRESULT WINAPI FileSource_Load(IFileSourceFilter * iface, LPCOLESTR pszFi return HRESULT_FROM_WIN32(GetLastError()); }
+ if (!GetFileSizeEx(hFile, &This->file_size)) + { + WARN("Could not get file size.\n"); + return HRESULT_FROM_WIN32(GetLastError()); + } + if (This->pszFileName) { free(This->pszFileName); @@ -883,14 +890,10 @@ static HRESULT WINAPI FileAsyncReader_SyncRead(IAsyncReader *iface, static HRESULT WINAPI FileAsyncReader_Length(IAsyncReader *iface, LONGLONG *total, LONGLONG *available) { struct async_reader *filter = impl_from_IAsyncReader(iface); - DWORD low, high;
TRACE("iface %p, total %p, available %p.\n", iface, total, available);
- if ((low = GetFileSize(filter->file, &high)) == -1 && GetLastError() != NO_ERROR) - return HRESULT_FROM_WIN32(GetLastError()); - - *available = *total = (LONGLONG)low | (LONGLONG)high << (sizeof(DWORD) * 8); + *available = *total = filter->file_size.QuadPart;
return S_OK; } diff --git a/dlls/quartz/tests/filesource.c b/dlls/quartz/tests/filesource.c index 2040910516..87bbf1ee13 100644 --- a/dlls/quartz/tests/filesource.c +++ b/dlls/quartz/tests/filesource.c @@ -1035,6 +1035,9 @@ static void test_async_reader(void) } CloseHandle(file);
+ hr = IBaseFilter_FindPin(filter, L"Output", &pin); + ok(hr == VFW_E_NOT_FOUND, "Got unexpected hr %#x.\n", hr); + IBaseFilter_QueryInterface(filter, &IID_IFileSourceFilter, (void **)&filesource); IFileSourceFilter_Load(filesource, filename, NULL); IBaseFilter_FindPin(filter, L"Output", &pin);