server: PIPE_TYPE_BYTE | PIPE_READMODE_MESSAGE is invalid for named pipes.

This commit is contained in:
Bernhard Loos 2011-10-12 14:50:40 +02:00 committed by Alexandre Julliard
parent fea69b2305
commit c368df4865
2 changed files with 15 additions and 1 deletions

View file

@ -71,6 +71,19 @@ static void test_CreateNamedPipe(int pipemode)
ok(hnp == INVALID_HANDLE_VALUE && GetLastError() == ERROR_INVALID_NAME,
"CreateNamedPipe should fail if name doesn't start with \\\\.\\pipe\n");
if (pipemode == PIPE_TYPE_BYTE)
{
/* Bad parameter checks */
hnp = CreateNamedPipe(PIPENAME, PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE | PIPE_READMODE_MESSAGE,
/* nMaxInstances */ 1,
/* nOutBufSize */ 1024,
/* nInBufSize */ 1024,
/* nDefaultWait */ NMPWAIT_USE_DEFAULT_WAIT,
/* lpSecurityAttrib */ NULL);
ok(hnp == INVALID_HANDLE_VALUE && GetLastError() == ERROR_INVALID_PARAMETER,
"CreateNamedPipe should fail with PIPE_TYPE_BYTE | PIPE_READMODE_MESSAGE\n");
}
hnp = CreateNamedPipe(NULL,
PIPE_ACCESS_DUPLEX, pipemode | PIPE_WAIT,
1, 1024, 1024, NMPWAIT_USE_DEFAULT_WAIT, NULL);

View file

@ -950,7 +950,8 @@ DECL_HANDLER(create_named_pipe)
struct unicode_str name;
struct directory *root = NULL;
if (!req->sharing || (req->sharing & ~(FILE_SHARE_READ | FILE_SHARE_WRITE)))
if (!req->sharing || (req->sharing & ~(FILE_SHARE_READ | FILE_SHARE_WRITE)) ||
(!(req->flags & NAMED_PIPE_MESSAGE_STREAM_WRITE) && (req->flags & NAMED_PIPE_MESSAGE_STREAM_READ)))
{
set_error( STATUS_INVALID_PARAMETER );
return;