Signed-off-by: Jinoh Kang jinoh.kang.kr@gmail.com --- dlls/ntdll/tests/om.c | 30 ++++++++++++++++++++++++++++++ server/named_pipe.c | 9 ++++++++- 2 files changed, 38 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/tests/om.c b/dlls/ntdll/tests/om.c index 77eb58a23b5..1b6d9d2d2d1 100644 --- a/dlls/ntdll/tests/om.c +++ b/dlls/ntdll/tests/om.c @@ -197,6 +197,35 @@ static void test_namespace_pipe(void) pNtClose(pipe); }
+static void test_pipe_device_file_as_root(void) +{ + OBJECT_ATTRIBUTES attr; + UNICODE_STRING str; + IO_STATUS_BLOCK iosb; + NTSTATUS status; + LARGE_INTEGER timeout; + HANDLE pipe, root, h; + + pRtlInitUnicodeString(&str, L"\Device\NamedPipe"); + InitializeObjectAttributes(&attr, &str, 0, 0, NULL); + status = pNtOpenFile(&root, GENERIC_READ, &attr, &iosb, FILE_SHARE_READ|FILE_SHARE_WRITE, 0); + ok(status == STATUS_SUCCESS, "NtOpenFile should have succeeded got %08x\n", status); + + pRtlInitUnicodeString(&str, L"test2\pipe"); + InitializeObjectAttributes(&attr, &str, 0, root, NULL); + status = pNtCreateNamedPipeFile(&pipe, GENERIC_READ|GENERIC_WRITE, &attr, &iosb, FILE_SHARE_READ|FILE_SHARE_WRITE, + FILE_CREATE, FILE_PIPE_FULL_DUPLEX, FALSE, FALSE, FALSE, 1, 256, 256, &timeout); + ok(status == STATUS_SUCCESS, "Failed to create NamedPipe(%08x)\n", status); + + h = CreateFileA("\\.\pipe\test2\pipe", GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, + OPEN_EXISTING, 0, 0 ); + ok(h != INVALID_HANDLE_VALUE, "Failed to open NamedPipe (%u)\n", GetLastError()); + + pNtClose(h); + pNtClose(pipe); + pNtClose(root); +} + #define check_create_open_dir(parent, name, status) check_create_open_dir_(__LINE__, parent, name, status) static void check_create_open_dir_( int line, HANDLE parent, const WCHAR *name, NTSTATUS expect ) { @@ -2434,6 +2463,7 @@ START_TEST(om)
test_case_sensitive(); test_namespace_pipe(); + test_pipe_device_file_as_root(); test_name_collisions(); test_name_limits(); test_directory(); diff --git a/server/named_pipe.c b/server/named_pipe.c index 1bbf7f17a3a..22971c4752f 100644 --- a/server/named_pipe.c +++ b/server/named_pipe.c @@ -1278,13 +1278,20 @@ static struct pipe_end *create_pipe_client( struct named_pipe *pipe, data_size_t
static int named_pipe_link_name( struct object *obj, struct object_name *name, struct object *parent ) { - struct named_pipe_device *dev = (struct named_pipe_device *)parent; + struct named_pipe_device *dev; + + if (parent->ops == &named_pipe_device_file_ops) + { + parent = &((struct named_pipe_device_file *)parent)->device->obj; + }
if (parent->ops != &named_pipe_device_ops) { set_error( STATUS_OBJECT_NAME_INVALID ); return 0; } + + dev = (struct named_pipe_device *)parent; namespace_add( dev->pipes, name ); name->parent = grab_object( parent ); return 1;
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=102671
Your paranoid android.
=== w7u_2qxl (32 bit report) ===
ntdll: om.c:218: Test failed: Failed to create NamedPipe(c0000033) om.c:222: Test failed: Failed to open NamedPipe (2)
=== w7u_adm (32 bit report) ===
ntdll: om.c:218: Test failed: Failed to create NamedPipe(c0000033) om.c:222: Test failed: Failed to open NamedPipe (2)
=== w7u_el (32 bit report) ===
ntdll: om.c:218: Test failed: Failed to create NamedPipe(c0000033) om.c:222: Test failed: Failed to open NamedPipe (2)
=== w8 (32 bit report) ===
ntdll: om.c:218: Test failed: Failed to create NamedPipe(c0000033) om.c:222: Test failed: Failed to open NamedPipe (2)
=== w8adm (32 bit report) ===
ntdll: om.c:218: Test failed: Failed to create NamedPipe(c0000033) om.c:222: Test failed: Failed to open NamedPipe (2)
=== w864 (32 bit report) ===
ntdll: om.c:218: Test failed: Failed to create NamedPipe(c0000033) om.c:222: Test failed: Failed to open NamedPipe (2)
=== w1064v1507 (32 bit report) ===
ntdll: om.c:218: Test failed: Failed to create NamedPipe(c0000033) om.c:222: Test failed: Failed to open NamedPipe (2)
=== w1064v1809 (32 bit report) ===
ntdll: om.c:218: Test failed: Failed to create NamedPipe(c0000033) om.c:222: Test failed: Failed to open NamedPipe (2)
=== w1064 (32 bit report) ===
ntdll: om.c:218: Test failed: Failed to create NamedPipe(c0000033) om.c:222: Test failed: Failed to open NamedPipe (2)
=== w1064_tsign (32 bit report) ===
ntdll: om.c:218: Test failed: Failed to create NamedPipe(c0000033) om.c:222: Test failed: Failed to open NamedPipe (2)
=== w10pro64 (32 bit report) ===
ntdll: om.c:218: Test failed: Failed to create NamedPipe(c0000033) om.c:222: Test failed: Failed to open NamedPipe (2)
=== w864 (64 bit report) ===
ntdll: om.c:218: Test failed: Failed to create NamedPipe(c0000033) om.c:222: Test failed: Failed to open NamedPipe (2)
=== w1064v1507 (64 bit report) ===
ntdll: om.c:218: Test failed: Failed to create NamedPipe(c0000033) om.c:222: Test failed: Failed to open NamedPipe (2)
=== w1064v1809 (64 bit report) ===
ntdll: om.c:218: Test failed: Failed to create NamedPipe(c0000033) om.c:222: Test failed: Failed to open NamedPipe (2)
=== w1064 (64 bit report) ===
ntdll: om.c:218: Test failed: Failed to create NamedPipe(c0000033) om.c:222: Test failed: Failed to open NamedPipe (2)
=== w1064_2qxl (64 bit report) ===
ntdll: om.c:218: Test failed: Failed to create NamedPipe(c0000033) om.c:222: Test failed: Failed to open NamedPipe (2)
=== w1064_tsign (64 bit report) ===
ntdll: om.c:218: Test failed: Failed to create NamedPipe(c0000033) om.c:222: Test failed: Failed to open NamedPipe (2)
=== w10pro64 (64 bit report) ===
ntdll: om.c:218: Test failed: Failed to create NamedPipe(c0000033) om.c:222: Test failed: Failed to open NamedPipe (2)
=== w10pro64_ar (64 bit report) ===
ntdll: om.c:218: Test failed: Failed to create NamedPipe(c0000033) om.c:222: Test failed: Failed to open NamedPipe (2)
=== w10pro64_he (64 bit report) ===
ntdll: om.c:218: Test failed: Failed to create NamedPipe(c0000033) om.c:222: Test failed: Failed to open NamedPipe (2)
=== w10pro64_ja (64 bit report) ===
ntdll: om.c:218: Test failed: Failed to create NamedPipe(c0000033) om.c:222: Test failed: Failed to open NamedPipe (2)
=== w10pro64_zh_CN (64 bit report) ===
ntdll: om.c:218: Test failed: Failed to create NamedPipe(c0000033) om.c:222: Test failed: Failed to open NamedPipe (2)