X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=platform%2Fwin32%2Ffunctions%2F_PDCLIB%2F_PDCLIB_runTlsCallbacks.c;h=318f91ceabf6bcf089846e746171cc38f0c064ba;hp=7dcf7a69846874579d6a29c7db35aaa33bab4e7a;hb=c42d6c99b024d1a93994d734d9739a3db44c9d67;hpb=639bad513ab9399ed9a8c588a476a10dbe6c9478 diff --git a/platform/win32/functions/_PDCLIB/_PDCLIB_runTlsCallbacks.c b/platform/win32/functions/_PDCLIB/_PDCLIB_runTlsCallbacks.c index 7dcf7a6..318f91c 100644 --- a/platform/win32/functions/_PDCLIB/_PDCLIB_runTlsCallbacks.c +++ b/platform/win32/functions/_PDCLIB/_PDCLIB_runTlsCallbacks.c @@ -1,34 +1,40 @@ -#include -#include - -#ifndef REGTEST -extern PIMAGE_TLS_CALLBACK __crt_xl_start__; -#ifdef __GNUC__ -__attribute__((section(".CRT$XLZZZ"))) -#else -__declspec(allocate(".CRT$XLZZZ")) -#endif -PIMAGE_TLS_CALLBACK __crt_xl_end__ = NULL; - -/* Runs all TLS callbacks registered in the executable - */ - -void NTAPI _PDCLIB_runTlsCallbacks(void * image, DWORD reason, PVOID pv); -void NTAPI _PDCLIB_runTlsCallbacks(void * image, DWORD reason, PVOID pv) -{ - PIMAGE_TLS_CALLBACK * pcb = &__crt_xl_start__; - - while(*pcb) (*(pcb++))(image, reason, pv); -} -#endif - -#ifdef TEST -#include <_PDCLIB_test.h> - -/* Tested in tss_get.c */ -int main( void ) -{ - return TEST_RESULTS; -} - -#endif \ No newline at end of file +/* _PDCLIB_runTlsCallbacks( void *, DWORD, PVOID ) + + This file is part of the Public Domain C Library (PDCLib). + Permission is granted to use, modify, and / or redistribute at will. +*/ + +#include +#include + +#ifndef REGTEST +extern PIMAGE_TLS_CALLBACK __crt_xl_start__; +#ifdef __GNUC__ +__attribute__((section(".CRT$XLZZZ"))) +#else +__declspec(allocate(".CRT$XLZZZ")) +#endif +PIMAGE_TLS_CALLBACK __crt_xl_end__ = NULL; + +/* Runs all TLS callbacks registered in the executable + */ + +void NTAPI _PDCLIB_runTlsCallbacks(void * image, DWORD reason, PVOID pv); +void NTAPI _PDCLIB_runTlsCallbacks(void * image, DWORD reason, PVOID pv) +{ + PIMAGE_TLS_CALLBACK * pcb = &__crt_xl_start__; + + while(*pcb) (*(pcb++))(image, reason, pv); +} +#endif + +#ifdef TEST +#include "_PDCLIB_test.h" + +/* Tested in tss_get.c */ +int main( void ) +{ + return TEST_RESULTS; +} + +#endif