Jacek Caban : server: Return proper object type for mailslot and device files.
Alexandre Julliard
julliard at winehq.org
Fri Feb 22 15:22:11 CST 2019
Module: wine
Branch: master
Commit: 6531f79d8d5ff65fba37b431e0b9326cfaa1ffc9
URL: https://source.winehq.org/git/wine.git/?a=commit;h=6531f79d8d5ff65fba37b431e0b9326cfaa1ffc9
Author: Jacek Caban <jacek at codeweavers.com>
Date: Fri Feb 22 13:14:34 2019 +0100
server: Return proper object type for mailslot and device files.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntdll/tests/om.c | 3 +++
server/device.c | 2 +-
server/file.c | 3 +--
server/file.h | 1 +
server/mailslot.c | 4 ++--
server/named_pipe.c | 12 ++----------
6 files changed, 10 insertions(+), 15 deletions(-)
diff --git a/dlls/ntdll/tests/om.c b/dlls/ntdll/tests/om.c
index 3110dbf..3f627aa 100644
--- a/dlls/ntdll/tests/om.c
+++ b/dlls/ntdll/tests/om.c
@@ -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");
diff --git a/server/device.c b/server/device.c
index ac7d88f..cae66d4 100644
--- a/server/device.c
+++ b/server/device.c
@@ -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 */
diff --git a/server/file.c b/server/file.c
index 8d39f30..7ca650f 100644
--- a/server/file.c
+++ b/server/file.c
@@ -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) };
diff --git a/server/file.h b/server/file.h
index 6b67866..0621b47 100644
--- a/server/file.h
+++ b/server/file.h
@@ -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 );
diff --git a/server/mailslot.c b/server/mailslot.c
index 95308c4..75a397d 100644
--- a/server/mailslot.c
+++ b/server/mailslot.c
@@ -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 */
diff --git a/server/named_pipe.c b/server/named_pipe.c
index 8c32ef8..101ff63 100644
--- a/server/named_pipe.c
+++ b/server/named_pipe.c
@@ -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;
More information about the wine-cvs
mailing list