Bruno Jesus <00cpxxx(a)gmail.com> writes:
> @@ -2427,6 +2427,46 @@ static void WINAPI WS2_GetAcceptExSockaddrs(PVOID buffer, DWORD data_size, DWORD
> }
>
> /***********************************************************************
> + * WSASendMsg
> + */
> +int WINAPI WSASendMsg( SOCKET s, LPWSAMSG msg, DWORD dwFlags, LPDWORD lpNumberOfBytesSent,
> + LPWSAOVERLAPPED lpOverlapped,
> + LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
> +{
> + int ret = SOCKET_ERROR, fd, sock_type;
> + socklen_t optlen = sizeof(sock_type);
> +
> + if (!msg)
> + {
> + SetLastError(WSAEFAULT);
> + return SOCKET_ERROR;
> + }
> +
> + if ( (fd = get_sock_fd( s, 0, NULL )) == -1)
> + return SOCKET_ERROR;
> +
> + if (getsockopt(fd, SOL_SOCKET, SO_TYPE, &sock_type, &optlen) == -1)
> + {
> + SetLastError((errno == EBADF) ? WSAENOTSOCK : wsaErrno());
> + goto cleanup;
> + }
> +
> + if (sock_type != SOCK_DGRAM && sock_type != SOCK_RAW)
> + {
> + SetLastError(WSAEINVAL);
> + goto cleanup;
> + }
> +
> + ret = WS2_sendto( s, msg->lpBuffers, msg->dwBufferCount, lpNumberOfBytesSent,
> + dwFlags, msg->name, msg->namelen,
> + lpOverlapped, lpCompletionRoutine );
This is redundant, WS2_sendto will already fetch the file descriptor,
any necessary error checking should happen there.
--
Alexandre Julliard
julliard(a)winehq.org