Commit 297b054e authored by Peter Oberndorfer's avatar Peter Oberndorfer Committed by Alexandre Julliard

kernel32: VerifyConsoleIoHandle does not set last error value.

parent f30b7089
......@@ -441,7 +441,7 @@ BOOL WINAPI VerifyConsoleIoHandle(HANDLE handle)
SERVER_START_REQ(get_console_mode)
{
req->handle = console_handle_unmap(handle);
ret = !wine_server_call_err( req );
ret = !wine_server_call( req );
}
SERVER_END_REQ;
return ret;
......
......@@ -27,6 +27,7 @@ static BOOL (WINAPI *pGetConsoleInputExeNameA)(DWORD, LPSTR);
static DWORD (WINAPI *pGetConsoleProcessList)(LPDWORD, DWORD);
static HANDLE (WINAPI *pOpenConsoleW)(LPCWSTR,DWORD,BOOL,DWORD);
static BOOL (WINAPI *pSetConsoleInputExeNameA)(LPCSTR);
static BOOL (WINAPI *pVerifyConsoleIoHandle)(HANDLE handle);
/* DEFAULT_ATTRIB is used for all initial filling of the console.
* all modifications are made with TEST_ATTRIB so that we could check
......@@ -68,6 +69,7 @@ static void init_function_pointers(void)
KERNEL32_GET_PROC(GetConsoleProcessList);
KERNEL32_GET_PROC(OpenConsoleW);
KERNEL32_GET_PROC(SetConsoleInputExeNameA);
KERNEL32_GET_PROC(VerifyConsoleIoHandle);
#undef KERNEL32_GET_PROC
}
......@@ -1083,6 +1085,56 @@ static void test_OpenConsoleW(void)
CloseHandle(ret);
}
static void test_VerifyConsoleIoHandle(void)
{
BOOL ret;
DWORD error;
HANDLE handle;
if (!pVerifyConsoleIoHandle)
{
win_skip("VerifyConsoleIoHandle is not available\n");
return;
}
/* invalid handle */
SetLastError(0xdeadbeef);
ret = pVerifyConsoleIoHandle((HANDLE)0xdeadbee0);
error = GetLastError();
ok(!ret, "expected VerifyConsoleIoHandle to fail\n");
ok(error == 0xdeadbeef, "wrong GetLastError() %d\n", error);
/* invalid handle + 1 */
SetLastError(0xdeadbeef);
ret = pVerifyConsoleIoHandle((HANDLE)0xdeadbee1);
error = GetLastError();
ok(!ret, "expected VerifyConsoleIoHandle to fail\n");
ok(error == 0xdeadbeef, "wrong GetLastError() %d\n", error);
/* invalid handle + 2 */
SetLastError(0xdeadbeef);
ret = pVerifyConsoleIoHandle((HANDLE)0xdeadbee2);
error = GetLastError();
ok(!ret, "expected VerifyConsoleIoHandle to fail\n");
ok(error == 0xdeadbeef, "wrong GetLastError() %d\n", error);
/* invalid handle + 3 */
SetLastError(0xdeadbeef);
ret = pVerifyConsoleIoHandle((HANDLE)0xdeadbee3);
error = GetLastError();
ok(!ret, "expected VerifyConsoleIoHandle to fail\n");
ok(error == 0xdeadbeef, "wrong GetLastError() %d\n", error);
handle = GetStdHandle(STD_INPUT_HANDLE);
/* valid handle */
SetLastError(0xdeadbeef);
ret = pVerifyConsoleIoHandle(handle);
error = GetLastError();
ok(ret, "expected VerifyConsoleIoHandle to succeed\n");
ok(error == 0xdeadbeef, "wrong GetLastError() %d\n", error);
}
START_TEST(console)
{
HANDLE hConIn, hConOut;
......@@ -1134,4 +1186,5 @@ START_TEST(console)
test_GetConsoleProcessList();
test_OpenConsoleW();
test_VerifyConsoleIoHandle();
}
......@@ -1000,7 +1000,7 @@ static void test_WaitForSingleObject(void)
SetLastError(0xdeadbeef);
ret = WaitForSingleObject(modify_handle(nonsignaled, 3), 0);
ok(ret == WAIT_TIMEOUT, "expected WAIT_TIMEOUT, got %d\n", ret);
todo_wine ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %d\n", GetLastError());
ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %d\n", GetLastError());
/* valid handle with different values for lower 2 bits */
SetLastError(0xdeadbeef);
......@@ -1021,7 +1021,7 @@ static void test_WaitForSingleObject(void)
SetLastError(0xdeadbeef);
ret = WaitForSingleObject(modify_handle(signaled, 3), 0);
ok(ret == WAIT_OBJECT_0, "expected WAIT_OBJECT_0, got %d\n", ret);
todo_wine ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %d\n", GetLastError());
ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %d\n", GetLastError());
CloseHandle(signaled);
CloseHandle(nonsignaled);
......
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