https://bugs.winehq.org/show_bug.cgi?id=30984
--- Comment #51 from Olivier F. R. Dierick o.dierick@piezo-forte.be --- Created attachment 72979 --> https://bugs.winehq.org/attachment.cgi?id=72979 Hack makes the staged patchset work again on Debian (default utf8 locale)
Hello,
The staged patchset is disabled in staging (see [1]).
The patchset fail to compile because kernelbase was converted to PE and MultiByteToWideChar() and GetLocaleInfoW() are no more directly accessible to non-PE winex11.drv.
The attached hack 'fixes' the staging patchset for me on system using UTF-8 locales by replacing the calls to those functions with workarounds.
For the first call to MultiByteToWideChar(), I just considered that the locale is UTF-8 (That's what CP_UNIXCP amounts to if WINEUNIXCP is not set which I think is the general case).
For the others calls to MultiByteToWideChar(), I couldn't understand what the format of the localized layout tables was but it didn't look like multi-byte encoded, so I just removed the call to MultiByteToWideChar() and copied the 4 char values as 1-byte Unicode codepoints.
With that change, there was no need to call GetLocaleInfoW() to get the ANSI codepage so I removed that part.
It was tested with wine-staging 7.15 and the game 'Lord of the Rings Online' (and also in the output of WINEDEBUG=+key,+keyboard wine notepad).
Note that it won't work if the current locale is not 'UTF-8' (as in LANG="fr_BE.UTF-8" for example), or if the values in the localized layout table are not 1-byte Unicode codepoints equivalent to the current locale Unicode codepoints 128..256. It is the case for the Belgian keyboard layout I tested, but it may be different for others.
I believe that the format of the data in the localized layout tables needs to be decided/clarified.
[1] https://github.com/wine-staging/wine-staging/blob/master/patches/winex11-key...