Commit ced55e1d authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

twinapi.appcore: Stub Windows.System.Profile.AnalyticsInfo factory.

parent 0cd904e1
......@@ -3,6 +3,7 @@ MODULE = twinapi.appcore.dll
IMPORTS = combase
SOURCES = \
analytics_info.c \
classes.idl \
client_device_information.c \
main.c
/* WinRT Windows.Globalization implementation
*
* Copyright 2021 Rémi Bernon for CodeWeavers
*
* 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"
WINE_DEFAULT_DEBUG_CHANNEL(twinapi);
struct analytics_info_factory
{
IActivationFactory IActivationFactory_iface;
IAnalyticsInfoStatics IAnalyticsInfoStatics_iface;
LONG ref;
};
static inline struct analytics_info_factory *impl_from_IActivationFactory( IActivationFactory *iface )
{
return CONTAINING_RECORD( iface, struct analytics_info_factory, IActivationFactory_iface );
}
static HRESULT WINAPI activation_factory_QueryInterface( IActivationFactory *iface, REFIID iid, void **out )
{
struct analytics_info_factory *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 ))
{
IActivationFactory_AddRef( (*out = &impl->IActivationFactory_iface) );
return S_OK;
}
if (IsEqualGUID( iid, &IID_IAnalyticsInfoStatics ))
{
IAnalyticsInfoStatics_AddRef( (*out = &impl->IAnalyticsInfoStatics_iface) );
return S_OK;
}
FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) );
*out = NULL;
return E_NOINTERFACE;
}
static ULONG WINAPI activation_factory_AddRef( IActivationFactory *iface )
{
struct analytics_info_factory *impl = impl_from_IActivationFactory( iface );
ULONG ref = InterlockedIncrement( &impl->ref );
TRACE( "iface %p, ref %lu.\n", iface, ref );
return ref;
}
static ULONG WINAPI activation_factory_Release( IActivationFactory *iface )
{
struct analytics_info_factory *impl = impl_from_IActivationFactory( iface );
ULONG ref = InterlockedDecrement( &impl->ref );
TRACE( "iface %p, ref %lu.\n", iface, ref );
return ref;
}
static HRESULT WINAPI activation_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 activation_factory_GetRuntimeClassName( IActivationFactory *iface, HSTRING *class_name )
{
FIXME( "iface %p, class_name %p stub!\n", iface, class_name );
return E_NOTIMPL;
}
static HRESULT WINAPI activation_factory_GetTrustLevel( IActivationFactory *iface, TrustLevel *trust_level )
{
FIXME( "iface %p, trust_level %p stub!\n", iface, trust_level );
return E_NOTIMPL;
}
static HRESULT WINAPI activation_factory_ActivateInstance( IActivationFactory *iface, IInspectable **out )
{
FIXME( "iface %p, out %p stub!\n", iface, out );
return E_NOTIMPL;
}
static const struct IActivationFactoryVtbl activation_factory_vtbl =
{
activation_factory_QueryInterface,
activation_factory_AddRef,
activation_factory_Release,
/* IInspectable methods */
activation_factory_GetIids,
activation_factory_GetRuntimeClassName,
activation_factory_GetTrustLevel,
/* IActivationFactory methods */
activation_factory_ActivateInstance,
};
DEFINE_IINSPECTABLE( statics, IAnalyticsInfoStatics, struct analytics_info_factory, IActivationFactory_iface );
static HRESULT WINAPI statics_get_VersionInfo( IAnalyticsInfoStatics *iface, IAnalyticsVersionInfo **value )
{
FIXME( "iface %p, value %p stub!\n", iface, value );
return E_NOTIMPL;
}
static HRESULT WINAPI statics_get_DeviceForm( IAnalyticsInfoStatics *iface, HSTRING *value )
{
FIXME( "iface %p, value %p stub!\n", iface, value );
return E_NOTIMPL;
}
static const struct IAnalyticsInfoStaticsVtbl statics_vtbl =
{
statics_QueryInterface,
statics_AddRef,
statics_Release,
/* IInspectable methods */
statics_GetIids,
statics_GetRuntimeClassName,
statics_GetTrustLevel,
/* IAnalyticsInfoStatics methods */
statics_get_VersionInfo,
statics_get_DeviceForm,
};
static struct analytics_info_factory factory =
{
{&activation_factory_vtbl},
{&statics_vtbl},
1,
};
IActivationFactory *analytics_info_factory = &factory.IActivationFactory_iface;
......@@ -18,4 +18,17 @@
#pragma makedep register
#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.globalization.idl";
#define DO_NO_IMPORTS
#include "windows.security.exchangeactivesyncprovisioning.idl"
#include "windows.system.profile.idl"
......@@ -71,6 +71,8 @@ HRESULT WINAPI DllGetActivationFactory( HSTRING classid, IActivationFactory **fa
if (!wcscmp( buffer, RuntimeClass_Windows_Security_ExchangeActiveSyncProvisioning_EasClientDeviceInformation ))
IActivationFactory_QueryInterface( client_device_information_factory, &IID_IActivationFactory, (void **)factory );
else if (!wcscmp( buffer, RuntimeClass_Windows_System_Profile_AnalyticsInfo ))
IActivationFactory_QueryInterface( analytics_info_factory, &IID_IActivationFactory, (void **)factory );
if (*factory) return S_OK;
return CLASS_E_CLASSNOTAVAILABLE;
......
......@@ -32,7 +32,52 @@
#include "windows.foundation.h"
#define WIDL_using_Windows_Security_ExchangeActiveSyncProvisioning
#include "windows.security.exchangeactivesyncprovisioning.h"
#define WIDL_using_Windows_System_Profile
#include "windows.system.profile.h"
#define WIDL_using_Windows_System_UserProfile
#include "windows.system.userprofile.h"
#include "wine/debug.h"
#include "wine/debug.h"
extern IActivationFactory *client_device_information_factory;
extern IActivationFactory *analytics_info_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 )
......@@ -32,6 +32,10 @@
#include "windows.foundation.h"
#define WIDL_using_Windows_Security_ExchangeActiveSyncProvisioning
#include "windows.security.exchangeactivesyncprovisioning.h"
#define WIDL_using_Windows_System_Profile
#include "windows.system.profile.h"
#define WIDL_using_Windows_System_UserProfile
#include "windows.system.userprofile.h"
#include "wine/test.h"
......@@ -107,6 +111,40 @@ static void test_EasClientDeviceInformation(void)
ok( ref == 1, "got ref %ld.\n", ref );
}
static void test_AnalyticsVersionInfo(void)
{
static const WCHAR *class_name = RuntimeClass_Windows_System_Profile_AnalyticsInfo;
IAnalyticsInfoStatics *analytics_info_statics;
IActivationFactory *factory;
HSTRING str;
HRESULT hr;
LONG ref;
hr = WindowsCreateString( class_name, wcslen( class_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( class_name ) );
return;
}
check_interface( factory, &IID_IUnknown, TRUE );
check_interface( factory, &IID_IInspectable, TRUE );
check_interface( factory, &IID_IAgileObject, TRUE );
hr = IActivationFactory_QueryInterface( factory, &IID_IAnalyticsInfoStatics, (void **)&analytics_info_statics );
ok( hr == S_OK, "got hr %#lx.\n", hr );
ref = IAnalyticsInfoStatics_Release( analytics_info_statics );
ok( ref == 2, "got ref %ld.\n", ref );
ref = IActivationFactory_Release( factory );
ok( ref == 1, "got ref %ld.\n", ref );
}
START_TEST(twinapi)
{
HRESULT hr;
......@@ -115,6 +153,7 @@ START_TEST(twinapi)
ok( hr == S_OK, "RoInitialize failed, hr %#lx\n", hr );
test_EasClientDeviceInformation();
test_AnalyticsVersionInfo();
RoUninitialize();
}
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