Commit fb963625 authored by Alistair Leslie-Hughes's avatar Alistair Leslie-Hughes Committed by Vitaly Lipatov

ws2_32: Return a valid value for WSAIoctl SIO_IDEAL_SEND_BACKLOG_QUERY.

parent 758e7cad
......@@ -1726,6 +1726,25 @@ NTSTATUS sock_ioctl( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc
return STATUS_SUCCESS;
}
case IOCTL_AFD_WINE_SEND_BACKLOG_QUERY:
{
if (out_size < sizeof(DWORD))
{
status = STATUS_BUFFER_TOO_SMALL;
break;
}
if(get_sock_type( handle ) != SOCK_STREAM)
{
status = STATUS_NOT_SUPPORTED;
break;
}
*(DWORD*)out_buffer = 0x10000; /* 64k */
break;
}
case IOCTL_AFD_WINE_SIOCATMARK:
{
int value, ret;
......
......@@ -2327,6 +2327,23 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID
return ret ? -1 : 0;
}
case SIO_IDEAL_SEND_BACKLOG_QUERY:
{
DWORD ret;
if (!out_buff)
{
SetLastError(WSAEFAULT);
return SOCKET_ERROR;
}
ret = server_ioctl_sock( s, IOCTL_AFD_WINE_SEND_BACKLOG_QUERY, in_buff, in_size,
out_buff, out_size, ret_size, overlapped, completion );
SetLastError( ret );
if (!ret) *ret_size = sizeof(u_long);
return ret ? -1 : 0;
}
case SIOCATMARK:
{
DWORD ret;
......
......@@ -6820,8 +6820,9 @@ static void test_WSASendTo(void)
struct sockaddr_in addr, ret_addr;
char buf[12] = "hello world";
WSABUF data_buf;
DWORD bytesSent;
DWORD bytesSent, size;
int ret, len;
ULONG backlog = 0;
addr.sin_family = AF_INET;
addr.sin_port = htons(139);
......@@ -6857,6 +6858,11 @@ static void test_WSASendTo(void)
ok(!ret, "got error %u\n", WSAGetLastError());
ok(ret_addr.sin_family == AF_INET, "got family %u\n", ret_addr.sin_family);
ok(ret_addr.sin_port, "expected nonzero port\n");
ret = WSAIoctl(s, SIO_IDEAL_SEND_BACKLOG_QUERY, NULL, 0, &backlog, sizeof(backlog), &size, NULL, NULL);
ok(ret == SOCKET_ERROR && WSAGetLastError() == WSAEOPNOTSUPP,
"WSAIoctl() failed: %d/%d\n", ret, WSAGetLastError());
closesocket(s);
}
struct recv_thread_apc_param
......@@ -6936,6 +6942,7 @@ static void test_WSARecv(void)
DWORD dwret;
BOOL bret;
HANDLE thread, event = NULL, io_port;
ULONG backlog = 0, size;
tcp_socketpair(&src, &dest);
......@@ -7101,6 +7108,10 @@ static void test_WSARecv(void)
CloseHandle(io_port);
iret = WSAIoctl(src, SIO_IDEAL_SEND_BACKLOG_QUERY, NULL, 0, &backlog, sizeof(backlog), &size, NULL, NULL);
ok(!iret, "WSAIoctl() failed: %d/%d\n", iret, WSAGetLastError());
ok(backlog == 0x10000, "got %08lx\n", backlog);
end:
if (server != INVALID_SOCKET)
closesocket(server);
......
......@@ -283,6 +283,7 @@ C_ASSERT( sizeof(struct afd_get_events_params) == 56 );
#define IOCTL_AFD_WINE_SET_IP_RECVTTL WINE_AFD_IOC(294)
#define IOCTL_AFD_WINE_GET_IP_RECVTOS WINE_AFD_IOC(295)
#define IOCTL_AFD_WINE_SET_IP_RECVTOS WINE_AFD_IOC(296)
#define IOCTL_AFD_WINE_SEND_BACKLOG_QUERY WINE_AFD_IOC(297)
struct afd_iovec
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment