From 961455c7f033110dad03dab7f0f688e9c89763fc Mon Sep 17 00:00:00 2001 From: Rob Shearman Date: Thu, 25 Jan 2007 10:23:11 +0000 Subject: [PATCH] rpcrt4: Stash away NetworkOptions passed in from the binding string so that transports can look at the string if needed. --- dlls/rpcrt4/rpc_binding.c | 12 +++++++++--- dlls/rpcrt4/rpc_binding.h | 6 ++++-- dlls/rpcrt4/rpc_transport.c | 4 +++- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/dlls/rpcrt4/rpc_binding.c b/dlls/rpcrt4/rpc_binding.c index 00349071c59..ffa965979f2 100644 --- a/dlls/rpcrt4/rpc_binding.c +++ b/dlls/rpcrt4/rpc_binding.c @@ -79,7 +79,7 @@ LPWSTR RPCRT4_strdupAtoW(LPSTR src) return s; } -LPWSTR RPCRT4_strndupW(LPWSTR src, INT slen) +LPWSTR RPCRT4_strndupW(LPCWSTR src, INT slen) { DWORD len; LPWSTR s; @@ -149,6 +149,8 @@ RPC_STATUS RPCRT4_CompleteBindingA(RpcBinding* Binding, LPSTR NetworkAddr, LPST } else { Binding->Endpoint = RPCRT4_strdupA(""); } + HeapFree(GetProcessHeap(), 0, Binding->NetworkOptions); + Binding->NetworkOptions = RPCRT4_strdupAtoW(NetworkOptions); if (!Binding->Endpoint) ERR("out of memory?\n"); return RPC_S_OK; @@ -168,6 +170,8 @@ RPC_STATUS RPCRT4_CompleteBindingW(RpcBinding* Binding, LPWSTR NetworkAddr, LPWS Binding->Endpoint = RPCRT4_strdupA(""); } if (!Binding->Endpoint) ERR("out of memory?\n"); + HeapFree(GetProcessHeap(), 0, Binding->NetworkOptions); + Binding->NetworkOptions = RPCRT4_strdupW(NetworkOptions); return RPC_S_OK; } @@ -224,6 +228,7 @@ RPC_STATUS RPCRT4_DestroyBinding(RpcBinding* Binding) RPCRT4_strfree(Binding->Endpoint); RPCRT4_strfree(Binding->NetworkAddr); RPCRT4_strfree(Binding->Protseq); + HeapFree(GetProcessHeap(), 0, Binding->NetworkOptions); if (Binding->AuthInfo) RpcAuthInfo_Release(Binding->AuthInfo); if (Binding->QOS) RpcQualityOfService_Release(Binding->QOS); HeapFree(GetProcessHeap(), 0, Binding); @@ -259,8 +264,8 @@ RPC_STATUS RPCRT4_OpenBinding(RpcBinding* Binding, RpcConnection** Connection, /* create a new connection */ status = RPCRT4_CreateConnection(&NewConnection, Binding->server, Binding->Protseq, Binding->NetworkAddr, - Binding->Endpoint, NULL, Binding->AuthInfo, - Binding->QOS, Binding); + Binding->Endpoint, Binding->NetworkOptions, + Binding->AuthInfo, Binding->QOS, Binding); if (status != RPC_S_OK) return status; @@ -873,6 +878,7 @@ RPC_STATUS RPC_ENTRY RpcBindingCopy( DestBinding->Protseq = RPCRT4_strndupA(SrcBinding->Protseq, -1); DestBinding->NetworkAddr = RPCRT4_strndupA(SrcBinding->NetworkAddr, -1); DestBinding->Endpoint = RPCRT4_strndupA(SrcBinding->Endpoint, -1); + DestBinding->NetworkOptions = RPCRT4_strdupW(SrcBinding->NetworkOptions); if (SrcBinding->AuthInfo) RpcAuthInfo_AddRef(SrcBinding->AuthInfo); DestBinding->AuthInfo = SrcBinding->AuthInfo; diff --git a/dlls/rpcrt4/rpc_binding.h b/dlls/rpcrt4/rpc_binding.h index 6b5ca216584..76100d6928e 100644 --- a/dlls/rpcrt4/rpc_binding.h +++ b/dlls/rpcrt4/rpc_binding.h @@ -52,6 +52,7 @@ typedef struct _RpcConnection BOOL server; LPSTR NetworkAddr; LPSTR Endpoint; + LPWSTR NetworkOptions; const struct connection_ops *ops; USHORT MaxTransmissionSize; /* The active interface bound to server. */ @@ -92,6 +93,7 @@ typedef struct _RpcBinding LPSTR Protseq; LPSTR NetworkAddr; LPSTR Endpoint; + LPWSTR NetworkOptions; RPC_BLOCKING_FN BlockingFn; ULONG ServerTid; RpcConnection* FromConn; @@ -102,7 +104,7 @@ typedef struct _RpcBinding } RpcBinding; LPSTR RPCRT4_strndupA(LPCSTR src, INT len); -LPWSTR RPCRT4_strndupW(LPWSTR src, INT len); +LPWSTR RPCRT4_strndupW(LPCWSTR src, INT len); LPSTR RPCRT4_strdupWtoA(LPWSTR src); LPWSTR RPCRT4_strdupAtoW(LPSTR src); void RPCRT4_strfree(LPSTR src); @@ -117,7 +119,7 @@ ULONG RpcQualityOfService_Release(RpcQualityOfService *qos); RpcConnection *RPCRT4_GetIdleConnection(const RPC_SYNTAX_IDENTIFIER *InterfaceId, const RPC_SYNTAX_IDENTIFIER *TransferSyntax, LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, const RpcAuthInfo* AuthInfo, const RpcQualityOfService *QOS); void RPCRT4_ReleaseIdleConnection(RpcConnection *Connection); -RPC_STATUS RPCRT4_CreateConnection(RpcConnection** Connection, BOOL server, LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCSTR NetworkOptions, RpcAuthInfo* AuthInfo, RpcQualityOfService *QOS, RpcBinding* Binding); +RPC_STATUS RPCRT4_CreateConnection(RpcConnection** Connection, BOOL server, LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAuthInfo* AuthInfo, RpcQualityOfService *QOS, RpcBinding* Binding); RPC_STATUS RPCRT4_DestroyConnection(RpcConnection* Connection); RPC_STATUS RPCRT4_OpenClientConnection(RpcConnection* Connection); RPC_STATUS RPCRT4_CloseConnection(RpcConnection* Connection); diff --git a/dlls/rpcrt4/rpc_transport.c b/dlls/rpcrt4/rpc_transport.c index c92d79dc542..bf998bb5245 100644 --- a/dlls/rpcrt4/rpc_transport.c +++ b/dlls/rpcrt4/rpc_transport.c @@ -1336,7 +1336,7 @@ RPC_STATUS RPCRT4_CloseConnection(RpcConnection* Connection) RPC_STATUS RPCRT4_CreateConnection(RpcConnection** Connection, BOOL server, LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, - LPCSTR NetworkOptions, RpcAuthInfo* AuthInfo, RpcQualityOfService *QOS, + LPCWSTR NetworkOptions, RpcAuthInfo* AuthInfo, RpcQualityOfService *QOS, RpcBinding* Binding) { const struct connection_ops *ops; @@ -1355,6 +1355,7 @@ RPC_STATUS RPCRT4_CreateConnection(RpcConnection** Connection, BOOL server, NewConnection->ops = ops; NewConnection->NetworkAddr = RPCRT4_strdupA(NetworkAddr); NewConnection->Endpoint = RPCRT4_strdupA(Endpoint); + NewConnection->NetworkOptions = RPCRT4_strdupW(NetworkOptions); NewConnection->Used = Binding; NewConnection->MaxTransmissionSize = RPC_MAX_PACKET_SIZE; memset(&NewConnection->ActiveInterface, 0, sizeof(NewConnection->ActiveInterface)); @@ -1430,6 +1431,7 @@ RPC_STATUS RPCRT4_DestroyConnection(RpcConnection* Connection) RPCRT4_CloseConnection(Connection); RPCRT4_strfree(Connection->Endpoint); RPCRT4_strfree(Connection->NetworkAddr); + HeapFree(GetProcessHeap(), 0, Connection->NetworkOptions); if (Connection->AuthInfo) RpcAuthInfo_Release(Connection->AuthInfo); if (Connection->QOS) RpcQualityOfService_Release(Connection->QOS); HeapFree(GetProcessHeap(), 0, Connection);