Nikolay Sivov : mfplat: Set default attributes for file-based bytestream object.
Alexandre Julliard
julliard at winehq.org
Fri Mar 22 16:06:18 CDT 2019
Module: wine
Branch: master
Commit: 12812772a0cbe143ca89844904198806dfca62a6
URL: https://source.winehq.org/git/wine.git/?a=commit;h=12812772a0cbe143ca89844904198806dfca62a6
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Fri Mar 22 09:15:18 2019 +0300
mfplat: Set default attributes for file-based bytestream object.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/mfplat/main.c | 20 ++++++++++++++++----
dlls/mfplat/tests/mfplat.c | 9 ++-------
2 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c
index b3c264b..12ac940 100644
--- a/dlls/mfplat/main.c
+++ b/dlls/mfplat/main.c
@@ -2632,6 +2632,7 @@ HRESULT WINAPI MFCreateFile(MF_FILE_ACCESSMODE accessmode, MF_FILE_OPENMODE open
DWORD filesharemode = FILE_SHARE_READ;
DWORD filecreation_disposition = 0;
DWORD fileattributes = 0;
+ FILETIME writetime;
HANDLE file;
HRESULT hr;
@@ -2680,15 +2681,16 @@ HRESULT WINAPI MFCreateFile(MF_FILE_ACCESSMODE accessmode, MF_FILE_OPENMODE open
if(file == INVALID_HANDLE_VALUE)
return HRESULT_FROM_WIN32(GetLastError());
- /* Close the file again, since we don't do anything with it yet */
- CloseHandle(file);
-
object = heap_alloc_zero(sizeof(*object));
if (!object)
+ {
+ CloseHandle(file);
return E_OUTOFMEMORY;
+ }
- if (FAILED(hr = init_attributes_object(&object->attributes, 0)))
+ if (FAILED(hr = init_attributes_object(&object->attributes, 2)))
{
+ CloseHandle(file);
heap_free(object);
return hr;
}
@@ -2699,8 +2701,18 @@ HRESULT WINAPI MFCreateFile(MF_FILE_ACCESSMODE accessmode, MF_FILE_OPENMODE open
InitializeCriticalSection(&object->cs);
list_init(&object->pending);
+ if (GetFileTime(file, NULL, NULL, &writetime))
+ {
+ IMFAttributes_SetBlob(&object->attributes.IMFAttributes_iface, &MF_BYTESTREAM_LAST_MODIFIED_TIME,
+ (const UINT8 *)&writetime, sizeof(writetime));
+ }
+
+ IMFAttributes_SetString(&object->attributes.IMFAttributes_iface, &MF_BYTESTREAM_ORIGIN_NAME, url);
+
*bytestream = &object->IMFByteStream_iface;
+ CloseHandle(file);
+
return S_OK;
}
diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c
index 6603808..4e01abf 100644
--- a/dlls/mfplat/tests/mfplat.c
+++ b/dlls/mfplat/tests/mfplat.c
@@ -1169,24 +1169,19 @@ todo_wine
hr = IMFAttributes_GetCount(attributes, &count);
ok(hr == S_OK, "Failed to get attributes count, hr %#x.\n", hr);
-todo_wine
ok(count == 2, "Unexpected attributes count %u.\n", count);
/* Original file name. */
hr = IMFAttributes_GetAllocatedString(attributes, &MF_BYTESTREAM_ORIGIN_NAME, &str, &count);
-todo_wine
ok(hr == S_OK, "Failed to get attribute, hr %#x.\n", hr);
-if (SUCCEEDED(hr))
-{
ok(!lstrcmpW(str, filename), "Unexpected name %s.\n", wine_dbgstr_w(str));
CoTaskMemFree(str);
-}
+
/* Modification time. */
hr = IMFAttributes_GetItemType(attributes, &MF_BYTESTREAM_LAST_MODIFIED_TIME, &item_type);
-todo_wine {
ok(hr == S_OK, "Failed to get item type, hr %#x.\n", hr);
ok(item_type == MF_ATTRIBUTE_BLOB, "Unexpected item type.\n");
-}
+
IMFAttributes_Release(attributes);
hr = MFCreateFile(MF_ACCESSMODE_READ, MF_OPENMODE_FAIL_IF_NOT_EXIST,
More information about the wine-cvs
mailing list