[CRT] spawn: define a unicode environment when needed 936/head
authorMark Jansen <mark.jansen@reactos.org>
Fri, 12 Oct 2018 22:20:58 +0000 (00:20 +0200)
committerMark Jansen <mark.jansen@reactos.org>
Sat, 13 Oct 2018 18:30:07 +0000 (20:30 +0200)
CORE-9182

sdk/lib/crt/process/process.c

index f607c2e..ef6ad4d 100644 (file)
@@ -203,6 +203,7 @@ do_spawnT(int mode, const _TCHAR* cmdname, const _TCHAR* args, const _TCHAR* env
    BOOL bResult;
    DWORD dwExitCode;
    DWORD dwError;
+   DWORD dwFlags = 0;
 
    TRACE(MK_STR(do_spawnT)"(%i,'%"sT"','%"sT"','%"sT"')",mode,cmdname,args,envp);
 
@@ -286,12 +287,20 @@ do_spawnT(int mode, const _TCHAR* cmdname, const _TCHAR* args, const _TCHAR* env
 
    create_io_inherit_block(&StartupInfo.cbReserved2, &StartupInfo.lpReserved2);
 
+   if (mode == _P_DETACH)
+   {
+       dwFlags |= DETACHED_PROCESS;
+   }
+#ifdef _UNICODE
+   dwFlags |= CREATE_UNICODE_ENVIRONMENT;
+#endif
+
    bResult = CreateProcess((_TCHAR *)cmdname,
                             (_TCHAR *)args,
                             NULL,
                             NULL,
                             TRUE,
-                            mode == _P_DETACH ? DETACHED_PROCESS : 0,
+                            dwFlags,
                             (LPVOID)envp,
                             NULL,
                             &StartupInfo,