* win: fix building on MinGW

MinGW does not have LOCALE_INVARIANT/_malloca/_freea/wmemcpy_s present on the system.

My building environment:
gcc version 4.8.1 (GCC)
GNU gdb (GDB) 7.6.1
GNU ld (GNU Binutils) 2.24
GNU windres (GNU Binutils) 2.24
GNU dlltool (GNU Binutils) 2.24
GNU Make 3.82.90
#define __MINGW32_VERSION           3.20
#define __W32API_VERSION 3.17