From: christian on
Hi all
I'm writing an UMDF driver for USB and took the OSRUSBFX2 example from WDK
6000 as a starting point. Now I have some problems to retrieve the 2nd
interface. Here is a code snippet from the implementation
(CDevice::OnPrepareHardware):

HRESULT hr;
IWDFUsbTargetFactory * pIUsbTargetFactory = NULL;
IWDFUsbTargetDevice * pIUsbTargetDevice = NULL;
IWDFUsbInterface * pIUsbInterface = NULL;

hr = m_FxDevice->QueryInterface(IID_PPV_ARGS(&pIUsbTargetFactory));
hr = pIUsbTargetFactory->CreateUsbTargetDevice( &pIUsbTargetDevice);
UCHAR NumInterfaces = pIUsbTargetDevice->GetNumInterfaces();
if (NumInterfaces == 2)
hr = pIUsbTargetDevice->RetrieveUsbInterface(1, &pIUsbInterface);
else
hr = pIUsbTargetDevice->RetrieveUsbInterface(0, &pIUsbInterface);

If the device has 1 interface,no problem. But I have to implement a device
which has 2 interfaces, and I want get the second, because there are my
wanted BULK endpoints.

Please can anyone help me on this problem?

Best regards