From: Zhiyi Zhang zzhang@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55656 --- dlls/user32/tests/dialog.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/dlls/user32/tests/dialog.c b/dlls/user32/tests/dialog.c index 18a9685b230..7ea0d13c0f3 100644 --- a/dlls/user32/tests/dialog.c +++ b/dlls/user32/tests/dialog.c @@ -38,6 +38,7 @@ #include "winbase.h" #include "wingdi.h" #include "winuser.h" +#include "winnls.h"
#define MAXHWNDS 1024 static HWND hwnd [MAXHWNDS]; @@ -569,13 +570,24 @@ static LRESULT CALLBACK test_control_procA(HWND hwnd, UINT msg, WPARAM wparam, L
static int wm_char_count;
+static BOOL is_cjk(void) +{ + int lang_id = PRIMARYLANGID(GetUserDefaultLangID()); + + if (lang_id == LANG_CHINESE || lang_id == LANG_JAPANESE || lang_id == LANG_KOREAN) + return TRUE; + return FALSE; +} + static LRESULT CALLBACK test_IsDialogMessageA_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { switch (msg) { case WM_CHAR: - if (GetSystemMetrics(SM_DBCSENABLED)) + if (is_cjk()) ok(wparam == 0x5b57, "Got unexpected wparam %#Ix.\n", wparam); + else if (PRIMARYLANGID(GetUserDefaultLangID()) == LANG_HINDI && GetACP() == CP_UTF8) + ok(wparam == 0xfffd, "Got unexpected wparam %#Ix.\n", wparam); else ok(wparam == 0x3f, "Got unexpected wparam %#Ix.\n", wparam); wm_char_count++; @@ -863,8 +875,10 @@ static void test_IsDialogMessage(void) { if (msg.message == WM_CHAR) { - if (GetSystemMetrics(SM_DBCSENABLED)) + if (is_cjk()) ok(msg.wParam != 0x3f && msg.wParam != 0x5b57, "Got unexpected wparam %#Ix.\n", msg.wParam); + else if (PRIMARYLANGID(GetUserDefaultLangID()) == LANG_HINDI && GetACP() == CP_UTF8) + ok(msg.wParam == 0x97ade5, "Got unexpected wparam %#Ix.\n", msg.wParam); else ok(msg.wParam == 0x3f, "Got unexpected wparam %#Ix.\n", msg.wParam); ret = IsDialogMessageA(g_hwndMain, &msg);
From: Zhiyi Zhang zzhang@codeweavers.com
Using GetSystemMetrics(SM_DBCSENABLED) may incorrectly enable ASCII to Unicode mapping in mixed locale environments. For example, when UserDefaultLCID is French(040c) but SystemDefaultLCID is Japanese(0411).
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55655 --- dlls/user32/message.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/dlls/user32/message.c b/dlls/user32/message.c index 4016c95539a..86c6593e192 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -807,6 +807,14 @@ BOOL WINAPI DECLSPEC_HOTPATCH GetMessageA( MSG *msg, HWND hwnd, UINT first, UINT return (msg->message != WM_QUIT); }
+static BOOL is_cjk(void) +{ + int lang_id = PRIMARYLANGID(GetUserDefaultLangID()); + + if (lang_id == LANG_CHINESE || lang_id == LANG_JAPANESE || lang_id == LANG_KOREAN) + return TRUE; + return FALSE; +}
/*********************************************************************** * IsDialogMessageA (USER32.@) @@ -817,7 +825,7 @@ BOOL WINAPI IsDialogMessageA( HWND hwndDlg, LPMSG pmsg ) enum wm_char_mapping mapping; MSG msg = *pmsg;
- mapping = GetSystemMetrics( SM_DBCSENABLED ) ? WMCHAR_MAP_ISDIALOGMESSAGE : WMCHAR_MAP_NOMAPPING; + mapping = is_cjk() ? WMCHAR_MAP_ISDIALOGMESSAGE : WMCHAR_MAP_NOMAPPING; if (!map_wparam_AtoW( msg.message, &msg.wParam, mapping )) return TRUE; return IsDialogMessageW( hwndDlg, &msg );
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 tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=137939
Your paranoid android.
=== debian11 (32 bit hi:IN report) ===
user32: dialog.c:881: Test failed: Got unexpected wparam 0xade5.
I tested the fix on all of the TestBot variants now. See https://testbot.winehq.org/JobDetails.pl?Key=137901