From: Helix Graziani helix.graziani@hotmail.com
--- dlls/windows.globalization/main.c | 112 ++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+)
diff --git a/dlls/windows.globalization/main.c b/dlls/windows.globalization/main.c index 7f9594ccc6a..324e0a42291 100644 --- a/dlls/windows.globalization/main.c +++ b/dlls/windows.globalization/main.c @@ -22,9 +22,114 @@
WINE_DEFAULT_DEBUG_CHANNEL(locale);
+struct hstring_iterable { + IIterable_HSTRING IIterable_HSTRING_iface; + LONG ref; +}; + +static inline struct hstring_iterable *impl_from_IIterable_HSTRING(IIterable_HSTRING *iface) +{ + return CONTAINING_RECORD(iface, struct hstring_iterable, IIterable_HSTRING_iface); +} + +static HRESULT STDMETHODCALLTYPE hstring_iterable_QueryInterface(IIterable_HSTRING *iface, + REFIID iid, void **out) +{ + struct hstring_iterable *impl = impl_from_IIterable_HSTRING(iface); + TRACE("iface %p, iid %s, out %p stub!\n", iface, debugstr_guid(iid), out); + + if (IsEqualGUID(iid, &IID_IUnknown) || + IsEqualGUID(iid, &IID_IInspectable) || + IsEqualGUID(iid, &IID_IAgileObject) || + IsEqualGUID(iid, &IID_IIterable_HSTRING)) + { + IUnknown_AddRef(iface); + *out = &impl->IIterable_HSTRING_iface; + return S_OK; + } + + FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG STDMETHODCALLTYPE hstring_iterable_AddRef(IIterable_HSTRING *iface) +{ + struct hstring_iterable *impl = impl_from_IIterable_HSTRING(iface); + ULONG ref = InterlockedIncrement(&impl->ref); + TRACE("iface %p, ref %lu.\n", iface, ref); + return ref; +} + +static ULONG STDMETHODCALLTYPE hstring_iterable_Release(IIterable_HSTRING *iface) +{ + struct hstring_iterable *impl = impl_from_IIterable_HSTRING(iface); + ULONG ref = InterlockedDecrement(&impl->ref); + TRACE("iface %p, ref %lu.\n", iface, ref); + if (ref == 0) + { + free(impl); + } + return ref; +} + +static HRESULT STDMETHODCALLTYPE hstring_iterable_GetIids(IIterable_HSTRING *iface, + ULONG *iid_count, IID **iids) +{ + FIXME("iface %p, iid_count %p, iids %p stub!\n", iface, iid_count, iids); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE hstring_iterable_GetRuntimeClassName(IIterable_HSTRING *iface, + HSTRING *class_name) +{ + FIXME("iface %p, class_name %p stub!\n", iface, class_name); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE hstring_iterable_GetTrustLevel(IIterable_HSTRING *iface, + TrustLevel *trust_level) +{ + FIXME("iface %p, trust_level %p stub!\n", iface, trust_level); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE hstring_iterable_First(IIterable_HSTRING *iface, + IIterator_HSTRING **value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + return E_NOTIMPL; +} + +static const struct IIterable_HSTRINGVtbl hstring_iterable_vtbl = { + hstring_iterable_QueryInterface, + hstring_iterable_AddRef, + hstring_iterable_Release, + /* IInspectable methods */ + hstring_iterable_GetIids, + hstring_iterable_GetRuntimeClassName, + hstring_iterable_GetTrustLevel, + /* IIterable<HSTRING> methods */ + hstring_iterable_First, +}; + +static HRESULT hstring_iterable_create(void **out) +{ + struct hstring_iterable *impl; + + if (!(impl = malloc(sizeof(struct hstring_iterable)))) return E_OUTOFMEMORY; + impl->ref = 1; + + impl->IIterable_HSTRING_iface.lpVtbl = &hstring_iterable_vtbl; + + *out = &impl->IIterable_HSTRING_iface; + return S_OK; +} + struct hstring_vector { IVectorView_HSTRING IVectorView_HSTRING_iface; + IIterable_HSTRING IIterable_HSTRING_iface; LONG ref;
ULONG count; @@ -54,6 +159,13 @@ static HRESULT STDMETHODCALLTYPE hstring_vector_QueryInterface(IVectorView_HSTRI return S_OK; }
+ if (IsEqualGUID(iid, &IID_IIterable_HSTRING)) + { + IUnknown_AddRef(iface); + hstring_iterable_create(out); + return S_OK; + } + FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); *out = NULL; return E_NOINTERFACE;