Commit 18a9aba0 authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

kernel32/tests: Windows 8 returns different error codes.

parent f399e903
...@@ -704,7 +704,7 @@ static void testScreenBuffer(HANDLE hConOut) ...@@ -704,7 +704,7 @@ static void testScreenBuffer(HANDLE hConOut)
WCHAR test_unicode[] = {0x0442, 0x0435, 0x0441, 0x0442, 0}; WCHAR test_unicode[] = {0x0442, 0x0435, 0x0441, 0x0442, 0};
WCHAR str_wbuf[20]; WCHAR str_wbuf[20];
char str_buf[20]; char str_buf[20];
DWORD len; DWORD len, error;
COORD c; COORD c;
BOOL ret; BOOL ret;
DWORD oldcp; DWORD oldcp;
...@@ -782,25 +782,25 @@ static void testScreenBuffer(HANDLE hConOut) ...@@ -782,25 +782,25 @@ static void testScreenBuffer(HANDLE hConOut)
/* trying to write non-console handle */ /* trying to write non-console handle */
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ok(!WriteConsoleA(hFileOutRW, test_str1, lstrlenA(test_str1), &len, NULL), ret = WriteConsoleA(hFileOutRW, test_str1, lstrlenA(test_str1), &len, NULL);
"Shouldn't succeed\n"); error = GetLastError();
ok(GetLastError() == ERROR_INVALID_HANDLE, ok(!ret, "Shouldn't succeed\n");
"GetLastError: expecting %u got %u\n", ok(error == ERROR_INVALID_HANDLE || error == ERROR_INVALID_FUNCTION,
ERROR_INVALID_HANDLE, GetLastError()); "GetLastError: got %u\n", error);
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ok(!WriteConsoleA(hFileOutRO, test_str1, lstrlenA(test_str1), &len, NULL), ret = WriteConsoleA(hFileOutRO, test_str1, lstrlenA(test_str1), &len, NULL);
"Shouldn't succeed\n"); error = GetLastError();
ok(GetLastError() == ERROR_INVALID_HANDLE, ok(!ret, "Shouldn't succeed\n");
"GetLastError: expecting %u got %u\n", ok(error == ERROR_INVALID_HANDLE || error == ERROR_INVALID_FUNCTION,
ERROR_INVALID_HANDLE, GetLastError()); "GetLastError: got %u\n", error);
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ok(!WriteConsoleA(hFileOutWT, test_str1, lstrlenA(test_str1), &len, NULL), ret = WriteConsoleA(hFileOutWT, test_str1, lstrlenA(test_str1), &len, NULL);
"Shouldn't succeed\n"); error = GetLastError();
todo_wine ok(GetLastError() == ERROR_INVALID_HANDLE, ok(!ret, "Shouldn't succeed\n");
"GetLastError: expecting %u got %u\n", todo_wine ok(error == ERROR_INVALID_HANDLE || error == ERROR_INVALID_FUNCTION,
ERROR_INVALID_HANDLE, GetLastError()); "GetLastError: got %u\n", error);
CloseHandle(hFileOutRW); CloseHandle(hFileOutRW);
CloseHandle(hFileOutRO); CloseHandle(hFileOutRO);
...@@ -1051,6 +1051,7 @@ static void test_OpenConsoleW(void) ...@@ -1051,6 +1051,7 @@ static void test_OpenConsoleW(void)
static const WCHAR conoutW[] = {'C','O','N','O','U','T','$',0}; static const WCHAR conoutW[] = {'C','O','N','O','U','T','$',0};
static const WCHAR emptyW[] = {0}; static const WCHAR emptyW[] = {0};
static const WCHAR invalidW[] = {'I','N','V','A','L','I','D',0}; static const WCHAR invalidW[] = {'I','N','V','A','L','I','D',0};
DWORD gle;
static const struct static const struct
{ {
...@@ -1058,42 +1059,42 @@ static void test_OpenConsoleW(void) ...@@ -1058,42 +1059,42 @@ static void test_OpenConsoleW(void)
DWORD access; DWORD access;
BOOL inherit; BOOL inherit;
DWORD creation; DWORD creation;
DWORD gle; DWORD gle, gle2;
} invalid_table[] = { } invalid_table[] = {
{NULL, 0, FALSE, 0, ERROR_INVALID_PARAMETER}, {NULL, 0, FALSE, 0, ERROR_INVALID_PARAMETER, ERROR_PATH_NOT_FOUND},
{NULL, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, ERROR_INVALID_PARAMETER}, {NULL, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, ERROR_INVALID_PARAMETER, ERROR_PATH_NOT_FOUND},
{NULL, 0, FALSE, OPEN_ALWAYS, ERROR_INVALID_PARAMETER}, {NULL, 0, FALSE, OPEN_ALWAYS, ERROR_INVALID_PARAMETER, ERROR_PATH_NOT_FOUND},
{NULL, GENERIC_READ | GENERIC_WRITE, FALSE, 0, ERROR_INVALID_PARAMETER}, {NULL, GENERIC_READ | GENERIC_WRITE, FALSE, 0, ERROR_INVALID_PARAMETER, ERROR_PATH_NOT_FOUND},
{NULL, GENERIC_READ | GENERIC_WRITE, FALSE, OPEN_ALWAYS, ERROR_INVALID_PARAMETER}, {NULL, GENERIC_READ | GENERIC_WRITE, FALSE, OPEN_ALWAYS, ERROR_INVALID_PARAMETER, ERROR_PATH_NOT_FOUND},
{NULL, GENERIC_READ | GENERIC_WRITE, FALSE, OPEN_EXISTING, ERROR_INVALID_PARAMETER}, {NULL, GENERIC_READ | GENERIC_WRITE, FALSE, OPEN_EXISTING, ERROR_INVALID_PARAMETER, ERROR_PATH_NOT_FOUND},
{emptyW, 0, FALSE, 0, ERROR_INVALID_PARAMETER}, {emptyW, 0, FALSE, 0, ERROR_INVALID_PARAMETER, ERROR_PATH_NOT_FOUND},
{emptyW, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, ERROR_INVALID_PARAMETER}, {emptyW, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, ERROR_INVALID_PARAMETER, ERROR_PATH_NOT_FOUND},
{emptyW, 0, FALSE, OPEN_ALWAYS, ERROR_INVALID_PARAMETER}, {emptyW, 0, FALSE, OPEN_ALWAYS, ERROR_INVALID_PARAMETER, ERROR_PATH_NOT_FOUND},
{emptyW, GENERIC_READ | GENERIC_WRITE, FALSE, 0, ERROR_INVALID_PARAMETER}, {emptyW, GENERIC_READ | GENERIC_WRITE, FALSE, 0, ERROR_INVALID_PARAMETER, ERROR_PATH_NOT_FOUND},
{emptyW, GENERIC_READ | GENERIC_WRITE, FALSE, OPEN_ALWAYS, ERROR_INVALID_PARAMETER}, {emptyW, GENERIC_READ | GENERIC_WRITE, FALSE, OPEN_ALWAYS, ERROR_INVALID_PARAMETER, ERROR_PATH_NOT_FOUND},
{emptyW, GENERIC_READ | GENERIC_WRITE, FALSE, OPEN_EXISTING, ERROR_INVALID_PARAMETER}, {emptyW, GENERIC_READ | GENERIC_WRITE, FALSE, OPEN_EXISTING, ERROR_INVALID_PARAMETER, ERROR_PATH_NOT_FOUND},
{invalidW, 0, FALSE, 0, ERROR_INVALID_PARAMETER}, {invalidW, 0, FALSE, 0, ERROR_INVALID_PARAMETER, ERROR_FILE_NOT_FOUND},
{invalidW, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, ERROR_INVALID_PARAMETER}, {invalidW, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, ERROR_INVALID_PARAMETER, 0},
{invalidW, 0, FALSE, OPEN_ALWAYS, ERROR_INVALID_PARAMETER}, {invalidW, 0, FALSE, OPEN_ALWAYS, ERROR_INVALID_PARAMETER, ERROR_FILE_NOT_FOUND},
{invalidW, GENERIC_READ | GENERIC_WRITE, FALSE, 0, ERROR_INVALID_PARAMETER}, {invalidW, GENERIC_READ | GENERIC_WRITE, FALSE, 0, ERROR_INVALID_PARAMETER, ERROR_FILE_NOT_FOUND},
{invalidW, GENERIC_READ | GENERIC_WRITE, FALSE, OPEN_ALWAYS, ERROR_INVALID_PARAMETER}, {invalidW, GENERIC_READ | GENERIC_WRITE, FALSE, OPEN_ALWAYS, ERROR_INVALID_PARAMETER, ERROR_FILE_NOT_FOUND},
{invalidW, GENERIC_READ | GENERIC_WRITE, FALSE, OPEN_EXISTING, ERROR_INVALID_PARAMETER}, {invalidW, GENERIC_READ | GENERIC_WRITE, FALSE, OPEN_EXISTING, ERROR_INVALID_PARAMETER, ERROR_FILE_NOT_FOUND},
{coninW, 0, FALSE, 0, ERROR_SHARING_VIOLATION}, {coninW, 0, FALSE, 0, ERROR_SHARING_VIOLATION, 0},
{coninW, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, ERROR_INVALID_PARAMETER}, {coninW, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, ERROR_INVALID_PARAMETER, 0},
{coninW, 0, FALSE, OPEN_ALWAYS, ERROR_INVALID_PARAMETER}, {coninW, 0, FALSE, OPEN_ALWAYS, ERROR_INVALID_PARAMETER, 0},
{coninW, GENERIC_READ | GENERIC_WRITE, FALSE, 0, ERROR_SHARING_VIOLATION}, {coninW, GENERIC_READ | GENERIC_WRITE, FALSE, 0, ERROR_SHARING_VIOLATION, 0},
{coninW, GENERIC_READ | GENERIC_WRITE, FALSE, CREATE_NEW, ERROR_SHARING_VIOLATION}, {coninW, GENERIC_READ | GENERIC_WRITE, FALSE, CREATE_NEW, ERROR_SHARING_VIOLATION, 0},
{coninW, GENERIC_READ | GENERIC_WRITE, FALSE, CREATE_ALWAYS, ERROR_SHARING_VIOLATION}, {coninW, GENERIC_READ | GENERIC_WRITE, FALSE, CREATE_ALWAYS, ERROR_SHARING_VIOLATION, 0},
{coninW, GENERIC_READ | GENERIC_WRITE, FALSE, OPEN_ALWAYS, ERROR_INVALID_PARAMETER}, {coninW, GENERIC_READ | GENERIC_WRITE, FALSE, OPEN_ALWAYS, ERROR_INVALID_PARAMETER, 0},
{coninW, GENERIC_READ | GENERIC_WRITE, FALSE, TRUNCATE_EXISTING, ERROR_INVALID_PARAMETER}, {coninW, GENERIC_READ | GENERIC_WRITE, FALSE, TRUNCATE_EXISTING, ERROR_INVALID_PARAMETER, 0},
{conoutW, 0, FALSE, 0, ERROR_SHARING_VIOLATION}, {conoutW, 0, FALSE, 0, ERROR_SHARING_VIOLATION, 0},
{conoutW, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, ERROR_INVALID_PARAMETER}, {conoutW, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, ERROR_INVALID_PARAMETER, 0},
{conoutW, 0, FALSE, OPEN_ALWAYS, ERROR_INVALID_PARAMETER}, {conoutW, 0, FALSE, OPEN_ALWAYS, ERROR_INVALID_PARAMETER, 0},
{conoutW, GENERIC_READ | GENERIC_WRITE, FALSE, 0, ERROR_SHARING_VIOLATION}, {conoutW, GENERIC_READ | GENERIC_WRITE, FALSE, 0, ERROR_SHARING_VIOLATION, 0},
{conoutW, GENERIC_READ | GENERIC_WRITE, FALSE, CREATE_NEW, ERROR_SHARING_VIOLATION}, {conoutW, GENERIC_READ | GENERIC_WRITE, FALSE, CREATE_NEW, ERROR_SHARING_VIOLATION, 0},
{conoutW, GENERIC_READ | GENERIC_WRITE, FALSE, CREATE_ALWAYS, ERROR_SHARING_VIOLATION}, {conoutW, GENERIC_READ | GENERIC_WRITE, FALSE, CREATE_ALWAYS, ERROR_SHARING_VIOLATION, 0},
{conoutW, GENERIC_READ | GENERIC_WRITE, FALSE, OPEN_ALWAYS, ERROR_INVALID_PARAMETER}, {conoutW, GENERIC_READ | GENERIC_WRITE, FALSE, OPEN_ALWAYS, ERROR_INVALID_PARAMETER, 0},
{conoutW, GENERIC_READ | GENERIC_WRITE, FALSE, TRUNCATE_EXISTING, ERROR_INVALID_PARAMETER}, {conoutW, GENERIC_READ | GENERIC_WRITE, FALSE, TRUNCATE_EXISTING, ERROR_INVALID_PARAMETER, 0},
}; };
int index; int index;
...@@ -1110,12 +1111,13 @@ static void test_OpenConsoleW(void) ...@@ -1110,12 +1111,13 @@ static void test_OpenConsoleW(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = pOpenConsoleW(invalid_table[index].name, invalid_table[index].access, ret = pOpenConsoleW(invalid_table[index].name, invalid_table[index].access,
invalid_table[index].inherit, invalid_table[index].creation); invalid_table[index].inherit, invalid_table[index].creation);
gle = GetLastError();
ok(ret == INVALID_HANDLE_VALUE, ok(ret == INVALID_HANDLE_VALUE,
"Expected OpenConsoleW to return INVALID_HANDLE_VALUE for index %d, got %p\n", "Expected OpenConsoleW to return INVALID_HANDLE_VALUE for index %d, got %p\n",
index, ret); index, ret);
ok(GetLastError() == invalid_table[index].gle, ok(gle == invalid_table[index].gle || (gle != 0 && gle == invalid_table[index].gle2),
"Expected GetLastError() to return %u for index %d, got %u\n", "Expected GetLastError() to return %u/%u for index %d, got %u\n",
invalid_table[index].gle, index, GetLastError()); invalid_table[index].gle, invalid_table[index].gle2, index, gle);
} }
/* OpenConsoleW should not touch the last error on success. */ /* OpenConsoleW should not touch the last error on success. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment