From cdb3cdf3cfca2d50be3173e0902893b3c95d0029 Mon Sep 17 00:00:00 2001
From: Robert Shearman <rob@codeweavers.com>
Date: Wed, 8 Jun 2005 18:31:38 +0000
Subject: [PATCH] - Don't pass the PROFILE_SERVER flag in to CreateNamedPipe as
 it is   bogus. - Call FlushFileBuffers to make sure the other end of the pipe
 doesn't   get cut off prematurely. - Don't call CancelIo as we should never
 have async I/O pending.

---
 dlls/rpcrt4/rpc_binding.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/dlls/rpcrt4/rpc_binding.c b/dlls/rpcrt4/rpc_binding.c
index edf92d7279c..ca0271714a2 100644
--- a/dlls/rpcrt4/rpc_binding.c
+++ b/dlls/rpcrt4/rpc_binding.c
@@ -142,7 +142,7 @@ RPC_STATUS RPCRT4_OpenConnection(RpcConnection* Connection)
         pname = HeapAlloc(GetProcessHeap(), 0, strlen(prefix) + strlen(Connection->Endpoint) + 1);
         strcat(strcpy(pname, prefix), Connection->Endpoint);
         TRACE("listening on %s\n", pname);
-        Connection->conn = CreateNamedPipeA(pname, PROFILE_SERVER | PIPE_ACCESS_DUPLEX,
+        Connection->conn = CreateNamedPipeA(pname, PIPE_ACCESS_DUPLEX,
                                          PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE, PIPE_UNLIMITED_INSTANCES,
                                          RPC_MAX_PACKET_SIZE, RPC_MAX_PACKET_SIZE, 5000, NULL);
         HeapFree(GetProcessHeap(), 0, pname);
@@ -166,7 +166,7 @@ RPC_STATUS RPCRT4_OpenConnection(RpcConnection* Connection)
         pname = HeapAlloc(GetProcessHeap(), 0, strlen(prefix) + strlen(Connection->Endpoint) + 1);
         strcat(strcpy(pname, prefix), Connection->Endpoint);
         TRACE("listening on %s\n", pname);
-        Connection->conn = CreateNamedPipeA(pname, PROFILE_SERVER | PIPE_ACCESS_DUPLEX,
+        Connection->conn = CreateNamedPipeA(pname, PIPE_ACCESS_DUPLEX,
                                          PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, PIPE_UNLIMITED_INSTANCES,
                                          RPC_MAX_PACKET_SIZE, RPC_MAX_PACKET_SIZE, 5000, NULL);
         HeapFree(GetProcessHeap(), 0, pname);
@@ -274,7 +274,7 @@ RPC_STATUS RPCRT4_CloseConnection(RpcConnection* Connection)
 {
   TRACE("(Connection == ^%p)\n", Connection);
   if (Connection->conn) {
-    CancelIo(Connection->conn);
+    FlushFileBuffers(Connection->conn);
     CloseHandle(Connection->conn);
     Connection->conn = 0;
   }