mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-28 12:23:28 +00:00
Call the registered exit functions if the dll is unloaded.
svn path=/trunk/; revision=17294
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user