server: Return a WSA error code in create_socket.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
4383a9d536
commit
424a379f64
|
@ -7619,7 +7619,7 @@ SOCKET WINAPI WSASocketW(int af, int type, int protocol,
|
|||
req->access = GENERIC_READ|GENERIC_WRITE|SYNCHRONIZE;
|
||||
req->attributes = (dwFlags & WSA_FLAG_NO_HANDLE_INHERIT) ? 0 : OBJ_INHERIT;
|
||||
req->flags = dwFlags & ~WSA_FLAG_NO_HANDLE_INHERIT;
|
||||
set_error( wine_server_call( req ) );
|
||||
err = NtStatusToWSAError( wine_server_call( req ) );
|
||||
ret = HANDLE2SOCKET( wine_server_ptr_handle( reply->handle ));
|
||||
}
|
||||
SERVER_END_REQ;
|
||||
|
@ -7655,7 +7655,6 @@ SOCKET WINAPI WSASocketW(int af, int type, int protocol,
|
|||
return ret;
|
||||
}
|
||||
|
||||
err = GetLastError();
|
||||
if (err == WSAEACCES) /* raw socket denied */
|
||||
{
|
||||
if (type == SOCK_RAW)
|
||||
|
@ -7663,14 +7662,6 @@ SOCKET WINAPI WSASocketW(int af, int type, int protocol,
|
|||
else
|
||||
ERR_(winediag)("Failed to create socket, this requires special permissions.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
/* invalid combination of valid parameters, like SOCK_STREAM + IPPROTO_UDP */
|
||||
if (err == WSAEINVAL)
|
||||
err = WSAESOCKTNOSUPPORT;
|
||||
else if (err == WSAEOPNOTSUPP)
|
||||
err = WSAEPROTONOSUPPORT;
|
||||
}
|
||||
|
||||
done:
|
||||
WARN("\t\tfailed, error %d!\n", err);
|
||||
|
|
|
@ -2773,7 +2773,6 @@ static void test_WSASocket(void)
|
|||
if (sock == INVALID_SOCKET)
|
||||
{
|
||||
err = WSAGetLastError();
|
||||
todo_wine
|
||||
ok(err == WSAEAFNOSUPPORT || broken(err == WSAEPROTONOSUPPORT), "Expected 10047, received %d\n", err);
|
||||
skip("IPX is not supported\n");
|
||||
}
|
||||
|
|
|
@ -661,11 +661,10 @@ static struct object *create_socket( int family, int type, int protocol, unsigne
|
|||
int sockfd;
|
||||
|
||||
sockfd = socket( family, type, protocol );
|
||||
if (debug_level)
|
||||
fprintf(stderr,"socket(%d,%d,%d)=%d\n",family,type,protocol,sockfd);
|
||||
if (sockfd == -1)
|
||||
{
|
||||
sock_set_error();
|
||||
if (errno == EINVAL) set_win32_error( WSAESOCKTNOSUPPORT );
|
||||
else set_win32_error( sock_get_error( errno ));
|
||||
return NULL;
|
||||
}
|
||||
fcntl(sockfd, F_SETFL, O_NONBLOCK); /* make socket nonblocking */
|
||||
|
|
|
@ -5549,6 +5549,49 @@ static const struct
|
|||
{ "USER_MAPPED_FILE", STATUS_USER_MAPPED_FILE },
|
||||
{ "VOLUME_DISMOUNTED", STATUS_VOLUME_DISMOUNTED },
|
||||
{ "WAS_LOCKED", STATUS_WAS_LOCKED },
|
||||
{ "WSAEACCES", 0xc0010000 | WSAEACCES },
|
||||
{ "WSAEADDRINUSE", 0xc0010000 | WSAEADDRINUSE },
|
||||
{ "WSAEADDRNOTAVAIL", 0xc0010000 | WSAEADDRNOTAVAIL },
|
||||
{ "WSAEAFNOSUPPORT", 0xc0010000 | WSAEAFNOSUPPORT },
|
||||
{ "WSAEALREADY", 0xc0010000 | WSAEALREADY },
|
||||
{ "WSAEBADF", 0xc0010000 | WSAEBADF },
|
||||
{ "WSAECONNABORTED", 0xc0010000 | WSAECONNABORTED },
|
||||
{ "WSAECONNREFUSED", 0xc0010000 | WSAECONNREFUSED },
|
||||
{ "WSAECONNRESET", 0xc0010000 | WSAECONNRESET },
|
||||
{ "WSAEDESTADDRREQ", 0xc0010000 | WSAEDESTADDRREQ },
|
||||
{ "WSAEDQUOT", 0xc0010000 | WSAEDQUOT },
|
||||
{ "WSAEFAULT", 0xc0010000 | WSAEFAULT },
|
||||
{ "WSAEHOSTDOWN", 0xc0010000 | WSAEHOSTDOWN },
|
||||
{ "WSAEHOSTUNREACH", 0xc0010000 | WSAEHOSTUNREACH },
|
||||
{ "WSAEINPROGRESS", 0xc0010000 | WSAEINPROGRESS },
|
||||
{ "WSAEINTR", 0xc0010000 | WSAEINTR },
|
||||
{ "WSAEINVAL", 0xc0010000 | WSAEINVAL },
|
||||
{ "WSAEISCONN", 0xc0010000 | WSAEISCONN },
|
||||
{ "WSAELOOP", 0xc0010000 | WSAELOOP },
|
||||
{ "WSAEMFILE", 0xc0010000 | WSAEMFILE },
|
||||
{ "WSAEMSGSIZE", 0xc0010000 | WSAEMSGSIZE },
|
||||
{ "WSAENAMETOOLONG", 0xc0010000 | WSAENAMETOOLONG },
|
||||
{ "WSAENETDOWN", 0xc0010000 | WSAENETDOWN },
|
||||
{ "WSAENETRESET", 0xc0010000 | WSAENETRESET },
|
||||
{ "WSAENETUNREACH", 0xc0010000 | WSAENETUNREACH },
|
||||
{ "WSAENOBUFS", 0xc0010000 | WSAENOBUFS },
|
||||
{ "WSAENOPROTOOPT", 0xc0010000 | WSAENOPROTOOPT },
|
||||
{ "WSAENOTCONN", 0xc0010000 | WSAENOTCONN },
|
||||
{ "WSAENOTEMPTY", 0xc0010000 | WSAENOTEMPTY },
|
||||
{ "WSAENOTSOCK", 0xc0010000 | WSAENOTSOCK },
|
||||
{ "WSAEOPNOTSUPP", 0xc0010000 | WSAEOPNOTSUPP },
|
||||
{ "WSAEPFNOSUPPORT", 0xc0010000 | WSAEPFNOSUPPORT },
|
||||
{ "WSAEPROCLIM", 0xc0010000 | WSAEPROCLIM },
|
||||
{ "WSAEPROTONOSUPPORT", 0xc0010000 | WSAEPROTONOSUPPORT },
|
||||
{ "WSAEPROTOTYPE", 0xc0010000 | WSAEPROTOTYPE },
|
||||
{ "WSAEREMOTE", 0xc0010000 | WSAEREMOTE },
|
||||
{ "WSAESHUTDOWN", 0xc0010000 | WSAESHUTDOWN },
|
||||
{ "WSAESOCKTNOSUPPORT", 0xc0010000 | WSAESOCKTNOSUPPORT },
|
||||
{ "WSAESTALE", 0xc0010000 | WSAESTALE },
|
||||
{ "WSAETIMEDOUT", 0xc0010000 | WSAETIMEDOUT },
|
||||
{ "WSAETOOMANYREFS", 0xc0010000 | WSAETOOMANYREFS },
|
||||
{ "WSAEUSERS", 0xc0010000 | WSAEUSERS },
|
||||
{ "WSAEWOULDBLOCK", 0xc0010000 | WSAEWOULDBLOCK },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
|
|
|
@ -298,6 +298,10 @@ sub GET_ERROR_NAMES()
|
|||
{
|
||||
$errors{$1} = "0xc0010000 | $1";
|
||||
}
|
||||
while (/\breturn\s+(WSA\w+)/g)
|
||||
{
|
||||
$errors{$1} = "0xc0010000 | $1";
|
||||
}
|
||||
}
|
||||
close FILE;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue