Commit 0973b8d2 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

server: Improve FSCTL_PIPE_PEEK error handling.

parent 8e5bc0da
......@@ -214,7 +214,6 @@ static void test_CreateNamedPipe(int pipemode)
test_signaled(hnp);
ret = PeekNamedPipe(hnp, NULL, 0, NULL, &readden, NULL);
todo_wine
ok(!ret && GetLastError() == ERROR_BAD_PIPE, "PeekNamedPipe returned %x (%u)\n",
ret, GetLastError());
......@@ -1463,7 +1462,6 @@ static int test_DisconnectNamedPipe(void)
ok(!ret && GetLastError() == ERROR_PIPE_NOT_CONNECTED, "PeekNamedPipe returned %x (%u)\n",
ret, GetLastError());
ret = PeekNamedPipe(hnp, NULL, 0, NULL, &readden, NULL);
todo_wine
ok(!ret && GetLastError() == ERROR_BAD_PIPE, "PeekNamedPipe returned %x (%u)\n",
ret, GetLastError());
ok(CloseHandle(hFile), "CloseHandle\n");
......
......@@ -1286,7 +1286,7 @@ static void test_pipe_state(HANDLE pipe, BOOL is_server, DWORD state)
expected_status = STATUS_PIPE_BROKEN;
break;
}
todo_wine_if(expected_status && expected_status != STATUS_PIPE_BROKEN)
todo_wine_if(expected_status == STATUS_BUFFER_OVERFLOW || expected_status == STATUS_PIPE_DISCONNECTED)
ok(status == expected_status, "status = %x, expected %x in %s state %u\n",
status, expected_status, is_server ? "server" : "client", state);
if (!status)
......@@ -1397,7 +1397,7 @@ static void test_pipe_with_data_state(HANDLE pipe, BOOL is_server, DWORD state)
expected_status = STATUS_BUFFER_OVERFLOW;
break;
}
todo_wine
todo_wine_if(expected_status == STATUS_BUFFER_OVERFLOW || expected_status == STATUS_PIPE_DISCONNECTED)
ok(status == expected_status, "status = %x, expected %x in %s state %u\n",
status, expected_status, is_server ? "server" : "client", state);
if (status == STATUS_BUFFER_OVERFLOW)
......
......@@ -868,10 +868,17 @@ static int pipe_end_peek( struct pipe_end *pipe_end )
}
reply_size -= offsetof( FILE_PIPE_PEEK_BUFFER, Data );
if (!pipe_end->connection && list_empty( &pipe_end->message_queue ))
switch (pipe_end->state)
{
case FILE_PIPE_CONNECTED_STATE:
break;
case FILE_PIPE_CLOSING_STATE:
if (!list_empty( &pipe_end->message_queue )) break;
set_error( STATUS_PIPE_BROKEN );
return 0;
default:
set_error( STATUS_INVALID_PIPE_STATE );
return 0;
}
LIST_FOR_EACH_ENTRY( message, &pipe_end->message_queue, struct pipe_message, entry )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment