Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
0673ddf3
Commit
0673ddf3
authored
Mar 26, 2019
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Export the onexit functions from the import library.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
59e6cc16
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
148 additions
and
140 deletions
+148
-140
Makefile.in
dlls/msvcr100/Makefile.in
+1
-0
Makefile.in
dlls/msvcr110/Makefile.in
+1
-0
Makefile.in
dlls/msvcr120/Makefile.in
+1
-0
Makefile.in
dlls/msvcr70/Makefile.in
+1
-0
Makefile.in
dlls/msvcr71/Makefile.in
+1
-0
Makefile.in
dlls/msvcr80/Makefile.in
+1
-0
Makefile.in
dlls/msvcr90/Makefile.in
+1
-0
Makefile.in
dlls/msvcrt/Makefile.in
+1
-0
exit.c
dlls/msvcrt/exit.c
+7
-131
msvcrt.h
dlls/msvcrt/msvcrt.h
+7
-0
msvcrt.spec
dlls/msvcrt/msvcrt.spec
+0
-3
onexit.c
dlls/msvcrt/onexit.c
+119
-0
Makefile.in
dlls/ucrtbase/Makefile.in
+1
-0
ucrtbase.spec
dlls/ucrtbase/ucrtbase.spec
+6
-6
No files found.
dlls/msvcr100/Makefile.in
View file @
0673ddf3
...
...
@@ -26,6 +26,7 @@ C_SRCS = \
math.c
\
mbcs.c
\
misc.c
\
onexit.c
\
process.c
\
scanf.c
\
scheduler.c
\
...
...
dlls/msvcr110/Makefile.in
View file @
0673ddf3
...
...
@@ -26,6 +26,7 @@ C_SRCS = \
math.c
\
mbcs.c
\
misc.c
\
onexit.c
\
process.c
\
scanf.c
\
scheduler.c
\
...
...
dlls/msvcr120/Makefile.in
View file @
0673ddf3
...
...
@@ -26,6 +26,7 @@ C_SRCS = \
math.c
\
mbcs.c
\
misc.c
\
onexit.c
\
process.c
\
scanf.c
\
scheduler.c
\
...
...
dlls/msvcr70/Makefile.in
View file @
0673ddf3
...
...
@@ -26,6 +26,7 @@ C_SRCS = \
math.c
\
mbcs.c
\
misc.c
\
onexit.c
\
process.c
\
scanf.c
\
string.c
\
...
...
dlls/msvcr71/Makefile.in
View file @
0673ddf3
...
...
@@ -26,6 +26,7 @@ C_SRCS = \
math.c
\
mbcs.c
\
misc.c
\
onexit.c
\
process.c
\
scanf.c
\
string.c
\
...
...
dlls/msvcr80/Makefile.in
View file @
0673ddf3
...
...
@@ -26,6 +26,7 @@ C_SRCS = \
math.c
\
mbcs.c
\
misc.c
\
onexit.c
\
process.c
\
scanf.c
\
string.c
\
...
...
dlls/msvcr90/Makefile.in
View file @
0673ddf3
...
...
@@ -26,6 +26,7 @@ C_SRCS = \
math.c
\
mbcs.c
\
misc.c
\
onexit.c
\
process.c
\
scanf.c
\
string.c
\
...
...
dlls/msvcrt/Makefile.in
View file @
0673ddf3
...
...
@@ -25,6 +25,7 @@ C_SRCS = \
math.c
\
mbcs.c
\
misc.c
\
onexit.c
\
process.c
\
scanf.c
\
scheduler.c
\
...
...
dlls/msvcrt/exit.c
View file @
0673ddf3
...
...
@@ -31,28 +31,12 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
static
MSVCRT_purecall_handler
purecall_handler
=
NULL
;
typedef
struct
MSVCRT__onexit_table_t
{
MSVCRT__onexit_t
*
_first
;
MSVCRT__onexit_t
*
_last
;
MSVCRT__onexit_t
*
_end
;
}
MSVCRT__onexit_table_t
;
static
MSVCRT__onexit_table_t
MSVCRT_atexit_table
;
static
MSVCRT__onexit_table_t
MSVCRT_quick_exit_table
;
typedef
void
(
__stdcall
*
_tls_callback_type
)(
void
*
,
ULONG
,
void
*
);
static
_tls_callback_type
tls_atexit_callback
;
static
CRITICAL_SECTION
MSVCRT_onexit_cs
;
static
CRITICAL_SECTION_DEBUG
MSVCRT_onexit_cs_debug
=
{
0
,
0
,
&
MSVCRT_onexit_cs
,
{
&
MSVCRT_onexit_cs_debug
.
ProcessLocksList
,
&
MSVCRT_onexit_cs_debug
.
ProcessLocksList
},
0
,
0
,
{
(
DWORD_PTR
)(
__FILE__
": MSVCRT_onexit_cs"
)
}
};
static
CRITICAL_SECTION
MSVCRT_onexit_cs
=
{
&
MSVCRT_onexit_cs_debug
,
-
1
,
0
,
0
,
0
,
0
};
extern
int
MSVCRT_app_type
;
extern
MSVCRT_wchar_t
*
MSVCRT__wpgmptr
;
...
...
@@ -61,93 +45,15 @@ static int MSVCRT_error_mode = MSVCRT__OUT_TO_DEFAULT;
void
(
*
CDECL
_aexit_rtn
)(
int
)
=
MSVCRT__exit
;
static
int
initialize_onexit_table
(
MSVCRT__onexit_table_t
*
table
)
{
if
(
!
table
)
return
-
1
;
if
(
table
->
_first
==
table
->
_end
)
table
->
_last
=
table
->
_end
=
table
->
_first
=
NULL
;
return
0
;
}
static
int
register_onexit_function
(
MSVCRT__onexit_table_t
*
table
,
MSVCRT__onexit_t
func
)
{
if
(
!
table
)
return
-
1
;
EnterCriticalSection
(
&
MSVCRT_onexit_cs
);
if
(
!
table
->
_first
)
{
table
->
_first
=
MSVCRT_calloc
(
32
,
sizeof
(
void
*
));
if
(
!
table
->
_first
)
{
WARN
(
"failed to allocate initial table.
\n
"
);
LeaveCriticalSection
(
&
MSVCRT_onexit_cs
);
return
-
1
;
}
table
->
_last
=
table
->
_first
;
table
->
_end
=
table
->
_first
+
32
;
}
/* grow if full */
if
(
table
->
_last
==
table
->
_end
)
{
int
len
=
table
->
_end
-
table
->
_first
;
MSVCRT__onexit_t
*
tmp
=
MSVCRT_realloc
(
table
->
_first
,
2
*
len
*
sizeof
(
void
*
));
if
(
!
tmp
)
{
WARN
(
"failed to grow table.
\n
"
);
LeaveCriticalSection
(
&
MSVCRT_onexit_cs
);
return
-
1
;
}
table
->
_first
=
tmp
;
table
->
_end
=
table
->
_first
+
2
*
len
;
table
->
_last
=
table
->
_first
+
len
;
}
*
table
->
_last
=
func
;
table
->
_last
++
;
LeaveCriticalSection
(
&
MSVCRT_onexit_cs
);
return
0
;
}
static
int
execute_onexit_table
(
MSVCRT__onexit_table_t
*
table
)
{
MSVCRT__onexit_t
*
func
;
MSVCRT__onexit_table_t
copy
;
if
(
!
table
)
return
-
1
;
EnterCriticalSection
(
&
MSVCRT_onexit_cs
);
if
(
!
table
->
_first
||
table
->
_first
>=
table
->
_last
)
{
LeaveCriticalSection
(
&
MSVCRT_onexit_cs
);
return
0
;
}
copy
.
_first
=
table
->
_first
;
copy
.
_last
=
table
->
_last
;
copy
.
_end
=
table
->
_end
;
memset
(
table
,
0
,
sizeof
(
*
table
));
initialize_onexit_table
(
table
);
LeaveCriticalSection
(
&
MSVCRT_onexit_cs
);
for
(
func
=
copy
.
_last
-
1
;
func
>=
copy
.
_first
;
func
--
)
{
if
(
*
func
)
(
*
func
)();
}
MSVCRT_free
(
copy
.
_first
);
return
0
;
}
extern
int
CDECL
_initialize_onexit_table
(
MSVCRT__onexit_table_t
*
table
);
extern
int
CDECL
_register_onexit_function
(
MSVCRT__onexit_table_t
*
table
,
MSVCRT__onexit_t
func
);
extern
int
CDECL
_execute_onexit_table
(
MSVCRT__onexit_table_t
*
table
);
static
void
call_atexit
(
void
)
{
/* Note: should only be called with the exit lock held */
if
(
tls_atexit_callback
)
tls_atexit_callback
(
NULL
,
DLL_PROCESS_DETACH
,
NULL
);
execute_onexit_table
(
&
MSVCRT_atexit_table
);
_
execute_onexit_table
(
&
MSVCRT_atexit_table
);
}
/*********************************************************************
...
...
@@ -363,7 +269,7 @@ MSVCRT__onexit_t CDECL MSVCRT__onexit(MSVCRT__onexit_t func)
return
NULL
;
LOCK_EXIT
;
register_onexit_function
(
&
MSVCRT_atexit_table
,
func
);
_
register_onexit_function
(
&
MSVCRT_atexit_table
,
func
);
UNLOCK_EXIT
;
return
func
;
...
...
@@ -409,7 +315,7 @@ int CDECL MSVCRT_atexit(void (__cdecl *func)(void))
int
CDECL
MSVCRT__crt_at_quick_exit
(
void
(
__cdecl
*
func
)(
void
))
{
TRACE
(
"(%p)
\n
"
,
func
);
return
register_onexit_function
(
&
MSVCRT_quick_exit_table
,
(
MSVCRT__onexit_t
)
func
);
return
_
register_onexit_function
(
&
MSVCRT_quick_exit_table
,
(
MSVCRT__onexit_t
)
func
);
}
/*********************************************************************
...
...
@@ -419,7 +325,7 @@ void CDECL MSVCRT_quick_exit(int exitcode)
{
TRACE
(
"(%d)
\n
"
,
exitcode
);
execute_onexit_table
(
&
MSVCRT_quick_exit_table
);
_
execute_onexit_table
(
&
MSVCRT_quick_exit_table
);
MSVCRT__exit
(
exitcode
);
}
...
...
@@ -433,36 +339,6 @@ int CDECL MSVCRT__crt_atexit(void (__cdecl *func)(void))
}
/*********************************************************************
* _initialize_onexit_table (UCRTBASE.@)
*/
int
CDECL
MSVCRT__initialize_onexit_table
(
MSVCRT__onexit_table_t
*
table
)
{
TRACE
(
"(%p)
\n
"
,
table
);
return
initialize_onexit_table
(
table
);
}
/*********************************************************************
* _register_onexit_function (UCRTBASE.@)
*/
int
CDECL
MSVCRT__register_onexit_function
(
MSVCRT__onexit_table_t
*
table
,
MSVCRT__onexit_t
func
)
{
TRACE
(
"(%p %p)
\n
"
,
table
,
func
);
return
register_onexit_function
(
table
,
func
);
}
/*********************************************************************
* _execute_onexit_table (UCRTBASE.@)
*/
int
CDECL
MSVCRT__execute_onexit_table
(
MSVCRT__onexit_table_t
*
table
)
{
TRACE
(
"(%p)
\n
"
,
table
);
return
execute_onexit_table
(
table
);
}
/*********************************************************************
* _register_thread_local_exe_atexit_callback (UCRTBASE.@)
*/
void
CDECL
_register_thread_local_exe_atexit_callback
(
_tls_callback_type
callback
)
...
...
dlls/msvcrt/msvcrt.h
View file @
0673ddf3
...
...
@@ -206,6 +206,13 @@ typedef struct MSVCRT_localeinfo_struct
MSVCRT_pthreadmbcinfo
mbcinfo
;
}
MSVCRT__locale_tstruct
,
*
MSVCRT__locale_t
;
typedef
struct
MSVCRT__onexit_table_t
{
MSVCRT__onexit_t
*
_first
;
MSVCRT__onexit_t
*
_last
;
MSVCRT__onexit_t
*
_end
;
}
MSVCRT__onexit_table_t
;
typedef
struct
_frame_info
{
void
*
object
;
...
...
dlls/msvcrt/msvcrt.spec
View file @
0673ddf3
...
...
@@ -422,7 +422,6 @@
@ varargs _execle(str str)
@ varargs _execlp(str str)
@ varargs _execlpe(str str)
@ cdecl _execute_onexit_table(ptr) MSVCRT__execute_onexit_table # for compatibility with Mingw
@ cdecl _execv(str ptr)
@ cdecl _execve(str ptr ptr) MSVCRT__execve
@ cdecl _execvp(str ptr)
...
...
@@ -555,7 +554,6 @@
@ cdecl _i64toa_s(int64 ptr long long) MSVCRT__i64toa_s
@ cdecl _i64tow(int64 ptr long) ntdll._i64tow
@ cdecl _i64tow_s(int64 ptr long long) MSVCRT__i64tow_s
@ cdecl _initialize_onexit_table(ptr) MSVCRT__initialize_onexit_table # for compatibility with Mingw
@ cdecl _initterm(ptr ptr)
@ cdecl _initterm_e(ptr ptr)
@ stub -arch=i386 _inp(long)
...
...
@@ -869,7 +867,6 @@
# extern _pwctype
@ cdecl _read(long ptr long) MSVCRT__read
# stub _realloc_dbg(ptr long long str long)
@ cdecl _register_onexit_function(ptr ptr) MSVCRT__register_onexit_function # for compatibility with Mingw
@ cdecl _resetstkoflw() MSVCRT__resetstkoflw
@ cdecl _rmdir(str) MSVCRT__rmdir
@ cdecl _rmtmp() MSVCRT__rmtmp
...
...
dlls/msvcrt/onexit.c
0 → 100644
View file @
0673ddf3
/*
* msvcrt onexit functions
*
* Copyright 2016 Nikolay Sivov
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/* these functions are part of the import lib for compatibility with the Mingw runtime */
#if 0
#pragma makedep implib
#endif
#include "msvcrt.h"
#include "mtdll.h"
/*********************************************************************
* _initialize_onexit_table (UCRTBASE.@)
*/
int
CDECL
_initialize_onexit_table
(
MSVCRT__onexit_table_t
*
table
)
{
if
(
!
table
)
return
-
1
;
if
(
table
->
_first
==
table
->
_end
)
table
->
_last
=
table
->
_end
=
table
->
_first
=
NULL
;
return
0
;
}
/*********************************************************************
* _register_onexit_function (UCRTBASE.@)
*/
int
CDECL
_register_onexit_function
(
MSVCRT__onexit_table_t
*
table
,
MSVCRT__onexit_t
func
)
{
if
(
!
table
)
return
-
1
;
_mlock
(
_EXIT_LOCK1
);
if
(
!
table
->
_first
)
{
table
->
_first
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
32
*
sizeof
(
void
*
));
if
(
!
table
->
_first
)
{
_munlock
(
_EXIT_LOCK1
);
return
-
1
;
}
table
->
_last
=
table
->
_first
;
table
->
_end
=
table
->
_first
+
32
;
}
/* grow if full */
if
(
table
->
_last
==
table
->
_end
)
{
int
len
=
table
->
_end
-
table
->
_first
;
MSVCRT__onexit_t
*
tmp
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
table
->
_first
,
2
*
len
*
sizeof
(
void
*
));
if
(
!
tmp
)
{
_munlock
(
_EXIT_LOCK1
);
return
-
1
;
}
table
->
_first
=
tmp
;
table
->
_end
=
table
->
_first
+
2
*
len
;
table
->
_last
=
table
->
_first
+
len
;
}
*
table
->
_last
=
func
;
table
->
_last
++
;
_munlock
(
_EXIT_LOCK1
);
return
0
;
}
/*********************************************************************
* _execute_onexit_table (UCRTBASE.@)
*/
int
CDECL
_execute_onexit_table
(
MSVCRT__onexit_table_t
*
table
)
{
MSVCRT__onexit_t
*
func
;
MSVCRT__onexit_table_t
copy
;
if
(
!
table
)
return
-
1
;
_mlock
(
_EXIT_LOCK1
);
if
(
!
table
->
_first
||
table
->
_first
>=
table
->
_last
)
{
_munlock
(
_EXIT_LOCK1
);
return
0
;
}
copy
.
_first
=
table
->
_first
;
copy
.
_last
=
table
->
_last
;
copy
.
_end
=
table
->
_end
;
memset
(
table
,
0
,
sizeof
(
*
table
));
_initialize_onexit_table
(
table
);
_munlock
(
_EXIT_LOCK1
);
for
(
func
=
copy
.
_last
-
1
;
func
>=
copy
.
_first
;
func
--
)
{
if
(
*
func
)
(
*
func
)();
}
HeapFree
(
GetProcessHeap
(),
0
,
copy
.
_first
);
return
0
;
}
dlls/ucrtbase/Makefile.in
View file @
0673ddf3
...
...
@@ -26,6 +26,7 @@ C_SRCS = \
math.c
\
mbcs.c
\
misc.c
\
onexit.c
\
process.c
\
scanf.c
\
string.c
\
...
...
dlls/ucrtbase/ucrtbase.spec
View file @
0673ddf3
...
...
@@ -279,7 +279,7 @@
@ varargs _execle(str str)
@ varargs _execlp(str str)
@ varargs _execlpe(str str)
@ cdecl _execute_onexit_table(ptr)
MSVCRT__execute_onexit_table
@ cdecl _execute_onexit_table(ptr)
@ cdecl _execv(str ptr)
@ cdecl _execve(str ptr ptr) MSVCRT__execve
@ cdecl _execvp(str ptr)
...
...
@@ -419,7 +419,7 @@
@ cdecl _i64tow(int64 ptr long) ntdll._i64tow
@ cdecl _i64tow_s(int64 ptr long long) MSVCRT__i64tow_s
@ cdecl _initialize_narrow_environment()
@ cdecl _initialize_onexit_table(ptr)
MSVCRT__initialize_onexit_table
@ cdecl _initialize_onexit_table(ptr)
@ cdecl _initialize_wide_environment()
@ cdecl _initterm(ptr ptr)
@ cdecl _initterm_e(ptr ptr)
...
...
@@ -906,7 +906,7 @@
@ stub _o__eof
@ cdecl _o__errno() MSVCRT__errno
@ stub _o__except1
@ cdecl _o__execute_onexit_table(ptr)
MSVCRT_
_execute_onexit_table
@ cdecl _o__execute_onexit_table(ptr) _execute_onexit_table
@ stub _o__execv
@ stub _o__execve
@ stub _o__execvp
...
...
@@ -1029,7 +1029,7 @@
@ stub _o__i64tow
@ stub _o__i64tow_s
@ stub _o__initialize_narrow_environment
@ cdecl _o__initialize_onexit_table(ptr)
MSVCRT_
_initialize_onexit_table
@ cdecl _o__initialize_onexit_table(ptr) _initialize_onexit_table
@ cdecl _o__initialize_wide_environment() _initialize_wide_environment
@ stub _o__invalid_parameter_noinfo
@ stub _o__invalid_parameter_noinfo_noreturn
...
...
@@ -1316,7 +1316,7 @@
@ stub _o__read
@ stub _o__realloc_base
@ stub _o__recalloc
@ cdecl _o__register_onexit_function(ptr ptr)
MSVCRT_
_register_onexit_function
@ cdecl _o__register_onexit_function(ptr ptr) _register_onexit_function
@ stub _o__resetstkoflw
@ stub _o__rmdir
@ stub _o__rmtmp
...
...
@@ -1861,7 +1861,7 @@
@ cdecl _read(long ptr long) MSVCRT__read
@ cdecl _realloc_base(ptr long)
@ cdecl _recalloc(ptr long long)
@ cdecl _register_onexit_function(ptr ptr)
MSVCRT__register_onexit_function
@ cdecl _register_onexit_function(ptr ptr)
@ cdecl _register_thread_local_exe_atexit_callback(ptr)
@ cdecl _resetstkoflw() MSVCRT__resetstkoflw
@ cdecl _rmdir(str) MSVCRT__rmdir
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment