[PATCH 1/2] windowscodecs: Stub IWICMetadataQueryReader

Andrew Eikum aeikum at codeweavers.com
Fri Mar 11 15:16:29 CST 2016


Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
---
 dlls/windowscodecs/Makefile.in         |   1 +
 dlls/windowscodecs/bitmap.c            |   1 -
 dlls/windowscodecs/bmpdecode.c         |   1 -
 dlls/windowscodecs/bmpencode.c         |   1 -
 dlls/windowscodecs/clipper.c           |   1 -
 dlls/windowscodecs/clsfactory.c        |   2 -
 dlls/windowscodecs/colorcontext.c      |   1 -
 dlls/windowscodecs/colortransform.c    |   1 -
 dlls/windowscodecs/converter.c         |   1 -
 dlls/windowscodecs/fliprotate.c        |   1 -
 dlls/windowscodecs/gifformat.c         |  10 ++-
 dlls/windowscodecs/icnsformat.c        |   1 -
 dlls/windowscodecs/icoformat.c         |   1 -
 dlls/windowscodecs/imgfactory.c        |  10 ++-
 dlls/windowscodecs/info.c              |   2 -
 dlls/windowscodecs/jpegformat.c        |   1 -
 dlls/windowscodecs/main.c              |   1 -
 dlls/windowscodecs/metadatahandler.c   |   2 -
 dlls/windowscodecs/metadataquery.c     | 150 +++++++++++++++++++++++++++++++++
 dlls/windowscodecs/palette.c           |   1 -
 dlls/windowscodecs/pngformat.c         |  12 ++-
 dlls/windowscodecs/propertybag.c       |   1 -
 dlls/windowscodecs/proxy.c             |   2 -
 dlls/windowscodecs/regsvr.c            |   2 -
 dlls/windowscodecs/scaler.c            |   1 -
 dlls/windowscodecs/stream.c            |   1 -
 dlls/windowscodecs/tests/metadata.c    |  38 +++++++++
 dlls/windowscodecs/tgaformat.c         |   1 -
 dlls/windowscodecs/tiffformat.c        |  12 ++-
 dlls/windowscodecs/wincodecs_private.h |   5 ++
 30 files changed, 223 insertions(+), 42 deletions(-)
 create mode 100644 dlls/windowscodecs/metadataquery.c

diff --git a/dlls/windowscodecs/Makefile.in b/dlls/windowscodecs/Makefile.in
index 5d4eddf..78e2059 100644
--- a/dlls/windowscodecs/Makefile.in
+++ b/dlls/windowscodecs/Makefile.in
@@ -22,6 +22,7 @@ C_SRCS = \
 	jpegformat.c \
 	main.c \
 	metadatahandler.c \
+	metadataquery.c \
 	palette.c \
 	pngformat.c \
 	propertybag.c \
diff --git a/dlls/windowscodecs/bitmap.c b/dlls/windowscodecs/bitmap.c
index 85d0076..6adaab0 100644
--- a/dlls/windowscodecs/bitmap.c
+++ b/dlls/windowscodecs/bitmap.c
@@ -25,7 +25,6 @@
 #include "windef.h"
 #include "winbase.h"
 #include "objbase.h"
-#include "wincodec.h"
 
 #include "wincodecs_private.h"
 
diff --git a/dlls/windowscodecs/bmpdecode.c b/dlls/windowscodecs/bmpdecode.c
index 7910b4f..2bcb81e 100644
--- a/dlls/windowscodecs/bmpdecode.c
+++ b/dlls/windowscodecs/bmpdecode.c
@@ -28,7 +28,6 @@
 #include "winreg.h"
 #include "wingdi.h"
 #include "objbase.h"
-#include "wincodec.h"
 
 #include "wincodecs_private.h"
 
diff --git a/dlls/windowscodecs/bmpencode.c b/dlls/windowscodecs/bmpencode.c
index a570884..3dce8bb 100644
--- a/dlls/windowscodecs/bmpencode.c
+++ b/dlls/windowscodecs/bmpencode.c
@@ -27,7 +27,6 @@
 #include "winreg.h"
 #include "wingdi.h"
 #include "objbase.h"
-#include "wincodec.h"
 
 #include "wincodecs_private.h"
 
diff --git a/dlls/windowscodecs/clipper.c b/dlls/windowscodecs/clipper.c
index 6f8a05b..94127f3 100644
--- a/dlls/windowscodecs/clipper.c
+++ b/dlls/windowscodecs/clipper.c
@@ -23,7 +23,6 @@
 #include "windef.h"
 #include "winbase.h"
 #include "objbase.h"
-#include "wincodec.h"
 
 #include "wincodecs_private.h"
 
diff --git a/dlls/windowscodecs/clsfactory.c b/dlls/windowscodecs/clsfactory.c
index 9928be5..d4c524a 100644
--- a/dlls/windowscodecs/clsfactory.c
+++ b/dlls/windowscodecs/clsfactory.c
@@ -28,8 +28,6 @@
 #include "objbase.h"
 #include "ocidl.h"
 #include "initguid.h"
-#include "wincodec.h"
-#include "wincodecsdk.h"
 
 #include "wincodecs_private.h"
 
diff --git a/dlls/windowscodecs/colorcontext.c b/dlls/windowscodecs/colorcontext.c
index 268b6ef..eb13482 100644
--- a/dlls/windowscodecs/colorcontext.c
+++ b/dlls/windowscodecs/colorcontext.c
@@ -25,7 +25,6 @@
 #include "windef.h"
 #include "winbase.h"
 #include "objbase.h"
-#include "wincodec.h"
 
 #include "wincodecs_private.h"
 
diff --git a/dlls/windowscodecs/colortransform.c b/dlls/windowscodecs/colortransform.c
index 7791731..5b1c7e8 100644
--- a/dlls/windowscodecs/colortransform.c
+++ b/dlls/windowscodecs/colortransform.c
@@ -25,7 +25,6 @@
 #include "windef.h"
 #include "winbase.h"
 #include "objbase.h"
-#include "wincodec.h"
 
 #include "wincodecs_private.h"
 
diff --git a/dlls/windowscodecs/converter.c b/dlls/windowscodecs/converter.c
index 11f04d9..e701f2a 100644
--- a/dlls/windowscodecs/converter.c
+++ b/dlls/windowscodecs/converter.c
@@ -25,7 +25,6 @@
 #include "windef.h"
 #include "winbase.h"
 #include "objbase.h"
-#include "wincodec.h"
 
 #include "wincodecs_private.h"
 
diff --git a/dlls/windowscodecs/fliprotate.c b/dlls/windowscodecs/fliprotate.c
index 81e01cc..72d1e8a 100644
--- a/dlls/windowscodecs/fliprotate.c
+++ b/dlls/windowscodecs/fliprotate.c
@@ -25,7 +25,6 @@
 #include "windef.h"
 #include "winbase.h"
 #include "objbase.h"
-#include "wincodec.h"
 
 #include "wincodecs_private.h"
 
diff --git a/dlls/windowscodecs/gifformat.c b/dlls/windowscodecs/gifformat.c
index d134515..9ba29f5 100644
--- a/dlls/windowscodecs/gifformat.c
+++ b/dlls/windowscodecs/gifformat.c
@@ -27,8 +27,6 @@
 #include "windef.h"
 #include "winbase.h"
 #include "objbase.h"
-#include "wincodec.h"
-#include "wincodecsdk.h"
 
 #include "ungif.h"
 
@@ -816,8 +814,14 @@ static HRESULT WINAPI GifFrameDecode_CopyPixels(IWICBitmapFrameDecode *iface,
 static HRESULT WINAPI GifFrameDecode_GetMetadataQueryReader(IWICBitmapFrameDecode *iface,
     IWICMetadataQueryReader **ppIMetadataQueryReader)
 {
+    GifFrameDecode *This = impl_from_IWICBitmapFrameDecode(iface);
+
     TRACE("(%p,%p)\n", iface, ppIMetadataQueryReader);
-    return WINCODEC_ERR_UNSUPPORTEDOPERATION;
+
+    if (!ppIMetadataQueryReader)
+        return E_INVALIDARG;
+
+    return MetadataQueryReader_CreateInstance(&This->IWICMetadataBlockReader_iface, ppIMetadataQueryReader);
 }
 
 static HRESULT WINAPI GifFrameDecode_GetColorContexts(IWICBitmapFrameDecode *iface,
diff --git a/dlls/windowscodecs/icnsformat.c b/dlls/windowscodecs/icnsformat.c
index 5d48a1a..d4c5004 100644
--- a/dlls/windowscodecs/icnsformat.c
+++ b/dlls/windowscodecs/icnsformat.c
@@ -83,7 +83,6 @@
 #include "windef.h"
 #include "winbase.h"
 #include "objbase.h"
-#include "wincodec.h"
 
 #include "wincodecs_private.h"
 
diff --git a/dlls/windowscodecs/icoformat.c b/dlls/windowscodecs/icoformat.c
index a87d94a..1b1c792 100644
--- a/dlls/windowscodecs/icoformat.c
+++ b/dlls/windowscodecs/icoformat.c
@@ -26,7 +26,6 @@
 #include "winbase.h"
 #include "wingdi.h"
 #include "objbase.h"
-#include "wincodec.h"
 
 #include "wincodecs_private.h"
 
diff --git a/dlls/windowscodecs/imgfactory.c b/dlls/windowscodecs/imgfactory.c
index f2455fc..659aa7e 100644
--- a/dlls/windowscodecs/imgfactory.c
+++ b/dlls/windowscodecs/imgfactory.c
@@ -28,8 +28,6 @@
 #include "winreg.h"
 #include "objbase.h"
 #include "shellapi.h"
-#include "wincodec.h"
-#include "wincodecsdk.h"
 
 #include "wincodecs_private.h"
 
@@ -1098,8 +1096,12 @@ static HRESULT WINAPI ComponentFactory_CreateMetadataWriterFromReader(IWICCompon
 static HRESULT WINAPI ComponentFactory_CreateQueryReaderFromBlockReader(IWICComponentFactory *iface,
         IWICMetadataBlockReader *block_reader, IWICMetadataQueryReader **query_reader)
 {
-    FIXME("%p,%p,%p: stub\n", iface, block_reader, query_reader);
-    return E_NOTIMPL;
+    TRACE("%p,%p,%p\n", iface, block_reader, query_reader);
+
+    if (!block_reader || !query_reader)
+        return E_INVALIDARG;
+
+    return MetadataQueryReader_CreateInstance(block_reader, query_reader);
 }
 
 static HRESULT WINAPI ComponentFactory_CreateQueryWriterFromBlockWriter(IWICComponentFactory *iface,
diff --git a/dlls/windowscodecs/info.c b/dlls/windowscodecs/info.c
index cf3c38a..84b80bc 100644
--- a/dlls/windowscodecs/info.c
+++ b/dlls/windowscodecs/info.c
@@ -27,8 +27,6 @@
 #include "winbase.h"
 #include "winreg.h"
 #include "objbase.h"
-#include "wincodec.h"
-#include "wincodecsdk.h"
 
 #include "wincodecs_private.h"
 
diff --git a/dlls/windowscodecs/jpegformat.c b/dlls/windowscodecs/jpegformat.c
index e29996d..7ee8012 100644
--- a/dlls/windowscodecs/jpegformat.c
+++ b/dlls/windowscodecs/jpegformat.c
@@ -47,7 +47,6 @@
 #include "windef.h"
 #include "winbase.h"
 #include "objbase.h"
-#include "wincodec.h"
 
 #include "wincodecs_private.h"
 
diff --git a/dlls/windowscodecs/main.c b/dlls/windowscodecs/main.c
index d346711..442976f 100644
--- a/dlls/windowscodecs/main.c
+++ b/dlls/windowscodecs/main.c
@@ -25,7 +25,6 @@
 #include "windef.h"
 #include "winbase.h"
 #include "objbase.h"
-#include "wincodec.h"
 
 #include "wincodecs_private.h"
 
diff --git a/dlls/windowscodecs/metadatahandler.c b/dlls/windowscodecs/metadatahandler.c
index fb35f80..571f8b5 100644
--- a/dlls/windowscodecs/metadatahandler.c
+++ b/dlls/windowscodecs/metadatahandler.c
@@ -29,8 +29,6 @@
 #include "winbase.h"
 #include "winternl.h"
 #include "objbase.h"
-#include "wincodec.h"
-#include "wincodecsdk.h"
 
 #include "wincodecs_private.h"
 
diff --git a/dlls/windowscodecs/metadataquery.c b/dlls/windowscodecs/metadataquery.c
new file mode 100644
index 0000000..b3e3c60
--- /dev/null
+++ b/dlls/windowscodecs/metadataquery.c
@@ -0,0 +1,150 @@
+/*
+ * Copyright 2016 Andrew Eikum for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "config.h"
+
+#include <stdarg.h>
+
+#define COBJMACROS
+
+#include "windef.h"
+#include "winbase.h"
+#include "objbase.h"
+
+#include "wincodecs_private.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(wincodecs);
+
+typedef struct {
+    IWICMetadataQueryReader IWICMetadataQueryReader_iface;
+
+    LONG ref;
+
+    IWICMetadataBlockReader *block;
+} QueryReader;
+
+static inline QueryReader *impl_from_IWICMetadataQueryReader(IWICMetadataQueryReader *iface)
+{
+    return CONTAINING_RECORD(iface, QueryReader, IWICMetadataQueryReader_iface);
+}
+
+static HRESULT WINAPI mqr_QueryInterface(IWICMetadataQueryReader *iface, REFIID riid,
+        void **ppvObject)
+{
+    QueryReader *This = impl_from_IWICMetadataQueryReader(iface);
+
+    TRACE("(%p,%s,%p)\n", This, debugstr_guid(riid), ppvObject);
+
+    if (IsEqualGUID(riid, &IID_IUnknown) ||
+            IsEqualGUID(riid, &IID_IWICMetadataQueryReader))
+        *ppvObject = &This->IWICMetadataQueryReader_iface;
+    else
+        *ppvObject = NULL;
+
+    if (*ppvObject)
+    {
+        IUnknown_AddRef((IUnknown*)*ppvObject);
+        return S_OK;
+    }
+
+    return E_NOINTERFACE;
+}
+
+static ULONG WINAPI mqr_AddRef(IWICMetadataQueryReader *iface)
+{
+    QueryReader *This = impl_from_IWICMetadataQueryReader(iface);
+    ULONG ref = InterlockedIncrement(&This->ref);
+    TRACE("(%p) refcount=%u\n", This, ref);
+    return ref;
+}
+
+static ULONG WINAPI mqr_Release(IWICMetadataQueryReader *iface)
+{
+    QueryReader *This = impl_from_IWICMetadataQueryReader(iface);
+    ULONG ref = InterlockedDecrement(&This->ref);
+    TRACE("(%p) refcount=%u\n", This, ref);
+    if (!ref)
+    {
+        HeapFree(GetProcessHeap(), 0, This);
+    }
+    return ref;
+}
+
+static HRESULT WINAPI mqr_GetContainerFormat(IWICMetadataQueryReader *iface,
+        GUID *pguidContainerFormat)
+{
+    QueryReader *This = impl_from_IWICMetadataQueryReader(iface);
+    FIXME("(%p,%p)\n", This, pguidContainerFormat);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI mqr_GetLocation(IWICMetadataQueryReader *iface,
+        UINT cchMaxLength, WCHAR *wzNamespace, UINT *pcchActualLength)
+{
+    QueryReader *This = impl_from_IWICMetadataQueryReader(iface);
+    FIXME("(%p,%u,%p,%p)\n", This, cchMaxLength, wzNamespace, pcchActualLength);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI mqr_GetMetadataByName(IWICMetadataQueryReader *iface,
+        LPCWSTR wzName, PROPVARIANT *pvarValue)
+{
+    QueryReader *This = impl_from_IWICMetadataQueryReader(iface);
+    FIXME("(%p,%s,%p)\n", This, wine_dbgstr_w(wzName), pvarValue);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI mqr_GetEnumerator(IWICMetadataQueryReader *iface,
+        IEnumString **ppIEnumString)
+{
+    QueryReader *This = impl_from_IWICMetadataQueryReader(iface);
+    FIXME("(%p,%p)\n", This, ppIEnumString);
+    return E_NOTIMPL;
+}
+
+static IWICMetadataQueryReaderVtbl mqr_vtbl = {
+    mqr_QueryInterface,
+    mqr_AddRef,
+    mqr_Release,
+    mqr_GetContainerFormat,
+    mqr_GetLocation,
+    mqr_GetMetadataByName,
+    mqr_GetEnumerator
+};
+
+HRESULT MetadataQueryReader_CreateInstance(IWICMetadataBlockReader *mbr, IWICMetadataQueryReader **out)
+{
+    QueryReader *obj;
+    HRESULT ret;
+
+    obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*obj));
+    if (!obj)
+        return E_OUTOFMEMORY;
+
+    obj->IWICMetadataQueryReader_iface.lpVtbl = &mqr_vtbl;
+    obj->ref = 1;
+
+    IWICMetadataBlockReader_AddRef(mbr);
+    obj->block = mbr;
+
+    *out = &obj->IWICMetadataQueryReader_iface;
+
+    return ret;
+}
diff --git a/dlls/windowscodecs/palette.c b/dlls/windowscodecs/palette.c
index e21a073..89ec9ea 100644
--- a/dlls/windowscodecs/palette.c
+++ b/dlls/windowscodecs/palette.c
@@ -27,7 +27,6 @@
 #include "winbase.h"
 #include "winreg.h"
 #include "objbase.h"
-#include "wincodec.h"
 
 #include "wincodecs_private.h"
 
diff --git a/dlls/windowscodecs/pngformat.c b/dlls/windowscodecs/pngformat.c
index f39b31a..4f5cb94 100644
--- a/dlls/windowscodecs/pngformat.c
+++ b/dlls/windowscodecs/pngformat.c
@@ -31,8 +31,6 @@
 #include "windef.h"
 #include "winbase.h"
 #include "objbase.h"
-#include "wincodec.h"
-#include "wincodecsdk.h"
 
 #include "wincodecs_private.h"
 
@@ -1020,8 +1018,14 @@ static HRESULT WINAPI PngDecoder_Frame_CopyPixels(IWICBitmapFrameDecode *iface,
 static HRESULT WINAPI PngDecoder_Frame_GetMetadataQueryReader(IWICBitmapFrameDecode *iface,
     IWICMetadataQueryReader **ppIMetadataQueryReader)
 {
-    FIXME("(%p,%p): stub\n", iface, ppIMetadataQueryReader);
-    return E_NOTIMPL;
+    PngDecoder *This = impl_from_IWICBitmapFrameDecode(iface);
+
+    TRACE("(%p,%p)\n", iface, ppIMetadataQueryReader);
+
+    if (!ppIMetadataQueryReader)
+        return E_INVALIDARG;
+
+    return MetadataQueryReader_CreateInstance(&This->IWICMetadataBlockReader_iface, ppIMetadataQueryReader);
 }
 
 static HRESULT WINAPI PngDecoder_Frame_GetColorContexts(IWICBitmapFrameDecode *iface,
diff --git a/dlls/windowscodecs/propertybag.c b/dlls/windowscodecs/propertybag.c
index 11fa5b1..8e81ec0 100644
--- a/dlls/windowscodecs/propertybag.c
+++ b/dlls/windowscodecs/propertybag.c
@@ -26,7 +26,6 @@
 #include "windef.h"
 #include "winbase.h"
 #include "objbase.h"
-#include "wincodec.h"
 #include "wine/unicode.h"
 
 #include "wincodecs_private.h"
diff --git a/dlls/windowscodecs/proxy.c b/dlls/windowscodecs/proxy.c
index 10d34e3..a28b386 100644
--- a/dlls/windowscodecs/proxy.c
+++ b/dlls/windowscodecs/proxy.c
@@ -27,8 +27,6 @@
 #include "windef.h"
 #include "winbase.h"
 #include "objbase.h"
-#include "wincodec.h"
-#include "wincodecsdk.h"
 
 #include "wincodecs_private.h"
 
diff --git a/dlls/windowscodecs/regsvr.c b/dlls/windowscodecs/regsvr.c
index ccb78b8..9c4062e 100644
--- a/dlls/windowscodecs/regsvr.c
+++ b/dlls/windowscodecs/regsvr.c
@@ -29,8 +29,6 @@
 
 #include "objbase.h"
 #include "ocidl.h"
-#include "wincodec.h"
-#include "wincodecsdk.h"
 
 #include "wine/debug.h"
 #include "wine/unicode.h"
diff --git a/dlls/windowscodecs/scaler.c b/dlls/windowscodecs/scaler.c
index 03410e8..ebcc790 100644
--- a/dlls/windowscodecs/scaler.c
+++ b/dlls/windowscodecs/scaler.c
@@ -25,7 +25,6 @@
 #include "windef.h"
 #include "winbase.h"
 #include "objbase.h"
-#include "wincodec.h"
 
 #include "wincodecs_private.h"
 
diff --git a/dlls/windowscodecs/stream.c b/dlls/windowscodecs/stream.c
index d05e940..308ef8e 100644
--- a/dlls/windowscodecs/stream.c
+++ b/dlls/windowscodecs/stream.c
@@ -24,7 +24,6 @@
 #include "winreg.h"
 #include "objbase.h"
 #include "shlwapi.h"
-#include "wincodec.h"
 #include "wincodecs_private.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(wincodecs);
diff --git a/dlls/windowscodecs/tests/metadata.c b/dlls/windowscodecs/tests/metadata.c
index 6c2d6b7..aa096f0 100644
--- a/dlls/windowscodecs/tests/metadata.c
+++ b/dlls/windowscodecs/tests/metadata.c
@@ -964,6 +964,8 @@ static void test_metadata_png(void)
     IWICBitmapFrameDecode *frame;
     IWICMetadataBlockReader *blockreader;
     IWICMetadataReader *reader;
+    IWICMetadataQueryReader *queryreader;
+    IWICComponentFactory *factory;
     GUID containerformat;
     HRESULT hr;
     UINT count=0xdeadbeef;
@@ -1034,9 +1036,34 @@ static void test_metadata_png(void)
         hr = IWICMetadataBlockReader_GetReaderByIndex(blockreader, 1, &reader);
         todo_wine ok(hr == WINCODEC_ERR_VALUEOUTOFRANGE, "GetReaderByIndex failed, hr=%x\n", hr);
 
+        hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
+            &IID_IWICComponentFactory, (void**)&factory);
+        ok(hr == S_OK, "CoCreateInstance failed, hr=%x\n", hr);
+
+        hr = IWICComponentFactory_CreateQueryReaderFromBlockReader(factory, NULL, &queryreader);
+        ok(hr == E_INVALIDARG, "CreateQueryReaderFromBlockReader should have failed: %08x\n", hr);
+
+        hr = IWICComponentFactory_CreateQueryReaderFromBlockReader(factory, blockreader, NULL);
+        ok(hr == E_INVALIDARG, "CreateQueryReaderFromBlockReader should have failed: %08x\n", hr);
+
+        hr = IWICComponentFactory_CreateQueryReaderFromBlockReader(factory, blockreader, &queryreader);
+        ok(hr == S_OK, "CreateQueryReaderFromBlockReader failed: %08x\n", hr);
+
+        IWICMetadataQueryReader_Release(queryreader);
+
+        IWICComponentFactory_Release(factory);
+
         IWICMetadataBlockReader_Release(blockreader);
     }
 
+    hr = IWICBitmapFrameDecode_GetMetadataQueryReader(frame, &queryreader);
+    ok(hr == S_OK, "GetMetadataQueryReader failed: %08x\n", hr);
+
+    if (SUCCEEDED(hr))
+    {
+        IWICMetadataQueryReader_Release(queryreader);
+    }
+
     IWICBitmapFrameDecode_Release(frame);
 
     IWICBitmapDecoder_Release(decoder);
@@ -1126,6 +1153,7 @@ static void test_metadata_gif(void)
     IWICBitmapFrameDecode *frame;
     IWICMetadataBlockReader *blockreader;
     IWICMetadataReader *reader;
+    IWICMetadataQueryReader *queryreader;
     GUID format;
     HRESULT hr;
     UINT count;
@@ -1448,6 +1476,16 @@ static void test_metadata_gif(void)
         IWICMetadataBlockReader_Release(blockreader);
     }
 
+    hr = IWICBitmapFrameDecode_GetMetadataQueryReader(frame, &queryreader);
+    ok(hr == S_OK ||
+            broken(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION) /* before Vista */,
+            "GetMetadataQueryReader failed: %08x\n", hr);
+
+    if (SUCCEEDED(hr))
+    {
+        IWICMetadataQueryReader_Release(queryreader);
+    }
+
     IWICBitmapFrameDecode_Release(frame);
     IWICBitmapDecoder_Release(decoder);
 }
diff --git a/dlls/windowscodecs/tgaformat.c b/dlls/windowscodecs/tgaformat.c
index 2b8cb1a..ec7fa23 100644
--- a/dlls/windowscodecs/tgaformat.c
+++ b/dlls/windowscodecs/tgaformat.c
@@ -26,7 +26,6 @@
 #include "windef.h"
 #include "winbase.h"
 #include "objbase.h"
-#include "wincodec.h"
 
 #include "wincodecs_private.h"
 
diff --git a/dlls/windowscodecs/tiffformat.c b/dlls/windowscodecs/tiffformat.c
index 5795d85..1dacd87 100644
--- a/dlls/windowscodecs/tiffformat.c
+++ b/dlls/windowscodecs/tiffformat.c
@@ -32,8 +32,6 @@
 #include "windef.h"
 #include "winbase.h"
 #include "objbase.h"
-#include "wincodec.h"
-#include "wincodecsdk.h"
 
 #include "wincodecs_private.h"
 
@@ -1167,8 +1165,14 @@ static HRESULT WINAPI TiffFrameDecode_CopyPixels(IWICBitmapFrameDecode *iface,
 static HRESULT WINAPI TiffFrameDecode_GetMetadataQueryReader(IWICBitmapFrameDecode *iface,
     IWICMetadataQueryReader **ppIMetadataQueryReader)
 {
-    FIXME("(%p,%p): stub\n", iface, ppIMetadataQueryReader);
-    return E_NOTIMPL;
+    TiffFrameDecode *This = impl_from_IWICBitmapFrameDecode(iface);
+
+    TRACE("(%p,%p)\n", iface, ppIMetadataQueryReader);
+
+    if (!ppIMetadataQueryReader)
+        return E_INVALIDARG;
+
+    return MetadataQueryReader_CreateInstance(&This->IWICMetadataBlockReader_iface, ppIMetadataQueryReader);
 }
 
 static HRESULT WINAPI TiffFrameDecode_GetColorContexts(IWICBitmapFrameDecode *iface,
diff --git a/dlls/windowscodecs/wincodecs_private.h b/dlls/windowscodecs/wincodecs_private.h
index 4efcd46..f54403c 100644
--- a/dlls/windowscodecs/wincodecs_private.h
+++ b/dlls/windowscodecs/wincodecs_private.h
@@ -19,6 +19,9 @@
 #ifndef WINCODECS_PRIVATE_H
 #define WINCODECS_PRIVATE_H
 
+#include "wincodec.h"
+#include "wincodecsdk.h"
+
 DEFINE_GUID(CLSID_WineTgaDecoder, 0xb11fc79a,0x67cc,0x43e6,0xa9,0xce,0xe3,0xd5,0x49,0x45,0xd3,0x04);
 
 DEFINE_GUID(CLSID_WICIcnsEncoder, 0x312fb6f1,0xb767,0x409d,0x8a,0x6d,0x0f,0xc1,0x54,0xd4,0xf0,0x5c);
@@ -159,6 +162,8 @@ extern HRESULT GCEReader_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN;
 extern HRESULT APEReader_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN;
 extern HRESULT GifCommentReader_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN;
 
+extern HRESULT MetadataQueryReader_CreateInstance(IWICMetadataBlockReader *mbr, IWICMetadataQueryReader **out) DECLSPEC_HIDDEN;
+
 extern HRESULT stream_initialize_from_filehandle(IWICStream *iface, HANDLE hfile) DECLSPEC_HIDDEN;
 
 #endif /* WINCODECS_PRIVATE_H */
-- 
2.7.2





More information about the wine-patches mailing list