Needed to prevent VR games from crashing when the user attempts to capture the desktop.
The reference count seems to start at 0, which I've never encountered before. Not sure if my code is incorrect.
-- v2: graphicscapture: Partially implement IGraphicsCaptureSessionStatics::IsSupported(). graphicscapture/tests: Add IGraphicsCaptureSessionStatics::IsSupported() tests. graphicscapture: Add IGraphicsCaptureSessionStatics stub interface. graphicscapture: Add stub DLL. include: Add windows.graphics.capture.idl file.
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- include/Makefile.in | 1 + include/windows.graphics.capture.idl | 77 ++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 include/windows.graphics.capture.idl
diff --git a/include/Makefile.in b/include/Makefile.in index 102ea551cac..9bde0bcceb0 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -815,6 +815,7 @@ SOURCES = \ windows.gaming.input.idl \ windows.gaming.ui.idl \ windows.globalization.idl \ + windows.graphics.capture.idl \ windows.graphics.directx.direct3d11.idl \ windows.graphics.directx.idl \ windows.graphics.effects.idl \ diff --git a/include/windows.graphics.capture.idl b/include/windows.graphics.capture.idl new file mode 100644 index 00000000000..f89f91afc42 --- /dev/null +++ b/include/windows.graphics.capture.idl @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2023 Mohamad Al-Jaf + * + * 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 + */ + +#ifdef __WIDL__ +#pragma winrt ns_prefix +#endif + +import "inspectable.idl"; +import "asyncinfo.idl"; +import "eventtoken.idl"; +import "windowscontracts.idl"; +import "windows.foundation.idl"; +/* import "windows.graphics.idl"; */ +import "windows.graphics.directx.idl"; +import "windows.graphics.directx.direct3d11.idl"; +/* import "windows.security.authorization.appcapabilityaccess.idl"; */ +import "windows.system.idl"; +import "windows.ui.idl"; +/* import "windows.ui.composition.idl"; */ + +namespace Windows.Graphics.Capture { + interface IGraphicsCaptureSession; + interface IGraphicsCaptureSession2; + interface IGraphicsCaptureSession3; + interface IGraphicsCaptureSessionStatics; + + runtimeclass GraphicsCaptureSession; + + [ + contract(Windows.Foundation.UniversalApiContract, 6.0), + exclusiveto(Windows.Graphics.Capture.GraphicsCaptureSession), + uuid(814e42a9-f70f-4ad7-939b-fddcc6eb880d) + ] + interface IGraphicsCaptureSession : IInspectable + { + HRESULT StartCapture(); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 6.0), + exclusiveto(Windows.Graphics.Capture.GraphicsCaptureSession), + uuid(2224a540-5974-49aa-b232-0882536f4cb5) + ] + interface IGraphicsCaptureSessionStatics : IInspectable + { + HRESULT IsSupported([out, retval] boolean *result); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 6.0), + marshaling_behavior(agile), + static(Windows.Graphics.Capture.IGraphicsCaptureSessionStatics, Windows.Foundation.UniversalApiContract, 6.0), + threading(both) + ] + runtimeclass GraphicsCaptureSession + { + [default] interface Windows.Graphics.Capture.IGraphicsCaptureSession; + [contract(Windows.Foundation.UniversalApiContract, 10.0)] interface Windows.Graphics.Capture.IGraphicsCaptureSession2; + [contract(Windows.Foundation.UniversalApiContract, 12.0)] interface Windows.Graphics.Capture.IGraphicsCaptureSession3; + interface Windows.Foundation.IClosable; + } +}
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- configure.ac | 2 + dlls/graphicscapture/Makefile.in | 9 ++ dlls/graphicscapture/classes.idl | 23 ++++ dlls/graphicscapture/graphicscapture.spec | 2 + dlls/graphicscapture/main.c | 49 ++++++++ dlls/graphicscapture/private.h | 39 +++++++ dlls/graphicscapture/session.c | 116 +++++++++++++++++++ dlls/graphicscapture/tests/Makefile.in | 5 + dlls/graphicscapture/tests/graphicscapture.c | 85 ++++++++++++++ 9 files changed, 330 insertions(+) create mode 100644 dlls/graphicscapture/Makefile.in create mode 100644 dlls/graphicscapture/classes.idl create mode 100644 dlls/graphicscapture/graphicscapture.spec create mode 100644 dlls/graphicscapture/main.c create mode 100644 dlls/graphicscapture/private.h create mode 100644 dlls/graphicscapture/session.c create mode 100644 dlls/graphicscapture/tests/Makefile.in create mode 100644 dlls/graphicscapture/tests/graphicscapture.c
diff --git a/configure.ac b/configure.ac index 5ff1bb093f4..9e0e86b6704 100644 --- a/configure.ac +++ b/configure.ac @@ -2613,6 +2613,8 @@ WINE_CONFIG_MAKEFILE(dlls/gdiplus/tests) WINE_CONFIG_MAKEFILE(dlls/glu32) WINE_CONFIG_MAKEFILE(dlls/gphoto2.ds) WINE_CONFIG_MAKEFILE(dlls/gpkcsp) +WINE_CONFIG_MAKEFILE(dlls/graphicscapture) +WINE_CONFIG_MAKEFILE(dlls/graphicscapture/tests) WINE_CONFIG_MAKEFILE(dlls/hal) WINE_CONFIG_MAKEFILE(dlls/hhctrl.ocx) WINE_CONFIG_MAKEFILE(dlls/hid) diff --git a/dlls/graphicscapture/Makefile.in b/dlls/graphicscapture/Makefile.in new file mode 100644 index 00000000000..28fc3eee3b5 --- /dev/null +++ b/dlls/graphicscapture/Makefile.in @@ -0,0 +1,9 @@ +MODULE = graphicscapture.dll +IMPORTS = combase + +C_SRCS = \ + main.c \ + session.c + +IDL_SRCS = \ + classes.idl diff --git a/dlls/graphicscapture/classes.idl b/dlls/graphicscapture/classes.idl new file mode 100644 index 00000000000..a2e9798be81 --- /dev/null +++ b/dlls/graphicscapture/classes.idl @@ -0,0 +1,23 @@ +/* + * Runtime Classes for graphicscapture.dll + * + * Copyright (C) 2023 Mohamad Al-Jaf + * + * 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 + +#include "windows.graphics.capture.idl" diff --git a/dlls/graphicscapture/graphicscapture.spec b/dlls/graphicscapture/graphicscapture.spec new file mode 100644 index 00000000000..9fd6b109f9e --- /dev/null +++ b/dlls/graphicscapture/graphicscapture.spec @@ -0,0 +1,2 @@ +@ stdcall -private DllCanUnloadNow() +@ stdcall -private DllGetActivationFactory(ptr ptr) diff --git a/dlls/graphicscapture/main.c b/dlls/graphicscapture/main.c new file mode 100644 index 00000000000..42584fef329 --- /dev/null +++ b/dlls/graphicscapture/main.c @@ -0,0 +1,49 @@ +/* WinRT GraphicsCapture Implementation + * + * Copyright (C) 2023 Mohamad Al-Jaf + * + * 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 "initguid.h" +#include "private.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(graphicscapture); + +static const char *debugstr_hstring( HSTRING hstr ) +{ + const WCHAR *str; + UINT32 len; + if (hstr && !((ULONG_PTR)hstr >> 16)) return "(invalid)"; + str = WindowsGetStringRawBuffer( hstr, &len ); + return wine_dbgstr_wn( str, len ); +} + +HRESULT WINAPI DllGetActivationFactory( HSTRING classid, IActivationFactory **factory ) +{ + const WCHAR *buffer = WindowsGetStringRawBuffer( classid, NULL ); + + TRACE( "class %s, factory %p.\n", debugstr_hstring(classid), factory ); + + *factory = NULL; + + if (!wcscmp( buffer, RuntimeClass_Windows_Graphics_Capture_GraphicsCaptureSession )) + IActivationFactory_QueryInterface( session_factory, &IID_IActivationFactory, (void **)factory ); + + if (*factory) return S_OK; + return CLASS_E_CLASSNOTAVAILABLE; +} diff --git a/dlls/graphicscapture/private.h b/dlls/graphicscapture/private.h new file mode 100644 index 00000000000..6a958347537 --- /dev/null +++ b/dlls/graphicscapture/private.h @@ -0,0 +1,39 @@ +/* WinRT GraphicsCapture Implementation + * + * Copyright (C) 2023 Mohamad Al-Jaf + * + * 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_WINDOWS_GRAPHICSCAPTURE_PRIVATE_H +#define __WINE_WINDOWS_GRAPHICSCAPTURE_PRIVATE_H + +#include <stdarg.h> + +#define COBJMACROS +#include "windef.h" +#include "winbase.h" +#include "winstring.h" + +#include "activation.h" + +#define WIDL_using_Windows_Foundation +#include "windows.foundation.h" +#define WIDL_using_Windows_Graphics_Capture +#include "windows.graphics.capture.h" + +extern IActivationFactory *session_factory; + +#endif diff --git a/dlls/graphicscapture/session.c b/dlls/graphicscapture/session.c new file mode 100644 index 00000000000..d8ed0001ff6 --- /dev/null +++ b/dlls/graphicscapture/session.c @@ -0,0 +1,116 @@ +/* WinRT GraphicsCaptureSession Implementation + * + * Copyright (C) 2023 Mohamad Al-Jaf + * + * 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" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(graphicscapture); + +struct session +{ + IActivationFactory IActivationFactory_iface; + LONG ref; +}; + +static inline struct session *impl_from_IActivationFactory( IActivationFactory *iface ) +{ + return CONTAINING_RECORD( iface, struct session, IActivationFactory_iface ); +} + +static HRESULT WINAPI factory_QueryInterface( IActivationFactory *iface, REFIID iid, void **out ) +{ + struct session *impl = impl_from_IActivationFactory( iface ); + + TRACE( "iface %p, iid %s, out %p.\n", iface, debugstr_guid( iid ), out ); + + if (IsEqualGUID( iid, &IID_IUnknown ) || + IsEqualGUID( iid, &IID_IInspectable ) || + IsEqualGUID( iid, &IID_IAgileObject ) || + IsEqualGUID( iid, &IID_IActivationFactory )) + { + *out = &impl->IActivationFactory_iface; + IInspectable_AddRef( *out ); + return S_OK; + } + + FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) ); + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI factory_AddRef( IActivationFactory *iface ) +{ + struct session *impl = impl_from_IActivationFactory( iface ); + ULONG ref = InterlockedIncrement( &impl->ref ); + TRACE( "iface %p increasing refcount to %lu.\n", iface, ref ); + return ref; +} + +static ULONG WINAPI factory_Release( IActivationFactory *iface ) +{ + struct session *impl = impl_from_IActivationFactory( iface ); + ULONG ref = InterlockedDecrement( &impl->ref ); + TRACE( "iface %p decreasing refcount to %lu.\n", iface, ref ); + return ref; +} + +static HRESULT WINAPI factory_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 WINAPI factory_GetRuntimeClassName( IActivationFactory *iface, HSTRING *class_name ) +{ + FIXME( "iface %p, class_name %p stub!\n", iface, class_name ); + return E_NOTIMPL; +} + +static HRESULT WINAPI factory_GetTrustLevel( IActivationFactory *iface, TrustLevel *trust_level ) +{ + FIXME( "iface %p, trust_level %p stub!\n", iface, trust_level ); + return E_NOTIMPL; +} + +static HRESULT WINAPI factory_ActivateInstance( IActivationFactory *iface, IInspectable **instance ) +{ + FIXME( "iface %p, instance %p stub!\n", iface, instance ); + return E_NOTIMPL; +} + +static const struct IActivationFactoryVtbl factory_vtbl = +{ + factory_QueryInterface, + factory_AddRef, + factory_Release, + /* IInspectable methods */ + factory_GetIids, + factory_GetRuntimeClassName, + factory_GetTrustLevel, + /* IActivationFactory methods */ + factory_ActivateInstance, +}; + +static struct session session_statics = +{ + {&factory_vtbl}, + 0, +}; + +IActivationFactory *session_factory = &session_statics.IActivationFactory_iface; diff --git a/dlls/graphicscapture/tests/Makefile.in b/dlls/graphicscapture/tests/Makefile.in new file mode 100644 index 00000000000..234514dbc3b --- /dev/null +++ b/dlls/graphicscapture/tests/Makefile.in @@ -0,0 +1,5 @@ +TESTDLL = graphicscapture.dll +IMPORTS = combase + +C_SRCS = \ + graphicscapture.c diff --git a/dlls/graphicscapture/tests/graphicscapture.c b/dlls/graphicscapture/tests/graphicscapture.c new file mode 100644 index 00000000000..49b15f914ee --- /dev/null +++ b/dlls/graphicscapture/tests/graphicscapture.c @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2023 Mohamad Al-Jaf + * + * 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 + */ +#define COBJMACROS +#include "initguid.h" +#include <stdarg.h> + +#include "windef.h" +#include "winbase.h" +#include "winstring.h" + +#include "roapi.h" + +#define WIDL_using_Windows_Foundation +#include "windows.foundation.h" +#define WIDL_using_Windows_Graphics_Capture +#include "windows.graphics.capture.h" + +#include "wine/test.h" + +#define check_interface( obj, iid ) check_interface_( __LINE__, obj, iid ) +static void check_interface_( unsigned int line, void *obj, const IID *iid ) +{ + IUnknown *iface = obj; + IUnknown *unk; + HRESULT hr; + + hr = IUnknown_QueryInterface( iface, iid, (void **)&unk ); + ok_(__FILE__, line)( hr == S_OK, "got hr %#lx.\n", hr ); + IUnknown_Release( unk ); +} + +static void test_GraphicsCaptureSessionStatics(void) +{ + static const WCHAR *session_statics_name = L"Windows.Graphics.Capture.GraphicsCaptureSession"; + IActivationFactory *factory; + HSTRING str; + HRESULT hr; + LONG ref; + + hr = WindowsCreateString( session_statics_name, wcslen( session_statics_name ), &str ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + + hr = RoGetActivationFactory( str, &IID_IActivationFactory, (void **)&factory ); + WindowsDeleteString( str ); + ok( hr == S_OK || broken( hr == REGDB_E_CLASSNOTREG ), "got hr %#lx.\n", hr ); + if (hr == REGDB_E_CLASSNOTREG) + { + win_skip( "%s runtimeclass not registered, skipping tests.\n", wine_dbgstr_w( session_statics_name ) ); + return; + } + + check_interface( factory, &IID_IUnknown ); + check_interface( factory, &IID_IInspectable ); + check_interface( factory, &IID_IAgileObject ); + + ref = IActivationFactory_Release( factory ); + ok( ref == 0, "got ref %ld.\n", ref ); +} + +START_TEST(graphicscapture) +{ + HRESULT hr; + + hr = RoInitialize( RO_INIT_MULTITHREADED ); + ok( hr == S_OK, "RoInitialize failed, hr %#lx\n", hr ); + + test_GraphicsCaptureSessionStatics(); + + RoUninitialize(); +}
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- 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 ); }
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- dlls/graphicscapture/tests/graphicscapture.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/dlls/graphicscapture/tests/graphicscapture.c b/dlls/graphicscapture/tests/graphicscapture.c index 6cdd4e021af..66283fbb5d3 100644 --- a/dlls/graphicscapture/tests/graphicscapture.c +++ b/dlls/graphicscapture/tests/graphicscapture.c @@ -49,6 +49,7 @@ static void test_GraphicsCaptureSessionStatics(void) static const WCHAR *session_statics_name = L"Windows.Graphics.Capture.GraphicsCaptureSession"; IGraphicsCaptureSessionStatics *session_statics; IActivationFactory *factory; + BOOLEAN res; HSTRING str; HRESULT hr; LONG ref; @@ -72,6 +73,11 @@ static void test_GraphicsCaptureSessionStatics(void) hr = IActivationFactory_QueryInterface( factory, &IID_IGraphicsCaptureSessionStatics, (void **)&session_statics ); ok( hr == S_OK, "got hr %#lx.\n", hr );
+ res = 2; + hr = IGraphicsCaptureSessionStatics_IsSupported( session_statics, &res ); + todo_wine ok( hr == S_OK, "got hr %#lx.\n", hr ); + todo_wine ok( res == TRUE, "got %d.\n", res ); + ref = IGraphicsCaptureSessionStatics_Release( session_statics ); ok( ref == 1, "got ref %ld.\n", ref ); ref = IActivationFactory_Release( factory );
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
Needed to prevent VR games from crashing when the user attempts to capture the desktop. --- dlls/graphicscapture/session.c | 6 ++++-- dlls/graphicscapture/tests/graphicscapture.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/dlls/graphicscapture/session.c b/dlls/graphicscapture/session.c index a6752d364a4..8c7aecfc793 100644 --- a/dlls/graphicscapture/session.c +++ b/dlls/graphicscapture/session.c @@ -119,8 +119,10 @@ DEFINE_IINSPECTABLE( session_statics, IGraphicsCaptureSessionStatics, struct ses
static HRESULT WINAPI session_statics_IsSupported( IGraphicsCaptureSessionStatics *iface, boolean *result ) { - FIXME( "iface %p, result %p stub!\n", iface, result ); - return E_NOTIMPL; + TRACE( "iface %p, result %p\n", iface, result ); + + *result = FALSE; + return S_OK; }
static const struct IGraphicsCaptureSessionStaticsVtbl session_statics_vtbl = diff --git a/dlls/graphicscapture/tests/graphicscapture.c b/dlls/graphicscapture/tests/graphicscapture.c index 66283fbb5d3..caac271763b 100644 --- a/dlls/graphicscapture/tests/graphicscapture.c +++ b/dlls/graphicscapture/tests/graphicscapture.c @@ -75,7 +75,7 @@ static void test_GraphicsCaptureSessionStatics(void)
res = 2; hr = IGraphicsCaptureSessionStatics_IsSupported( session_statics, &res ); - todo_wine ok( hr == S_OK, "got hr %#lx.\n", hr ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); todo_wine ok( res == TRUE, "got %d.\n", res );
ref = IGraphicsCaptureSessionStatics_Release( session_statics );
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=131090
Your paranoid android.
=== build (build log) ===
error: patch failed: include/Makefile.in:815 Task: Patch failed to apply
On Mon Mar 27 00:12:00 2023 +0000, Mohamad Al-Jaf wrote:
changed this line in [version 2 of the diff](/wine/wine/-/merge_requests/2490/diffs?diff_id=39155&start_sha=96eddb3f2fa84f648c9a95c872836d5ac3544580#112b6c06bb8284072d2d10443acf8e3c92fb702d_80_78)
I see, makes sense, yeah there's no reason to break the test.
On Fri Mar 24 07:38:58 2023 +0000, Rémi Bernon wrote:
[default] interface Windows.Graphics.Capture.IGraphicsCaptureSession; [contract(Windows.Foundation.UniversalApiContract, 10.0)] interface Windows.Graphics.Capture.IGraphicsCaptureSession2; [contract(Windows.Foundation.UniversalApiContract, 12.0)] interface Windows.Graphics.Capture.IGraphicsCaptureSession3; interface Windows.Foundation.IClosable;
With maybe the forward declarations though you might skip them as they are not even needed.
Added them anyway as there's no reason not to.
Thanks for the review!
On Fri Mar 24 11:09:44 2023 +0000, **** wrote:
Marvin replied on the mailing list:
Hi, It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated. The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=131023 Your paranoid android. === build (build log) === error: patch failed: dlls/imm32/imm.c:928 Task: Patch failed to apply === debian11 (build log) === Task: Patch failed to apply === debian11b (build log) === Task: Patch failed to apply
What a strange error.
On Mon Mar 27 00:53:52 2023 +0000, **** wrote:
Marvin replied on the mailing list:
Hi, It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated. The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details: The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=131090 Your paranoid android. === build (build log) === error: patch failed: include/Makefile.in:815 Task: Patch failed to apply
Looks like Marvin is broken. I made sure to rebase prior to pushing. Also, the pipeline built fine.
This merge request was approved by Rémi Bernon.