ReactOS  0.4.15-dev-3203-gacde1e0
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 }
int mingw_app_type
Definition: mingw_helpers.c:31
static int argc
Definition: ServiceArgs.c:12
#define SW_SHOWDEFAULT
Definition: winuser.h:774
void(__cdecl * _PVFV)(void)
Definition: internal.h:33
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
static void duplicate_ppstrings(int ac, char ***av)
Definition: crtexe.c:396
void __main(void)
Definition: gccmain.c:51
void _pei386_runtime_relocator(void)
Definition: mscmain.c:23
int wmain(int argc, WCHAR **argv)
Definition: at.c:753
void __cdecl _fpreset(void)
Definition: _fpreset.c:10
#define SPACECHAR
Definition: crtexe.c:37
#define TRUE
Definition: types.h:120
#define DLL_THREAD_ATTACH
Definition: compat.h:132
int main(int argc, char *argv[])
Definition: atactl.cpp:1685
volatile __enative_startup_state __native_startup_state
Definition: natstart.c:13
_CRTIMP void __cdecl _initterm(_PVFV *, _PVFV *)
Definition: initterm.c:10
DWORD dwFlags
Definition: winbase.h:836
long CALLBACK _gnu_exception_handler(EXCEPTION_POINTERS *exception_data)
Definition: crt_handler.c:196
static void __cdecl __mingw_prepare_except_for_msvcr80_and_higher(void)
Definition: crtexe.c:435
_CRTIMP char ** __initenv
Definition: environ.c:24
#define argv
Definition: mplay32.c:18
#define alloca
Definition: malloc.h:357
void __cdecl _amsg_exit(int errnum)
Definition: amsg.c:44
_CRTIMP wchar_t ** __winitenv
Definition: environ.c:25
DWORD __mingw_winmain_nShowCmd
#define FALSE
Definition: types.h:117
LPTOP_LEVEL_EXCEPTION_FILTER WINAPI DECLSPEC_HOTPATCH SetUnhandledExceptionFilter(IN LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter)
Definition: except.c:788
__analysis_noreturn _CRTIMP void __cdecl _cexit(void)
Definition: _exit.c:7
LPTOP_LEVEL_EXCEPTION_FILTER __mingw_oldexcpt_handler
Definition: crt_handler.c:188
#define InterlockedCompareExchangePointer
Definition: interlocked.h:129
#define _ASSERTE(expr)
Definition: crtdbg.h:111
#define STARTF_USESHOWWINDOW
Definition: winbase.h:488
char _TCHAR
Definition: tchar.h:1392
#define InterlockedExchangePointer(Target, Value)
Definition: dshow.h:45
void __do_global_dtors(void)
Definition: gccmain.c:20
int32_t WINBOOL
Definition: typedefs.h:58
struct _NT_TIB * PNT_TIB
HINSTANCE __mingw_winmain_hInstance
IMAGE_DOS_HEADER __ImageBase
Definition: mstscax.cpp:17
HANDLE HINSTANCE
Definition: typedefs.h:77
#define VOID
Definition: acefi.h:82
wchar_t * _wcmdln
Definition: environ.c:19
const PIMAGE_TLS_CALLBACK __dyn_tls_init_callback
Definition: tlssup.c:107
LPSTR __mingw_winmain_lpCmdLine
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420
#define NULL
Definition: types.h:112
WORD wShowWindow
Definition: winbase.h:837
int __cdecl _ismbblead(unsigned int)
Definition: ismblead.c:20
char * _acmdln
Definition: environ.c:18
#define DQUOTECHAR
Definition: crtexe.c:38
#define GetStartupInfo
Definition: winbase.h:3697
void exit(int exitcode)
Definition: _exit.c:33
#define memset(x, y, z)
Definition: compat.h:39
int __mingw_init_ehandler(void)
Definition: mscmain.c:27
volatile void * __native_startup_lock
Definition: natstart.c:14

◆ __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:606
static const WCHAR L[]
Definition: oid.c:1250
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
const char * __mingw_enum_import_library_names(int)
Definition: pesect.c:195
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

Referenced by __mingw_prepare_except_for_msvcr80_and_higher().

◆ __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 }
#define wprintf(...)
Definition: whoami.c:18
Definition: parser.c:48
static const WCHAR L[]
Definition: oid.c:1250
Definition: fci.c:126

Referenced by __mingw_prepare_except_for_msvcr80_and_higher().

◆ __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 }
HANDLE __mingw_get_msvcrt_handle(void)
Definition: pesect.c:236
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
#define NULL
Definition: types.h:112
void(__cdecl * _invalid_parameter_handler)(const wchar_t *, const wchar_t *, const wchar_t *, unsigned int, uintptr_t)
Definition: stdlib.h:125
#define GetProcAddress(x, y)
Definition: compat.h:612

Referenced by __declspec().

◆ __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 #ifndef __clang__ /* FIXME: CORE-14042 */
120  if (__globallocalestatus == -1)
121  {
122  }
123 #endif
124  return 0;
125 }
int mingw_app_type
Definition: mingw_helpers.c:31
int __globallocalestatus
int _MINGW_INSTALL_DEBUG_MATHERR
Definition: reactos.c:2
void(__cdecl * _PVFV)(void)
Definition: internal.h:33
_PVFV * __onexitbegin
Definition: atonexit.c:23
_PVFV * __onexitend
Definition: atonexit.c:24
int __CRTDECL _setargv(void)
Definition: dllargv.c:18
_CRTIMP void __cdecl __set_app_type(int)
Definition: environ.c:360
static int __cdecl check_managed_app(void)
Definition: crtexe.c:333
int __CRTDECL _matherr(_Inout_ struct _exception *exception)
#define _CONSOLE_APP
Definition: internal.h:145
int __CRTDECL _wsetargv(void)
#define _GUI_APP
Definition: internal.h:146
void __cdecl __setusermatherr(_UserMathErrorFunctionPointer func)
Definition: usermatherr.c:19

◆ _fpreset()

void __cdecl _fpreset ( void  )

Definition at line 10 of file _fpreset.c.

11 {
12  __setfp(0x0);
13 }
GLint x0
Definition: linetemp.h:95
void __setfp(unsigned int)

Referenced by __declspec().

◆ _initterm()

_CRTIMP void __cdecl _initterm ( _PVFV ,
_PVFV  
)

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 }
#define TRACE(s)
Definition: solgame.cpp:4
struct task_struct * current
Definition: linux.c:32
GLuint GLuint end
Definition: gl.h:1545
void(CDECL * _INITTERMFUN)(void)
Definition: initterm.c:3
GLuint start
Definition: gl.h:1545

Referenced by __declspec().

◆ 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 }
IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]
Definition: ntddk_ex.h:178
int mingw_initltssuo_force
#define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR
Definition: ntimage.h:489
#define IMAGE_NT_OPTIONAL_HDR32_MAGIC
Definition: ntimage.h:376
#define IMAGE_DOS_SIGNATURE
Definition: pedump.c:89
int mingw_initcharmax
Definition: charmax.c:12
struct _IMAGE_DOS_HEADER * PIMAGE_DOS_HEADER
switch(r->id)
Definition: btrfs.c:2980
#define IMAGE_NT_SIGNATURE
Definition: pedump.c:93
#define IMAGE_NT_OPTIONAL_HDR64_MAGIC
Definition: ntimage.h:377
IMAGE_DOS_HEADER __ImageBase
Definition: mstscax.cpp:17
struct _IMAGE_OPTIONAL_HEADER * PIMAGE_OPTIONAL_HEADER32
IMAGE_OPTIONAL_HEADER32 OptionalHeader
Definition: ntddk_ex.h:184
int mingw_initltsdyn_force
IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]
Definition: ntimage.h:370
int mingw_initltsdrot_force
struct _IMAGE_OPTIONAL_HEADER64 * PIMAGE_OPTIONAL_HEADER64
PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS
Definition: ntddk_ex.h:187

◆ crt_process_init()

BOOL crt_process_init ( void  )

Definition at line 20 of file crt_init.c.

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

Referenced by mainCRTStartup().

◆ 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
GLdouble n
Definition: glext.h:7729
r l[0]
Definition: byte_order.h:167
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
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 NULL
Definition: types.h:112
#define malloc
Definition: debug_ros.c:4

Referenced by __declspec().

◆ 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;
192  ret = __tmainCRTStartup ();
193 #ifdef __SEH__
194  asm ("\tnop\n"
195  "\t.l_end: nop\n");
196 #endif
197  return ret;
198 }
int mingw_app_type
Definition: mingw_helpers.c:31
BOOL crt_process_init(void)
Definition: crt_init.c:20
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 }
static int argc
Definition: ServiceArgs.c:12
#define argv
Definition: mplay32.c:18
void __getmainargs(int *argc, char ***argv, char ***envp, int expand_wildcards, int *new_mode)
Definition: getargs.c:182
int _newmode
Definition: _newmode.c:7
void CDECL __wgetmainargs(int *argc, WCHAR ***wargv, WCHAR ***wenvp, int expand_wildcards, int *new_mode)
int _dowildcard
Definition: wildcard.c:32

◆ 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;
157  ret = __tmainCRTStartup ();
158 #ifdef __SEH__
159  asm ("\tnop\n"
160  "\t.l_endw: nop\n");
161 #endif
162  return ret;
163 }
int mingw_app_type
Definition: mingw_helpers.c:31
static int __cdecl __tmainCRTStartup(void)
void __cdecl __security_init_cookie(void)
Definition: gs_support.c:55
int ret

Variable Documentation

◆ __ImageBase

IMAGE_DOS_HEADER __ImageBase

Definition at line 17 of file mstscax.cpp.

Referenced by __declspec(), and check_managed_app().

◆ __initenv

_CRTIMP char** __initenv

Definition at line 24 of file environ.c.

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

◆ __winitenv

_CRTIMP wchar_t** __winitenv

Definition at line 25 of file environ.c.

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

◆ _dowildcard

int _dowildcard

Definition at line 32 of file wildcard.c.

Referenced by pre_cpp_init().

◆ mingw_initcharmax

int mingw_initcharmax

Definition at line 12 of file charmax.c.

Referenced by check_managed_app().

◆ mingw_initltsdrot_force

int mingw_initltsdrot_force

Referenced by check_managed_app().

◆ mingw_initltsdyn_force

int mingw_initltsdyn_force

Referenced by check_managed_app().

◆ mingw_initltssuo_force

int mingw_initltssuo_force

Referenced by check_managed_app().