次の方法で共有


CSecureChannelClient::SetInterface

banner art

The SetInterface method is used by applications to set the IComponentAuthenticate interface to use for Secure Authenticated Channel (SAC) operations.

Syntax

void SetInterface(
  IComponentAuthenticate*  pComponentAuth
);

Parameters

  pComponentAuth

[in] Pointer to an IComponentAuthenticate interface.

Return Values

The method returns an HRESULT. All the interface methods in Windows Media Device Manager and service provider can return any of the following classes of error codes:

  • Standard COM error codes
  • Windows error codes converted to HRESULT values
  • Windows Media Device Manager error codes

For a complete list of possible error codes, see Error Codes.

Possible values include, but are not limited to, those in the following table.

Return code Description
S_OK The method succeeded.
E_INVALIDARG The pComponentAuth parameter is invalid or is a NULL pointer.
E_FAIL An unspecified error occurred.

Remarks

The SAC interface is the IComponentAuthenticate interface. Applications use the IComponentAuthenticate interface provided in Windows Media Device Manager. Service providers and secure content providers must implement their own IComponentAuthenticate interface.

CoCreateInstance must be called first to acquire the IcomponentAuthenticate interface.

Example Code

IComponentAuthenticate *pAuth = NULL;
CSecureChannelClient SAC;
HRESULT hr;
hr = CoCreateInstance( CLSID_MediaDevMgr, 
                       NULL, 
                       CLSCTX_INPROC_SERVER,
                       IID_IComponentAuthenticate, 
                       (void**) &pAuth );

if (SUCCEEDED(hr))
{
    hr = SAC.SetCertificate ( (BYTE*) abCert, 
                              sizeof (abCert),
                              (BYTE*) abPVK, 
                              sizeof (abPVK) );
    
    SAC.SetInterface(pAuth);
    
    hr = SAC.Authenticate(SAC_PROTOCOL_V1);
    If (FAILED(hr))
        Goto exit;
    hr = pAuth->QueryInterface(IID_IWMDeviceManager, 
                               (void**) &pDevMgr);
    If (FAILED (hr))
        Goto exit;
}

Requirements

Header: Include scclient.h.

Library: mssachlp.lib

See Also