From: "Erich E. Hoover" Subject: [PATCH 1/5] ws2_32/tests: Fix cleanup for first IOCP duplicated handle test (resend). Message-Id: Date: Thu, 3 May 2012 16:50:05 -0600 Real Name: Erich Hoover Description: This patch fixes an issue with one of the AcceptEX IOCP duplicated handle tests spilling an IOCP packet over into the next test. With the attached fix it then becomes clear that the destroyed handle doesn't make a difference, both handles must be destroyed for the ERROR_OPERATION_ABORTED completion to be queued. Changelog: ws2_32/tests: Fix cleanup for first IOCP duplicated handle test. From f66bef44176627f238557137aa0f9c16b6ab4ffd Mon Sep 17 00:00:00 2001 From: Erich Hoover Date: Thu, 3 May 2012 16:32:34 -0600 Subject: ws2_32/tests: Fix cleanup for first IOCP duplicated handle test. --- dlls/ws2_32/tests/sock.c | 37 ++++++++++++++++++++++++++++--------- 1 files changed, 28 insertions(+), 9 deletions(-) diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c index b71be34..e9814e3 100644 --- a/dlls/ws2_32/tests/sock.c +++ b/dlls/ws2_32/tests/sock.c @@ -5585,12 +5585,34 @@ static void test_completion_port(void) ok(num_bytes == 0xdeadbeef, "Number of bytes transferred is %u\n", num_bytes); ok(!olp, "Overlapped structure is at %p\n", olp); - closesocket(src); src = INVALID_SOCKET; closesocket(dup); dup = INVALID_SOCKET; + SetLastError(0xdeadbeef); + key = 0xdeadbeef; + num_bytes = 0xdeadbeef; + olp = (WSAOVERLAPPED *)0xdeadbeef; + bret = GetQueuedCompletionStatus(io_port, &num_bytes, &key, &olp, 100); + ok(bret == FALSE, "failed to get completion status %u\n", bret); + todo_wine ok(GetLastError() == ERROR_OPERATION_ABORTED, "Last error was %d\n", GetLastError()); + todo_wine ok(key == 125, "Key is %lu\n", key); + todo_wine ok(num_bytes == 0, "Number of bytes transferred is %u\n", num_bytes); + todo_wine ok(olp == &ov, "Overlapped structure is at %p\n", olp); + todo_wine ok(olp && olp->Internal == (ULONG)STATUS_CANCELLED, "Internal status is %lx\n", olp ? olp->Internal : 0); + + SetLastError(0xdeadbeef); + key = 0xdeadbeef; + num_bytes = 0xdeadbeef; + olp = (WSAOVERLAPPED *)0xdeadbeef; + bret = GetQueuedCompletionStatus( io_port, &num_bytes, &key, &olp, 200 ); + ok(bret == FALSE, "failed to get completion status %u\n", bret); + ok(GetLastError() == WAIT_TIMEOUT, "Last error was %d\n", GetLastError()); + ok(key == 0xdeadbeef, "Key is %lu\n", key); + ok(num_bytes == 0xdeadbeef, "Number of bytes transferred is %u\n", num_bytes); + ok(!olp, "Overlapped structure is at %p\n", olp); + /* Test IOCP with duplicated handle (closing duplicated handle) */ if ((src = setup_iocp_src(&bindAddress)) == INVALID_SOCKET) @@ -5618,15 +5640,12 @@ static void test_completion_port(void) key = 0xdeadbeef; num_bytes = 0xdeadbeef; olp = (WSAOVERLAPPED *)0xdeadbeef; - - bret = GetQueuedCompletionStatus(io_port, &num_bytes, &key, &olp, 100); + bret = GetQueuedCompletionStatus( io_port, &num_bytes, &key, &olp, 200 ); ok(bret == FALSE, "failed to get completion status %u\n", bret); - todo_wine ok(GetLastError() == ERROR_OPERATION_ABORTED, "Last error was %d\n", GetLastError()); - todo_wine ok(key == 125, "Key is %lu\n", key); - todo_wine ok(num_bytes == 0, "Number of bytes transferred is %u\n", num_bytes); - todo_wine ok(olp == &ov, "Overlapped structure is at %p\n", olp); - todo_wine ok(olp && (broken(olp->Internal == (ULONG)STATUS_PENDING) || (olp->Internal == (ULONG)STATUS_CANCELLED)), - "Internal status is %lx\n", olp ? olp->Internal : 0); + ok(GetLastError() == WAIT_TIMEOUT, "Last error was %d\n", GetLastError()); + ok(key == 0xdeadbeef, "Key is %lu\n", key); + ok(num_bytes == 0xdeadbeef, "Number of bytes transferred is %u\n", num_bytes); + ok(!olp, "Overlapped structure is at %p\n", olp); SetLastError(0xdeadbeef); key = 0xdeadbeef; -- 1.7.5.4