Rebase against 4c7f3f8af856888f5ab020b2a32d0b01db0c82f7.

This commit is contained in:
Sebastian Lackner
2016-12-12 04:28:52 +01:00
parent 0d616d719e
commit 6f120f6a56
28 changed files with 280 additions and 990 deletions

View File

@@ -1,4 +1,4 @@
From a08cd0cbb65ca0c53857c35e40f6d3d910119b22 Mon Sep 17 00:00:00 2001
From 14bade0152141ee9ce78acd98b13d29abc450fea Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Thu, 31 Jul 2014 00:28:59 +0200
Subject: kernel32/tests: Add tests for PeekNamedPipe with partial received
@@ -19,7 +19,7 @@ Changes in v3:
1 file changed, 140 insertions(+), 2 deletions(-)
diff --git a/dlls/kernel32/tests/pipe.c b/dlls/kernel32/tests/pipe.c
index 056f95b..a252bc8 100644
index 7d89da5..13fdf60 100644
--- a/dlls/kernel32/tests/pipe.c
+++ b/dlls/kernel32/tests/pipe.c
@@ -46,7 +46,8 @@ static void CALLBACK user_apc(ULONG_PTR param)
@@ -57,8 +57,8 @@ index 056f95b..a252bc8 100644
default:
SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
rpcargs->returnValue = 0;
@@ -109,6 +119,33 @@ static BOOL RpcReadFile(HANDLE hFile, LPVOID buffer, DWORD bytesToRead, LPDWORD
return (BOOL)rpcargs.returnValue;
@@ -117,6 +127,33 @@ static void _test_signaled(unsigned line, HANDLE handle)
ok_(__FILE__,line)(res == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", res);
}
+/* Runs PeekNamedPipe(...) from a different thread */
@@ -91,7 +91,7 @@ index 056f95b..a252bc8 100644
static void test_CreateNamedPipe(int pipemode)
{
HANDLE hnp;
@@ -118,6 +155,7 @@ static void test_CreateNamedPipe(int pipemode)
@@ -126,6 +163,7 @@ static void test_CreateNamedPipe(int pipemode)
char ibuf[32], *pbuf;
DWORD written;
DWORD readden;
@@ -99,7 +99,7 @@ index 056f95b..a252bc8 100644
DWORD avail;
DWORD lpmode;
BOOL ret;
@@ -232,9 +270,21 @@ static void test_CreateNamedPipe(int pipemode)
@@ -241,9 +279,21 @@ static void test_CreateNamedPipe(int pipemode)
ok(written == sizeof(obuf2), "write file len\n");
ok(ReadFile(hFile, ibuf, 4, &readden, NULL), "ReadFile\n");
ok(readden == 4, "read got %d bytes\n", readden);
@@ -121,7 +121,7 @@ index 056f95b..a252bc8 100644
memset(ibuf, 0, sizeof(ibuf));
ok(WriteFile(hFile, obuf, sizeof(obuf), &written, NULL), "WriteFile\n");
@@ -447,6 +497,16 @@ static void test_CreateNamedPipe(int pipemode)
@@ -456,6 +506,16 @@ static void test_CreateNamedPipe(int pipemode)
ok(written == sizeof(obuf), "write file len 9\n");
ok(WriteFile(hnp, obuf2, sizeof(obuf2), &written, NULL), "WriteFile 9\n");
ok(written == sizeof(obuf2), "write file len 9\n");
@@ -138,7 +138,7 @@ index 056f95b..a252bc8 100644
SetLastError(0xdeadbeef);
todo_wine
ok(!ReadFile(hFile, ibuf, 4, &readden, NULL), "ReadFile 9\n");
@@ -460,6 +520,16 @@ static void test_CreateNamedPipe(int pipemode)
@@ -469,6 +529,16 @@ static void test_CreateNamedPipe(int pipemode)
todo_wine
ok(GetLastError() == ERROR_MORE_DATA, "wrong error 9\n");
ok(readden == 4, "read got %d bytes 9\n", readden);
@@ -155,7 +155,7 @@ index 056f95b..a252bc8 100644
ret = RpcReadFile(hFile, ibuf + 8, sizeof(ibuf), &readden, NULL);
ok(ret, "RpcReadFile 9\n");
todo_wine
@@ -468,6 +538,14 @@ static void test_CreateNamedPipe(int pipemode)
@@ -477,6 +547,14 @@ static void test_CreateNamedPipe(int pipemode)
if (readden <= sizeof(obuf) - 8) /* blocks forever if second part was already received */
{
memset(ibuf, 0, sizeof(ibuf));
@@ -170,7 +170,7 @@ index 056f95b..a252bc8 100644
SetLastError(0xdeadbeef);
ret = RpcReadFile(hFile, ibuf, 4, &readden, NULL);
ok(!ret, "RpcReadFile 9\n");
@@ -480,11 +558,27 @@ static void test_CreateNamedPipe(int pipemode)
@@ -489,11 +567,27 @@ static void test_CreateNamedPipe(int pipemode)
todo_wine
ok(GetLastError() == ERROR_MORE_DATA, "wrong error 9\n");
ok(readden == 4, "read got %d bytes 9\n", readden);
@@ -198,7 +198,7 @@ index 056f95b..a252bc8 100644
/* Now the reverse direction */
memset(ibuf, 0, sizeof(ibuf));
@@ -492,6 +586,16 @@ static void test_CreateNamedPipe(int pipemode)
@@ -501,6 +595,16 @@ static void test_CreateNamedPipe(int pipemode)
ok(written == sizeof(obuf2), "write file len 10\n");
ok(WriteFile(hFile, obuf, sizeof(obuf), &written, NULL), "WriteFile 10\n");
ok(written == sizeof(obuf), "write file len 10\n");
@@ -215,7 +215,7 @@ index 056f95b..a252bc8 100644
SetLastError(0xdeadbeef);
todo_wine
ok(!ReadFile(hnp, ibuf, 4, &readden, NULL), "ReadFile 10\n");
@@ -505,6 +609,16 @@ static void test_CreateNamedPipe(int pipemode)
@@ -514,6 +618,16 @@ static void test_CreateNamedPipe(int pipemode)
todo_wine
ok(GetLastError() == ERROR_MORE_DATA, "wrong error 10\n");
ok(readden == 4, "read got %d bytes 10\n", readden);
@@ -232,7 +232,7 @@ index 056f95b..a252bc8 100644
ret = RpcReadFile(hnp, ibuf + 8, sizeof(ibuf), &readden, NULL);
ok(ret, "RpcReadFile 10\n");
todo_wine
@@ -513,6 +627,14 @@ static void test_CreateNamedPipe(int pipemode)
@@ -522,6 +636,14 @@ static void test_CreateNamedPipe(int pipemode)
if (readden <= sizeof(obuf2) - 8) /* blocks forever if second part was already received */
{
memset(ibuf, 0, sizeof(ibuf));
@@ -247,7 +247,7 @@ index 056f95b..a252bc8 100644
SetLastError(0xdeadbeef);
ret = RpcReadFile(hnp, ibuf, 4, &readden, NULL);
ok(!ret, "RpcReadFile 10\n");
@@ -525,11 +647,27 @@ static void test_CreateNamedPipe(int pipemode)
@@ -534,11 +656,27 @@ static void test_CreateNamedPipe(int pipemode)
todo_wine
ok(GetLastError() == ERROR_MORE_DATA, "wrong error 10\n");
ok(readden == 4, "read got %d bytes 10\n", readden);
@@ -276,5 +276,5 @@ index 056f95b..a252bc8 100644
}
--
2.1.3
2.9.0

View File

@@ -1,4 +1,4 @@
From 01f63c1b25a7b0f964e9558d1054a613d1cd90e8 Mon Sep 17 00:00:00 2001
From 463a6541de5c95ed1ca3c79a3b5b721e2edade45 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sat, 6 Jun 2015 01:21:05 +0200
Subject: server: Return correct error codes for NtWriteFile when pipes are
@@ -12,10 +12,10 @@ Subject: server: Return correct error codes for NtWriteFile when pipes are
4 files changed, 46 insertions(+), 3 deletions(-)
diff --git a/dlls/kernel32/tests/pipe.c b/dlls/kernel32/tests/pipe.c
index db2d49d..a2a425d 100644
index 6f70285..817f857 100644
--- a/dlls/kernel32/tests/pipe.c
+++ b/dlls/kernel32/tests/pipe.c
@@ -1909,7 +1909,7 @@ static void test_CloseHandle(void)
@@ -1917,7 +1917,7 @@ static void test_CloseHandle(void)
SetLastError(0xdeadbeef);
ret = WriteFile(hfile, testdata, sizeof(testdata), &numbytes, NULL);
ok(!ret, "WriteFile unexpectedly succeeded\n");
@@ -25,10 +25,10 @@ index db2d49d..a2a425d 100644
CloseHandle(hfile);
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index d1dd1e7..1b97ef0 100644
index 863ff78..e9efa92 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -1240,6 +1240,9 @@ static NTSTATUS write_unix_fd(int fd, const char *buf, ULONG *total, ULONG lengt
@@ -1239,6 +1239,9 @@ static NTSTATUS write_unix_fd(int fd, const char *buf, ULONG *total, ULONG lengt
return STATUS_SUCCESS;
else if (errno == EFAULT)
return STATUS_INVALID_USER_BUFFER;
@@ -39,7 +39,7 @@ index d1dd1e7..1b97ef0 100644
}
}
diff --git a/server/named_pipe.c b/server/named_pipe.c
index 6e627bd..69293a9 100644
index ad7d537..5bec9bc 100644
--- a/server/named_pipe.c
+++ b/server/named_pipe.c
@@ -147,6 +147,7 @@ static const struct object_ops named_pipe_ops =
@@ -59,7 +59,7 @@ index 6e627bd..69293a9 100644
pipe_server_destroy /* destroy */
};
@@ -194,6 +195,7 @@ static const struct fd_ops pipe_server_fd_ops =
@@ -193,6 +194,7 @@ static const struct fd_ops pipe_server_fd_ops =
static void pipe_client_dump( struct object *obj, int verbose );
static int pipe_client_signaled( struct object *obj, struct wait_queue_entry *entry );
static struct fd *pipe_client_get_fd( struct object *obj );
@@ -67,7 +67,7 @@ index 6e627bd..69293a9 100644
static void pipe_client_destroy( struct object *obj );
static obj_handle_t pipe_client_flush( struct fd *fd, const async_data_t *async, int blocking );
static enum server_fd_type pipe_client_get_fd_type( struct fd *fd );
@@ -217,7 +219,7 @@ static const struct object_ops pipe_client_ops =
@@ -216,7 +218,7 @@ static const struct object_ops pipe_client_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
no_alloc_handle, /* alloc_handle */
@@ -76,8 +76,8 @@ index 6e627bd..69293a9 100644
pipe_client_destroy /* destroy */
};
@@ -284,6 +286,8 @@ static const struct fd_ops named_pipe_device_fd_ops =
default_fd_cancel_async /* cancel_async */
@@ -281,6 +283,8 @@ static const struct fd_ops named_pipe_device_fd_ops =
default_fd_reselect_async /* reselect_async */
};
+static inline int messagemode_flags( int flags );
@@ -85,7 +85,7 @@ index 6e627bd..69293a9 100644
static void named_pipe_dump( struct object *obj, int verbose )
{
fputs( "Named pipe\n", stderr );
@@ -393,6 +397,23 @@ static void do_disconnect( struct pipe_server *server )
@@ -390,6 +394,23 @@ static void do_disconnect( struct pipe_server *server )
server->fd = NULL;
}
@@ -109,7 +109,7 @@ index 6e627bd..69293a9 100644
static void pipe_server_destroy( struct object *obj)
{
struct pipe_server *server = (struct pipe_server *)obj;
@@ -419,6 +440,24 @@ static void pipe_server_destroy( struct object *obj)
@@ -416,6 +437,24 @@ static void pipe_server_destroy( struct object *obj)
release_object( server->pipe );
}
@@ -135,10 +135,10 @@ index 6e627bd..69293a9 100644
{
struct pipe_client *client = (struct pipe_client *)obj;
diff --git a/server/protocol.def b/server/protocol.def
index 29f3a52..2dd44dd 100644
index e7a55d7..f1e7af1 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -2428,6 +2428,7 @@ enum message_type
@@ -2427,6 +2427,7 @@ enum message_type
#define NAMED_PIPE_MESSAGE_STREAM_WRITE 0x0001
#define NAMED_PIPE_MESSAGE_STREAM_READ 0x0002
#define NAMED_PIPE_NONBLOCKING_MODE 0x0004

View File

@@ -1,4 +1,4 @@
From 32b32213893b9007898c35cd01246d852153d80c Mon Sep 17 00:00:00 2001
From 5ae266b76e7d946b3228faee7924af63d5f08ac2 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Wed, 24 Feb 2016 15:45:09 +0100
Subject: server: Do not allow to queue async operation for broken pipes.
@@ -8,10 +8,10 @@ Subject: server: Do not allow to queue async operation for broken pipes.
1 file changed, 32 insertions(+), 2 deletions(-)
diff --git a/server/named_pipe.c b/server/named_pipe.c
index 546984ddf..9f560c9 100644
index 5bec9bc..4dda82a 100644
--- a/server/named_pipe.c
+++ b/server/named_pipe.c
@@ -154,6 +154,7 @@ static obj_handle_t pipe_server_flush( struct fd *fd, const async_data_t *async,
@@ -153,6 +153,7 @@ static obj_handle_t pipe_server_flush( struct fd *fd, const async_data_t *async,
static enum server_fd_type pipe_server_get_fd_type( struct fd *fd );
static obj_handle_t pipe_server_ioctl( struct fd *fd, ioctl_code_t code, const async_data_t *async,
int blocking );
@@ -19,16 +19,16 @@ index 546984ddf..9f560c9 100644
static const struct object_ops pipe_server_ops =
{
@@ -187,7 +188,7 @@ static const struct fd_ops pipe_server_fd_ops =
@@ -186,7 +187,7 @@ static const struct fd_ops pipe_server_fd_ops =
no_fd_write, /* write */
pipe_server_flush, /* flush */
pipe_server_ioctl, /* ioctl */
- default_fd_queue_async, /* queue_async */
+ pipe_server_queue_async, /* queue_async */
default_fd_reselect_async, /* reselect_async */
default_fd_cancel_async, /* cancel_async */
default_fd_reselect_async /* reselect_async */
};
@@ -200,6 +201,7 @@ static int pipe_client_close_handle( struct object *obj, struct process *process
@@ -198,6 +199,7 @@ static int pipe_client_close_handle( struct object *obj, struct process *process
static void pipe_client_destroy( struct object *obj );
static obj_handle_t pipe_client_flush( struct fd *fd, const async_data_t *async, int blocking );
static enum server_fd_type pipe_client_get_fd_type( struct fd *fd );
@@ -36,16 +36,16 @@ index 546984ddf..9f560c9 100644
static const struct object_ops pipe_client_ops =
{
@@ -233,7 +235,7 @@ static const struct fd_ops pipe_client_fd_ops =
@@ -231,7 +233,7 @@ static const struct fd_ops pipe_client_fd_ops =
no_fd_write, /* write */
pipe_client_flush, /* flush */
default_fd_ioctl, /* ioctl */
- default_fd_queue_async, /* queue_async */
+ pipe_client_queue_async, /* queue_async */
default_fd_reselect_async, /* reselect_async */
default_fd_cancel_async /* cancel_async */
default_fd_reselect_async /* reselect_async */
};
@@ -629,6 +631,20 @@ static obj_handle_t pipe_client_flush( struct fd *fd, const async_data_t *async,
@@ -621,6 +623,20 @@ static obj_handle_t pipe_client_flush( struct fd *fd, const async_data_t *async,
return 0;
}
@@ -66,7 +66,7 @@ index 546984ddf..9f560c9 100644
static inline int is_overlapped( unsigned int options )
{
return !(options & (FILE_SYNCHRONOUS_IO_ALERT | FILE_SYNCHRONOUS_IO_NONALERT));
@@ -718,6 +734,20 @@ static obj_handle_t pipe_server_ioctl( struct fd *fd, ioctl_code_t code, const a
@@ -707,6 +723,20 @@ static obj_handle_t pipe_server_ioctl( struct fd *fd, ioctl_code_t code, const a
}
}
@@ -88,5 +88,5 @@ index 546984ddf..9f560c9 100644
obj_handle_t handle, unsigned int access )
{
--
2.7.1
2.9.0