server: Implement IOCTL_AFD_EVENT_SELECT.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2021-06-14 00:41:49 -05:00 committed by Alexandre Julliard
parent e6258c544d
commit 9bbf3ab96b
3 changed files with 83 additions and 0 deletions

View File

@ -1170,6 +1170,17 @@ NTSTATUS sock_ioctl( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc
break;
}
case IOCTL_AFD_EVENT_SELECT:
{
const struct afd_event_select_params *params = in_buffer;
TRACE( "event %p, mask %#x\n", params->event, params->mask );
if (out_size) FIXME( "unexpected output size %u\n", out_size );
status = STATUS_BAD_DEVICE_TYPE;
break;
}
case IOCTL_AFD_RECV:
{
const struct afd_recv_params *params = in_buffer;

View File

@ -35,6 +35,7 @@
#define IOCTL_AFD_LISTEN CTL_CODE(FILE_DEVICE_BEEP, 0x802, METHOD_NEITHER, FILE_ANY_ACCESS)
#define IOCTL_AFD_RECV CTL_CODE(FILE_DEVICE_BEEP, 0x805, METHOD_NEITHER, FILE_ANY_ACCESS)
#define IOCTL_AFD_POLL CTL_CODE(FILE_DEVICE_BEEP, 0x809, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_AFD_EVENT_SELECT CTL_CODE(FILE_DEVICE_BEEP, 0x821, METHOD_NEITHER, FILE_ANY_ACCESS)
enum afd_poll_bit
{
@ -106,6 +107,24 @@ struct afd_poll_params
};
#include <poppack.h>
struct afd_event_select_params
{
HANDLE event;
int mask;
};
struct afd_event_select_params_64
{
ULONGLONG event;
int mask;
};
struct afd_event_select_params_32
{
ULONG event;
int mask;
};
#define IOCTL_AFD_WINE_CREATE CTL_CODE(FILE_DEVICE_NETWORK, 200, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_AFD_WINE_ACCEPT CTL_CODE(FILE_DEVICE_NETWORK, 201, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_AFD_WINE_ACCEPT_INTO CTL_CODE(FILE_DEVICE_NETWORK, 202, METHOD_BUFFERED, FILE_ANY_ACCESS)

View File

@ -2011,6 +2011,59 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
}
return 1;
case IOCTL_AFD_EVENT_SELECT:
{
struct event *event = NULL;
obj_handle_t event_handle;
int mask;
if (is_machine_64bit( current->process->machine ))
{
const struct afd_event_select_params_64 *params = get_req_data();
if (get_req_data_size() < sizeof(params))
{
set_error( STATUS_INVALID_PARAMETER );
return 1;
}
event_handle = params->event;
mask = params->mask;
}
else
{
const struct afd_event_select_params_32 *params = get_req_data();
if (get_req_data_size() < sizeof(params))
{
set_error( STATUS_INVALID_PARAMETER );
return 1;
}
event_handle = params->event;
mask = params->mask;
}
if ((event_handle || mask) &&
!(event = get_event_obj( current->process, event_handle, EVENT_MODIFY_STATE )))
{
set_error( STATUS_INVALID_PARAMETER );
return 1;
}
if (sock->event) release_object( sock->event );
sock->event = event;
sock->mask = mask;
sock->window = 0;
sock->message = 0;
sock->wparam = 0;
sock->nonblocking = 1;
sock_reselect( sock );
return 1;
}
default:
set_error( STATUS_NOT_SUPPORTED );
return 0;