Piotr Caban (@piotr) commented about dlls/msvcrt/thread.c:
#if _MSVCR_VER >= 140 ptr->module = NULL; #endif
_setmbcp(_MB_CP_ANSI);
You can't call _setmbcp() here - it might modify other thread mbcp when global (non per-thread) settings are used. The bug is caused by using uninitialized locale cache. The simplest solution is to set: ```c ptr->cached_locale[0] = 'C'; ptr->cached_locale[1] = 0; ```