From c7e87b536edb28bb48162690e0d42c9ba9ccb43c Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Thu, 17 Mar 2022 08:27:22 +0100 Subject: [PATCH] start: Force no console creation when using start /exec. Signed-off-by: Eric Pouech Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- programs/start/start.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/programs/start/start.c b/programs/start/start.c index 998c439423e..7252d54e046 100644 --- a/programs/start/start.c +++ b/programs/start/start.c @@ -516,8 +516,11 @@ int __cdecl wmain (int argc, WCHAR *argv[]) break; } else if (is_option(argv[i], L"/exec")) { - creation_flags = 0; - sei.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_NO_CONSOLE | SEE_MASK_FLAG_NO_UI; + /* If start.exe isn't attached to a console, force that no console would be created. + * This is needed when target process belongs to CUI subsystem. + */ + creation_flags = GetConsoleCP() == 0 ? DETACHED_PROCESS : 0; + sei.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_NO_CONSOLE | SEE_MASK_FLAG_NO_UI; i++; break; }