mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-01 15:14:29 +00:00
kernel32: Implement bytes left in PeekNamedPipe().
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:
parent
37bdb8e8cd
commit
d37bfe960f
|
@ -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 );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue