mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-14 20:55:40 +00:00
mfplat: Set default attributes for file-based bytestream object.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
e3c76d773b
commit
12812772a0
|
@ -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)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
if (FAILED(hr = init_attributes_object(&object->attributes, 0)))
|
||||
{
|
||||
CloseHandle(file);
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue