In ucrt, this struct has a different layout, with only three fields exposed in headers (which can be used by inline functions).
This fixes use of some ctype.h functions like e.g. _isdigit_l from applications that use ucrt (both with MSVC and mingw-w64).
Signed-off-by: Martin Storsjo martin@martin.st --- dlls/msvcrt/msvcrt.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
diff --git a/dlls/msvcrt/msvcrt.h b/dlls/msvcrt/msvcrt.h index 552b48aa53..ccb8fec1af 100644 --- a/dlls/msvcrt/msvcrt.h +++ b/dlls/msvcrt/msvcrt.h @@ -163,8 +163,19 @@ typedef struct { } MSVCRT___lc_time_data;
typedef struct MSVCRT_threadlocaleinfostruct { +#if _MSVCR_VER >= 140 + // In UCRT, only these three members are visible in user facing headers. + unsigned short *pctype; + int mb_cur_max; + unsigned int lc_codepage; + // Keep the rest of the struct (except for these members) below, that + // msvcrt internal code needs. +#endif + int refcount; +#if _MSVCR_VER < 140 unsigned int lc_codepage; +#endif unsigned int lc_collate_cp; MSVCRT_ulong lc_handle[6]; MSVCRT_LC_ID lc_id[6]; @@ -175,14 +186,18 @@ typedef struct MSVCRT_threadlocaleinfostruct { int *wrefcount; } lc_category[6]; int lc_clike; +#if _MSVCR_VER < 140 int mb_cur_max; +#endif int *lconv_intl_refcount; int *lconv_num_refcount; int *lconv_mon_refcount; struct MSVCRT_lconv *lconv; int *ctype1_refcount; unsigned short *ctype1; +#if _MSVCR_VER < 140 unsigned short *pctype; +#endif unsigned char *pclmap; unsigned char *pcumap; MSVCRT___lc_time_data *lc_time_curr;
Hi Martin,
On 10/2/19 9:32 AM, Martin Storsjo wrote:
typedef struct MSVCRT_threadlocaleinfostruct { +#if _MSVCR_VER >= 140
- // In UCRT, only these three members are visible in user facing headers.
- unsigned short *pctype;
- int mb_cur_max;
- unsigned int lc_codepage;
- // Keep the rest of the struct (except for these members) below, that
- // msvcrt internal code needs.
+#endif
The change looks good for me. Please don't use c++ style comments (probably the comments are not needed at all).
Thanks, Piotr