Commit 0b5c0855 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

ole32: Store destination context and context data in server channel.

parent 3099a254
...@@ -185,7 +185,8 @@ ULONG stub_manager_int_release(struct stub_manager *This) DECLSPEC_HIDDEN; ...@@ -185,7 +185,8 @@ ULONG stub_manager_int_release(struct stub_manager *This) DECLSPEC_HIDDEN;
struct stub_manager *new_stub_manager(APARTMENT *apt, IUnknown *object) DECLSPEC_HIDDEN; struct stub_manager *new_stub_manager(APARTMENT *apt, IUnknown *object) 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, MSHLFLAGS flags) DECLSPEC_HIDDEN; struct ifstub *stub_manager_new_ifstub(struct stub_manager *m, IRpcStubBuffer *sb, IUnknown *iptr, 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 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;
struct stub_manager *get_stub_manager_from_object(APARTMENT *apt, void *object) DECLSPEC_HIDDEN; struct stub_manager *get_stub_manager_from_object(APARTMENT *apt, void *object) DECLSPEC_HIDDEN;
...@@ -195,7 +196,7 @@ void stub_manager_release_marshal_data(struct stub_manager *m, ULONG refs, const ...@@ -195,7 +196,7 @@ void stub_manager_release_marshal_data(struct stub_manager *m, ULONG refs, const
HRESULT ipid_get_dispatch_params(const IPID *ipid, APARTMENT **stub_apt, IRpcStubBuffer **stub, IRpcChannelBuffer **chan, IID *iid, IUnknown **iface) DECLSPEC_HIDDEN; HRESULT ipid_get_dispatch_params(const IPID *ipid, APARTMENT **stub_apt, IRpcStubBuffer **stub, IRpcChannelBuffer **chan, IID *iid, IUnknown **iface) DECLSPEC_HIDDEN;
HRESULT start_apartment_remote_unknown(void) DECLSPEC_HIDDEN; HRESULT start_apartment_remote_unknown(void) DECLSPEC_HIDDEN;
HRESULT marshal_object(APARTMENT *apt, STDOBJREF *stdobjref, REFIID riid, IUnknown *obj, MSHLFLAGS mshlflags) DECLSPEC_HIDDEN; HRESULT marshal_object(APARTMENT *apt, STDOBJREF *stdobjref, REFIID riid, IUnknown *obj, DWORD dest_context, void *dest_context_data, MSHLFLAGS mshlflags) DECLSPEC_HIDDEN;
/* RPC Backend */ /* RPC Backend */
...@@ -206,7 +207,7 @@ HRESULT RPC_CreateClientChannel(const OXID *oxid, const IPID *ipid, ...@@ -206,7 +207,7 @@ HRESULT RPC_CreateClientChannel(const OXID *oxid, const IPID *ipid,
const OXID_INFO *oxid_info, const OXID_INFO *oxid_info,
DWORD dest_context, void *dest_context_data, DWORD dest_context, void *dest_context_data,
IRpcChannelBuffer **chan) DECLSPEC_HIDDEN; IRpcChannelBuffer **chan) DECLSPEC_HIDDEN;
HRESULT RPC_CreateServerChannel(IRpcChannelBuffer **chan) DECLSPEC_HIDDEN; HRESULT RPC_CreateServerChannel(DWORD dest_context, void *dest_context_data, IRpcChannelBuffer **chan) DECLSPEC_HIDDEN;
void RPC_ExecuteCall(struct dispatch_params *params) DECLSPEC_HIDDEN; void RPC_ExecuteCall(struct dispatch_params *params) DECLSPEC_HIDDEN;
HRESULT RPC_RegisterInterface(REFIID riid) DECLSPEC_HIDDEN; HRESULT RPC_RegisterInterface(REFIID riid) DECLSPEC_HIDDEN;
void RPC_UnregisterInterface(REFIID riid) DECLSPEC_HIDDEN; void RPC_UnregisterInterface(REFIID riid) DECLSPEC_HIDDEN;
......
...@@ -115,7 +115,8 @@ static inline HRESULT get_facbuf_for_iid(REFIID riid, IPSFactoryBuffer **facbuf) ...@@ -115,7 +115,8 @@ static inline HRESULT get_facbuf_for_iid(REFIID riid, IPSFactoryBuffer **facbuf)
} }
/* marshals an object into a STDOBJREF structure */ /* marshals an object into a STDOBJREF structure */
HRESULT marshal_object(APARTMENT *apt, STDOBJREF *stdobjref, REFIID riid, IUnknown *object, MSHLFLAGS mshlflags) HRESULT marshal_object(APARTMENT *apt, STDOBJREF *stdobjref, REFIID riid, IUnknown *object,
DWORD dest_context, void *dest_context_data, MSHLFLAGS mshlflags)
{ {
struct stub_manager *manager; struct stub_manager *manager;
struct ifstub *ifstub; struct ifstub *ifstub;
...@@ -192,7 +193,7 @@ HRESULT marshal_object(APARTMENT *apt, STDOBJREF *stdobjref, REFIID riid, IUnkno ...@@ -192,7 +193,7 @@ HRESULT marshal_object(APARTMENT *apt, STDOBJREF *stdobjref, REFIID riid, IUnkno
/* make sure ifstub that we are creating is unique */ /* make sure ifstub that we are creating is unique */
ifstub = stub_manager_find_ifstub(manager, riid, mshlflags); ifstub = stub_manager_find_ifstub(manager, riid, mshlflags);
if (!ifstub) if (!ifstub)
ifstub = stub_manager_new_ifstub(manager, stub, iobject, riid, mshlflags); ifstub = stub_manager_new_ifstub(manager, stub, iobject, riid, dest_context, dest_context_data, mshlflags);
if (stub) IRpcStubBuffer_Release(stub); if (stub) IRpcStubBuffer_Release(stub);
IUnknown_Release(iobject); IUnknown_Release(iobject);
...@@ -1225,8 +1226,8 @@ StdMarshalImpl_GetMarshalSizeMax( ...@@ -1225,8 +1226,8 @@ StdMarshalImpl_GetMarshalSizeMax(
static HRESULT WINAPI static HRESULT WINAPI
StdMarshalImpl_MarshalInterface( StdMarshalImpl_MarshalInterface(
LPMARSHAL iface, IStream *pStm,REFIID riid, void* pv, DWORD dwDestContext, LPMARSHAL iface, IStream *pStm,REFIID riid, void* pv, DWORD dest_context,
void* pvDestContext, DWORD mshlflags) void* dest_context_data, DWORD mshlflags)
{ {
STDOBJREF stdobjref; STDOBJREF stdobjref;
ULONG res; ULONG res;
...@@ -1244,7 +1245,7 @@ StdMarshalImpl_MarshalInterface( ...@@ -1244,7 +1245,7 @@ StdMarshalImpl_MarshalInterface(
/* make sure this apartment can be reached from other threads / processes */ /* make sure this apartment can be reached from other threads / processes */
RPC_StartRemoting(apt); RPC_StartRemoting(apt);
hres = marshal_object(apt, &stdobjref, riid, pv, mshlflags); hres = marshal_object(apt, &stdobjref, riid, pv, dest_context, dest_context_data, mshlflags);
if (hres != S_OK) if (hres != S_OK)
{ {
ERR("Failed to create ifstub, hres=0x%x\n", hres); ERR("Failed to create ifstub, hres=0x%x\n", hres);
......
...@@ -1052,10 +1052,8 @@ static HRESULT WINAPI ServerRpcChannelBuffer_GetDestCtx(LPRPCCHANNELBUFFER iface ...@@ -1052,10 +1052,8 @@ static HRESULT WINAPI ServerRpcChannelBuffer_GetDestCtx(LPRPCCHANNELBUFFER iface
{ {
RpcChannelBuffer *This = (RpcChannelBuffer *)iface; RpcChannelBuffer *This = (RpcChannelBuffer *)iface;
WARN("(%p,%p), stub!\n", dest_context, dest_context_data); TRACE("(%p,%p)\n", dest_context, dest_context_data);
/* FIXME: implement this by storing the dwDestContext and pvDestContext
* values passed into IMarshal_MarshalInterface and returning them here */
*dest_context = This->dest_context; *dest_context = This->dest_context;
*dest_context_data = This->dest_context_data; *dest_context_data = This->dest_context_data;
return S_OK; return S_OK;
...@@ -1159,7 +1157,7 @@ HRESULT RPC_CreateClientChannel(const OXID *oxid, const IPID *ipid, ...@@ -1159,7 +1157,7 @@ HRESULT RPC_CreateClientChannel(const OXID *oxid, const IPID *ipid,
return S_OK; return S_OK;
} }
HRESULT RPC_CreateServerChannel(IRpcChannelBuffer **chan) HRESULT RPC_CreateServerChannel(DWORD dest_context, void *dest_context_data, IRpcChannelBuffer **chan)
{ {
RpcChannelBuffer *This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This)); RpcChannelBuffer *This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
if (!This) if (!This)
...@@ -1167,8 +1165,8 @@ HRESULT RPC_CreateServerChannel(IRpcChannelBuffer **chan) ...@@ -1167,8 +1165,8 @@ HRESULT RPC_CreateServerChannel(IRpcChannelBuffer **chan)
This->IRpcChannelBuffer_iface.lpVtbl = &ServerRpcChannelBufferVtbl; This->IRpcChannelBuffer_iface.lpVtbl = &ServerRpcChannelBufferVtbl;
This->refs = 1; This->refs = 1;
This->dest_context = MSHCTX_DIFFERENTMACHINE; This->dest_context = dest_context;
This->dest_context_data = NULL; This->dest_context_data = dest_context_data;
*chan = &This->IRpcChannelBuffer_iface; *chan = &This->IRpcChannelBuffer_iface;
......
...@@ -67,7 +67,8 @@ static inline HRESULT generate_ipid(struct stub_manager *m, IPID *ipid) ...@@ -67,7 +67,8 @@ 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, MSHLFLAGS flags) struct ifstub *stub_manager_new_ifstub(struct stub_manager *m, IRpcStubBuffer *sb, IUnknown *iptr, REFIID iid, DWORD dest_context,
void *dest_context_data, MSHLFLAGS flags)
{ {
struct ifstub *stub; struct ifstub *stub;
HRESULT hr; HRESULT hr;
...@@ -78,7 +79,7 @@ struct ifstub *stub_manager_new_ifstub(struct stub_manager *m, IRpcStubBuffer *s ...@@ -78,7 +79,7 @@ struct ifstub *stub_manager_new_ifstub(struct stub_manager *m, IRpcStubBuffer *s
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 = RPC_CreateServerChannel(&stub->chan); hr = RPC_CreateServerChannel(dest_context, dest_context_data, &stub->chan);
if (hr != S_OK) if (hr != S_OK)
{ {
HeapFree(GetProcessHeap(), 0, stub); HeapFree(GetProcessHeap(), 0, stub);
...@@ -666,7 +667,7 @@ static HRESULT WINAPI RemUnknown_RemQueryInterface(IRemUnknown *iface, ...@@ -666,7 +667,7 @@ static HRESULT WINAPI RemUnknown_RemQueryInterface(IRemUnknown *iface,
for (i = 0; i < cIids; i++) for (i = 0; i < cIids; i++)
{ {
HRESULT hrobj = marshal_object(apt, &(*ppQIResults)[i].std, &iids[i], HRESULT hrobj = marshal_object(apt, &(*ppQIResults)[i].std, &iids[i],
stubmgr->object, MSHLFLAGS_NORMAL); stubmgr->object, MSHCTX_DIFFERENTMACHINE, NULL, MSHLFLAGS_NORMAL);
if (hrobj == S_OK) if (hrobj == S_OK)
successful_qis++; successful_qis++;
(*ppQIResults)[i].hResult = hrobj; (*ppQIResults)[i].hResult = hrobj;
...@@ -775,7 +776,7 @@ HRESULT start_apartment_remote_unknown(void) ...@@ -775,7 +776,7 @@ HRESULT start_apartment_remote_unknown(void)
{ {
STDOBJREF stdobjref; /* dummy - not used */ STDOBJREF stdobjref; /* dummy - not used */
/* register it with the stub manager */ /* register it with the stub manager */
hr = marshal_object(apt, &stdobjref, &IID_IRemUnknown, (IUnknown *)pRemUnknown, MSHLFLAGS_NORMAL|MSHLFLAGSP_REMUNKNOWN); hr = marshal_object(apt, &stdobjref, &IID_IRemUnknown, (IUnknown *)pRemUnknown, MSHCTX_DIFFERENTMACHINE, NULL, MSHLFLAGS_NORMAL|MSHLFLAGSP_REMUNKNOWN);
/* release our reference to the object as the stub manager will manage the life cycle for us */ /* release our reference to the object as the stub manager will manage the life cycle for us */
IRemUnknown_Release(pRemUnknown); IRemUnknown_Release(pRemUnknown);
if (hr == S_OK) if (hr == S_OK)
......
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