Commit 9bdb97e6 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

ole32: Use proper interface pointer in CreateStub call.

parent e5edbc6f
......@@ -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;
......
......@@ -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);
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment