From fdfd19cb47ff6039b085afdbdcc61723e716024f Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Thu, 21 Apr 2022 17:39:11 +0200 Subject: [PATCH] kernel32/tests: Make the console tests pass if current console is shell-no-window. Signed-off-by: Eric Pouech Signed-off-by: Alexandre Julliard --- dlls/kernel32/tests/process.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dlls/kernel32/tests/process.c b/dlls/kernel32/tests/process.c index 8f18a0d37a7..d94cecd3462 100644 --- a/dlls/kernel32/tests/process.c +++ b/dlls/kernel32/tests/process.c @@ -1541,8 +1541,13 @@ static void test_Console(void) startup.hStdOutput = CreateFileA("CONOUT$", GENERIC_READ|GENERIC_WRITE, 0, &sa, OPEN_EXISTING, 0, 0); /* first, we need to be sure we're attached to a console */ - if (!is_console(startup.hStdInput) || !is_console(startup.hStdOutput)) + if (startup.hStdInput == INVALID_HANDLE_VALUE || startup.hStdOutput == INVALID_HANDLE_VALUE) { + /* this fails either when this test process is run detached from console + * (unlikely, as this very process must be explicitly created with detached flag), + * or is attached to a Wine's shell-no-window kind of console (if the later, detach from it) + */ + FreeConsole(); /* we're not attached to a console, let's do it */ AllocConsole(); startup.hStdInput = CreateFileA("CONIN$", GENERIC_READ|GENERIC_WRITE, 0, &sa, OPEN_EXISTING, 0, 0);