server: Return ReadDataAvailable value for FilePipeLocalInformation.

Makes Cygwin mintty.exe or script.exe show output, if the
stack issues got worked around.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47808
Signed-off-by: Bernhard Übelacker <bernhardu@mailbox.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Bernhard Übelacker 2021-11-26 22:32:09 +01:00 committed by Alexandre Julliard
parent 4be47ac4a3
commit c488f29122
2 changed files with 15 additions and 1 deletions

View File

@ -1888,8 +1888,16 @@ static void test_pipe_with_data_state(HANDLE pipe, BOOL is_server, DWORD state)
"NtQueryInformationFile(FilePipeLocalInformation) failed in %s state %u: %x\n",
is_server ? "server" : "client", state, status);
if (!status)
{
ok(local_info.NamedPipeState == state, "%s NamedPipeState = %u, expected %u\n",
is_server ? "server" : "client", local_info.NamedPipeState, state);
if (state != FILE_PIPE_DISCONNECTED_STATE && state != FILE_PIPE_LISTENING_STATE)
ok(local_info.ReadDataAvailable != 0, "ReadDataAvailable, expected non-zero, in %s state %u\n",
is_server ? "server" : "client", state);
else
ok(local_info.ReadDataAvailable == 0, "ReadDataAvailable, expected zero, in %s state %u\n",
is_server ? "server" : "client", state);
}
status = pNtQueryInformationFile(pipe, &io, &pipe_info, sizeof(pipe_info), FilePipeInformation);
if (!is_server && state == FILE_PIPE_DISCONNECTED_STATE)

View File

@ -670,6 +670,8 @@ static void pipe_end_get_file_info( struct fd *fd, obj_handle_t handle, unsigned
case FilePipeLocalInformation:
{
FILE_PIPE_LOCAL_INFORMATION *pipe_info;
struct pipe_message *message;
data_size_t avail = 0;
if (!(get_handle_access( current->process, handle) & FILE_READ_ATTRIBUTES))
{
@ -706,7 +708,11 @@ static void pipe_end_get_file_info( struct fd *fd, obj_handle_t handle, unsigned
pipe_info->MaximumInstances = pipe->maxinstances;
pipe_info->CurrentInstances = pipe->instances;
pipe_info->InboundQuota = pipe->insize;
pipe_info->ReadDataAvailable = 0; /* FIXME */
LIST_FOR_EACH_ENTRY( message, &pipe_end->message_queue, struct pipe_message, entry )
avail += message->iosb->in_size - message->read_pos;
pipe_info->ReadDataAvailable = avail;
pipe_info->OutboundQuota = pipe->outsize;
pipe_info->WriteQuotaAvailable = 0; /* FIXME */
pipe_info->NamedPipeState = pipe_end->state;