[PATCH V3 4/5] dlls/kernel32/tests: adapt dup console handle test to non Win7 handles

Eric Pouech eric.pouech at gmail.com
Thu Apr 21 04:08:21 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

Rewrite 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 b6dd70399d3..88556ac0c1f 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];
@@ -2514,17 +2509,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