ReactOS 0.4.16-dev-2104-gb84fa49
corecrt_startup.h File Reference
#include <corecrt.h>
Include dependency graph for corecrt_startup.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _onexit_table_t
 

Macros

#define _CRT_ONEXIT_T_DEFINED
 
#define _set_app_type   __set_app_type
 

Typedefs

typedef enum _crt_argv_mode _crt_argv_mode
 
typedef enum _crt_app_type _crt_app_type
 
typedef void(__cdecl_PVFV) (void)
 
typedef int(__cdecl_PIFV) (void)
 
typedef void(__cdecl_PVFI) (int)
 
typedef struct _onexit_table_t _onexit_table_t
 
typedef int(__cdecl_onexit_t) (void)
 
typedef int(__cdecl_UserMathErrorFunctionPointer) (struct _exception *)
 

Enumerations

enum  _crt_argv_mode {
  _crt_argv_no_arguments , _crt_argv_unexpanded_arguments , _crt_argv_expanded_arguments , _crt_argv_no_arguments ,
  _crt_argv_unexpanded_arguments , _crt_argv_expanded_arguments
}
 
enum  _crt_app_type {
  _crt_unknown_app , _crt_console_app , _crt_gui_app , _crt_unknown_app ,
  _crt_console_app , _crt_gui_app
}
 

Functions

_ACRTIMP void __cdecl __getmainargs (int *, char ***, char ***, int, int *)
 
_ACRTIMP void __cdecl __wgetmainargs (int *, wchar_t ***, wchar_t ***, int, int *)
 
_ACRTIMP void __cdecl __setusermatherr (_UserMathErrorFunctionPointer)
 
_ACRTIMP errno_t __cdecl _configure_narrow_argv (_crt_argv_mode)
 
_ACRTIMP errno_t __cdecl _configure_wide_argv (_crt_argv_mode)
 
_ACRTIMP int __cdecl _crt_at_quick_exit (_PVFV)
 
_ACRTIMP int __cdecl _crt_atexit (_PVFV)
 
_ACRTIMP int __cdecl _execute_onexit_table (_onexit_table_t *)
 
_ACRTIMP char **__cdecl _get_initial_narrow_environment (void)
 
_ACRTIMP wchar_t **__cdecl _get_initial_wide_environment (void)
 
_ACRTIMP char *__cdecl _get_narrow_winmain_command_line (void)
 
_ACRTIMP wchar_t *__cdecl _get_wide_winmain_command_line (void)
 
_ACRTIMP int __cdecl _initialize_narrow_environment (void)
 
_ACRTIMP int __cdecl _initialize_onexit_table (_onexit_table_t *)
 
_ACRTIMP int __cdecl _initialize_wide_environment (void)
 
_ACRTIMP int __cdecl _register_onexit_function (_onexit_table_t *, _onexit_t)
 
_ACRTIMP void __cdecl _set_app_type (_crt_app_type)
 

Macro Definition Documentation

◆ _CRT_ONEXIT_T_DEFINED

#define _CRT_ONEXIT_T_DEFINED

Definition at line 36 of file corecrt_startup.h.

◆ _set_app_type

#define _set_app_type   __set_app_type

Definition at line 50 of file corecrt_startup.h.

Typedef Documentation

◆ _crt_app_type

◆ _crt_argv_mode

This file has no copyright assigned and is placed in the Public Domain. This file is part of the Wine project.

◆ _onexit_t

typedef int(__cdecl * _onexit_t) (void)

Definition at line 37 of file corecrt_startup.h.

◆ _onexit_table_t

◆ _PIFV

typedef int(__cdecl * _PIFV) (void)

Definition at line 26 of file corecrt_startup.h.

◆ _PVFI

typedef void(__cdecl * _PVFI) (int)

Definition at line 27 of file corecrt_startup.h.

◆ _PVFV

typedef void(__cdecl * _PVFV) (void)

Definition at line 25 of file corecrt_startup.h.

◆ _UserMathErrorFunctionPointer

typedef int(__cdecl * _UserMathErrorFunctionPointer) (struct _exception *)

Definition at line 41 of file corecrt_startup.h.

Enumeration Type Documentation

◆ _crt_app_type

Enumerator
_crt_unknown_app 
_crt_console_app 
_crt_gui_app 
_crt_unknown_app 
_crt_console_app 
_crt_gui_app 

Definition at line 18 of file corecrt_startup.h.

19{
_crt_app_type
@ _crt_gui_app
@ _crt_console_app
@ _crt_unknown_app

◆ _crt_argv_mode

This file has no copyright assigned and is placed in the Public Domain. This file is part of the Wine project.

Enumerator
_crt_argv_no_arguments 
_crt_argv_unexpanded_arguments 
_crt_argv_expanded_arguments 
_crt_argv_no_arguments 
_crt_argv_unexpanded_arguments 
_crt_argv_expanded_arguments 

Definition at line 11 of file corecrt_startup.h.

Function Documentation

◆ __getmainargs()

_ACRTIMP void __cdecl __getmainargs ( int argc,
char ***  argv,
char ***  envp,
int  expand_wildcards,
int new_mode 
)

Definition at line 579 of file data.c.

581{
582 TRACE("(%p,%p,%p,%d,%p).\n", argc, argv, envp, expand_wildcards, new_mode);
583
584 if (expand_wildcards) {
588 if (wargv_expand) {
590
593 }else {
594 expand_wildcards = 0;
595 }
596 }
597 if (!expand_wildcards) {
598#ifdef __REACTOS__
599 if ((MSVCRT___argv == NULL) || (MSVCRT___argc == 0))
600 {
601 MSVCRT___argv = cmdline_to_argvA(MSVCRT__acmdln, &MSVCRT___argc);
602 }
603#else
606#endif
607 }
608
611 *envp = MSVCRT__environ;
612
613 if (new_mode)
614 _set_new_mode( *new_mode );
615 return 0;
616}
static int argc
Definition: ServiceArgs.c:12
#define NULL
Definition: types.h:112
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
static char ** build_argv(WCHAR **wargv)
Definition: data.c:63
static int initial_argc
Definition: data.c:30
static int build_expanded_wargv(int *argc, wchar_t **argv)
Definition: data.c:471
static int wargc_expand
Definition: data.c:32
char ** MSVCRT___argv
Definition: data.c:50
static WCHAR ** initial_wargv
Definition: data.c:29
int MSVCRT___argc
Definition: data.c:31
char ** MSVCRT__environ
Definition: data.c:55
char * MSVCRT__acmdln
Definition: data.c:53
static wchar_t ** wargv_expand
Definition: data.c:52
int CDECL _set_new_mode(int mode)
Definition: heap.c:227
#define argv
Definition: mplay32.c:18
#define TRACE(s)
Definition: solgame.cpp:4

◆ __setusermatherr()

_ACRTIMP void __cdecl __setusermatherr ( _UserMathErrorFunctionPointer  func)

Definition at line 17 of file _invoke_matherr.c.

18{
20}
static _UserMathErrorFunctionPointer user_matherr
GLenum func
Definition: glext.h:6028

Referenced by test_math_errors().

◆ __wgetmainargs()

_ACRTIMP void __cdecl __wgetmainargs ( int argc,
wchar_t ***  wargv,
wchar_t ***  wenvp,
int  expand_wildcards,
int new_mode 
)

Definition at line 536 of file data.c.

538{
539 TRACE("(%p,%p,%p,%d,%p).\n", argc, wargv, wenvp, expand_wildcards, new_mode);
540
541 if (expand_wildcards) {
545 if (wargv_expand) {
547
550 }else {
551 expand_wildcards = 0;
552 }
553 }
554 if (!expand_wildcards) {
555#ifdef __REACTOS__
556 if ((MSVCRT___wargv == NULL) || (MSVCRT___argc == 0))
557 {
559 }
560#else
563#endif
564 }
565
567
569 *wargv = MSVCRT___wargv;
570 *wenvp = MSVCRT__wenviron;
571 if (new_mode)
572 _set_new_mode( *new_mode );
573 return 0;
574}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
wchar_t ** MSVCRT___wargv
Definition: data.c:51
static WCHAR ** cmdline_to_argv(const WCHAR *src, int *ret_argc)
Definition: data.c:85
wchar_t ** MSVCRT__wenviron
Definition: data.c:56
wchar_t * MSVCRT__wcmdln
Definition: data.c:54
int env_init(BOOL unicode, BOOL modif)
Definition: environ.c:30

◆ _configure_narrow_argv()

_ACRTIMP errno_t __cdecl _configure_narrow_argv ( _crt_argv_mode  mode)

Definition at line 396 of file argv_parsing.cpp.

397{
398 return common_configure_argv<char>(mode);
399}
GLenum mode
Definition: glext.h:6217

Referenced by call_main< decltype(main)>(), and mainCRTStartup().

◆ _configure_wide_argv()

_ACRTIMP errno_t __cdecl _configure_wide_argv ( _crt_argv_mode  mode)

Definition at line 401 of file argv_parsing.cpp.

402{
403 return common_configure_argv<wchar_t>(mode);
404}

Referenced by call_main< decltype(wmain)>(), and wmainCRTStartup().

◆ _crt_at_quick_exit()

_ACRTIMP int __cdecl _crt_at_quick_exit ( _PVFV  function)

Definition at line 46 of file onexit.cpp.

47{
48 return _register_onexit_function(&__acrt_at_quick_exit_table, reinterpret_cast<_onexit_t>(function));
49}
int(__cdecl * _onexit_t)(void)
_onexit_table_t __acrt_at_quick_exit_table
Definition: onexit.cpp:26
int __cdecl _register_onexit_function(_onexit_table_t *const table, _onexit_t const function)
Definition: onexit.cpp:82

Referenced by test_call_exit(), and test_call_quick_exit().

◆ _crt_atexit()

_ACRTIMP int __cdecl _crt_atexit ( _PVFV  function)

Definition at line 41 of file onexit.cpp.

42{
43 return _register_onexit_function(&__acrt_atexit_table, reinterpret_cast<_onexit_t>(function));
44}
_onexit_table_t __acrt_atexit_table
Definition: onexit.cpp:25

Referenced by test_call_exit(), and test_call_quick_exit().

◆ _execute_onexit_table()

_ACRTIMP int __cdecl _execute_onexit_table ( _onexit_table_t table)

Definition at line 91 of file onexit.c.

92{
93 _PVFV *func;
95
96 if (!table)
97 return -1;
98
100 if (!table->_first || table->_first >= table->_last)
101 {
103 return 0;
104 }
105 copy._first = table->_first;
106 copy._last = table->_last;
107 copy._end = table->_end;
108 memset(table, 0, sizeof(*table));
111
112 for (func = copy._last - 1; func >= copy._first; func--)
113 {
114 if (*func)
115 (*func)();
116 }
117
118 HeapFree(GetProcessHeap(), 0, copy._first);
119 return 0;
120}
INT copy(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFlags, BOOL bTouch)
Definition: copy.c:51
void(__cdecl * _PVFV)(void)
void CDECL _lock(int locknum)
Definition: lock.c:85
void CDECL _unlock(int locknum)
Definition: lock.c:114
#define _EXIT_LOCK1
Definition: mtdll.h:37
int __cdecl _initialize_onexit_table(_onexit_table_t *table)
Definition: onexit.c:34
#define memset(x, y, z)
Definition: compat.h:39

Referenced by common_exit(), test__execute_onexit_table(), and test__register_onexit_function().

◆ _get_initial_narrow_environment()

_ACRTIMP char **__cdecl _get_initial_narrow_environment ( void  )

Definition at line 328 of file environment_initialization.cpp.

329{
330 return common_get_initial_environment<char>();
331}

Referenced by call_main< decltype(main)>(), and mainCRTStartup().

◆ _get_initial_wide_environment()

_ACRTIMP wchar_t **__cdecl _get_initial_wide_environment ( void  )

Definition at line 333 of file environment_initialization.cpp.

334{
335 return common_get_initial_environment<wchar_t>();
336}

Referenced by call_main< decltype(wmain)>(), and wmainCRTStartup().

◆ _get_narrow_winmain_command_line()

_ACRTIMP char *__cdecl _get_narrow_winmain_command_line ( void  )

Definition at line 102 of file argv_winmain.cpp.

103{ // Need to use unsigned char so that we correctly handle ASCII characters
104 // above 127, in particular the comparison to ' ' (space - 0x20).
105 return reinterpret_cast<char *>(common_wincmdln<unsigned char>());
106}

Referenced by test__get_narrow_winmain_command_line().

◆ _get_wide_winmain_command_line()

_ACRTIMP wchar_t *__cdecl _get_wide_winmain_command_line ( void  )

Definition at line 108 of file argv_winmain.cpp.

109{
110 return common_wincmdln<wchar_t>();
111}

◆ _initialize_narrow_environment()

_ACRTIMP int __cdecl _initialize_narrow_environment ( void  )

Definition at line 192 of file environment_initialization.cpp.

193{
194 return common_initialize_environment_nolock<char>();
195}

Referenced by mainCRTStartup().

◆ _initialize_onexit_table()

_ACRTIMP int __cdecl _initialize_onexit_table ( _onexit_table_t table)

Definition at line 34 of file onexit.c.

35{
36 if (!table)
37 return -1;
38
39 if (table->_first == table->_end)
40 table->_last = table->_end = table->_first = NULL;
41 return 0;
42}

Referenced by __scrt_initialize_onexit(), _execute_onexit_table(), initialize_c(), test__execute_onexit_table(), test__initialize_onexit_table(), and test__register_onexit_function().

◆ _initialize_wide_environment()

_ACRTIMP int __cdecl _initialize_wide_environment ( void  )

Definition at line 197 of file environment_initialization.cpp.

198{
199 return common_initialize_environment_nolock<wchar_t>();
200}

Referenced by wmainCRTStartup().

◆ _register_onexit_function()

_ACRTIMP int __cdecl _register_onexit_function ( _onexit_table_t table,
_onexit_t  func 
)

Definition at line 48 of file onexit.c.

49{
50 if (!table)
51 return -1;
52
54 if (!table->_first)
55 {
56 table->_first = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 32 * sizeof(void *));
57 if (!table->_first)
58 {
60 return -1;
61 }
62 table->_last = table->_first;
63 table->_end = table->_first + 32;
64 }
65
66 /* grow if full */
67 if (table->_last == table->_end)
68 {
69 int len = table->_end - table->_first;
70 _PVFV *tmp = HeapReAlloc(GetProcessHeap(), 0, table->_first, 2 * len * sizeof(void *));
71 if (!tmp)
72 {
74 return -1;
75 }
76 table->_first = tmp;
77 table->_end = table->_first + 2 * len;
78 table->_last = table->_first + len;
79 }
80
81 *table->_last = (_PVFV)func;
82 table->_last++;
84 return 0;
85}
#define HeapReAlloc
Definition: compat.h:734
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
GLenum GLsizei len
Definition: glext.h:6722

Referenced by _crt_at_quick_exit(), _crt_atexit(), _CRTALLOC(), test__execute_onexit_table(), and test__register_onexit_function().

◆ _set_app_type()

_ACRTIMP void __cdecl _set_app_type ( _crt_app_type  new_app_type)

Definition at line 80 of file report_runtime_error.cpp.

81{
82 __acrt_app_type = new_app_type;
83}
static _crt_app_type __acrt_app_type