Nikolay Sivov : mfplat: Implement Write() for file streams.
Alexandre Julliard
julliard at winehq.org
Mon Aug 15 15:22:31 CDT 2022
Module: wine
Branch: master
Commit: 6b418e82130dc53dd4769b2b9d735ef838b165b9
URL: https://gitlab.winehq.org/wine/wine/-/commit/6b418e82130dc53dd4769b2b9d735ef838b165b9
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Mon Aug 15 11:21:06 2022 +0300
mfplat: Implement Write() for file streams.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
dlls/mfplat/main.c | 25 ++++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c
index 1afec10405b..ebab4ed6f1f 100644
--- a/dlls/mfplat/main.c
+++ b/dlls/mfplat/main.c
@@ -4089,11 +4089,30 @@ static HRESULT WINAPI bytestream_EndRead(IMFByteStream *iface, IMFAsyncResult *r
return bytestream_complete_io_request(stream, ASYNC_STREAM_OP_READ, result, byte_read);
}
-static HRESULT WINAPI bytestream_file_Write(IMFByteStream *iface, const BYTE *data, ULONG count, ULONG *written)
+static HRESULT WINAPI bytestream_file_Write(IMFByteStream *iface, const BYTE *data, ULONG size, ULONG *written)
{
- FIXME("%p, %p, %lu, %p\n", iface, data, count, written);
+ struct bytestream *stream = impl_from_IMFByteStream(iface);
+ LARGE_INTEGER position;
+ HRESULT hr = S_OK;
+ BOOL ret;
- return E_NOTIMPL;
+ TRACE("%p, %p, %lu, %p\n", iface, data, size, written);
+
+ EnterCriticalSection(&stream->cs);
+
+ position.QuadPart = stream->position;
+ if ((ret = SetFilePointerEx(stream->hfile, position, NULL, FILE_BEGIN)))
+ {
+ if ((ret = WriteFile(stream->hfile, data, size, written, NULL)))
+ stream->position += *written;
+ }
+
+ if (!ret)
+ hr = HRESULT_FROM_WIN32(GetLastError());
+
+ LeaveCriticalSection(&stream->cs);
+
+ return hr;
}
static HRESULT WINAPI bytestream_BeginWrite(IMFByteStream *iface, const BYTE *data, ULONG size,
More information about the wine-cvs
mailing list