[PATCH V2 2/2] dlls/kernel32/tests: adapt dup console handle test to non Win7 handles

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


This test hadn't been changed with console rewrite.
The status before this patch:
- it's not run on Windows except Win7
- it's not run on Wine

Rewrote it so that it run on all cases and inverse the test logic (it was
only testing Win7 behavior, which is no longer what we want).

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

---
 dlls/kernel32/tests/process.c |   15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/dlls/kernel32/tests/process.c b/dlls/kernel32/tests/process.c
index 9629b50a744..ebadc2e8d12 100644
--- a/dlls/kernel32/tests/process.c
+++ b/dlls/kernel32/tests/process.c
@@ -1507,11 +1507,6 @@ static  void    test_DebuggingFlag(void)
     DeleteFileA(resfile);
 }
 
-static BOOL is_console(HANDLE h)
-{
-    return h != INVALID_HANDLE_VALUE && ((ULONG_PTR)h & 3) == 3;
-}
-
 static void test_Console(void)
 {
     char                buffer[2 * MAX_PATH + 35];
@@ -2500,17 +2495,11 @@ static void test_DuplicateHandle(void)
     DeleteFileA(file_name);
 
     f = CreateFileA("CONIN$", GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0);
-    if (!is_console(f))
-    {
-        skip("DuplicateHandle on console handle\n");
-        CloseHandle(f);
-        return;
-    }
-
+    ok(f != INVALID_HANDLE_VALUE, "Failed to open CONIN$ %lu\n", GetLastError());
     r = DuplicateHandle(GetCurrentProcess(), f, GetCurrentProcess(), &out,
             0, FALSE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE);
     ok(r, "DuplicateHandle error %lu\n", GetLastError());
-    todo_wine ok(f != out, "f == out\n");
+    ok(f == out || broken(/* Win7 */ (((ULONG_PTR)f & 3) == 3) && (f != out)), "f != out\n");
     CloseHandle(out);
 }
 




More information about the wine-devel mailing list