Zebediah Figura : ws2_32/tests: Test that sockets returned from accept() don't return FD_CONNECT from WSAEnumNetworkEvents().

Alexandre Julliard julliard at winehq.org
Wed May 4 16:14:45 CDT 2022


Module: wine
Branch: master
Commit: a321a6721704183ff4495bb01545a3068c68f514
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=a321a6721704183ff4495bb01545a3068c68f514

Author: Zebediah Figura <zfigura at codeweavers.com>
Date:   Tue May  3 17:56:24 2022 -0500

ws2_32/tests: Test that sockets returned from accept() don't return FD_CONNECT from WSAEnumNetworkEvents().

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ws2_32/tests/afd.c  | 12 ++++++++++++
 dlls/ws2_32/tests/sock.c |  3 +++
 2 files changed, 15 insertions(+)

diff --git a/dlls/ws2_32/tests/afd.c b/dlls/ws2_32/tests/afd.c
index 43c401c940a..184c7e0725a 100644
--- a/dlls/ws2_32/tests/afd.c
+++ b/dlls/ws2_32/tests/afd.c
@@ -1819,6 +1819,18 @@ static void test_get_events(void)
     ok(!ret, "got error %lu\n", GetLastError());
     ok(!events.lNetworkEvents, "got events %#lx\n", events.lNetworkEvents);
 
+    ret = WSAEventSelect(server, event, FD_ACCEPT | FD_CLOSE | FD_CONNECT | FD_OOB | FD_READ | FD_WRITE);
+    ok(!ret, "got error %lu\n", GetLastError());
+
+    memset(&params, 0xcc, sizeof(params));
+    memset(&io, 0xcc, sizeof(io));
+    ret = NtDeviceIoControlFile((HANDLE)server, NULL, NULL, NULL, &io,
+            IOCTL_AFD_GET_EVENTS, NULL, 0, &params, sizeof(params));
+    ok(!ret, "got %#x\n", ret);
+    ok(params.flags == AFD_POLL_WRITE, "got flags %#x\n", params.flags);
+    for (i = 0; i < ARRAY_SIZE(params.status); ++i)
+        ok(!params.status[i], "got status[%u] %#x\n", i, params.status[i]);
+
     closesocket(client);
     closesocket(server);
 
diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c
index f17b4bb0ffa..5b3cc75f18c 100644
--- a/dlls/ws2_32/tests/sock.c
+++ b/dlls/ws2_32/tests/sock.c
@@ -5599,6 +5599,9 @@ static void test_connect_events(struct event_test_ctx *ctx)
     server = accept(listener, NULL, NULL);
     ok(server != -1, "failed to accept, error %u\n", WSAGetLastError());
 
+    select_events(ctx, server, FD_ACCEPT | FD_CONNECT | FD_OOB | FD_READ | FD_WRITE);
+    check_events(ctx, FD_WRITE, 0, 200);
+
     closesocket(client);
     closesocket(server);
 




More information about the wine-cvs mailing list