IClientSecurity::CopyProxy method

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


HRESULT CopyProxy(
  [in]  IUnknown *pProxy,
  [out] IUnknown **ppCopy


pProxy [in]

A pointer to the interface whose proxy is to be copied. This parameter cannot be NULL.

ppCopy [out]

A pointer to the IUnknown interface pointer that receives the copy of the proxy. This parameter cannot be NULL.

Return value

This method can return the following values.

Return codeDescription

The method completed successfully.


One or more arguments are not valid.



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 CopyProxy with the IClientSecurity pointer, and the release of the IClientSecurity pointer.


Minimum supported client

Windows 2000 Professional [desktop apps | Windows Store apps]

Minimum supported server

Windows 2000 Server [desktop apps | Windows Store apps]






IID_IClientSecurity is defined as 0000013D-0000-0000-C000-000000000046

See also