rpcrt4: Use a separate function to open each protseq.
This commit is contained in:
parent
3a4a76be2f
commit
0ee6f59cc0
|
@ -190,48 +190,60 @@ static RPC_STATUS rpcrt4_open_pipe(RpcConnection *Connection, LPCSTR pname, BOOL
|
|||
return RPC_S_OK;
|
||||
}
|
||||
|
||||
static RPC_STATUS rpcrt4_ncalrpc_open(RpcConnection* Connection)
|
||||
{
|
||||
static LPCSTR prefix = "\\\\.\\pipe\\lrpc\\";
|
||||
RPC_STATUS r;
|
||||
LPSTR pname;
|
||||
|
||||
/* protseq=ncalrpc: supposed to use NT LPC ports,
|
||||
* but we'll implement it with named pipes for now */
|
||||
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);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static RPC_STATUS rpcrt4_ncacn_np_open(RpcConnection* Connection)
|
||||
{
|
||||
static LPCSTR prefix = "\\\\.";
|
||||
RPC_STATUS r;
|
||||
LPSTR pname;
|
||||
|
||||
/* protseq=ncacn_np: named pipes */
|
||||
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);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
RPC_STATUS RPCRT4_OpenConnection(RpcConnection* Connection)
|
||||
{
|
||||
RPC_STATUS r = RPC_S_OK;
|
||||
|
||||
TRACE("(Connection == ^%p)\n", Connection);
|
||||
|
||||
/* already connected? */
|
||||
if (Connection->conn)
|
||||
return r;
|
||||
return RPC_S_OK;
|
||||
|
||||
/* 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 (strcmp(Connection->Protseq, "ncalrpc") == 0)
|
||||
return rpcrt4_ncalrpc_open(Connection);
|
||||
|
||||
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 */
|
||||
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;
|
||||
if (strcmp(Connection->Protseq, "ncacn_np") == 0)
|
||||
return rpcrt4_ncacn_np_open(Connection);
|
||||
|
||||
ERR("protseq %s not supported\n", Connection->Protseq);
|
||||
return RPC_S_PROTSEQ_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
RPC_STATUS RPCRT4_CloseConnection(RpcConnection* Connection)
|
||||
|
|
Loading…
Reference in New Issue