HRESULT WrappedIDXGISwapChain2::GetDevice( /* [in] */ REFIID riid, /* [retval][out] */ void **ppDevice) { HRESULT ret = m_pReal->GetDevice(riid, ppDevice); if(SUCCEEDED(ret)) { // try one of the trivial wraps, we don't mind making a new one of those if(riid == __uuidof(ID3D11Device)) { // probably they're asking for the device device. *ppDevice = m_pDevice; m_pDevice->AddRef(); } else if(riid == __uuidof(IDXGISwapChain)) { // don't think anyone would try this, but what the hell. *ppDevice = this; AddRef(); } else if(!HandleWrap(riid, ppDevice)) { // can probably get away with returning the real result here, // but it worries me a bit. RDCUNIMPLEMENTED("Not returning trivial type"); } } return ret; }
HRESULT RefCountDXGIObject::WrapQueryInterface(IUnknown *real, REFIID riid, void **ppvObject) { HRESULT ret = real->QueryInterface(riid, ppvObject); if(SUCCEEDED(ret)) HandleWrap(riid, ppvObject); return ret; }
HRESULT STDMETHODCALLTYPE RefCountDXGIObject::GetParent( /* [in] */ REFIID riid, /* [retval][out] */ void **ppParent) { HRESULT ret = m_pReal->GetParent(riid, ppParent); if(SUCCEEDED(ret)) HandleWrap(riid, ppParent); return ret; }