From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/iertutil/main.c | 232 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 230 insertions(+), 2 deletions(-)
diff --git a/dlls/iertutil/main.c b/dlls/iertutil/main.c index c0c5f96db43..9a63cfadf84 100644 --- a/dlls/iertutil/main.c +++ b/dlls/iertutil/main.c @@ -20,6 +20,214 @@
WINE_DEFAULT_DEBUG_CHANNEL(iertutil);
+struct uri +{ + IUriRuntimeClass IUriRuntimeClass_iface; + HSTRING raw_uri; + LONG ref; +}; + +static inline struct uri *impl_from_IUriRuntimeClass(IUriRuntimeClass *iface) +{ + return CONTAINING_RECORD(iface, struct uri, IUriRuntimeClass_iface); +} + +static HRESULT STDMETHODCALLTYPE uri_QueryInterface(IUriRuntimeClass *iface, REFIID iid, void **out) +{ + 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_IUriRuntimeClass)) + { + IUnknown_AddRef(iface); + *out = iface; + return S_OK; + } + + FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG STDMETHODCALLTYPE uri_AddRef(IUriRuntimeClass *iface) +{ + struct uri *impl = impl_from_IUriRuntimeClass(iface); + ULONG ref = InterlockedIncrement(&impl->ref); + TRACE("iface %p, ref %lu.\n", iface, ref); + return ref; +} + +static ULONG STDMETHODCALLTYPE uri_Release(IUriRuntimeClass *iface) +{ + struct uri *impl = impl_from_IUriRuntimeClass(iface); + ULONG ref = InterlockedDecrement(&impl->ref); + + TRACE("iface %p, ref %lu.\n", iface, ref); + + if (!ref) + { + WindowsDeleteString(impl->raw_uri); + free(impl); + } + + return ref; +} + +static HRESULT STDMETHODCALLTYPE uri_GetIids(IUriRuntimeClass *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 uri_GetRuntimeClassName(IUriRuntimeClass *iface, + HSTRING *class_name) +{ + FIXME("iface %p, class_name %p stub!\n", iface, class_name); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE uri_GetTrustLevel(IUriRuntimeClass *iface, TrustLevel *trust_level) +{ + FIXME("iface %p, trust_level %p stub!\n", iface, trust_level); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE uri_AbsoluteUri(IUriRuntimeClass *iface, HSTRING *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE uri_DisplayUri(IUriRuntimeClass *iface, HSTRING *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE uri_Domain(IUriRuntimeClass *iface, HSTRING *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE uri_Extension(IUriRuntimeClass *iface, HSTRING *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE uri_Fragment(IUriRuntimeClass *iface, HSTRING *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE uri_Host(IUriRuntimeClass *iface, HSTRING *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE uri_Password(IUriRuntimeClass *iface, HSTRING *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE uri_Path(IUriRuntimeClass *iface, HSTRING *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE uri_Query(IUriRuntimeClass *iface, HSTRING *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE uri_QueryParsed(IUriRuntimeClass *iface, + IWwwFormUrlDecoderRuntimeClass **decoder) +{ + FIXME("iface %p, decoder %p stub!\n", iface, decoder); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE uri_RawUri(IUriRuntimeClass *iface, HSTRING *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE uri_SchemeName(IUriRuntimeClass *iface, HSTRING *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE uri_UserName(IUriRuntimeClass *iface, HSTRING *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE uri_Port(IUriRuntimeClass *iface, INT32 *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE uri_Suspicious(IUriRuntimeClass *iface, boolean *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE uri_Equals(IUriRuntimeClass *iface, IUriRuntimeClass *uri, + boolean *value) +{ + FIXME("iface %p, uri %p, value %p stub!\n", iface, uri, value); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE uri_CombineUri(IUriRuntimeClass *iface, HSTRING relative_uri, + IUriRuntimeClass **instance) +{ + FIXME("iface %p, relative_uri %s, instance %p stub!\n", iface, debugstr_hstring(relative_uri), instance); + return E_NOTIMPL; +} + +static const struct IUriRuntimeClassVtbl uri_vtbl = +{ + uri_QueryInterface, + uri_AddRef, + uri_Release, + /* IInspectable methods */ + uri_GetIids, + uri_GetRuntimeClassName, + uri_GetTrustLevel, + /* IUriRuntimeClass methods */ + uri_AbsoluteUri, + uri_DisplayUri, + uri_Domain, + uri_Extension, + uri_Fragment, + uri_Host, + uri_Password, + uri_Path, + uri_Query, + uri_QueryParsed, + uri_RawUri, + uri_SchemeName, + uri_UserName, + uri_Port, + uri_Suspicious, + uri_Equals, + uri_CombineUri, +}; + struct iertutil { IActivationFactory IActivationFactory_iface; @@ -122,8 +330,28 @@ DEFINE_IINSPECTABLE(uri_factory, IUriRuntimeClassFactory, struct iertutil, IActi static HRESULT STDMETHODCALLTYPE uri_factory_CreateUri(IUriRuntimeClassFactory *iface, HSTRING uri, IUriRuntimeClass **instance) { - FIXME("iface %p, uri %s, instance %p stub!\n", iface, debugstr_hstring(uri), instance); - return E_NOTIMPL; + const WCHAR *raw_buffer; + struct uri *uri_impl; + + FIXME("iface %p, uri %s, instance %p semi-stub!\n", iface, debugstr_hstring(uri), instance); + + if (!uri) + return E_POINTER; + + uri_impl = calloc(1, sizeof(*uri_impl)); + if (!uri_impl) + return E_OUTOFMEMORY; + + uri_impl->IUriRuntimeClass_iface.lpVtbl = &uri_vtbl; + uri_impl->ref = 1; + + raw_buffer = WindowsGetStringRawBuffer(uri, NULL); + WindowsCreateString(raw_buffer, wcslen(raw_buffer), &uri_impl->raw_uri); + + /* TODO: Parse the URI according to RFC 3986 and RFC 3987 */ + + *instance = &uri_impl->IUriRuntimeClass_iface; + return S_OK; }
static HRESULT STDMETHODCALLTYPE uri_factory_CreateWithRelativeUri(IUriRuntimeClassFactory *iface,