HRESULT CMyDevice::QueryInterface( _In_ REFIID InterfaceId, _Outptr_ PVOID *Object ) /*++ Routine Description: This method is called to get a pointer to one of the object's callback interfaces. Since the skeleton driver doesn't support any of the device events, this method simply calls the base class's BaseQueryInterface. If the skeleton is extended to include device event interfaces then this method must be changed to check the IID and return pointers to them as appropriate. Arguments: InterfaceId - the interface being requested Object - a location to store the interface pointer if successful Return Value: S_OK or E_NOINTERFACE --*/ { HRESULT hr; if (IsEqualIID(InterfaceId, __uuidof(IPnpCallbackHardware))) { *Object = QueryIPnpCallbackHardware(); hr = S_OK; } else if (IsEqualIID(InterfaceId, __uuidof(IPnpCallback))) { *Object = QueryIPnpCallback(); hr = S_OK; } else if (IsEqualIID(InterfaceId, __uuidof(IRequestCallbackRequestCompletion))) { *Object = QueryIRequestCallbackRequestCompletion(); hr = S_OK; } else { hr = CUnknown::QueryInterface(InterfaceId, Object); } return hr; }
HRESULT CMyDevice::QueryInterface( __in REFIID InterfaceId, __deref_out PVOID *Object ) /*++ Routine Description: This method is called to get a pointer to one of the object's callback interfaces. Arguments: InterfaceId - the interface being requested Object - a location to store the interface pointer if successful Return Value: S_OK or E_NOINTERFACE --*/ { HRESULT hr; if (IsEqualIID(InterfaceId, __uuidof(IPnpCallbackHardware))) { *Object = QueryIPnpCallbackHardware(); hr = S_OK; } else if (IsEqualIID(InterfaceId, __uuidof(IPnpCallback))) { *Object = QueryIPnpCallback(); hr = S_OK; } else if (IsEqualIID(InterfaceId, __uuidof(IUsbTargetPipeContinuousReaderCallbackReadersFailed))) { *Object = QueryContinousReaderFailureCompletion(); hr = S_OK; } else if( IsEqualIID(InterfaceId, __uuidof(IUsbTargetPipeContinuousReaderCallbackReadComplete))) { *Object = QueryContinousReaderCompletion(); hr = S_OK; } else { hr = CUnknown::QueryInterface(InterfaceId, Object); } return hr; }