winepulse: Remove AudioSessionManager.
[wine.git] / dlls / windows.gaming.ui.gamebar / main.c
blobff44c6cd00ead0b35e23b7c25ee7399cd24cd32f
1 /* WinRT Windows.Gaming.UI.GameBar implementation
3 * Copyright 2022 Paul Gofman for CodeWeavers
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #include "initguid.h"
21 #include "private.h"
23 #include "wine/debug.h"
25 WINE_DEFAULT_DEBUG_CHANNEL(gamebar);
27 static EventRegistrationToken dummy_token = {.value = 0xdeadbeef};
29 struct gamebar_statics
31 IActivationFactory IActivationFactory_iface;
32 IGameBarStatics IGameBarStatics_iface;
33 LONG ref;
36 static inline struct gamebar_statics *impl_from_IActivationFactory( IActivationFactory *iface )
38 return CONTAINING_RECORD( iface, struct gamebar_statics, IActivationFactory_iface );
41 static HRESULT WINAPI factory_QueryInterface( IActivationFactory *iface, REFIID iid, void **out )
43 struct gamebar_statics *impl = impl_from_IActivationFactory( iface );
45 TRACE( "iface %p, iid %s, out %p.\n", iface, debugstr_guid( iid ), out );
47 if (IsEqualGUID( iid, &IID_IUnknown ) ||
48 IsEqualGUID( iid, &IID_IInspectable ) ||
49 IsEqualGUID( iid, &IID_IAgileObject ) ||
50 IsEqualGUID( iid, &IID_IActivationFactory ))
52 *out = &impl->IActivationFactory_iface;
53 IInspectable_AddRef( *out );
54 return S_OK;
57 if (IsEqualGUID( iid, &IID_IGameBarStatics ))
59 *out = &impl->IGameBarStatics_iface;
60 IInspectable_AddRef( *out );
61 return S_OK;
64 FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) );
65 *out = NULL;
66 return E_NOINTERFACE;
69 static ULONG WINAPI factory_AddRef( IActivationFactory *iface )
71 struct gamebar_statics *impl = impl_from_IActivationFactory( iface );
72 ULONG ref = InterlockedIncrement( &impl->ref );
73 TRACE( "iface %p increasing refcount to %lu.\n", iface, ref );
74 return ref;
77 static ULONG WINAPI factory_Release( IActivationFactory *iface )
79 struct gamebar_statics *impl = impl_from_IActivationFactory( iface );
80 ULONG ref = InterlockedDecrement( &impl->ref );
81 TRACE( "iface %p decreasing refcount to %lu.\n", iface, ref );
82 return ref;
85 static HRESULT WINAPI factory_GetIids( IActivationFactory *iface, ULONG *iid_count, IID **iids )
87 FIXME( "iface %p, iid_count %p, iids %p stub!\n", iface, iid_count, iids );
88 return E_NOTIMPL;
91 static HRESULT WINAPI factory_GetRuntimeClassName( IActivationFactory *iface, HSTRING *class_name )
93 FIXME( "iface %p, class_name %p stub!\n", iface, class_name );
94 return E_NOTIMPL;
97 static HRESULT WINAPI factory_GetTrustLevel( IActivationFactory *iface, TrustLevel *trust_level )
99 FIXME( "iface %p, trust_level %p stub!\n", iface, trust_level );
100 return E_NOTIMPL;
103 static HRESULT WINAPI factory_ActivateInstance( IActivationFactory *iface, IInspectable **instance )
105 FIXME( "iface %p, instance %p stub!\n", iface, instance );
106 return E_NOTIMPL;
109 static const struct IActivationFactoryVtbl factory_vtbl =
111 factory_QueryInterface,
112 factory_AddRef,
113 factory_Release,
114 /* IInspectable methods */
115 factory_GetIids,
116 factory_GetRuntimeClassName,
117 factory_GetTrustLevel,
118 /* IActivationFactory methods */
119 factory_ActivateInstance,
122 DEFINE_IINSPECTABLE( statics, IGameBarStatics, struct gamebar_statics, IActivationFactory_iface )
124 static HRESULT WINAPI statics_add_VisibilityChanged( IGameBarStatics *iface,
125 IEventHandler_IInspectable *handler,
126 EventRegistrationToken *token )
128 FIXME( "iface %p, handler %p, token %p stub.\n", iface, handler, token );
129 *token = dummy_token;
130 return S_OK;
133 static HRESULT WINAPI statics_remove_VisibilityChanged( IGameBarStatics *iface, EventRegistrationToken token )
135 FIXME( "iface %p, token %#I64x stub.\n", iface, token.value );
136 return S_OK;
139 static HRESULT WINAPI statics_add_IsInputRedirectedChanged( IGameBarStatics *iface,
140 IEventHandler_IInspectable *handler,
141 EventRegistrationToken *token )
143 FIXME( "iface %p, handler %p, token %p stub.\n", iface, handler, token );
144 *token = dummy_token;
145 return S_OK;
148 static HRESULT WINAPI statics_remove_IsInputRedirectedChanged( IGameBarStatics *iface, EventRegistrationToken token )
150 FIXME( "iface %p, token %#I64x stub.\n", iface, token.value );
151 return S_OK;
154 static HRESULT WINAPI statics_get_Visible( IGameBarStatics *iface, BOOLEAN *value)
156 TRACE( "iface %p, value %p.\n", iface, value );
158 if (!value) return E_POINTER;
159 *value = FALSE;
160 return S_OK;
163 static HRESULT WINAPI statics_get_IsInputRedirected( IGameBarStatics *iface, BOOLEAN *value )
165 TRACE( "iface %p, value %p.\n", iface, value );
167 if (!value) return E_POINTER;
168 *value = FALSE;
169 return S_OK;
172 static const struct IGameBarStaticsVtbl statics_vtbl =
174 statics_QueryInterface,
175 statics_AddRef,
176 statics_Release,
177 /* IInspectable methods */
178 statics_GetIids,
179 statics_GetRuntimeClassName,
180 statics_GetTrustLevel,
181 /* IGameBarStatics methods */
182 statics_add_VisibilityChanged,
183 statics_remove_VisibilityChanged,
184 statics_add_IsInputRedirectedChanged,
185 statics_remove_IsInputRedirectedChanged,
186 statics_get_Visible,
187 statics_get_IsInputRedirected,
190 static struct gamebar_statics gamebar_statics =
192 {&factory_vtbl},
193 {&statics_vtbl},
197 static IActivationFactory *gamebar_factory = &gamebar_statics.IActivationFactory_iface;
199 HRESULT WINAPI DllGetClassObject( REFCLSID clsid, REFIID riid, void **out )
201 FIXME("clsid %s, riid %s, out %p stub!\n", debugstr_guid(clsid), debugstr_guid(riid), out);
203 return CLASS_E_CLASSNOTAVAILABLE;
206 HRESULT WINAPI DllGetActivationFactory( HSTRING class_str, IActivationFactory **factory )
208 const WCHAR *buffer = WindowsGetStringRawBuffer( class_str, NULL );
210 TRACE( "class %s, factory %p.\n", debugstr_w(buffer), factory );
212 *factory = NULL;
214 if (!wcscmp( buffer, RuntimeClass_Windows_Gaming_UI_GameBar ))
215 IActivationFactory_QueryInterface( gamebar_factory, &IID_IActivationFactory, (void **)factory );
217 if (*factory) return S_OK;
218 return CLASS_E_CLASSNOTAVAILABLE;
221 BOOL WINAPI DllMain( HINSTANCE instance, DWORD reason, void *reserved )
223 TRACE( "instance %p, reason %lu, reserved %p.\n", instance, reason, reserved );
225 switch (reason)
227 case DLL_PROCESS_ATTACH:
228 DisableThreadLibraryCalls( instance );
229 break;
231 return TRUE;