Bruno Jesus : ws2_32: Use the struct information when the parameters are zero in WSASocket.
Alexandre Julliard
julliard at winehq.org
Tue Sep 17 15:25:54 CDT 2013
Module: wine
Branch: master
Commit: 8e29fcddb92b5a37092f74c388072f8196db3649
URL: http://source.winehq.org/git/wine.git/?a=commit;h=8e29fcddb92b5a37092f74c388072f8196db3649
Author: Bruno Jesus <00cpxxx at gmail.com>
Date: Tue Sep 17 10:00:24 2013 -0300
ws2_32: Use the struct information when the parameters are zero in WSASocket.
---
dlls/ws2_32/socket.c | 14 +++++++-------
dlls/ws2_32/tests/sock.c | 3 +--
2 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 4750656..30c3c6c 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -5884,20 +5884,20 @@ SOCKET WINAPI WSASocketW(int af, int type, int protocol,
return ret;
}
- /* convert the socket family and type */
- af = convert_af_w2u(af);
- type = convert_socktype_w2u(type);
-
if (lpProtocolInfo)
{
- if (af == FROM_PROTOCOL_INFO)
+ if (af == FROM_PROTOCOL_INFO || !af)
af = lpProtocolInfo->iAddressFamily;
- if (type == FROM_PROTOCOL_INFO)
+ if (type == FROM_PROTOCOL_INFO || !type)
type = lpProtocolInfo->iSocketType;
- if (protocol == FROM_PROTOCOL_INFO)
+ if (protocol == FROM_PROTOCOL_INFO || !protocol)
protocol = lpProtocolInfo->iProtocol;
}
+ /* convert the socket family and type */
+ af = convert_af_w2u(af);
+ type = convert_socktype_w2u(type);
+
if ( af == AF_UNSPEC) /* did they not specify the address family? */
{
if ((protocol == IPPROTO_TCP && type == SOCK_STREAM) ||
diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c
index 70269b4..1f18869 100644
--- a/dlls/ws2_32/tests/sock.c
+++ b/dlls/ws2_32/tests/sock.c
@@ -1946,7 +1946,6 @@ todo_wine
pi[0].iSocketType = SOCK_DGRAM;
pi[0].iAddressFamily = AF_INET;
sock = WSASocketA(0, 0, 0, &pi[0], 0, 0);
-todo_wine {
ok(sock != INVALID_SOCKET, "Failed to create socket: %d\n",
WSAGetLastError());
size = sizeof(socktype);
@@ -1956,7 +1955,7 @@ todo_wine {
ok(socktype == SOCK_DGRAM, "Wrong socket type, expected %d received %d\n",
SOCK_DGRAM, socktype);
closesocket(sock);
-}
+
sock = WSASocketA(AF_INET, SOCK_STREAM, IPPROTO_TCP, &pi[0], 0, 0);
ok(sock != INVALID_SOCKET, "Failed to create socket: %d\n",
WSAGetLastError());
More information about the wine-cvs
mailing list