Jacek Caban : ole32: Use proper interface pointer in CreateStub call.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Aug 31 06:41:59 CDT 2015
Module: wine
Branch: master
Commit: 9bdb97e69498cd8d77f370f994ec1f320c741c36
URL: http://source.winehq.org/git/wine.git/?a=commit;h=9bdb97e69498cd8d77f370f994ec1f320c741c36
Author: Jacek Caban <jacek at codeweavers.com>
Date: Fri Aug 28 14:59:31 2015 +0200
ole32: Use proper interface pointer in CreateStub call.
---
dlls/ole32/compobj_private.h | 2 +-
dlls/ole32/marshal.c | 11 ++---------
dlls/ole32/stubmanager.c | 15 ++++++++++-----
3 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/dlls/ole32/compobj_private.h b/dlls/ole32/compobj_private.h
index f11186c..9f56d47 100644
--- a/dlls/ole32/compobj_private.h
+++ b/dlls/ole32/compobj_private.h
@@ -187,7 +187,7 @@ HRESULT FTMarshalCF_Create(REFIID riid, LPVOID *ppv) DECLSPEC_HIDDEN;
ULONG stub_manager_int_release(struct stub_manager *This) DECLSPEC_HIDDEN;
ULONG stub_manager_ext_addref(struct stub_manager *m, ULONG refs, BOOL tableweak) DECLSPEC_HIDDEN;
ULONG stub_manager_ext_release(struct stub_manager *m, ULONG refs, BOOL tableweak, BOOL last_unlock_releases) DECLSPEC_HIDDEN;
-struct ifstub *stub_manager_new_ifstub(struct stub_manager *m, IRpcStubBuffer *sb, IUnknown *iptr, REFIID iid,
+struct ifstub *stub_manager_new_ifstub(struct stub_manager *m, IRpcStubBuffer *sb, REFIID iid,
DWORD dest_context, void *dest_context_data, MSHLFLAGS flags) DECLSPEC_HIDDEN;
struct ifstub *stub_manager_find_ifstub(struct stub_manager *m, REFIID iid, MSHLFLAGS flags) DECLSPEC_HIDDEN;
struct stub_manager *get_stub_manager(APARTMENT *apt, OID oid) DECLSPEC_HIDDEN;
diff --git a/dlls/ole32/marshal.c b/dlls/ole32/marshal.c
index d142b93..73b9409 100644
--- a/dlls/ole32/marshal.c
+++ b/dlls/ole32/marshal.c
@@ -148,16 +148,10 @@ HRESULT marshal_object(APARTMENT *apt, STDOBJREF *stdobjref, REFIID riid, IUnkno
ifstub = stub_manager_find_ifstub(manager, riid, mshlflags);
if (!ifstub) {
IRpcStubBuffer *stub = NULL;
- IUnknown *iobject = NULL; /* object of type riid */
-
- hr = IUnknown_QueryInterface(object, riid, (void **)&iobject);
- if (hr != S_OK)
- ERR("object doesn't expose interface %s, failing with error 0x%08x\n",
- debugstr_guid(riid), hr);
/* IUnknown doesn't require a stub buffer, because it never goes out on
* the wire */
- if (hr == S_OK && !IsEqualIID(riid, &IID_IUnknown))
+ if (!IsEqualIID(riid, &IID_IUnknown))
{
IPSFactoryBuffer *psfb;
@@ -176,12 +170,11 @@ HRESULT marshal_object(APARTMENT *apt, STDOBJREF *stdobjref, REFIID riid, IUnkno
}
if (hr == S_OK) {
- ifstub = stub_manager_new_ifstub(manager, stub, iobject, riid, dest_context, dest_context_data, mshlflags);
+ ifstub = stub_manager_new_ifstub(manager, stub, riid, dest_context, dest_context_data, mshlflags);
if (!ifstub)
hr = E_OUTOFMEMORY;
}
if (stub) IRpcStubBuffer_Release(stub);
- if (iobject) IUnknown_Release(iobject);
if (hr != S_OK) {
stub_manager_int_release(manager);
diff --git a/dlls/ole32/stubmanager.c b/dlls/ole32/stubmanager.c
index 1f79ff5..3b9086d 100644
--- a/dlls/ole32/stubmanager.c
+++ b/dlls/ole32/stubmanager.c
@@ -65,21 +65,28 @@ static inline HRESULT generate_ipid(struct stub_manager *m, IPID *ipid)
}
/* registers a new interface stub COM object with the stub manager and returns registration record */
-struct ifstub *stub_manager_new_ifstub(struct stub_manager *m, IRpcStubBuffer *sb, IUnknown *iptr, REFIID iid, DWORD dest_context,
+struct ifstub *stub_manager_new_ifstub(struct stub_manager *m, IRpcStubBuffer *sb, REFIID iid, DWORD dest_context,
void *dest_context_data, MSHLFLAGS flags)
{
struct ifstub *stub;
HRESULT hr;
- TRACE("oid=%s, stubbuffer=%p, iptr=%p, iid=%s\n",
- wine_dbgstr_longlong(m->oid), sb, iptr, debugstr_guid(iid));
+ TRACE("oid=%s, stubbuffer=%p, iid=%s\n", wine_dbgstr_longlong(m->oid), sb, debugstr_guid(iid));
stub = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct ifstub));
if (!stub) return NULL;
+ hr = IUnknown_QueryInterface(m->object, iid, (void **)&stub->iface);
+ if (hr != S_OK)
+ {
+ HeapFree(GetProcessHeap(), 0, stub);
+ return NULL;
+ }
+
hr = RPC_CreateServerChannel(dest_context, dest_context_data, &stub->chan);
if (hr != S_OK)
{
+ IUnknown_Release(stub->iface);
HeapFree(GetProcessHeap(), 0, stub);
return NULL;
}
@@ -87,8 +94,6 @@ struct ifstub *stub_manager_new_ifstub(struct stub_manager *m, IRpcStubBuffer *s
stub->stubbuffer = sb;
if (sb) IRpcStubBuffer_AddRef(sb);
- IUnknown_AddRef(iptr);
- stub->iface = iptr;
stub->flags = flags;
stub->iid = *iid;
More information about the wine-cvs
mailing list