Jacek Caban : oleaut32: Ensure that we' re using the right interface in CreateStub implementation.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Sep 4 07:03:43 CDT 2015


Module: wine
Branch: master
Commit: af944cefdfb912eba0d17134f019b0be5b5f1729
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=af944cefdfb912eba0d17134f019b0be5b5f1729

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Sep  4 11:49:30 2015 +0200

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 a2d1ea1..6608aed 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;
 }
 




More information about the wine-cvs mailing list