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
25 #include "winstring.h"
26 #include "wine/debug.h"
30 #include "activation.h"
32 #define WIDL_using_Windows_Foundation
33 #define WIDL_using_Windows_Foundation_Collections
34 #include "windows.foundation.h"
35 #define WIDL_using_Windows_Globalization
36 #include "windows.globalization.h"
37 #define WIDL_using_Windows_System_UserProfile
38 #include "windows.system.userprofile.h"
40 WINE_DEFAULT_DEBUG_CHANNEL(locale
);
44 IVectorView_HSTRING IVectorView_HSTRING_iface
;
51 C_ASSERT(sizeof(struct hstring_vector
) == offsetof(struct hstring_vector
, values
[0]));
53 static inline struct hstring_vector
*impl_from_IVectorView_HSTRING(IVectorView_HSTRING
*iface
)
55 return CONTAINING_RECORD(iface
, struct hstring_vector
, IVectorView_HSTRING_iface
);
58 static HRESULT STDMETHODCALLTYPE
hstring_vector_QueryInterface(IVectorView_HSTRING
*iface
,
59 REFIID iid
, void **out
)
61 struct hstring_vector
*impl
= impl_from_IVectorView_HSTRING(iface
);
62 TRACE("iface %p, iid %s, out %p stub!\n", iface
, debugstr_guid(iid
), out
);
64 if (IsEqualGUID(iid
, &IID_IUnknown
) ||
65 IsEqualGUID(iid
, &IID_IInspectable
) ||
66 IsEqualGUID(iid
, &IID_IAgileObject
) ||
67 IsEqualGUID(iid
, &IID_IVectorView_HSTRING
))
69 IUnknown_AddRef(iface
);
70 *out
= &impl
->IVectorView_HSTRING_iface
;
74 FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid
));
79 static ULONG STDMETHODCALLTYPE
hstring_vector_AddRef(IVectorView_HSTRING
*iface
)
81 struct hstring_vector
*impl
= impl_from_IVectorView_HSTRING(iface
);
82 ULONG ref
= InterlockedIncrement(&impl
->ref
);
83 TRACE("iface %p, ref %lu.\n", iface
, ref
);
87 static ULONG STDMETHODCALLTYPE
hstring_vector_Release(IVectorView_HSTRING
*iface
)
89 struct hstring_vector
*impl
= impl_from_IVectorView_HSTRING(iface
);
90 ULONG ref
= InterlockedDecrement(&impl
->ref
);
91 TRACE("iface %p, ref %lu.\n", iface
, ref
);
94 while (impl
->count
--) WindowsDeleteString(impl
->values
[impl
->count
]);
100 static HRESULT STDMETHODCALLTYPE
hstring_vector_GetIids(IVectorView_HSTRING
*iface
,
101 ULONG
*iid_count
, IID
**iids
)
103 FIXME("iface %p, iid_count %p, iids %p stub!\n", iface
, iid_count
, iids
);
107 static HRESULT STDMETHODCALLTYPE
hstring_vector_GetRuntimeClassName(IVectorView_HSTRING
*iface
,
110 FIXME("iface %p, class_name %p stub!\n", iface
, class_name
);
114 static HRESULT STDMETHODCALLTYPE
hstring_vector_GetTrustLevel(IVectorView_HSTRING
*iface
,
115 TrustLevel
*trust_level
)
117 FIXME("iface %p, trust_level %p stub!\n", iface
, trust_level
);
121 static HRESULT STDMETHODCALLTYPE
hstring_vector_GetAt(IVectorView_HSTRING
*iface
,
122 UINT32 index
, HSTRING
*value
)
124 struct hstring_vector
*impl
= impl_from_IVectorView_HSTRING(iface
);
126 TRACE("iface %p, index %#x, value %p.\n", iface
, index
, value
);
129 if (index
>= impl
->count
) return E_BOUNDS
;
130 return WindowsDuplicateString(impl
->values
[index
], value
);
133 static HRESULT STDMETHODCALLTYPE
hstring_vector_get_Size(IVectorView_HSTRING
*iface
,
136 struct hstring_vector
*impl
= impl_from_IVectorView_HSTRING(iface
);
138 TRACE("iface %p, value %p.\n", iface
, value
);
140 *value
= impl
->count
;
144 static HRESULT STDMETHODCALLTYPE
hstring_vector_IndexOf(IVectorView_HSTRING
*iface
,
145 HSTRING element
, UINT32
*index
, BOOLEAN
*found
)
147 struct hstring_vector
*impl
= impl_from_IVectorView_HSTRING(iface
);
150 TRACE("iface %p, element %p, index %p, found %p.\n", iface
, element
, index
, found
);
152 for (i
= 0; i
< impl
->count
; ++i
)
153 if (SUCCEEDED(WindowsCompareStringOrdinal(impl
->values
[i
], element
, &order
)) && order
== 0)
170 static HRESULT STDMETHODCALLTYPE
hstring_vector_GetMany(IVectorView_HSTRING
*iface
,
171 UINT32 start_index
, UINT32 items_size
, HSTRING
*items
, UINT
*count
)
173 struct hstring_vector
*impl
= impl_from_IVectorView_HSTRING(iface
);
177 TRACE("iface %p, start_index %#x, items %p, count %p.\n", iface
, start_index
, items
, count
);
179 memset(items
, 0, items_size
* sizeof(*items
));
181 for (i
= start_index
; i
< impl
->count
&& i
< start_index
+ items_size
; ++i
)
182 if (FAILED(hr
= WindowsDuplicateString(impl
->values
[i
], items
+ i
- start_index
)))
185 if (FAILED(hr
)) while (i
-- > start_index
) WindowsDeleteString(items
[i
- start_index
]);
186 *count
= i
- start_index
;
190 static const struct IVectorView_HSTRINGVtbl hstring_vector_vtbl
=
192 hstring_vector_QueryInterface
,
193 hstring_vector_AddRef
,
194 hstring_vector_Release
,
195 /* IInspectable methods */
196 hstring_vector_GetIids
,
197 hstring_vector_GetRuntimeClassName
,
198 hstring_vector_GetTrustLevel
,
199 /* IVectorView<HSTRING> methods */
200 hstring_vector_GetAt
,
201 hstring_vector_get_Size
,
202 hstring_vector_IndexOf
,
203 hstring_vector_GetMany
,
206 static HRESULT
hstring_vector_create(HSTRING
*values
, SIZE_T count
, IVectorView_HSTRING
**out
)
208 struct hstring_vector
*impl
;
210 if (!(impl
= malloc(offsetof(struct hstring_vector
, values
[count
])))) return E_OUTOFMEMORY
;
213 impl
->IVectorView_HSTRING_iface
.lpVtbl
= &hstring_vector_vtbl
;
215 memcpy(impl
->values
, values
, count
* sizeof(HSTRING
));
217 *out
= &impl
->IVectorView_HSTRING_iface
;
221 struct windows_globalization
223 IActivationFactory IActivationFactory_iface
;
224 IGlobalizationPreferencesStatics IGlobalizationPreferencesStatics_iface
;
228 struct language_factory
230 IActivationFactory IActivationFactory_iface
;
231 ILanguageFactory ILanguageFactory_iface
;
237 ILanguage ILanguage_iface
;
239 WCHAR name
[LOCALE_NAME_MAX_LENGTH
];
242 static inline struct windows_globalization
*impl_from_IActivationFactory(IActivationFactory
*iface
)
244 return CONTAINING_RECORD(iface
, struct windows_globalization
, IActivationFactory_iface
);
247 static inline struct language_factory
*impl_language_factory_from_IActivationFactory(IActivationFactory
*iface
)
249 return CONTAINING_RECORD(iface
, struct language_factory
, IActivationFactory_iface
);
252 static inline struct windows_globalization
*impl_from_IGlobalizationPreferencesStatics(IGlobalizationPreferencesStatics
*iface
)
254 return CONTAINING_RECORD(iface
, struct windows_globalization
, IGlobalizationPreferencesStatics_iface
);
257 static inline struct language_factory
*impl_from_ILanguageFactory(ILanguageFactory
*iface
)
259 return CONTAINING_RECORD(iface
, struct language_factory
, ILanguageFactory_iface
);
262 static inline struct language
*impl_from_ILanguage(ILanguage
*iface
)
264 return CONTAINING_RECORD(iface
, struct language
, ILanguage_iface
);
267 static HRESULT STDMETHODCALLTYPE
language_QueryInterface(
268 ILanguage
*iface
, REFIID iid
, void **out
)
270 TRACE("iface %p, iid %s, out %p.\n", iface
, debugstr_guid(iid
), out
);
272 if (IsEqualGUID(iid
, &IID_IUnknown
) ||
273 IsEqualGUID(iid
, &IID_IInspectable
) ||
274 IsEqualGUID(iid
, &IID_IAgileObject
) ||
275 IsEqualGUID(iid
, &IID_ILanguage
))
277 IUnknown_AddRef(iface
);
282 FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid
));
284 return E_NOINTERFACE
;
287 static ULONG STDMETHODCALLTYPE
language_AddRef(
290 struct language
*language
= impl_from_ILanguage(iface
);
291 ULONG ref
= InterlockedIncrement(&language
->ref
);
292 TRACE("iface %p, ref %lu.\n", iface
, ref
);
296 static ULONG STDMETHODCALLTYPE
language_Release(
299 struct language
*language
= impl_from_ILanguage(iface
);
300 ULONG ref
= InterlockedDecrement(&language
->ref
);
302 TRACE("iface %p, ref %lu.\n", iface
, ref
);
310 static HRESULT STDMETHODCALLTYPE
language_GetIids(
311 ILanguage
*iface
, ULONG
*iid_count
, IID
**iids
)
313 FIXME("iface %p, iid_count %p, iids %p stub!\n", iface
, iid_count
, iids
);
317 static HRESULT STDMETHODCALLTYPE
language_GetRuntimeClassName(
318 ILanguage
*iface
, HSTRING
*class_name
)
320 FIXME("iface %p, class_name %p stub!\n", iface
, class_name
);
324 static HRESULT STDMETHODCALLTYPE
language_GetTrustLevel(
325 ILanguage
*iface
, TrustLevel
*trust_level
)
327 FIXME("iface %p, trust_level %p stub!\n", iface
, trust_level
);
331 static HRESULT STDMETHODCALLTYPE
language_get_LanguageTag(
332 ILanguage
*iface
, HSTRING
*value
)
334 struct language
*language
= impl_from_ILanguage(iface
);
336 TRACE("iface %p, value %p.\n", iface
, value
);
338 return WindowsCreateString(language
->name
, wcslen(language
->name
), value
);
341 static HRESULT STDMETHODCALLTYPE
language_get_DisplayName(
342 ILanguage
*iface
, HSTRING
*value
)
344 FIXME("iface %p, value %p stub!\n", iface
, value
);
348 static HRESULT STDMETHODCALLTYPE
language_get_NativeName(
349 ILanguage
*iface
, HSTRING
*value
)
351 FIXME("iface %p, value %p stub!\n", iface
, value
);
355 static HRESULT STDMETHODCALLTYPE
language_get_Script(
356 ILanguage
*iface
, HSTRING
*value
)
358 FIXME("iface %p, value %p stub!\n", iface
, value
);
362 static const struct ILanguageVtbl language_vtbl
=
364 language_QueryInterface
,
367 /* IInspectable methods */
369 language_GetRuntimeClassName
,
370 language_GetTrustLevel
,
371 /* ILanguage methods */
372 language_get_LanguageTag
,
373 language_get_DisplayName
,
374 language_get_NativeName
,
378 static HRESULT STDMETHODCALLTYPE
windows_globalization_QueryInterface(
379 IActivationFactory
*iface
, REFIID iid
, void **out
)
381 struct windows_globalization
*impl
= impl_from_IActivationFactory(iface
);
382 TRACE("iface %p, iid %s, out %p stub!\n", iface
, debugstr_guid(iid
), out
);
384 if (IsEqualGUID(iid
, &IID_IUnknown
) ||
385 IsEqualGUID(iid
, &IID_IInspectable
) ||
386 IsEqualGUID(iid
, &IID_IAgileObject
) ||
387 IsEqualGUID(iid
, &IID_IActivationFactory
))
389 IUnknown_AddRef(iface
);
390 *out
= &impl
->IActivationFactory_iface
;
394 if (IsEqualGUID(iid
, &IID_IGlobalizationPreferencesStatics
))
396 IUnknown_AddRef(iface
);
397 *out
= &impl
->IGlobalizationPreferencesStatics_iface
;
401 FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid
));
403 return E_NOINTERFACE
;
406 static ULONG STDMETHODCALLTYPE
windows_globalization_AddRef(
407 IActivationFactory
*iface
)
409 struct windows_globalization
*impl
= impl_from_IActivationFactory(iface
);
410 ULONG ref
= InterlockedIncrement(&impl
->ref
);
411 TRACE("iface %p, ref %lu.\n", iface
, ref
);
415 static ULONG STDMETHODCALLTYPE
windows_globalization_Release(
416 IActivationFactory
*iface
)
418 struct windows_globalization
*impl
= impl_from_IActivationFactory(iface
);
419 ULONG ref
= InterlockedDecrement(&impl
->ref
);
420 TRACE("iface %p, ref %lu.\n", iface
, ref
);
424 static HRESULT STDMETHODCALLTYPE
windows_globalization_GetIids(
425 IActivationFactory
*iface
, ULONG
*iid_count
, IID
**iids
)
427 FIXME("iface %p, iid_count %p, iids %p stub!\n", iface
, iid_count
, iids
);
431 static HRESULT STDMETHODCALLTYPE
windows_globalization_GetRuntimeClassName(
432 IActivationFactory
*iface
, HSTRING
*class_name
)
434 FIXME("iface %p, class_name %p stub!\n", iface
, class_name
);
438 static HRESULT STDMETHODCALLTYPE
windows_globalization_GetTrustLevel(
439 IActivationFactory
*iface
, TrustLevel
*trust_level
)
441 FIXME("iface %p, trust_level %p stub!\n", iface
, trust_level
);
445 static HRESULT STDMETHODCALLTYPE
windows_globalization_ActivateInstance(
446 IActivationFactory
*iface
, IInspectable
**instance
)
448 FIXME("iface %p, instance %p stub!\n", iface
, instance
);
452 static const struct IActivationFactoryVtbl activation_factory_vtbl
=
454 windows_globalization_QueryInterface
,
455 windows_globalization_AddRef
,
456 windows_globalization_Release
,
457 /* IInspectable methods */
458 windows_globalization_GetIids
,
459 windows_globalization_GetRuntimeClassName
,
460 windows_globalization_GetTrustLevel
,
461 /* IActivationFactory methods */
462 windows_globalization_ActivateInstance
,
465 static HRESULT STDMETHODCALLTYPE
globalization_preferences_QueryInterface(
466 IGlobalizationPreferencesStatics
*iface
, REFIID iid
, void **object
)
468 struct windows_globalization
*impl
= impl_from_IGlobalizationPreferencesStatics(iface
);
469 return windows_globalization_QueryInterface(&impl
->IActivationFactory_iface
, iid
, object
);
472 static ULONG STDMETHODCALLTYPE
globalization_preferences_AddRef(
473 IGlobalizationPreferencesStatics
*iface
)
475 struct windows_globalization
*impl
= impl_from_IGlobalizationPreferencesStatics(iface
);
476 return windows_globalization_AddRef(&impl
->IActivationFactory_iface
);
479 static ULONG STDMETHODCALLTYPE
globalization_preferences_Release(
480 IGlobalizationPreferencesStatics
*iface
)
482 struct windows_globalization
*impl
= impl_from_IGlobalizationPreferencesStatics(iface
);
483 return windows_globalization_Release(&impl
->IActivationFactory_iface
);
486 static HRESULT STDMETHODCALLTYPE
globalization_preferences_GetIids(
487 IGlobalizationPreferencesStatics
*iface
, ULONG
*iid_count
, IID
**iids
)
489 FIXME("iface %p, iid_count %p, iids %p stub!\n", iface
, iid_count
, iids
);
493 static HRESULT STDMETHODCALLTYPE
globalization_preferences_GetRuntimeClassName(
494 IGlobalizationPreferencesStatics
*iface
, HSTRING
*class_name
)
496 FIXME("iface %p, class_name %p stub!\n", iface
, class_name
);
500 static HRESULT STDMETHODCALLTYPE
globalization_preferences_GetTrustLevel(
501 IGlobalizationPreferencesStatics
*iface
, TrustLevel
*trust_level
)
503 FIXME("iface %p, trust_level %p stub!\n", iface
, trust_level
);
507 static HRESULT STDMETHODCALLTYPE
globalization_preferences_get_Calendars(
508 IGlobalizationPreferencesStatics
*iface
, IVectorView_HSTRING
**out
)
510 FIXME("iface %p, out %p stub!\n", iface
, out
);
511 return hstring_vector_create(NULL
, 0, out
);
514 static HRESULT STDMETHODCALLTYPE
globalization_preferences_get_Clocks(
515 IGlobalizationPreferencesStatics
*iface
, IVectorView_HSTRING
**out
)
517 FIXME("iface %p, out %p stub!\n", iface
, out
);
518 return hstring_vector_create(NULL
, 0, out
);
521 static HRESULT STDMETHODCALLTYPE
globalization_preferences_get_Currencies(
522 IGlobalizationPreferencesStatics
*iface
, IVectorView_HSTRING
**out
)
524 FIXME("iface %p, out %p stub!\n", iface
, out
);
525 return hstring_vector_create(NULL
, 0, out
);
528 static HRESULT STDMETHODCALLTYPE
globalization_preferences_get_Languages(
529 IGlobalizationPreferencesStatics
*iface
, IVectorView_HSTRING
**out
)
533 WCHAR locale
[LOCALE_NAME_MAX_LENGTH
];
535 TRACE("iface %p, out %p.\n", iface
, out
);
537 if (!GetUserDefaultLocaleName(locale
, LOCALE_NAME_MAX_LENGTH
))
540 TRACE("returning language %s\n", debugstr_w(locale
));
542 if (FAILED(hr
= WindowsCreateString(locale
, wcslen(locale
), &hstring
)))
545 return hstring_vector_create(&hstring
, 1, out
);
548 static HRESULT STDMETHODCALLTYPE
globalization_preferences_get_HomeGeographicRegion(
549 IGlobalizationPreferencesStatics
*iface
, HSTRING
* out
)
553 TRACE("iface %p, out %p.\n", iface
, out
);
555 if (!GetUserDefaultGeoName(country
, 16))
558 TRACE("returning country %s\n", debugstr_w(country
));
560 return WindowsCreateString(country
, wcslen(country
), out
);
563 static HRESULT STDMETHODCALLTYPE
globalization_preferences_get_WeekStartsOn(
564 IGlobalizationPreferencesStatics
*iface
, enum DayOfWeek
* out
)
566 FIXME("iface %p, out %p stub!\n", iface
, out
);
570 static const struct IGlobalizationPreferencesStaticsVtbl globalization_preferences_vtbl
=
572 globalization_preferences_QueryInterface
,
573 globalization_preferences_AddRef
,
574 globalization_preferences_Release
,
575 /* IInspectable methods */
576 globalization_preferences_GetIids
,
577 globalization_preferences_GetRuntimeClassName
,
578 globalization_preferences_GetTrustLevel
,
579 /* IGlobalizationPreferencesStatics methods */
580 globalization_preferences_get_Calendars
,
581 globalization_preferences_get_Clocks
,
582 globalization_preferences_get_Currencies
,
583 globalization_preferences_get_Languages
,
584 globalization_preferences_get_HomeGeographicRegion
,
585 globalization_preferences_get_WeekStartsOn
,
588 static struct windows_globalization userprofile_preferences
=
590 {&activation_factory_vtbl
},
591 {&globalization_preferences_vtbl
},
595 static HRESULT STDMETHODCALLTYPE
windows_globalization_language_factory_QueryInterface(
596 IActivationFactory
*iface
, REFIID iid
, void **out
)
598 struct language_factory
*factory
= impl_language_factory_from_IActivationFactory(iface
);
600 TRACE("iface %p, iid %s, out %p.\n", iface
, debugstr_guid(iid
), out
);
602 if (IsEqualGUID(iid
, &IID_IUnknown
) ||
603 IsEqualGUID(iid
, &IID_IInspectable
) ||
604 IsEqualGUID(iid
, &IID_IAgileObject
) ||
605 IsEqualGUID(iid
, &IID_IActivationFactory
))
607 IUnknown_AddRef(iface
);
612 if (IsEqualGUID(iid
, &IID_ILanguageFactory
))
614 IUnknown_AddRef(iface
);
615 *out
= &factory
->ILanguageFactory_iface
;
619 FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid
));
621 return E_NOINTERFACE
;
624 static ULONG STDMETHODCALLTYPE
windows_globalization_language_factory_AddRef(IActivationFactory
*iface
)
626 struct language_factory
*factory
= impl_language_factory_from_IActivationFactory(iface
);
627 return InterlockedIncrement(&factory
->ref
);
630 static ULONG STDMETHODCALLTYPE
windows_globalization_language_factory_Release(IActivationFactory
*iface
)
632 struct language_factory
*factory
= impl_language_factory_from_IActivationFactory(iface
);
633 return InterlockedDecrement(&factory
->ref
);
636 static const struct IActivationFactoryVtbl activation_factory_language_vtbl
=
638 windows_globalization_language_factory_QueryInterface
,
639 windows_globalization_language_factory_AddRef
,
640 windows_globalization_language_factory_Release
,
641 /* IInspectable methods */
642 windows_globalization_GetIids
,
643 windows_globalization_GetRuntimeClassName
,
644 windows_globalization_GetTrustLevel
,
645 /* IActivationFactory methods */
646 windows_globalization_ActivateInstance
,
649 static HRESULT STDMETHODCALLTYPE
language_factory_QueryInterface(
650 ILanguageFactory
*iface
, REFIID iid
, void **object
)
652 struct language_factory
*factory
= impl_from_ILanguageFactory(iface
);
653 return IActivationFactory_QueryInterface(&factory
->IActivationFactory_iface
, iid
, object
);
656 static ULONG STDMETHODCALLTYPE
language_factory_AddRef(
657 ILanguageFactory
*iface
)
659 struct language_factory
*factory
= impl_from_ILanguageFactory(iface
);
660 return IActivationFactory_AddRef(&factory
->IActivationFactory_iface
);
663 static ULONG STDMETHODCALLTYPE
language_factory_Release(
664 ILanguageFactory
*iface
)
666 struct language_factory
*factory
= impl_from_ILanguageFactory(iface
);
667 return IActivationFactory_Release(&factory
->IActivationFactory_iface
);
670 static HRESULT STDMETHODCALLTYPE
language_factory_GetIids(
671 ILanguageFactory
*iface
, ULONG
*iid_count
, IID
**iids
)
673 FIXME("iface %p, iid_count %p, iids %p stub!\n", iface
, iid_count
, iids
);
677 static HRESULT STDMETHODCALLTYPE
language_factory_GetRuntimeClassName(
678 ILanguageFactory
*iface
, HSTRING
*class_name
)
680 FIXME("iface %p, class_name %p stub!\n", iface
, class_name
);
684 static HRESULT STDMETHODCALLTYPE
language_factory_GetTrustLevel(
685 ILanguageFactory
*iface
, TrustLevel
*trust_level
)
687 FIXME("iface %p, trust_level %p stub!\n", iface
, trust_level
);
691 static HRESULT STDMETHODCALLTYPE
language_factory_CreateLanguage(
692 ILanguageFactory
*iface
, HSTRING tag
, ILanguage
**value
)
694 const WCHAR
*name
= WindowsGetStringRawBuffer(tag
, NULL
);
695 WCHAR buffer
[LOCALE_NAME_MAX_LENGTH
];
696 struct language
*language
;
698 TRACE("iface %p, tag %p, value %p.\n", iface
, tag
, value
);
700 if (!GetLocaleInfoEx(name
, LOCALE_SNAME
, buffer
, ARRAY_SIZE(buffer
)))
703 if (!(language
= calloc(1, sizeof(*language
))))
704 return E_OUTOFMEMORY
;
706 language
->ILanguage_iface
.lpVtbl
= &language_vtbl
;
708 wcscpy(language
->name
, buffer
);
710 *value
= &language
->ILanguage_iface
;
715 static const struct ILanguageFactoryVtbl language_factory_vtbl
=
717 language_factory_QueryInterface
,
718 language_factory_AddRef
,
719 language_factory_Release
,
720 /* IInspectable methods */
721 language_factory_GetIids
,
722 language_factory_GetRuntimeClassName
,
723 language_factory_GetTrustLevel
,
724 /* ILanguageFactory methods */
725 language_factory_CreateLanguage
,
728 static struct language_factory language_factory
=
730 {&activation_factory_language_vtbl
},
731 {&language_factory_vtbl
},
735 HRESULT WINAPI
DllGetClassObject(REFCLSID clsid
, REFIID riid
, void **out
)
737 FIXME("clsid %s, riid %s, out %p stub!\n", debugstr_guid(clsid
), debugstr_guid(riid
), out
);
738 return CLASS_E_CLASSNOTAVAILABLE
;
741 HRESULT WINAPI
DllGetActivationFactory(HSTRING classid
, IActivationFactory
**factory
)
743 const WCHAR
*name
= WindowsGetStringRawBuffer(classid
, NULL
);
745 TRACE("classid %s, factory %p.\n", debugstr_hstring(classid
), factory
);
749 if (!wcscmp(name
, RuntimeClass_Windows_System_UserProfile_GlobalizationPreferences
))
751 *factory
= &userprofile_preferences
.IActivationFactory_iface
;
752 IUnknown_AddRef(*factory
);
754 else if (!wcscmp(name
, RuntimeClass_Windows_Globalization_Language
))
756 *factory
= &language_factory
.IActivationFactory_iface
;
757 IUnknown_AddRef(*factory
);
760 if (*factory
) return S_OK
;
761 return CLASS_E_CLASSNOTAVAILABLE
;