[PATCH 6/6] ws2_32: Return WSAEFAULT instead of WSAEINVAL from WSAStartup() if "data" is NULL.

Zebediah Figura zfigura at codeweavers.com
Tue Feb 1 00:20:51 CST 2022


Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
 dlls/ws2_32/socket.c         | 2 +-
 dlls/ws2_32/tests/protocol.c | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 7a1483f140f..a75aaee68be 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -594,7 +594,7 @@ int WINAPI WSAStartup( WORD version, WSADATA *data )
     if (!LOBYTE(version))
         return WSAVERNOTSUPPORTED;
 
-    if (!data) return WSAEINVAL;
+    if (!data) return WSAEFAULT;
 
     num_startup++;
     TRACE( "increasing startup count to %d\n", num_startup );
diff --git a/dlls/ws2_32/tests/protocol.c b/dlls/ws2_32/tests/protocol.c
index 8b429e5c914..1ff335f7fe2 100644
--- a/dlls/ws2_32/tests/protocol.c
+++ b/dlls/ws2_32/tests/protocol.c
@@ -2880,8 +2880,7 @@ static void test_startup(void)
         ok(WSAGetLastError() == WSANOTINITIALISED, "got error %u\n", WSAGetLastError());
 
         ret = WSAStartup(tests[i].version, NULL);
-        todo_wine_if (LOBYTE(tests[i].version))
-            ok(ret == (LOBYTE(tests[i].version) ? WSAEFAULT : WSAVERNOTSUPPORTED), "got %d\n", ret);
+        ok(ret == (LOBYTE(tests[i].version) ? WSAEFAULT : WSAVERNOTSUPPORTED), "got %d\n", ret);
 
         winetest_pop_context();
     }
-- 
2.34.1




More information about the wine-devel mailing list