kernelbase: Handle corner case in CreateProcess.

In CreateProcess, if:
- parent isn't attached to a console
- CreateProcess's flag isn't set with DETACHED_PROCESS nor
  CREATE_NEW_CONSOLE
- child is a CUI program
then a console must be allocated for the child.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52048
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Eric Pouech 2022-03-17 08:27:28 +01:00 committed by Alexandre Julliard
parent c7e87b536e
commit f034084d49
2 changed files with 6 additions and 2 deletions

View File

@ -4735,7 +4735,7 @@ static void test_CreateProcessCUI(void)
res = check_whether_child_attached(cuiexec, DETACHED_PROCESS);
ok(!res, "Don't expecting child to be attached to a console\n");
res = check_whether_child_attached(cuiexec, 0);
todo_wine ok(res, "Expecting child to be attached to a console\n");
ok(res, "Expecting child to be attached to a console\n");
DeleteFileA(guiexec);
DeleteFileA(cuiexec);

View File

@ -191,7 +191,11 @@ static RTL_USER_PROCESS_PARAMETERS *create_process_params( const WCHAR *filename
if (flags & CREATE_NEW_PROCESS_GROUP) params->ConsoleFlags = 1;
if (flags & CREATE_NEW_CONSOLE) params->ConsoleHandle = CONSOLE_HANDLE_ALLOC;
else if (!(flags & DETACHED_PROCESS)) params->ConsoleHandle = NtCurrentTeb()->Peb->ProcessParameters->ConsoleHandle;
else if (!(flags & DETACHED_PROCESS))
{
params->ConsoleHandle = NtCurrentTeb()->Peb->ProcessParameters->ConsoleHandle;
if (!params->ConsoleHandle) params->ConsoleHandle = CONSOLE_HANDLE_ALLOC;
}
if (startup->dwFlags & STARTF_USESTDHANDLES)
{