[PATCH v3 0/1] MR6131: Draft: Extend bcp47langs.dll with GetUserLanguages
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. -- v3: bcp47langs: Implement GetUserLanguages https://gitlab.winehq.org/wine/wine/-/merge_requests/6131
From: Marius Schiffer <marius(a)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 | 8 ++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 dlls/bcp47langs/main.c 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..f79c27dbf02 --- /dev/null +++ b/dlls/bcp47langs/main.c @@ -0,0 +1,8 @@ +#include <hstring.h> +#include <winstring.h> + +int WINAPI GetUserLanguages(char Delimiter, HSTRING* UserLanguages) { + static const WCHAR* languages = L"eng"; + WindowsCreateString(languages, wcslen(languages), UserLanguages); + return 0; +} -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/6131
Zhiyi Zhang (@zhiyi) commented about dlls/bcp47langs/main.c:
+#include <hstring.h> +#include <winstring.h> + +int WINAPI GetUserLanguages(char Delimiter, HSTRING* UserLanguages) { We prefer the underscore style in wine's code. So please use delimiter and user_languages.
Also please align the asterisk to the right. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/6131#note_76724
Zhiyi Zhang (@zhiyi) commented about dlls/bcp47langs/main.c:
+#include <hstring.h> +#include <winstring.h> + +int WINAPI GetUserLanguages(char Delimiter, HSTRING* UserLanguages) { + static const WCHAR* languages = L"eng"; Add a fixme trace and note that this is a stub.
Also, please add some tests. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/6131#note_76725
Just a drive-by comment and sorry to be off-topic but @MariusSchiffer might be perhaps interested to look at some point also into the Fusion360 fixes of MR !2343. :wink: -- https://gitlab.winehq.org/wine/wine/-/merge_requests/6131#note_76726
participants (4)
-
Clemens Leu (@lorn10) -
Marius Schiffer -
Marius Schiffer (@MariusSchiffer) -
Zhiyi Zhang (@zhiyi)