Mike McCormack : rpcrt4: Simplify RPCRT4_OpenConnection() a little.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Apr 19 13:15:02 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: d571441562039307eb7ebd0b23d8ce74be7637f1
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=d571441562039307eb7ebd0b23d8ce74be7637f1

Author: Mike McCormack <mike at codeweavers.com>
Date:   Wed Apr 19 19:24:59 2006 +0900

rpcrt4: Simplify RPCRT4_OpenConnection() a little.

---

 dlls/rpcrt4/rpc_binding.c |   80 ++++++++++++++++-----------------------------
 1 files changed, 29 insertions(+), 51 deletions(-)

diff --git a/dlls/rpcrt4/rpc_binding.c b/dlls/rpcrt4/rpc_binding.c
index f2e0743..8c8d8c6 100644
--- a/dlls/rpcrt4/rpc_binding.c
+++ b/dlls/rpcrt4/rpc_binding.c
@@ -200,59 +200,37 @@ RPC_STATUS RPCRT4_OpenConnection(RpcConn
   if (Connection->conn)
      return r;
 
-  if (Connection->server) { /* server */
-      /* protseq=ncalrpc: supposed to use NT LPC ports,
-       * but we'll implement it with named pipes for now */
-      if (strcmp(Connection->Protseq, "ncalrpc") == 0) {
-        static LPCSTR prefix = "\\\\.\\pipe\\lrpc\\";
-        LPSTR pname;
-        pname = HeapAlloc(GetProcessHeap(), 0, strlen(prefix) + strlen(Connection->Endpoint) + 1);
-        strcat(strcpy(pname, prefix), Connection->Endpoint);
-        TRACE("listening on %s\n", pname);
-        r = rpcrt4_connect_pipe(Connection, pname);
-        HeapFree(GetProcessHeap(), 0, pname);
-      }
-      /* protseq=ncacn_np: named pipes */
-      else if (strcmp(Connection->Protseq, "ncacn_np") == 0) {
-        static LPCSTR prefix = "\\\\.";
-        LPSTR pname;
-        pname = HeapAlloc(GetProcessHeap(), 0, strlen(prefix) + strlen(Connection->Endpoint) + 1);
-        strcat(strcpy(pname, prefix), Connection->Endpoint);
-        r = rpcrt4_connect_pipe(Connection, pname);
-        HeapFree(GetProcessHeap(), 0, pname);
-      }
-      else {
-        ERR("protseq %s not supported\n", Connection->Protseq);
-        return RPC_S_PROTSEQ_NOT_SUPPORTED;
-      }
+  /* protseq=ncalrpc: supposed to use NT LPC ports,
+   * but we'll implement it with named pipes for now */
+  if (strcmp(Connection->Protseq, "ncalrpc") == 0) {
+    static LPCSTR prefix = "\\\\.\\pipe\\lrpc\\";
+    LPSTR pname;
+    pname = HeapAlloc(GetProcessHeap(), 0, strlen(prefix) + strlen(Connection->Endpoint) + 1);
+    strcat(strcpy(pname, prefix), Connection->Endpoint);
+
+    if (Connection->server)
+      r = rpcrt4_connect_pipe(Connection, pname);
+    else
+      r = rpcrt4_open_pipe(Connection, pname, TRUE);
+    HeapFree(GetProcessHeap(), 0, pname);
   }
-  else { /* client */
-      /* protseq=ncalrpc: supposed to use NT LPC ports,
-       * but we'll implement it with named pipes for now */
-      if (strcmp(Connection->Protseq, "ncalrpc") == 0) {
-        static LPCSTR prefix = "\\\\.\\pipe\\lrpc\\";
-        LPSTR pname;
-
-        pname = HeapAlloc(GetProcessHeap(), 0, strlen(prefix) + strlen(Connection->Endpoint) + 1);
-        strcat(strcpy(pname, prefix), Connection->Endpoint);
-        r = rpcrt4_open_pipe(Connection, pname, TRUE);
-        HeapFree(GetProcessHeap(), 0, pname);
-      }
-      /* protseq=ncacn_np: named pipes */
-      else if (strcmp(Connection->Protseq, "ncacn_np") == 0) {
-        static LPCSTR prefix = "\\\\.";
-        LPSTR pname;
-
-        pname = HeapAlloc(GetProcessHeap(), 0, strlen(prefix) + strlen(Connection->Endpoint) + 1);
-        strcat(strcpy(pname, prefix), Connection->Endpoint);
-        r = rpcrt4_open_pipe(Connection, pname, FALSE);
-        HeapFree(GetProcessHeap(), 0, pname);
-      } else {
-        ERR("protseq %s not supported\n", Connection->Protseq);
-        return RPC_S_PROTSEQ_NOT_SUPPORTED;
-      }
+  /* protseq=ncacn_np: named pipes */
+  else if (strcmp(Connection->Protseq, "ncacn_np") == 0) {
+    static LPCSTR prefix = "\\\\.";
+    LPSTR pname;
+    pname = HeapAlloc(GetProcessHeap(), 0, strlen(prefix) + strlen(Connection->Endpoint) + 1);
+    strcat(strcpy(pname, prefix), Connection->Endpoint);
+    if (Connection->server)
+      r = rpcrt4_connect_pipe(Connection, pname);
+    else
+      r = rpcrt4_open_pipe(Connection, pname, FALSE);
+    HeapFree(GetProcessHeap(), 0, pname);
   }
-
+  else {
+    ERR("protseq %s not supported\n", Connection->Protseq);
+    r = RPC_S_PROTSEQ_NOT_SUPPORTED;
+  }
+ 
   return r;
 }
 




More information about the wine-cvs mailing list