From 3f07c6e256d59f6564ffb6be09e0dffe7c09e061 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Mon, 2 Oct 2017 16:42:24 +0200 Subject: [PATCH] server: Add FileFsDeviceInformation implementation for named pipes. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- dlls/ntdll/tests/pipe.c | 4 ---- server/named_pipe.c | 27 +++++++++++++++++++++++++-- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/dlls/ntdll/tests/pipe.c b/dlls/ntdll/tests/pipe.c index c448526866f..897c44b1ade 100644 --- a/dlls/ntdll/tests/pipe.c +++ b/dlls/ntdll/tests/pipe.c @@ -1115,25 +1115,21 @@ static void test_volume_info(void) memset( buffer, 0xaa, sizeof(buffer) ); status = pNtQueryVolumeInformationFile( read, &iosb, buffer, sizeof(buffer), FileFsDeviceInformation ); - todo_wine { ok( status == STATUS_SUCCESS, "NtQueryVolumeInformationFile failed: %x\n", status ); ok( iosb.Information == sizeof(*device_info), "Information = %lu\n", iosb.Information ); device_info = (FILE_FS_DEVICE_INFORMATION*)buffer; ok( device_info->DeviceType == FILE_DEVICE_NAMED_PIPE, "DeviceType = %u\n", device_info->DeviceType ); ok( !(device_info->Characteristics & ~FILE_DEVICE_ALLOW_APPCONTAINER_TRAVERSAL), "Characteristics = %x\n", device_info->Characteristics ); - } memset( buffer, 0xaa, sizeof(buffer) ); status = pNtQueryVolumeInformationFile( write, &iosb, buffer, sizeof(buffer), FileFsDeviceInformation ); - todo_wine { ok( status == STATUS_SUCCESS, "NtQueryVolumeInformationFile failed: %x\n", status ); ok( iosb.Information == sizeof(*device_info), "Information = %lu\n", iosb.Information ); device_info = (FILE_FS_DEVICE_INFORMATION*)buffer; ok( device_info->DeviceType == FILE_DEVICE_NAMED_PIPE, "DeviceType = %u\n", device_info->DeviceType ); ok( !(device_info->Characteristics & ~FILE_DEVICE_ALLOW_APPCONTAINER_TRAVERSAL), "Characteristics = %x\n", device_info->Characteristics ); - } CloseHandle( read ); CloseHandle( write ); diff --git a/server/named_pipe.c b/server/named_pipe.c index 6dd2fd628a2..d0ec38f36c6 100644 --- a/server/named_pipe.c +++ b/server/named_pipe.c @@ -156,6 +156,7 @@ static const struct object_ops named_pipe_ops = static enum server_fd_type pipe_end_get_fd_type( struct fd *fd ); static int pipe_end_read( struct fd *fd, struct async *async, file_pos_t pos ); static int pipe_end_write( struct fd *fd, struct async *async_data, file_pos_t pos ); +static void pipe_end_get_volume_info( struct fd *fd, unsigned int info_class ); static void pipe_end_queue_async( struct fd *fd, struct async *async, int type, int count ); static void pipe_end_reselect_async( struct fd *fd, struct async_queue *queue ); @@ -196,7 +197,7 @@ static const struct fd_ops pipe_server_fd_ops = pipe_end_read, /* read */ pipe_end_write, /* write */ pipe_server_flush, /* flush */ - no_fd_get_volume_info, /* get_volume_info */ + pipe_end_get_volume_info, /* get_volume_info */ pipe_server_ioctl, /* ioctl */ pipe_end_queue_async, /* queue_async */ pipe_end_reselect_async /* reselect_async */ @@ -240,7 +241,7 @@ static const struct fd_ops pipe_client_fd_ops = pipe_end_read, /* read */ pipe_end_write, /* write */ pipe_client_flush, /* flush */ - no_fd_get_volume_info, /* get_volume_info */ + pipe_end_get_volume_info, /* get_volume_info */ pipe_client_ioctl, /* ioctl */ pipe_end_queue_async, /* queue_async */ pipe_end_reselect_async /* reselect_async */ @@ -685,6 +686,28 @@ static int pipe_client_flush( struct fd *fd, struct async *async ) return use_server_io( pipe_end ) ? pipe_end_flush( pipe_end, async ) : 1; } +static void pipe_end_get_volume_info( struct fd *fd, unsigned int info_class ) +{ + switch (info_class) + { + case FileFsDeviceInformation: + { + static const FILE_FS_DEVICE_INFORMATION device_info = + { + FILE_DEVICE_NAMED_PIPE, + FILE_DEVICE_ALLOW_APPCONTAINER_TRAVERSAL + }; + if (get_reply_max_size() >= sizeof(device_info)) + set_reply_data( &device_info, sizeof(device_info) ); + else + set_error( STATUS_BUFFER_TOO_SMALL ); + break; + } + default: + set_error( STATUS_NOT_IMPLEMENTED ); + } +} + static void message_queue_read( struct pipe_end *pipe_end, struct iosb *iosb ) { struct pipe_message *message;