From fa455f594bceb085562ae847ad1bcdcca40ecb8c Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Wed, 12 Nov 2014 16:00:55 -0600 Subject: [PATCH] windowscodecs: Add fallback to unknown metadata reader. --- dlls/windowscodecs/imgfactory.c | 25 ++++++++++++++++++++++++- dlls/windowscodecs/tests/metadata.c | 2 +- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/dlls/windowscodecs/imgfactory.c b/dlls/windowscodecs/imgfactory.c index 444f2e4e9d4..42b4e591c11 100644 --- a/dlls/windowscodecs/imgfactory.c +++ b/dlls/windowscodecs/imgfactory.c @@ -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; diff --git a/dlls/windowscodecs/tests/metadata.c b/dlls/windowscodecs/tests/metadata.c index 2dc60490eec..fa9d70114f2 100644 --- a/dlls/windowscodecs/tests/metadata.c +++ b/dlls/windowscodecs/tests/metadata.c @@ -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)) {