Commit d5714415 authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

rpcrt4: Simplify RPCRT4_OpenConnection() a little.

parent ae8197ef
......@@ -200,7 +200,6 @@ RPC_STATUS RPCRT4_OpenConnection(RpcConnection* Connection)
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) {
......@@ -208,8 +207,11 @@ RPC_STATUS RPCRT4_OpenConnection(RpcConnection* Connection)
LPSTR pname;
pname = HeapAlloc(GetProcessHeap(), 0, strlen(prefix) + strlen(Connection->Endpoint) + 1);
strcat(strcpy(pname, prefix), Connection->Endpoint);
TRACE("listening on %s\n", pname);
if (Connection->server)
r = rpcrt4_connect_pipe(Connection, pname);
else
r = rpcrt4_open_pipe(Connection, pname, TRUE);
HeapFree(GetProcessHeap(), 0, pname);
}
/* protseq=ncacn_np: named pipes */
......@@ -218,39 +220,15 @@ RPC_STATUS RPCRT4_OpenConnection(RpcConnection* Connection)
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);
return RPC_S_PROTSEQ_NOT_SUPPORTED;
}
}
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;
}
r = RPC_S_PROTSEQ_NOT_SUPPORTED;
}
return r;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment