Signed-off-by: Jactry Zeng jzeng@codeweavers.com --- dlls/mfplat/main.c | 21 +++++++++++++++++++-- dlls/mfplat/tests/mfplat.c | 5 ++++- 2 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index 2877e9a929..f897325502 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -774,10 +774,27 @@ static HRESULT WINAPI mfattributes_SetItem(IMFAttributes *iface, REFGUID key, RE static HRESULT WINAPI mfattributes_DeleteItem(IMFAttributes *iface, REFGUID key) { mfattributes *This = impl_from_IMFAttributes(iface); + struct mfattribute *attribute = NULL; + int index = 0;
- FIXME("%p, %s\n", This, debugstr_guid(key)); + TRACE("(%p, %s)\n", This, debugstr_guid(key));
- return E_NOTIMPL; + EnterCriticalSection(&This->lock); + + index = mfattributes_finditem(This, key, &attribute); + if(attribute) + { + PropVariantClear(&attribute->value); + heap_free(attribute); + + This->count--; + for(; index < This->count; index++) + This->attributes[index] = This->attributes[index + 1]; + } + + LeaveCriticalSection(&This->lock); + + return S_OK; }
static HRESULT WINAPI mfattributes_DeleteAllItems(IMFAttributes *iface) diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 13c1d3cb2f..5dcb641486 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -763,7 +763,7 @@ static void test_IMFAttributes_item(void) ok(hr == S_OK, "IMFAttributes_SetItem failed: 0x%08x.\n", hr);
hr = IMFAttributes_DeleteItem(attributes, &DUMMY_GUID2); - todo_wine ok(hr == S_OK, "IMFAttributes_DeleteItem failed: 0x%08x.\n", hr); + ok(hr == S_OK, "IMFAttributes_DeleteItem failed: 0x%08x.\n", hr); hr = IMFAttributes_GetItemByIndex(attributes, 0, &key, &ret_propvar); todo_wine ok(hr == S_OK, "IMFAttributes_GetItemByIndex failed: 0x%08x.\n", hr); todo_wine ok(!PropVariantCompareEx(&propvar, &ret_propvar, 0, 0), "got wrong property.\n"); @@ -777,6 +777,9 @@ static void test_IMFAttributes_item(void) todo_wine ok(!PropVariantCompareEx(&propvar, &ret_propvar, 0, 0), "got wrong property.\n"); todo_wine ok(IsEqualIID(&key, &DUMMY_GUID1), "got wrong key: %s.\n", wine_dbgstr_guid(&key));
+ hr = IMFAttributes_DeleteItem(attributes, &DUMMY_GUID2); + ok(hr == S_OK, "IMFAttributes_DeleteItem failed: 0x%08x.\n", hr); + IMFAttributes_Release(attributes); }