ole32: Use proper interface pointer in CreateStub call.
This commit is contained in:
parent
e5edbc6fa0
commit
9bdb97e694
|
@ -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_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_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;
|
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;
|
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 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;
|
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);
|
ifstub = stub_manager_find_ifstub(manager, riid, mshlflags);
|
||||||
if (!ifstub) {
|
if (!ifstub) {
|
||||||
IRpcStubBuffer *stub = NULL;
|
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
|
/* IUnknown doesn't require a stub buffer, because it never goes out on
|
||||||
* the wire */
|
* the wire */
|
||||||
if (hr == S_OK && !IsEqualIID(riid, &IID_IUnknown))
|
if (!IsEqualIID(riid, &IID_IUnknown))
|
||||||
{
|
{
|
||||||
IPSFactoryBuffer *psfb;
|
IPSFactoryBuffer *psfb;
|
||||||
|
|
||||||
|
@ -176,12 +170,11 @@ HRESULT marshal_object(APARTMENT *apt, STDOBJREF *stdobjref, REFIID riid, IUnkno
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hr == S_OK) {
|
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)
|
if (!ifstub)
|
||||||
hr = E_OUTOFMEMORY;
|
hr = E_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
if (stub) IRpcStubBuffer_Release(stub);
|
if (stub) IRpcStubBuffer_Release(stub);
|
||||||
if (iobject) IUnknown_Release(iobject);
|
|
||||||
|
|
||||||
if (hr != S_OK) {
|
if (hr != S_OK) {
|
||||||
stub_manager_int_release(manager);
|
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 */
|
/* 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)
|
void *dest_context_data, MSHLFLAGS flags)
|
||||||
{
|
{
|
||||||
struct ifstub *stub;
|
struct ifstub *stub;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("oid=%s, stubbuffer=%p, iptr=%p, iid=%s\n",
|
TRACE("oid=%s, stubbuffer=%p, iid=%s\n", wine_dbgstr_longlong(m->oid), sb, debugstr_guid(iid));
|
||||||
wine_dbgstr_longlong(m->oid), sb, iptr, debugstr_guid(iid));
|
|
||||||
|
|
||||||
stub = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct ifstub));
|
stub = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct ifstub));
|
||||||
if (!stub) return NULL;
|
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);
|
hr = RPC_CreateServerChannel(dest_context, dest_context_data, &stub->chan);
|
||||||
if (hr != S_OK)
|
if (hr != S_OK)
|
||||||
{
|
{
|
||||||
|
IUnknown_Release(stub->iface);
|
||||||
HeapFree(GetProcessHeap(), 0, stub);
|
HeapFree(GetProcessHeap(), 0, stub);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -87,8 +94,6 @@ struct ifstub *stub_manager_new_ifstub(struct stub_manager *m, IRpcStubBuffer *s
|
||||||
stub->stubbuffer = sb;
|
stub->stubbuffer = sb;
|
||||||
if (sb) IRpcStubBuffer_AddRef(sb);
|
if (sb) IRpcStubBuffer_AddRef(sb);
|
||||||
|
|
||||||
IUnknown_AddRef(iptr);
|
|
||||||
stub->iface = iptr;
|
|
||||||
stub->flags = flags;
|
stub->flags = flags;
|
||||||
stub->iid = *iid;
|
stub->iid = *iid;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue