[PATCH V2 1/2] dlls/kernel32/tests: let the console tests pass if current console is shell-no-window

Eric Pouech eric.pouech at gmail.com
Wed Apr 20 04:29:33 CDT 2022


This patch shall let this kernel32:process test pass when run from TestBot.

Note: adapted the tests to non Win7 type of handles (the ones with 2 lower bits
set...).
Windows 8 and above use real handles for console.
Wine has been doing so since since 2 years.

The is_console() helper is then not testing what its name pretends. It
actually tests whether we're running the test on W7 :-(
So let's get reed of it.

Signed-off-by: Eric Pouech <eric.pouech at gmail.com>

---
 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..9629b50a744 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 explicitely 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);




More information about the wine-devel mailing list