kernel32/tests: Use current console input in test_ReadConsole.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2020-10-14 19:57:37 +02:00 committed by Alexandre Julliard
parent 70c1d4fcaa
commit 1668db80ab
1 changed files with 6 additions and 14 deletions

View File

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