Module: wine Branch: master Commit: a36f7015146c5339afc558a3250e7e1a1192a15f URL: https://gitlab.winehq.org/wine/wine/-/commit/a36f7015146c5339afc558a3250e7e1...
Author: Mohamad Al-Jaf mohamadaljaf@gmail.com Date: Fri Mar 17 01:52:42 2023 -0400
graphicscapture: Add IGraphicsCaptureSessionStatics stub interface.
---
dlls/graphicscapture/private.h | 38 ++++++++++++++++++++++++++++ dlls/graphicscapture/session.c | 30 ++++++++++++++++++++++ dlls/graphicscapture/tests/graphicscapture.c | 6 +++++ 3 files changed, 74 insertions(+)
diff --git a/dlls/graphicscapture/private.h b/dlls/graphicscapture/private.h index 6a958347537..d60c138c873 100644 --- a/dlls/graphicscapture/private.h +++ b/dlls/graphicscapture/private.h @@ -36,4 +36,42 @@
extern IActivationFactory *session_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/graphicscapture/session.c b/dlls/graphicscapture/session.c index d8ed0001ff6..a6752d364a4 100644 --- a/dlls/graphicscapture/session.c +++ b/dlls/graphicscapture/session.c @@ -25,6 +25,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(graphicscapture); struct session { IActivationFactory IActivationFactory_iface; + IGraphicsCaptureSessionStatics IGraphicsCaptureSessionStatics_iface; LONG ref; };
@@ -49,6 +50,13 @@ static HRESULT WINAPI factory_QueryInterface( IActivationFactory *iface, REFIID return S_OK; }
+ if (IsEqualGUID( iid, &IID_IGraphicsCaptureSessionStatics )) + { + *out = &impl->IGraphicsCaptureSessionStatics_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,31 @@ static const struct IActivationFactoryVtbl factory_vtbl = factory_ActivateInstance, };
+DEFINE_IINSPECTABLE( session_statics, IGraphicsCaptureSessionStatics, struct session, IActivationFactory_iface ) + +static HRESULT WINAPI session_statics_IsSupported( IGraphicsCaptureSessionStatics *iface, boolean *result ) +{ + FIXME( "iface %p, result %p stub!\n", iface, result ); + return E_NOTIMPL; +} + +static const struct IGraphicsCaptureSessionStaticsVtbl session_statics_vtbl = +{ + session_statics_QueryInterface, + session_statics_AddRef, + session_statics_Release, + /* IInspectable methods */ + session_statics_GetIids, + session_statics_GetRuntimeClassName, + session_statics_GetTrustLevel, + /* IGraphicsCaptureSessionStatics methods */ + session_statics_IsSupported, +}; + static struct session session_statics = { {&factory_vtbl}, + {&session_statics_vtbl}, 0, };
diff --git a/dlls/graphicscapture/tests/graphicscapture.c b/dlls/graphicscapture/tests/graphicscapture.c index 49b15f914ee..6cdd4e021af 100644 --- a/dlls/graphicscapture/tests/graphicscapture.c +++ b/dlls/graphicscapture/tests/graphicscapture.c @@ -47,6 +47,7 @@ static void check_interface_( unsigned int line, void *obj, const IID *iid ) static void test_GraphicsCaptureSessionStatics(void) { static const WCHAR *session_statics_name = L"Windows.Graphics.Capture.GraphicsCaptureSession"; + IGraphicsCaptureSessionStatics *session_statics; IActivationFactory *factory; HSTRING str; HRESULT hr; @@ -68,6 +69,11 @@ static void test_GraphicsCaptureSessionStatics(void) check_interface( factory, &IID_IInspectable ); check_interface( factory, &IID_IAgileObject );
+ hr = IActivationFactory_QueryInterface( factory, &IID_IGraphicsCaptureSessionStatics, (void **)&session_statics ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + + ref = IGraphicsCaptureSessionStatics_Release( session_statics ); + ok( ref == 1, "got ref %ld.\n", ref ); ref = IActivationFactory_Release( factory ); ok( ref == 0, "got ref %ld.\n", ref ); }