https://bugs.winehq.org/show_bug.cgi?id=51478
Bug ID: 51478 Summary: dinput:keyboard breaks user32:input's test_keyboard_layout_name() in some locales () Product: Wine Version: 6.10 Hardware: x86-64 OS: Windows Status: NEW Severity: normal Priority: P2 Component: user32 Assignee: wine-bugs@winehq.org Reporter: fgouget@codeweavers.com
Created attachment 70313 --> https://bugs.winehq.org/attachment.cgi?id=70313 Add test_keyboard_layout_name() traces
The WineTest runs show the following test_keyboard_layout_name() failure in some locales:
https://test.winehq.org/data/patterns.html#user32:input
input.c:3169: Test failed: Could not find keyboard layout 0000000004110411 in preload list
This is 100% reproducible in the following configurations (only the keyboard layout id differs): win7_newtb-w7u-es win7_newtb-w7u-pt-PT win2004_newtb-w10pro64-ar-64 win2004_newtb-w10pro64-he-64 win2004_newtb-w10pro64-hi-64 win2004_newtb-w10pro64-ja-64 win2004_newtb-w10pro64-ko-64 win2004_newtb-w10pro64-pt-BR-64 win2004_newtb-w10pro64-ru-64 win2004_newtb-w10pro64-zh-CN-64
Notes: * Interestingly this means this failure does not happen in the English, French, German and Greek locales. * Also user32:input only fails on the first run that follows dinput:keyboard, and does not ever fail again, even if dinput:keyboard is run again.
In the w10pro64_pt_BR case, adding extra traces shows that the root of the issue is that GetKeyboardLayoutList() returns 10 instead of 13. As a result test_keyboard_layout_name() fails to retrieve all the Keyboard Layout\Preload values (there is 12 of these, not 10 or 13!).
Also the items are not in the same order in layouts_preload and layouts so this causes some entries to be missing.
More notes: * The ok() message is wrong: it is not layout we are looking for but layouts[i], aka klid.
* I don't know why the GetKeyboardLayoutList() return value changes in the first run that follows dinput:keyboard, but I'm not sure it makes sense to assume it matches the number of entries in the Preload key in the first place.