From: Michael Müller michael@fds-team.de
Based on a patch by Valentyn Pavliuchenko.
Fixes bug 28995.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/kernel32/tests/pipe.c | 13 +++++++++++++ dlls/ntdll/directory.c | 14 ++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/dlls/kernel32/tests/pipe.c b/dlls/kernel32/tests/pipe.c index fa677cf..b74232c 100644 --- a/dlls/kernel32/tests/pipe.c +++ b/dlls/kernel32/tests/pipe.c @@ -627,6 +627,19 @@ static void test_CreateNamedPipe(int pipemode)
ok(CloseHandle(hnp), "CloseHandle\n");
+ hnp = CreateNamedPipeA("\\.\pipe\test->pipe.c", PIPE_ACCESS_DUPLEX, pipemode | PIPE_WAIT, + /* nMaxInstances */ 1, + /* nOutBufSize */ 1024, + /* nInBufSize */ 1024, + /* nDefaultWait */ NMPWAIT_USE_DEFAULT_WAIT, + /* lpSecurityAttrib */ NULL); + ok(hnp != INVALID_HANDLE_VALUE, "CreateNamedPipe failed: %u\n", GetLastError()); + + hFile = CreateFileA("\\.\pipe\test->pipe.c", 0, 0, NULL, OPEN_EXISTING, 0, 0); + ok(hFile != INVALID_HANDLE_VALUE, "CreateFile failed: %u\n", GetLastError()); + ok(CloseHandle(hFile), "CloseHandle\n"); + ok(CloseHandle(hnp), "CloseHandle\n"); + if (winetest_debug > 1) trace("test_CreateNamedPipe returning\n"); }
diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c index 4655a634..e6754ec 100644 --- a/dlls/ntdll/directory.c +++ b/dlls/ntdll/directory.c @@ -2819,6 +2819,7 @@ NTSTATUS CDECL wine_nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRI UINT disposition, BOOLEAN check_case ) { static const WCHAR unixW[] = {'u','n','i','x'}; + static const WCHAR pipeW[] = {'p','i','p','e'}; static const WCHAR invalid_charsW[] = { INVALID_NT_CHARS, 0 };
NTSTATUS status = STATUS_SUCCESS; @@ -2829,6 +2830,7 @@ NTSTATUS CDECL wine_nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRI int pos, ret, name_len, unix_len, prefix_len, used_default; WCHAR prefix[MAX_DIR_ENTRY_LEN]; BOOLEAN is_unix = FALSE; + BOOLEAN is_pipe = FALSE;
name = nameW->Buffer; name_len = nameW->Length / sizeof(WCHAR); @@ -2862,13 +2864,17 @@ NTSTATUS CDECL wine_nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRI name += prefix_len; name_len -= prefix_len;
- /* check for invalid characters (all chars except 0 are valid for unix) */ - is_unix = (prefix_len == 4 && !memcmp( prefix, unixW, sizeof(unixW) )); - if (is_unix) + /* check for invalid characters (all chars except 0 are valid for unix and pipes) */ + if (prefix_len == 4) + { + is_unix = !memcmp( prefix, unixW, sizeof(unixW) ); + is_pipe = !memcmp( prefix, pipeW, sizeof(pipeW) ); + } + if (is_unix || is_pipe) { for (p = name; p < name + name_len; p++) if (!*p) return STATUS_OBJECT_NAME_INVALID; - check_case = TRUE; + check_case |= is_unix; } else {