kernel32/tests: Make the console tests pass if current console is shell-no-window.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Eric Pouech 2022-04-21 17:39:11 +02:00 committed by Alexandre Julliard
parent 7500fc1ce9
commit fdfd19cb47
1 changed files with 6 additions and 1 deletions

View File

@ -1541,8 +1541,13 @@ static void test_Console(void)
startup.hStdOutput = CreateFileA("CONOUT$", GENERIC_READ|GENERIC_WRITE, 0, &sa, OPEN_EXISTING, 0, 0); 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 */ /* 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 */ /* we're not attached to a console, let's do it */
AllocConsole(); AllocConsole();
startup.hStdInput = CreateFileA("CONIN$", GENERIC_READ|GENERIC_WRITE, 0, &sa, OPEN_EXISTING, 0, 0); startup.hStdInput = CreateFileA("CONIN$", GENERIC_READ|GENERIC_WRITE, 0, &sa, OPEN_EXISTING, 0, 0);