Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mfplat/main.c | 8 +++++--- dlls/mfplat/tests/mfplat.c | 41 +++++++++++++++----------------------- 2 files changed, 21 insertions(+), 28 deletions(-)
diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index 57bed4ac3e..6aaa29daa3 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -1971,6 +1971,7 @@ typedef struct bytestream IMFAsyncCallback read_callback; IMFAsyncCallback write_callback; IStream *stream; + HANDLE hfile; QWORD position; DWORD capabilities; struct list pending; @@ -2235,6 +2236,8 @@ static ULONG WINAPI bytestream_Release(IMFByteStream *iface) DeleteCriticalSection(&stream->cs); if (stream->stream) IStream_Release(stream->stream); + if (stream->hfile) + CloseHandle(stream->hfile); heap_free(stream); }
@@ -2820,7 +2823,7 @@ static const IMFGetServiceVtbl bytestream_file_getservice_vtbl = HRESULT WINAPI MFCreateFile(MF_FILE_ACCESSMODE accessmode, MF_FILE_OPENMODE openmode, MF_FILE_FLAGS flags, LPCWSTR url, IMFByteStream **bytestream) { - mfbytestream *object; + struct bytestream *object; DWORD fileaccessmode = 0; DWORD filesharemode = FILE_SHARE_READ; DWORD filecreation_disposition = 0; @@ -2894,6 +2897,7 @@ HRESULT WINAPI MFCreateFile(MF_FILE_ACCESSMODE accessmode, MF_FILE_OPENMODE open object->write_callback.lpVtbl = &bytestream_file_write_callback_vtbl; InitializeCriticalSection(&object->cs); list_init(&object->pending); + object->hfile = file;
if (GetFileTime(file, NULL, NULL, &writetime)) { @@ -2905,8 +2909,6 @@ HRESULT WINAPI MFCreateFile(MF_FILE_ACCESSMODE accessmode, MF_FILE_OPENMODE open
*bytestream = &object->IMFByteStream_iface;
- CloseHandle(file); - return S_OK; }
diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 6c6bfc16b6..f280a35a58 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -1187,15 +1187,11 @@ todo_wine ok(hr == S_OK, "got 0x%08x\n", hr); IMFByteStream_Release(bytestream2);
- hr = MFCreateFile(MF_ACCESSMODE_WRITE, MF_OPENMODE_FAIL_IF_NOT_EXIST, - MF_FILEFLAGS_NONE, filename, &bytestream2); - todo_wine ok(hr == HRESULT_FROM_WIN32(ERROR_SHARING_VIOLATION), "got 0x%08x\n", hr); - if (hr == S_OK) IMFByteStream_Release(bytestream2); + hr = MFCreateFile(MF_ACCESSMODE_WRITE, MF_OPENMODE_FAIL_IF_NOT_EXIST, MF_FILEFLAGS_NONE, filename, &bytestream2); + ok(hr == HRESULT_FROM_WIN32(ERROR_SHARING_VIOLATION), "Unexpected hr %#x.\n", hr);
- hr = MFCreateFile(MF_ACCESSMODE_READWRITE, MF_OPENMODE_FAIL_IF_NOT_EXIST, - MF_FILEFLAGS_NONE, filename, &bytestream2); - todo_wine ok(hr == HRESULT_FROM_WIN32(ERROR_SHARING_VIOLATION), "got 0x%08x\n", hr); - if (hr == S_OK) IMFByteStream_Release(bytestream2); + hr = MFCreateFile(MF_ACCESSMODE_READWRITE, MF_OPENMODE_FAIL_IF_NOT_EXIST, MF_FILEFLAGS_NONE, filename, &bytestream2); + ok(hr == HRESULT_FROM_WIN32(ERROR_SHARING_VIOLATION), "Unexpected hr %#x.\n", hr);
IMFByteStream_Release(bytestream);
@@ -1211,20 +1207,15 @@ todo_wine MF_FILEFLAGS_NONE, newfilename, &bytestream); ok(hr == S_OK, "got 0x%08x\n", hr);
- hr = MFCreateFile(MF_ACCESSMODE_READ, MF_OPENMODE_FAIL_IF_NOT_EXIST, - MF_FILEFLAGS_NONE, newfilename, &bytestream2); - todo_wine ok(hr == HRESULT_FROM_WIN32(ERROR_SHARING_VIOLATION), "got 0x%08x\n", hr); - if (hr == S_OK) IMFByteStream_Release(bytestream2); + hr = MFCreateFile(MF_ACCESSMODE_READ, MF_OPENMODE_FAIL_IF_NOT_EXIST, MF_FILEFLAGS_NONE, newfilename, &bytestream2); + ok(hr == HRESULT_FROM_WIN32(ERROR_SHARING_VIOLATION), "Unexpected hr %#x.\n", hr);
- hr = MFCreateFile(MF_ACCESSMODE_WRITE, MF_OPENMODE_FAIL_IF_NOT_EXIST, - MF_FILEFLAGS_NONE, newfilename, &bytestream2); - todo_wine ok(hr == HRESULT_FROM_WIN32(ERROR_SHARING_VIOLATION), "got 0x%08x\n", hr); - if (hr == S_OK) IMFByteStream_Release(bytestream2); + hr = MFCreateFile(MF_ACCESSMODE_WRITE, MF_OPENMODE_FAIL_IF_NOT_EXIST, MF_FILEFLAGS_NONE, newfilename, &bytestream2); + ok(hr == HRESULT_FROM_WIN32(ERROR_SHARING_VIOLATION), "Unexpected hr %#x.\n", hr);
- hr = MFCreateFile(MF_ACCESSMODE_WRITE, MF_OPENMODE_FAIL_IF_NOT_EXIST, - MF_FILEFLAGS_ALLOW_WRITE_SHARING, newfilename, &bytestream2); - todo_wine ok(hr == HRESULT_FROM_WIN32(ERROR_SHARING_VIOLATION), "got 0x%08x\n", hr); - if (hr == S_OK) IMFByteStream_Release(bytestream2); + hr = MFCreateFile(MF_ACCESSMODE_WRITE, MF_OPENMODE_FAIL_IF_NOT_EXIST, MF_FILEFLAGS_ALLOW_WRITE_SHARING, + newfilename, &bytestream2); + ok(hr == HRESULT_FROM_WIN32(ERROR_SHARING_VIOLATION), "Unexpected hr %#x.\n", hr);
IMFByteStream_Release(bytestream);
@@ -1233,14 +1224,14 @@ todo_wine ok(hr == S_OK, "got 0x%08x\n", hr);
/* Opening the file again fails even though MF_FILEFLAGS_ALLOW_WRITE_SHARING is set. */ - hr = MFCreateFile(MF_ACCESSMODE_WRITE, MF_OPENMODE_FAIL_IF_NOT_EXIST, - MF_FILEFLAGS_ALLOW_WRITE_SHARING, newfilename, &bytestream2); - todo_wine ok(hr == HRESULT_FROM_WIN32(ERROR_SHARING_VIOLATION), "got 0x%08x\n", hr); - if (hr == S_OK) IMFByteStream_Release(bytestream2); + hr = MFCreateFile(MF_ACCESSMODE_WRITE, MF_OPENMODE_FAIL_IF_NOT_EXIST, MF_FILEFLAGS_ALLOW_WRITE_SHARING, + newfilename, &bytestream2); + ok(hr == HRESULT_FROM_WIN32(ERROR_SHARING_VIOLATION), "Unexpected hr %#x.\n", hr);
IMFByteStream_Release(bytestream);
- MFShutdown(); + hr = MFShutdown(); + ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr);
DeleteFileW(filename); DeleteFileW(newfilename);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mfplat/main.c | 5 +++++ dlls/mfplat/tests/mfplat.c | 1 - 2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index 6aaa29daa3..83eaee9b97 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -2823,6 +2823,7 @@ static const IMFGetServiceVtbl bytestream_file_getservice_vtbl = HRESULT WINAPI MFCreateFile(MF_FILE_ACCESSMODE accessmode, MF_FILE_OPENMODE openmode, MF_FILE_FLAGS flags, LPCWSTR url, IMFByteStream **bytestream) { + DWORD capabilities = MFBYTESTREAM_IS_SEEKABLE | MFBYTESTREAM_DOES_NOT_USE_NETWORK; struct bytestream *object; DWORD fileaccessmode = 0; DWORD filesharemode = FILE_SHARE_READ; @@ -2838,12 +2839,15 @@ HRESULT WINAPI MFCreateFile(MF_FILE_ACCESSMODE accessmode, MF_FILE_OPENMODE open { case MF_ACCESSMODE_READ: fileaccessmode = GENERIC_READ; + capabilities |= MFBYTESTREAM_IS_READABLE; break; case MF_ACCESSMODE_WRITE: fileaccessmode = GENERIC_WRITE; + capabilities |= MFBYTESTREAM_IS_WRITABLE; break; case MF_ACCESSMODE_READWRITE: fileaccessmode = GENERIC_READ | GENERIC_WRITE; + capabilities |= (MFBYTESTREAM_IS_READABLE | MFBYTESTREAM_IS_WRITABLE); break; }
@@ -2897,6 +2901,7 @@ HRESULT WINAPI MFCreateFile(MF_FILE_ACCESSMODE accessmode, MF_FILE_OPENMODE open object->write_callback.lpVtbl = &bytestream_file_write_callback_vtbl; InitializeCriticalSection(&object->cs); list_init(&object->pending); + object->capabilities = capabilities; object->hfile = file;
if (GetFileTime(file, NULL, NULL, &writetime)) diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index f280a35a58..779a76aff2 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -1153,7 +1153,6 @@ static void test_file_stream(void) ok(hr == S_OK, "Failed to get stream capabilities, hr %#x.\n", hr); if (is_win8_plus) { -todo_wine ok(caps == (MFBYTESTREAM_IS_READABLE | MFBYTESTREAM_IS_SEEKABLE | MFBYTESTREAM_DOES_NOT_USE_NETWORK), "Unexpected caps %#x.\n", caps); }
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=49931
Your paranoid android.
=== debian9 (32 bit report) ===
mfplat: Unhandled exception: page fault on read access to 0x00000009 in 32-bit code (0x7e7aa52a).
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mfplat/mediatype.c | 9 +++++---- dlls/mfplat/tests/mfplat.c | 1 - 2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/dlls/mfplat/mediatype.c b/dlls/mfplat/mediatype.c index e64dd3da63..2c2c83e8de 100644 --- a/dlls/mfplat/mediatype.c +++ b/dlls/mfplat/mediatype.c @@ -318,17 +318,18 @@ static HRESULT WINAPI mediatype_IsCompressedFormat(IMFMediaType *iface, BOOL *co { struct media_type *media_type = impl_from_IMFMediaType(iface); UINT32 value; - HRESULT hr;
TRACE("%p, %p.\n", iface, compressed);
- hr = IMFAttributes_GetUINT32(&media_type->attributes.IMFAttributes_iface, &MF_MT_ALL_SAMPLES_INDEPENDENT, &value); - if (FAILED(hr)) + if (FAILED(IMFAttributes_GetUINT32(&media_type->attributes.IMFAttributes_iface, + &MF_MT_ALL_SAMPLES_INDEPENDENT, &value))) + { value = 0; + }
*compressed = !value;
- return hr; + return S_OK; }
static HRESULT WINAPI mediatype_IsEqual(IMFMediaType *iface, IMFMediaType *type, DWORD *flags) diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 779a76aff2..f62136f4ad 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -355,7 +355,6 @@ if(0)
compressed = FALSE; hr = IMFMediaType_IsCompressedFormat(mediatype, &compressed); -todo_wine ok(hr == S_OK, "Failed to get media type property, hr %#x.\n", hr); ok(compressed, "Unexpected value %d.\n", compressed);