ReactOS 0.4.16-dev-297-gc569aee
crtexe.c File Reference
#include <oscalls.h>
#include <internal.h>
#include <process.h>
#include <signal.h>
#include <math.h>
#include <stdlib.h>
#include <tchar.h>
#include <sect_attribs.h>
#include <locale.h>
Include dependency graph for crtexe.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define SPECIAL_CRTEXE
 
#define SPACECHAR   _T(' ')
 
#define DQUOTECHAR   _T('\"')
 
#define __UNUSED_PARAM_1   __UNUSED_PARAM
 

Functions

void __cdecl _fpreset (void)
 
_CRTIMP void __cdecl _initterm (_PVFV *, _PVFV *)
 
static int __cdecl check_managed_app (void)
 
 _CRTALLOC (".CRT$XIA")
 
static void __cdecl pre_cpp_init (void)
 
static int __cdecl __tmainCRTStartup (void)
 
int __cdecl WinMainCRTStartup (void)
 
int __cdecl mainCRTStartup (void)
 
BOOL crt_process_init (void)
 
static __declspec (noinline)
 
static void duplicate_ppstrings (int ac, char ***av)
 
static void __cdecl __mingw_invalidParameterHandler (const wchar_t *__UNUSED_PARAM_1(expression), const wchar_t *__UNUSED_PARAM_1(function), const wchar_t *__UNUSED_PARAM_1(file), unsigned int __UNUSED_PARAM_1(line), uintptr_t __UNUSED_PARAM(pReserved))
 
HANDLE __mingw_get_msvcrt_handle (void)
 
static void __cdecl __mingw_prepare_except_for_msvcr80_and_higher (void)
 

Variables

_CRTIMP wchar_t ** __winitenv
 
_CRTIMP char ** __initenv
 
IMAGE_DOS_HEADER __ImageBase
 
int _dowildcard
 
int mingw_initltsdrot_force
 
int mingw_initltsdyn_force
 
int mingw_initltssuo_force
 
int mingw_initcharmax
 

Macro Definition Documentation

◆ __UNUSED_PARAM_1

#define __UNUSED_PARAM_1   __UNUSED_PARAM

Definition at line 417 of file crtexe.c.

◆ DQUOTECHAR

#define DQUOTECHAR   _T('\"')

Definition at line 38 of file crtexe.c.

◆ SPACECHAR

#define SPACECHAR   _T(' ')

Definition at line 37 of file crtexe.c.

◆ SPECIAL_CRTEXE

#define SPECIAL_CRTEXE

This file has no copyright assigned and is placed in the Public Domain. This file is part of the w64 mingw-runtime package. No warranty is given; refer to the file DISCLAIMER.PD within this package.

Definition at line 7 of file crtexe.c.

Function Documentation

◆ __declspec()

static __declspec ( noinline  )
static

Definition at line 201 of file crtexe.c.

204{
205 _TCHAR *lpszCommandLine = NULL;
206 STARTUPINFO StartupInfo;
207 WINBOOL inDoubleQuote = FALSE;
208 memset (&StartupInfo, 0, sizeof (STARTUPINFO));
209
210#ifndef _WIN64
211 /* We need to make sure that this function is build with frame-pointer
212 and that we align the stack to 16 bytes for the sake of SSE ops in main
213 or in functions inlined into main. */
214 lpszCommandLine = (_TCHAR *) _alloca (32);
215 memset (lpszCommandLine, 0xcc, 32);
216#ifdef __GNUC__
217 asm __volatile__ ("andl $-16, %%esp" : : : "%esp");
218#endif
219#endif
220
221 if (mingw_app_type)
222 GetStartupInfo (&StartupInfo);
223 {
224 void *lock_free = NULL;
225 void *fiberid = ((PNT_TIB)NtCurrentTeb())->StackBase;
226 int nested = FALSE;
227 while((lock_free = InterlockedCompareExchangePointer ((volatile PVOID *) &__native_startup_lock,
228 fiberid, 0)) != 0)
229 {
230 if (lock_free == fiberid)
231 {
232 nested = TRUE;
233 break;
234 }
235 Sleep(1000);
236 }
238 {
239 _amsg_exit (31);
240 }
242 {
244 _initterm ((_PVFV *)(void *)__xi_a, (_PVFV *)(void *) __xi_z);
245 }
246 else
247 has_cctor = 1;
248
250 {
251 _initterm (__xc_a, __xc_z);
253 }
255 if (! nested)
257
260
263#ifdef _WIN64
265#endif
267
268 _fpreset ();
269
270 if (mingw_app_type)
271 {
272#ifdef WPRFLAG
273 lpszCommandLine = (_TCHAR *) _wcmdln;
274#else
275 lpszCommandLine = (char *) _acmdln;
276#endif
277 while (*lpszCommandLine > SPACECHAR || (*lpszCommandLine && inDoubleQuote))
278 {
279 if (*lpszCommandLine == DQUOTECHAR)
280 inDoubleQuote = !inDoubleQuote;
281#ifdef _MBCS
282 if (_ismbblead (*lpszCommandLine))
283 {
284 if (lpszCommandLine) /* FIXME: Why this check? Should I check for *lpszCommandLine != 0 too? */
285 lpszCommandLine++;
286 }
287#endif
288 ++lpszCommandLine;
289 }
290 while (*lpszCommandLine && (*lpszCommandLine <= SPACECHAR))
291 lpszCommandLine++;
292
294 __mingw_winmain_lpCmdLine = lpszCommandLine;
296 StartupInfo.wShowWindow : SW_SHOWDEFAULT;
297 }
299 __main ();
300#ifdef WPRFLAG
301#if !defined(__arm__) && !defined(__aarch64__)
302 __winitenv = envp;
303#endif
304 /* C++ initialization.
305 gcc inserts this call automatically for a function called main, but not for wmain. */
306 mainret = wmain (argc, argv, envp);
307#else
308#if !defined(__arm__) && !defined(__aarch64__)
309 __initenv = envp;
310#endif
311 mainret = main (argc, argv, envp);
312#endif
313
314#ifdef __GNUC__
316#endif
317
318 if (!managedapp)
319 exit (mainret);
320
321 if (has_cctor == 0)
322 _cexit ();
323 }
324 return mainret;
325}
static int argc
Definition: ServiceArgs.c:12
#define VOID
Definition: acefi.h:82
HINSTANCE __mingw_winmain_hInstance
LPSTR __mingw_winmain_lpCmdLine
DWORD __mingw_winmain_nShowCmd
LPTOP_LEVEL_EXCEPTION_FILTER __mingw_oldexcpt_handler
Definition: crt_handler.c:188
int __mingw_init_ehandler(void)
Definition: mscmain.c:27
long CALLBACK _gnu_exception_handler(EXCEPTION_POINTERS *exception_data)
Definition: crt_handler.c:196
#define _ASSERTE(expr)
Definition: crtdbg.h:113
static void __cdecl __mingw_prepare_except_for_msvcr80_and_higher(void)
Definition: crtexe.c:435
#define SPACECHAR
Definition: crtexe.c:37
static void duplicate_ppstrings(int ac, char ***av)
Definition: crtexe.c:396
_CRTIMP wchar_t ** __winitenv
Definition: environ.c:25
void __cdecl _fpreset(void)
Definition: _fpreset.c:10
#define DQUOTECHAR
Definition: crtexe.c:38
IMAGE_DOS_HEADER __ImageBase
_CRTIMP char ** __initenv
Definition: environ.c:24
_CRTIMP void __cdecl _initterm(_PVFV *, _PVFV *)
Definition: initterm.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
struct _NT_TIB * PNT_TIB
#define DLL_THREAD_ATTACH
Definition: compat.h:132
LPTOP_LEVEL_EXCEPTION_FILTER WINAPI DECLSPEC_HOTPATCH SetUnhandledExceptionFilter(IN LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter)
Definition: except.c:790
int main()
Definition: test.c:6
#define InterlockedExchangePointer(Target, Value)
Definition: dshow.h:45
void __main(void)
Definition: gccmain.c:51
void __do_global_dtors(void)
Definition: gccmain.c:20
char _TCHAR
Definition: tchar.h:1392
#define InterlockedCompareExchangePointer
Definition: interlocked.h:129
#define NtCurrentTeb
const PIMAGE_TLS_CALLBACK __dyn_tls_init_callback
Definition: tlssup.c:107
int mingw_app_type
Definition: mingw_helpers.c:31
UINT WINAPI nested(MSIHANDLE hinst)
Definition: custom.c:565
int __cdecl _ismbblead(unsigned int)
Definition: ismblead.c:20
void __cdecl _amsg_exit(int errnum)
Definition: amsg.c:44
#define argv
Definition: mplay32.c:18
void _pei386_runtime_relocator(void)
Definition: mscmain.c:23
char * _acmdln
Definition: environ.c:18
wchar_t * _wcmdln
Definition: environ.c:19
int wmain()
__analysis_noreturn _CRTIMP void __cdecl _cexit(void)
Definition: _exit.c:7
#define exit(n)
Definition: config.h:202
volatile void * __native_startup_lock
Definition: natstart.c:14
volatile __enative_startup_state __native_startup_state
Definition: natstart.c:13
@ __uninitialized
Definition: internal.h:149
@ __initialized
Definition: internal.h:149
@ __initializing
Definition: internal.h:149
void(__cdecl * _PVFV)(void)
Definition: internal.h:33
#define memset(x, y, z)
Definition: compat.h:39
DWORD dwFlags
Definition: winbase.h:867
WORD wShowWindow
Definition: winbase.h:868
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
HANDLE HINSTANCE
Definition: typedefs.h:77
int32_t WINBOOL
Definition: typedefs.h:58
#define STARTF_USESHOWWINDOW
Definition: winbase.h:517
#define GetStartupInfo
Definition: winbase.h:3866
#define SW_SHOWDEFAULT
Definition: winuser.h:783

◆ __mingw_get_msvcrt_handle()

HMODULE __mingw_get_msvcrt_handle ( void  )

Definition at line 236 of file pesect.c.

237{
238 static HANDLE msvcrt_handle;
239
240 if(!msvcrt_handle) {
241 const char *lib_name;
242 int i = 0;
243
244 while ((lib_name = __mingw_enum_import_library_names (i++))) {
245 if((lib_name[0] == 'm' || lib_name[0] == 'M')
246 && (lib_name[1] == 's' || lib_name[1] == 'S')
247 && (lib_name[2] == 'v' || lib_name[2] == 'V')
248 && (lib_name[3] == 'c' || lib_name[3] == 'C')
249 && (lib_name[4] == 'r' || lib_name[4] == 'R')
250 && (lib_name[5] == 't' || lib_name[5] == 'T' || ('0' <= lib_name[5] && lib_name[5] <= '9')))
251 break;
252 }
253
254 if(lib_name)
255 msvcrt_handle = GetModuleHandleA(lib_name);
256 if(!msvcrt_handle)
257 msvcrt_handle = LoadLibraryW(L"msvcrt.dll");
258 }
259
260 return msvcrt_handle;
261}
#define LoadLibraryW(x)
Definition: compat.h:747
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define L(x)
Definition: ntvdm.h:50
const char * __mingw_enum_import_library_names(int)
Definition: pesect.c:195

◆ __mingw_invalidParameterHandler()

static void __cdecl __mingw_invalidParameterHandler ( const wchar_t __UNUSED_PARAM_1expression,
const wchar_t __UNUSED_PARAM_1function,
const wchar_t __UNUSED_PARAM_1file,
unsigned int   __UNUSED_PARAM_1line,
uintptr_t   __UNUSED_PARAMpReserved 
)
static

Definition at line 420 of file crtexe.c.

425{
426#ifdef __MINGW_SHOW_INVALID_PARAMETER_EXCEPTION
427 wprintf(L"Invalid parameter detected in function %s. File: %s Line: %u\n", function, file, line);
428 wprintf(L"Expression: %s\n", expression);
429#endif
430}
Definition: fci.c:127
Definition: parser.c:49
#define wprintf(...)
Definition: whoami.c:18

◆ __mingw_prepare_except_for_msvcr80_and_higher()

static void __cdecl __mingw_prepare_except_for_msvcr80_and_higher ( void  )
static

Definition at line 435 of file crtexe.c.

436{
438
439 fIPH = (void*)GetProcAddress (__mingw_get_msvcrt_handle(), "_set_invalid_parameter_handler");
440 if (fIPH)
442}
static void __cdecl __mingw_invalidParameterHandler(const wchar_t *__UNUSED_PARAM_1(expression), const wchar_t *__UNUSED_PARAM_1(function), const wchar_t *__UNUSED_PARAM_1(file), unsigned int __UNUSED_PARAM_1(line), uintptr_t __UNUSED_PARAM(pReserved))
Definition: crtexe.c:420
HANDLE __mingw_get_msvcrt_handle(void)
Definition: pesect.c:236
#define GetProcAddress(x, y)
Definition: compat.h:753
void(__cdecl * _invalid_parameter_handler)(const wchar_t *, const wchar_t *, const wchar_t *, unsigned int, uintptr_t)
Definition: stdlib.h:125

◆ __tmainCRTStartup()

static int __cdecl __tmainCRTStartup ( void  )
static

◆ _CRTALLOC()

_CRTALLOC ( ".CRT$XIA"  )

Definition at line 46 of file crtexe.c.

102{
103 managedapp = check_managed_app ();
104 if (mingw_app_type)
106 else
108 __onexitbegin = __onexitend = (_PVFV *)(-1);
109
110#ifdef WPRFLAG
111 _wsetargv();
112#else
113 _setargv();
114#endif
116 {
118 }
119#if !defined(__clang__) && (!defined(_M_ARM64) || (_MSC_VER < 1930)) /* FIXME: CORE-14042 */
120 if (__globallocalestatus == -1)
121 {
122 }
123#endif
124 return 0;
125}
void __cdecl __setusermatherr(_UserMathErrorFunctionPointer func)
_PVFV * __onexitend
Definition: atonexit.c:24
_PVFV * __onexitbegin
Definition: atonexit.c:23
static int __cdecl check_managed_app(void)
Definition: crtexe.c:333
int __globallocalestatus
int __CRTDECL _matherr(_Inout_ struct _exception *exception)
_CRTIMP void __cdecl __set_app_type(int)
Definition: environ.c:360
int __CRTDECL _wsetargv(void)
#define _CONSOLE_APP
Definition: internal.h:145
int __CRTDECL _setargv(void)
Definition: dllargv.c:18
#define _GUI_APP
Definition: internal.h:146
int _MINGW_INSTALL_DEBUG_MATHERR
Definition: reactos.c:2

◆ _fpreset()

void __cdecl _fpreset ( void  )

Definition at line 10 of file _fpreset.c.

11{
12 /* Mask everything */
14}
void _mm_setcsr(unsigned int a)
Definition: xmmintrin.h:542
#define _MM_MASK_MASK
Definition: xmmintrin.h:101

◆ _initterm()

_CRTIMP void __cdecl _initterm ( _PVFV start,
_PVFV end 
)

Definition at line 10 of file initterm.c.

11{
13
14 TRACE("(%p,%p)\n",start,end);
15 while (current<end)
16 {
17 if (*current)
18 {
19 TRACE("Call init function %p\n",*current);
20 (**current)();
21 TRACE("returned\n");
22 }
23 current++;
24 }
25}
GLuint start
Definition: gl.h:1545
GLuint GLuint end
Definition: gl.h:1545
void(CDECL * _INITTERMFUN)(void)
Definition: initterm.c:3
struct task_struct * current
Definition: linux.c:32
#define TRACE(s)
Definition: solgame.cpp:4

◆ check_managed_app()

static int __cdecl check_managed_app ( void  )
static

Definition at line 333 of file crtexe.c.

334{
335 PIMAGE_DOS_HEADER pDOSHeader;
336 PIMAGE_NT_HEADERS pPEHeader;
337 PIMAGE_OPTIONAL_HEADER32 pNTHeader32;
338 PIMAGE_OPTIONAL_HEADER64 pNTHeader64;
339
340 /* Force to be linked. */
345
346 pDOSHeader = (PIMAGE_DOS_HEADER) &__ImageBase;
347 if (pDOSHeader->e_magic != IMAGE_DOS_SIGNATURE)
348 return 0;
349
350 pPEHeader = (PIMAGE_NT_HEADERS)((char *)pDOSHeader + pDOSHeader->e_lfanew);
351 if (pPEHeader->Signature != IMAGE_NT_SIGNATURE)
352 return 0;
353
354 pNTHeader32 = (PIMAGE_OPTIONAL_HEADER32) &pPEHeader->OptionalHeader;
355 switch (pNTHeader32->Magic)
356 {
359 return 0;
362 pNTHeader64 = (PIMAGE_OPTIONAL_HEADER64)pNTHeader32;
364 return 0;
366 }
367 return 0;
368}
int mingw_initcharmax
Definition: charmax.c:12
int mingw_initltsdrot_force
int mingw_initltsdyn_force
int mingw_initltssuo_force
switch(r->id)
Definition: btrfs.c:3046
struct _IMAGE_OPTIONAL_HEADER * PIMAGE_OPTIONAL_HEADER32
PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS
Definition: ntddk_ex.h:187
struct _IMAGE_DOS_HEADER * PIMAGE_DOS_HEADER
struct _IMAGE_OPTIONAL_HEADER64 * PIMAGE_OPTIONAL_HEADER64
#define IMAGE_NT_OPTIONAL_HDR32_MAGIC
Definition: ntimage.h:376
#define IMAGE_NT_OPTIONAL_HDR64_MAGIC
Definition: ntimage.h:377
#define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR
Definition: ntimage.h:489
#define IMAGE_NT_SIGNATURE
Definition: pedump.c:93
#define IMAGE_DOS_SIGNATURE
Definition: pedump.c:89
IMAGE_OPTIONAL_HEADER32 OptionalHeader
Definition: ntddk_ex.h:184
IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]
Definition: ntimage.h:370
IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]
Definition: ntddk_ex.h:178

◆ crt_process_init()

BOOL crt_process_init ( void  )

Definition at line 21 of file crt_init.c.

22{
24
25 /* initialize version info */
33
34 /* create tls stuff */
36 return FALSE;
37
38 if (!msvcrt_init_heap())
39 return FALSE;
40
41 if (BlockEnvToEnvironA() < 0)
42 return FALSE;
43
44 if (BlockEnvToEnvironW() < 0)
45 {
47 return FALSE;
48 }
49
52
53 /* Initialization of the WINE code */
55
56 //msvcrt_init_math();
58 //msvcrt_init_console();
59 //msvcrt_init_args();
60 //msvcrt_init_signals();
61
62 return TRUE;
63}
char * _acmdln
Definition: environ.c:18
void msvcrt_init_io(void)
Definition: file.c:456
void msvcrt_init_mt_locks(void)
Definition: lock.c:54
int BlockEnvToEnvironA(void)
Definition: environ.c:34
void FreeEnvironment(char **environment)
Definition: environ.c:190
BOOL msvcrt_init_heap(void)
Definition: heap.c:895
wchar_t * _wcmdln
Definition: environ.c:19
int BlockEnvToEnvironW(void)
Definition: environ.c:86
char ** _environ
Definition: environ.c:22
#define _strdup
Definition: debug_ros.c:7
LPSTR WINAPI GetCommandLineA(VOID)
Definition: proc.c:2009
LPWSTR WINAPI GetCommandLineW(VOID)
Definition: proc.c:2019
BOOL WINAPI GetVersionExW(IN LPOSVERSIONINFOW lpVersionInformation)
Definition: version.c:37
if(dx< 0)
Definition: linetemp.h:194
unsigned int _winminor
Definition: environ.c:12
unsigned int _winmajor
Definition: environ.c:13
unsigned int _osver
Definition: environ.c:11
unsigned int _osplatform
Definition: environ.c:10
unsigned int _winver
Definition: environ.c:14
_Check_return_ _CRTIMP wchar_t *__cdecl _wcsdup(_In_z_ const wchar_t *_Str)
BOOL msvcrt_init_tls(void)
Definition: tls.c:9
ULONG dwPlatformId
Definition: rtltypes.h:241
ULONG dwOSVersionInfoSize
Definition: rtltypes.h:237
ULONG dwMajorVersion
Definition: rtltypes.h:238
ULONG dwBuildNumber
Definition: rtltypes.h:240
ULONG dwMinorVersion
Definition: rtltypes.h:239
OSVERSIONINFO osvi
Definition: ver.c:28
struct _OSVERSIONINFOW OSVERSIONINFOW

◆ duplicate_ppstrings()

static void duplicate_ppstrings ( int  ac,
char ***  av 
)
static

Definition at line 396 of file crtexe.c.

397{
398 char **avl;
399 int i;
400 char **n = (char **) malloc (sizeof (char *) * (ac + 1));
401
402 avl=*av;
403 for (i=0; i < ac; i++)
404 {
405 size_t l = strlen (avl[i]) + 1;
406 n[i] = (char *) malloc (l);
407 memcpy (n[i], avl[i], l);
408 }
409 n[i] = NULL;
410 *av = n;
411}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
r l[0]
Definition: byte_order.h:168
#define malloc
Definition: debug_ros.c:4
GLdouble n
Definition: glext.h:7729
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878

◆ mainCRTStartup()

int __cdecl mainCRTStartup ( void  )

Definition at line 172 of file crtexe.c.

173{
174 int ret = 255;
175#ifndef _DLL
176 if (!crt_process_init())
177 {
178 return -1;
179 }
180#endif
181#ifdef __SEH__
182 asm ("\t.l_start:\n"
183 "\t.seh_handler __C_specific_handler, @except\n"
184 "\t.seh_handlerdata\n"
185 "\t.long 1\n"
186 "\t.rva .l_start, .l_end, _gnu_exception_handler ,.l_end\n"
187 "\t.text"
188 );
189#endif
190 mingw_app_type = 0;
193#ifdef __SEH__
194 asm ("\tnop\n"
195 "\t.l_end: nop\n");
196#endif
197 return ret;
198}
BOOL crt_process_init(void)
Definition: crt_init.c:21
static int __cdecl __tmainCRTStartup(void)
void __cdecl __security_init_cookie(void)
Definition: gs_support.c:55
int ret

◆ pre_cpp_init()

static void __cdecl pre_cpp_init ( void  )
static

Definition at line 128 of file crtexe.c.

129{
130 startinfo.newmode = _newmode;
131
132#ifdef WPRFLAG
133 argret = __wgetmainargs(&argc,&argv,&envp,_dowildcard,&startinfo);
134#else
135 argret = __getmainargs(&argc,&argv,&envp,_dowildcard,&startinfo);
136#endif
137}
int _dowildcard
Definition: wildcard.c:32
void __getmainargs(int *argc, char ***argv, char ***envp, int expand_wildcards, int *new_mode)
Definition: getargs.c:182
void CDECL __wgetmainargs(int *argc, WCHAR ***wargv, WCHAR ***wenvp, int expand_wildcards, int *new_mode)
int _newmode
Definition: _newmode.c:7

◆ WinMainCRTStartup()

int __cdecl WinMainCRTStartup ( void  )

Definition at line 143 of file crtexe.c.

144{
145 int ret = 255;
146#ifdef __SEH__
147 asm ("\t.l_startw:\n"
148 "\t.seh_handler __C_specific_handler, @except\n"
149 "\t.seh_handlerdata\n"
150 "\t.long 1\n"
151 "\t.rva .l_startw, .l_endw, _gnu_exception_handler ,.l_endw\n"
152 "\t.text"
153 );
154#endif
155 mingw_app_type = 1;
158#ifdef __SEH__
159 asm ("\tnop\n"
160 "\t.l_endw: nop\n");
161#endif
162 return ret;
163}

Variable Documentation

◆ __ImageBase

IMAGE_DOS_HEADER __ImageBase
extern

◆ __initenv

_CRTIMP char** __initenv
extern

Definition at line 24 of file environ.c.

Referenced by __p___initenv(), BlockEnvToEnvironA(), and SetEnv().

◆ __winitenv

_CRTIMP wchar_t** __winitenv
extern

Definition at line 25 of file environ.c.

Referenced by __p___winitenv(), BlockEnvToEnvironW(), and SetEnv().

◆ _dowildcard

int _dowildcard
extern

Definition at line 32 of file wildcard.c.

◆ mingw_initcharmax

int mingw_initcharmax
extern

Definition at line 12 of file charmax.c.

◆ mingw_initltsdrot_force

int mingw_initltsdrot_force
extern

◆ mingw_initltsdyn_force

int mingw_initltsdyn_force
extern

◆ mingw_initltssuo_force

int mingw_initltssuo_force
extern