Zebediah Figura : ws2_32/tests: Verify that AFD_POLL_CONNECT and AFD_POLL_WRITE are signaled simultaneously.

Alexandre Julliard julliard at winehq.org
Tue May 3 15:39:26 CDT 2022


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

Author: Zebediah Figura <zfigura at codeweavers.com>
Date:   Thu Apr 28 22:02:30 2022 -0500

ws2_32/tests: Verify that AFD_POLL_CONNECT and AFD_POLL_WRITE are signaled simultaneously.

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

---

 dlls/ws2_32/tests/afd.c | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/dlls/ws2_32/tests/afd.c b/dlls/ws2_32/tests/afd.c
index 5152469f02f..43c401c940a 100644
--- a/dlls/ws2_32/tests/afd.c
+++ b/dlls/ws2_32/tests/afd.c
@@ -724,7 +724,42 @@ static void test_poll(void)
     ok(out_params->sockets[0].flags == AFD_POLL_ACCEPT, "got flags %#x\n", out_params->sockets[0].flags);
     ok(!out_params->sockets[0].status, "got status %#x\n", out_params->sockets[0].status);
 
+    server = accept(listener, NULL, NULL);
+    ok(server != -1, "got error %u\n", WSAGetLastError());
+    closesocket(server);
     closesocket(client);
+
+    /* Verify that CONNECT and WRITE are signaled simultaneously. */
+
+    client = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
+
+    in_params->timeout = -1000 * 10000;
+    in_params->count = 1;
+    in_params->sockets[0].socket = client;
+    in_params->sockets[0].flags = ~0;
+    params_size = offsetof(struct afd_poll_params, sockets[1]);
+
+    ret = NtDeviceIoControlFile((HANDLE)client, event, NULL, NULL, &io,
+            IOCTL_AFD_POLL, in_params, params_size, out_params, params_size);
+    ok(ret == STATUS_PENDING, "got %#x\n", ret);
+
+    ret = connect(client, (struct sockaddr *)&addr, sizeof(addr));
+    ok(!ret, "got error %u\n", WSAGetLastError());
+
+    ret = WaitForSingleObject(event, 200);
+    ok(!ret, "got %#x\n", ret);
+    ok(!io.Status, "got %#lx\n", io.Status);
+    ok(io.Information == offsetof(struct afd_poll_params, sockets[1]), "got %#Ix\n", io.Information);
+    ok(out_params->count == 1, "got count %u\n", out_params->count);
+    ok(out_params->sockets[0].flags == (AFD_POLL_CONNECT | AFD_POLL_WRITE),
+            "got flags %#x\n", out_params->sockets[0].flags);
+    ok(!out_params->sockets[0].status, "got status %#x\n", out_params->sockets[0].status);
+
+    server = accept(listener, NULL, NULL);
+    ok(server != -1, "got error %u\n", WSAGetLastError());
+    closesocket(server);
+    closesocket(client);
+
     closesocket(listener);
 
     /* Test UDP sockets. */




More information about the wine-cvs mailing list