Commit df9b41af authored by Mohamad Al-Jaf's avatar Mohamad Al-Jaf Committed by Alexandre Julliard

windows.security.authentication.onlineid: Add IOnlineIdServiceTicketRequestFactory stub interface.

parent a3ef7d74
......@@ -4,4 +4,5 @@ IMPORTS = combase
SOURCES = \
authenticator.c \
classes.idl \
main.c
main.c \
ticket.c
......@@ -40,6 +40,8 @@ HRESULT WINAPI DllGetActivationFactory( HSTRING classid, IActivationFactory **fa
if (!wcscmp( buffer, RuntimeClass_Windows_Security_Authentication_OnlineId_OnlineIdSystemAuthenticator ))
IActivationFactory_QueryInterface( authenticator_factory, &IID_IActivationFactory, (void **)factory );
if (!wcscmp( buffer, RuntimeClass_Windows_Security_Authentication_OnlineId_OnlineIdServiceTicketRequest ))
IActivationFactory_QueryInterface( ticket_factory, &IID_IActivationFactory, (void **)factory );
if (*factory) return S_OK;
return CLASS_E_CLASSNOTAVAILABLE;
......
......@@ -38,6 +38,7 @@
#include "windows.security.authentication.onlineid.h"
extern IActivationFactory *authenticator_factory;
extern IActivationFactory *ticket_factory;
#define DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from, iface_mem, expr ) \
static inline impl_type *impl_from( iface_type *iface ) \
......
......@@ -79,6 +79,39 @@ static void test_AuthenticatorStatics(void)
ok( ref == 1, "got ref %ld.\n", ref );
}
static void test_TicketStatics(void)
{
static const WCHAR *ticket_statics_name = L"Windows.Security.Authentication.OnlineId.OnlineIdServiceTicketRequest";
IOnlineIdServiceTicketRequest *ticket_statics = (void *)0xdeadbeef;
IActivationFactory *factory = (void *)0xdeadbeef;
HSTRING str;
HRESULT hr;
LONG ref;
hr = WindowsCreateString( ticket_statics_name, wcslen( ticket_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( ticket_statics_name ) );
return;
}
check_interface( factory, &IID_IUnknown );
check_interface( factory, &IID_IInspectable );
hr = IActivationFactory_QueryInterface( factory, &IID_IOnlineIdServiceTicketRequestFactory, (void **)&ticket_statics );
ok( hr == S_OK, "got hr %#lx.\n", hr );
ref = IOnlineIdServiceTicketRequest_Release( ticket_statics );
ok( ref == 2, "got ref %ld.\n", ref );
ref = IActivationFactory_Release( factory );
ok( ref == 1, "got ref %ld.\n", ref );
}
START_TEST(onlineid)
{
HRESULT hr;
......@@ -87,6 +120,7 @@ START_TEST(onlineid)
ok( hr == S_OK, "RoInitialize failed, hr %#lx\n", hr );
test_AuthenticatorStatics();
test_TicketStatics();
RoUninitialize();
}
/* WinRT Windows.Security.Authentication.Onlineid Implementation
*
* Copyright (C) 2024 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(onlineid);
struct ticket_request_factory_statics
{
IActivationFactory IActivationFactory_iface;
IOnlineIdServiceTicketRequestFactory IOnlineIdServiceTicketRequestFactory_iface;
LONG ref;
};
static inline struct ticket_request_factory_statics *impl_from_IActivationFactory( IActivationFactory *iface )
{
return CONTAINING_RECORD( iface, struct ticket_request_factory_statics, IActivationFactory_iface );
}
static HRESULT WINAPI factory_QueryInterface( IActivationFactory *iface, REFIID iid, void **out )
{
struct ticket_request_factory_statics *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_IActivationFactory ))
{
*out = &impl->IActivationFactory_iface;
IInspectable_AddRef( *out );
return S_OK;
}
if (IsEqualGUID( iid, &IID_IOnlineIdServiceTicketRequestFactory ))
{
*out = &impl->IOnlineIdServiceTicketRequestFactory_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 ticket_request_factory_statics *impl = impl_from_IActivationFactory( iface );
ULONG ref = InterlockedIncrement( &impl->ref );
TRACE( "iface %p, ref %lu.\n", iface, ref );
return ref;
}
static ULONG WINAPI factory_Release( IActivationFactory *iface )
{
struct ticket_request_factory_statics *impl = impl_from_IActivationFactory( iface );
ULONG ref = InterlockedDecrement( &impl->ref );
TRACE( "iface %p, ref %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,
};
DEFINE_IINSPECTABLE( ticket_request_factory_statics, IOnlineIdServiceTicketRequestFactory, struct ticket_request_factory_statics, IActivationFactory_iface )
static HRESULT WINAPI ticket_request_factory_statics_CreateOnlineIdServiceTicketRequest( IOnlineIdServiceTicketRequestFactory *iface, HSTRING service,
HSTRING policy, IOnlineIdServiceTicketRequest **request )
{
FIXME( "iface %p, service %s, policy %s, request %p stub!\n", iface, debugstr_hstring( service ), debugstr_hstring( policy ), request );
return E_NOTIMPL;
}
static HRESULT WINAPI ticket_request_factory_statics_CreateOnlineIdServiceTicketRequestAdvanced( IOnlineIdServiceTicketRequestFactory *iface, HSTRING service,
IOnlineIdServiceTicketRequest **request )
{
FIXME( "iface %p, service %s, request %p stub!\n", iface, debugstr_hstring( service ), request );
return E_NOTIMPL;
}
static const struct IOnlineIdServiceTicketRequestFactoryVtbl ticket_request_factory_statics_vtbl =
{
ticket_request_factory_statics_QueryInterface,
ticket_request_factory_statics_AddRef,
ticket_request_factory_statics_Release,
/* IInspectable methods */
ticket_request_factory_statics_GetIids,
ticket_request_factory_statics_GetRuntimeClassName,
ticket_request_factory_statics_GetTrustLevel,
/* IOnlineIdServiceTicketRequestFactory methods */
ticket_request_factory_statics_CreateOnlineIdServiceTicketRequest,
ticket_request_factory_statics_CreateOnlineIdServiceTicketRequestAdvanced,
};
static struct ticket_request_factory_statics ticket_request_factory_statics =
{
{&factory_vtbl},
{&ticket_request_factory_statics_vtbl},
1,
};
IActivationFactory *ticket_factory = &ticket_request_factory_statics.IActivationFactory_iface;
......@@ -72,6 +72,23 @@ namespace Windows.Security.Authentication.OnlineId {
}
[
contract(Windows.Foundation.UniversalApiContract, 1.0),
exclusiveto(Windows.Security.Authentication.OnlineId.OnlineIdServiceTicketRequest),
uuid(bebb0a08-9e73-4077-9614-08614c0bc245)
]
interface IOnlineIdServiceTicketRequestFactory : IInspectable
{
HRESULT CreateOnlineIdServiceTicketRequest(
[in] HSTRING service, [in] HSTRING policy,
[out, retval] Windows.Security.Authentication.OnlineId.OnlineIdServiceTicketRequest **request
);
HRESULT CreateOnlineIdServiceTicketRequestAdvanced(
[in] HSTRING service,
[out, retval] Windows.Security.Authentication.OnlineId.OnlineIdServiceTicketRequest **request
);
}
[
contract(Windows.Foundation.UniversalApiContract, 4.0),
exclusiveto(Windows.Security.Authentication.OnlineId.OnlineIdSystemAuthenticatorForUser),
uuid(5798befb-1de4-4186-a2e6-b563f86aaf44)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment