This is an undocumented API used by some programs to fetch the user's selected languages.
Example is Fusion360 (during its login process).
Signature currently taken from here: https://stackoverflow.com/questions/63877075/what-is-the-right-way-to-get-th... (Maybe that stackoverflow answer is also why Fusion has implemented this...) And I haven't found a way yet to retrieve a result that is not static.
-- v4: bcp47langs: Implement GetUserLanguages
From: Marius Schiffer marius@mschiffer.de
Implement an undocumented API used by some programs to fetch the user's selected languages. Returns only english as the language.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56915 --- dlls/bcp47langs/Makefile.in | 3 +++ dlls/bcp47langs/bcp47langs.spec | 2 +- dlls/bcp47langs/main.c | 13 +++++++++++++ dlls/bcp47langs/tests/Makefile.in | 6 ++++++ dlls/bcp47langs/tests/bcp47langs.c | 14 ++++++++++++++ include/bcp47langs.h | 2 ++ 6 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 dlls/bcp47langs/main.c create mode 100644 dlls/bcp47langs/tests/Makefile.in create mode 100644 dlls/bcp47langs/tests/bcp47langs.c create mode 100644 include/bcp47langs.h
diff --git a/dlls/bcp47langs/Makefile.in b/dlls/bcp47langs/Makefile.in index 5eb4caaf0e7..1c73a895909 100644 --- a/dlls/bcp47langs/Makefile.in +++ b/dlls/bcp47langs/Makefile.in @@ -1,2 +1,5 @@ MODULE = bcp47langs.dll IMPORTLIB = bcp47langs +IMPORTS = combase + +SOURCES = main.c diff --git a/dlls/bcp47langs/bcp47langs.spec b/dlls/bcp47langs/bcp47langs.spec index a054c1486a9..969f77b56b8 100644 --- a/dlls/bcp47langs/bcp47langs.spec +++ b/dlls/bcp47langs/bcp47langs.spec @@ -48,7 +48,7 @@ @ stub GetUserDisplayLanguageOverride @ stub GetUserLanguageInputMethods @ stub GetUserLanguageInputMethodsForUser -@ stub GetUserLanguages +@ stdcall GetUserLanguages(long ptr) @ stub GetUserLanguagesForAllUsers @ stub GetUserLanguagesForUser @ stub GetUserLocaleFromLanguageProfileOptOut diff --git a/dlls/bcp47langs/main.c b/dlls/bcp47langs/main.c new file mode 100644 index 00000000000..23040618195 --- /dev/null +++ b/dlls/bcp47langs/main.c @@ -0,0 +1,13 @@ +#include <hstring.h> +#include <winstring.h> + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(bcp47langs); + +int WINAPI GetUserLanguages(char delimiter, HSTRING* user_languages) { + static const WCHAR *languages = L"en-us"; + FIXME("stub, only returning en-us\n"); + WindowsCreateString(languages, wcslen(languages), user_languages); + return 0; +} diff --git a/dlls/bcp47langs/tests/Makefile.in b/dlls/bcp47langs/tests/Makefile.in new file mode 100644 index 00000000000..0d8861089f7 --- /dev/null +++ b/dlls/bcp47langs/tests/Makefile.in @@ -0,0 +1,6 @@ +TESTDLL = bcp47langs.dll +IMPORTS = bcp47langs msvcrt + +SOURCES = \ + bcp47langs.c + diff --git a/dlls/bcp47langs/tests/bcp47langs.c b/dlls/bcp47langs/tests/bcp47langs.c new file mode 100644 index 00000000000..c893fc0c17b --- /dev/null +++ b/dlls/bcp47langs/tests/bcp47langs.c @@ -0,0 +1,14 @@ +#include <wine/test.h> +#include <winbase.h> + +#include "msvcrt/locale.h" +#include "bcp47langs.h" + +START_TEST(paths) +{ + int ret = locale("LC_ALL", "enu"); + HSTRING *result; + ok(GetUserLanguages(",", result) == 0); + WCHAR *user_languages = WindowsGetStringRawBuffer(result, null); + ok(user_languages == "en-us"); +} diff --git a/include/bcp47langs.h b/include/bcp47langs.h new file mode 100644 index 00000000000..c72d0d75430 --- /dev/null +++ b/include/bcp47langs.h @@ -0,0 +1,2 @@ + +int WINAPI GetUserLanguages(char delimiter, HSTRING* user_languages);
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=147280
Your paranoid android.
=== build (build log) ===
../wine/include/bcp47langs.h:2:45: error: unknown type name ‘HSTRING’ ../wine/dlls/bcp47langs/tests/bcp47langs.c:10:5: error: unknown type name ‘HSTRING’ ../wine/include/wine/test.h:118:83: error: too few arguments to function ‘winetest_ok’ ../wine/dlls/bcp47langs/tests/bcp47langs.c:12:63: error: ‘null’ undeclared (first use in this function) ../wine/include/wine/test.h:118:83: error: too few arguments to function ‘winetest_ok’ Task: The exe32 Wine build failed
=== debian11 (build log) ===
../wine/include/bcp47langs.h:2:45: error: unknown type name ‘HSTRING’ ../wine/dlls/bcp47langs/tests/bcp47langs.c:10:5: error: unknown type name ‘HSTRING’ ../wine/include/wine/test.h:118:83: error: too few arguments to function ‘winetest_ok’ ../wine/dlls/bcp47langs/tests/bcp47langs.c:12:63: error: ‘null’ undeclared (first use in this function) ../wine/include/wine/test.h:118:83: error: too few arguments to function ‘winetest_ok’ Task: The win32 Wine build failed
=== debian11b (build log) ===
../wine/include/bcp47langs.h:2:45: error: unknown type name ‘HSTRING’ ../wine/dlls/bcp47langs/tests/bcp47langs.c:10:5: error: unknown type name ‘HSTRING’ ../wine/include/wine/test.h:118:83: error: too few arguments to function ‘winetest_ok’ ../wine/dlls/bcp47langs/tests/bcp47langs.c:12:63: error: ‘null’ undeclared (first use in this function) ../wine/include/wine/test.h:118:83: error: too few arguments to function ‘winetest_ok’ Task: The wow64 Wine build failed