Zebediah Figura : ws2_32: Return 32767 or 0 in the iMaxSockets field.

Alexandre Julliard julliard at winehq.org
Tue Feb 1 15:21:34 CST 2022


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

Author: Zebediah Figura <zfigura at codeweavers.com>
Date:   Tue Feb  1 00:20:49 2022 -0600

ws2_32: Return 32767 or 0 in the iMaxSockets field.

Depending on reported winsock version.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50352
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

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

diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 565f1c89dc0..19a7d901414 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -419,7 +419,6 @@ static BOOL socket_list_remove( SOCKET socket )
     return FALSE;
 }
 
-#define MAX_SOCKETS_PER_PROCESS      128     /* reasonable guess */
 #define MAX_UDP_DATAGRAM             1024
 static INT WINAPI WSA_DefaultBlockingHook( FARPROC x );
 
@@ -588,7 +587,7 @@ int WINAPI WSAStartup( WORD version, WSADATA *data )
         data->wHighVersion = MAKEWORD(2, 2);
         strcpy( data->szDescription, "WinSock 2.0" );
         strcpy( data->szSystemStatus, "Running" );
-        data->iMaxSockets = MAX_SOCKETS_PER_PROCESS;
+        data->iMaxSockets = (LOBYTE(version) == 1 ? 32767 : 0);
         data->iMaxUdpDg = MAX_UDP_DATAGRAM;
         /* don't fill lpVendorInfo */
     }
diff --git a/dlls/ws2_32/tests/protocol.c b/dlls/ws2_32/tests/protocol.c
index db89febff2e..a95b6e685af 100644
--- a/dlls/ws2_32/tests/protocol.c
+++ b/dlls/ws2_32/tests/protocol.c
@@ -2871,7 +2871,7 @@ static void test_startup(void)
         ok(data.wHighVersion == 0x202, "got maximum version %#x\n", data.wHighVersion);
         ok(!strcmp(data.szDescription, "WinSock 2.0"), "got description %s\n", debugstr_a(data.szDescription));
         ok(!strcmp(data.szSystemStatus, "Running"), "got status %s\n", debugstr_a(data.szSystemStatus));
-        todo_wine ok(data.iMaxSockets == (LOBYTE(tests[i].version) == 1 ? 32767 : 0), "got maximum sockets %u\n", data.iMaxSockets);
+        ok(data.iMaxSockets == (LOBYTE(tests[i].version) == 1 ? 32767 : 0), "got maximum sockets %u\n", data.iMaxSockets);
         todo_wine ok(data.iMaxUdpDg == (LOBYTE(tests[i].version) == 1 ? 65467 : 0), "got maximum datagram size %u\n", data.iMaxUdpDg);
 
         WSASetLastError(0xdeadbeef);




More information about the wine-cvs mailing list