mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-09-13 09:17:20 -07:00
kernel32-Named_Pipe: Remove patches 2-4 (accepted upstream).
This commit is contained in:
parent
5f08af6906
commit
2ae83d8d8e
@ -337,18 +337,14 @@ kernel32-GetVolumePathName.ok:
|
||||
# | * [#17273] Support for SetNamedPipeHandleState
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/kernel32/sync.c, dlls/kernel32/tests/pipe.c, dlls/ntdll/file.c, dlls/ntdll/tests/pipe.c, include/winternl.h,
|
||||
# | server/named_pipe.c, server/protocol.def
|
||||
# | * dlls/kernel32/sync.c, dlls/kernel32/tests/pipe.c, dlls/ntdll/tests/pipe.c
|
||||
# |
|
||||
.INTERMEDIATE: kernel32-Named_Pipe.ok
|
||||
kernel32-Named_Pipe.ok:
|
||||
$(call APPLY_FILE,kernel32-Named_Pipe/0001-kernel32-ConnectNamedPort-should-return-FALSE-and-se.patch)
|
||||
$(call APPLY_FILE,kernel32-Named_Pipe/0002-ntdll-Implement-FILE_PIPE_INFORMATION-for-NtQueryInf.patch)
|
||||
$(call APPLY_FILE,kernel32-Named_Pipe/0003-server-Store-pipe_flags-in-a-separate-variable-for-b.patch)
|
||||
$(call APPLY_FILE,kernel32-Named_Pipe/0004-server-Implement-set_named_pipe_info-wineserver-call.patch)
|
||||
$(call APPLY_FILE,kernel32-Named_Pipe/0005-ntdll-tests-Add-tests-for-FILE_PIPE_INFORMATION.patch)
|
||||
$(call APPLY_FILE,kernel32-Named_Pipe/0006-kernel32-tests-Always-allow-only-one-specific-test-r.patch)
|
||||
$(call APPLY_FILE,kernel32-Named_Pipe/0007-kernel32-Implement-Get-Set-NamedPipeHandleState.patch)
|
||||
$(call APPLY_FILE,kernel32-Named_Pipe/0002-ntdll-tests-Add-tests-for-FILE_PIPE_INFORMATION.patch)
|
||||
$(call APPLY_FILE,kernel32-Named_Pipe/0003-kernel32-tests-Always-allow-only-one-specific-test-r.patch)
|
||||
$(call APPLY_FILE,kernel32-Named_Pipe/0004-kernel32-Implement-Get-Set-NamedPipeHandleState.patch)
|
||||
@( \
|
||||
echo '+ { "kernel32-Named_Pipe", "Dan Kegel", "Fix for ConnectNamedPort return value in overlapped mode." },'; \
|
||||
echo '+ { "kernel32-Named_Pipe", "Sebastian Lackner / Adam Martinson", "Add proper implementation for SetNamedPipeHandleState. [rev 7]" },'; \
|
||||
|
@ -1,98 +0,0 @@
|
||||
From a621406ad321dc6871fbaf7c43d70fa6da9df07a Mon Sep 17 00:00:00 2001
|
||||
From: Adam Martinson <adam.r.martinson@gmail.com>
|
||||
Date: Tue, 12 Aug 2014 21:29:47 +0200
|
||||
Subject: ntdll: Implement FILE_PIPE_INFORMATION for NtQueryInformationFile.
|
||||
|
||||
This is a subset of my current work-in-progress named pipe message mode
|
||||
patches, see: http://bugs.winehq.org/show_bug.cgi?id=17195#c157
|
||||
|
||||
Please note that none of the patches in this series focuses on a specific
|
||||
implementation of message mode pipes yet - whatever finally is used, we
|
||||
always need the redirection kernel32 -> ntdll -> wineserver.
|
||||
|
||||
This first patch (by Adam Martinson) implements FILE_PIPE_INFORMATION
|
||||
based on the existing get_named_pipe_info wineserver call.
|
||||
---
|
||||
dlls/ntdll/file.c | 22 ++++++++++++++++++++--
|
||||
include/winternl.h | 11 +++++++++++
|
||||
2 files changed, 31 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
|
||||
index d2efcc1..2ae8bee 100644
|
||||
--- a/dlls/ntdll/file.c
|
||||
+++ b/dlls/ntdll/file.c
|
||||
@@ -1981,7 +1981,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE hFile, PIO_STATUS_BLOCK io,
|
||||
sizeof(FILE_END_OF_FILE_INFORMATION), /* FileEndOfFileInformation */
|
||||
0, /* FileAlternateNameInformation */
|
||||
sizeof(FILE_STREAM_INFORMATION)-sizeof(WCHAR), /* FileStreamInformation */
|
||||
- 0, /* FilePipeInformation */
|
||||
+ sizeof(FILE_PIPE_INFORMATION), /* FilePipeInformation */
|
||||
sizeof(FILE_PIPE_LOCAL_INFORMATION), /* FilePipeLocalInformation */
|
||||
0, /* FilePipeRemoteInformation */
|
||||
sizeof(FILE_MAILSLOT_QUERY_INFORMATION), /* FileMailslotQueryInformation */
|
||||
@@ -2032,7 +2032,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE hFile, PIO_STATUS_BLOCK io,
|
||||
if (len < info_sizes[class])
|
||||
return io->u.Status = STATUS_INFO_LENGTH_MISMATCH;
|
||||
|
||||
- if (class != FilePipeLocalInformation)
|
||||
+ if (class != FilePipeInformation && class != FilePipeLocalInformation)
|
||||
{
|
||||
if ((io->u.Status = server_get_unix_fd( hFile, 0, &fd, &needs_close, NULL, NULL )))
|
||||
return io->u.Status;
|
||||
@@ -2146,6 +2146,24 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE hFile, PIO_STATUS_BLOCK io,
|
||||
}
|
||||
}
|
||||
break;
|
||||
+ case FilePipeInformation:
|
||||
+ {
|
||||
+ FILE_PIPE_INFORMATION* pi = ptr;
|
||||
+
|
||||
+ SERVER_START_REQ( get_named_pipe_info )
|
||||
+ {
|
||||
+ req->handle = wine_server_obj_handle( hFile );
|
||||
+ if (!(io->u.Status = wine_server_call( req )))
|
||||
+ {
|
||||
+ pi->ReadMode = (reply->flags & NAMED_PIPE_MESSAGE_STREAM_READ) ?
|
||||
+ FILE_PIPE_MESSAGE_MODE : FILE_PIPE_BYTE_STREAM_MODE;
|
||||
+ pi->CompletionMode = (reply->flags & NAMED_PIPE_NONBLOCKING_MODE) ?
|
||||
+ FILE_PIPE_COMPLETE_OPERATION : FILE_PIPE_QUEUE_OPERATION;
|
||||
+ }
|
||||
+ }
|
||||
+ SERVER_END_REQ;
|
||||
+ }
|
||||
+ break;
|
||||
case FilePipeLocalInformation:
|
||||
{
|
||||
FILE_PIPE_LOCAL_INFORMATION* pli = ptr;
|
||||
diff --git a/include/winternl.h b/include/winternl.h
|
||||
index a95a016..95951e2 100644
|
||||
--- a/include/winternl.h
|
||||
+++ b/include/winternl.h
|
||||
@@ -623,6 +623,11 @@ typedef struct _FILE_MAILSLOT_SET_INFORMATION {
|
||||
LARGE_INTEGER ReadTimeout;
|
||||
} FILE_MAILSLOT_SET_INFORMATION, *PFILE_MAILSLOT_SET_INFORMATION;
|
||||
|
||||
+typedef struct _FILE_PIPE_INFORMATION {
|
||||
+ ULONG ReadMode;
|
||||
+ ULONG CompletionMode;
|
||||
+} FILE_PIPE_INFORMATION, *PFILE_PIPE_INFORMATION;
|
||||
+
|
||||
typedef struct _FILE_PIPE_LOCAL_INFORMATION {
|
||||
ULONG NamedPipeType;
|
||||
ULONG NamedPipeConfiguration;
|
||||
@@ -1602,6 +1607,12 @@ typedef struct _RTL_HANDLE_TABLE
|
||||
/* options for pipe's type */
|
||||
#define FILE_PIPE_TYPE_MESSAGE 0x00000001
|
||||
#define FILE_PIPE_TYPE_BYTE 0x00000000
|
||||
+/* options for pipe's message mode */
|
||||
+#define FILE_PIPE_MESSAGE_MODE 0x00000001
|
||||
+#define FILE_PIPE_BYTE_STREAM_MODE 0x00000000
|
||||
+/* options for pipe's blocking mode */
|
||||
+#define FILE_PIPE_COMPLETE_OPERATION 0x00000001
|
||||
+#define FILE_PIPE_QUEUE_OPERATION 0x00000000
|
||||
/* and client / server end */
|
||||
#define FILE_PIPE_SERVER_END 0x00000001
|
||||
#define FILE_PIPE_CLIENT_END 0x00000000
|
||||
--
|
||||
1.7.9.5
|
||||
|
@ -1,112 +0,0 @@
|
||||
From 0826b4c53e337639519e8aabe7a6a57f67d6dd0c Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Tue, 12 Aug 2014 21:29:59 +0200
|
||||
Subject: server: Store pipe_flags in a separate variable for both server and
|
||||
client of named pipes.
|
||||
|
||||
One global "flags" member for a pipe is not sufficient to store different values
|
||||
for each opened server/connection. This patch adds an additional pipe_flags member
|
||||
to both the server and client.
|
||||
|
||||
pipe->flags contain attributes which are valid for all servers/client - the
|
||||
server->pipe_flags and client->pipe_flags values are separate for each connection.
|
||||
|
||||
When requesting get_named_pipe_info then return the information for the specific
|
||||
instance, instead of the global information.
|
||||
---
|
||||
server/named_pipe.c | 16 ++++++++++------
|
||||
1 file changed, 10 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/server/named_pipe.c b/server/named_pipe.c
|
||||
index 4b23ba2..59fb0ab 100644
|
||||
--- a/server/named_pipe.c
|
||||
+++ b/server/named_pipe.c
|
||||
@@ -77,6 +77,7 @@ struct pipe_server
|
||||
struct timeout_user *flush_poll;
|
||||
struct event *event;
|
||||
unsigned int options; /* pipe options */
|
||||
+ unsigned int pipe_flags;
|
||||
};
|
||||
|
||||
struct pipe_client
|
||||
@@ -85,6 +86,7 @@ struct pipe_client
|
||||
struct fd *fd; /* pipe file descriptor */
|
||||
struct pipe_server *server; /* server that this client is connected to */
|
||||
unsigned int flags; /* file flags */
|
||||
+ unsigned int pipe_flags;
|
||||
};
|
||||
|
||||
struct named_pipe
|
||||
@@ -737,7 +739,7 @@ static struct pipe_server *get_pipe_server_obj( struct process *process,
|
||||
return (struct pipe_server *) obj;
|
||||
}
|
||||
|
||||
-static struct pipe_server *create_pipe_server( struct named_pipe *pipe, unsigned int options )
|
||||
+static struct pipe_server *create_pipe_server( struct named_pipe *pipe, unsigned int options, int pipe_flags )
|
||||
{
|
||||
struct pipe_server *server;
|
||||
|
||||
@@ -750,6 +752,7 @@ static struct pipe_server *create_pipe_server( struct named_pipe *pipe, unsigned
|
||||
server->client = NULL;
|
||||
server->flush_poll = NULL;
|
||||
server->options = options;
|
||||
+ server->pipe_flags = pipe_flags;
|
||||
|
||||
list_add_head( &pipe->servers, &server->entry );
|
||||
grab_object( pipe );
|
||||
@@ -762,7 +765,7 @@ static struct pipe_server *create_pipe_server( struct named_pipe *pipe, unsigned
|
||||
return server;
|
||||
}
|
||||
|
||||
-static struct pipe_client *create_pipe_client( unsigned int flags )
|
||||
+static struct pipe_client *create_pipe_client( unsigned int flags, int pipe_flags )
|
||||
{
|
||||
struct pipe_client *client;
|
||||
|
||||
@@ -773,6 +776,7 @@ static struct pipe_client *create_pipe_client( unsigned int flags )
|
||||
client->fd = NULL;
|
||||
client->server = NULL;
|
||||
client->flags = flags;
|
||||
+ client->pipe_flags = pipe_flags;
|
||||
|
||||
return client;
|
||||
}
|
||||
@@ -822,7 +826,7 @@ static struct object *named_pipe_open_file( struct object *obj, unsigned int acc
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- if ((client = create_pipe_client( options )))
|
||||
+ if ((client = create_pipe_client( options, pipe->flags )))
|
||||
{
|
||||
if (!socketpair( PF_UNIX, SOCK_STREAM, 0, fds ))
|
||||
{
|
||||
@@ -977,7 +981,7 @@ DECL_HANDLER(create_named_pipe)
|
||||
pipe->outsize = req->outsize;
|
||||
pipe->maxinstances = req->maxinstances;
|
||||
pipe->timeout = req->timeout;
|
||||
- pipe->flags = req->flags;
|
||||
+ pipe->flags = req->flags & NAMED_PIPE_MESSAGE_STREAM_WRITE;
|
||||
pipe->sharing = req->sharing;
|
||||
}
|
||||
else
|
||||
@@ -997,7 +1001,7 @@ DECL_HANDLER(create_named_pipe)
|
||||
clear_error(); /* clear the name collision */
|
||||
}
|
||||
|
||||
- server = create_pipe_server( pipe, req->options );
|
||||
+ server = create_pipe_server( pipe, req->options, req->flags );
|
||||
if (server)
|
||||
{
|
||||
reply->handle = alloc_handle( current->process, server, req->access, req->attributes );
|
||||
@@ -1026,7 +1030,7 @@ DECL_HANDLER(get_named_pipe_info)
|
||||
server = client->server;
|
||||
}
|
||||
|
||||
- reply->flags = server->pipe->flags;
|
||||
+ reply->flags = client ? client->pipe_flags : server->pipe_flags;
|
||||
reply->sharing = server->pipe->sharing;
|
||||
reply->maxinstances = server->pipe->maxinstances;
|
||||
reply->instances = server->pipe->instances;
|
||||
--
|
||||
1.7.9.5
|
||||
|
@ -1,130 +0,0 @@
|
||||
From cf370c3fae81841e2b2984ddc3ea313607a3a824 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Tue, 12 Aug 2014 21:30:34 +0200
|
||||
Subject: server: Implement set_named_pipe_info wineserver call for
|
||||
NtSetInformationFile/FilePipeInformation.
|
||||
|
||||
Based on patch by Adam Martinson.
|
||||
|
||||
This patch adds a new wineserver call set_named_pipe_info to change the properties
|
||||
stored in server->pipe_flags or client->pipe_flags. This request is then used to
|
||||
implement NtSetInformationFile(FilePipeInformation, ...)
|
||||
|
||||
Invalid combinations (like requesting read message mode when using a byte mode pipe)
|
||||
are rejected with STATUS_INVALID_PARAMETER.
|
||||
|
||||
Requires ./tools/make_requests
|
||||
---
|
||||
dlls/ntdll/file.c | 23 +++++++++++++++++++++++
|
||||
server/named_pipe.c | 38 ++++++++++++++++++++++++++++++++++++++
|
||||
server/protocol.def | 7 ++++++-
|
||||
3 files changed, 67 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
|
||||
index 2ae8bee..92d9829 100644
|
||||
--- a/dlls/ntdll/file.c
|
||||
+++ b/dlls/ntdll/file.c
|
||||
@@ -2335,6 +2335,29 @@ NTSTATUS WINAPI NtSetInformationFile(HANDLE handle, PIO_STATUS_BLOCK io,
|
||||
else io->u.Status = STATUS_INVALID_PARAMETER_3;
|
||||
break;
|
||||
|
||||
+ case FilePipeInformation:
|
||||
+ if (len >= sizeof(FILE_PIPE_INFORMATION))
|
||||
+ {
|
||||
+ FILE_PIPE_INFORMATION *info = ptr;
|
||||
+
|
||||
+ if ((info->CompletionMode | info->ReadMode) & ~1)
|
||||
+ {
|
||||
+ io->u.Status = STATUS_INVALID_PARAMETER;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ SERVER_START_REQ( set_named_pipe_info )
|
||||
+ {
|
||||
+ req->handle = wine_server_obj_handle( handle );
|
||||
+ req->flags = (info->CompletionMode ? NAMED_PIPE_NONBLOCKING_MODE : 0) |
|
||||
+ (info->ReadMode ? NAMED_PIPE_MESSAGE_STREAM_READ : 0);
|
||||
+ io->u.Status = wine_server_call( req );
|
||||
+ }
|
||||
+ SERVER_END_REQ;
|
||||
+ }
|
||||
+ else io->u.Status = STATUS_INVALID_PARAMETER_3;
|
||||
+ break;
|
||||
+
|
||||
case FileMailslotSetInformation:
|
||||
{
|
||||
FILE_MAILSLOT_SET_INFORMATION *info = ptr;
|
||||
diff --git a/server/named_pipe.c b/server/named_pipe.c
|
||||
index 59fb0ab..0ec069d 100644
|
||||
--- a/server/named_pipe.c
|
||||
+++ b/server/named_pipe.c
|
||||
@@ -1045,3 +1045,41 @@ DECL_HANDLER(get_named_pipe_info)
|
||||
release_object(server);
|
||||
}
|
||||
}
|
||||
+
|
||||
+DECL_HANDLER(set_named_pipe_info)
|
||||
+{
|
||||
+ struct pipe_server *server;
|
||||
+ struct pipe_client *client = NULL;
|
||||
+
|
||||
+ server = get_pipe_server_obj( current->process, req->handle, FILE_WRITE_ATTRIBUTES );
|
||||
+ if (!server)
|
||||
+ {
|
||||
+ if (get_error() != STATUS_OBJECT_TYPE_MISMATCH)
|
||||
+ return;
|
||||
+
|
||||
+ clear_error();
|
||||
+ client = (struct pipe_client *)get_handle_obj( current->process, req->handle,
|
||||
+ 0, &pipe_client_ops );
|
||||
+ if (!client) return;
|
||||
+ server = client->server;
|
||||
+ }
|
||||
+
|
||||
+ if ((req->flags & ~(NAMED_PIPE_MESSAGE_STREAM_READ | NAMED_PIPE_NONBLOCKING_MODE)) ||
|
||||
+ ((req->flags & NAMED_PIPE_MESSAGE_STREAM_READ) && !(server->pipe->flags & NAMED_PIPE_MESSAGE_STREAM_WRITE)))
|
||||
+ {
|
||||
+ set_error( STATUS_INVALID_PARAMETER );
|
||||
+ }
|
||||
+ else if (client)
|
||||
+ {
|
||||
+ client->pipe_flags = server->pipe->flags | req->flags;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ server->pipe_flags = server->pipe->flags | req->flags;
|
||||
+ }
|
||||
+
|
||||
+ if (client)
|
||||
+ release_object(client);
|
||||
+ else
|
||||
+ release_object(server);
|
||||
+}
|
||||
diff --git a/server/protocol.def b/server/protocol.def
|
||||
index a8c1fb9..c9270ea 100644
|
||||
--- a/server/protocol.def
|
||||
+++ b/server/protocol.def
|
||||
@@ -2294,7 +2294,7 @@ enum message_type
|
||||
#define NAMED_PIPE_NONBLOCKING_MODE 0x0004
|
||||
#define NAMED_PIPE_SERVER_END 0x8000
|
||||
|
||||
-
|
||||
+/* Get named pipe information by handle */
|
||||
@REQ(get_named_pipe_info)
|
||||
obj_handle_t handle;
|
||||
@REPLY
|
||||
@@ -2306,6 +2306,11 @@ enum message_type
|
||||
unsigned int insize;
|
||||
@END
|
||||
|
||||
+/* Set named pipe information by handle */
|
||||
+@REQ(set_named_pipe_info)
|
||||
+ obj_handle_t handle;
|
||||
+ unsigned int flags;
|
||||
+@END
|
||||
|
||||
/* Create a window */
|
||||
@REQ(create_window)
|
||||
--
|
||||
1.7.9.5
|
||||
|
Loading…
Reference in New Issue
Block a user