From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/wintypes/main.c | 34 +++++++++++++++++++++++++++++++++- dlls/wintypes/tests/wintypes.c | 5 ++++- 2 files changed, 37 insertions(+), 2 deletions(-)
diff --git a/dlls/wintypes/main.c b/dlls/wintypes/main.c index 41d58e08b29..5b48851e8c7 100644 --- a/dlls/wintypes/main.c +++ b/dlls/wintypes/main.c @@ -403,6 +403,7 @@ struct property_value IReference_boolean boolean_iface; IReference_FLOAT float_iface; IReference_DOUBLE double_iface; + IReference_GUID guid_iface; IReference_HSTRING hstring_iface; } irefs; PropertyType type; @@ -496,6 +497,12 @@ static HRESULT STDMETHODCALLTYPE property_value_QueryInterface(IPropertyValue *i *out = &impl->irefs.double_iface; return S_OK; } + else if (IsEqualIID(riid, &IID_IReference_GUID) && impl->type == PropertyType_Guid) + { + IReference_GUID_AddRef(&impl->irefs.guid_iface); + *out = &impl->irefs.guid_iface; + return S_OK; + } else if (IsEqualIID(riid, &IID_IReference_HSTRING) && impl->type == PropertyType_String) { IReference_HSTRING_AddRef(&impl->irefs.hstring_iface); @@ -1043,6 +1050,31 @@ static const struct IReference_DOUBLEVtbl iref_double_vtbl = iref_double_get_Value, };
+DEFINE_IINSPECTABLE_(iref_guid, IReference_GUID, struct property_value, + impl_from_IReference_GUID, irefs.guid_iface, &impl->IPropertyValue_iface); + +static HRESULT STDMETHODCALLTYPE iref_guid_get_Value(IReference_GUID *iface, GUID *value) +{ + struct property_value *impl = impl_from_IReference_GUID(iface); + + TRACE("iface %p, value %p.\n", iface, value); + + return property_value_GetGuid(&impl->IPropertyValue_iface, value); +} + +static const struct IReference_GUIDVtbl iref_guid_vtbl = +{ + iref_guid_QueryInterface, + iref_guid_AddRef, + iref_guid_Release, + /* IInspectable methods */ + iref_guid_GetIids, + iref_guid_GetRuntimeClassName, + iref_guid_GetTrustLevel, + /* IReference<GUID> methods */ + iref_guid_get_Value, +}; + DEFINE_IINSPECTABLE(property_value_statics, IPropertyValueStatics, struct property_value_statics, IActivationFactory_iface)
static HRESULT STDMETHODCALLTYPE property_value_statics_CreateEmpty(IPropertyValueStatics *iface, @@ -1152,7 +1184,7 @@ static HRESULT STDMETHODCALLTYPE property_value_statics_CreateGuid(IPropertyValu GUID value, IInspectable **property_value) { TRACE("iface %p, value %s, property_value %p.\n", iface, wine_dbgstr_guid(&value), property_value); - return create_primitive_property_value(PropertyType_Guid); + create_primitive_property_value_iref(PropertyType_Guid, irefs.guid_iface.lpVtbl, iref_guid_vtbl); }
static HRESULT STDMETHODCALLTYPE property_value_statics_CreateDateTime(IPropertyValueStatics *iface, diff --git a/dlls/wintypes/tests/wintypes.c b/dlls/wintypes/tests/wintypes.c index acf1e949787..4f5541858df 100644 --- a/dlls/wintypes/tests/wintypes.c +++ b/dlls/wintypes/tests/wintypes.c @@ -742,6 +742,7 @@ static void test_IPropertyValueStatics(void) IReference_HSTRING *iref_hstring; IReference_FLOAT *iref_float; IReference_DOUBLE *iref_double; + IReference_GUID *iref_guid; IPropertyValue *value = NULL; enum PropertyType type; unsigned int i, count; @@ -750,6 +751,7 @@ static void test_IPropertyValueStatics(void) UINT32 ret_uint32; FLOAT ret_float; DOUBLE ret_double; + GUID ret_guid; boolean ret; HRESULT hr;
@@ -994,7 +996,7 @@ static void test_IPropertyValueStatics(void) \ hr = IFACE_TYPE##_get_Value(RET_OBJ, &RET_VALUE); \ ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); \ - ok(RET_VALUE == VALUE, "Got unexpected value.\n"); \ + ok(!memcmp(&RET_VALUE, &VALUE, sizeof(VALUE)), "Got unexpected value.\n"); \ \ IFACE_TYPE##_Release(RET_OBJ); \ IPropertyValue_Release(value); \ @@ -1007,6 +1009,7 @@ static void test_IPropertyValueStatics(void) TEST_PROPERTY_VALUE_IREFERENCE(String, IReference_HSTRING, str, iref_hstring, ret_str) TEST_PROPERTY_VALUE_IREFERENCE(Single, IReference_FLOAT, float_value, iref_float, ret_float) TEST_PROPERTY_VALUE_IREFERENCE(Double, IReference_DOUBLE, double_value, iref_double, ret_double) + TEST_PROPERTY_VALUE_IREFERENCE(Guid, IReference_GUID, IID_IPropertyValue, iref_guid, ret_guid)
#undef TEST_PROPERTY_VALUE_IREFERENCE