Re: [3/3] ws2_32: Implement WSASendMsg() (try 2)
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
On Mon, Sep 30, 2013 at 6:32 AM, Alexandre Julliard <julliard(a)winehq.org> wrote:
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)
This is redundant, WS2_sendto will already fetch the file descriptor, any necessary error checking should happen there.
Ok, thanks for the review. I'll try again asap.
-- Alexandre Julliard julliard(a)winehq.org
Bruno
participants (2)
-
Alexandre Julliard -
Bruno Jesus