'How do I force a system locale for a certain process?
I am writing a mod for an old video game which I don't have the source code for.
The game has critical bugs ('random' crashes, which are hard to debug without source code access) and from my observation, they only occur when using certain system locales - so far I've discovered it happens with the Japanese and Chinese locales. I assume said bugs happen due to misuse of some Windows APIs.
I inject my code to the app using DLL injection and I use Microsoft Detours.
My intention is to force the process to think that the system locale is English (US). My attempt was to inject the following piece of code in the main thread, but it didn't seem to work. I was able to notice that it didn't work as the game renders fonts differently according to your locale (monospaced font when using Japanese, for example).
This is the code I used to try reproducing the Japanese locale on the process:
SetThreadLocale(MAKELCID(MAKELANGID(LANG_JAPANESE, SUBLANG_JAPANESE_JAPAN), SORT_DEFAULT));
The call to SetThreadLocale returns 1, so I believe the call is successful (although its documentation is confusing - the return type is BOOL but the documentation says it should return LCID).
Is there any solution for this issue?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
