[PATCH 05/11] mfplat: Implement IMFByteStream::GetLength for files.

Derek Lesho dlesho at codeweavers.com
Tue Feb 4 11:17:16 CST 2020


Signed-off-by: Derek Lesho <dlesho at codeweavers.com>
---
 dlls/mfplat/main.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c
index c8beeda973..21d415b79f 100644
--- a/dlls/mfplat/main.c
+++ b/dlls/mfplat/main.c
@@ -3316,13 +3316,6 @@ static HRESULT WINAPI bytestream_GetCapabilities(IMFByteStream *iface, DWORD *ca
     return S_OK;
 }
 
-static HRESULT WINAPI mfbytestream_GetLength(IMFByteStream *iface, QWORD *length)
-{
-    FIXME("%p, %p.\n", iface, length);
-
-    return E_NOTIMPL;
-}
-
 static HRESULT WINAPI mfbytestream_SetLength(IMFByteStream *iface, QWORD length)
 {
     mfbytestream *This = impl_from_IMFByteStream(iface);
@@ -3341,13 +3334,17 @@ static HRESULT WINAPI mfbytestream_GetCurrentPosition(IMFByteStream *iface, QWOR
     return E_NOTIMPL;
 }
 
-static HRESULT WINAPI mfbytestream_SetCurrentPosition(IMFByteStream *iface, QWORD position)
+static HRESULT WINAPI bytestream_file_GetLength(IMFByteStream *iface, QWORD *length)
 {
-    mfbytestream *This = impl_from_IMFByteStream(iface);
+    struct bytestream *stream = impl_from_IMFByteStream(iface);
+    LARGE_INTEGER li;
 
-    FIXME("%p, %s\n", This, wine_dbgstr_longlong(position));
+    if (GetFileSizeEx(stream->hfile, &li))
+        *length = li.QuadPart;
+    else
+        return HRESULT_FROM_WIN32(GetLastError());
 
-    return E_NOTIMPL;
+    return S_OK;
 }
 
 static HRESULT WINAPI bytestream_file_IsEndOfStream(IMFByteStream *iface, BOOL *ret)
@@ -3478,7 +3475,7 @@ static const IMFByteStreamVtbl bytestream_file_vtbl =
     bytestream_AddRef,
     bytestream_Release,
     bytestream_GetCapabilities,
-    mfbytestream_GetLength,
+    bytestream_file_GetLength,
     mfbytestream_SetLength,
     mfbytestream_GetCurrentPosition,
     mfbytestream_SetCurrentPosition,
-- 
2.25.0




More information about the wine-devel mailing list