server: Introduce IOCTL_AFD_WINE_GET_SO_ERROR.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
ad03df1222
commit
8211c3ab36
|
@ -162,6 +162,7 @@ struct afd_get_events_params
|
|||
#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_SET_SO_BROADCAST CTL_CODE(FILE_DEVICE_NETWORK, 221, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||
#define IOCTL_AFD_WINE_GET_SO_ERROR CTL_CODE(FILE_DEVICE_NETWORK, 222, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||
|
||||
struct afd_create_params
|
||||
{
|
||||
|
|
|
@ -2546,6 +2546,40 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
return 1;
|
||||
}
|
||||
|
||||
case IOCTL_AFD_WINE_GET_SO_ERROR:
|
||||
{
|
||||
int error;
|
||||
socklen_t len = sizeof(error);
|
||||
unsigned int i;
|
||||
|
||||
if (get_reply_max_size() < sizeof(error))
|
||||
{
|
||||
set_error( STATUS_BUFFER_TOO_SMALL );
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (getsockopt( unix_fd, SOL_SOCKET, SO_ERROR, (char *)&error, &len ) < 0)
|
||||
{
|
||||
set_error( sock_get_ntstatus( errno ) );
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!error)
|
||||
{
|
||||
for (i = 0; i < ARRAY_SIZE( sock->errors ); ++i)
|
||||
{
|
||||
if (sock->errors[i])
|
||||
{
|
||||
error = sock->errors[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
set_reply_data( &error, sizeof(error) );
|
||||
return 1;
|
||||
}
|
||||
|
||||
default:
|
||||
set_error( STATUS_NOT_SUPPORTED );
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue