server: Use pipe_end_get_file_info for FilePipeInformation implementation.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2018-10-15 13:41:00 +02:00 committed by Alexandre Julliard
parent 36c6a16c62
commit 5f43a1b93e
6 changed files with 25 additions and 114 deletions

View file

@ -2312,7 +2312,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE hFile, PIO_STATUS_BLOCK io,
if (len < info_sizes[class])
return io->u.Status = STATUS_INFO_LENGTH_MISMATCH;
if (class != FilePipeInformation && class != FileAccessInformation)
if (class != FileAccessInformation)
{
if ((io->u.Status = server_get_unix_fd( hFile, 0, &fd, &needs_close, NULL, NULL )))
{
@ -2442,24 +2442,6 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE hFile, PIO_STATUS_BLOCK io,
}
}
break;
case FilePipeInformation:
{
FILE_PIPE_INFORMATION* pi = ptr;
SERVER_START_REQ( get_named_pipe_info )
{
req->handle = wine_server_obj_handle( hFile );
if (!(io->u.Status = wine_server_call( req )))
{
pi->ReadMode = (reply->flags & NAMED_PIPE_MESSAGE_STREAM_READ) ?
FILE_PIPE_MESSAGE_MODE : FILE_PIPE_BYTE_STREAM_MODE;
pi->CompletionMode = (reply->flags & NAMED_PIPE_NONBLOCKING_MODE) ?
FILE_PIPE_COMPLETE_OPERATION : FILE_PIPE_QUEUE_OPERATION;
}
}
SERVER_END_REQ;
}
break;
case FileNameInformation:
{
FILE_NAME_INFORMATION *info = ptr;

View file

@ -3419,23 +3419,6 @@ struct create_named_pipe_reply
#define NAMED_PIPE_SERVER_END 0x8000
struct get_named_pipe_info_request
{
struct request_header __header;
obj_handle_t handle;
};
struct get_named_pipe_info_reply
{
struct reply_header __header;
unsigned int flags;
unsigned int sharing;
unsigned int maxinstances;
unsigned int instances;
unsigned int outsize;
unsigned int insize;
};
struct set_named_pipe_info_request
{
struct request_header __header;
@ -5805,7 +5788,6 @@ enum request
REQ_ioctl,
REQ_set_irp_result,
REQ_create_named_pipe,
REQ_get_named_pipe_info,
REQ_set_named_pipe_info,
REQ_create_window,
REQ_destroy_window,
@ -6102,7 +6084,6 @@ union generic_request
struct ioctl_request ioctl_request;
struct set_irp_result_request set_irp_result_request;
struct create_named_pipe_request create_named_pipe_request;
struct get_named_pipe_info_request get_named_pipe_info_request;
struct set_named_pipe_info_request set_named_pipe_info_request;
struct create_window_request create_window_request;
struct destroy_window_request destroy_window_request;
@ -6397,7 +6378,6 @@ union generic_reply
struct ioctl_reply ioctl_reply;
struct set_irp_result_reply set_irp_result_reply;
struct create_named_pipe_reply create_named_pipe_reply;
struct get_named_pipe_info_reply get_named_pipe_info_reply;
struct set_named_pipe_info_reply set_named_pipe_info_reply;
struct create_window_reply create_window_reply;
struct destroy_window_reply destroy_window_reply;
@ -6532,6 +6512,6 @@ union generic_reply
struct terminate_job_reply terminate_job_reply;
};
#define SERVER_PROTOCOL_VERSION 566
#define SERVER_PROTOCOL_VERSION 567
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */

View file

@ -555,6 +555,29 @@ static void pipe_end_get_file_info( struct fd *fd, obj_handle_t handle, unsigned
if (reply_size) memcpy( &name_info->FileName[1], name, reply_size );
break;
}
case FilePipeInformation:
{
FILE_PIPE_INFORMATION *pipe_info;
if (!(get_handle_access( current->process, handle) & FILE_READ_ATTRIBUTES))
{
set_error( STATUS_ACCESS_DENIED );
return;
}
if (get_reply_max_size() < sizeof(*pipe_info))
{
set_error( STATUS_INFO_LENGTH_MISMATCH );
return;
}
if (!(pipe_info = set_reply_data_size( sizeof(*pipe_info) ))) return;
pipe_info->ReadMode = (pipe_end->flags & NAMED_PIPE_MESSAGE_STREAM_READ)
? FILE_PIPE_MESSAGE_MODE : FILE_PIPE_BYTE_STREAM_MODE;
pipe_info->CompletionMode = (pipe_end->flags & NAMED_PIPE_NONBLOCKING_MODE)
? FILE_PIPE_COMPLETE_OPERATION : FILE_PIPE_QUEUE_OPERATION;
break;
}
case FilePipeLocalInformation:
{
FILE_PIPE_LOCAL_INFORMATION *pipe_info;
@ -1320,39 +1343,6 @@ DECL_HANDLER(create_named_pipe)
release_object( pipe );
}
DECL_HANDLER(get_named_pipe_info)
{
struct pipe_end *pipe_end;
pipe_end = (struct pipe_end *)get_handle_obj( current->process, req->handle,
FILE_READ_ATTRIBUTES, &pipe_server_ops );
if (!pipe_end)
{
if (get_error() != STATUS_OBJECT_TYPE_MISMATCH)
return;
clear_error();
pipe_end = (struct pipe_end *)get_handle_obj( current->process, req->handle,
FILE_READ_ATTRIBUTES, &pipe_client_ops );
if (!pipe_end) return;
}
if (pipe_end->pipe)
{
reply->flags = pipe_end->flags;
reply->sharing = pipe_end->pipe->sharing;
reply->maxinstances = pipe_end->pipe->maxinstances;
reply->instances = pipe_end->pipe->instances;
reply->insize = pipe_end->pipe->insize;
reply->outsize = pipe_end->pipe->outsize;
if (pipe_end->obj.ops == &pipe_server_ops) reply->flags |= NAMED_PIPE_SERVER_END;
}
else set_error( STATUS_PIPE_DISCONNECTED );
release_object( pipe_end );
}
DECL_HANDLER(set_named_pipe_info)
{
struct pipe_end *pipe_end;

View file

@ -2459,18 +2459,6 @@ enum message_type
#define NAMED_PIPE_NONBLOCKING_MODE 0x0004
#define NAMED_PIPE_SERVER_END 0x8000
/* Get named pipe information by handle */
@REQ(get_named_pipe_info)
obj_handle_t handle;
@REPLY
unsigned int flags;
unsigned int sharing;
unsigned int maxinstances;
unsigned int instances;
unsigned int outsize;
unsigned int insize;
@END
/* Set named pipe information by handle */
@REQ(set_named_pipe_info)
obj_handle_t handle;

View file

@ -269,7 +269,6 @@ DECL_HANDLER(write);
DECL_HANDLER(ioctl);
DECL_HANDLER(set_irp_result);
DECL_HANDLER(create_named_pipe);
DECL_HANDLER(get_named_pipe_info);
DECL_HANDLER(set_named_pipe_info);
DECL_HANDLER(create_window);
DECL_HANDLER(destroy_window);
@ -565,7 +564,6 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] =
(req_handler)req_ioctl,
(req_handler)req_set_irp_result,
(req_handler)req_create_named_pipe,
(req_handler)req_get_named_pipe_info,
(req_handler)req_set_named_pipe_info,
(req_handler)req_create_window,
(req_handler)req_destroy_window,
@ -1647,15 +1645,6 @@ C_ASSERT( FIELD_OFFSET(struct create_named_pipe_request, flags) == 48 );
C_ASSERT( sizeof(struct create_named_pipe_request) == 56 );
C_ASSERT( FIELD_OFFSET(struct create_named_pipe_reply, handle) == 8 );
C_ASSERT( sizeof(struct create_named_pipe_reply) == 16 );
C_ASSERT( FIELD_OFFSET(struct get_named_pipe_info_request, handle) == 12 );
C_ASSERT( sizeof(struct get_named_pipe_info_request) == 16 );
C_ASSERT( FIELD_OFFSET(struct get_named_pipe_info_reply, flags) == 8 );
C_ASSERT( FIELD_OFFSET(struct get_named_pipe_info_reply, sharing) == 12 );
C_ASSERT( FIELD_OFFSET(struct get_named_pipe_info_reply, maxinstances) == 16 );
C_ASSERT( FIELD_OFFSET(struct get_named_pipe_info_reply, instances) == 20 );
C_ASSERT( FIELD_OFFSET(struct get_named_pipe_info_reply, outsize) == 24 );
C_ASSERT( FIELD_OFFSET(struct get_named_pipe_info_reply, insize) == 28 );
C_ASSERT( sizeof(struct get_named_pipe_info_reply) == 32 );
C_ASSERT( FIELD_OFFSET(struct set_named_pipe_info_request, handle) == 12 );
C_ASSERT( FIELD_OFFSET(struct set_named_pipe_info_request, flags) == 16 );
C_ASSERT( sizeof(struct set_named_pipe_info_request) == 24 );

View file

@ -3020,21 +3020,6 @@ static void dump_create_named_pipe_reply( const struct create_named_pipe_reply *
fprintf( stderr, " handle=%04x", req->handle );
}
static void dump_get_named_pipe_info_request( const struct get_named_pipe_info_request *req )
{
fprintf( stderr, " handle=%04x", req->handle );
}
static void dump_get_named_pipe_info_reply( const struct get_named_pipe_info_reply *req )
{
fprintf( stderr, " flags=%08x", req->flags );
fprintf( stderr, ", sharing=%08x", req->sharing );
fprintf( stderr, ", maxinstances=%08x", req->maxinstances );
fprintf( stderr, ", instances=%08x", req->instances );
fprintf( stderr, ", outsize=%08x", req->outsize );
fprintf( stderr, ", insize=%08x", req->insize );
}
static void dump_set_named_pipe_info_request( const struct set_named_pipe_info_request *req )
{
fprintf( stderr, " handle=%04x", req->handle );
@ -4700,7 +4685,6 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_ioctl_request,
(dump_func)dump_set_irp_result_request,
(dump_func)dump_create_named_pipe_request,
(dump_func)dump_get_named_pipe_info_request,
(dump_func)dump_set_named_pipe_info_request,
(dump_func)dump_create_window_request,
(dump_func)dump_destroy_window_request,
@ -4993,7 +4977,6 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_ioctl_reply,
NULL,
(dump_func)dump_create_named_pipe_reply,
(dump_func)dump_get_named_pipe_info_reply,
NULL,
(dump_func)dump_create_window_reply,
NULL,
@ -5286,7 +5269,6 @@ static const char * const req_names[REQ_NB_REQUESTS] = {
"ioctl",
"set_irp_result",
"create_named_pipe",
"get_named_pipe_info",
"set_named_pipe_info",
"create_window",
"destroy_window",