Partager via


IClientSecurity::CopyProxy (Compact 2013)

3/26/2014

This method makes a private copy of the proxy for the specified interface.

Syntax

HRESULT CopyProxy(
  IUnknown* pProxy,
  IUnknown** ppCopy 
);

Parameters

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

Return Value

  • 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.

Anyone can query for a proxy and change security levels on it using SetBlanket. However, when you make 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 levels 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.

To determine whether the platform supports this interface, see Determining Supported COM APIs.

Requirements

Header

objidl.h,
objidl.idl

Library

ole32.lib,
uuid.lib

See Also

Reference

IClientSecurity
CoCopyProxy