Zebediah Figura : ws2_32: Only set error codes for triggered events in WSAEnumNetworkEvents().

Alexandre Julliard julliard at winehq.org
Tue Feb 20 16:44:52 CST 2018


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

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Mon Feb 19 16:10:39 2018 -0600

ws2_32: Only set error codes for triggered events in WSAEnumNetworkEvents().

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ws2_32/socket.c     | 5 ++++-
 dlls/ws2_32/tests/sock.c | 3 +--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 79b9333..e39901d 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -7218,7 +7218,10 @@ int WINAPI WSAEnumNetworkEvents(SOCKET s, WSAEVENT hEvent, LPWSANETWORKEVENTS lp
     if (!ret)
     {
         for (i = 0; i < FD_MAX_EVENTS; i++)
-            lpEvent->iErrorCode[i] = NtStatusToWSAError(errors[i]);
+        {
+            if (lpEvent->lNetworkEvents & (1 << i))
+                lpEvent->iErrorCode[i] = NtStatusToWSAError(errors[i]);
+        }
         return 0;
     }
     SetLastError(WSAEINVAL);
diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c
index 17b59a4..7c55c21 100644
--- a/dlls/ws2_32/tests/sock.c
+++ b/dlls/ws2_32/tests/sock.c
@@ -2995,7 +2995,7 @@ static void test_WSAEnumNetworkEvents(void)
                 }
                 for (k = 0; k < FD_MAX_EVENTS; k++)
                 {
-                    if (i >= 1 && j == 0 && k == 1) /* first UDP and connected TCP test, FD_WRITE bit no error*/
+                    if (net_events.lNetworkEvents & (1 << k))
                     {
                         ok (net_events.iErrorCode[k] == 0x0, "Test[%d][%d]: expected 0x0, got 0x%x\n",
                             i, k, net_events.iErrorCode[k]);
@@ -3003,7 +3003,6 @@ static void test_WSAEnumNetworkEvents(void)
                     else
                     {
                         /* Bits that are not set in lNetworkEvents MUST not be changed */
-                        todo_wine
                         ok (net_events.iErrorCode[k] == 0xABABABAB, "Test[%d][%d]: expected 0xABABABAB, got 0x%x\n",
                             i, k, net_events.iErrorCode[k]);
                     }




More information about the wine-cvs mailing list