mirror of
https://github.com/reactos/reactos.git
synced 2024-07-29 23:58:44 +00:00
Call the registered exit functions if the dll is unloaded.
svn path=/trunk/; revision=17294
This commit is contained in:
parent
d85fe524ac
commit
7faccfa7bb
|
@ -12,13 +12,7 @@ struct __atexit *__atexit_ptr = 0;
|
|||
void exit(int status)
|
||||
{
|
||||
//int i;
|
||||
struct __atexit *a = __atexit_ptr;
|
||||
__atexit_ptr = 0; /* to prevent infinite loops */
|
||||
while (a)
|
||||
{
|
||||
(a->__function)();
|
||||
a = a->__next;
|
||||
}
|
||||
|
||||
/*
|
||||
if (__stdio_cleanup_hook)
|
||||
__stdio_cleanup_hook();
|
||||
|
|
|
@ -2,6 +2,19 @@
|
|||
#include <stdlib.h>
|
||||
#include <internal/atexit.h>
|
||||
|
||||
void _atexit_cleanup(void)
|
||||
{
|
||||
struct __atexit *next, *a = __atexit_ptr;
|
||||
__atexit_ptr = 0; /* to prevent infinite loops */
|
||||
while (a)
|
||||
{
|
||||
(a->__function)();
|
||||
next = a->__next;
|
||||
free(a);
|
||||
a = next;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*
|
||||
|
|
|
@ -38,6 +38,7 @@ extern BOOL __fileno_init(void);
|
|||
extern int BlockEnvToEnvironA(void);
|
||||
extern int BlockEnvToEnvironW(void);
|
||||
extern void FreeEnvironment(char **environment);
|
||||
extern void _atexit_cleanup(void);
|
||||
|
||||
extern unsigned int _osver;
|
||||
extern unsigned int _winminor;
|
||||
|
@ -174,6 +175,7 @@ DllMain(PVOID hinstDll, ULONG dwReason, PVOID reserved)
|
|||
DPRINT("Detach %d\n", nAttachCount);
|
||||
/* FIXME: more cleanup... */
|
||||
_fcloseall();
|
||||
_atexit_cleanup();
|
||||
|
||||
/* destroy tls stuff */
|
||||
DestroyThreadData();
|
||||
|
|
|
@ -37,6 +37,7 @@ extern BOOL __fileno_init(void);
|
|||
extern int BlockEnvToEnvironA(void);
|
||||
extern int BlockEnvToEnvironW(void);
|
||||
extern void FreeEnvironment(char **environment);
|
||||
extern void _atexit_cleanup(void);
|
||||
|
||||
extern unsigned int _osver;
|
||||
extern unsigned int _winminor;
|
||||
|
@ -116,6 +117,7 @@ DllMain(PVOID hinstDll, ULONG dwReason, PVOID reserved)
|
|||
//DPRINT("Detach\n");
|
||||
/* FIXME: more cleanup... */
|
||||
_fcloseall();
|
||||
_atexit_cleanup();
|
||||
|
||||
/* destroy tls stuff */
|
||||
DestroyThreadData();
|
||||
|
|
Loading…
Reference in a new issue