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

oldstable
Bruno Jesus 2013-09-17 10:00:24 -03:00 committed by Alexandre Julliard
parent bffc240b4e
commit 8e29fcddb9
2 changed files with 11 additions and 12 deletions

View File

@ -5884,20 +5884,20 @@ SOCKET WINAPI WSASocketW(int af, int type, int protocol,
return ret;
}
if (lpProtocolInfo)
{
if (af == FROM_PROTOCOL_INFO || !af)
af = lpProtocolInfo->iAddressFamily;
if (type == FROM_PROTOCOL_INFO || !type)
type = lpProtocolInfo->iSocketType;
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 (lpProtocolInfo)
{
if (af == FROM_PROTOCOL_INFO)
af = lpProtocolInfo->iAddressFamily;
if (type == FROM_PROTOCOL_INFO)
type = lpProtocolInfo->iSocketType;
if (protocol == FROM_PROTOCOL_INFO)
protocol = lpProtocolInfo->iProtocol;
}
if ( af == AF_UNSPEC) /* did they not specify the address family? */
{
if ((protocol == IPPROTO_TCP && type == SOCK_STREAM) ||

View File

@ -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());