diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c index cdcfa15c5f7..79e17724a17 100644 --- a/dlls/kernel32/tests/console.c +++ b/dlls/kernel32/tests/console.c @@ -1428,32 +1428,31 @@ static void test_WriteConsoleInputA(HANDLE input_handle) const INPUT_RECORD *buffer; DWORD count; LPDWORD written; - DWORD expected_count; DWORD gle, gle2; int win_crash; } invalid_table[] = { - {NULL, NULL, 0, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 0, 1}, - {NULL, NULL, 0, &count, 0, ERROR_INVALID_HANDLE}, - {NULL, NULL, 1, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 0, 1}, - {NULL, NULL, 1, &count, 0xdeadbeef, ERROR_NOACCESS, ERROR_INVALID_ACCESS}, - {NULL, &event, 0, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 0, 1}, - {NULL, &event, 0, &count, 0, ERROR_INVALID_HANDLE}, - {NULL, &event, 1, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 0, 1}, - {NULL, &event, 1, &count, 0, ERROR_INVALID_HANDLE}, - {INVALID_HANDLE_VALUE, NULL, 0, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 0, 1}, - {INVALID_HANDLE_VALUE, NULL, 0, &count, 0, ERROR_INVALID_HANDLE}, - {INVALID_HANDLE_VALUE, NULL, 1, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 0, 1}, - {INVALID_HANDLE_VALUE, NULL, 1, &count, 0xdeadbeef, ERROR_INVALID_HANDLE, ERROR_INVALID_ACCESS}, - {INVALID_HANDLE_VALUE, &event, 0, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 0, 1}, - {INVALID_HANDLE_VALUE, &event, 0, &count, 0, ERROR_INVALID_HANDLE}, - {INVALID_HANDLE_VALUE, &event, 1, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 0, 1}, - {INVALID_HANDLE_VALUE, &event, 1, &count, 0, ERROR_INVALID_HANDLE}, - {input_handle, NULL, 0, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 0, 1}, - {input_handle, NULL, 1, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 0, 1}, - {input_handle, NULL, 1, &count, 0xdeadbeef, ERROR_NOACCESS, ERROR_INVALID_ACCESS}, - {input_handle, &event, 0, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 0, 1}, - {input_handle, &event, 1, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 0, 1}, + {NULL, NULL, 0, NULL, ERROR_INVALID_ACCESS, 0, 1}, + {NULL, NULL, 0, &count,ERROR_INVALID_HANDLE}, + {NULL, NULL, 1, NULL, ERROR_INVALID_ACCESS, 0, 1}, + {NULL, NULL, 1, &count, ERROR_NOACCESS, ERROR_INVALID_ACCESS}, + {NULL, &event, 0, NULL, ERROR_INVALID_ACCESS, 0, 1}, + {NULL, &event, 0, &count, ERROR_INVALID_HANDLE}, + {NULL, &event, 1, NULL, ERROR_INVALID_ACCESS, 0, 1}, + {NULL, &event, 1, &count, ERROR_INVALID_HANDLE}, + {INVALID_HANDLE_VALUE, NULL, 0, NULL, ERROR_INVALID_ACCESS, 0, 1}, + {INVALID_HANDLE_VALUE, NULL, 0, &count, ERROR_INVALID_HANDLE}, + {INVALID_HANDLE_VALUE, NULL, 1, NULL, ERROR_INVALID_ACCESS, 0, 1}, + {INVALID_HANDLE_VALUE, NULL, 1, &count, ERROR_INVALID_HANDLE, ERROR_INVALID_ACCESS}, + {INVALID_HANDLE_VALUE, &event, 0, NULL, ERROR_INVALID_ACCESS, 0, 1}, + {INVALID_HANDLE_VALUE, &event, 0, &count, ERROR_INVALID_HANDLE}, + {INVALID_HANDLE_VALUE, &event, 1, NULL, ERROR_INVALID_ACCESS, 0, 1}, + {INVALID_HANDLE_VALUE, &event, 1, &count, ERROR_INVALID_HANDLE}, + {input_handle, NULL, 0, NULL, ERROR_INVALID_ACCESS, 0, 1}, + {input_handle, NULL, 1, NULL, ERROR_INVALID_ACCESS, 0, 1}, + {input_handle, NULL, 1, &count, ERROR_NOACCESS, ERROR_INVALID_ACCESS}, + {input_handle, &event, 0, NULL, ERROR_INVALID_ACCESS, 0, 1}, + {input_handle, &event, 1, NULL, ERROR_INVALID_ACCESS, 0, 1}, }; /* Suppress external sources of input events for the duration of the test. */ @@ -1492,12 +1491,6 @@ static void test_WriteConsoleInputA(HANDLE input_handle) invalid_table[i].count, invalid_table[i].written); ok(!ret, "[%d] Expected WriteConsoleInputA to return FALSE, got %d\n", i, ret); - if (invalid_table[i].written) - { - ok(count == invalid_table[i].expected_count, - "[%d] Expected output count to be %u, got %u\n", - i, invalid_table[i].expected_count, count); - } gle = GetLastError(); ok(gle == invalid_table[i].gle || (gle != 0 && gle == invalid_table[i].gle2), "[%d] Expected last error to be %u or %u, got %u\n", @@ -1672,32 +1665,31 @@ static void test_WriteConsoleInputW(HANDLE input_handle) const INPUT_RECORD *buffer; DWORD count; LPDWORD written; - DWORD expected_count; DWORD gle, gle2; int win_crash; } invalid_table[] = { - {NULL, NULL, 0, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 0, 1}, - {NULL, NULL, 0, &count, 0, ERROR_INVALID_HANDLE}, - {NULL, NULL, 1, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 0, 1}, - {NULL, NULL, 1, &count, 0xdeadbeef, ERROR_NOACCESS, ERROR_INVALID_ACCESS}, - {NULL, &event, 0, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 0, 1}, - {NULL, &event, 0, &count, 0, ERROR_INVALID_HANDLE}, - {NULL, &event, 1, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 0, 1}, - {NULL, &event, 1, &count, 0, ERROR_INVALID_HANDLE}, - {INVALID_HANDLE_VALUE, NULL, 0, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 0, 1}, - {INVALID_HANDLE_VALUE, NULL, 0, &count, 0, ERROR_INVALID_HANDLE}, - {INVALID_HANDLE_VALUE, NULL, 1, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 0, 1}, - {INVALID_HANDLE_VALUE, NULL, 1, &count, 0xdeadbeef, ERROR_INVALID_HANDLE, ERROR_INVALID_ACCESS}, - {INVALID_HANDLE_VALUE, &event, 0, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 0, 1}, - {INVALID_HANDLE_VALUE, &event, 0, &count, 0, ERROR_INVALID_HANDLE}, - {INVALID_HANDLE_VALUE, &event, 1, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 0, 1}, - {INVALID_HANDLE_VALUE, &event, 1, &count, 0, ERROR_INVALID_HANDLE}, - {input_handle, NULL, 0, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 0, 1}, - {input_handle, NULL, 1, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 0, 1}, - {input_handle, NULL, 1, &count, 0xdeadbeef, ERROR_NOACCESS, ERROR_INVALID_ACCESS}, - {input_handle, &event, 0, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 0, 1}, - {input_handle, &event, 1, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 0, 1}, + {NULL, NULL, 0, NULL, ERROR_INVALID_ACCESS, 0, 1}, + {NULL, NULL, 0, &count, ERROR_INVALID_HANDLE}, + {NULL, NULL, 1, NULL, ERROR_INVALID_ACCESS, 0, 1}, + {NULL, NULL, 1, &count, ERROR_NOACCESS, ERROR_INVALID_ACCESS}, + {NULL, &event, 0, NULL, ERROR_INVALID_ACCESS, 0, 1}, + {NULL, &event, 0, &count, ERROR_INVALID_HANDLE}, + {NULL, &event, 1, NULL, ERROR_INVALID_ACCESS, 0, 1}, + {NULL, &event, 1, &count, ERROR_INVALID_HANDLE}, + {INVALID_HANDLE_VALUE, NULL, 0, NULL, ERROR_INVALID_ACCESS, 0, 1}, + {INVALID_HANDLE_VALUE, NULL, 0, &count, ERROR_INVALID_HANDLE}, + {INVALID_HANDLE_VALUE, NULL, 1, NULL, ERROR_INVALID_ACCESS, 0, 1}, + {INVALID_HANDLE_VALUE, NULL, 1, &count, ERROR_INVALID_HANDLE, ERROR_INVALID_ACCESS}, + {INVALID_HANDLE_VALUE, &event, 0, NULL, ERROR_INVALID_ACCESS, 0, 1}, + {INVALID_HANDLE_VALUE, &event, 0, &count, ERROR_INVALID_HANDLE}, + {INVALID_HANDLE_VALUE, &event, 1, NULL, ERROR_INVALID_ACCESS, 0, 1}, + {INVALID_HANDLE_VALUE, &event, 1, &count, ERROR_INVALID_HANDLE}, + {input_handle, NULL, 0, NULL, ERROR_INVALID_ACCESS, 0, 1}, + {input_handle, NULL, 1, NULL, ERROR_INVALID_ACCESS, 0, 1}, + {input_handle, NULL, 1, &count, ERROR_NOACCESS, ERROR_INVALID_ACCESS}, + {input_handle, &event, 0, NULL, ERROR_INVALID_ACCESS, 0, 1}, + {input_handle, &event, 1, NULL, ERROR_INVALID_ACCESS, 0, 1}, }; /* Suppress external sources of input events for the duration of the test. */ @@ -1736,12 +1728,6 @@ static void test_WriteConsoleInputW(HANDLE input_handle) invalid_table[i].count, invalid_table[i].written); ok(!ret, "[%d] Expected WriteConsoleInputW to return FALSE, got %d\n", i, ret); - if (invalid_table[i].written) - { - ok(count == invalid_table[i].expected_count, - "[%d] Expected output count to be %u, got %u\n", - i, invalid_table[i].expected_count, count); - } gle = GetLastError(); ok(gle == invalid_table[i].gle || (gle != 0 && gle == invalid_table[i].gle2), "[%d] Expected last error to be %u or %u, got %u\n", @@ -2165,21 +2151,20 @@ static void test_FillConsoleOutputCharacterA(HANDLE output_handle) DWORD length; COORD coord; LPDWORD lpNumCharsWritten; - DWORD expected_count; DWORD last_error; int win7_crash; } invalid_table[] = { - {NULL, 'a', 0, {0, 0}, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 1}, - {NULL, 'a', 0, {0, 0}, &count, 0, ERROR_INVALID_HANDLE}, - {NULL, 'a', 1, {0, 0}, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 1}, - {NULL, 'a', 1, {0, 0}, &count, 0, ERROR_INVALID_HANDLE}, - {INVALID_HANDLE_VALUE, 'a', 0, {0, 0}, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 1}, - {INVALID_HANDLE_VALUE, 'a', 0, {0, 0}, &count, 0, ERROR_INVALID_HANDLE}, - {INVALID_HANDLE_VALUE, 'a', 1, {0, 0}, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 1}, - {INVALID_HANDLE_VALUE, 'a', 1, {0, 0}, &count, 0, ERROR_INVALID_HANDLE}, - {output_handle, 'a', 0, {0, 0}, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 1}, - {output_handle, 'a', 1, {0, 0}, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 1}, + {NULL, 'a', 0, {0, 0}, NULL, ERROR_INVALID_ACCESS, 1}, + {NULL, 'a', 0, {0, 0}, &count, ERROR_INVALID_HANDLE}, + {NULL, 'a', 1, {0, 0}, NULL, ERROR_INVALID_ACCESS, 1}, + {NULL, 'a', 1, {0, 0}, &count, ERROR_INVALID_HANDLE}, + {INVALID_HANDLE_VALUE, 'a', 0, {0, 0}, NULL, ERROR_INVALID_ACCESS, 1}, + {INVALID_HANDLE_VALUE, 'a', 0, {0, 0}, &count, ERROR_INVALID_HANDLE}, + {INVALID_HANDLE_VALUE, 'a', 1, {0, 0}, NULL, ERROR_INVALID_ACCESS, 1}, + {INVALID_HANDLE_VALUE, 'a', 1, {0, 0}, &count, ERROR_INVALID_HANDLE}, + {output_handle, 'a', 0, {0, 0}, NULL, ERROR_INVALID_ACCESS, 1}, + {output_handle, 'a', 1, {0, 0}, NULL, ERROR_INVALID_ACCESS, 1}, }; for (i = 0; i < sizeof(invalid_table)/sizeof(invalid_table[0]); i++) @@ -2195,12 +2180,6 @@ static void test_FillConsoleOutputCharacterA(HANDLE output_handle) invalid_table[i].coord, invalid_table[i].lpNumCharsWritten); ok(!ret, "[%d] Expected FillConsoleOutputCharacterA to return FALSE, got %d\n", i, ret); - if (invalid_table[i].lpNumCharsWritten) - { - ok(count == invalid_table[i].expected_count, - "[%d] Expected count to be %u, got %u\n", - i, invalid_table[i].expected_count, count); - } ok(GetLastError() == invalid_table[i].last_error, "[%d] Expected last error to be %u, got %u\n", i, invalid_table[i].last_error, GetLastError()); @@ -2231,21 +2210,20 @@ static void test_FillConsoleOutputCharacterW(HANDLE output_handle) DWORD length; COORD coord; LPDWORD lpNumCharsWritten; - DWORD expected_count; DWORD last_error; int win7_crash; } invalid_table[] = { - {NULL, 'a', 0, {0, 0}, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 1}, - {NULL, 'a', 0, {0, 0}, &count, 0, ERROR_INVALID_HANDLE}, - {NULL, 'a', 1, {0, 0}, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 1}, - {NULL, 'a', 1, {0, 0}, &count, 0, ERROR_INVALID_HANDLE}, - {INVALID_HANDLE_VALUE, 'a', 0, {0, 0}, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 1}, - {INVALID_HANDLE_VALUE, 'a', 0, {0, 0}, &count, 0, ERROR_INVALID_HANDLE}, - {INVALID_HANDLE_VALUE, 'a', 1, {0, 0}, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 1}, - {INVALID_HANDLE_VALUE, 'a', 1, {0, 0}, &count, 0, ERROR_INVALID_HANDLE}, - {output_handle, 'a', 0, {0, 0}, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 1}, - {output_handle, 'a', 1, {0, 0}, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 1}, + {NULL, 'a', 0, {0, 0}, NULL, ERROR_INVALID_ACCESS, 1}, + {NULL, 'a', 0, {0, 0}, &count, ERROR_INVALID_HANDLE}, + {NULL, 'a', 1, {0, 0}, NULL, ERROR_INVALID_ACCESS, 1}, + {NULL, 'a', 1, {0, 0}, &count, ERROR_INVALID_HANDLE}, + {INVALID_HANDLE_VALUE, 'a', 0, {0, 0}, NULL, ERROR_INVALID_ACCESS, 1}, + {INVALID_HANDLE_VALUE, 'a', 0, {0, 0}, &count, ERROR_INVALID_HANDLE}, + {INVALID_HANDLE_VALUE, 'a', 1, {0, 0}, NULL, ERROR_INVALID_ACCESS, 1}, + {INVALID_HANDLE_VALUE, 'a', 1, {0, 0}, &count, ERROR_INVALID_HANDLE}, + {output_handle, 'a', 0, {0, 0}, NULL, ERROR_INVALID_ACCESS, 1}, + {output_handle, 'a', 1, {0, 0}, NULL, ERROR_INVALID_ACCESS, 1}, }; for (i = 0; i < sizeof(invalid_table)/sizeof(invalid_table[0]); i++) @@ -2261,12 +2239,6 @@ static void test_FillConsoleOutputCharacterW(HANDLE output_handle) invalid_table[i].coord, invalid_table[i].lpNumCharsWritten); ok(!ret, "[%d] Expected FillConsoleOutputCharacterW to return FALSE, got %d\n", i, ret); - if (invalid_table[i].lpNumCharsWritten) - { - ok(count == invalid_table[i].expected_count, - "[%d] Expected count to be %u, got %u\n", - i, invalid_table[i].expected_count, count); - } ok(GetLastError() == invalid_table[i].last_error, "[%d] Expected last error to be %u, got %u\n", i, invalid_table[i].last_error, GetLastError()); @@ -2297,21 +2269,20 @@ static void test_FillConsoleOutputAttribute(HANDLE output_handle) DWORD length; COORD coord; LPDWORD lpNumAttrsWritten; - DWORD expected_count; DWORD last_error; int win7_crash; } invalid_table[] = { - {NULL, FOREGROUND_BLUE, 0, {0, 0}, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 1}, - {NULL, FOREGROUND_BLUE, 0, {0, 0}, &count, 0, ERROR_INVALID_HANDLE}, - {NULL, FOREGROUND_BLUE, 1, {0, 0}, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 1}, - {NULL, FOREGROUND_BLUE, 1, {0, 0}, &count, 0, ERROR_INVALID_HANDLE}, - {INVALID_HANDLE_VALUE, FOREGROUND_BLUE, 0, {0, 0}, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 1}, - {INVALID_HANDLE_VALUE, FOREGROUND_BLUE, 0, {0, 0}, &count, 0, ERROR_INVALID_HANDLE}, - {INVALID_HANDLE_VALUE, FOREGROUND_BLUE, 1, {0, 0}, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 1}, - {INVALID_HANDLE_VALUE, FOREGROUND_BLUE, 1, {0, 0}, &count, 0, ERROR_INVALID_HANDLE}, - {output_handle, FOREGROUND_BLUE, 0, {0, 0}, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 1}, - {output_handle, FOREGROUND_BLUE, 1, {0, 0}, NULL, 0xdeadbeef, ERROR_INVALID_ACCESS, 1}, + {NULL, FOREGROUND_BLUE, 0, {0, 0}, NULL, ERROR_INVALID_ACCESS, 1}, + {NULL, FOREGROUND_BLUE, 0, {0, 0}, &count, ERROR_INVALID_HANDLE}, + {NULL, FOREGROUND_BLUE, 1, {0, 0}, NULL, ERROR_INVALID_ACCESS, 1}, + {NULL, FOREGROUND_BLUE, 1, {0, 0}, &count, ERROR_INVALID_HANDLE}, + {INVALID_HANDLE_VALUE, FOREGROUND_BLUE, 0, {0, 0}, NULL, ERROR_INVALID_ACCESS, 1}, + {INVALID_HANDLE_VALUE, FOREGROUND_BLUE, 0, {0, 0}, &count, ERROR_INVALID_HANDLE}, + {INVALID_HANDLE_VALUE, FOREGROUND_BLUE, 1, {0, 0}, NULL, ERROR_INVALID_ACCESS, 1}, + {INVALID_HANDLE_VALUE, FOREGROUND_BLUE, 1, {0, 0}, &count, ERROR_INVALID_HANDLE}, + {output_handle, FOREGROUND_BLUE, 0, {0, 0}, NULL, ERROR_INVALID_ACCESS, 1}, + {output_handle, FOREGROUND_BLUE, 1, {0, 0}, NULL, ERROR_INVALID_ACCESS, 1}, }; for (i = 0; i < sizeof(invalid_table)/sizeof(invalid_table[0]); i++) @@ -2327,12 +2298,6 @@ static void test_FillConsoleOutputAttribute(HANDLE output_handle) invalid_table[i].coord, invalid_table[i].lpNumAttrsWritten); ok(!ret, "[%d] Expected FillConsoleOutputAttribute to return FALSE, got %d\n", i, ret); - if (invalid_table[i].lpNumAttrsWritten) - { - ok(count == invalid_table[i].expected_count, - "[%d] Expected count to be %u, got %u\n", - i, invalid_table[i].expected_count, count); - } ok(GetLastError() == invalid_table[i].last_error, "[%d] Expected last error to be %u, got %u\n", i, invalid_table[i].last_error, GetLastError());