[PATCH v2] rpcrt4: Implement wait_for_incoming_data() for named pipes transport.

Dmitry Timoshkov dmitry at baikal.ru
Mon Sep 16 05:29:47 CDT 2019


Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
---
 dlls/rpcrt4/rpc_transport.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/dlls/rpcrt4/rpc_transport.c b/dlls/rpcrt4/rpc_transport.c
index 02fd56ce96..961335d191 100644
--- a/dlls/rpcrt4/rpc_transport.c
+++ b/dlls/rpcrt4/rpc_transport.c
@@ -463,10 +463,27 @@ 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;
+    HANDLE event;
+    NTSTATUS status;
+
+    if (connection->listen_event)
+    {
+        WaitForSingleObject(connection->listen_event, INFINITE);
+        return 0;
+    }
+
+    event = get_np_event(connection);
+    if (!event) return -1;
+
+    status = NtFsControlFile(connection->pipe, event, NULL, NULL, &connection->io_status, FSCTL_PIPE_LISTEN, NULL, 0, NULL, 0);
+    if (status == STATUS_SUCCESS)
+        WaitForSingleObject(event, INFINITE);
+
+    release_np_event(connection, event);
+    return 0;
 }
 
 static size_t rpcrt4_ncacn_np_get_top_of_tower(unsigned char *tower_data,
-- 
2.20.1




More information about the wine-devel mailing list