From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/wintypes/main.c | 34 +++++++++++++++++++++++++++++++++- dlls/wintypes/tests/wintypes.c | 3 +++ 2 files changed, 36 insertions(+), 1 deletion(-)
diff --git a/dlls/wintypes/main.c b/dlls/wintypes/main.c index 5b48851e8c7..eaf5b776bc4 100644 --- a/dlls/wintypes/main.c +++ b/dlls/wintypes/main.c @@ -399,6 +399,7 @@ struct property_value union { IReference_BYTE byte_iface; + IReference_INT16 int16_iface; IReference_UINT32 uint32_iface; IReference_boolean boolean_iface; IReference_FLOAT float_iface; @@ -473,6 +474,12 @@ static HRESULT STDMETHODCALLTYPE property_value_QueryInterface(IPropertyValue *i *out = &impl->irefs.byte_iface; return S_OK; } + else if (IsEqualIID(riid, &IID_IReference_INT16) && impl->type == PropertyType_Int16) + { + IReference_INT16_AddRef(&impl->irefs.int16_iface); + *out = &impl->irefs.int16_iface; + return S_OK; + } else if (IsEqualIID(riid, &IID_IReference_UINT32) && impl->type == PropertyType_UInt32) { IReference_UINT32_AddRef(&impl->irefs.uint32_iface); @@ -925,6 +932,31 @@ static const struct IReference_BYTEVtbl iref_byte_vtbl = iref_byte_get_Value, };
+DEFINE_IINSPECTABLE_(iref_int16, IReference_INT16, struct property_value, + impl_from_IReference_INT16, irefs.int16_iface, &impl->IPropertyValue_iface); + +static HRESULT STDMETHODCALLTYPE iref_int16_get_Value(IReference_INT16 *iface, INT16 *value) +{ + struct property_value *impl = impl_from_IReference_INT16(iface); + + TRACE("iface %p, value %p.\n", iface, value); + + return property_value_GetInt16(&impl->IPropertyValue_iface, value); +} + +static const struct IReference_INT16Vtbl iref_int16_vtbl = +{ + iref_int16_QueryInterface, + iref_int16_AddRef, + iref_int16_Release, + /* IInspectable methods */ + iref_int16_GetIids, + iref_int16_GetRuntimeClassName, + iref_int16_GetTrustLevel, + /* IReference<INT16> methods */ + iref_int16_get_Value, +}; + DEFINE_IINSPECTABLE_(iref_uint32, IReference_UINT32, struct property_value, impl_from_IReference_UINT32, irefs.uint32_iface, &impl->IPropertyValue_iface);
@@ -1100,7 +1132,7 @@ static HRESULT STDMETHODCALLTYPE property_value_statics_CreateInt16(IPropertyVal INT16 value, IInspectable **property_value) { TRACE("iface %p, value %d, property_value %p.\n", iface, value, property_value); - return create_primitive_property_value(PropertyType_Int16); + create_primitive_property_value_iref(PropertyType_Int16, irefs.int16_iface.lpVtbl, iref_int16_vtbl); }
static HRESULT STDMETHODCALLTYPE property_value_statics_CreateUInt16(IPropertyValueStatics *iface, diff --git a/dlls/wintypes/tests/wintypes.c b/dlls/wintypes/tests/wintypes.c index 4f5541858df..baf982b7833 100644 --- a/dlls/wintypes/tests/wintypes.c +++ b/dlls/wintypes/tests/wintypes.c @@ -737,6 +737,7 @@ static void test_IPropertyValueStatics(void) IPropertyValueStatics *statics = NULL; IActivationFactory *factory = NULL; IReference_BYTE *iref_byte; + IReference_INT16 *iref_int16; IReference_UINT32 *iref_uint32; IReference_boolean *iref_boolean; IReference_HSTRING *iref_hstring; @@ -748,6 +749,7 @@ static void test_IPropertyValueStatics(void) unsigned int i, count; BYTE byte, *ptr_byte; HSTRING str, ret_str; + INT16 ret_int16; UINT32 ret_uint32; FLOAT ret_float; DOUBLE ret_double; @@ -1004,6 +1006,7 @@ static void test_IPropertyValueStatics(void) } while (0);
TEST_PROPERTY_VALUE_IREFERENCE(UInt8, IReference_BYTE, byte_value, iref_byte, byte) + TEST_PROPERTY_VALUE_IREFERENCE(Int16, IReference_INT16, int16_value, iref_int16, ret_int16) 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)