Jacek Caban : rpcrt4: Use NtReadFile in rpcrt4_conn_np_read.
Alexandre Julliard
julliard at winehq.org
Fri Oct 7 14:46:47 CDT 2016
Module: wine
Branch: master
Commit: 2f0de6a1bc64f38b40729f29a8615f35535b5d9b
URL: http://source.winehq.org/git/wine.git/?a=commit;h=2f0de6a1bc64f38b40729f29a8615f35535b5d9b
Author: Jacek Caban <jacek at codeweavers.com>
Date: Thu Oct 6 15:01:40 2016 +0200
rpcrt4: Use NtReadFile in rpcrt4_conn_np_read.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/rpcrt4/rpc_transport.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/dlls/rpcrt4/rpc_transport.c b/dlls/rpcrt4/rpc_transport.c
index 54cef07..b2fbf9b 100644
--- a/dlls/rpcrt4/rpc_transport.c
+++ b/dlls/rpcrt4/rpc_transport.c
@@ -77,6 +77,8 @@
# define ioctlsocket ioctl
#endif /* defined(__MINGW32__) || defined (_MSC_VER) */
+#include "ntstatus.h"
+#define WIN32_NO_STATUS
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
@@ -445,22 +447,20 @@ static int rpcrt4_conn_np_read(RpcConnection *Connection,
void *buffer, unsigned int count)
{
RpcConnection_np *npc = (RpcConnection_np *) Connection;
+ IO_STATUS_BLOCK io_status;
char *buf = buffer;
- BOOL ret = TRUE;
unsigned int bytes_left = count;
+ NTSTATUS status;
while (bytes_left)
{
- DWORD bytes_read;
- ret = ReadFile(npc->pipe, buf, bytes_left, &bytes_read, NULL);
- if (!ret && GetLastError() == ERROR_MORE_DATA)
- ret = TRUE;
- if (!ret || !bytes_read)
- break;
- bytes_left -= bytes_read;
- buf += bytes_read;
+ 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 ret ? count : -1;
+ return count;
}
static int rpcrt4_conn_np_write(RpcConnection *Connection,
More information about the wine-cvs
mailing list