Commit 8e29fcdd authored by Bruno Jesus's avatar Bruno Jesus Committed by Alexandre Julliard

ws2_32: Use the struct information when the parameters are zero in WSASocket.

parent bffc240b
......@@ -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) ||
......
......@@ -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());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment