From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/wintypes/main.c | 34 +++++++++++++++++++++++++++++- dlls/wintypes/wintypes_private.idl | 10 +++++++++ 2 files changed, 43 insertions(+), 1 deletion(-)
diff --git a/dlls/wintypes/main.c b/dlls/wintypes/main.c index 1a61caccc1b..8497be1564e 100644 --- a/dlls/wintypes/main.c +++ b/dlls/wintypes/main.c @@ -317,6 +317,7 @@ struct property_value union { IReference_boolean boolean_iface; + IReference_HSTRING hstring_iface; } irefs; PropertyType type; unsigned int value_size; @@ -385,6 +386,12 @@ static HRESULT STDMETHODCALLTYPE property_value_QueryInterface(IPropertyValue *i *out = &impl->irefs.boolean_iface; return S_OK; } + else if (IsEqualIID(riid, &IID_IReference_HSTRING) && impl->type == PropertyType_String) + { + IReference_HSTRING_AddRef(&impl->irefs.hstring_iface); + *out = &impl->irefs.hstring_iface; + return S_OK; + }
FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid)); *out = NULL; @@ -801,6 +808,31 @@ static const struct IReference_booleanVtbl iref_boolean_vtbl = iref_boolean_get_Value, };
+DEFINE_IINSPECTABLE_(iref_hstring, IReference_HSTRING, struct property_value, + impl_from_IReference_HSTRING, irefs.hstring_iface, &impl->IPropertyValue_iface); + +static HRESULT STDMETHODCALLTYPE iref_hstring_get_Value(IReference_HSTRING *iface, HSTRING *value) +{ + struct property_value *impl = impl_from_IReference_HSTRING(iface); + + TRACE("iface %p, value %p.\n", iface, value); + + return property_value_GetString(&impl->IPropertyValue_iface, value); +} + +static const struct IReference_HSTRINGVtbl iref_hstring_vtbl = +{ + iref_hstring_QueryInterface, + iref_hstring_AddRef, + iref_hstring_Release, + /* IInspectable methods */ + iref_hstring_GetIids, + iref_hstring_GetRuntimeClassName, + iref_hstring_GetTrustLevel, + /* IReference<HSTRING> methods */ + iref_hstring_get_Value, +}; + DEFINE_IINSPECTABLE(property_value_statics, IPropertyValueStatics, struct wintypes, IActivationFactory_iface)
static HRESULT STDMETHODCALLTYPE property_value_statics_CreateEmpty(IPropertyValueStatics *iface, @@ -896,7 +928,7 @@ static HRESULT STDMETHODCALLTYPE property_value_statics_CreateString(IPropertyVa HSTRING value, IInspectable **property_value) { TRACE("iface %p, value %s, property_value %p.\n", iface, debugstr_hstring(value), property_value); - return create_primitive_property_value(PropertyType_String); + create_primitive_property_value_iref(PropertyType_String, irefs.hstring_iface.lpVtbl, iref_hstring_vtbl); }
static HRESULT STDMETHODCALLTYPE property_value_statics_CreateInspectable(IPropertyValueStatics *iface, diff --git a/dlls/wintypes/wintypes_private.idl b/dlls/wintypes/wintypes_private.idl index 87ccd81c228..b0d7b7d2241 100644 --- a/dlls/wintypes/wintypes_private.idl +++ b/dlls/wintypes/wintypes_private.idl @@ -18,6 +18,16 @@
#pragma makedep header
+#ifdef __WIDL__ +#pragma winrt ns_prefix +#endif + +import "windows.foundation.idl"; + +declare { + interface Windows.Foundation.IReference<HSTRING>; +} + cpp_quote("#define DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from, iface_mem, expr ) \") cpp_quote(" static inline impl_type *impl_from( iface_type *iface ) \") cpp_quote(" { \")