Nikolay Sivov : mfplat: Implement IsEndOfStream() for file stream.
Alexandre Julliard
julliard at winehq.org
Mon May 6 15:38:49 CDT 2019
Module: wine
Branch: master
Commit: 52f374ad50b1ab9431c0ef7f913afc283a389827
URL: https://source.winehq.org/git/wine.git/?a=commit;h=52f374ad50b1ab9431c0ef7f913afc283a389827
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Mon May 6 13:52:18 2019 +0300
mfplat: Implement IsEndOfStream() for file stream.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/mfplat/main.c | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c
index 0e21497..61521ce 100644
--- a/dlls/mfplat/main.c
+++ b/dlls/mfplat/main.c
@@ -2648,16 +2648,25 @@ static HRESULT WINAPI mfbytestream_SetCurrentPosition(IMFByteStream *iface, QWOR
return E_NOTIMPL;
}
-static HRESULT WINAPI mfbytestream_IsEndOfStream(IMFByteStream *iface, BOOL *endstream)
+static HRESULT WINAPI bytestream_file_IsEndOfStream(IMFByteStream *iface, BOOL *ret)
{
- mfbytestream *This = impl_from_IMFByteStream(iface);
+ struct bytestream *stream = impl_from_IMFByteStream(iface);
+ LARGE_INTEGER position, length;
+ HRESULT hr = S_OK;
- FIXME("%p, %p\n", This, endstream);
+ TRACE("%p, %p.\n", iface, ret);
- if(endstream)
- *endstream = TRUE;
+ EnterCriticalSection(&stream->cs);
- return S_OK;
+ position.QuadPart = 0;
+ if (SetFilePointerEx(stream->hfile, position, &length, FILE_END))
+ *ret = stream->position >= length.QuadPart;
+ else
+ hr = HRESULT_FROM_WIN32(GetLastError());
+
+ LeaveCriticalSection(&stream->cs);
+
+ return hr;
}
static HRESULT WINAPI bytestream_file_Read(IMFByteStream *iface, BYTE *buffer, ULONG size, ULONG *read_len)
@@ -2771,7 +2780,7 @@ static const IMFByteStreamVtbl bytestream_file_vtbl =
mfbytestream_SetLength,
mfbytestream_GetCurrentPosition,
mfbytestream_SetCurrentPosition,
- mfbytestream_IsEndOfStream,
+ bytestream_file_IsEndOfStream,
bytestream_file_Read,
bytestream_BeginRead,
bytestream_EndRead,
More information about the wine-cvs
mailing list