Commit d4d6330f authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

server: Add support for querying FileNameInformation on named pipes.

parent 6b08e60f
...@@ -1168,9 +1168,7 @@ static void _test_file_name(unsigned line, HANDLE pipe) ...@@ -1168,9 +1168,7 @@ static void _test_file_name(unsigned line, HANDLE pipe)
memset( buffer, 0xaa, sizeof(buffer) ); memset( buffer, 0xaa, sizeof(buffer) );
memset( &iosb, 0xaa, sizeof(iosb) ); memset( &iosb, 0xaa, sizeof(iosb) );
status = NtQueryInformationFile( pipe, &iosb, buffer, sizeof(buffer), FileNameInformation ); status = NtQueryInformationFile( pipe, &iosb, buffer, sizeof(buffer), FileNameInformation );
todo_wine
ok_(__FILE__,line)( status == STATUS_SUCCESS, "NtQueryInformationFile failed: %x\n", status ); ok_(__FILE__,line)( status == STATUS_SUCCESS, "NtQueryInformationFile failed: %x\n", status );
if (status) return;
ok_(__FILE__,line)( iosb.Status == STATUS_SUCCESS, "Status = %x\n", iosb.Status ); ok_(__FILE__,line)( iosb.Status == STATUS_SUCCESS, "Status = %x\n", iosb.Status );
ok_(__FILE__,line)( iosb.Information == sizeof(name_info->FileNameLength) + sizeof(nameW), ok_(__FILE__,line)( iosb.Information == sizeof(name_info->FileNameLength) + sizeof(nameW),
"Information = %lu\n", iosb.Information ); "Information = %lu\n", iosb.Information );
...@@ -1205,7 +1203,6 @@ static void test_file_info(void) ...@@ -1205,7 +1203,6 @@ static void test_file_info(void)
test_file_name( server ); test_file_name( server );
DisconnectNamedPipe( server ); DisconnectNamedPipe( server );
todo_wine
test_file_name_fail( client, STATUS_PIPE_DISCONNECTED ); test_file_name_fail( client, STATUS_PIPE_DISCONNECTED );
CloseHandle( server ); CloseHandle( server );
......
...@@ -152,6 +152,7 @@ static void pipe_end_reselect_async( struct fd *fd, struct async_queue *queue ); ...@@ -152,6 +152,7 @@ static void pipe_end_reselect_async( struct fd *fd, struct async_queue *queue );
static void pipe_server_dump( struct object *obj, int verbose ); static void pipe_server_dump( struct object *obj, int verbose );
static void pipe_server_destroy( struct object *obj); static void pipe_server_destroy( struct object *obj);
static int pipe_server_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); static int pipe_server_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
static void pipe_server_get_file_info( struct fd *fd, unsigned int info_class );
static const struct object_ops pipe_server_ops = static const struct object_ops pipe_server_ops =
{ {
...@@ -183,7 +184,7 @@ static const struct fd_ops pipe_server_fd_ops = ...@@ -183,7 +184,7 @@ static const struct fd_ops pipe_server_fd_ops =
pipe_end_read, /* read */ pipe_end_read, /* read */
pipe_end_write, /* write */ pipe_end_write, /* write */
pipe_end_flush, /* flush */ pipe_end_flush, /* flush */
no_fd_get_file_info, /* get_file_info */ pipe_server_get_file_info, /* get_file_info */
pipe_end_get_volume_info, /* get_volume_info */ pipe_end_get_volume_info, /* get_volume_info */
pipe_server_ioctl, /* ioctl */ pipe_server_ioctl, /* ioctl */
no_fd_queue_async, /* queue_async */ no_fd_queue_async, /* queue_async */
...@@ -194,6 +195,7 @@ static const struct fd_ops pipe_server_fd_ops = ...@@ -194,6 +195,7 @@ static const struct fd_ops pipe_server_fd_ops =
static void pipe_client_dump( struct object *obj, int verbose ); static void pipe_client_dump( struct object *obj, int verbose );
static void pipe_client_destroy( struct object *obj ); static void pipe_client_destroy( struct object *obj );
static int pipe_client_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); static int pipe_client_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
static void pipe_client_get_file_info( struct fd *fd, unsigned int info_class );
static const struct object_ops pipe_client_ops = static const struct object_ops pipe_client_ops =
{ {
...@@ -225,7 +227,7 @@ static const struct fd_ops pipe_client_fd_ops = ...@@ -225,7 +227,7 @@ static const struct fd_ops pipe_client_fd_ops =
pipe_end_read, /* read */ pipe_end_read, /* read */
pipe_end_write, /* write */ pipe_end_write, /* write */
pipe_end_flush, /* flush */ pipe_end_flush, /* flush */
no_fd_get_file_info, /* get_file_info */ pipe_client_get_file_info, /* get_file_info */
pipe_end_get_volume_info, /* get_volume_info */ pipe_end_get_volume_info, /* get_volume_info */
pipe_client_ioctl, /* ioctl */ pipe_client_ioctl, /* ioctl */
no_fd_queue_async, /* queue_async */ no_fd_queue_async, /* queue_async */
...@@ -545,6 +547,55 @@ static int pipe_end_flush( struct fd *fd, struct async *async ) ...@@ -545,6 +547,55 @@ static int pipe_end_flush( struct fd *fd, struct async *async )
return 1; return 1;
} }
static void pipe_end_get_file_info( struct fd *fd, struct named_pipe *pipe, unsigned int info_class )
{
switch (info_class)
{
case FileNameInformation:
{
FILE_NAME_INFORMATION *name_info;
data_size_t name_len, reply_size;
const WCHAR *name;
if (get_reply_max_size() < sizeof(*name_info))
{
set_error( STATUS_INFO_LENGTH_MISMATCH );
return;
}
name = get_object_name( &pipe->obj, &name_len );
reply_size = offsetof( FILE_NAME_INFORMATION, FileName[name_len/sizeof(WCHAR) + 1] );
if (reply_size > get_reply_max_size())
{
reply_size = get_reply_max_size();
set_error( STATUS_BUFFER_OVERFLOW );
}
if (!(name_info = set_reply_data_size( reply_size ))) return;
name_info->FileNameLength = name_len + sizeof(WCHAR);
name_info->FileName[0] = '\\';
reply_size -= offsetof( FILE_NAME_INFORMATION, FileName[1] );
if (reply_size) memcpy( &name_info->FileName[1], name, reply_size );
break;
}
default:
no_fd_get_file_info( fd, info_class );
}
}
static void pipe_server_get_file_info( struct fd *fd, unsigned int info_class )
{
struct pipe_server *server = get_fd_user( fd );
pipe_end_get_file_info( fd, server->pipe, info_class );
}
static void pipe_client_get_file_info( struct fd *fd, unsigned int info_class )
{
struct pipe_client *client = get_fd_user( fd );
if (client->server) pipe_end_get_file_info( fd, client->server->pipe, info_class );
else set_error( STATUS_PIPE_DISCONNECTED );
}
static void pipe_end_get_volume_info( struct fd *fd, unsigned int info_class ) static void pipe_end_get_volume_info( struct fd *fd, unsigned int info_class )
{ {
switch (info_class) switch (info_class)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment