From: Zhiyi Zhang zzhang@codeweavers.com
--- configure.ac | 1 + dlls/iertutil/Makefile.in | 6 ++ dlls/iertutil/classes.idl | 28 ++++++ dlls/iertutil/iertutil.spec | 3 + dlls/iertutil/main.c | 172 +++++++++++++++++++++++++++++++++ dlls/iertutil/private.h | 75 ++++++++++++++ dlls/wintypes/classes.idl | 1 + include/windows.foundation.idl | 14 +++ 8 files changed, 300 insertions(+) create mode 100644 dlls/iertutil/Makefile.in create mode 100644 dlls/iertutil/classes.idl create mode 100644 dlls/iertutil/iertutil.spec create mode 100644 dlls/iertutil/main.c create mode 100644 dlls/iertutil/private.h
diff --git a/configure.ac b/configure.ac index f1a951807ec..5ae7890c89a 100644 --- a/configure.ac +++ b/configure.ac @@ -2700,6 +2700,7 @@ WINE_CONFIG_MAKEFILE(dlls/icmp) WINE_CONFIG_MAKEFILE(dlls/ieframe) WINE_CONFIG_MAKEFILE(dlls/ieframe/tests) WINE_CONFIG_MAKEFILE(dlls/ieproxy) +WINE_CONFIG_MAKEFILE(dlls/iertutil) WINE_CONFIG_MAKEFILE(dlls/ifsmgr.vxd,enable_win16) WINE_CONFIG_MAKEFILE(dlls/imaadp32.acm) WINE_CONFIG_MAKEFILE(dlls/imagehlp) diff --git a/dlls/iertutil/Makefile.in b/dlls/iertutil/Makefile.in new file mode 100644 index 00000000000..ba633d5ee72 --- /dev/null +++ b/dlls/iertutil/Makefile.in @@ -0,0 +1,6 @@ +MODULE = iertutil.dll +IMPORTS = combase + +SOURCES = \ + classes.idl \ + main.c diff --git a/dlls/iertutil/classes.idl b/dlls/iertutil/classes.idl new file mode 100644 index 00000000000..7124283e229 --- /dev/null +++ b/dlls/iertutil/classes.idl @@ -0,0 +1,28 @@ +/* + * Runtime Classes for iertutil.dll + * + * Copyright 2024 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 + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#pragma makedep register + +#ifdef __WIDL__ +#pragma winrt ns_prefix +#endif + +#define DO_NO_IMPORTS +#include "windows.foundation.idl" diff --git a/dlls/iertutil/iertutil.spec b/dlls/iertutil/iertutil.spec new file mode 100644 index 00000000000..20a8bfa98ea --- /dev/null +++ b/dlls/iertutil/iertutil.spec @@ -0,0 +1,3 @@ +@ stdcall -private DllCanUnloadNow() +@ stdcall -private DllGetActivationFactory(ptr ptr) +@ stdcall -private DllGetClassObject(ptr ptr ptr) diff --git a/dlls/iertutil/main.c b/dlls/iertutil/main.c new file mode 100644 index 00000000000..c0c5f96db43 --- /dev/null +++ b/dlls/iertutil/main.c @@ -0,0 +1,172 @@ +/* + * Copyright 2024 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 + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(iertutil); + +struct iertutil +{ + IActivationFactory IActivationFactory_iface; + IUriRuntimeClassFactory IUriRuntimeClassFactory_iface; + LONG ref; +}; + +static inline struct iertutil *impl_from_IActivationFactory(IActivationFactory *iface) +{ + return CONTAINING_RECORD(iface, struct iertutil, IActivationFactory_iface); +} + +static HRESULT STDMETHODCALLTYPE iertutil_QueryInterface(IActivationFactory *iface, REFIID iid, + void **out) +{ + struct iertutil *impl = impl_from_IActivationFactory(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_IActivationFactory)) + { + IUnknown_AddRef(iface); + *out = iface; + return S_OK; + } + else if (IsEqualGUID(iid, &IID_IUriRuntimeClassFactory)) + { + IUriRuntimeClassFactory_AddRef(&impl->IUriRuntimeClassFactory_iface); + *out = &impl->IUriRuntimeClassFactory_iface; + return S_OK; + } + + FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG STDMETHODCALLTYPE iertutil_AddRef(IActivationFactory *iface) +{ + struct iertutil *impl = impl_from_IActivationFactory(iface); + ULONG ref = InterlockedIncrement(&impl->ref); + TRACE("iface %p, ref %lu.\n", iface, ref); + return ref; +} + +static ULONG STDMETHODCALLTYPE iertutil_Release(IActivationFactory *iface) +{ + struct iertutil *impl = impl_from_IActivationFactory(iface); + ULONG ref = InterlockedDecrement(&impl->ref); + TRACE("iface %p, ref %lu.\n", iface, ref); + return ref; +} + +static HRESULT STDMETHODCALLTYPE iertutil_GetIids(IActivationFactory *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 iertutil_GetRuntimeClassName(IActivationFactory *iface, + HSTRING *class_name) +{ + FIXME("iface %p, class_name %p stub!\n", iface, class_name); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE iertutil_GetTrustLevel(IActivationFactory *iface, + TrustLevel *trust_level) +{ + FIXME("iface %p, trust_level %p stub!\n", iface, trust_level); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE iertutil_ActivateInstance(IActivationFactory *iface, + IInspectable **instance) +{ + FIXME("iface %p, instance %p stub!\n", iface, instance); + return E_NOTIMPL; +} + +static const struct IActivationFactoryVtbl activation_factory_vtbl = +{ + iertutil_QueryInterface, + iertutil_AddRef, + iertutil_Release, + /* IInspectable methods */ + iertutil_GetIids, + iertutil_GetRuntimeClassName, + iertutil_GetTrustLevel, + /* IActivationFactory methods */ + iertutil_ActivateInstance, +}; + +DEFINE_IINSPECTABLE(uri_factory, IUriRuntimeClassFactory, struct iertutil, IActivationFactory_iface) + +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; +} + +static HRESULT STDMETHODCALLTYPE uri_factory_CreateWithRelativeUri(IUriRuntimeClassFactory *iface, + HSTRING base_uri, + HSTRING relative_uri, + IUriRuntimeClass **instance) +{ + FIXME("iface %p, base_uri %s, relative_uri %s, instance %p stub!\n", iface, + debugstr_hstring(base_uri), debugstr_hstring(relative_uri), instance); + return E_NOTIMPL; +} + +static const struct IUriRuntimeClassFactoryVtbl uri_factory_vtbl = +{ + uri_factory_QueryInterface, + uri_factory_AddRef, + uri_factory_Release, + /* IInspectable methods */ + uri_factory_GetIids, + uri_factory_GetRuntimeClassName, + uri_factory_GetTrustLevel, + /* IUriRuntimeClassFactory methods */ + uri_factory_CreateUri, + uri_factory_CreateWithRelativeUri, +}; + +static struct iertutil iertutil = +{ + {&activation_factory_vtbl}, + {&uri_factory_vtbl}, + 1 +}; + +HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID riid, void **out) +{ + FIXME("clsid %s, riid %s, out %p stub!\n", debugstr_guid(clsid), debugstr_guid(riid), out); + return CLASS_E_CLASSNOTAVAILABLE; +} + +HRESULT WINAPI DllGetActivationFactory(HSTRING classid, IActivationFactory **factory) +{ + TRACE("classid %s, factory %p.\n", debugstr_hstring(classid), factory); + *factory = &iertutil.IActivationFactory_iface; + IUnknown_AddRef(*factory); + return S_OK; +} diff --git a/dlls/iertutil/private.h b/dlls/iertutil/private.h new file mode 100644 index 00000000000..80b36886a7a --- /dev/null +++ b/dlls/iertutil/private.h @@ -0,0 +1,75 @@ +/* + * Copyright 2024 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 + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef __WINE_IERTUTIL_PRIVATE_H +#define __WINE_IERTUTIL_PRIVATE_H + +#include <stdarg.h> + +#define COBJMACROS +#include "initguid.h" +#include "windef.h" +#include "winbase.h" +#include "winstring.h" +#include "wine/debug.h" +#include "activation.h" + +#define WIDL_using_Windows_Foundation +#include "windows.foundation.h" + +#define DEFINE_IINSPECTABLE_(pfx, iface_type, impl_type, impl_from, iface_mem, expr) \ + static inline impl_type *impl_from(iface_type *iface) \ + { \ + return CONTAINING_RECORD(iface, impl_type, iface_mem); \ + } \ + static HRESULT WINAPI pfx##_QueryInterface(iface_type *iface, REFIID iid, void **out) \ + { \ + impl_type *impl = impl_from(iface); \ + return IInspectable_QueryInterface((IInspectable *)(expr), iid, out); \ + } \ + static ULONG WINAPI pfx##_AddRef(iface_type *iface) \ + { \ + impl_type *impl = impl_from(iface); \ + return IInspectable_AddRef((IInspectable *)(expr)); \ + } \ + static ULONG WINAPI pfx##_Release(iface_type *iface) \ + { \ + impl_type *impl = impl_from(iface); \ + return IInspectable_Release((IInspectable *)(expr)); \ + } \ + static HRESULT WINAPI pfx##_GetIids(iface_type *iface, ULONG *iid_count, IID **iids) \ + { \ + impl_type *impl = impl_from(iface); \ + return IInspectable_GetIids((IInspectable *)(expr), iid_count, iids); \ + } \ + static HRESULT WINAPI pfx##_GetRuntimeClassName(iface_type *iface, HSTRING *class_name) \ + { \ + impl_type *impl = impl_from(iface); \ + return IInspectable_GetRuntimeClassName((IInspectable *)(expr), class_name); \ + } \ + static HRESULT WINAPI pfx##_GetTrustLevel(iface_type *iface, TrustLevel *trust_level) \ + { \ + impl_type *impl = impl_from(iface); \ + return IInspectable_GetTrustLevel((IInspectable *)(expr), trust_level); \ + } + +#define DEFINE_IINSPECTABLE(pfx, iface_type, impl_type, base_iface) \ + DEFINE_IINSPECTABLE_(pfx, iface_type, impl_type, impl_from_##iface_type, iface_type##_iface, \ + &impl->base_iface) + +#endif /* __WINE_IERTUTIL_PRIVATE_H */ diff --git a/dlls/wintypes/classes.idl b/dlls/wintypes/classes.idl index daf3fc62f66..116c764fe6e 100644 --- a/dlls/wintypes/classes.idl +++ b/dlls/wintypes/classes.idl @@ -25,5 +25,6 @@ #endif
#define DO_NO_IMPORTS +#define _WINTYPES #include "windows.foundation.idl" #include "windows.foundation.metadata.idl" diff --git a/include/windows.foundation.idl b/include/windows.foundation.idl index 88a9f576f40..9e3b656d8a3 100644 --- a/include/windows.foundation.idl +++ b/include/windows.foundation.idl @@ -109,32 +109,44 @@ namespace Windows.Foundation { interface Windows.Foundation.Collections.IIterable<HSTRING>; interface Windows.Foundation.Collections.IIterable<IInspectable *>; interface Windows.Foundation.Collections.IIterable<IWwwFormUrlDecoderEntry *>; +#ifndef _WINTYPES interface Windows.Foundation.Collections.IIterable<Uri *>; +#endif interface Windows.Foundation.Collections.IIterator<HSTRING>; interface Windows.Foundation.Collections.IIterator<IInspectable *>; interface Windows.Foundation.Collections.IIterator<IWwwFormUrlDecoderEntry *>; +#ifndef _WINTYPES interface Windows.Foundation.Collections.IIterator<Uri *>; +#endif interface Windows.Foundation.Collections.IVectorView<BYTE>; interface Windows.Foundation.Collections.IVectorView<HSTRING>; interface Windows.Foundation.Collections.IVectorView<IInspectable *>; interface Windows.Foundation.Collections.IVectorView<IWwwFormUrlDecoderEntry *>; +#ifndef _WINTYPES interface Windows.Foundation.Collections.IVectorView<Windows.Foundation.Uri *>; +#endif interface Windows.Foundation.Collections.IVector<HSTRING>; interface Windows.Foundation.Collections.IVector<IInspectable *>; interface Windows.Foundation.Collections.IMapView<HSTRING, Windows.Foundation.Collections.IVectorView<HSTRING> *>; interface Windows.Foundation.EventHandler<IInspectable *>; + interface Windows.Foundation.AsyncOperationCompletedHandler<HSTRING>; interface Windows.Foundation.AsyncOperationCompletedHandler<IInspectable *>; interface Windows.Foundation.AsyncOperationCompletedHandler<boolean>; interface Windows.Foundation.AsyncOperationCompletedHandler<HSTRING>; interface Windows.Foundation.AsyncOperationCompletedHandler<UINT32>; +#ifndef _WINTYPES interface Windows.Foundation.AsyncOperationCompletedHandler<Windows.Foundation.Uri *>; +#endif interface Windows.Foundation.AsyncOperationProgressHandler<UINT32, UINT32>; interface Windows.Foundation.AsyncOperationWithProgressCompletedHandler<UINT32, UINT32>; + interface Windows.Foundation.IAsyncOperation<HSTRING>; interface Windows.Foundation.IAsyncOperation<IInspectable *>; interface Windows.Foundation.IAsyncOperation<boolean>; interface Windows.Foundation.IAsyncOperation<HSTRING>; interface Windows.Foundation.IAsyncOperation<UINT32>; +#ifndef _WINTYPES interface Windows.Foundation.IAsyncOperation<Windows.Foundation.Uri *>; +#endif interface Windows.Foundation.IAsyncOperationWithProgress<UINT32, UINT32>; interface Windows.Foundation.IReference<BYTE>; interface Windows.Foundation.IReference<DOUBLE>; @@ -561,6 +573,7 @@ namespace Windows.Foundation { { }
+#ifndef _WINTYPES [ activatable(Windows.Foundation.IUriRuntimeClassFactory, Windows.Foundation.UniversalApiContract, 1.0), contract(Windows.Foundation.UniversalApiContract, 1.0), @@ -587,6 +600,7 @@ namespace Windows.Foundation { interface Windows.Foundation.Collections.IVectorView<Windows.Foundation.IWwwFormUrlDecoderEntry *>; interface Windows.Foundation.Collections.IIterable<Windows.Foundation.IWwwFormUrlDecoderEntry *>; } +#endif
[ contract(Windows.Foundation.UniversalApiContract, 1.0),