From af944cefdfb912eba0d17134f019b0be5b5f1729 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Fri, 4 Sep 2015 11:49:30 +0200 Subject: [PATCH] oleaut32: Ensure that we're using the right interface in CreateStub implementation. --- dlls/oleaut32/tmarshal.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/dlls/oleaut32/tmarshal.c b/dlls/oleaut32/tmarshal.c index a2d1ea185e1..6608aeda684 100644 --- a/dlls/oleaut32/tmarshal.c +++ b/dlls/oleaut32/tmarshal.c @@ -2282,6 +2282,7 @@ PSFacBuf_CreateStub( ITypeInfo *tinfo; TMStubImpl *stub; TYPEATTR *typeattr; + IUnknown *obj; TRACE("(%s,%p,%p)\n",debugstr_guid(riid),pUnkServer,ppStub); @@ -2291,16 +2292,26 @@ PSFacBuf_CreateStub( return hres; } + /* FIXME: This is not exactly right. We should probably call QI later. */ + hres = IUnknown_QueryInterface(pUnkServer, riid, (void**)&obj); + if (FAILED(hres)) { + WARN("Could not get %s iface: %08x\n", debugstr_guid(riid), hres); + obj = pUnkServer; + IUnknown_AddRef(obj); + } + stub = CoTaskMemAlloc(sizeof(TMStubImpl)); - if (!stub) + if (!stub) { + IUnknown_Release(obj); return E_OUTOFMEMORY; + } stub->IRpcStubBuffer_iface.lpVtbl = &tmstubvtbl; stub->ref = 1; stub->tinfo = tinfo; stub->dispatch_stub = NULL; stub->dispatch_derivative = FALSE; stub->iid = *riid; - hres = IRpcStubBuffer_Connect(&stub->IRpcStubBuffer_iface,pUnkServer); + hres = IRpcStubBuffer_Connect(&stub->IRpcStubBuffer_iface, obj); *ppStub = &stub->IRpcStubBuffer_iface; TRACE("IRpcStubBuffer: %p\n", stub); if (hres) @@ -2315,6 +2326,7 @@ PSFacBuf_CreateStub( ITypeInfo_ReleaseTypeAttr(tinfo, typeattr); } + IUnknown_Release(obj); return hres; }