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

rpcrt4: Simplify rpcrt4_conn_np_write implementation.

There is no need for the loop. Named pipes always do complete writes. Also use NtWriteFile like we do for reading to not mess with GetLastError(). Signed-off-by: 's avatarJacek Caban <jacek@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent b21ca188
...@@ -429,24 +429,18 @@ static int rpcrt4_conn_np_read(RpcConnection *Connection, ...@@ -429,24 +429,18 @@ static int rpcrt4_conn_np_read(RpcConnection *Connection,
return count; return count;
} }
static int rpcrt4_conn_np_write(RpcConnection *Connection, static int rpcrt4_conn_np_write(RpcConnection *conn, const void *buffer, unsigned int count)
const void *buffer, unsigned int count)
{ {
RpcConnection_np *npc = (RpcConnection_np *) Connection; RpcConnection_np *connection = (RpcConnection_np *) conn;
const char *buf = buffer; IO_STATUS_BLOCK io_status;
BOOL ret = TRUE; NTSTATUS status;
unsigned int bytes_left = count;
while (bytes_left) status = NtWriteFile(connection->pipe, NULL, NULL, NULL, &io_status, buffer, count, NULL, NULL);
{ if (status)
DWORD bytes_written; return -1;
ret = WriteFile(npc->pipe, buf, bytes_left, &bytes_written, NULL);
if (!ret || !bytes_written) assert(io_status.Information == count);
break; return count;
bytes_left -= bytes_written;
buf += bytes_written;
}
return ret ? count : -1;
} }
static int rpcrt4_conn_np_close(RpcConnection *Connection) static int rpcrt4_conn_np_close(RpcConnection *Connection)
......
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