Commit bd6f8071 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

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: 's avatarJacek Caban <jacek@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent f62b9d69
......@@ -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)
......
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