Aric Stewart : ws2_32: Return proper WSAENOBUFS error when enuming protocols.

Alexandre Julliard julliard at winehq.org
Fri Oct 19 08:35:39 CDT 2007


Module: wine
Branch: master
Commit: 6c824e8b89dfe3fd55a6046965bd3d3a243b13cd
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=6c824e8b89dfe3fd55a6046965bd3d3a243b13cd

Author: Aric Stewart <aric at codeweavers.com>
Date:   Thu Oct 18 08:40:13 2007 -0500

ws2_32: Return proper WSAENOBUFS error when enuming protocols.

---

 dlls/ws2_32/protocol.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/dlls/ws2_32/protocol.c b/dlls/ws2_32/protocol.c
index 2f71d32..7cccecb 100644
--- a/dlls/ws2_32/protocol.c
+++ b/dlls/ws2_32/protocol.c
@@ -301,18 +301,16 @@ INT WINAPI WSAEnumProtocolsA( LPINT protocols, LPWSAPROTOCOL_INFOA buffer, LPDWO
     DWORD size = 0;
     INT local[] = { WS_IPPROTO_TCP, WS_IPPROTO_UDP, NSPROTO_IPX, NSPROTO_SPX, NSPROTO_SPXII, 0 };
 
-    if (!buffer)
-        return SOCKET_ERROR;
-
     if (!protocols) protocols = local;
 
     while (protocols[i]) i++;
 
     size = i * sizeof(WSAPROTOCOL_INFOA);
 
-    if (*len < size)
+    if (*len < size || !buffer)
     {
         *len = size;
+        WSASetLastError(WSAENOBUFS);
         return SOCKET_ERROR;
     }
 
@@ -367,18 +365,16 @@ INT WINAPI WSAEnumProtocolsW( LPINT protocols, LPWSAPROTOCOL_INFOW buffer, LPDWO
     DWORD size = 0;
     INT local[] = { WS_IPPROTO_TCP, WS_IPPROTO_UDP, NSPROTO_IPX, NSPROTO_SPX, NSPROTO_SPXII, 0 };
 
-    if (!buffer)
-        return SOCKET_ERROR;
-
     if (!protocols) protocols = local;
 
     while (protocols[i]) i++;
 
     size = i * sizeof(WSAPROTOCOL_INFOW);
 
-    if (*len < size)
+    if (*len < size || !buffer)
     {
         *len = size;
+        WSASetLastError(WSAENOBUFS);
         return SOCKET_ERROR;
     }
 




More information about the wine-cvs mailing list