]> pd.if.org Git - pdclib/blob - platform/win32/functions/_PDCLIB/_PDCLIB_runTlsCallbacks.c
dos2unix
[pdclib] / platform / win32 / functions / _PDCLIB / _PDCLIB_runTlsCallbacks.c
1 #include <stddef.h>
2 #include <windows.h>
3
4 #ifndef REGTEST
5 extern PIMAGE_TLS_CALLBACK __crt_xl_start__;
6 #ifdef __GNUC__
7 __attribute__((section(".CRT$XLZZZ")))
8 #else
9 __declspec(allocate(".CRT$XLZZZ")) 
10 #endif
11 PIMAGE_TLS_CALLBACK __crt_xl_end__ = NULL;
12
13 /* Runs all TLS callbacks registered in the executable
14  */
15
16 void NTAPI _PDCLIB_runTlsCallbacks(void * image, DWORD reason, PVOID pv);
17 void NTAPI _PDCLIB_runTlsCallbacks(void * image, DWORD reason, PVOID pv)
18 {
19     PIMAGE_TLS_CALLBACK * pcb = &__crt_xl_start__;
20
21     while(*pcb) (*(pcb++))(image, reason, pv);
22 }
23 #endif
24
25 #ifdef TEST
26 #include "_PDCLIB_test.h"
27
28 /* Tested in tss_get.c */
29 int main( void )
30 {
31     return TEST_RESULTS;
32 }
33
34 #endif