Superseded patch 157911.
Signed-off-by: Jactry Zeng jzeng@codeweavers.com --- dlls/mfplat/main.c | 25 +++++++++++++++++++++---- dlls/mfplat/tests/mfplat.c | 26 +++++++++++++------------- 2 files changed, 34 insertions(+), 17 deletions(-)
diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index 4f42fc0939..898634f153 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -981,10 +981,23 @@ static HRESULT WINAPI mfbytestream_IsEndOfStream(IMFByteStream *iface, BOOL *end static HRESULT WINAPI mfbytestream_Read(IMFByteStream *iface, BYTE *data, ULONG count, ULONG *byte_read) { mfbytestream *This = impl_from_IMFByteStream(iface); + STATSTG statstg; + QWORD length; + HRESULT hr;
- FIXME("%p, %p, %u, %p\n", This, data, count, byte_read); + TRACE("(%p)->(%p, %u, %p)\n", This, data, count, byte_read);
- return E_NOTIMPL; + memset(&statstg, 0, sizeof(statstg)); + hr = IStream_Stat(This->stream, &statstg, STATFLAG_NONAME); + if(FAILED(hr)) + return hr; + if((statstg.grfMode & 0xf) == STGM_WRITE) + return E_ACCESSDENIED; + + IMFByteStream_GetLength(iface, &length); + if(count > length) + count = length; + return IStream_Read(This->stream, data, count, byte_read); }
static HRESULT WINAPI mfbytestream_BeginRead(IMFByteStream *iface, BYTE *data, ULONG count, @@ -1009,10 +1022,14 @@ static HRESULT WINAPI mfbytestream_EndRead(IMFByteStream *iface, IMFAsyncResult static HRESULT WINAPI mfbytestream_Write(IMFByteStream *iface, const BYTE *data, ULONG count, ULONG *written) { mfbytestream *This = impl_from_IMFByteStream(iface); + HRESULT hr;
- FIXME("%p, %p, %u, %p\n", This, data, count, written); + TRACE("(%p)->(%p, %u, %p)\n", This, data, count, written);
- return E_NOTIMPL; + hr = IStream_Write(This->stream, data, count, written); + if(hr == STG_E_ACCESSDENIED) + return E_ACCESSDENIED; + return hr; }
static HRESULT WINAPI mfbytestream_BeginWrite(IMFByteStream *iface, const BYTE *data, ULONG count, diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 9d081c12c4..ac2eaa5b75 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -797,13 +797,13 @@ static void test_bytestream_from_file(void) CHECK_BS_LEN(bytestream, sizeof(asf_header)); read = 0; hr = IMFByteStream_Read(bytestream, buffer, sizeof(buffer), &read); - todo_wine ok(hr == S_OK, "IMFByteStream_Read failed: 0x%08x.\n", hr); - todo_wine ok(read == sizeof(asf_header), "got wrong read length: %d.\n", read); - todo_wine ok(!memcmp(buffer, asf_header, sizeof(asf_header)), "got wrong content.\n"); + ok(hr == S_OK, "IMFByteStream_Read failed: 0x%08x.\n", hr); + ok(read == sizeof(asf_header), "got wrong read length: %d.\n", read); + ok(!memcmp(buffer, asf_header, sizeof(asf_header)), "got wrong content.\n"); todo_wine CHECK_BS_POS(bytestream, sizeof(asf_header)); memset(buffer, 0, sizeof(buffer)); hr = IMFByteStream_Write(bytestream, asf_header, sizeof(asf_header), &written); - todo_wine ok(hr == E_ACCESSDENIED, "IMFByteStream_Write should fail: 0x%08x.\n", hr); + ok(hr == E_ACCESSDENIED, "IMFByteStream_Write should fail: 0x%08x.\n", hr); hr = IMFByteStream_SetLength(bytestream, 200); ok(hr == E_FAIL, "IMFByteStream_SetLength should fail: 0x%08x.\n", hr); todo_wine CHECK_BS_POS(bytestream, sizeof(asf_header)); @@ -814,12 +814,12 @@ static void test_bytestream_from_file(void) MF_FILEFLAGS_NONE, asffile, &bytestream); ok(hr == S_OK, "MFCreateFile failed: 0x%08x.\n", hr); hr = IMFByteStream_Read(bytestream, buffer, sizeof(buffer), &read); - todo_wine ok(hr == E_ACCESSDENIED, "IMFByteStream_Read should fail: 0x%08x.\n", hr); + ok(hr == E_ACCESSDENIED, "IMFByteStream_Read should fail: 0x%08x.\n", hr); todo_wine CHECK_BS_POS(bytestream, 0); written = 0xdeadbeef; hr = IMFByteStream_Write(bytestream, asf_header, sizeof(asf_header), &written); - todo_wine ok(hr == S_OK, "IMFByteStream_Write failed: 0x%08x.\n", hr); - todo_wine ok(written == sizeof(asf_header), "got wrong written length: %d.\n", written); + ok(hr == S_OK, "IMFByteStream_Write failed: 0x%08x.\n", hr); + ok(written == sizeof(asf_header), "got wrong written length: %d.\n", written); CHECK_BS_LEN(bytestream, sizeof(asf_header)); todo_wine CHECK_BS_POS(bytestream, sizeof(asf_header));
@@ -846,8 +846,8 @@ static void test_bytestream_from_file(void) CHECK_BS_LEN(bytestream, sizeof(asf_header) + 2); written = 0xdeadbeef; hr = IMFByteStream_Write(bytestream, test_data, sizeof(test_data), &written); - todo_wine ok(hr == S_OK, "IMFByteStream_Write failed: 0x%08x.\n", hr); - todo_wine ok(written == sizeof(test_data), "got wrong written length: %d.\n", written); + ok(hr == S_OK, "IMFByteStream_Write failed: 0x%08x.\n", hr); + ok(written == sizeof(test_data), "got wrong written length: %d.\n", written); CHECK_BS_LEN(bytestream, sizeof(asf_header) + 2); todo_wine CHECK_BS_POS(bytestream, sizeof(test_data)); IMFByteStream_Release(bytestream); @@ -898,8 +898,8 @@ static void test_bytestream_from_stream(void) CHECK_BS_LEN(bytestream, sizeof(asf_header)); hr = IMFByteStream_Read(bytestream, buffer, sizeof(buffer), &read); todo_wine ok(hr == S_FALSE, "IMFByteStream_Read returned: 0x%08x.\n", hr); - todo_wine ok(read == sizeof(asf_header), "got wrong read length: %d.\n", read); - todo_wine ok(!memcmp(buffer, asf_header, sizeof(asf_header)), "got wrong content.\n"); + ok(read == sizeof(asf_header), "got wrong read length: %d.\n", read); + ok(!memcmp(buffer, asf_header, sizeof(asf_header)), "got wrong content.\n"); todo_wine CHECK_BS_POS(bytestream, sizeof(asf_header)); memset(buffer, 0, sizeof(buffer)); todo_wine CHECK_BS_POS(bytestream, sizeof(asf_header)); @@ -922,8 +922,8 @@ static void test_bytestream_from_stream(void) todo_wine CHECK_BS_POS(bytestream, 0); written = 0xdeadbeef; hr = IMFByteStream_Write(bytestream, asf_header, sizeof(asf_header), &written); - todo_wine ok(hr == S_OK, "IMFByteStream_Write failed: 0x%08x.\n", hr); - todo_wine ok(written == sizeof(asf_header), "got wrong written length: %d.\n", written); + ok(hr == S_OK, "IMFByteStream_Write failed: 0x%08x.\n", hr); + ok(written == sizeof(asf_header), "got wrong written length: %d.\n", written); CHECK_BS_LEN(bytestream, sizeof(asf_header)); todo_wine CHECK_BS_POS(bytestream, sizeof(asf_header));
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=47259
Your paranoid android.
=== wxppro (32 bit report) ===
mfplat: mfplat: Timeout
=== wvistau64 (32 bit report) ===
mfplat: mfplat: Timeout
=== wvistau64_zh_CN (32 bit report) ===
mfplat: mfplat: Timeout
=== wvistau64_fr (32 bit report) ===
mfplat: mfplat: Timeout
=== wvistau64_he (32 bit report) ===
mfplat: mfplat: Timeout
=== wvistau64 (64 bit report) ===
mfplat: mfplat: Timeout