Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/mfplat/tests/mfplat.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 541459c715b..1b51cd73dc3 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -1947,8 +1947,10 @@ static void test_file_stream(void) WCHAR pathW[MAX_PATH]; DWORD caps, count; WCHAR *filename; + BYTE data[8]; HRESULT hr; WCHAR *str; + ULONG size; BOOL eos;
filename = load_resource(L"test.mp4"); @@ -2023,6 +2025,31 @@ static void test_file_stream(void) ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(position == 2 * bytestream_length, "Unexpected position.\n");
+ hr = IMFByteStream_IsEndOfStream(bytestream, &eos); + ok(hr == S_OK, "Failed query end of stream, hr %#x.\n", hr); + ok(eos == TRUE, "Unexpected IsEndOfStream result, %u.\n", eos); + + size = 0xdeadbeef; + hr = IMFByteStream_Read(bytestream, data, sizeof(data), &size); + todo_wine ok(hr == HRESULT_FROM_WIN32(ERROR_HANDLE_EOF), "Unexpected hr %#x.\n", hr); + todo_wine ok(size == 0xdeadbeef, "Got size %u.\n", size); + + hr = IMFByteStream_SetCurrentPosition(bytestream, bytestream_length - 4); + ok(hr == S_OK, "Failed to set bytestream position, hr %#x.\n", hr); + + size = 0xdeadbeef; + hr = IMFByteStream_Read(bytestream, data, sizeof(data), &size); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(size == 4, "Got size %u.\n", size); + + hr = IMFByteStream_SetCurrentPosition(bytestream, bytestream_length); + ok(hr == S_OK, "Failed to set bytestream position, hr %#x.\n", hr); + + size = 0xdeadbeef; + hr = IMFByteStream_Read(bytestream, data, sizeof(data), &size); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(!size, "Got size %u.\n", size); + hr = MFCreateFile(MF_ACCESSMODE_READ, MF_OPENMODE_FAIL_IF_NOT_EXIST, MF_FILEFLAGS_NONE, filename, &bytestream2); ok(hr == S_OK, "got 0x%08x\n", hr);
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/mfplat/main.c | 14 +++++++++++++- dlls/mfplat/tests/mfplat.c | 4 ++-- 2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index 7fd713261fc..be063fa1e55 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -3843,7 +3843,7 @@ static HRESULT WINAPI bytestream_file_IsEndOfStream(IMFByteStream *iface, BOOL * static HRESULT WINAPI bytestream_file_Read(IMFByteStream *iface, BYTE *buffer, ULONG size, ULONG *read_len) { struct bytestream *stream = impl_from_IMFByteStream(iface); - LARGE_INTEGER position; + LARGE_INTEGER position, file_size; HRESULT hr = S_OK; BOOL ret;
@@ -3851,6 +3851,18 @@ static HRESULT WINAPI bytestream_file_Read(IMFByteStream *iface, BYTE *buffer, U
EnterCriticalSection(&stream->cs);
+ if (!GetFileSizeEx(stream->hfile, &file_size)) + { + LeaveCriticalSection(&stream->cs); + return HRESULT_FROM_WIN32(GetLastError()); + } + + if (stream->position > file_size.QuadPart) + { + LeaveCriticalSection(&stream->cs); + return HRESULT_FROM_WIN32(ERROR_HANDLE_EOF); + } + position.QuadPart = stream->position; if ((ret = SetFilePointerEx(stream->hfile, position, NULL, FILE_BEGIN))) { diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 1b51cd73dc3..84b35386463 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -2031,8 +2031,8 @@ static void test_file_stream(void)
size = 0xdeadbeef; hr = IMFByteStream_Read(bytestream, data, sizeof(data), &size); - todo_wine ok(hr == HRESULT_FROM_WIN32(ERROR_HANDLE_EOF), "Unexpected hr %#x.\n", hr); - todo_wine ok(size == 0xdeadbeef, "Got size %u.\n", size); + ok(hr == HRESULT_FROM_WIN32(ERROR_HANDLE_EOF), "Unexpected hr %#x.\n", hr); + ok(size == 0xdeadbeef, "Got size %u.\n", size);
hr = IMFByteStream_SetCurrentPosition(bytestream, bytestream_length - 4); ok(hr == S_OK, "Failed to set bytestream position, hr %#x.\n", hr);
Hi,
While running your changed tests, 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=99461
Your paranoid android.
=== w8 (32 bit report) ===
mfplat: mfplat.c:2034: Test failed: Unexpected hr 0. mfplat.c:2035: Test failed: Got size 0.
=== w8adm (32 bit report) ===
mfplat: mfplat.c:2034: Test failed: Unexpected hr 0. mfplat.c:2035: Test failed: Got size 0.
=== w864 (32 bit report) ===
mfplat: mfplat.c:2034: Test failed: Unexpected hr 0. mfplat.c:2035: Test failed: Got size 0.
=== w1064v1507 (32 bit report) ===
mfplat: mfplat.c:2035: Test failed: Got size 0.
=== w1064v1809 (32 bit report) ===
mfplat: mfplat.c:2035: Test failed: Got size 0.
=== w1064 (32 bit report) ===
mfplat: mfplat.c:2035: Test failed: Got size 0.
=== w1064_tsign (32 bit report) ===
mfplat: mfplat.c:2035: Test failed: Got size 0.
=== w10pro64 (32 bit report) ===
mfplat: mfplat.c:2035: Test failed: Got size 0.
=== w864 (64 bit report) ===
mfplat: mfplat.c:2034: Test failed: Unexpected hr 0. mfplat.c:2035: Test failed: Got size 0.
=== w1064v1507 (64 bit report) ===
mfplat: mfplat.c:2035: Test failed: Got size 0.
=== w1064v1809 (64 bit report) ===
mfplat: mfplat.c:2035: Test failed: Got size 0.
=== w1064 (64 bit report) ===
mfplat: mfplat.c:2035: Test failed: Got size 0.
=== w1064_2qxl (64 bit report) ===
mfplat: mfplat.c:2035: Test failed: Got size 0.
=== w1064_tsign (64 bit report) ===
mfplat: mfplat.c:2035: Test failed: Got size 0.
=== w10pro64 (64 bit report) ===
mfplat: mfplat.c:2035: Test failed: Got size 0.
=== w10pro64_ar (64 bit report) ===
mfplat: mfplat.c:2035: Test failed: Got size 0.
=== w10pro64_he (64 bit report) ===
mfplat: mfplat.c:2035: Test failed: Got size 0.
=== w10pro64_ja (64 bit report) ===
mfplat: mfplat.c:2035: Test failed: Got size 0.
=== w10pro64_zh_CN (64 bit report) ===
mfplat: mfplat.c:2035: Test failed: Got size 0.
Hi,
While running your changed tests, 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=99460
Your paranoid android.
=== w8 (32 bit report) ===
mfplat: mfplat.c:2034: Test failed: Unexpected hr 0. mfplat.c:2035: Test failed: Got size 0.
=== w8adm (32 bit report) ===
mfplat: mfplat.c:2034: Test failed: Unexpected hr 0. mfplat.c:2035: Test failed: Got size 0.
=== w864 (32 bit report) ===
mfplat: mfplat.c:2034: Test failed: Unexpected hr 0. mfplat.c:2035: Test failed: Got size 0.
=== w1064v1507 (32 bit report) ===
mfplat: mfplat.c:2035: Test failed: Got size 0.
=== w1064v1809 (32 bit report) ===
mfplat: mfplat.c:2035: Test failed: Got size 0.
=== w1064 (32 bit report) ===
mfplat: mfplat.c:2035: Test failed: Got size 0.
=== w1064_tsign (32 bit report) ===
mfplat: mfplat.c:2035: Test failed: Got size 0.
=== w10pro64 (32 bit report) ===
mfplat: mfplat.c:2035: Test failed: Got size 0.
=== w864 (64 bit report) ===
mfplat: mfplat.c:2034: Test failed: Unexpected hr 0. mfplat.c:2035: Test failed: Got size 0.
=== w1064v1507 (64 bit report) ===
mfplat: mfplat.c:2035: Test failed: Got size 0.
=== w1064v1809 (64 bit report) ===
mfplat: mfplat.c:2035: Test failed: Got size 0.
=== w1064 (64 bit report) ===
mfplat: mfplat.c:2035: Test failed: Got size 0.
=== w1064_2qxl (64 bit report) ===
mfplat: mfplat.c:2035: Test failed: Got size 0.
=== w1064_tsign (64 bit report) ===
mfplat: mfplat.c:2035: Test failed: Got size 0.
=== w10pro64 (64 bit report) ===
mfplat: mfplat.c:2035: Test failed: Got size 0.
=== w10pro64_ar (64 bit report) ===
mfplat: mfplat.c:2035: Test failed: Got size 0.
=== w10pro64_he (64 bit report) ===
mfplat: mfplat.c:2035: Test failed: Got size 0.
=== w10pro64_ja (64 bit report) ===
mfplat: mfplat.c:2035: Test failed: Got size 0.
=== w10pro64_zh_CN (64 bit report) ===
mfplat: mfplat.c:2035: Test failed: Got size 0.