]> pd.if.org Git - pdclib/blob - platform/win32/functions/_PDCLIB/_PDCLIB_runTlsCallbacks.c
Cosmetic comment fixes.
[pdclib] / platform / win32 / functions / _PDCLIB / _PDCLIB_runTlsCallbacks.c
1 /* _PDCLIB_runTlsCallbacks( void *, DWORD, PVOID )
2
3    This file is part of the Public Domain C Library (PDCLib).
4    Permission is granted to use, modify, and / or redistribute at will.
5 */
6
7 #include <stddef.h>
8 #include <windows.h>
9
10 #ifndef REGTEST
11 extern PIMAGE_TLS_CALLBACK __crt_xl_start__;
12 #ifdef __GNUC__
13 __attribute__((section(".CRT$XLZZZ")))
14 #else
15 __declspec(allocate(".CRT$XLZZZ")) 
16 #endif
17 PIMAGE_TLS_CALLBACK __crt_xl_end__ = NULL;
18
19 /* Runs all TLS callbacks registered in the executable
20  */
21
22 void NTAPI _PDCLIB_runTlsCallbacks(void * image, DWORD reason, PVOID pv);
23 void NTAPI _PDCLIB_runTlsCallbacks(void * image, DWORD reason, PVOID pv)
24 {
25     PIMAGE_TLS_CALLBACK * pcb = &__crt_xl_start__;
26
27     while(*pcb) (*(pcb++))(image, reason, pv);
28 }
29 #endif
30
31 #ifdef TEST
32 #include "_PDCLIB_test.h"
33
34 /* Tested in tss_get.c */
35 int main( void )
36 {
37     return TEST_RESULTS;
38 }
39
40 #endif