Beispiel #1
0
//===============================================================================================
// FUNCTION: QueryInterface
// PURPOSE:  This method returns a reference to the request interface, if it exists.
//
BOOL CUnknown::QueryInterface(REFIID riid, CUnknown *pUnknown)
{
   MEMBERASSERT();
   WPTRASSERT(pUnknown);
   ASSERT(m_pInterface!=NULL);
   
   // Clear the interface in the return object in case of failure.
   pUnknown->SetInterface(NULL);

   // Query for the interface.   
   void *pInterface = NULL;
   if (!_QueryInterface(riid, &pInterface))
      return FALSE;
      
   // Set the return value.      
   pUnknown->SetInterface(PUNKNOWN(pInterface));
   return TRUE;
}
		HResult _Chain(void *pThis, void* pChain, SCOM_RIID riid, void **ppv)
		{
			_CHAINDATA* pcd = static_cast<_CHAINDATA*>(pChain);
			void* p = (void*)((unsigned long)pThis + pcd->dwOffset);
			return _QueryInterface(p, pcd->pFunc(), riid, ppv);
		}