Signed-off-by: Jactry Zeng jzeng@codeweavers.com --- dlls/mfplat/Makefile.in | 2 +- dlls/mfplat/main.c | 60 +++++++++++++++++++++++++++++++++----- dlls/mfplat/tests/mfplat.c | 28 ++++++++++++++++-- 3 files changed, 79 insertions(+), 11 deletions(-)
diff --git a/dlls/mfplat/Makefile.in b/dlls/mfplat/Makefile.in index a117ede271..4ec51e300e 100644 --- a/dlls/mfplat/Makefile.in +++ b/dlls/mfplat/Makefile.in @@ -1,6 +1,6 @@ MODULE = mfplat.dll IMPORTLIB = mfplat -IMPORTS = advapi32 ole32 +IMPORTS = advapi32 ole32 propsys
C_SRCS = \ buffer.c \ diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index 5ae3b4ff07..1749bd6929 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -33,6 +33,7 @@ #include "wine/list.h"
#include "mfplat_private.h" +#include "propvarutil.h"
WINE_DEFAULT_DEBUG_CHANNEL(mfplat);
@@ -649,22 +650,59 @@ static HRESULT WINAPI mfattributes_Compare(IMFAttributes *iface, IMFAttributes * return E_NOTIMPL; }
+static HRESULT mfattributes_get_item(mfattributes *object, REFGUID key, PROPVARIANT *value) +{ + HRESULT hr; + struct mfattribute *attribute = NULL; + + EnterCriticalSection(&object->lock); + + attribute = mfattributes_find_item(object, key, NULL); + if (!attribute) + hr = MF_E_ATTRIBUTENOTFOUND; + else + { + if (attribute->value.vt != value->vt) + hr = MF_E_INVALIDTYPE; + else + hr = PropVariantCopy(value, &attribute->value); + } + + LeaveCriticalSection(&object->lock); + + return hr; +} + static HRESULT WINAPI mfattributes_GetUINT32(IMFAttributes *iface, REFGUID key, UINT32 *value) { mfattributes *This = impl_from_IMFAttributes(iface); + PROPVARIANT attrval; + HRESULT hr;
- FIXME("%p, %s, %p\n", This, debugstr_guid(key), value); + TRACE("(%p, %s, %p)\n", This, debugstr_guid(key), value);
- return E_NOTIMPL; + PropVariantInit(&attrval); + attrval.vt = VT_UI4; + hr = mfattributes_get_item(This, key, &attrval); + if (SUCCEEDED(hr)) + hr = PropVariantToUInt32(&attrval, value); + return hr; }
static HRESULT WINAPI mfattributes_GetUINT64(IMFAttributes *iface, REFGUID key, UINT64 *value) { mfattributes *This = impl_from_IMFAttributes(iface); + PROPVARIANT attrval; + HRESULT hr;
- FIXME("%p, %s, %p\n", This, debugstr_guid(key), value); + TRACE("(%p, %s, %p)\n", This, debugstr_guid(key), value);
- return E_NOTIMPL; + PropVariantInit(&attrval); + attrval.vt = VT_UI8; + hr = mfattributes_get_item(This, key, &attrval); + if (SUCCEEDED(hr)) + hr = PropVariantToUInt64(&attrval, value); + return hr; }
static HRESULT WINAPI mfattributes_GetDouble(IMFAttributes *iface, REFGUID key, double *value) @@ -855,19 +893,25 @@ static HRESULT WINAPI mfattributes_DeleteAllItems(IMFAttributes *iface) static HRESULT WINAPI mfattributes_SetUINT32(IMFAttributes *iface, REFGUID key, UINT32 value) { mfattributes *This = impl_from_IMFAttributes(iface); + PROPVARIANT attrval;
- FIXME("%p, %s, %d\n", This, debugstr_guid(key), value); + TRACE("(%p, %s, %d)\n", This, debugstr_guid(key), value);
- return E_NOTIMPL; + attrval.vt = VT_UI4; + attrval.ulVal = value; + return mfattributes_set_item(This, key, &attrval); }
static HRESULT WINAPI mfattributes_SetUINT64(IMFAttributes *iface, REFGUID key, UINT64 value) { mfattributes *This = impl_from_IMFAttributes(iface); + PROPVARIANT attrval;
- FIXME("%p, %s, %s\n", This, debugstr_guid(key), wine_dbgstr_longlong(value)); + TRACE("(%p, %s, %s)\n", This, debugstr_guid(key), wine_dbgstr_longlong(value));
- return E_NOTIMPL; + attrval.vt = VT_UI8; + attrval.uhVal.QuadPart = value; + return mfattributes_set_item(This, key, &attrval); }
static HRESULT WINAPI mfattributes_SetDouble(IMFAttributes *iface, REFGUID key, double value) diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index ea70b4bf5f..55c9f516c3 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -423,6 +423,8 @@ static void test_MFCreateAttributes(void) UINT32 count; PROPVARIANT propvar, ret_propvar; GUID key; + UINT32 uint32_value; + UINT64 uint64_value;
hr = MFCreateAttributes( &attributes, 3 ); ok(hr == S_OK, "got 0x%08x\n", hr); @@ -432,13 +434,35 @@ static void test_MFCreateAttributes(void) todo_wine ok(hr == S_OK, "got 0x%08x\n", hr); ok(count == 0, "got %d\n", count);
- hr = IMFAttributes_SetUINT32(attributes, &MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS, 0); - todo_wine ok(hr == S_OK, "got 0x%08x\n", hr); + hr = IMFAttributes_SetUINT32(attributes, &MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS, 123); + ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IMFAttributes_GetCount(attributes, &count); todo_wine ok(hr == S_OK, "got 0x%08x\n", hr); todo_wine ok(count == 1, "got %d\n", count);
+ uint32_value = 0xdeadbeef; + hr = IMFAttributes_GetUINT32(attributes, &MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS, &uint32_value); + ok(hr == S_OK, "IMFAttributes_GetUINT32 failed: 0x%08x.\n", hr); + ok(uint32_value == 123, "got wrong value: %d, expected: 123.\n", uint32_value); + + uint64_value = 0xdeadbeef; + hr = IMFAttributes_GetUINT64(attributes, &MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS, &uint64_value); + ok(hr == MF_E_INVALIDTYPE, "IMFAttributes_GetUINT64 should fail: 0x%08x.\n", hr); + ok(uint64_value == 0xdeadbeef, "got wrong value: %lld, expected: 0xdeadbeef.\n", uint64_value); + + hr = IMFAttributes_SetUINT64(attributes, &MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS, 65536); + ok(hr == S_OK, "IMFAttributes_SetUINT64 failed: 0x%08x.\n", hr); + + hr = IMFAttributes_GetUINT64(attributes, &MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS, &uint64_value); + ok(hr == S_OK, "IMFAttributes_GetUINT64 failed: 0x%08x.\n", hr); + ok(uint64_value == 65536, "got wrong value: %lld, expected: 65536.\n", uint64_value); + + uint32_value = 0xdeadbeef; + hr = IMFAttributes_GetUINT32(attributes, &MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS, &uint32_value); + ok(hr == MF_E_INVALIDTYPE, "IMFAttributes_GetUINT32 should fail: 0x%08x.\n", hr); + ok(uint32_value == 0xdeadbeef, "got wrong value: %d, expected: 0xdeadbeef.\n", uint32_value); + IMFAttributes_Release(attributes);
hr = MFCreateAttributes(&attributes, 0);
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=48958
Your paranoid android.
=== wxppro (32 bit report) ===
mfplat: 0b40:mfplat: unhandled exception c0000005 at 0BF0B786
Report errors: mfplat:mfplat returned success despite having failures