Commit a42f5f19 authored by Connor McAdams's avatar Connor McAdams Committed by Alexandre Julliard

combase: Use correct destination context in CoUnmarshalInterface when using the standard marshaler.

parent b87c502a
...@@ -256,4 +256,5 @@ struct ifstub * stub_manager_new_ifstub(struct stub_manager *m, IRpcStubBuffer * ...@@ -256,4 +256,5 @@ struct ifstub * stub_manager_new_ifstub(struct stub_manager *m, IRpcStubBuffer *
HRESULT ipid_get_dispatch_params(const IPID *ipid, struct apartment **stub_apt, HRESULT ipid_get_dispatch_params(const IPID *ipid, struct apartment **stub_apt,
struct stub_manager **manager, IRpcStubBuffer **stub, IRpcChannelBuffer **chan, struct stub_manager **manager, IRpcStubBuffer **stub, IRpcChannelBuffer **chan,
IID *iid, IUnknown **iface); IID *iid, IUnknown **iface);
HRESULT ipid_get_dest_context(const IPID *ipid, MSHCTX *dest_context, void **dest_context_data);
HRESULT start_apartment_remote_unknown(struct apartment *apt); HRESULT start_apartment_remote_unknown(struct apartment *apt);
...@@ -698,7 +698,7 @@ HRESULT WINAPI CoReleaseMarshalData(IStream *stream) ...@@ -698,7 +698,7 @@ HRESULT WINAPI CoReleaseMarshalData(IStream *stream)
} }
static HRESULT std_unmarshal_interface(MSHCTX dest_context, void *dest_context_data, static HRESULT std_unmarshal_interface(MSHCTX dest_context, void *dest_context_data,
IStream *stream, REFIID riid, void **ppv) IStream *stream, REFIID riid, void **ppv, BOOL dest_context_known)
{ {
struct stub_manager *stubmgr = NULL; struct stub_manager *stubmgr = NULL;
struct OR_STANDARD obj; struct OR_STANDARD obj;
...@@ -757,6 +757,8 @@ static HRESULT std_unmarshal_interface(MSHCTX dest_context, void *dest_context_d ...@@ -757,6 +757,8 @@ static HRESULT std_unmarshal_interface(MSHCTX dest_context, void *dest_context_d
{ {
if (!stub_manager_notify_unmarshal(stubmgr, &obj.std.ipid)) if (!stub_manager_notify_unmarshal(stubmgr, &obj.std.ipid))
hres = CO_E_OBJNOTCONNECTED; hres = CO_E_OBJNOTCONNECTED;
if (SUCCEEDED(hres) && !dest_context_known)
hres = ipid_get_dest_context(&obj.std.ipid, &dest_context, &dest_context_data);
} }
else else
{ {
...@@ -803,7 +805,7 @@ HRESULT WINAPI CoUnmarshalInterface(IStream *stream, REFIID riid, void **ppv) ...@@ -803,7 +805,7 @@ HRESULT WINAPI CoUnmarshalInterface(IStream *stream, REFIID riid, void **ppv)
hr = get_unmarshaler_from_stream(stream, &marshal, &iid); hr = get_unmarshaler_from_stream(stream, &marshal, &iid);
if (hr == S_FALSE) if (hr == S_FALSE)
{ {
hr = std_unmarshal_interface(0, NULL, stream, &iid, (void **)&object); hr = std_unmarshal_interface(0, NULL, stream, &iid, (void **)&object, FALSE);
if (hr != S_OK) if (hr != S_OK)
ERR("StdMarshal UnmarshalInterface failed, hr %#lx\n", hr); ERR("StdMarshal UnmarshalInterface failed, hr %#lx\n", hr);
} }
...@@ -2183,7 +2185,7 @@ static HRESULT WINAPI StdMarshalImpl_UnmarshalInterface(IMarshal *iface, IStream ...@@ -2183,7 +2185,7 @@ static HRESULT WINAPI StdMarshalImpl_UnmarshalInterface(IMarshal *iface, IStream
return E_NOTIMPL; return E_NOTIMPL;
} }
return std_unmarshal_interface(marshal->dest_context, marshal->dest_context_data, stream, riid, ppv); return std_unmarshal_interface(marshal->dest_context, marshal->dest_context_data, stream, riid, ppv, TRUE);
} }
static HRESULT WINAPI StdMarshalImpl_ReleaseMarshalData(IMarshal *iface, IStream *stream) static HRESULT WINAPI StdMarshalImpl_ReleaseMarshalData(IMarshal *iface, IStream *stream)
......
...@@ -554,6 +554,31 @@ HRESULT ipid_get_dispatch_params(const IPID *ipid, struct apartment **stub_apt, ...@@ -554,6 +554,31 @@ HRESULT ipid_get_dispatch_params(const IPID *ipid, struct apartment **stub_apt,
return S_OK; return S_OK;
} }
HRESULT ipid_get_dest_context(const IPID *ipid, MSHCTX *dest_context, void **dest_context_data)
{
struct stub_manager *stubmgr;
struct ifstub *ifstub;
struct apartment *apt;
void *data;
HRESULT hr;
DWORD ctx;
hr = ipid_to_ifstub(ipid, &apt, &stubmgr, &ifstub);
if (hr != S_OK) return RPC_E_DISCONNECTED;
hr = IRpcChannelBuffer_GetDestCtx(ifstub->chan, &ctx, &data);
if (SUCCEEDED(hr))
{
*dest_context = ctx;
*dest_context_data = data;
}
stub_manager_int_release(stubmgr);
apartment_release(apt);
return hr;
}
/* returns TRUE if it is possible to unmarshal, FALSE otherwise. */ /* returns TRUE if it is possible to unmarshal, FALSE otherwise. */
BOOL stub_manager_notify_unmarshal(struct stub_manager *m, const IPID *ipid) BOOL stub_manager_notify_unmarshal(struct stub_manager *m, const IPID *ipid)
{ {
......
...@@ -589,7 +589,7 @@ static HRESULT WINAPI RpcProxyBuffer_Connect(IRpcProxyBuffer *iface, IRpcChannel ...@@ -589,7 +589,7 @@ static HRESULT WINAPI RpcProxyBuffer_Connect(IRpcProxyBuffer *iface, IRpcChannel
hr = IRpcChannelBuffer_GetDestCtx(pRpcChannelBuffer, &dest_context, &dest_context_data); hr = IRpcChannelBuffer_GetDestCtx(pRpcChannelBuffer, &dest_context, &dest_context_data);
ok(hr == S_OK, "GetDestCtx failed: %08lx\n", hr); ok(hr == S_OK, "GetDestCtx failed: %08lx\n", hr);
todo_wine ok(dest_context == MSHCTX_INPROC, "desc_context = %lx\n", dest_context); ok(dest_context == MSHCTX_INPROC, "desc_context = %lx\n", dest_context);
ok(!dest_context_data, "desc_context_data = %p\n", dest_context_data); ok(!dest_context_data, "desc_context_data = %p\n", dest_context_data);
return IRpcProxyBuffer_Connect(This->buffer, pRpcChannelBuffer); return IRpcProxyBuffer_Connect(This->buffer, pRpcChannelBuffer);
......
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