server: Return STATUS_BUFFER_OVERFLOW in pipe_end_peek for partial reads in message mode.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
c1d21f1ae4
commit
ee28e0107c
|
@ -1531,6 +1531,7 @@ BOOL WINAPI PeekNamedPipe( HANDLE hPipe, LPVOID lpvBuffer, DWORD cbBuffer,
|
|||
|
||||
status = NtFsControlFile( hPipe, 0, NULL, NULL, &io, FSCTL_PIPE_PEEK, NULL, 0,
|
||||
buffer, FIELD_OFFSET( FILE_PIPE_PEEK_BUFFER, Data[cbBuffer] ) );
|
||||
if (status == STATUS_BUFFER_OVERFLOW) status = STATUS_SUCCESS;
|
||||
if (!status)
|
||||
{
|
||||
ULONG read_size = io.Information - FIELD_OFFSET( FILE_PIPE_PEEK_BUFFER, Data );
|
||||
|
|
|
@ -927,6 +927,24 @@ static void read_pipe_test(ULONG pipe_flags, ULONG pipe_type)
|
|||
ResetEvent( event );
|
||||
ret = WriteFile( write, buffer, 2, &written, NULL );
|
||||
ok(ret && written == 2, "WriteFile error %d\n", GetLastError());
|
||||
|
||||
memset( &iosb, 0xcc, sizeof(iosb) );
|
||||
status = NtFsControlFile( read, NULL, NULL, NULL, &iosb, FSCTL_PIPE_PEEK, NULL, 0, buffer,
|
||||
FIELD_OFFSET(FILE_PIPE_PEEK_BUFFER, Data[1]) );
|
||||
if (pipe_type & PIPE_TYPE_MESSAGE)
|
||||
{
|
||||
ok( status == STATUS_BUFFER_OVERFLOW || status == STATUS_PENDING,
|
||||
"FSCTL_PIPE_PEEK returned %x\n", status );
|
||||
ok( U(iosb).Status == STATUS_BUFFER_OVERFLOW, "wrong status %x\n", U(iosb).Status );
|
||||
}
|
||||
else
|
||||
{
|
||||
ok( !status || status == STATUS_PENDING, "FSCTL_PIPE_PEEK returned %x\n", status );
|
||||
ok( U(iosb).Status == 0, "wrong status %x\n", U(iosb).Status );
|
||||
}
|
||||
ok( iosb.Information == FIELD_OFFSET(FILE_PIPE_PEEK_BUFFER, Data[1]),
|
||||
"wrong info %lu\n", iosb.Information );
|
||||
|
||||
status = NtReadFile( read, event, apc, &apc_count, &iosb, buffer, 1, NULL, NULL );
|
||||
if (pipe_type & PIPE_READMODE_MESSAGE)
|
||||
{
|
||||
|
@ -1330,7 +1348,7 @@ static void test_pipe_state(HANDLE pipe, BOOL is_server, DWORD state)
|
|||
expected_status = STATUS_PIPE_BROKEN;
|
||||
break;
|
||||
}
|
||||
todo_wine_if(expected_status == STATUS_BUFFER_OVERFLOW || expected_status == STATUS_PIPE_DISCONNECTED)
|
||||
todo_wine_if(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)
|
||||
|
@ -1454,7 +1472,7 @@ static void test_pipe_with_data_state(HANDLE pipe, BOOL is_server, DWORD state)
|
|||
expected_status = STATUS_BUFFER_OVERFLOW;
|
||||
break;
|
||||
}
|
||||
todo_wine_if(expected_status == STATUS_BUFFER_OVERFLOW || expected_status == STATUS_PIPE_DISCONNECTED)
|
||||
todo_wine_if(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)
|
||||
|
|
|
@ -921,6 +921,7 @@ static int pipe_end_peek( struct pipe_end *pipe_end )
|
|||
if (write_pos == reply_size) break;
|
||||
}
|
||||
}
|
||||
if (message_length > reply_size) set_error( STATUS_BUFFER_OVERFLOW );
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue