From c908c9c7c9e0da51a2b35915965e5a1d519497dd Mon Sep 17 00:00:00 2001 From: Akihiro Sagawa Date: Thu, 25 Jun 2015 00:42:07 +0900 Subject: [PATCH] winetest: Add SystemPreferredUILanguages to the log. A few GDI functions are affected by System account's display language (by GetSystemPreferredUILanguages). --- programs/winetest/main.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/programs/winetest/main.c b/programs/winetest/main.c index 01493770886..1eb49b6a699 100644 --- a/programs/winetest/main.c +++ b/programs/winetest/main.c @@ -445,20 +445,35 @@ static void print_version (void) static void print_language(void) { HMODULE hkernel32; + BOOL (WINAPI *pGetSystemPreferredUILanguages)(DWORD, PULONG, PZZWSTR, PULONG); LANGID (WINAPI *pGetUserDefaultUILanguage)(void); LANGID (WINAPI *pGetThreadUILanguage)(void); - xprintf (" SystemDefaultLCID=%x\n", GetSystemDefaultLCID()); - xprintf (" UserDefaultLCID=%x\n", GetUserDefaultLCID()); - xprintf (" ThreadLocale=%x\n", GetThreadLocale()); + xprintf (" SystemDefaultLCID=%04x\n", GetSystemDefaultLCID()); + xprintf (" UserDefaultLCID=%04x\n", GetUserDefaultLCID()); + xprintf (" ThreadLocale=%04x\n", GetThreadLocale()); hkernel32 = GetModuleHandleA("kernel32.dll"); + pGetSystemPreferredUILanguages = (void*)GetProcAddress(hkernel32, "GetSystemPreferredUILanguages"); pGetUserDefaultUILanguage = (void*)GetProcAddress(hkernel32, "GetUserDefaultUILanguage"); pGetThreadUILanguage = (void*)GetProcAddress(hkernel32, "GetThreadUILanguage"); + + if (pGetSystemPreferredUILanguages && !running_under_wine()) + { + WCHAR langW[32]; + ULONG num, size = sizeof(langW)/sizeof(langW[0]); + if (pGetSystemPreferredUILanguages(MUI_LANGUAGE_ID, &num, langW, &size)) + { + char lang[32], *p = lang; + WideCharToMultiByte(CP_ACP, 0, langW, size, lang, sizeof(lang), NULL, NULL); + for (p += strlen(p) + 1; *p != '\0'; p += strlen(p) + 1) *(p - 1) = ','; + xprintf (" SystemPreferredUILanguages=%s\n", lang); + } + } if (pGetUserDefaultUILanguage) - xprintf (" UserDefaultUILanguage=%x\n", pGetUserDefaultUILanguage()); + xprintf (" UserDefaultUILanguage=%04x\n", pGetUserDefaultUILanguage()); if (pGetThreadUILanguage) - xprintf (" ThreadUILanguage=%x\n", pGetThreadUILanguage()); + xprintf (" ThreadUILanguage=%04x\n", pGetThreadUILanguage()); } static inline BOOL is_dot_dir(const char* x)