[4/4] windowscodecs: Implement MetadataHandler_GetValueByIndex. Resend.

Dmitry Timoshkov dmitry at baikal.ru
Wed Jun 20 00:00:25 CDT 2012


---
 dlls/windowscodecs/metadatahandler.c | 28 +++++++++++++++++++++++++---
 dlls/windowscodecs/tests/metadata.c  |  6 ------
 2 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/dlls/windowscodecs/metadatahandler.c b/dlls/windowscodecs/metadatahandler.c
index f8b8fcb..9f36d65 100644
--- a/dlls/windowscodecs/metadatahandler.c
+++ b/dlls/windowscodecs/metadatahandler.c
@@ -185,10 +185,32 @@ static HRESULT WINAPI MetadataHandler_GetCount(IWICMetadataWriter *iface,
 }
 
 static HRESULT WINAPI MetadataHandler_GetValueByIndex(IWICMetadataWriter *iface,
-    UINT nIndex, PROPVARIANT *pvarSchema, PROPVARIANT *pvarId, PROPVARIANT *pvarValue)
+    UINT index, PROPVARIANT *schema, PROPVARIANT *id, PROPVARIANT *value)
 {
-    FIXME("(%p,%u,%p,%p,%p): stub\n", iface, nIndex, pvarSchema, pvarId, pvarValue);
-    return E_NOTIMPL;
+    HRESULT hr = S_OK;
+    MetadataHandler *This = impl_from_IWICMetadataWriter(iface);
+
+    TRACE("%p,%u,%p,%p,%p\n", iface, index, schema, id, value);
+
+    EnterCriticalSection(&This->lock);
+
+    if (index >= This->item_count)
+    {
+        LeaveCriticalSection(&This->lock);
+        return E_INVALIDARG;
+    }
+
+    if (schema)
+        hr = PropVariantCopy(schema, &This->items[index].schema);
+
+    if (SUCCEEDED(hr) && id)
+        hr = PropVariantCopy(id, &This->items[index].id);
+
+    if (SUCCEEDED(hr) && value)
+        hr = PropVariantCopy(value, &This->items[index].value);
+
+    LeaveCriticalSection(&This->lock);
+    return hr;
 }
 
 static HRESULT WINAPI MetadataHandler_GetValue(IWICMetadataWriter *iface,
diff --git a/dlls/windowscodecs/tests/metadata.c b/dlls/windowscodecs/tests/metadata.c
index e746c89..3c433bd 100644
--- a/dlls/windowscodecs/tests/metadata.c
+++ b/dlls/windowscodecs/tests/metadata.c
@@ -425,13 +425,7 @@ static void test_metadata_IFD(void)
     ok(hr == E_INVALIDARG, "GetMetadataFormat should fail\n");
 
     hr = IWICMetadataReader_GetValueByIndex(reader, 0, NULL, NULL, NULL);
-todo_wine
     ok(hr == S_OK, "GetValueByIndex error %#x\n", hr);
-    if (FAILED(hr))
-    {
-        IWICMetadataReader_Release(reader);
-        return;
-    }
 
     hr = IWICMetadataReader_GetValueByIndex(reader, count - 1, NULL, NULL, NULL);
     ok(hr == S_OK, "GetValueByIndex error %#x\n", hr);
-- 
1.7.11




More information about the wine-patches mailing list