server: Implement IOCTL_SERIAL_SET_WAIT_MASK as an ioctl on the server side.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2017-05-05 12:28:19 +02:00
parent 84e97cf604
commit b7b9c4eaa6
6 changed files with 14 additions and 37 deletions

View File

@ -771,21 +771,6 @@ static NTSTATUS set_special_chars(int fd, const SERIAL_CHARS* sc)
return STATUS_SUCCESS;
}
static NTSTATUS set_wait_mask(HANDLE hDevice, DWORD mask)
{
NTSTATUS status;
SERVER_START_REQ( set_serial_info )
{
req->handle = wine_server_obj_handle( hDevice );
req->flags = SERIALINFO_SET_MASK;
req->eventmask = mask;
status = wine_server_call( req );
}
SERVER_END_REQ;
return status;
}
/*
* does not change IXOFF but simulates that IXOFF has been received:
*/
@ -1126,6 +1111,7 @@ static inline NTSTATUS io_control(HANDLE hDevice,
{
case IOCTL_SERIAL_GET_TIMEOUTS:
case IOCTL_SERIAL_SET_TIMEOUTS:
case IOCTL_SERIAL_SET_WAIT_MASK:
/* these are handled on the server side */
return STATUS_NOT_SUPPORTED;
}
@ -1301,13 +1287,6 @@ static inline NTSTATUS io_control(HANDLE hDevice,
status = STATUS_NOT_SUPPORTED;
#endif
break;
case IOCTL_SERIAL_SET_WAIT_MASK:
if (lpInBuffer && nInBufferSize == sizeof(DWORD))
{
status = set_wait_mask(hDevice, *(DWORD*)lpInBuffer);
}
else status = STATUS_INVALID_PARAMETER;
break;
case IOCTL_SERIAL_SET_XOFF:
status = set_XOff(fd);
break;

View File

@ -3164,13 +3164,12 @@ struct set_serial_info_request
struct request_header __header;
obj_handle_t handle;
int flags;
unsigned int eventmask;
char __pad_20[4];
};
struct set_serial_info_reply
{
struct reply_header __header;
};
#define SERIALINFO_SET_MASK 0x02
#define SERIALINFO_PENDING_WRITE 0x04
#define SERIALINFO_PENDING_WAIT 0x08
@ -6396,6 +6395,6 @@ union generic_reply
struct terminate_job_reply terminate_job_reply;
};
#define SERVER_PROTOCOL_VERSION 529
#define SERVER_PROTOCOL_VERSION 530
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */

View File

@ -2309,9 +2309,7 @@ enum message_type
@REQ(set_serial_info)
obj_handle_t handle; /* handle to comm port */
int flags; /* bitmask to set values (see below) */
unsigned int eventmask;
@END
#define SERIALINFO_SET_MASK 0x02
#define SERIALINFO_PENDING_WRITE 0x04
#define SERIALINFO_PENDING_WAIT 0x08

View File

@ -1559,7 +1559,6 @@ C_ASSERT( FIELD_OFFSET(struct get_serial_info_reply, pending_write) == 16 );
C_ASSERT( sizeof(struct get_serial_info_reply) == 24 );
C_ASSERT( FIELD_OFFSET(struct set_serial_info_request, handle) == 12 );
C_ASSERT( FIELD_OFFSET(struct set_serial_info_request, flags) == 16 );
C_ASSERT( FIELD_OFFSET(struct set_serial_info_request, eventmask) == 20 );
C_ASSERT( sizeof(struct set_serial_info_request) == 24 );
C_ASSERT( FIELD_OFFSET(struct register_async_request, type) == 12 );
C_ASSERT( FIELD_OFFSET(struct register_async_request, async) == 16 );

View File

@ -220,6 +220,16 @@ static obj_handle_t serial_ioctl( struct fd *fd, ioctl_code_t code, struct async
else set_error( STATUS_BUFFER_TOO_SMALL );
return 0;
case IOCTL_SERIAL_SET_WAIT_MASK:
if (get_req_data_size() >= sizeof(serial->eventmask))
{
serial->eventmask = *(unsigned int *)get_req_data();
serial->generation++;
fd_async_wake_up( serial->fd, ASYNC_TYPE_WAIT, STATUS_SUCCESS );
}
else set_error( STATUS_BUFFER_TOO_SMALL );
return 0;
default:
set_error( STATUS_NOT_SUPPORTED );
return 0;
@ -329,14 +339,6 @@ DECL_HANDLER(set_serial_info)
if (req->flags & SERIALINFO_PENDING_WRITE)
serial->pending_write = 1;
/* event mask */
if (req->flags & SERIALINFO_SET_MASK)
{
serial->eventmask = req->eventmask;
serial->generation++;
fd_async_wake_up( serial->fd, ASYNC_TYPE_WAIT, STATUS_SUCCESS );
}
release_object( serial );
}
}

View File

@ -121,6 +121,7 @@ static void dump_ioctl_code( const char *prefix, const ioctl_code_t *code )
CASE(FSCTL_PIPE_WAIT);
CASE(IOCTL_SERIAL_GET_TIMEOUTS);
CASE(IOCTL_SERIAL_SET_TIMEOUTS);
CASE(IOCTL_SERIAL_SET_WAIT_MASK);
CASE(WS_SIO_ADDRESS_LIST_CHANGE);
default: fprintf( stderr, "%s%08x", prefix, *code ); break;
#undef CASE
@ -2843,7 +2844,6 @@ static void dump_set_serial_info_request( const struct set_serial_info_request *
{
fprintf( stderr, " handle=%04x", req->handle );
fprintf( stderr, ", flags=%d", req->flags );
fprintf( stderr, ", eventmask=%08x", req->eventmask );
}
static void dump_register_async_request( const struct register_async_request *req )