RpcBindingCopy

The RpcBindingCopy function copies binding information and creates a new binding handle.

#include <rpc.h>
RPC_STATUS RPC_ENTRY RpcBindingCopy( 
  RPC_BINDING_HANDLE  SourceBinding,        
  RPC_BINDING_HANDLE *  DestinationBinding  
);
 

Parameters

SourceBinding
Specifies the server binding handle whose referenced binding information is copied.
DestinationBinding
Returns a pointer to the server binding handle that refers to the copied binding information.

Remarks

Note  Microsoft RPC supports RpcBindingCopy only in client applications, not in server applications.

The RpcBindingCopy routine copies the server-binding information referenced by the SourceBinding argument. RpcBindingCopy uses the DestinationBinding argument to return a new server binding handle for the copied binding information. RpcBindingCopy also copies the authentication information from the SourceBinding argument to the DestinationBinding argument.

An application uses RpcBindingCopy when it wants to keep a change made to binding information by one thread from affecting the binding information used by other threads.

Once an application calls RpcBindingCopy, operations performed on the SourceBinding binding handle do not affect the binding information referenced by the DestinationBinding binding handle. Similarly, operations performed on the DestinationBinding binding handle do not affect the binding information referenced by the SourceBinding binding handle.

If an application wants one thread's changes to binding information to affect the binding information used by other threads, the application should share a single binding handle across the threads. In this case, the application is responsible for binding-handle concurrency control.

When an application is finished using the binding handle specified by the DestinationBinding argument, the application should call the RpcBindingFree routine to release the memory used by the DestinationBinding binding handle and its referenced binding information.

Return Values

Value Meaning
RPC_S_OK Success
RPC_S_INVALID_BINDING Invalid binding handle
RPC_S_WRONG_KIND_OF_BINDING Wrong kind of binding for operation

QuickInfo

  Windows NT: Yes
  Windows CE: Unsupported.
  Header: Declared in rpcdce.h.
  Import Library: Link with rpcrt4.lib.

See Also

RpcBindingFree