rpcrt4: Simplify rpcrt4_conn_np_read implementation.
Since RPC messages are sent as a single message, if it's too short, it means the message is broken and we let the caller to handle an error. Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
f62b9d69ae
commit
bd6f8071d8
|
@ -409,24 +409,14 @@ static RPC_STATUS rpcrt4_ncalrpc_handoff(RpcConnection *old_conn, RpcConnection
|
|||
return status;
|
||||
}
|
||||
|
||||
static int rpcrt4_conn_np_read(RpcConnection *Connection,
|
||||
void *buffer, unsigned int count)
|
||||
static int rpcrt4_conn_np_read(RpcConnection *conn, void *buffer, unsigned int count)
|
||||
{
|
||||
RpcConnection_np *npc = (RpcConnection_np *) Connection;
|
||||
IO_STATUS_BLOCK io_status;
|
||||
char *buf = buffer;
|
||||
unsigned int bytes_left = count;
|
||||
NTSTATUS status;
|
||||
RpcConnection_np *connection = (RpcConnection_np *) conn;
|
||||
IO_STATUS_BLOCK io_status;
|
||||
NTSTATUS status;
|
||||
|
||||
while (bytes_left)
|
||||
{
|
||||
status = NtReadFile(npc->pipe, NULL, NULL, NULL, &io_status, buf, bytes_left, NULL, NULL);
|
||||
if (status && status != STATUS_BUFFER_OVERFLOW)
|
||||
return -1;
|
||||
bytes_left -= io_status.Information;
|
||||
buf += io_status.Information;
|
||||
}
|
||||
return count;
|
||||
status = NtReadFile(connection->pipe, NULL, NULL, NULL, &io_status, buffer, count, NULL, NULL);
|
||||
return status && status != STATUS_BUFFER_OVERFLOW ? -1 : io_status.Information;
|
||||
}
|
||||
|
||||
static int rpcrt4_conn_np_write(RpcConnection *conn, const void *buffer, unsigned int count)
|
||||
|
|
Loading…
Reference in New Issue