From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- .../authenticator.c | 39 ++++++++ .../private.h | 40 ++++++++ .../tests/onlineid.c | 6 ++ ...ndows.security.authentication.onlineid.idl | 96 +++++++++++++++++++ 4 files changed, 181 insertions(+)
diff --git a/dlls/windows.security.authentication.onlineid/authenticator.c b/dlls/windows.security.authentication.onlineid/authenticator.c index 44918d2fbb1..c79dbdc89b6 100644 --- a/dlls/windows.security.authentication.onlineid/authenticator.c +++ b/dlls/windows.security.authentication.onlineid/authenticator.c @@ -25,6 +25,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(onlineid); struct authenticator_statics { IActivationFactory IActivationFactory_iface; + IOnlineIdSystemAuthenticatorStatics IOnlineIdSystemAuthenticatorStatics_iface; LONG ref; };
@@ -49,6 +50,13 @@ static HRESULT WINAPI factory_QueryInterface( IActivationFactory *iface, REFIID return S_OK; }
+ if (IsEqualGUID( iid, &IID_IOnlineIdSystemAuthenticatorStatics )) + { + *out = &impl->IOnlineIdSystemAuthenticatorStatics_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,40 @@ static const struct IActivationFactoryVtbl factory_vtbl = factory_ActivateInstance, };
+DEFINE_IINSPECTABLE( authenticator_statics, IOnlineIdSystemAuthenticatorStatics, struct authenticator_statics, IActivationFactory_iface ) + +static HRESULT WINAPI authenticator_statics_get_Default( IOnlineIdSystemAuthenticatorStatics *iface, + IOnlineIdSystemAuthenticatorForUser **value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + +static HRESULT WINAPI authenticator_statics_GetForUser( IOnlineIdSystemAuthenticatorStatics *iface, __x_ABI_CWindows_CSystem_CIUser *user, + IOnlineIdSystemAuthenticatorForUser **value ) +{ + FIXME( "iface %p, user %p, value %p stub!\n", iface, user, value ); + return E_NOTIMPL; +} + +static const struct IOnlineIdSystemAuthenticatorStaticsVtbl authenticator_statics_vtbl = +{ + authenticator_statics_QueryInterface, + authenticator_statics_AddRef, + authenticator_statics_Release, + /* IInspectable methods */ + authenticator_statics_GetIids, + authenticator_statics_GetRuntimeClassName, + authenticator_statics_GetTrustLevel, + /* IOnlineIdSystemAuthenticatorStatics methods */ + authenticator_statics_get_Default, + authenticator_statics_GetForUser, +}; + static struct authenticator_statics authenticator_statics = { {&factory_vtbl}, + {&authenticator_statics_vtbl}, 1, };
diff --git a/dlls/windows.security.authentication.onlineid/private.h b/dlls/windows.security.authentication.onlineid/private.h index db0dcb075fe..987b348fe88 100644 --- a/dlls/windows.security.authentication.onlineid/private.h +++ b/dlls/windows.security.authentication.onlineid/private.h @@ -32,9 +32,49 @@ #define WIDL_using_Windows_Foundation #define WIDL_using_Windows_Foundation_Collections #include "windows.foundation.h" +#define WIDL_using_Windows_System +#include "windows.system.h" #define WIDL_using_Windows_Security_Authentication_OnlineId #include "windows.security.authentication.onlineid.h"
extern IActivationFactory *authenticator_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.security.authentication.onlineid/tests/onlineid.c b/dlls/windows.security.authentication.onlineid/tests/onlineid.c index 5ed57af737b..0dd265536ee 100644 --- a/dlls/windows.security.authentication.onlineid/tests/onlineid.c +++ b/dlls/windows.security.authentication.onlineid/tests/onlineid.c @@ -48,6 +48,7 @@ static void check_interface_( unsigned int line, void *obj, const IID *iid ) static void test_AuthenticatorStatics(void) { static const WCHAR *authenticator_statics_name = L"Windows.Security.Authentication.OnlineId.OnlineIdSystemAuthenticator"; + IOnlineIdSystemAuthenticatorStatics *authenticator_statics = (void *)0xdeadbeef; IActivationFactory *factory = (void *)0xdeadbeef; HSTRING str; HRESULT hr; @@ -69,6 +70,11 @@ static void test_AuthenticatorStatics(void) check_interface( factory, &IID_IInspectable ); check_interface( factory, &IID_IAgileObject );
+ hr = IActivationFactory_QueryInterface( factory, &IID_IOnlineIdSystemAuthenticatorStatics, (void **)&authenticator_statics ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + + ref = IOnlineIdSystemAuthenticatorStatics_Release( authenticator_statics ); + ok( ref == 2, "got ref %ld.\n", ref ); ref = IActivationFactory_Release( factory ); ok( ref == 1, "got ref %ld.\n", ref ); } diff --git a/include/windows.security.authentication.onlineid.idl b/include/windows.security.authentication.onlineid.idl index dcbec66976d..fe01f1635fd 100644 --- a/include/windows.security.authentication.onlineid.idl +++ b/include/windows.security.authentication.onlineid.idl @@ -28,11 +28,64 @@ import "windows.foundation.idl"; import "windows.system.idl";
namespace Windows.Security.Authentication.OnlineId { + typedef enum OnlineIdSystemTicketStatus OnlineIdSystemTicketStatus; + + interface IOnlineIdServiceTicketRequest; + interface IOnlineIdServiceTicketRequestFactory; interface IOnlineIdSystemAuthenticatorForUser; interface IOnlineIdSystemAuthenticatorStatics; + interface IOnlineIdSystemIdentity; + interface IOnlineIdSystemTicketResult;
+ runtimeclass OnlineIdServiceTicketRequest; runtimeclass OnlineIdSystemAuthenticator; runtimeclass OnlineIdSystemAuthenticatorForUser; + runtimeclass OnlineIdSystemIdentity; + runtimeclass OnlineIdSystemTicketResult; + + declare { + interface Windows.Foundation.Collections.IIterable<Windows.Security.Authentication.OnlineId.OnlineIdServiceTicketRequest *>; + interface Windows.Foundation.Collections.IIterator<Windows.Security.Authentication.OnlineId.OnlineIdServiceTicketRequest *>; + interface Windows.Foundation.AsyncOperationCompletedHandler<Windows.Security.Authentication.OnlineId.OnlineIdSystemTicketResult *>; + interface Windows.Foundation.IAsyncOperation<Windows.Security.Authentication.OnlineId.OnlineIdSystemTicketResult *>; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 4.0) + ] + enum OnlineIdSystemTicketStatus + { + Success = 0, + Error = 1, + ServiceConnectionError = 2, + }; + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Security.Authentication.OnlineId.OnlineIdServiceTicketRequest), + uuid(297445d3-fb63-4135-8909-4e354c061466) + ] + interface IOnlineIdServiceTicketRequest : IInspectable + { + [propget] HRESULT Service([out, retval] HSTRING *value); + [propget] HRESULT Policy([out, retval] HSTRING *value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 4.0), + exclusiveto(Windows.Security.Authentication.OnlineId.OnlineIdSystemAuthenticatorForUser), + uuid(5798befb-1de4-4186-a2e6-b563f86aaf44) + ] + interface IOnlineIdSystemAuthenticatorForUser : IInspectable + { + [overload("GetTicketAsync")] HRESULT GetTicketAsync( + [in] Windows.Security.Authentication.OnlineId.OnlineIdServiceTicketRequest *request, + [out, retval] Windows.Foundation.IAsyncOperation<Windows.Security.Authentication.OnlineId.OnlineIdSystemTicketResult *> **operation + ); + [propput] HRESULT ApplicationId([in] GUID value); + [propget] HRESULT ApplicationId([out, retval] GUID *value); + [propget] HRESULT User([out, retval] Windows.System.User **user); + }
[ contract(Windows.Foundation.UniversalApiContract, 4.0), @@ -45,6 +98,29 @@ namespace Windows.Security.Authentication.OnlineId { HRESULT GetForUser([in] Windows.System.User *user, [out, retval] Windows.Security.Authentication.OnlineId.OnlineIdSystemAuthenticatorForUser **value); }
+ [ + contract(Windows.Foundation.UniversalApiContract, 4.0), + exclusiveto(Windows.Security.Authentication.OnlineId.OnlineIdSystemTicketResult), + uuid(db0a5ff8-b098-4acd-9d13-9e640652b5b6) + ] + interface IOnlineIdSystemTicketResult : IInspectable + { + [propget] HRESULT Identity([out, retval] Windows.Security.Authentication.OnlineId.OnlineIdSystemIdentity **value); + [propget] HRESULT Status([out, retval] Windows.Security.Authentication.OnlineId.OnlineIdSystemTicketStatus *value); + [propget] HRESULT ExtendedError([out, retval] HRESULT *value); + } + + [ + activatable(Windows.Security.Authentication.OnlineId.IOnlineIdServiceTicketRequestFactory, Windows.Foundation.UniversalApiContract, 1.0), + contract(Windows.Foundation.UniversalApiContract, 1.0), + marshaling_behavior(agile), + threading(both) + ] + runtimeclass OnlineIdServiceTicketRequest + { + [default] interface Windows.Security.Authentication.OnlineId.IOnlineIdServiceTicketRequest; + } + [ contract(Windows.Foundation.UniversalApiContract, 4.0), marshaling_behavior(agile), @@ -64,4 +140,24 @@ namespace Windows.Security.Authentication.OnlineId { { [default] interface Windows.Security.Authentication.OnlineId.IOnlineIdSystemAuthenticatorForUser; } + + [ + contract(Windows.Foundation.UniversalApiContract, 4.0), + marshaling_behavior(agile), + threading(both) + ] + runtimeclass OnlineIdSystemIdentity + { + [default] interface Windows.Security.Authentication.OnlineId.IOnlineIdSystemIdentity; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 4.0), + marshaling_behavior(agile), + threading(both) + ] + runtimeclass OnlineIdSystemTicketResult + { + [default] interface Windows.Security.Authentication.OnlineId.IOnlineIdSystemTicketResult; + } }