Commit 78eca968 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

ucrtbase: Add exe entry points implementation.

parent 82a4e720
...@@ -24,7 +24,12 @@ ...@@ -24,7 +24,12 @@
#ifdef __MINGW32__ #ifdef __MINGW32__
#if _MSVCR_VER >= 140
#define _UCRT
#endif
#include <stdarg.h> #include <stdarg.h>
#include <stdlib.h>
#include <process.h> #include <process.h>
#include "windef.h" #include "windef.h"
...@@ -40,10 +45,19 @@ static const IMAGE_NT_HEADERS *get_nt_header( void ) ...@@ -40,10 +45,19 @@ static const IMAGE_NT_HEADERS *get_nt_header( void )
int __cdecl mainCRTStartup(void) int __cdecl mainCRTStartup(void)
{ {
int argc, new_mode = 0, ret; int argc, ret;
char **argv, **env; char **argv, **env;
#ifdef _UCRT
_configure_narrow_argv(_crt_argv_unexpanded_arguments);
_initialize_narrow_environment();
argc = *__p___argc();
argv = *__p___argv();
env = _get_initial_narrow_environment();
#else
int new_mode = 0;
__getmainargs(&argc, &argv, &env, 0, &new_mode); __getmainargs(&argc, &argv, &env, 0, &new_mode);
#endif
_set_app_type(get_nt_header()->OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI ? _crt_gui_app : _crt_console_app); _set_app_type(get_nt_header()->OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI ? _crt_gui_app : _crt_console_app);
ret = main(argc, argv, env); ret = main(argc, argv, env);
......
...@@ -24,7 +24,12 @@ ...@@ -24,7 +24,12 @@
#ifdef __MINGW32__ #ifdef __MINGW32__
#if _MSVCR_VER >= 140
#define _UCRT
#endif
#include <stdarg.h> #include <stdarg.h>
#include <stdlib.h>
#include <process.h> #include <process.h>
#include "windef.h" #include "windef.h"
...@@ -40,10 +45,19 @@ static const IMAGE_NT_HEADERS *get_nt_header( void ) ...@@ -40,10 +45,19 @@ static const IMAGE_NT_HEADERS *get_nt_header( void )
int __cdecl wmainCRTStartup(void) int __cdecl wmainCRTStartup(void)
{ {
int argc, new_mode = 0, ret; int argc, ret;
WCHAR **argv, **env; WCHAR **argv, **env;
#ifdef _UCRT
_configure_wide_argv(_crt_argv_unexpanded_arguments);
_initialize_wide_environment();
argc = *__p___argc();
argv = *__p___wargv();
env = _get_initial_wide_environment();
#else
int new_mode = 0;
__wgetmainargs(&argc, &argv, &env, 0, &new_mode); __wgetmainargs(&argc, &argv, &env, 0, &new_mode);
#endif
_set_app_type(get_nt_header()->OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI ? _crt_gui_app : _crt_console_app); _set_app_type(get_nt_header()->OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI ? _crt_gui_app : _crt_console_app);
ret = wmain(argc, argv, env); ret = wmain(argc, argv, env);
......
...@@ -7,6 +7,11 @@ PARENTSRC = ../msvcrt ...@@ -7,6 +7,11 @@ PARENTSRC = ../msvcrt
C_SRCS = \ C_SRCS = \
console.c \ console.c \
cpp.c \ cpp.c \
crt_gccmain.c \
crt_main.c \
crt_winmain.c \
crt_wmain.c \
crt_wwinmain.c \
ctype.c \ ctype.c \
data.c \ data.c \
dir.c \ dir.c \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment