Module: wine Branch: master Commit: f3aa576aad75a4a6870e85ea24709fa00bdd5265 URL: https://gitlab.winehq.org/wine/wine/-/commit/f3aa576aad75a4a6870e85ea24709fa...
Author: Mohamad Al-Jaf mohamadaljaf@gmail.com Date: Wed Aug 2 00:50:38 2023 -0400
hvsimanagementapi: Add IIsolatedWindowsEnvironmentHostStatics stub interface.
---
dlls/hvsimanagementapi/host.c | 38 ++++++++++++++++++++++++++++++++ dlls/hvsimanagementapi/private.h | 38 ++++++++++++++++++++++++++++++++ dlls/hvsimanagementapi/tests/isolation.c | 6 +++++ 3 files changed, 82 insertions(+)
diff --git a/dlls/hvsimanagementapi/host.c b/dlls/hvsimanagementapi/host.c index e41e2ef7e99..37120d9ee94 100644 --- a/dlls/hvsimanagementapi/host.c +++ b/dlls/hvsimanagementapi/host.c @@ -25,6 +25,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(hvsi); struct isolated_host_statics { IActivationFactory IActivationFactory_iface; + IIsolatedWindowsEnvironmentHostStatics IIsolatedWindowsEnvironmentHostStatics_iface; LONG ref; };
@@ -49,6 +50,13 @@ static HRESULT WINAPI factory_QueryInterface( IActivationFactory *iface, REFIID return S_OK; }
+ if (IsEqualGUID( iid, &IID_IIsolatedWindowsEnvironmentHostStatics )) + { + *out = &impl->IIsolatedWindowsEnvironmentHostStatics_iface; + IInspectable_AddRef( *out ); + return S_OK; + } + FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) ); *out = NULL; return E_NOINTERFACE; @@ -107,9 +115,39 @@ static const struct IActivationFactoryVtbl factory_vtbl = factory_ActivateInstance, };
+DEFINE_IINSPECTABLE( isolated_host_statics, IIsolatedWindowsEnvironmentHostStatics, struct isolated_host_statics, IActivationFactory_iface ) + +static HRESULT WINAPI isolated_host_statics_get_IsReady( IIsolatedWindowsEnvironmentHostStatics *iface, boolean *value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + +static HRESULT WINAPI isolated_host_statics_get_HostErrors( IIsolatedWindowsEnvironmentHostStatics *iface, + IVectorView_IsolatedWindowsEnvironmentHostError **value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + +static const struct IIsolatedWindowsEnvironmentHostStaticsVtbl isolated_host_statics_vtbl = +{ + isolated_host_statics_QueryInterface, + isolated_host_statics_AddRef, + isolated_host_statics_Release, + /* IInspectable methods */ + isolated_host_statics_GetIids, + isolated_host_statics_GetRuntimeClassName, + isolated_host_statics_GetTrustLevel, + /* IIsolatedWindowsEnvironmentHostStatics methods */ + isolated_host_statics_get_IsReady, + isolated_host_statics_get_HostErrors, +}; + static struct isolated_host_statics isolated_host_statics = { {&factory_vtbl}, + {&isolated_host_statics_vtbl}, 1, };
diff --git a/dlls/hvsimanagementapi/private.h b/dlls/hvsimanagementapi/private.h index af18f54c077..4799a654176 100644 --- a/dlls/hvsimanagementapi/private.h +++ b/dlls/hvsimanagementapi/private.h @@ -37,4 +37,42 @@
extern IActivationFactory *isolated_host_factory;
+#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 diff --git a/dlls/hvsimanagementapi/tests/isolation.c b/dlls/hvsimanagementapi/tests/isolation.c index d08f6ecb645..8e0dc75c005 100644 --- a/dlls/hvsimanagementapi/tests/isolation.c +++ b/dlls/hvsimanagementapi/tests/isolation.c @@ -49,6 +49,7 @@ static void check_interface_( unsigned int line, void *obj, const IID *iid ) static void test_IsolatedWindowsEnvironmentHostStatics(void) { static const WCHAR *isolated_host_statics_name = L"Windows.Security.Isolation.IsolatedWindowsEnvironmentHost"; + IIsolatedWindowsEnvironmentHostStatics *isolated_host_statics; IActivationFactory *factory; HSTRING str; HRESULT hr; @@ -70,6 +71,11 @@ static void test_IsolatedWindowsEnvironmentHostStatics(void) check_interface( factory, &IID_IInspectable ); check_interface( factory, &IID_IAgileObject );
+ hr = IActivationFactory_QueryInterface( factory, &IID_IIsolatedWindowsEnvironmentHostStatics, (void **)&isolated_host_statics ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + + ref = IIsolatedWindowsEnvironmentHostStatics_Release( isolated_host_statics ); + ok( ref == 2, "got ref %ld.\n", ref ); ref = IActivationFactory_Release( factory ); ok( ref == 1, "got ref %ld.\n", ref ); }