server: Return proper object type for mailslot and device files.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2019-02-22 13:14:34 +01:00 committed by Alexandre Julliard
parent c55c4ab88c
commit 6531f79d8d
6 changed files with 10 additions and 15 deletions

View File

@ -1500,6 +1500,7 @@ static void test_query_object(void)
"name too short %s\n", wine_dbgstr_w(str->Buffer) );
trace( "got %s len %u\n", wine_dbgstr_w(str->Buffer), len );
test_object_type( handle, "File" );
test_file_info( handle );
pNtClose( handle );
@ -1858,6 +1859,8 @@ static void test_null_device(void)
ok(status == STATUS_SUCCESS,
"expected STATUS_SUCCESS, got %08x\n", status);
test_object_type(null, "File");
SetLastError(0xdeadbeef);
ret = WriteFile(null, buf, sizeof(buf), &num_bytes, NULL);
ok(!ret, "WriteFile unexpectedly succeeded\n");

View File

@ -183,7 +183,7 @@ static const struct object_ops device_file_ops =
{
sizeof(struct device_file), /* size */
device_file_dump, /* dump */
no_get_type, /* get_type */
file_get_type, /* get_type */
add_queue, /* add_queue */
remove_queue, /* remove_queue */
default_fd_signaled, /* signaled */

View File

@ -64,7 +64,6 @@ struct file
static unsigned int generic_file_map_access( unsigned int access );
static void file_dump( struct object *obj, int verbose );
static struct object_type *file_get_type( struct object *obj );
static struct fd *file_get_fd( struct object *obj );
static struct security_descriptor *file_get_sd( struct object *obj );
static int file_set_sd( struct object *obj, const struct security_descriptor *sd, unsigned int set_info );
@ -269,7 +268,7 @@ static void file_dump( struct object *obj, int verbose )
fprintf( stderr, "File fd=%p\n", file->fd );
}
static struct object_type *file_get_type( struct object *obj )
struct object_type *file_get_type( struct object *obj )
{
static const WCHAR name[] = {'F','i','l','e'};
static const struct unicode_str str = { name, sizeof(name) };

View File

@ -146,6 +146,7 @@ extern int get_file_unix_fd( struct file *file );
extern struct file *create_file_for_fd( int fd, unsigned int access, unsigned int sharing );
extern struct file *create_file_for_fd_obj( struct fd *fd, unsigned int access, unsigned int sharing );
extern void file_set_error(void);
extern struct object_type *file_get_type( struct object *obj );
extern struct security_descriptor *mode_to_sd( mode_t mode, const SID *user, const SID *group );
extern mode_t sd_to_mode( const struct security_descriptor *sd, const SID *owner );

View File

@ -75,7 +75,7 @@ static const struct object_ops mailslot_ops =
{
sizeof(struct mailslot), /* size */
mailslot_dump, /* dump */
no_get_type, /* get_type */
file_get_type, /* get_type */
add_queue, /* add_queue */
remove_queue, /* remove_queue */
default_fd_signaled, /* signaled */
@ -131,7 +131,7 @@ static const struct object_ops mail_writer_ops =
{
sizeof(struct mail_writer), /* size */
mail_writer_dump, /* dump */
no_get_type, /* get_type */
file_get_type, /* get_type */
no_add_queue, /* add_queue */
NULL, /* remove_queue */
NULL, /* signaled */

View File

@ -134,7 +134,6 @@ static const struct object_ops named_pipe_ops =
/* common server and client pipe end functions */
static void pipe_end_destroy( struct object *obj );
static struct object_type *pipe_end_get_type( struct object *obj );
static enum server_fd_type pipe_end_get_fd_type( struct fd *fd );
static struct fd *pipe_end_get_fd( struct object *obj );
static struct security_descriptor *pipe_end_get_sd( struct object *obj );
@ -156,7 +155,7 @@ static const struct object_ops pipe_server_ops =
{
sizeof(struct pipe_server), /* size */
pipe_server_dump, /* dump */
pipe_end_get_type, /* get_type */
file_get_type, /* get_type */
add_queue, /* add_queue */
remove_queue, /* remove_queue */
default_fd_signaled, /* signaled */
@ -197,7 +196,7 @@ static const struct object_ops pipe_client_ops =
{
sizeof(struct pipe_end), /* size */
pipe_client_dump, /* dump */
pipe_end_get_type, /* get_type */
file_get_type, /* get_type */
add_queue, /* add_queue */
remove_queue, /* remove_queue */
default_fd_signaled, /* signaled */
@ -341,13 +340,6 @@ static void named_pipe_destroy( struct object *obj)
free_async_queue( &pipe->waiters );
}
static struct object_type *pipe_end_get_type( struct object *obj )
{
static const WCHAR name[] = {'F','i','l','e'};
static const struct unicode_str str = { name, sizeof(name) };
return get_object_type( &str );
}
static struct fd *pipe_end_get_fd( struct object *obj )
{
struct pipe_end *pipe_end = (struct pipe_end *) obj;