From ae614670d37cba3ece225bdfcbb512be8617a747 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Wed, 3 Jun 2015 22:28:44 +0200
Subject: rpcrt4: Restore original error code when ReadFile fails with
 ERROR_MORE_DATA.

---
 dlls/rpcrt4/rpc_transport.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/dlls/rpcrt4/rpc_transport.c b/dlls/rpcrt4/rpc_transport.c
index 8c0263b..977dd20 100644
--- a/dlls/rpcrt4/rpc_transport.c
+++ b/dlls/rpcrt4/rpc_transport.c
@@ -416,6 +416,7 @@ static int rpcrt4_conn_np_read(RpcConnection *Connection,
   char *buf = buffer;
   BOOL ret = TRUE;
   unsigned int bytes_left = count;
+  DWORD err = GetLastError();
 
   while (bytes_left)
   {
@@ -428,6 +429,7 @@ static int rpcrt4_conn_np_read(RpcConnection *Connection,
     bytes_left -= bytes_read;
     buf += bytes_read;
   }
+  if (ret) SetLastError(err);
   return ret ? count : -1;
 }
 
-- 
2.4.2

