Signed-off-by: Jactry Zeng jzeng@codeweavers.com --- dlls/mfplat/main.c | 16 ++++++++++++++-- dlls/mfplat/tests/mfplat.c | 15 +++++++++------ 2 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index f897325502..06a49b237f 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -903,9 +903,21 @@ static HRESULT WINAPI mfattributes_GetItemByIndex(IMFAttributes *iface, UINT32 i { mfattributes *This = impl_from_IMFAttributes(iface);
- FIXME("%p, %d, %p, %p\n", This, index, key, value); + TRACE("(%p, %d, %p, %p)\n", This, index, key, value);
- return E_NOTIMPL; + EnterCriticalSection(&This->lock); + + if(index >= This->count) + { + LeaveCriticalSection(&This->lock); + return E_INVALIDARG; + } + *key = This->attributes[This->count - index - 1]->key; + PropVariantCopy(value, &This->attributes[This->count - index - 1]->value); + + LeaveCriticalSection(&This->lock); + + return S_OK; }
static HRESULT WINAPI mfattributes_CopyAllItems(IMFAttributes *iface, IMFAttributes *dest) diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 5dcb641486..7f7f413096 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -765,21 +765,24 @@ static void test_IMFAttributes_item(void) hr = IMFAttributes_DeleteItem(attributes, &DUMMY_GUID2); 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"); - todo_wine ok(IsEqualIID(&key, &DUMMY_GUID3), "got wrong key: %s.\n", wine_dbgstr_guid(&key)); + ok(hr == S_OK, "IMFAttributes_GetItemByIndex failed: 0x%08x.\n", hr); + ok(!PropVariantCompareEx(&propvar, &ret_propvar, 0, 0), "got wrong property.\n"); + ok(IsEqualIID(&key, &DUMMY_GUID3), "got wrong key: %s.\n", wine_dbgstr_guid(&key)); PropVariantClear(&ret_propvar); PropVariantClear(&propvar); propvar.vt = MF_ATTRIBUTE_UINT64; U(propvar).uhVal.QuadPart = 65536; hr = IMFAttributes_GetItemByIndex(attributes, 1, &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"); - todo_wine ok(IsEqualIID(&key, &DUMMY_GUID1), "got wrong key: %s.\n", wine_dbgstr_guid(&key)); + ok(hr == S_OK, "IMFAttributes_GetItemByIndex failed: 0x%08x.\n", hr); + ok(!PropVariantCompareEx(&propvar, &ret_propvar, 0, 0), "got wrong property.\n"); + 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);
+ hr = IMFAttributes_GetItemByIndex(attributes, 2, &key, &ret_propvar); + ok(hr == E_INVALIDARG, "IMFAttributes_GetItemByIndex should fail: 0x%08x.\n", hr); + IMFAttributes_Release(attributes); }
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=46064
Your paranoid android.
=== wxppro (32 bit report) ===
mfplat: mfplat.c:769: Test failed: got wrong property. mfplat.c:770: Test failed: got wrong key: {12345678-1234-1234-2121-212121212121}. mfplat.c:777: Test failed: got wrong property. mfplat.c:778: Test failed: got wrong key: {12345678-1234-1234-2323-232323232323}.
=== wvistau64 (32 bit report) ===
mfplat: mfplat.c:769: Test failed: got wrong property. mfplat.c:770: Test failed: got wrong key: {12345678-1234-1234-2121-212121212121}. mfplat.c:777: Test failed: got wrong property. mfplat.c:778: Test failed: got wrong key: {12345678-1234-1234-2323-232323232323}.
=== wvistau64_zh_CN (32 bit report) ===
mfplat: mfplat.c:769: Test failed: got wrong property. mfplat.c:770: Test failed: got wrong key: {12345678-1234-1234-2121-212121212121}. mfplat.c:777: Test failed: got wrong property. mfplat.c:778: Test failed: got wrong key: {12345678-1234-1234-2323-232323232323}.
=== wvistau64_fr (32 bit report) ===
mfplat: mfplat.c:769: Test failed: got wrong property. mfplat.c:770: Test failed: got wrong key: {12345678-1234-1234-2121-212121212121}. mfplat.c:777: Test failed: got wrong property. mfplat.c:778: Test failed: got wrong key: {12345678-1234-1234-2323-232323232323}.
=== wvistau64_he (32 bit report) ===
mfplat: mfplat.c:769: Test failed: got wrong property. mfplat.c:770: Test failed: got wrong key: {12345678-1234-1234-2121-212121212121}. mfplat.c:777: Test failed: got wrong property. mfplat.c:778: Test failed: got wrong key: {12345678-1234-1234-2323-232323232323}.
=== w7u (32 bit report) ===
mfplat: mfplat.c:769: Test failed: got wrong property. mfplat.c:770: Test failed: got wrong key: {12345678-1234-1234-2121-212121212121}. mfplat.c:777: Test failed: got wrong property. mfplat.c:778: Test failed: got wrong key: {12345678-1234-1234-2323-232323232323}.
=== w7pro64 (32 bit report) ===
mfplat: mfplat.c:769: Test failed: got wrong property. mfplat.c:770: Test failed: got wrong key: {12345678-1234-1234-2121-212121212121}. mfplat.c:777: Test failed: got wrong property. mfplat.c:778: Test failed: got wrong key: {12345678-1234-1234-2323-232323232323}.
=== wvistau64 (64 bit report) ===
mfplat: mfplat.c:769: Test failed: got wrong property. mfplat.c:770: Test failed: got wrong key: {12345678-1234-1234-2121-212121212121}. mfplat.c:777: Test failed: got wrong property. mfplat.c:778: Test failed: got wrong key: {12345678-1234-1234-2323-232323232323}.
=== w7pro64 (64 bit report) ===
mfplat: mfplat.c:769: Test failed: got wrong property. mfplat.c:770: Test failed: got wrong key: {12345678-1234-1234-2121-212121212121}. mfplat.c:777: Test failed: got wrong property. mfplat.c:778: Test failed: got wrong key: {12345678-1234-1234-2323-232323232323}.