Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
wine-mirror
GitHub Repository: wine-mirror/wine
Path: blob/master/dlls/bcp47langs/main.c
4388 views
1
/*
2
* Copyright 2025 Zhiyi Zhang for CodeWeavers
3
*
4
* This library is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Lesser General Public
6
* License as published by the Free Software Foundation; either
7
* version 2.1 of the License, or (at your option) any later version.
8
*
9
* This library is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* Lesser General Public License for more details.
13
*
14
* You should have received a copy of the GNU Lesser General Public
15
* License along with this library; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17
*/
18
19
#include <stdarg.h>
20
#include <windef.h>
21
#include <winbase.h>
22
#include <winnls.h>
23
#include "wine/debug.h"
24
25
WINE_DEFAULT_DEBUG_CHANNEL(bcp47langs);
26
27
HRESULT WINAPI GetFontFallbackLanguageList(const WCHAR *lang, size_t buffer_length, WCHAR *buffer,
28
size_t *required_buffer_length)
29
{
30
WCHAR locale[LOCALE_NAME_MAX_LENGTH];
31
size_t lang_length;
32
33
FIXME("lang %s, buffer_length %Iu, buffer %p, required_buffer_length %p stub!\n",
34
wine_dbgstr_w(lang), buffer_length, buffer, required_buffer_length);
35
36
if (!buffer_length || !buffer)
37
return E_INVALIDARG;
38
39
if (!lang)
40
{
41
if (!GetUserDefaultLocaleName(locale, LOCALE_NAME_MAX_LENGTH))
42
return E_FAIL;
43
44
lang = locale;
45
}
46
47
/* Return the original language as the fallback language list */
48
lang_length = wcslen(lang) + 1;
49
*required_buffer_length = lang_length;
50
if (buffer_length < lang_length)
51
return E_NOT_SUFFICIENT_BUFFER;
52
53
memcpy(buffer, lang, lang_length * sizeof(WCHAR));
54
return S_OK;
55
}
56
57