server: Implement IOCTL_SERIAL_SET_TIMEOUTS as an ioctl on the server side.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
a682420b58
commit
84e97cf604
|
@ -771,25 +771,6 @@ static NTSTATUS set_special_chars(int fd, const SERIAL_CHARS* sc)
|
|||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static NTSTATUS set_timeouts(HANDLE handle, const SERIAL_TIMEOUTS* st)
|
||||
{
|
||||
NTSTATUS status;
|
||||
|
||||
SERVER_START_REQ( set_serial_info )
|
||||
{
|
||||
req->handle = wine_server_obj_handle( handle );
|
||||
req->flags = SERIALINFO_SET_TIMEOUTS;
|
||||
req->readinterval = st->ReadIntervalTimeout ;
|
||||
req->readmult = st->ReadTotalTimeoutMultiplier ;
|
||||
req->readconst = st->ReadTotalTimeoutConstant ;
|
||||
req->writemult = st->WriteTotalTimeoutMultiplier ;
|
||||
req->writeconst = st->WriteTotalTimeoutConstant ;
|
||||
status = wine_server_call( req );
|
||||
}
|
||||
SERVER_END_REQ;
|
||||
return status;
|
||||
}
|
||||
|
||||
static NTSTATUS set_wait_mask(HANDLE hDevice, DWORD mask)
|
||||
{
|
||||
NTSTATUS status;
|
||||
|
@ -1135,17 +1116,22 @@ static inline NTSTATUS io_control(HANDLE hDevice,
|
|||
DWORD sz = 0, access = FILE_READ_DATA;
|
||||
NTSTATUS status = STATUS_SUCCESS;
|
||||
int fd = -1, needs_close = 0;
|
||||
enum server_fd_type type;
|
||||
|
||||
TRACE("%p %s %p %d %p %d %p\n",
|
||||
hDevice, iocode2str(dwIoControlCode), lpInBuffer, nInBufferSize,
|
||||
lpOutBuffer, nOutBufferSize, piosb);
|
||||
|
||||
switch (dwIoControlCode)
|
||||
{
|
||||
case IOCTL_SERIAL_GET_TIMEOUTS:
|
||||
case IOCTL_SERIAL_SET_TIMEOUTS:
|
||||
/* these are handled on the server side */
|
||||
return STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
piosb->Information = 0;
|
||||
|
||||
if (dwIoControlCode != IOCTL_SERIAL_GET_TIMEOUTS &&
|
||||
dwIoControlCode != IOCTL_SERIAL_SET_TIMEOUTS)
|
||||
{
|
||||
enum server_fd_type type;
|
||||
if ((status = server_get_unix_fd( hDevice, access, &fd, &needs_close, &type, NULL )))
|
||||
goto error;
|
||||
if (type != FD_TYPE_SERIAL)
|
||||
|
@ -1154,7 +1140,6 @@ static inline NTSTATUS io_control(HANDLE hDevice,
|
|||
status = STATUS_OBJECT_TYPE_MISMATCH;
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
switch (dwIoControlCode)
|
||||
{
|
||||
|
@ -1224,8 +1209,6 @@ static inline NTSTATUS io_control(HANDLE hDevice,
|
|||
}
|
||||
else status = STATUS_INVALID_PARAMETER;
|
||||
break;
|
||||
case IOCTL_SERIAL_GET_TIMEOUTS:
|
||||
return STATUS_NOT_SUPPORTED;
|
||||
case IOCTL_SERIAL_GET_WAIT_MASK:
|
||||
if (lpOutBuffer && nOutBufferSize == sizeof(DWORD))
|
||||
{
|
||||
|
@ -1318,12 +1301,6 @@ static inline NTSTATUS io_control(HANDLE hDevice,
|
|||
status = STATUS_NOT_SUPPORTED;
|
||||
#endif
|
||||
break;
|
||||
case IOCTL_SERIAL_SET_TIMEOUTS:
|
||||
if (lpInBuffer && nInBufferSize == sizeof(SERIAL_TIMEOUTS))
|
||||
status = set_timeouts(hDevice, lpInBuffer);
|
||||
else
|
||||
status = STATUS_INVALID_PARAMETER;
|
||||
break;
|
||||
case IOCTL_SERIAL_SET_WAIT_MASK:
|
||||
if (lpInBuffer && nInBufferSize == sizeof(DWORD))
|
||||
{
|
||||
|
|
|
@ -3164,19 +3164,12 @@ struct set_serial_info_request
|
|||
struct request_header __header;
|
||||
obj_handle_t handle;
|
||||
int flags;
|
||||
unsigned int readinterval;
|
||||
unsigned int readconst;
|
||||
unsigned int readmult;
|
||||
unsigned int writeconst;
|
||||
unsigned int writemult;
|
||||
unsigned int eventmask;
|
||||
char __pad_44[4];
|
||||
};
|
||||
struct set_serial_info_reply
|
||||
{
|
||||
struct reply_header __header;
|
||||
};
|
||||
#define SERIALINFO_SET_TIMEOUTS 0x01
|
||||
#define SERIALINFO_SET_MASK 0x02
|
||||
#define SERIALINFO_PENDING_WRITE 0x04
|
||||
#define SERIALINFO_PENDING_WAIT 0x08
|
||||
|
@ -6403,6 +6396,6 @@ union generic_reply
|
|||
struct terminate_job_reply terminate_job_reply;
|
||||
};
|
||||
|
||||
#define SERVER_PROTOCOL_VERSION 528
|
||||
#define SERVER_PROTOCOL_VERSION 529
|
||||
|
||||
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
|
||||
|
|
|
@ -2309,14 +2309,8 @@ 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 readinterval;
|
||||
unsigned int readconst;
|
||||
unsigned int readmult;
|
||||
unsigned int writeconst;
|
||||
unsigned int writemult;
|
||||
unsigned int eventmask;
|
||||
@END
|
||||
#define SERIALINFO_SET_TIMEOUTS 0x01
|
||||
#define SERIALINFO_SET_MASK 0x02
|
||||
#define SERIALINFO_PENDING_WRITE 0x04
|
||||
#define SERIALINFO_PENDING_WAIT 0x08
|
||||
|
|
|
@ -1559,13 +1559,8 @@ 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, readinterval) == 20 );
|
||||
C_ASSERT( FIELD_OFFSET(struct set_serial_info_request, readconst) == 24 );
|
||||
C_ASSERT( FIELD_OFFSET(struct set_serial_info_request, readmult) == 28 );
|
||||
C_ASSERT( FIELD_OFFSET(struct set_serial_info_request, writeconst) == 32 );
|
||||
C_ASSERT( FIELD_OFFSET(struct set_serial_info_request, writemult) == 36 );
|
||||
C_ASSERT( FIELD_OFFSET(struct set_serial_info_request, eventmask) == 40 );
|
||||
C_ASSERT( sizeof(struct set_serial_info_request) == 48 );
|
||||
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 );
|
||||
C_ASSERT( FIELD_OFFSET(struct register_async_request, count) == 56 );
|
||||
|
|
|
@ -206,6 +206,20 @@ 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_TIMEOUTS:
|
||||
if (get_req_data_size() >= sizeof(SERIAL_TIMEOUTS))
|
||||
{
|
||||
const SERIAL_TIMEOUTS *timeouts = get_req_data();
|
||||
|
||||
serial->readinterval = timeouts->ReadIntervalTimeout;
|
||||
serial->readconst = timeouts->ReadTotalTimeoutConstant;
|
||||
serial->readmult = timeouts->ReadTotalTimeoutMultiplier;
|
||||
serial->writeconst = timeouts->WriteTotalTimeoutConstant;
|
||||
serial->writemult = timeouts->WriteTotalTimeoutMultiplier;
|
||||
}
|
||||
else set_error( STATUS_BUFFER_TOO_SMALL );
|
||||
return 0;
|
||||
|
||||
default:
|
||||
set_error( STATUS_NOT_SUPPORTED );
|
||||
return 0;
|
||||
|
@ -311,16 +325,6 @@ DECL_HANDLER(set_serial_info)
|
|||
serial->pending_wait = 0;
|
||||
}
|
||||
|
||||
/* timeouts */
|
||||
if (req->flags & SERIALINFO_SET_TIMEOUTS)
|
||||
{
|
||||
serial->readinterval = req->readinterval;
|
||||
serial->readconst = req->readconst;
|
||||
serial->readmult = req->readmult;
|
||||
serial->writeconst = req->writeconst;
|
||||
serial->writemult = req->writemult;
|
||||
}
|
||||
|
||||
/* pending write */
|
||||
if (req->flags & SERIALINFO_PENDING_WRITE)
|
||||
serial->pending_write = 1;
|
||||
|
|
|
@ -120,6 +120,7 @@ static void dump_ioctl_code( const char *prefix, const ioctl_code_t *code )
|
|||
CASE(FSCTL_PIPE_PEEK);
|
||||
CASE(FSCTL_PIPE_WAIT);
|
||||
CASE(IOCTL_SERIAL_GET_TIMEOUTS);
|
||||
CASE(IOCTL_SERIAL_SET_TIMEOUTS);
|
||||
CASE(WS_SIO_ADDRESS_LIST_CHANGE);
|
||||
default: fprintf( stderr, "%s%08x", prefix, *code ); break;
|
||||
#undef CASE
|
||||
|
@ -2842,11 +2843,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, ", readinterval=%08x", req->readinterval );
|
||||
fprintf( stderr, ", readconst=%08x", req->readconst );
|
||||
fprintf( stderr, ", readmult=%08x", req->readmult );
|
||||
fprintf( stderr, ", writeconst=%08x", req->writeconst );
|
||||
fprintf( stderr, ", writemult=%08x", req->writemult );
|
||||
fprintf( stderr, ", eventmask=%08x", req->eventmask );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue