Commit d1a480a2 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

ole32: Introduce new ipid_to_ifstub helper and use it in ipid_get_dispatch_params.

parent 7f83dd11
...@@ -470,7 +470,7 @@ ULONG stub_manager_ext_release(struct stub_manager *m, ULONG refs, BOOL tablewea ...@@ -470,7 +470,7 @@ ULONG stub_manager_ext_release(struct stub_manager *m, ULONG refs, BOOL tablewea
/* gets the stub manager associated with an ipid - caller must have /* gets the stub manager associated with an ipid - caller must have
* a reference to the apartment while a reference to the stub manager is held. * a reference to the apartment while a reference to the stub manager is held.
* it must also call release on the stub manager when it is no longer needed */ * it must also call release on the stub manager when it is no longer needed */
static struct stub_manager *get_stub_manager_from_ipid(APARTMENT *apt, const IPID *ipid) static struct stub_manager *get_stub_manager_from_ipid(APARTMENT *apt, const IPID *ipid, struct ifstub **ifstub)
{ {
struct stub_manager *result = NULL; struct stub_manager *result = NULL;
struct list *cursor; struct list *cursor;
...@@ -480,7 +480,7 @@ static struct stub_manager *get_stub_manager_from_ipid(APARTMENT *apt, const IPI ...@@ -480,7 +480,7 @@ static struct stub_manager *get_stub_manager_from_ipid(APARTMENT *apt, const IPI
{ {
struct stub_manager *m = LIST_ENTRY( cursor, struct stub_manager, entry ); struct stub_manager *m = LIST_ENTRY( cursor, struct stub_manager, entry );
if (stub_manager_ipid_to_ifstub(m, ipid)) if ((*ifstub = stub_manager_ipid_to_ifstub(m, ipid)))
{ {
result = m; result = m;
stub_manager_int_addref(result); stub_manager_int_addref(result);
...@@ -497,7 +497,8 @@ static struct stub_manager *get_stub_manager_from_ipid(APARTMENT *apt, const IPI ...@@ -497,7 +497,8 @@ static struct stub_manager *get_stub_manager_from_ipid(APARTMENT *apt, const IPI
return result; return result;
} }
static HRESULT ipid_to_stub_manager(const IPID *ipid, APARTMENT **stub_apt, struct stub_manager **stubmgr_ret) static HRESULT ipid_to_ifstub(const IPID *ipid, APARTMENT **stub_apt,
struct stub_manager **stubmgr_ret, struct ifstub **ifstub)
{ {
/* FIXME: hack for IRemUnknown */ /* FIXME: hack for IRemUnknown */
if (ipid->Data2 == 0xffff) if (ipid->Data2 == 0xffff)
...@@ -509,7 +510,7 @@ static HRESULT ipid_to_stub_manager(const IPID *ipid, APARTMENT **stub_apt, stru ...@@ -509,7 +510,7 @@ static HRESULT ipid_to_stub_manager(const IPID *ipid, APARTMENT **stub_apt, stru
TRACE("Couldn't find apartment corresponding to TID 0x%04x\n", ipid->Data2); TRACE("Couldn't find apartment corresponding to TID 0x%04x\n", ipid->Data2);
return RPC_E_INVALID_OBJECT; return RPC_E_INVALID_OBJECT;
} }
*stubmgr_ret = get_stub_manager_from_ipid(*stub_apt, ipid); *stubmgr_ret = get_stub_manager_from_ipid(*stub_apt, ipid, ifstub);
if (!*stubmgr_ret) if (!*stubmgr_ret)
{ {
apartment_release(*stub_apt); apartment_release(*stub_apt);
...@@ -519,6 +520,12 @@ static HRESULT ipid_to_stub_manager(const IPID *ipid, APARTMENT **stub_apt, stru ...@@ -519,6 +520,12 @@ static HRESULT ipid_to_stub_manager(const IPID *ipid, APARTMENT **stub_apt, stru
return S_OK; return S_OK;
} }
static HRESULT ipid_to_stub_manager(const IPID *ipid, APARTMENT **stub_apt, struct stub_manager **stub)
{
struct ifstub *ifstub;
return ipid_to_ifstub(ipid, stub_apt, stub, &ifstub);
}
/* gets the apartment, stub and channel of an object. the caller must /* gets the apartment, stub and channel of an object. the caller must
* release the references to all objects (except iface) if the function * release the references to all objects (except iface) if the function
* returned success, otherwise no references are returned. */ * returned success, otherwise no references are returned. */
...@@ -532,32 +539,22 @@ HRESULT ipid_get_dispatch_params(const IPID *ipid, APARTMENT **stub_apt, ...@@ -532,32 +539,22 @@ HRESULT ipid_get_dispatch_params(const IPID *ipid, APARTMENT **stub_apt,
APARTMENT *apt; APARTMENT *apt;
HRESULT hr; HRESULT hr;
hr = ipid_to_stub_manager(ipid, &apt, &stubmgr); hr = ipid_to_ifstub(ipid, &apt, &stubmgr, &ifstub);
if (hr != S_OK) return RPC_E_DISCONNECTED; if (hr != S_OK) return RPC_E_DISCONNECTED;
ifstub = stub_manager_ipid_to_ifstub(stubmgr, ipid); *stub = ifstub->stubbuffer;
if (ifstub) IRpcStubBuffer_AddRef(*stub);
{ *chan = ifstub->chan;
*stub = ifstub->stubbuffer; IRpcChannelBuffer_AddRef(*chan);
IRpcStubBuffer_AddRef(*stub); *stub_apt = apt;
*chan = ifstub->chan; *iid = ifstub->iid;
IRpcChannelBuffer_AddRef(*chan); *iface = ifstub->iface;
*stub_apt = apt;
*iid = ifstub->iid; if (manager)
*iface = ifstub->iface; *manager = stubmgr;
if (manager)
*manager = stubmgr;
else
stub_manager_int_release(stubmgr);
return S_OK;
}
else else
{
stub_manager_int_release(stubmgr); stub_manager_int_release(stubmgr);
apartment_release(apt); return S_OK;
return RPC_E_DISCONNECTED;
}
} }
/* returns TRUE if it is possible to unmarshal, FALSE otherwise. */ /* returns TRUE if it is possible to unmarshal, FALSE otherwise. */
......
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