Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/ntdll/tests/om.c | 10 ++++------ server/named_pipe.c | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/dlls/ntdll/tests/om.c b/dlls/ntdll/tests/om.c index 29c777e91e6..916ac8cbe76 100644 --- a/dlls/ntdll/tests/om.c +++ b/dlls/ntdll/tests/om.c @@ -1227,9 +1227,8 @@ static BOOL compare_unicode_string( const UNICODE_STRING *string, const WCHAR *e && !wcsnicmp( string->Buffer, expect, string->Length / sizeof(WCHAR) ); }
-#define test_object_type(a,b) _test_object_type(__LINE__,a,b,FALSE) -#define test_object_type_todo(a,b) _test_object_type(__LINE__,a,b,TRUE) -static void _test_object_type( unsigned line, HANDLE handle, const WCHAR *expected_name, BOOL todo ) +#define test_object_type(a,b) _test_object_type(__LINE__,a,b) +static void _test_object_type( unsigned line, HANDLE handle, const WCHAR *expected_name ) { char buffer[1024]; UNICODE_STRING *str = (UNICODE_STRING *)buffer, expect; @@ -1243,8 +1242,7 @@ static void _test_object_type( unsigned line, HANDLE handle, const WCHAR *expect ok_(__FILE__,line)( status == STATUS_SUCCESS, "NtQueryObject failed %x\n", status ); ok_(__FILE__,line)( len > sizeof(UNICODE_STRING), "unexpected len %u\n", len ); ok_(__FILE__,line)( len >= sizeof(OBJECT_TYPE_INFORMATION) + str->Length, "unexpected len %u\n", len ); - todo_wine_if (todo) - ok_(__FILE__,line)(compare_unicode_string( str, expected_name ), "wrong name %s\n", debugstr_w( str->Buffer )); + ok_(__FILE__,line)(compare_unicode_string( str, expected_name ), "wrong name %s\n", debugstr_w( str->Buffer )); }
#define test_object_name(a,b,c) _test_object_name(__LINE__,a,b,c) @@ -1463,7 +1461,7 @@ static void test_query_object(void) ok( handle != INVALID_HANDLE_VALUE, "CreateFile failed (%d)\n", GetLastError() );
test_object_name( handle, L"\Device\NamedPipe", TRUE ); - test_object_type_todo( handle, L"File" ); + test_object_type( handle, L"File" ); test_file_info( handle );
pNtClose( handle ); diff --git a/server/named_pipe.c b/server/named_pipe.c index b259abb8de4..e7e5436c0e5 100644 --- a/server/named_pipe.c +++ b/server/named_pipe.c @@ -273,7 +273,7 @@ static const struct object_ops named_pipe_device_file_ops = { sizeof(struct named_pipe_device_file), /* size */ named_pipe_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 */
Based on a patch by Sebastian Lackner.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/ntdll/tests/om.c | 3 ++- server/named_pipe.c | 27 +++++++++++++++++++++------ server/object.c | 6 +++--- server/object.h | 3 +++ 4 files changed, 29 insertions(+), 10 deletions(-)
diff --git a/dlls/ntdll/tests/om.c b/dlls/ntdll/tests/om.c index 916ac8cbe76..ef050b062b2 100644 --- a/dlls/ntdll/tests/om.c +++ b/dlls/ntdll/tests/om.c @@ -1443,7 +1443,7 @@ static void test_query_object(void) 1, 1000, 1000, 1000, NULL ); ok( handle != INVALID_HANDLE_VALUE, "CreateNamedPipe failed err %u\n", GetLastError() );
- test_object_name( handle, L"\Device\NamedPipe\test_pipe", TRUE ); + test_object_name( handle, L"\Device\NamedPipe\test_pipe", FALSE ); test_object_type( handle, L"File" ); test_file_info( handle );
@@ -1451,6 +1451,7 @@ static void test_query_object(void) 0, NULL, OPEN_EXISTING, 0, 0 ); ok( client != INVALID_HANDLE_VALUE, "CreateFile failed (%d)\n", GetLastError() );
+ test_object_name( handle, L"\Device\NamedPipe\test_pipe", FALSE ); test_object_type( client, L"File" ); test_file_info( client );
diff --git a/server/named_pipe.c b/server/named_pipe.c index e7e5436c0e5..2c7c45c2336 100644 --- a/server/named_pipe.c +++ b/server/named_pipe.c @@ -140,6 +140,8 @@ static struct fd *pipe_end_get_fd( struct object *obj ); static struct security_descriptor *pipe_end_get_sd( struct object *obj ); static int pipe_end_set_sd( struct object *obj, const struct security_descriptor *sd, unsigned int set_info ); +static int pipe_end_link_name( struct object *obj, struct object_name *name, struct object *parent ); +static void pipe_end_unlink_name( struct object *obj, struct object_name *name ); 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 int pipe_end_flush( struct fd *fd, struct async *async ); @@ -167,8 +169,8 @@ static const struct object_ops pipe_server_ops = pipe_end_get_sd, /* get_sd */ pipe_end_set_sd, /* set_sd */ no_lookup_name, /* lookup_name */ - no_link_name, /* link_name */ - NULL, /* unlink_name */ + pipe_end_link_name, /* link_name */ + pipe_end_unlink_name, /* unlink_name */ no_open_file, /* open_file */ no_kernel_obj_list, /* get_kernel_obj_list */ fd_close_handle, /* close_handle */ @@ -209,8 +211,8 @@ static const struct object_ops pipe_client_ops = pipe_end_get_sd, /* get_sd */ pipe_end_set_sd, /* set_sd */ no_lookup_name, /* lookup_name */ - no_link_name, /* link_name */ - NULL, /* unlink_name */ + pipe_end_link_name, /* link_name */ + pipe_end_unlink_name, /* unlink_name */ no_open_file, /* open_file */ no_kernel_obj_list, /* get_kernel_obj_list */ fd_close_handle, /* close_handle */ @@ -699,6 +701,17 @@ static int pipe_end_set_sd( struct object *obj, const struct security_descriptor return 0; }
+static int pipe_end_link_name( struct object *obj, struct object_name *name, struct object *parent ) +{ + assert( parent->ops == &named_pipe_device_ops ); + name->parent = grab_object( parent ); + return 1; +} + +static void pipe_end_unlink_name( struct object *obj, struct object_name *name ) +{ +} + static void pipe_end_get_volume_info( struct fd *fd, unsigned int info_class ) { switch (info_class) @@ -1185,9 +1198,10 @@ static void init_pipe_end( struct pipe_end *pipe_end, struct named_pipe *pipe, static struct pipe_server *create_pipe_server( struct named_pipe *pipe, unsigned int options, unsigned int pipe_flags ) { + struct unicode_str name = { pipe->obj.name->name, pipe->obj.name->len }; struct pipe_server *server;
- server = alloc_object( &pipe_server_ops ); + server = create_object( pipe->obj.name->parent, &pipe_server_ops, &name, 0, NULL ); if (!server) return NULL;
@@ -1211,9 +1225,10 @@ static struct pipe_server *create_pipe_server( struct named_pipe *pipe, unsigned
static struct pipe_end *create_pipe_client( struct named_pipe *pipe, data_size_t buffer_size, unsigned int options ) { + struct unicode_str name = { pipe->obj.name->name, pipe->obj.name->len }; struct pipe_end *client;
- client = alloc_object( &pipe_client_ops ); + client = create_object( pipe->obj.name->parent, &pipe_client_ops, &name, 0, NULL ); if (!client) return NULL;
diff --git a/server/object.c b/server/object.c index 8ec6609f69d..165e215be2b 100644 --- a/server/object.c +++ b/server/object.c @@ -277,9 +277,9 @@ data_size_t get_path_element( const WCHAR *name, data_size_t len ) return i * sizeof(WCHAR); }
-static struct object *create_object( struct object *parent, const struct object_ops *ops, - const struct unicode_str *name, unsigned int attributes, - const struct security_descriptor *sd ) +void *create_object( struct object *parent, const struct object_ops *ops, + const struct unicode_str *name, unsigned int attributes, + const struct security_descriptor *sd ) { struct object *obj; struct object_name *name_ptr; diff --git a/server/object.h b/server/object.h index 1f5c4a5f061..a6a5e2c5f8f 100644 --- a/server/object.h +++ b/server/object.h @@ -137,6 +137,9 @@ extern void dump_object_name( struct object *obj ); extern struct object *lookup_named_object( struct object *root, const struct unicode_str *name, unsigned int attr, struct unicode_str *name_left ); extern data_size_t get_path_element( const WCHAR *name, data_size_t len ); +extern void *create_object( struct object *parent, const struct object_ops *ops, + const struct unicode_str *name, unsigned int attributes, + const struct security_descriptor *sd ); extern void *create_named_object( struct object *parent, const struct object_ops *ops, const struct unicode_str *name, unsigned int attributes, const struct security_descriptor *sd );
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/ntdll/tests/om.c | 2 +- server/named_pipe.c | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/dlls/ntdll/tests/om.c b/dlls/ntdll/tests/om.c index ef050b062b2..be617ce8a1c 100644 --- a/dlls/ntdll/tests/om.c +++ b/dlls/ntdll/tests/om.c @@ -1461,7 +1461,7 @@ static void test_query_object(void) handle = CreateFileA( "\\.\pipe", 0, 0, NULL, OPEN_EXISTING, 0, 0 ); ok( handle != INVALID_HANDLE_VALUE, "CreateFile failed (%d)\n", GetLastError() );
- test_object_name( handle, L"\Device\NamedPipe", TRUE ); + test_object_name( handle, L"\Device\NamedPipe", FALSE ); test_object_type( handle, L"File" ); test_file_info( handle );
diff --git a/server/named_pipe.c b/server/named_pipe.c index 2c7c45c2336..17d741263c0 100644 --- a/server/named_pipe.c +++ b/server/named_pipe.c @@ -267,6 +267,8 @@ static const struct object_ops named_pipe_device_ops =
static void named_pipe_device_file_dump( struct object *obj, int verbose ); static struct fd *named_pipe_device_file_get_fd( struct object *obj ); +static int named_pipe_device_file_link_name( struct object *obj, struct object_name *name, struct object *parent ); +static void named_pipe_device_file_unlink_name( struct object *obj, struct object_name *name ); static int named_pipe_device_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); static enum server_fd_type named_pipe_device_file_get_fd_type( struct fd *fd ); static void named_pipe_device_file_destroy( struct object *obj ); @@ -286,8 +288,8 @@ static const struct object_ops named_pipe_device_file_ops = default_get_sd, /* get_sd */ default_set_sd, /* set_sd */ no_lookup_name, /* lookup_name */ - no_link_name, /* link_name */ - NULL, /* unlink_name */ + named_pipe_device_file_link_name, /* link_name */ + named_pipe_device_file_unlink_name, /* unlink_name */ no_open_file, /* open_file */ no_kernel_obj_list, /* get_kernel_obj_list */ fd_close_handle, /* close_handle */ @@ -482,9 +484,10 @@ static struct object *named_pipe_device_lookup_name( struct object *obj, struct static struct object *named_pipe_device_open_file( struct object *obj, unsigned int access, unsigned int sharing, unsigned int options ) { + struct unicode_str name = { obj->name->name, obj->name->len }; struct named_pipe_device_file *file;
- if (!(file = alloc_object( &named_pipe_device_file_ops ))) return NULL; + if (!(file = create_object( obj->name->parent, &named_pipe_device_file_ops, &name, 0, NULL ))) return NULL; file->device = (struct named_pipe_device *)grab_object( obj ); if (!(file->fd = alloc_pseudo_fd( &named_pipe_device_fd_ops, obj, options ))) { @@ -532,6 +535,16 @@ static struct fd *named_pipe_device_file_get_fd( struct object *obj ) return (struct fd *)grab_object( file->fd ); }
+static int named_pipe_device_file_link_name( struct object *obj, struct object_name *name, struct object *parent ) +{ + name->parent = grab_object( parent ); + return 1; +} + +static void named_pipe_device_file_unlink_name( struct object *obj, struct object_name *name ) +{ +} + static enum server_fd_type named_pipe_device_file_get_fd_type( struct fd *fd ) { return FD_TYPE_DEVICE;
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=77221
Your paranoid android.
=== debiant (32 bit French report) ===
ntdll: om.c:2005: Test failed: got 86
Is there any plan or decision with regards to these patches?
I am curious because of the functionality covered by the test I just sent [1]. Marvel's Avengers game (and probably some coming ones, as this is probably related to Denuvo anticheat) depends on that. The possible implementation largely depends on the patch series [2] (or alternative if the one will be chosen).
1. https://source.winehq.org/patches/data/193014 2. https://www.winehq.org/pipermail/wine-devel/2020-August/171939.html
On 8/17/20 03:36, Zebediah Figura wrote:
Signed-off-by: Zebediah Figura z.figura12@gmail.com
dlls/ntdll/tests/om.c | 2 +- server/named_pipe.c | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/dlls/ntdll/tests/om.c b/dlls/ntdll/tests/om.c index ef050b062b2..be617ce8a1c 100644 --- a/dlls/ntdll/tests/om.c +++ b/dlls/ntdll/tests/om.c @@ -1461,7 +1461,7 @@ static void test_query_object(void) handle = CreateFileA( "\\.\pipe", 0, 0, NULL, OPEN_EXISTING, 0, 0 ); ok( handle != INVALID_HANDLE_VALUE, "CreateFile failed (%d)\n", GetLastError() );
- test_object_name( handle, L"\Device\NamedPipe", TRUE );
- test_object_name( handle, L"\Device\NamedPipe", FALSE ); test_object_type( handle, L"File" ); test_file_info( handle );
diff --git a/server/named_pipe.c b/server/named_pipe.c index 2c7c45c2336..17d741263c0 100644 --- a/server/named_pipe.c +++ b/server/named_pipe.c @@ -267,6 +267,8 @@ static const struct object_ops named_pipe_device_ops =
static void named_pipe_device_file_dump( struct object *obj, int verbose ); static struct fd *named_pipe_device_file_get_fd( struct object *obj ); +static int named_pipe_device_file_link_name( struct object *obj, struct object_name *name, struct object *parent ); +static void named_pipe_device_file_unlink_name( struct object *obj, struct object_name *name ); static int named_pipe_device_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); static enum server_fd_type named_pipe_device_file_get_fd_type( struct fd *fd ); static void named_pipe_device_file_destroy( struct object *obj ); @@ -286,8 +288,8 @@ static const struct object_ops named_pipe_device_file_ops = default_get_sd, /* get_sd */ default_set_sd, /* set_sd */ no_lookup_name, /* lookup_name */
- no_link_name, /* link_name */
- NULL, /* unlink_name */
- named_pipe_device_file_link_name, /* link_name */
- named_pipe_device_file_unlink_name, /* unlink_name */ no_open_file, /* open_file */ no_kernel_obj_list, /* get_kernel_obj_list */ fd_close_handle, /* close_handle */
@@ -482,9 +484,10 @@ static struct object *named_pipe_device_lookup_name( struct object *obj, struct static struct object *named_pipe_device_open_file( struct object *obj, unsigned int access, unsigned int sharing, unsigned int options ) {
- struct unicode_str name = { obj->name->name, obj->name->len }; struct named_pipe_device_file *file;
- if (!(file = alloc_object( &named_pipe_device_file_ops ))) return NULL;
- if (!(file = create_object( obj->name->parent, &named_pipe_device_file_ops, &name, 0, NULL ))) return NULL; file->device = (struct named_pipe_device *)grab_object( obj ); if (!(file->fd = alloc_pseudo_fd( &named_pipe_device_fd_ops, obj, options ))) {
@@ -532,6 +535,16 @@ static struct fd *named_pipe_device_file_get_fd( struct object *obj ) return (struct fd *)grab_object( file->fd ); }
+static int named_pipe_device_file_link_name( struct object *obj, struct object_name *name, struct object *parent ) +{
- name->parent = grab_object( parent );
- return 1;
+}
+static void named_pipe_device_file_unlink_name( struct object *obj, struct object_name *name ) +{ +}
- static enum server_fd_type named_pipe_device_file_get_fd_type( struct fd *fd ) { return FD_TYPE_DEVICE;