1 /* WinRT Windows.Globalization implementation
3 * Copyright 2021 RĂ©mi Bernon 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
22 WINE_DEFAULT_DEBUG_CHANNEL(twinapi
);
24 struct analytics_version_info
26 IAnalyticsVersionInfo IAnalyticsVersionInfo_iface
;
30 static inline struct analytics_version_info
*impl_from_IAnalyticsVersionInfo( IAnalyticsVersionInfo
*iface
)
32 return CONTAINING_RECORD( iface
, struct analytics_version_info
, IAnalyticsVersionInfo_iface
);
35 static HRESULT WINAPI
analytics_version_info_QueryInterface( IAnalyticsVersionInfo
*iface
, REFIID iid
, void **out
)
37 struct analytics_version_info
*impl
= impl_from_IAnalyticsVersionInfo( iface
);
39 TRACE( "iface %p, iid %s, out %p.\n", iface
, debugstr_guid( iid
), out
);
41 if (IsEqualGUID( iid
, &IID_IUnknown
) ||
42 IsEqualGUID( iid
, &IID_IInspectable
) ||
43 IsEqualGUID( iid
, &IID_IAgileObject
) ||
44 IsEqualGUID( iid
, &IID_IAnalyticsVersionInfo
))
46 IAnalyticsVersionInfo_AddRef( (*out
= &impl
->IAnalyticsVersionInfo_iface
) );
50 FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid
) );
55 static ULONG WINAPI
analytics_version_info_AddRef( IAnalyticsVersionInfo
*iface
)
57 struct analytics_version_info
*impl
= impl_from_IAnalyticsVersionInfo( iface
);
58 ULONG ref
= InterlockedIncrement( &impl
->ref
);
59 TRACE( "iface %p, ref %lu.\n", iface
, ref
);
63 static ULONG WINAPI
analytics_version_info_Release( IAnalyticsVersionInfo
*iface
)
65 struct analytics_version_info
*impl
= impl_from_IAnalyticsVersionInfo( iface
);
66 ULONG ref
= InterlockedDecrement( &impl
->ref
);
67 TRACE( "iface %p, ref %lu.\n", iface
, ref
);
68 if (!ref
) free( impl
);
72 static HRESULT WINAPI
analytics_version_info_GetIids( IAnalyticsVersionInfo
*iface
, ULONG
*iid_count
, IID
**iids
)
74 FIXME( "iface %p, iid_count %p, iids %p stub!\n", iface
, iid_count
, iids
);
78 static HRESULT WINAPI
analytics_version_info_GetRuntimeClassName( IAnalyticsVersionInfo
*iface
, HSTRING
*class_name
)
80 FIXME( "iface %p, class_name %p stub!\n", iface
, class_name
);
84 static HRESULT WINAPI
analytics_version_info_GetTrustLevel( IAnalyticsVersionInfo
*iface
, TrustLevel
*trust_level
)
86 FIXME( "iface %p, trust_level %p stub!\n", iface
, trust_level
);
90 static HRESULT WINAPI
analytics_version_info_get_DeviceFamily( IAnalyticsVersionInfo
*iface
, HSTRING
*value
)
92 TRACE( "iface %p, value %p\n", iface
, value
);
93 return WindowsCreateString( L
"Windows.Desktop", wcslen( L
"Windows.Desktop" ), value
);
96 static HRESULT WINAPI
analytics_version_info_get_DeviceFamilyVersion( IAnalyticsVersionInfo
*iface
, HSTRING
*value
)
98 FIXME( "iface %p, value %p stub!\n", iface
, value
);
102 static IAnalyticsVersionInfoVtbl analytics_version_info_vtbl
=
104 analytics_version_info_QueryInterface
,
105 analytics_version_info_AddRef
,
106 analytics_version_info_Release
,
107 /* IInspectable methods */
108 analytics_version_info_GetIids
,
109 analytics_version_info_GetRuntimeClassName
,
110 analytics_version_info_GetTrustLevel
,
111 /* IAnalyticsVersionInfo methods */
112 analytics_version_info_get_DeviceFamily
,
113 analytics_version_info_get_DeviceFamilyVersion
,
116 struct analytics_info_factory
118 IActivationFactory IActivationFactory_iface
;
119 IAnalyticsInfoStatics IAnalyticsInfoStatics_iface
;
123 static inline struct analytics_info_factory
*impl_from_IActivationFactory( IActivationFactory
*iface
)
125 return CONTAINING_RECORD( iface
, struct analytics_info_factory
, IActivationFactory_iface
);
128 static HRESULT WINAPI
activation_factory_QueryInterface( IActivationFactory
*iface
, REFIID iid
, void **out
)
130 struct analytics_info_factory
*impl
= impl_from_IActivationFactory( iface
);
132 TRACE( "iface %p, iid %s, out %p.\n", iface
, debugstr_guid( iid
), out
);
134 if (IsEqualGUID( iid
, &IID_IUnknown
) ||
135 IsEqualGUID( iid
, &IID_IInspectable
) ||
136 IsEqualGUID( iid
, &IID_IAgileObject
) ||
137 IsEqualGUID( iid
, &IID_IActivationFactory
))
139 IActivationFactory_AddRef( (*out
= &impl
->IActivationFactory_iface
) );
143 if (IsEqualGUID( iid
, &IID_IAnalyticsInfoStatics
))
145 IAnalyticsInfoStatics_AddRef( (*out
= &impl
->IAnalyticsInfoStatics_iface
) );
149 FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid
) );
151 return E_NOINTERFACE
;
154 static ULONG WINAPI
activation_factory_AddRef( IActivationFactory
*iface
)
156 struct analytics_info_factory
*impl
= impl_from_IActivationFactory( iface
);
157 ULONG ref
= InterlockedIncrement( &impl
->ref
);
158 TRACE( "iface %p, ref %lu.\n", iface
, ref
);
162 static ULONG WINAPI
activation_factory_Release( IActivationFactory
*iface
)
164 struct analytics_info_factory
*impl
= impl_from_IActivationFactory( iface
);
165 ULONG ref
= InterlockedDecrement( &impl
->ref
);
166 TRACE( "iface %p, ref %lu.\n", iface
, ref
);
170 static HRESULT WINAPI
activation_factory_GetIids( IActivationFactory
*iface
, ULONG
*iid_count
, IID
**iids
)
172 FIXME( "iface %p, iid_count %p, iids %p stub!\n", iface
, iid_count
, iids
);
176 static HRESULT WINAPI
activation_factory_GetRuntimeClassName( IActivationFactory
*iface
, HSTRING
*class_name
)
178 FIXME( "iface %p, class_name %p stub!\n", iface
, class_name
);
182 static HRESULT WINAPI
activation_factory_GetTrustLevel( IActivationFactory
*iface
, TrustLevel
*trust_level
)
184 FIXME( "iface %p, trust_level %p stub!\n", iface
, trust_level
);
188 static HRESULT WINAPI
activation_factory_ActivateInstance( IActivationFactory
*iface
, IInspectable
**out
)
190 FIXME( "iface %p, out %p stub!\n", iface
, out
);
194 static const struct IActivationFactoryVtbl activation_factory_vtbl
=
196 activation_factory_QueryInterface
,
197 activation_factory_AddRef
,
198 activation_factory_Release
,
199 /* IInspectable methods */
200 activation_factory_GetIids
,
201 activation_factory_GetRuntimeClassName
,
202 activation_factory_GetTrustLevel
,
203 /* IActivationFactory methods */
204 activation_factory_ActivateInstance
,
207 DEFINE_IINSPECTABLE( statics
, IAnalyticsInfoStatics
, struct analytics_info_factory
, IActivationFactory_iface
);
209 static HRESULT WINAPI
statics_get_VersionInfo( IAnalyticsInfoStatics
*iface
, IAnalyticsVersionInfo
**value
)
211 struct analytics_version_info
*info
;
213 TRACE( "iface %p, out %p.\n", iface
, value
);
215 if (!(info
= calloc( 1, sizeof(*info
) ))) return E_OUTOFMEMORY
;
216 info
->IAnalyticsVersionInfo_iface
.lpVtbl
= &analytics_version_info_vtbl
;
219 *value
= &info
->IAnalyticsVersionInfo_iface
;
223 static HRESULT WINAPI
statics_get_DeviceForm( IAnalyticsInfoStatics
*iface
, HSTRING
*value
)
225 FIXME( "iface %p, value %p stub!\n", iface
, value
);
229 static const struct IAnalyticsInfoStaticsVtbl statics_vtbl
=
231 statics_QueryInterface
,
234 /* IInspectable methods */
236 statics_GetRuntimeClassName
,
237 statics_GetTrustLevel
,
238 /* IAnalyticsInfoStatics methods */
239 statics_get_VersionInfo
,
240 statics_get_DeviceForm
,
243 static struct analytics_info_factory factory
=
245 {&activation_factory_vtbl
},
250 IActivationFactory
*analytics_info_factory
= &factory
.IActivationFactory_iface
;