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

rpcrt4: Simplify RPCRT4_OpenConnection() a little.

parent ae8197ef
...@@ -200,59 +200,37 @@ RPC_STATUS RPCRT4_OpenConnection(RpcConnection* Connection) ...@@ -200,59 +200,37 @@ RPC_STATUS RPCRT4_OpenConnection(RpcConnection* Connection)
if (Connection->conn) if (Connection->conn)
return r; return r;
if (Connection->server) { /* server */ /* protseq=ncalrpc: supposed to use NT LPC ports,
/* protseq=ncalrpc: supposed to use NT LPC ports, * but we'll implement it with named pipes for now */
* but we'll implement it with named pipes for now */ if (strcmp(Connection->Protseq, "ncalrpc") == 0) {
if (strcmp(Connection->Protseq, "ncalrpc") == 0) { static LPCSTR prefix = "\\\\.\\pipe\\lrpc\\";
static LPCSTR prefix = "\\\\.\\pipe\\lrpc\\"; LPSTR pname;
LPSTR pname; pname = HeapAlloc(GetProcessHeap(), 0, strlen(prefix) + strlen(Connection->Endpoint) + 1);
pname = HeapAlloc(GetProcessHeap(), 0, strlen(prefix) + strlen(Connection->Endpoint) + 1); strcat(strcpy(pname, prefix), Connection->Endpoint);
strcat(strcpy(pname, prefix), Connection->Endpoint);
TRACE("listening on %s\n", pname); if (Connection->server)
r = rpcrt4_connect_pipe(Connection, pname); r = rpcrt4_connect_pipe(Connection, pname);
HeapFree(GetProcessHeap(), 0, pname); else
} r = rpcrt4_open_pipe(Connection, pname, TRUE);
/* protseq=ncacn_np: named pipes */ HeapFree(GetProcessHeap(), 0, pname);
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;
}
} }
else { /* client */ /* protseq=ncacn_np: named pipes */
/* protseq=ncalrpc: supposed to use NT LPC ports, else if (strcmp(Connection->Protseq, "ncacn_np") == 0) {
* but we'll implement it with named pipes for now */ static LPCSTR prefix = "\\\\.";
if (strcmp(Connection->Protseq, "ncalrpc") == 0) { LPSTR pname;
static LPCSTR prefix = "\\\\.\\pipe\\lrpc\\"; pname = HeapAlloc(GetProcessHeap(), 0, strlen(prefix) + strlen(Connection->Endpoint) + 1);
LPSTR pname; strcat(strcpy(pname, prefix), Connection->Endpoint);
if (Connection->server)
pname = HeapAlloc(GetProcessHeap(), 0, strlen(prefix) + strlen(Connection->Endpoint) + 1); r = rpcrt4_connect_pipe(Connection, pname);
strcat(strcpy(pname, prefix), Connection->Endpoint); else
r = rpcrt4_open_pipe(Connection, pname, TRUE); r = rpcrt4_open_pipe(Connection, pname, FALSE);
HeapFree(GetProcessHeap(), 0, 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_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 {
ERR("protseq %s not supported\n", Connection->Protseq);
r = RPC_S_PROTSEQ_NOT_SUPPORTED;
}
return r; 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