mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-16 04:46:45 +00:00
ws2_32: Move the setsockopt(SO_BROADCAST) implementation to ntdll.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
d9b281e5c7
commit
759408c3ae
|
@ -1146,8 +1146,8 @@ static void complete_async( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, vo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static NTSTATUS do_getsockopt( HANDLE handle, IO_STATUS_BLOCK *io, void *out_buffer,
|
static NTSTATUS do_getsockopt( HANDLE handle, IO_STATUS_BLOCK *io, int level,
|
||||||
ULONG out_size, int level, int option )
|
int option, void *out_buffer, ULONG out_size )
|
||||||
{
|
{
|
||||||
int fd, needs_close = FALSE;
|
int fd, needs_close = FALSE;
|
||||||
socklen_t len = out_size;
|
socklen_t len = out_size;
|
||||||
|
@ -1165,6 +1165,22 @@ static NTSTATUS do_getsockopt( HANDLE handle, IO_STATUS_BLOCK *io, void *out_buf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static NTSTATUS do_setsockopt( HANDLE handle, IO_STATUS_BLOCK *io, int level,
|
||||||
|
int option, const void *optval, socklen_t optlen )
|
||||||
|
{
|
||||||
|
int fd, needs_close = FALSE;
|
||||||
|
NTSTATUS status;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if ((status = server_get_unix_fd( handle, 0, &fd, &needs_close, NULL, NULL )))
|
||||||
|
return status;
|
||||||
|
|
||||||
|
ret = setsockopt( fd, level, option, optval, optlen );
|
||||||
|
if (needs_close) close( fd );
|
||||||
|
return ret ? sock_errno_to_status( errno ) : STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS sock_ioctl( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc_user, IO_STATUS_BLOCK *io,
|
NTSTATUS sock_ioctl( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc_user, IO_STATUS_BLOCK *io,
|
||||||
ULONG code, void *in_buffer, ULONG in_size, void *out_buffer, ULONG out_size )
|
ULONG code, void *in_buffer, ULONG in_size, void *out_buffer, ULONG out_size )
|
||||||
{
|
{
|
||||||
|
@ -1586,7 +1602,10 @@ NTSTATUS sock_ioctl( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc
|
||||||
}
|
}
|
||||||
|
|
||||||
case IOCTL_AFD_WINE_GET_SO_BROADCAST:
|
case IOCTL_AFD_WINE_GET_SO_BROADCAST:
|
||||||
return do_getsockopt( handle, io, out_buffer, out_size, SOL_SOCKET, SO_BROADCAST );
|
return do_getsockopt( handle, io, SOL_SOCKET, SO_BROADCAST, out_buffer, out_size );
|
||||||
|
|
||||||
|
case IOCTL_AFD_WINE_SET_SO_BROADCAST:
|
||||||
|
return do_setsockopt( handle, io, SOL_SOCKET, SO_BROADCAST, in_buffer, in_size );
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
|
|
|
@ -3538,6 +3538,18 @@ int WINAPI WS_sendto(SOCKET s, const char *buf, int len, int flags,
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int server_setsockopt( SOCKET s, ULONG code, const char *optval, int optlen )
|
||||||
|
{
|
||||||
|
IO_STATUS_BLOCK io;
|
||||||
|
NTSTATUS status;
|
||||||
|
|
||||||
|
status = NtDeviceIoControlFile( (HANDLE)s, NULL, NULL, NULL, &io, code, (void *)optval, optlen, NULL, 0 );
|
||||||
|
SetLastError( NtStatusToWSAError( status ) );
|
||||||
|
return status ? -1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* setsockopt (WS2_32.21)
|
* setsockopt (WS2_32.21)
|
||||||
*/
|
*/
|
||||||
|
@ -3566,6 +3578,9 @@ int WINAPI WS_setsockopt(SOCKET s, int level, int optname,
|
||||||
case WS_SOL_SOCKET:
|
case WS_SOL_SOCKET:
|
||||||
switch(optname)
|
switch(optname)
|
||||||
{
|
{
|
||||||
|
case WS_SO_BROADCAST:
|
||||||
|
return server_setsockopt( s, IOCTL_AFD_WINE_SET_SO_BROADCAST, optval, optlen );
|
||||||
|
|
||||||
/* Some options need some conversion before they can be sent to
|
/* Some options need some conversion before they can be sent to
|
||||||
* setsockopt. The conversions are done here, then they will fall through
|
* setsockopt. The conversions are done here, then they will fall through
|
||||||
* to the general case. Special options that are not passed to
|
* to the general case. Special options that are not passed to
|
||||||
|
@ -3621,7 +3636,6 @@ int WINAPI WS_setsockopt(SOCKET s, int level, int optname,
|
||||||
/* The options listed here don't need any special handling. Thanks to
|
/* The options listed here don't need any special handling. Thanks to
|
||||||
* the conversion happening above, options from there will fall through
|
* the conversion happening above, options from there will fall through
|
||||||
* to this, too.*/
|
* to this, too.*/
|
||||||
case WS_SO_BROADCAST:
|
|
||||||
case WS_SO_ERROR:
|
case WS_SO_ERROR:
|
||||||
case WS_SO_KEEPALIVE:
|
case WS_SO_KEEPALIVE:
|
||||||
case WS_SO_OOBINLINE:
|
case WS_SO_OOBINLINE:
|
||||||
|
|
|
@ -161,6 +161,7 @@ struct afd_get_events_params
|
||||||
#define IOCTL_AFD_WINE_GET_INFO CTL_CODE(FILE_DEVICE_NETWORK, 218, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
#define IOCTL_AFD_WINE_GET_INFO CTL_CODE(FILE_DEVICE_NETWORK, 218, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||||
#define IOCTL_AFD_WINE_GET_SO_ACCEPTCONN CTL_CODE(FILE_DEVICE_NETWORK, 219, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
#define IOCTL_AFD_WINE_GET_SO_ACCEPTCONN CTL_CODE(FILE_DEVICE_NETWORK, 219, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||||
#define IOCTL_AFD_WINE_GET_SO_BROADCAST CTL_CODE(FILE_DEVICE_NETWORK, 220, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
#define IOCTL_AFD_WINE_GET_SO_BROADCAST CTL_CODE(FILE_DEVICE_NETWORK, 220, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||||
|
#define IOCTL_AFD_WINE_SET_SO_BROADCAST CTL_CODE(FILE_DEVICE_NETWORK, 221, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||||
|
|
||||||
struct afd_create_params
|
struct afd_create_params
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue