xref: /reactos/sdk/lib/crt/include/internal/tls.h (revision 40462c92)
1 /* tls.h */
2 
3 #ifndef __CRT_INTERNAL_TLS_H
4 #define __CRT_INTERNAL_TLS_H
5 
6 #ifndef _CRT_PRECOMP_H
7 #error DO NOT INCLUDE THIS HEADER DIRECTLY
8 #endif
9 
10 #include <stddef.h>
11 #include <time.h>
12 #include <locale.h>
13 #include <windef.h>
14 #include <winbase.h>
15 #include <winnt.h>
16 
17 #include <internal/wine/eh.h>
18 
19 /* TLS data */
20 extern DWORD tls_index;
21 
22 struct __thread_data {
23     DWORD                                 tid;
24     HANDLE                                handle;
25     int                                   thread_errno;
26     unsigned long                         thread_doserrno;
27     int                                   unk1;
28     unsigned int                          random_seed;        /* seed for rand() */
29     char                                  *strtok_next;        /* next ptr for strtok() */
30     wchar_t                               *wcstok_next;        /* next ptr for wcstok() */
31     unsigned char                         *mbstok_next;        /* next ptr for mbstok() */
32     char                                  *strerror_buffer;    /* buffer for strerror */
33     wchar_t                               *wcserror_buffer;    /* buffer for wcserror */
34     char                                  *tmpnam_buffer;      /* buffer for tmpname() */
35     wchar_t                               *wtmpnam_buffer;     /* buffer for wtmpname() */
36     void                                  *unk2[2];
37     char                                  *asctime_buffer;     /* buffer for asctime */
38     wchar_t                               *wasctime_buffer;    /* buffer for wasctime */
39     struct tm                             *time_buffer;        /* buffer for localtime/gmtime */
40     char                                  *efcvt_buffer;       /* buffer for ecvt/fcvt */
41     int                                   unk3[2];
42     void                                  *unk4[3];
43     EXCEPTION_POINTERS                    *xcptinfo;
44     int                                   fpecode;
45     struct MSVCRT_threadmbcinfostruct     *mbcinfo;
46     struct MSVCRT_threadlocaleinfostruct  *locinfo;
47     BOOL                                  have_locale;
48     int                                   unk5[1];
49     terminate_function                    terminate_handler;
50     unexpected_function                   unexpected_handler;
51     _se_translator_function               se_translator;
52     void                                  *unk6[3];
53     int                                   unk7;
54     EXCEPTION_RECORD                      *exc_record;
55     void                                  *unk8[100];
56 };
57 
58 typedef struct __thread_data thread_data_t;
59 
60 extern BOOL msvcrt_init_tls(void);
61 extern BOOL msvcrt_free_tls(void);
62 extern thread_data_t *msvcrt_get_thread_data(void);
63 extern void msvcrt_free_tls_mem(void);
64 
65 #define MSVCRT_ENABLE_PER_THREAD_LOCALE 1
66 #define MSVCRT_DISABLE_PER_THREAD_LOCALE 2
67 
68 #endif /* __MSVCRT_INTERNAL_TLS_H */
69 
70 /* EOF */
71