This parameter should set the new mode, not the app type. This was a
mistake from misreading the corresponding function in wine.

Signed-off-by: Martin Storsjö <[email protected]>
---
 mingw-w64-crt/crt/ucrtbase_compat.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/mingw-w64-crt/crt/ucrtbase_compat.c 
b/mingw-w64-crt/crt/ucrtbase_compat.c
index 7f022aa53..fa6d922c1 100644
--- a/mingw-w64-crt/crt/ucrtbase_compat.c
+++ b/mingw-w64-crt/crt/ucrtbase_compat.c
@@ -53,6 +53,8 @@ _CRTIMP int __cdecl _initialize_wide_environment(void);
 _CRTIMP int __cdecl _configure_narrow_argv(int mode);
 _CRTIMP int __cdecl _configure_wide_argv(int mode);
 
+// Declared in new.h, but only visible to C++
+_CRTIMP int __cdecl _set_new_mode(int _NewMode);
 
 
 // Wrappers with legacy msvcrt.dll style API, based on the new ucrtbase.dll 
functions.
@@ -63,7 +65,8 @@ int __cdecl __getmainargs(int * _Argc, char *** _Argv, char 
***_Env, int _DoWild
   *_Argc = *__p___argc();
   *_Argv = *__p___argv();
   *_Env = *__p__environ();
-  __set_app_type(_StartInfo->newmode);
+  if (_StartInfo)
+    _set_new_mode(_StartInfo->newmode);
   return 0;
 }
 
@@ -74,7 +77,8 @@ int __cdecl __wgetmainargs(int * _Argc, wchar_t *** _Argv, 
wchar_t ***_Env, int
   *_Argc = *__p___argc();
   *_Argv = *__p___wargv();
   *_Env = *__p__wenviron();
-  __set_app_type(_StartInfo->newmode);
+  if (_StartInfo)
+    _set_new_mode(_StartInfo->newmode);
   return 0;
 }
 
-- 
2.17.1



_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to