server: FSCTL_PIPE_LISTEN on a pipe client should return STATUS_ILLEGAL_FUNCTION.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2017-10-10 18:40:43 +02:00 committed by Alexandre Julliard
parent cd4dc08b30
commit 7477792b4c
3 changed files with 13 additions and 0 deletions

View File

@ -224,6 +224,12 @@ static void test_CreateNamedPipe(int pipemode)
ok(GetLastError() == ERROR_SEM_TIMEOUT, "wrong error %u\n", GetLastError());
/* Test ConnectNamedPipe() in both directions */
ok(!ConnectNamedPipe(hnp, NULL), "ConnectNamedPipe(server) succeeded\n");
ok(GetLastError() == ERROR_PIPE_CONNECTED, "expected ERROR_PIPE_CONNECTED, got %u\n", GetLastError());
ok(!ConnectNamedPipe(hFile, NULL), "ConnectNamedPipe(client) succeeded\n");
ok(GetLastError() == ERROR_INVALID_FUNCTION, "expected ERROR_INVALID_FUNCTION, got %u\n", GetLastError());
/* don't try to do i/o if one side couldn't be opened, as it hangs */
if (hFile != INVALID_HANDLE_VALUE) {
HANDLE hFile2;

View File

@ -256,6 +256,9 @@ static void test_create(void)
res, access[k], sharing[j]);
ok(info.NamedPipeConfiguration == pipe_config[j], "wrong duplex status for pipe: %d, expected %d\n",
info.NamedPipeConfiguration, pipe_config[j]);
res = listen_pipe(hclient, hEvent, &iosb, FALSE);
ok(res == STATUS_ILLEGAL_FUNCTION, "expected STATUS_ILLEGAL_FUNCTION, got %x\n", res);
CloseHandle(hclient);
}

View File

@ -876,6 +876,10 @@ static int pipe_client_ioctl( struct fd *fd, ioctl_code_t code, struct async *as
switch(code)
{
case FSCTL_PIPE_LISTEN:
set_error( STATUS_ILLEGAL_FUNCTION );
return 0;
case FSCTL_PIPE_PEEK:
return pipe_end_peek( &client->pipe_end );