ReactOS
0.4.16-dev-1163-gec5b142
Toggle main menu visibility
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
Functions
_
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
w
Variables
_
c
d
e
f
g
h
i
l
m
n
o
p
s
t
u
x
Typedefs
_
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
w
x
Enumerations
_
a
b
c
d
f
i
l
m
o
p
s
t
w
x
Enumerator
a
b
c
d
e
f
g
h
i
m
n
o
p
r
s
t
u
v
w
x
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
_
a
b
c
d
e
f
h
i
k
l
m
n
o
p
r
s
t
u
v
w
z
Enumerator
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Properties
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Related Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
v
x
Files
File List
File Members
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Examples
__vcrt_init.c
Go to the documentation of this file.
1
//
2
// __vcrt_init.c
3
//
4
// Copyright (c) 2024 Timo Kreuzer
5
//
6
// Implementation of vcruntime initialization and termination functions.
7
//
8
// SPDX-License-Identifier: MIT
9
//
10
11
#include <
internal_shared.h
>
12
13
void
msvcrt_init_exception
(
HINSTANCE
hinstDLL);
14
BOOL
msvcrt_init_tls
(
void
);
15
void
msvcrt_free_tls_mem
(
void
);
16
BOOL
msvcrt_free_tls
(
void
);
17
18
__vcrt_bool
__cdecl
__vcrt_initialize
(
void
)
19
{
20
msvcrt_init_exception
(
GetModuleHandle
(
NULL
));
21
22
if
(!
msvcrt_init_tls
())
23
return
FALSE
;
24
25
return
TRUE
;
26
}
27
28
__vcrt_bool
__cdecl
__vcrt_uninitialize
(
_In_
__vcrt_bool
_Terminating)
29
{
30
if
(!
msvcrt_free_tls
())
31
return
FALSE
;
32
33
return
TRUE
;
34
}
35
36
__vcrt_bool
__cdecl
__vcrt_uninitialize_critical
(
void
)
37
{
38
return
TRUE
;
39
}
40
41
__vcrt_bool
__cdecl
__vcrt_thread_attach
(
void
)
42
{
43
// Not called by UCRT
44
return
TRUE
;
45
}
46
47
__vcrt_bool
__cdecl
__vcrt_thread_detach
(
void
)
48
{
49
// Not called by UCRT
50
return
TRUE
;
51
}
52
53
// UCRT doesn't have a thread detach callback for the vcruntime TLS, because
54
// the native vcruntime uses FlsAlloc and provides a cleanup callback there.
55
// Since we don't have that, we use TLS callbacks.
56
const
IMAGE_TLS_DIRECTORY
*
__p_tls_used
= &
_tls_used
;
57
58
static
59
VOID
60
WINAPI
61
wine_tls_cleanup_callback
(
PVOID
hinstDLL,
DWORD
fdwReason
,
LPVOID
lpvReserved
)
62
{
63
// For the last thread, only DLL_PROCESS_DETACH is called
64
if
((
fdwReason
==
DLL_THREAD_DETACH
) ||
65
(
fdwReason
==
DLL_PROCESS_DETACH
))
66
{
67
msvcrt_free_tls_mem
();
68
}
69
}
70
71
_CRTALLOC
(
".CRT$XLD"
)
PIMAGE_TLS_CALLBACK
wine_tls_cleanup_ptr =
wine_tls_cleanup_callback
;
msvcrt_init_exception
void msvcrt_init_exception(HINSTANCE hinstDLL)
wine_tls_cleanup_callback
static VOID WINAPI wine_tls_cleanup_callback(PVOID hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
Definition:
__vcrt_init.c:61
msvcrt_free_tls_mem
void msvcrt_free_tls_mem(void)
Definition:
tls.c:53
__vcrt_thread_detach
__vcrt_bool __cdecl __vcrt_thread_detach(void)
Definition:
__vcrt_init.c:47
__vcrt_thread_attach
__vcrt_bool __cdecl __vcrt_thread_attach(void)
Definition:
__vcrt_init.c:41
msvcrt_free_tls
BOOL msvcrt_free_tls(void)
Definition:
tls.c:21
__vcrt_uninitialize
__vcrt_bool __cdecl __vcrt_uninitialize(_In_ __vcrt_bool _Terminating)
Definition:
__vcrt_init.c:28
__vcrt_uninitialize_critical
__vcrt_bool __cdecl __vcrt_uninitialize_critical(void)
Definition:
__vcrt_init.c:36
msvcrt_init_tls
BOOL msvcrt_init_tls(void)
Definition:
tls.c:9
__p_tls_used
const IMAGE_TLS_DIRECTORY * __p_tls_used
Definition:
__vcrt_init.c:56
__vcrt_initialize
__vcrt_bool __cdecl __vcrt_initialize(void)
Definition:
__vcrt_init.c:18
__cdecl
#define __cdecl
Definition:
accygwin.h:79
fdwReason
static DWORD const fdwReason
Definition:
appcrt_dllmain.cpp:57
NULL
#define NULL
Definition:
types.h:112
TRUE
#define TRUE
Definition:
types.h:120
FALSE
#define FALSE
Definition:
types.h:117
DLL_THREAD_DETACH
#define DLL_THREAD_DETACH
Definition:
compat.h:133
DLL_PROCESS_DETACH
#define DLL_PROCESS_DETACH
Definition:
compat.h:130
BOOL
unsigned int BOOL
Definition:
ntddk_ex.h:94
DWORD
unsigned long DWORD
Definition:
ntddk_ex.h:95
_CRTALLOC
#define _CRTALLOC(x)
Definition:
fma3_available.c:37
void
Definition:
nsiface.idl:2307
internal_shared.h
_tls_used
const IMAGE_TLS_DIRECTORY _tls_used
lpvReserved
static IN DWORD IN LPVOID lpvReserved
Definition:
load_notifications.c:17
_In_
#define _In_
Definition:
no_sal2.h:158
PIMAGE_TLS_CALLBACK
VOID(NTAPI * PIMAGE_TLS_CALLBACK)(PVOID DllHandle, ULONG Reason, PVOID Reserved)
Definition:
ntimage.h:531
_IMAGE_TLS_DIRECTORY32
Definition:
ntimage.h:545
__vcrt_bool
_Bool __vcrt_bool
Definition:
vcruntime.h:185
GetModuleHandle
#define GetModuleHandle
Definition:
winbase.h:3859
WINAPI
#define WINAPI
Definition:
msvc.h:6
sdk
lib
vcruntime
__vcrt_init.c
Generated on Wed May 21 2025 06:15:02 for ReactOS by
1.9.6