From: Mohamad Al-Jaf <mohamadaljaf@gmail.com> --- dlls/windows.devices.radios/main.c | 52 ++++++++++++++++++++++ dlls/windows.devices.radios/private.h | 38 ++++++++++++++++ dlls/windows.devices.radios/tests/radios.c | 6 +++ 3 files changed, 96 insertions(+) diff --git a/dlls/windows.devices.radios/main.c b/dlls/windows.devices.radios/main.c index 2096be57488..dc51e950432 100644 --- a/dlls/windows.devices.radios/main.c +++ b/dlls/windows.devices.radios/main.c @@ -27,6 +27,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(radios); struct radio_statics { IActivationFactory IActivationFactory_iface; + IRadioStatics IRadioStatics_iface; LONG ref; }; @@ -51,6 +52,13 @@ static HRESULT WINAPI factory_QueryInterface( IActivationFactory *iface, REFIID return S_OK; } + if (IsEqualGUID( iid, &IID_IRadioStatics )) + { + *out = &impl->IRadioStatics_iface; + IInspectable_AddRef( *out ); + return S_OK; + } + FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) ); *out = NULL; return E_NOINTERFACE; @@ -110,9 +118,53 @@ static const struct IActivationFactoryVtbl factory_vtbl = factory_ActivateInstance, }; +DEFINE_IINSPECTABLE( radio_statics, IRadioStatics, struct radio_statics, IActivationFactory_iface ) + +static HRESULT WINAPI radio_statics_GetRadiosAsync( IRadioStatics *iface, IAsyncOperation_IVectorView_Radio **value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + +static HRESULT WINAPI radio_statics_GetDeviceSelector( IRadioStatics *iface, HSTRING *selector ) +{ + FIXME( "iface %p, selector %p stub!\n", iface, selector ); + return E_NOTIMPL; +} + +static HRESULT WINAPI radio_statics_FromIdAsync( IRadioStatics *iface, HSTRING id, IAsyncOperation_Radio **value ) +{ + FIXME( "iface %p, id %s, value %p stub!\n", iface, debugstr_hstring( id ), value ); + return E_NOTIMPL; +} + +static HRESULT WINAPI radio_statics_RequestAccessAsync( IRadioStatics *iface, IAsyncOperation_RadioAccessStatus **value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + +static const struct IRadioStaticsVtbl radio_statics_vtbl = +{ + /* IUnknown methods */ + radio_statics_QueryInterface, + radio_statics_AddRef, + radio_statics_Release, + /* IInspectable methods */ + radio_statics_GetIids, + radio_statics_GetRuntimeClassName, + radio_statics_GetTrustLevel, + /* IRadioStatics methods */ + radio_statics_GetRadiosAsync, + radio_statics_GetDeviceSelector, + radio_statics_FromIdAsync, + radio_statics_RequestAccessAsync, +}; + static struct radio_statics radio_statics = { {&factory_vtbl}, + {&radio_statics_vtbl}, 1, }; diff --git a/dlls/windows.devices.radios/private.h b/dlls/windows.devices.radios/private.h index ddd2fc55606..b426d3b6409 100644 --- a/dlls/windows.devices.radios/private.h +++ b/dlls/windows.devices.radios/private.h @@ -35,4 +35,42 @@ #define WIDL_using_Windows_Devices_Radios #include "windows.devices.radios.h" +#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.devices.radios/tests/radios.c b/dlls/windows.devices.radios/tests/radios.c index 9bc5e8d9990..09994c467c8 100644 --- a/dlls/windows.devices.radios/tests/radios.c +++ b/dlls/windows.devices.radios/tests/radios.c @@ -49,6 +49,7 @@ static void check_interface_( unsigned int line, void *obj, const IID *iid ) static void test_RadioStatics(void) { static const WCHAR *radio_statics_name = L"Windows.Devices.Radios.Radio"; + IRadioStatics *radio_statics = (void *)0xdeadbeef; IActivationFactory *factory = (void *)0xdeadbeef; HSTRING str; HRESULT hr; @@ -70,6 +71,11 @@ static void test_RadioStatics(void) check_interface( factory, &IID_IInspectable ); check_interface( factory, &IID_IAgileObject ); + hr = IActivationFactory_QueryInterface( factory, &IID_IRadioStatics, (void **)&radio_statics ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + + ref = IRadioStatics_Release( radio_statics ); + ok( ref == 2, "got ref %ld.\n", ref ); ref = IActivationFactory_Release( factory ); ok( ref == 1, "got ref %ld.\n", ref ); } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10413