Rob Shearman : rpcrt4: Stash away NetworkOptions passed in from the binding string so that transports can look at the string if needed .

Alexandre Julliard julliard at wine.codeweavers.com
Thu Jan 25 06:12:20 CST 2007


Module: wine
Branch: master
Commit: 961455c7f033110dad03dab7f0f688e9c89763fc
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=961455c7f033110dad03dab7f0f688e9c89763fc

Author: Rob Shearman <rob at codeweavers.com>
Date:   Thu Jan 25 10:23:11 2007 +0000

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 0034907..ffa9659 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(RpcBi
   } 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(RpcBi
     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(RpcBind
   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
   /* 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 6b5ca21..76100d6 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(RpcQua
 
 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 c92d79d..bf998bb 100644
--- a/dlls/rpcrt4/rpc_transport.c
+++ b/dlls/rpcrt4/rpc_transport.c
@@ -1336,7 +1336,7 @@ RPC_STATUS RPCRT4_CloseConnection(RpcCon
 
 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(RpcCo
   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(RpcC
   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);




More information about the wine-cvs mailing list