IClientSecurity::CopyProxy

Makes a private copy of the proxy for the specified interface.

HRESULT CopyProxy(
  IUnknown *  pProxy,  //Pointer to the interface whose proxy 
                       // will be copied
  IUnknown **  ppCopy  //Address of output variable that receives 
                       // the IUnknown interface pointer of the 
                       // proxy copy
);
 

Parameters

pProxy
[in] Points to the interface whose proxy will be copied. May not be NULL.
ppCopy
[out] Address of IUnknown* pointer variable that receives the interface pointer to the copy of the proxy. It may not be NULL.

Return Values

S_OK
Success.
E_INVALIDARG
One or more arguments are invalid.

Remarks

IClientSecurity::CopyProxy is called by the client to make a private copy of the proxy for the specified interface. The proxy copy has default values for the authentication information. Its authentication information can be changed through a call to IClientSecurity::SetBlanket without affecting any other clients of the original proxy. The copy has one reference, and the caller of CopyProxy must ensure that the proxy copy gets freed.

Local interfaces, such as. IUnknown and IClientSecurity, cannot be copied. You cannot duplicate a proxy manager using CopyProxy.

Copies of the same proxy have a special relationship with respect to QueryInterface. Given a proxy, a, of the IA interface of a remote object, suppose a copy of a is created, called b. In this case, calling QueryInterface from the b proxy for IID_IA will not retrieve the IA interface on b, but the one on a, the original proxy.

Notice that anyone can query for a proxy and change security on it using SetBlanket. However, when you have made a copy of a proxy, no one can get the copy unless you give it to them. Only people who have the copy can set security on it.

The helper function CoCopyProxy encapsulates a QueryInterface call for a pointer to IClientSecurity, a call to IClientSecurity::CopyProxy with the IClientSecurity pointer, and the release of the IClientSecurity pointer.

QuickInfo

  Windows NT: Use version 4.0 or later.
  Windows: Use Windows 95 or later. Available as a redistributable for Windows 95.
  Windows CE: Unsupported.
  Header: Declared in objidl.h.

See Also

CoCopyProxy