Spotted by Eric Pouech.
Signed-off-by: Esme Povirk esme@codeweavers.com --- dlls/windowscodecs/metadatahandler.c | 4 ++++ dlls/windowscodecs/tests/metadata.c | 15 +++++++++++++++ 2 files changed, 19 insertions(+)
diff --git a/dlls/windowscodecs/metadatahandler.c b/dlls/windowscodecs/metadatahandler.c index b0b682b6d9b..5bcca0f58c6 100644 --- a/dlls/windowscodecs/metadatahandler.c +++ b/dlls/windowscodecs/metadatahandler.c @@ -491,9 +491,13 @@ static HRESULT WINAPI MetadataHandlerEnum_Next(IWICEnumMetadataItem *iface, ULONG new_index; HRESULT hr=S_FALSE; ULONG i; + ULONG fetched;
TRACE("(%p,%li)\n", iface, celt);
+ if (!pceltFetched) + pceltFetched = &fetched; + EnterCriticalSection(&This->parent->lock);
if (This->index >= This->parent->item_count) diff --git a/dlls/windowscodecs/tests/metadata.c b/dlls/windowscodecs/tests/metadata.c index 2ec9eb645e8..57d8e2b1bea 100644 --- a/dlls/windowscodecs/tests/metadata.c +++ b/dlls/windowscodecs/tests/metadata.c @@ -303,6 +303,21 @@ static void test_metadata_unknown(void) ok(hr == S_FALSE, "Next failed, hr=%lx\n", hr); ok(items_returned == 0, "unexpected item count %li\n", items_returned);
+ hr = IWICEnumMetadataItem_Reset(enumerator); + ok(hr == S_OK, "Reset failed, hr=%lx\n", hr); + + hr = IWICEnumMetadataItem_Next(enumerator, 1, &schema, &id, NULL, NULL); + ok(hr == S_OK, "Next failed, hr=%lx\n", hr); + + if (hr == S_OK) + { + ok(schema.vt == VT_EMPTY, "unexpected vt: %i\n", schema.vt); + ok(id.vt == VT_EMPTY, "unexpected vt: %i\n", id.vt); + + PropVariantClear(&schema); + PropVariantClear(&id); + } + IWICEnumMetadataItem_Release(enumerator); }