This patch series fixes management of _locale_t objects to align more with native. Some apps and libraries--most notably libc++--depend on this to behave properly.
The first patch contains tests demonstrating the proper behavior of _locale_t objects and their various members. Patches 2 through 6 copy various portions of the threadlocinfo struct from old to new when they aren't updated. This is all to clear the way for patch 7, which updates the locale pointer in msvcrt itself instead of the contents of the threadlocinfo struct. The last patch fixes the reference counting behavior of _get_current_locale() to match native.