Dmitry Timoshkov : rpcrt4: Implement wait_for_incoming_data() for named pipes transport.

Alexandre Julliard julliard at winehq.org
Tue Sep 17 16:22:48 CDT 2019


Module: wine
Branch: master
Commit: bb7c119190a14600d3ac0b47f268f8ea9c419f32
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=bb7c119190a14600d3ac0b47f268f8ea9c419f32

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Tue Sep 17 18:04:54 2019 +0800

rpcrt4: Implement wait_for_incoming_data() for named pipes transport.

Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/rpcrt4/rpc_transport.c | 29 ++++++++++++++++++++++++++---
 1 file changed, 26 insertions(+), 3 deletions(-)

diff --git a/dlls/rpcrt4/rpc_transport.c b/dlls/rpcrt4/rpc_transport.c
index 02fd56ce96..12d15f8654 100644
--- a/dlls/rpcrt4/rpc_transport.c
+++ b/dlls/rpcrt4/rpc_transport.c
@@ -463,10 +463,33 @@ static void rpcrt4_conn_np_cancel_call(RpcConnection *conn)
     CancelIoEx(connection->pipe, NULL);
 }
 
-static int rpcrt4_conn_np_wait_for_incoming_data(RpcConnection *Connection)
+static int rpcrt4_conn_np_wait_for_incoming_data(RpcConnection *conn)
 {
-    /* FIXME: implement when named pipe writes use overlapped I/O */
-    return -1;
+    RpcConnection_np *connection = (RpcConnection_np *)conn;
+    FILE_PIPE_PEEK_BUFFER buf;
+    HANDLE event;
+    NTSTATUS status;
+    int ret;
+
+    event = get_np_event(connection);
+    if (!event) return -1;
+
+    status = NtFsControlFile(connection->pipe, event, NULL, NULL, &connection->io_status, FSCTL_PIPE_PEEK, NULL, 0, &buf, sizeof(buf));
+    if (status == STATUS_SUCCESS)
+        ret = 0;
+    else if (status == STATUS_PENDING)
+    {
+        WaitForSingleObject(event, INFINITE);
+        ret = 0;
+    }
+    else
+    {
+        WARN("NtFsControlFile error %08x\n", status);
+        ret = -1;
+    }
+
+    release_np_event(connection, event);
+    return ret;
 }
 
 static size_t rpcrt4_ncacn_np_get_top_of_tower(unsigned char *tower_data,




More information about the wine-cvs mailing list