Add patch to allow special characters in pipe names

This commit is contained in:
Michael Müller 2014-07-27 04:02:05 +02:00
parent 283dd7e35c
commit 49eb3fb9f2
4 changed files with 107 additions and 0 deletions

View File

@ -17,6 +17,7 @@ These patches fix the following Wine bugs:
* Support for process ACLs ([Wine Bug #22006](http://bugs.winehq.org/show_bug.cgi?id=22006 "OpenProcess does not enforce ACL"))
* Create AppData\LocalLow in user profile directory ([Wine Bug #22896](http://bugs.winehq.org/show_bug.cgi?id=22896 "Multiple applications and games need support for shell32 FOLDERID_LocalAppDataLow (.NET based Unity Engine games, Java JRE 6 in Vista mode)"))
* Return correct IMediaSeeking stream positions in quartz ([Wine Bug #23174](http://bugs.winehq.org/show_bug.cgi?id=23174 "Fallout 3: Diologue and Video/sound issues"))
* Allow special characters in pipe names. ([Wine Bug #28995](http://bugs.winehq.org/show_bug.cgi?id=28995 "Unable to use named pipes with \">\" character in the name"))
* Add implementation of WTSEnumerateProcessesW ([Wine Bug #29903](http://bugs.winehq.org/show_bug.cgi?id=29903 "Some Microsoft debuggers fail to enumerate processes due to wtsapi32.WTSEnumerateProcessesW() being a stub (Microsoft Visual Studio 2005, DbgCLR from .NET 2.0 SDK)"))
* Fix race conditions and deadlocks in strmbase/quartz ([Wine Bug #31566](http://bugs.winehq.org/show_bug.cgi?id=31566 "Fallout 3: regression causes block at critical section when radio is enabled"))
* Support for stored file ACLs ([Wine Bug #31858](http://bugs.winehq.org/show_bug.cgi?id=31858 "Netflix on Firefox fails with Internet Connection Problem when loading bar is at 99%"))

View File

@ -16,6 +16,7 @@ PATCHLIST := Miscellaneous.ok \
ntdll-Dynamic_DST.ok \
ntdll-FD_Cache.ok \
ntdll-Junction_Points.ok \
ntdll-Pipe_SpecialCharacters.ok \
quartz-MediaSeeking_Positions.ok \
server-ACL_Compat.ok \
server-Address_Change_Notification.ok \
@ -262,6 +263,23 @@ ntdll-Junction_Points.ok:
echo '+ { "ntdll-Junction_Points", "Erich E. Hoover", "Support for junction points/reparse points." },'; \
) > ntdll-Junction_Points.ok
# Patchset ntdll-Pipe_SpecialCharacters
# |
# | Included patches:
# | * Allow special characters in pipe names. [by Michael Müller]
# |
# | This patchset fixes the following Wine bugs:
# | * [#28995] Unable to use named pipes with ">" character in the name
# |
# | Modified files:
# | * dlls/kernel32/tests/pipe.c, dlls/ntdll/directory.c
# |
ntdll-Pipe_SpecialCharacters.ok:
$(PATCH) < ntdll-Pipe_SpecialCharacters/0001-ntdll-Allow-special-characters-in-pipe-names.patch
@( \
echo '+ { "ntdll-Pipe_SpecialCharacters", "Michael Müller", "Allow special characters in pipe names." },'; \
) > ntdll-Pipe_SpecialCharacters.ok
# Patchset quartz-MediaSeeking_Positions
# |
# | Included patches:

View File

@ -0,0 +1,84 @@
From d5092cdd3d4df589f50b52c75bd50127c59f545d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sun, 27 Jul 2014 03:35:42 +0200
Subject: ntdll: Allow special characters in pipe names.
Based on patch by Valentyn Pavliuchenko.
---
dlls/kernel32/tests/pipe.c | 10 ++++++++++
dlls/ntdll/directory.c | 14 ++++++++++----
2 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/dlls/kernel32/tests/pipe.c b/dlls/kernel32/tests/pipe.c
index f7c7531..04de950 100644
--- a/dlls/kernel32/tests/pipe.c
+++ b/dlls/kernel32/tests/pipe.c
@@ -29,6 +29,7 @@
#include "wine/test.h"
#define PIPENAME "\\\\.\\PiPe\\tests_pipe.c"
+#define PIPENAME_SPECIAL "\\\\.\\PiPe\\tests->pipe.c"
#define NB_SERVER_LOOPS 8
@@ -335,6 +336,15 @@ static void test_CreateNamedPipe(int pipemode)
ok(CloseHandle(hnp), "CloseHandle\n");
+ hnp = CreateNamedPipeA(PIPENAME_SPECIAL, 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 with special characters failed\n");
+ ok(CloseHandle(hnp), "CloseHandle\n");
+
trace("test_CreateNamedPipe returning\n");
}
diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c
index 04a5b75..6558958 100644
--- a/dlls/ntdll/directory.c
+++ b/dlls/ntdll/directory.c
@@ -3009,6 +3009,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;
@@ -3019,6 +3020,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);
@@ -3050,13 +3052,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
{
--
1.8.3.2

View File

@ -0,0 +1,4 @@
Author: Michael Müller
Subject: Allow special characters in pipe names.
Revision: 1
Fixes: [28995] Allow special characters in pipe names.