Alexandre Julliard : server: Implement IOCTL_SERIAL_GET_TIMEOUTS as an ioctl on the server side.
Alexandre Julliard
julliard at winehq.org
Fri May 5 15:05:58 CDT 2017
Module: wine
Branch: master
Commit: a682420b58af834d85c23ef68e440754ff5ccba0
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a682420b58af834d85c23ef68e440754ff5ccba0
Author: Alexandre Julliard <julliard at winehq.org>
Date: Fri May 5 12:18:55 2017 +0200
server: Implement IOCTL_SERIAL_GET_TIMEOUTS as an ioctl on the server side.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntdll/serial.c | 29 +----------------------------
include/wine/server_protocol.h | 8 ++------
server/protocol.def | 5 -----
server/request.h | 13 ++++---------
server/serial.c | 38 ++++++++++++++++++++++++++++++--------
server/trace.c | 10 ++++------
6 files changed, 41 insertions(+), 62 deletions(-)
diff --git a/dlls/ntdll/serial.c b/dlls/ntdll/serial.c
index 91d9be9..f0a574a 100644
--- a/dlls/ntdll/serial.c
+++ b/dlls/ntdll/serial.c
@@ -390,26 +390,6 @@ static NTSTATUS get_status(int fd, SERIAL_STATUS* ss)
return status;
}
-static NTSTATUS get_timeouts(HANDLE handle, SERIAL_TIMEOUTS* st)
-{
- NTSTATUS status;
- SERVER_START_REQ( get_serial_info )
- {
- req->handle = wine_server_obj_handle( handle );
- req->flags = 0;
- if (!(status = wine_server_call( req )))
- {
- st->ReadIntervalTimeout = reply->readinterval;
- st->ReadTotalTimeoutMultiplier = reply->readmult;
- st->ReadTotalTimeoutConstant = reply->readconst;
- st->WriteTotalTimeoutMultiplier = reply->writemult;
- st->WriteTotalTimeoutConstant = reply->writeconst;
- }
- }
- SERVER_END_REQ;
- return status;
-}
-
static void stop_waiting( HANDLE handle )
{
NTSTATUS status;
@@ -1245,14 +1225,7 @@ static inline NTSTATUS io_control(HANDLE hDevice,
else status = STATUS_INVALID_PARAMETER;
break;
case IOCTL_SERIAL_GET_TIMEOUTS:
- if (lpOutBuffer && nOutBufferSize == sizeof(SERIAL_TIMEOUTS))
- {
- if (!(status = get_timeouts(hDevice, lpOutBuffer)))
- sz = sizeof(SERIAL_TIMEOUTS);
- }
- else
- status = STATUS_INVALID_PARAMETER;
- break;
+ return STATUS_NOT_SUPPORTED;
case IOCTL_SERIAL_GET_WAIT_MASK:
if (lpOutBuffer && nOutBufferSize == sizeof(DWORD))
{
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index bfdf22f..10c0504 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -3151,14 +3151,10 @@ struct get_serial_info_request
struct get_serial_info_reply
{
struct reply_header __header;
- unsigned int readinterval;
- unsigned int readconst;
- unsigned int readmult;
- unsigned int writeconst;
- unsigned int writemult;
unsigned int eventmask;
unsigned int cookie;
unsigned int pending_write;
+ char __pad_20[4];
};
@@ -6407,6 +6403,6 @@ union generic_reply
struct terminate_job_reply terminate_job_reply;
};
-#define SERVER_PROTOCOL_VERSION 527
+#define SERVER_PROTOCOL_VERSION 528
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
diff --git a/server/protocol.def b/server/protocol.def
index 87285a4..b1e4234 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -2299,11 +2299,6 @@ enum message_type
obj_handle_t handle; /* handle to comm port */
int flags;
@REPLY
- unsigned int readinterval;
- unsigned int readconst;
- unsigned int readmult;
- unsigned int writeconst;
- unsigned int writemult;
unsigned int eventmask;
unsigned int cookie;
unsigned int pending_write;
diff --git a/server/request.h b/server/request.h
index 41016bd..7600c31 100644
--- a/server/request.h
+++ b/server/request.h
@@ -1553,15 +1553,10 @@ C_ASSERT( sizeof(struct is_window_hung_reply) == 16 );
C_ASSERT( FIELD_OFFSET(struct get_serial_info_request, handle) == 12 );
C_ASSERT( FIELD_OFFSET(struct get_serial_info_request, flags) == 16 );
C_ASSERT( sizeof(struct get_serial_info_request) == 24 );
-C_ASSERT( FIELD_OFFSET(struct get_serial_info_reply, readinterval) == 8 );
-C_ASSERT( FIELD_OFFSET(struct get_serial_info_reply, readconst) == 12 );
-C_ASSERT( FIELD_OFFSET(struct get_serial_info_reply, readmult) == 16 );
-C_ASSERT( FIELD_OFFSET(struct get_serial_info_reply, writeconst) == 20 );
-C_ASSERT( FIELD_OFFSET(struct get_serial_info_reply, writemult) == 24 );
-C_ASSERT( FIELD_OFFSET(struct get_serial_info_reply, eventmask) == 28 );
-C_ASSERT( FIELD_OFFSET(struct get_serial_info_reply, cookie) == 32 );
-C_ASSERT( FIELD_OFFSET(struct get_serial_info_reply, pending_write) == 36 );
-C_ASSERT( sizeof(struct get_serial_info_reply) == 40 );
+C_ASSERT( FIELD_OFFSET(struct get_serial_info_reply, eventmask) == 8 );
+C_ASSERT( FIELD_OFFSET(struct get_serial_info_reply, cookie) == 12 );
+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 );
diff --git a/server/serial.c b/server/serial.c
index fea3c8c..b398cc1 100644
--- a/server/serial.c
+++ b/server/serial.c
@@ -50,6 +50,8 @@
#define WIN32_NO_STATUS
#include "windef.h"
#include "winternl.h"
+#include "winioctl.h"
+#include "ddk/ntddser.h"
#include "file.h"
#include "handle.h"
@@ -61,6 +63,7 @@ static struct fd *serial_get_fd( struct object *obj );
static void serial_destroy(struct object *obj);
static enum server_fd_type serial_get_fd_type( struct fd *fd );
+static obj_handle_t serial_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
static void serial_queue_async( struct fd *fd, struct async *async, int type, int count );
static void serial_reselect_async( struct fd *fd, struct async_queue *queue );
@@ -118,7 +121,7 @@ static const struct fd_ops serial_fd_ops =
no_fd_read, /* read */
no_fd_write, /* write */
no_fd_flush, /* flush */
- default_fd_ioctl, /* ioctl */
+ serial_ioctl, /* ioctl */
serial_queue_async, /* queue_async */
serial_reselect_async /* reselect_async */
};
@@ -183,6 +186,32 @@ static enum server_fd_type serial_get_fd_type( struct fd *fd )
return FD_TYPE_SERIAL;
}
+static obj_handle_t serial_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
+{
+ struct serial *serial = get_fd_user( fd );
+
+ switch (code)
+ {
+ case IOCTL_SERIAL_GET_TIMEOUTS:
+ if (get_reply_max_size() >= sizeof(SERIAL_TIMEOUTS))
+ {
+ SERIAL_TIMEOUTS *timeouts = set_reply_data_size( sizeof(*timeouts ));
+
+ timeouts->ReadIntervalTimeout = serial->readinterval;
+ timeouts->ReadTotalTimeoutConstant = serial->readconst;
+ timeouts->ReadTotalTimeoutMultiplier = serial->readmult;
+ timeouts->WriteTotalTimeoutConstant = serial->writeconst;
+ timeouts->WriteTotalTimeoutMultiplier = serial->writemult;
+ }
+ else set_error( STATUS_BUFFER_TOO_SMALL );
+ return 0;
+
+ default:
+ set_error( STATUS_NOT_SUPPORTED );
+ return 0;
+ }
+}
+
static void serial_queue_async( struct fd *fd, struct async *async, int type, int count )
{
struct serial *serial = get_fd_user( fd );
@@ -252,13 +281,6 @@ DECL_HANDLER(get_serial_info)
serial->pending_wait = 1;
}
- /* timeouts */
- reply->readinterval = serial->readinterval;
- reply->readconst = serial->readconst;
- reply->readmult = serial->readmult;
- reply->writeconst = serial->writeconst;
- reply->writemult = serial->writemult;
-
/* event mask */
reply->eventmask = serial->eventmask;
reply->cookie = serial->generation;
diff --git a/server/trace.c b/server/trace.c
index fc7fd35..5e13dad 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -39,6 +39,7 @@
#include "winuser.h"
#include "winioctl.h"
#include "ddk/wdm.h"
+#include "ddk/ntddser.h"
#define USE_WS_PREFIX
#include "winsock2.h"
#include "file.h"
@@ -116,7 +117,9 @@ static void dump_ioctl_code( const char *prefix, const ioctl_code_t *code )
CASE(FSCTL_DISMOUNT_VOLUME);
CASE(FSCTL_PIPE_DISCONNECT);
CASE(FSCTL_PIPE_LISTEN);
+ CASE(FSCTL_PIPE_PEEK);
CASE(FSCTL_PIPE_WAIT);
+ CASE(IOCTL_SERIAL_GET_TIMEOUTS);
CASE(WS_SIO_ADDRESS_LIST_CHANGE);
default: fprintf( stderr, "%s%08x", prefix, *code ); break;
#undef CASE
@@ -2830,12 +2833,7 @@ static void dump_get_serial_info_request( const struct get_serial_info_request *
static void dump_get_serial_info_reply( const struct get_serial_info_reply *req )
{
- 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 );
+ fprintf( stderr, " eventmask=%08x", req->eventmask );
fprintf( stderr, ", cookie=%08x", req->cookie );
fprintf( stderr, ", pending_write=%08x", req->pending_write );
}
More information about the wine-cvs
mailing list