Microsoft KB Archive/909107

= You may receive an &quot;E_NOINTERFACE&quot; error message when you query the IWMDMDevice interface or the IWMDMDevice2 interface for the IWMDMDevice3 interface in the Windows Media Device Manager 10 SDK =

Article ID: 909107

Article Last Modified on 11/17/2005

-

APPLIES TO


 * Windows Media Format 9.5 Software Development Kit x64 Edition

-





SYMPTOMS
In the Microsoft Windows Media Device Manager 10 Software Development Kit (SDK), when you query the IWMDMDevice interface or the IWMDMDevice2 interface for the IWMDMDevice3 interface, you may receive an &quot;E_NOINTERFACE&quot; error message under certain circumstances.

This behavior only occurs if you query the IComponentAuthenticate interface for the IWMDeviceManager interface, and then you try to query for the IWMDMDevice interfaces.

Note The Windows Media Device Manager 10 SDK is included with the Microsoft Windows Media Format 9.5 SDK.



CAUSE
This behavior occurs because of the way that the IWMDMDevice3 interface was added to extend the functionality of the Windows Media Device Manager 10 SDK.



RESOLUTION
Instead of querying the IComponentAuthenticate interface for the IWMDeviceManger interface, query the IComponentAuthenticate interface for the IWMDeviceManager2 interface. When you do this, you also must make sure that you use the EnumDevices2 method to access the appropriate IWMDMDevice interface.



STATUS
This behavior is by design.



MORE INFORMATION
You must use the new IWMDeviceManager2 interface together with the EnumDevices2 method to expose an IWMDMDevice interface that contains the new IWMDMDevice3 interface.

The following code example demonstrates how to set up the required components to let you access the IWMDMDevice3 interface. This code assumes that at least one device is connected to the system.

Note This code only accesses the first device in the enumeration. Additional code is required to iterate through all attached devices. // The following are generic keys. BYTE abPVK[] = {0x00}; BYTE abCert[] = {0x00};

IComponentAuthenticate* pICompAuth; IWMDeviceManager2* pIdvMgr;

// Create the authentication component. HRESULT hr = CoCreateInstance(CLSID_MediaDevMgr, NULL, _ CLSCTX_INPROC_SERVER, IID_IComponentAuthenticate, (void _ **)&pICompAuth); if(FAILED ( hr )) {  return; }

CSecureChannelClient* m_pSacClient = new CSecureChannelClient;

// Set up the client by using the default certificates. // hr = m_pSacClient->SetCertificate(SAC_CERT_V1, (BYTE*) abCert, _ sizeof(abCert), (BYTE*) abPVK, sizeof(abPVK)); if(FAILED(hr)) {  return; }

// Set the authentication interface of the client. // m_pSacClient->SetInterface(pICompAuth);

// Authenticate by using the V1 protocol // hr = m_pSacClient->Authenticate(SAC_PROTOCOL_V1); if(FAILED(hr)) {  return; }

// Query for the IWMDeviceManger2 interface. The IWMDeviceManger2 interface // is required to access the IWMDMDevice3 interface. // hr = pICompAuth->QueryInterface(IID_IWMDeviceManager2, _ (void**)&pIdvMgr); if(FAILED(hr)) {  return; }

// Use the EnumDevices2 method to access an IWMDMDevice // interface that exposes the IWMDMDevice3 interface. // IWMDMEnumDevice* pIEnmDvc = NULL; hr = pIdvMgr->EnumDevices2(&pIEnmDvc); if(FAILED(hr)) {  return; }

IWMDMDevice* pIdv; ULONG ulOut = 0;

// Enumerate the attached devices. Take the first // attached device. // hr = pIEnmDvc->Next(1, &pIdv, &ulOut); if(FAILED(hr) || hr == S_FALSE) {  return; }

// Query for the IWMDMDevice3 interface. // IWMDMDevice3 *pIDevice3; hr = pIdv->QueryInterface(IID_IWMDMDevice3, (void**)&pIDevice3); if(FAILED(hr)) {  return; }

Keywords: kbprb KB909107

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.