Jacek Caban : kernel32/tests: Use current console input in test_ReadConsole.

Alexandre Julliard julliard at winehq.org
Wed Oct 14 15:37:21 CDT 2020


Module: wine
Branch: master
Commit: 1668db80abe44a833ab3de888d235be53a02f0dd
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=1668db80abe44a833ab3de888d235be53a02f0dd

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Oct 14 19:57:37 2020 +0200

kernel32/tests: Use current console input in test_ReadConsole.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/kernel32/tests/console.c | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c
index b5878fe8a2..da62fd3eb2 100644
--- a/dlls/kernel32/tests/console.c
+++ b/dlls/kernel32/tests/console.c
@@ -2977,21 +2977,13 @@ static void test_ReadConsoleOutput(HANDLE console)
     ok(ch == 'z', "unexpected char %c/%x\n", ch, ch);
 }
 
-static void test_ReadConsole(void)
+static void test_ReadConsole(HANDLE input)
 {
-    HANDLE std_input;
     DWORD ret, bytes;
     char buf[1024];
 
-    std_input = GetStdHandle(STD_INPUT_HANDLE);
-
     SetLastError(0xdeadbeef);
-    ret = GetFileSize(std_input, NULL);
-    if (GetLastError() == 0xdeadbeef)
-    {
-        skip("stdin is redirected\n");
-        return;
-    }
+    ret = GetFileSize(input, NULL);
     ok(ret == INVALID_FILE_SIZE, "expected INVALID_FILE_SIZE, got %#x\n", ret);
     ok(GetLastError() == ERROR_INVALID_HANDLE ||
        GetLastError() == ERROR_INVALID_FUNCTION, /* Win 8, 10 */
@@ -2999,7 +2991,7 @@ static void test_ReadConsole(void)
 
     bytes = 0xdeadbeef;
     SetLastError(0xdeadbeef);
-    ret = ReadFile(std_input, buf, -128, &bytes, NULL);
+    ret = ReadFile(input, buf, -128, &bytes, NULL);
     ok(!ret, "expected 0, got %u\n", ret);
     ok(GetLastError() == ERROR_NOT_ENOUGH_MEMORY ||
        GetLastError() == ERROR_NOACCESS, /* Win 8, 10 */
@@ -3008,7 +3000,7 @@ static void test_ReadConsole(void)
 
     bytes = 0xdeadbeef;
     SetLastError(0xdeadbeef);
-    ret = ReadConsoleA(std_input, buf, -128, &bytes, NULL);
+    ret = ReadConsoleA(input, buf, -128, &bytes, NULL);
     ok(!ret, "expected 0, got %u\n", ret);
     ok(GetLastError() == ERROR_NOT_ENOUGH_MEMORY ||
        GetLastError() == ERROR_NOACCESS, /* Win 8, 10 */
@@ -3017,7 +3009,7 @@ static void test_ReadConsole(void)
 
     bytes = 0xdeadbeef;
     SetLastError(0xdeadbeef);
-    ret = ReadConsoleW(std_input, buf, -128, &bytes, NULL);
+    ret = ReadConsoleW(input, buf, -128, &bytes, NULL);
     ok(!ret, "expected 0, got %u\n", ret);
     ok(GetLastError() == ERROR_NOT_ENOUGH_MEMORY ||
        GetLastError() == ERROR_NOACCESS, /* Win 8, 10 */
@@ -4213,7 +4205,7 @@ START_TEST(console)
     ok(sbi.dwSize.Y == size, "Unexpected buffer size: %d instead of %d\n", sbi.dwSize.Y, size);
     if (!ret) return;
 
-    test_ReadConsole();
+    test_ReadConsole(hConIn);
     /* Non interactive tests */
     testCursor(hConOut, sbi.dwSize);
     /* test parameters (FIXME: test functionality) */




More information about the wine-cvs mailing list