Reactos
1//
2// corecrt_startup.h
3//
4// Copyright (c) Microsoft Corporation. All rights reserved.
5//
6// Declarations for the CoreCRT startup functionality, used while initializing
7// the CRT and during app startup and termination.
8//
9#pragma once
10
11#include <corecrt.h>
12#include <math.h>
13#include <vcruntime_startup.h>
14
15#pragma warning(push)
16#pragma warning(disable: _UCRT_DISABLED_WARNINGS)
17_UCRT_DISABLE_CLANG_WARNINGS
18
19_CRT_BEGIN_C_HEADER
20
21
22
23//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
24//
25// Exception Filters for main() and DllMain()
26//
27//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
28struct _EXCEPTION_POINTERS;
29
30_ACRTIMP int __cdecl _seh_filter_dll(
31 _In_ unsigned long _ExceptionNum,
32 _In_ struct _EXCEPTION_POINTERS* _ExceptionPtr
33 );
34
35_ACRTIMP int __cdecl _seh_filter_exe(
36 _In_ unsigned long _ExceptionNum,
37 _In_ struct _EXCEPTION_POINTERS* _ExceptionPtr
38 );
39
40
41
42//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
43//
44// Miscellaneous Runtime Support
45//
46//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
47typedef enum _crt_app_type
48{
49 _crt_unknown_app,
50 _crt_console_app,
51 _crt_gui_app
52} _crt_app_type;
53
54_ACRTIMP _crt_app_type __cdecl _query_app_type(void);
55
56_ACRTIMP void __cdecl _set_app_type(
57 _In_ _crt_app_type _Type
58 );
59
60typedef int (__cdecl *_UserMathErrorFunctionPointer)(struct _exception *);
61
62_ACRTIMP void __cdecl __setusermatherr(
63 _UserMathErrorFunctionPointer _UserMathErrorFunction
64 );
65
66int __cdecl _is_c_termination_complete(void);
67
68
69
70//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
71//
72// Arguments API for main() et al.
73//
74//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
75_ACRTIMP errno_t __cdecl _configure_narrow_argv(
76 _In_ _crt_argv_mode mode
77 );
78
79_ACRTIMP errno_t __cdecl _configure_wide_argv(
80 _In_ _crt_argv_mode mode
81 );
82
83// There is a linkopt for these to disable environment initialization when using
84// the static CRT, so they are not declared _ACRTIMP.
85int __CRTDECL _initialize_narrow_environment(void);
86int __CRTDECL _initialize_wide_environment(void);
87
88_ACRTIMP char** __cdecl _get_initial_narrow_environment(void);
89_ACRTIMP wchar_t** __cdecl _get_initial_wide_environment(void);
90
91char* __CRTDECL _get_narrow_winmain_command_line(void);
92wchar_t* __CRTDECL _get_wide_winmain_command_line(void);
93
94_ACRTIMP char** __cdecl __p__acmdln(void);
95_ACRTIMP wchar_t** __cdecl __p__wcmdln(void);
96
97#ifdef _CRT_DECLARE_GLOBAL_VARIABLES_DIRECTLY
98 extern char* _acmdln;
99 extern wchar_t* _wcmdln;
100#else
101 #define _acmdln (*__p__acmdln())
102 #define _wcmdln (*__p__wcmdln())
103#endif
104
105
106
107//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
108//
109// Initializer and Terminator Support
110//
111//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
112typedef void (__cdecl* _PVFV)(void);
113typedef int (__cdecl* _PIFV)(void);
114typedef void (__cdecl* _PVFI)(int);
115
116#ifndef _M_CEE
117 _ACRTIMP void __cdecl _initterm(
118 _In_reads_(_Last - _First) _In_ _PVFV* _First,
119 _In_ _PVFV* _Last
120 );
121
122 _ACRTIMP int __cdecl _initterm_e(
123 _In_reads_(_Last - _First) _PIFV* _First,
124 _In_ _PIFV* _Last
125 );
126#endif
127
128#ifndef _CRT_ONEXIT_T_DEFINED
129 #define _CRT_ONEXIT_T_DEFINED
130
131 typedef int (__CRTDECL* _onexit_t)(void);
132 #ifdef _M_CEE
133 typedef int (__clrcall* _onexit_m_t)(void);
134 #endif
135#endif
136
137typedef struct _onexit_table_t
138{
139 _PVFV* _first;
140 _PVFV* _last;
141 _PVFV* _end;
142} _onexit_table_t;
143
144_ACRTIMP int __cdecl _initialize_onexit_table(
145 _In_opt_ _onexit_table_t* _Table
146 );
147
148_ACRTIMP int __cdecl _register_onexit_function(
149 _In_opt_ _onexit_table_t* _Table,
150 _In_opt_ _onexit_t _Function
151 );
152
153_ACRTIMP int __cdecl _execute_onexit_table(
154 _In_opt_ _onexit_table_t* _Table
155 );
156
157_ACRTIMP int __cdecl _crt_atexit(
158 _In_opt_ _PVFV _Function
159 );
160
161_ACRTIMP int __cdecl _crt_at_quick_exit(
162 _In_opt_ _PVFV _Function
163 );
164
165
166
167//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
168//
169// Static CRT Initialization Support
170//
171//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
172#if _CRT_FUNCTIONS_REQUIRED
173
174 _Success_(return != 0)
175 __crt_bool __cdecl __acrt_initialize(void);
176
177 _Success_(return != 0)
178 __crt_bool __cdecl __acrt_uninitialize(
179 _In_ __crt_bool _Terminating
180 );
181
182 _Success_(return != 0)
183 __crt_bool __cdecl __acrt_uninitialize_critical(
184 _In_ __crt_bool _Terminating
185 );
186
187 _Success_(return != 0)
188 __crt_bool __cdecl __acrt_thread_attach(void);
189
190 _Success_(return != 0)
191 __crt_bool __cdecl __acrt_thread_detach(void);
192
193#endif // _CRT_FUNCTIONS_REQUIRED
194
195
196
197_CRT_END_C_HEADER
198_UCRT_RESTORE_CLANG_WARNINGS
199#pragma warning(pop) // _UCRT_DISABLED_WARNINGS