From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- dlls/windows.perception.stub/observer.c | 30 +++++++++++++++ dlls/windows.perception.stub/private.h | 38 +++++++++++++++++++ .../tests/perception.c | 1 + 3 files changed, 69 insertions(+)
diff --git a/dlls/windows.perception.stub/observer.c b/dlls/windows.perception.stub/observer.c index f41a35beb70..e5cb0bac3ea 100644 --- a/dlls/windows.perception.stub/observer.c +++ b/dlls/windows.perception.stub/observer.c @@ -26,6 +26,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(perception); struct observer { IActivationFactory IActivationFactory_iface; + ISpatialSurfaceObserverStatics ISpatialSurfaceObserverStatics_iface; LONG ref; };
@@ -50,6 +51,13 @@ static HRESULT WINAPI factory_QueryInterface( IActivationFactory *iface, REFIID return S_OK; }
+ if (IsEqualGUID( iid, &IID_ISpatialSurfaceObserverStatics )) + { + *out = &impl->ISpatialSurfaceObserverStatics_iface; + IInspectable_AddRef( *out ); + return S_OK; + } + FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) ); *out = NULL; return E_NOINTERFACE; @@ -108,9 +116,31 @@ static const struct IActivationFactoryVtbl factory_vtbl = factory_ActivateInstance, };
+DEFINE_IINSPECTABLE( observer_statics, ISpatialSurfaceObserverStatics, struct observer, IActivationFactory_iface ) + +static HRESULT WINAPI observer_statics_RequestAccessAsync( ISpatialSurfaceObserverStatics *iface, IAsyncOperation_SpatialPerceptionAccessStatus **result ) +{ + FIXME( "iface %p, result %p stub!\n", iface, result ); + return E_NOTIMPL; +} + +static const struct ISpatialSurfaceObserverStaticsVtbl observer_statics_vtbl = +{ + observer_statics_QueryInterface, + observer_statics_AddRef, + observer_statics_Release, + /* IInspectable methods */ + observer_statics_GetIids, + observer_statics_GetRuntimeClassName, + observer_statics_GetTrustLevel, + /* ISpatialSurfaceObserverStatics methods */ + observer_statics_RequestAccessAsync, +}; + static struct observer observer_statics = { {&factory_vtbl}, + {&observer_statics_vtbl}, 1, };
diff --git a/dlls/windows.perception.stub/private.h b/dlls/windows.perception.stub/private.h index 497b3998a02..a32f8221380 100644 --- a/dlls/windows.perception.stub/private.h +++ b/dlls/windows.perception.stub/private.h @@ -37,4 +37,42 @@
extern IActivationFactory *observer_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/windows.perception.stub/tests/perception.c b/dlls/windows.perception.stub/tests/perception.c index f26a45788a6..8b075042f72 100644 --- a/dlls/windows.perception.stub/tests/perception.c +++ b/dlls/windows.perception.stub/tests/perception.c @@ -68,6 +68,7 @@ static void test_ObserverStatics(void) check_interface( factory, &IID_IUnknown ); check_interface( factory, &IID_IInspectable ); check_interface( factory, &IID_IAgileObject ); + check_interface( factory, &IID_ISpatialSurfaceObserverStatics );
ref = IActivationFactory_Release( factory ); ok( ref == 1, "got ref %ld.\n", ref );