diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index 66def56a23a..774481daa9e 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -1806,7 +1806,11 @@ static NTSTATUS WS2_async_send(void* user, IO_STATUS_BLOCK* iosb, NTSTATUS statu if (result >= 0) { - status = STATUS_SUCCESS; + if (wsa->first_iovec < wsa->n_iovecs) + status = STATUS_PENDING; + else + status = STATUS_SUCCESS; + iosb->Information += result; } else if (errno == EINTR || errno == EAGAIN) @@ -3906,10 +3910,10 @@ static int WS2_sendto( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount, wsa->completion_func = lpCompletionRoutine; release_sock_fd( s, fd ); - if (n == -1) + if (n == -1 || n < totalLength) { iosb->u.Status = STATUS_PENDING; - iosb->Information = 0; + iosb->Information = n == -1 ? 0 : n; SERVER_START_REQ( register_async ) { diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c index 77925b5ddce..df6bff81296 100644 --- a/dlls/ws2_32/tests/sock.c +++ b/dlls/ws2_32/tests/sock.c @@ -2848,10 +2848,8 @@ static void test_send(void) bytes_sent = 0; ret = WSASend(dst, &buf, 1, &bytes_sent, 0, &ov, NULL); - todo_wine ok((ret == SOCKET_ERROR && GetLastError() == ERROR_IO_PENDING) || broken(bytes_sent == buflen), + ok((ret == SOCKET_ERROR && GetLastError() == ERROR_IO_PENDING) || broken(bytes_sent == buflen), "Failed to start overlapped send %d - %d - %d/%d\n", ret, WSAGetLastError(), bytes_sent, buflen); - if ( (ret != SOCKET_ERROR || GetLastError() != ERROR_IO_PENDING) && bytes_sent < buflen ) - goto end; /* don't check for completion yet, we may need to drain the buffer while still sending */ set_blocking(src, FALSE);