From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/wintypes/main.c | 36 ++++++++++++++++++++++++++++++++-- dlls/wintypes/tests/wintypes.c | 3 +++ 2 files changed, 37 insertions(+), 2 deletions(-)
diff --git a/dlls/wintypes/main.c b/dlls/wintypes/main.c index e5ed6d3b335..c27d8964d80 100644 --- a/dlls/wintypes/main.c +++ b/dlls/wintypes/main.c @@ -1,5 +1,5 @@ /* - * Copyright 2022-2024 Zhiyi Zhang for CodeWeavers + * Copyright 2022-2025 Zhiyi Zhang for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -398,6 +398,7 @@ struct property_value IPropertyValue IPropertyValue_iface; union { + IReference_UINT32 uint32_iface; IReference_boolean boolean_iface; IReference_DOUBLE double_iface; IReference_HSTRING hstring_iface; @@ -463,6 +464,12 @@ static HRESULT STDMETHODCALLTYPE property_value_QueryInterface(IPropertyValue *i *out = &impl->IPropertyValue_iface; return S_OK; } + else if (IsEqualIID(riid, &IID_IReference_UINT32) && impl->type == PropertyType_UInt32) + { + IReference_UINT32_AddRef(&impl->irefs.uint32_iface); + *out = &impl->irefs.uint32_iface; + return S_OK; + } else if (IsEqualIID(riid, &IID_IReference_boolean) && impl->type == PropertyType_Boolean) { IReference_boolean_AddRef(&impl->irefs.boolean_iface); @@ -872,6 +879,31 @@ static HRESULT _create_primitive_property_value(PropertyType type, void *value, return hr; \ } while (0)
+DEFINE_IINSPECTABLE_(iref_uint32, IReference_UINT32, struct property_value, + impl_from_IReference_UINT32, irefs.uint32_iface, &impl->IPropertyValue_iface); + +static HRESULT STDMETHODCALLTYPE iref_uint32_get_Value(IReference_UINT32 *iface, UINT32 *value) +{ + struct property_value *impl = impl_from_IReference_UINT32(iface); + + TRACE("iface %p, value %p.\n", iface, value); + + return property_value_GetUInt32(&impl->IPropertyValue_iface, value); +} + +static const struct IReference_UINT32Vtbl iref_uint32_vtbl = +{ + iref_uint32_QueryInterface, + iref_uint32_AddRef, + iref_uint32_Release, + /* IInspectable methods */ + iref_uint32_GetIids, + iref_uint32_GetRuntimeClassName, + iref_uint32_GetTrustLevel, + /* IReference<UINT32> methods */ + iref_uint32_get_Value, +}; + DEFINE_IINSPECTABLE_(iref_boolean, IReference_boolean, struct property_value, impl_from_IReference_boolean, irefs.boolean_iface, &impl->IPropertyValue_iface);
@@ -993,7 +1025,7 @@ static HRESULT STDMETHODCALLTYPE property_value_statics_CreateUInt32(IPropertyVa UINT32 value, IInspectable **property_value) { TRACE("iface %p, value %u, property_value %p.\n", iface, value, property_value); - return create_primitive_property_value(PropertyType_UInt32); + create_primitive_property_value_iref(PropertyType_UInt32, irefs.uint32_iface.lpVtbl, iref_uint32_vtbl); }
static HRESULT STDMETHODCALLTYPE property_value_statics_CreateInt64(IPropertyValueStatics *iface, diff --git a/dlls/wintypes/tests/wintypes.c b/dlls/wintypes/tests/wintypes.c index 5ec536b49f8..a0d293c692e 100644 --- a/dlls/wintypes/tests/wintypes.c +++ b/dlls/wintypes/tests/wintypes.c @@ -736,6 +736,7 @@ static void test_IPropertyValueStatics(void) IInspectable *inspectable = NULL, *tmp_inspectable = NULL; IPropertyValueStatics *statics = NULL; IActivationFactory *factory = NULL; + IReference_UINT32 *iref_uint32; IReference_boolean *iref_boolean; IReference_HSTRING *iref_hstring; IReference_DOUBLE *iref_double; @@ -744,6 +745,7 @@ static void test_IPropertyValueStatics(void) unsigned int i, count; BYTE byte, *ptr_byte; HSTRING str, ret_str; + UINT32 ret_uint32; DOUBLE ret_double; boolean ret; HRESULT hr; @@ -996,6 +998,7 @@ static void test_IPropertyValueStatics(void) IInspectable_Release(inspectable); \ } while (0);
+ TEST_PROPERTY_VALUE_IREFERENCE(UInt32, IReference_UINT32, uint32_value, iref_uint32, ret_uint32) TEST_PROPERTY_VALUE_IREFERENCE(Boolean, IReference_boolean, boolean_value, iref_boolean, ret) TEST_PROPERTY_VALUE_IREFERENCE(String, IReference_HSTRING, str, iref_hstring, ret_str) TEST_PROPERTY_VALUE_IREFERENCE(Double, IReference_DOUBLE, double_value, iref_double, ret_double)