Mike McCormack : rpcrt4: Make RPCRT4_Send more compatible with
write(2).
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Apr 19 13:15:04 CDT 2006
Module: wine
Branch: refs/heads/master
Commit: 71fc596a058082c9480003cfde946d38e6e3f8b9
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=71fc596a058082c9480003cfde946d38e6e3f8b9
Author: Mike McCormack <mike at codeweavers.com>
Date: Thu Apr 20 00:25:37 2006 +0900
rpcrt4: Make RPCRT4_Send more compatible with write(2).
---
dlls/rpcrt4/rpc_message.c | 26 +++++++++++++++++++-------
1 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/dlls/rpcrt4/rpc_message.c b/dlls/rpcrt4/rpc_message.c
index 7fe5e6a..6e89ace 100644
--- a/dlls/rpcrt4/rpc_message.c
+++ b/dlls/rpcrt4/rpc_message.c
@@ -238,6 +238,15 @@ VOID RPCRT4_FreeHeader(RpcPktHdr *Header
HeapFree(GetProcessHeap(), 0, Header);
}
+static int rpcrt4_conn_write(RpcConnection *Connection,
+ const void *buffer, unsigned int count)
+{
+ DWORD dwWritten = 0;
+ if (!WriteFile(Connection->conn, buffer, count, &dwWritten, NULL))
+ return -1;
+ return dwWritten;
+}
+
/***********************************************************************
* RPCRT4_Send (internal)
*
@@ -247,7 +256,8 @@ RPC_STATUS RPCRT4_Send(RpcConnection *Co
void *Buffer, unsigned int BufferLength)
{
PUCHAR buffer_pos;
- DWORD hdr_size, count;
+ DWORD hdr_size;
+ LONG count;
buffer_pos = Buffer;
/* The packet building functions save the packet header size, so we can use it. */
@@ -264,9 +274,10 @@ RPC_STATUS RPCRT4_Send(RpcConnection *Co
}
/* transmit packet header */
- if (!WriteFile(Connection->conn, Header, hdr_size, &count, NULL)) {
- WARN("WriteFile failed with error %ld\n", GetLastError());
- return GetLastError();
+ count = rpcrt4_conn_write(Connection, Header, hdr_size);
+ if (count<0) {
+ WARN("rpcrt4_conn_write failed\n");
+ return RPC_S_PROTOCOL_ERROR;
}
/* fragment consisted of header only and is the last one */
@@ -276,9 +287,10 @@ RPC_STATUS RPCRT4_Send(RpcConnection *Co
}
/* send the fragment data */
- if (!WriteFile(Connection->conn, buffer_pos, Header->common.frag_len - hdr_size, &count, NULL)) {
- WARN("WriteFile failed with error %ld\n", GetLastError());
- return GetLastError();
+ count = rpcrt4_conn_write(Connection, buffer_pos, Header->common.frag_len - hdr_size);
+ if (count<0) {
+ WARN("rpcrt4_conn_write failed\n");
+ return RPC_S_PROTOCOL_ERROR;
}
buffer_pos += Header->common.frag_len - hdr_size;
More information about the wine-cvs
mailing list