Beispiel #1
0
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;
}
Beispiel #2
0
HRESULT
STDMETHODCALLTYPE
CMyReadWriteQueue::QueryInterface(
    __in REFIID InterfaceId,
    __deref_out PVOID *Object
    )
/*++

Routine Description:


    Query Interface

Aruments:

    Follows COM specifications

Return Value:

    HRESULT indicatin success or failure

--*/
{
    HRESULT hr;


    if (IsEqualIID(InterfaceId, __uuidof(IQueueCallbackWrite)))
    {
        hr = S_OK;
        *Object = QueryIQueueCallbackWrite();
    }
    else if (IsEqualIID(InterfaceId, __uuidof(IQueueCallbackRead)))
    {
        hr = S_OK;
        *Object = QueryIQueueCallbackRead();
    }
    else if (IsEqualIID(InterfaceId, __uuidof(IRequestCallbackRequestCompletion)))
    {
        hr = S_OK;
        *Object = QueryIRequestCallbackRequestCompletion();
    }
    else if (IsEqualIID(InterfaceId, __uuidof(IQueueCallbackIoStop)))
    {
        hr = S_OK;
        *Object = QueryIQueueCallbackIoStop();
    }
    else
    {
        hr = CMyQueue::QueryInterface(InterfaceId, Object);
    }

    return hr;
}
HRESULT
CMyRemoteTarget::QueryInterface(
    _In_  REFIID  InterfaceId,
    _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(IRequestCallbackRequestCompletion))) 
    {    
        *Object = QueryIRequestCallbackRequestCompletion();
        hr = S_OK;  
    }
    else if(IsEqualIID(InterfaceId, __uuidof(IRemoteTargetCallbackRemoval))) 
    {    
        *Object = QueryIRemoteTargetCallbackRemoval();
        hr = S_OK;  
    }
    else if(IsEqualIID(InterfaceId, __uuidof(IObjectCleanup))) 
    {    
        *Object = QueryIObjectCleanup();
        hr = S_OK;  
    }
    else
    {
        hr = CUnknown::QueryInterface(InterfaceId, Object);
    }
    
    return hr;
}