windowscodecs: Add fallback to unknown metadata reader.

This commit is contained in:
Vincent Povirk 2014-11-12 16:00:55 -06:00 committed by Alexandre Julliard
parent 1dee37340d
commit fa455f594b
2 changed files with 25 additions and 2 deletions

View File

@ -1050,7 +1050,30 @@ start:
IEnumUnknown_Release(enumreaders);
if (!*reader && !(options & WICMetadataCreationFailUnknown))
FIXME("create unknown metadata reader\n");
{
hr = IStream_Seek(stream, zero, STREAM_SEEK_SET, NULL);
if (SUCCEEDED(hr))
hr = UnknownMetadataReader_CreateInstance(&IID_IWICMetadataReader, (void**)reader);
if (SUCCEEDED(hr))
{
hr = IWICMetadataReader_QueryInterface(*reader, &IID_IWICPersistStream, (void**)&wicpersiststream);
if (SUCCEEDED(hr))
{
hr = IWICPersistStream_LoadEx(wicpersiststream, stream, NULL, options & WICPersistOptionsMask);
IWICPersistStream_Release(wicpersiststream);
}
if (FAILED(hr))
{
IWICMetadataReader_Release(*reader);
*reader = NULL;
}
}
}
if (*reader)
return S_OK;

View File

@ -876,7 +876,7 @@ static void test_create_reader(void)
hr = IWICComponentFactory_CreateMetadataReaderFromContainer(factory,
&GUID_ContainerFormatWmp, NULL, WICPersistOptionsDefault,
stream, &reader);
todo_wine ok(hr == S_OK, "CreateMetadataReaderFromContainer failed, hr=%x\n", hr);
ok(hr == S_OK, "CreateMetadataReaderFromContainer failed, hr=%x\n", hr);
if (SUCCEEDED(hr))
{