Commit d37bfe96 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

kernel32: Implement bytes left in PeekNamedPipe().

parent 37bdb8e8
......@@ -1475,7 +1475,7 @@ BOOL WINAPI PeekNamedPipe( HANDLE hPipe, LPVOID lpvBuffer, DWORD cbBuffer,
ULONG read_size = io.Information - FIELD_OFFSET( FILE_PIPE_PEEK_BUFFER, Data );
if (lpcbAvail) *lpcbAvail = buffer->ReadDataAvailable;
if (lpcbRead) *lpcbRead = read_size;
if (lpcbMessage) *lpcbMessage = 0; /* FIXME */
if (lpcbMessage) *lpcbMessage = buffer->MessageLength - read_size;
if (lpvBuffer) memcpy( lpvBuffer, buffer->Data, read_size );
}
else SetLastError( RtlNtStatusToDosError(status) );
......
......@@ -927,6 +927,7 @@ static void pipe_end_peek( struct pipe_end *pipe_end )
FILE_PIPE_PEEK_BUFFER *buffer;
struct pipe_message *message;
data_size_t avail = 0;
data_size_t message_length = 0;
if (!use_server_io( pipe_end ))
{
......@@ -947,7 +948,8 @@ static void pipe_end_peek( struct pipe_end *pipe_end )
if (avail)
{
message = LIST_ENTRY( list_head(&pipe_end->message_queue), struct pipe_message, entry );
reply_size = min( reply_size, message->iosb->in_size - message->read_pos );
message_length = message->iosb->in_size - message->read_pos;
reply_size = min( reply_size, message_length );
}
else reply_size = 0;
......@@ -955,7 +957,7 @@ static void pipe_end_peek( struct pipe_end *pipe_end )
buffer->NamedPipeState = 0; /* FIXME */
buffer->ReadDataAvailable = avail;
buffer->NumberOfMessages = 0; /* FIXME */
buffer->MessageLength = 0; /* FIXME */
buffer->MessageLength = message_length;
if (reply_size) memcpy( buffer->Data, (const char *)message->iosb->in_data + message->read_pos, reply_size );
}
......
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