Commit 5c15a6c1 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

combase: Move ORPC functionality.

parent 11057c13
...@@ -443,7 +443,7 @@ void apartment_freeunusedlibraries(struct apartment *apt, DWORD delay) ...@@ -443,7 +443,7 @@ void apartment_freeunusedlibraries(struct apartment *apt, DWORD delay)
LeaveCriticalSection(&apt->cs); LeaveCriticalSection(&apt->cs);
} }
void WINAPI apartment_release(struct apartment *apt) void apartment_release(struct apartment *apt)
{ {
DWORD refcount; DWORD refcount;
...@@ -615,7 +615,7 @@ struct apartment * apartment_get_mta(void) ...@@ -615,7 +615,7 @@ struct apartment * apartment_get_mta(void)
/* Return the current apartment if it exists, or, failing that, the MTA. Caller /* Return the current apartment if it exists, or, failing that, the MTA. Caller
* must free the returned apartment in either case. */ * must free the returned apartment in either case. */
struct apartment * WINAPI apartment_get_current_or_mta(void) struct apartment * apartment_get_current_or_mta(void)
{ {
struct apartment *apt = com_get_current_apt(); struct apartment *apt = com_get_current_apt();
if (apt) if (apt)
...@@ -1098,14 +1098,13 @@ static HRESULT apartment_hostobject(struct apartment *apt, const struct host_obj ...@@ -1098,14 +1098,13 @@ static HRESULT apartment_hostobject(struct apartment *apt, const struct host_obj
} }
struct dispatch_params; struct dispatch_params;
extern void WINAPI Internal_RPC_ExecuteCall(struct dispatch_params *params);
static LRESULT CALLBACK apartment_wndproc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) static LRESULT CALLBACK apartment_wndproc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{ {
switch (msg) switch (msg)
{ {
case DM_EXECUTERPC: case DM_EXECUTERPC:
Internal_RPC_ExecuteCall((struct dispatch_params *)lParam); rpc_execute_call((struct dispatch_params *)lParam);
return 0; return 0;
case DM_HOSTOBJECT: case DM_HOSTOBJECT:
return apartment_hostobject(com_get_current_apt(), (const struct host_object_params *)lParam); return apartment_hostobject(com_get_current_apt(), (const struct host_object_params *)lParam);
...@@ -1119,7 +1118,7 @@ static BOOL apartment_is_model(const struct apartment *apt, DWORD model) ...@@ -1119,7 +1118,7 @@ static BOOL apartment_is_model(const struct apartment *apt, DWORD model)
return (apt->multi_threaded == !(model & COINIT_APARTMENTTHREADED)); return (apt->multi_threaded == !(model & COINIT_APARTMENTTHREADED));
} }
HRESULT WINAPI enter_apartment(struct tlsdata *data, DWORD model) HRESULT enter_apartment(struct tlsdata *data, DWORD model)
{ {
HRESULT hr = S_OK; HRESULT hr = S_OK;
...@@ -1143,7 +1142,7 @@ HRESULT WINAPI enter_apartment(struct tlsdata *data, DWORD model) ...@@ -1143,7 +1142,7 @@ HRESULT WINAPI enter_apartment(struct tlsdata *data, DWORD model)
return hr; return hr;
} }
void WINAPI leave_apartment(struct tlsdata *data) void leave_apartment(struct tlsdata *data)
{ {
if (!--data->inits) if (!--data->inits)
{ {
...@@ -1262,7 +1261,7 @@ HRESULT apartment_createwindowifneeded(struct apartment *apt) ...@@ -1262,7 +1261,7 @@ HRESULT apartment_createwindowifneeded(struct apartment *apt)
} }
/* retrieves the window for the main- or apartment-threaded apartment */ /* retrieves the window for the main- or apartment-threaded apartment */
HWND WINAPI apartment_getwindow(const struct apartment *apt) HWND apartment_getwindow(const struct apartment *apt)
{ {
assert(!apt->multi_threaded); assert(!apt->multi_threaded);
return apt->win; return apt->win;
......
...@@ -3053,6 +3053,16 @@ HRESULT WINAPI CoLockObjectExternal(IUnknown *object, BOOL lock, BOOL last_unloc ...@@ -3053,6 +3053,16 @@ HRESULT WINAPI CoLockObjectExternal(IUnknown *object, BOOL lock, BOOL last_unloc
} }
/*********************************************************************** /***********************************************************************
* CoRegisterChannelHook (combase.@)
*/
HRESULT WINAPI CoRegisterChannelHook(REFGUID guidExtension, IChannelHook *channel_hook)
{
TRACE("%s, %p\n", debugstr_guid(guidExtension), channel_hook);
return rpc_register_channel_hook(guidExtension, channel_hook);
}
/***********************************************************************
* DllMain (combase.@) * DllMain (combase.@)
*/ */
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID reserved) BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID reserved)
...@@ -3068,6 +3078,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID reserved) ...@@ -3068,6 +3078,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID reserved)
if (reserved) break; if (reserved) break;
apartment_global_cleanup(); apartment_global_cleanup();
DeleteCriticalSection(&registered_classes_cs); DeleteCriticalSection(&registered_classes_cs);
rpc_unregister_channel_hooks();
break; break;
case DLL_THREAD_DETACH: case DLL_THREAD_DETACH:
com_cleanup_tlsdata(); com_cleanup_tlsdata();
......
...@@ -139,6 +139,7 @@ ...@@ -139,6 +139,7 @@
@ stdcall CoQueryProxyBlanket(ptr ptr ptr ptr ptr ptr ptr ptr) @ stdcall CoQueryProxyBlanket(ptr ptr ptr ptr ptr ptr ptr ptr)
@ stub CoReactivateObject @ stub CoReactivateObject
@ stub CoRegisterActivationFilter @ stub CoRegisterActivationFilter
@ stdcall CoRegisterChannelHook(ptr ptr)
@ stdcall CoRegisterClassObject(ptr ptr long long ptr) @ stdcall CoRegisterClassObject(ptr ptr long long ptr)
@ stdcall CoRegisterInitializeSpy(ptr ptr) @ stdcall CoRegisterInitializeSpy(ptr ptr)
@ stdcall CoRegisterMallocSpy(ptr) @ stdcall CoRegisterMallocSpy(ptr)
...@@ -350,12 +351,3 @@ ...@@ -350,12 +351,3 @@
@ stdcall WindowsSubstringWithSpecifiedLength(ptr long long ptr) @ stdcall WindowsSubstringWithSpecifiedLength(ptr long long ptr)
@ stdcall WindowsTrimStringEnd(ptr ptr ptr) @ stdcall WindowsTrimStringEnd(ptr ptr ptr)
@ stdcall WindowsTrimStringStart(ptr ptr ptr) @ stdcall WindowsTrimStringStart(ptr ptr ptr)
@ stdcall apartment_get_current_or_mta()
@ stdcall apartment_release(ptr)
@ stdcall enter_apartment(ptr long)
@ stdcall leave_apartment(ptr)
@ stdcall apartment_getwindow(ptr)
@ stdcall stub_manager_int_release(ptr)
@ stdcall ipid_get_dispatch_params(ptr ptr ptr ptr ptr ptr ptr)
@ stdcall start_apartment_remote_unknown(ptr)
...@@ -102,7 +102,7 @@ static inline struct apartment* com_get_current_apt(void) ...@@ -102,7 +102,7 @@ static inline struct apartment* com_get_current_apt(void)
return tlsdata->apt; return tlsdata->apt;
} }
HWND WINAPI apartment_getwindow(const struct apartment *apt) DECLSPEC_HIDDEN; HWND apartment_getwindow(const struct apartment *apt) DECLSPEC_HIDDEN;
HRESULT apartment_createwindowifneeded(struct apartment *apt) DECLSPEC_HIDDEN; HRESULT apartment_createwindowifneeded(struct apartment *apt) DECLSPEC_HIDDEN;
void apartment_freeunusedlibraries(struct apartment *apt, DWORD unload_delay) DECLSPEC_HIDDEN; void apartment_freeunusedlibraries(struct apartment *apt, DWORD unload_delay) DECLSPEC_HIDDEN;
void apartment_global_cleanup(void) DECLSPEC_HIDDEN; void apartment_global_cleanup(void) DECLSPEC_HIDDEN;
...@@ -114,6 +114,18 @@ HRESULT rpcss_get_next_seqid(DWORD *id) DECLSPEC_HIDDEN; ...@@ -114,6 +114,18 @@ HRESULT rpcss_get_next_seqid(DWORD *id) DECLSPEC_HIDDEN;
HRESULT rpc_get_local_class_object(REFCLSID rclsid, REFIID riid, void **obj) DECLSPEC_HIDDEN; HRESULT rpc_get_local_class_object(REFCLSID rclsid, REFIID riid, void **obj) DECLSPEC_HIDDEN;
HRESULT rpc_start_local_server(REFCLSID clsid, IStream *stream, BOOL multi_use, void **registration) DECLSPEC_HIDDEN; HRESULT rpc_start_local_server(REFCLSID clsid, IStream *stream, BOOL multi_use, void **registration) DECLSPEC_HIDDEN;
void rpc_stop_local_server(void *registration) DECLSPEC_HIDDEN; void rpc_stop_local_server(void *registration) DECLSPEC_HIDDEN;
HRESULT rpc_create_clientchannel(const OXID *oxid, const IPID *ipid, const OXID_INFO *oxid_info, const IID *iid,
DWORD dest_context, void *dest_context_data, IRpcChannelBuffer **chan, struct apartment *apt) DECLSPEC_HIDDEN;
HRESULT rpc_create_serverchannel(DWORD dest_context, void *dest_context_data, IRpcChannelBuffer **chan) DECLSPEC_HIDDEN;
HRESULT rpc_register_interface(REFIID riid) DECLSPEC_HIDDEN;
void rpc_unregister_interface(REFIID riid, BOOL wait) DECLSPEC_HIDDEN;
HRESULT rpc_resolve_oxid(OXID oxid, OXID_INFO *oxid_info) DECLSPEC_HIDDEN;
void rpc_start_remoting(struct apartment *apt) DECLSPEC_HIDDEN;
HRESULT rpc_register_channel_hook(REFGUID rguid, IChannelHook *hook) DECLSPEC_HIDDEN;
void rpc_unregister_channel_hooks(void) DECLSPEC_HIDDEN;
struct dispatch_params;
void rpc_execute_call(struct dispatch_params *params);
enum class_reg_data_origin enum class_reg_data_origin
{ {
...@@ -136,10 +148,10 @@ struct class_reg_data ...@@ -136,10 +148,10 @@ struct class_reg_data
} u; } u;
}; };
HRESULT WINAPI enter_apartment(struct tlsdata *data, DWORD model); HRESULT enter_apartment(struct tlsdata *data, DWORD model) DECLSPEC_HIDDEN;
void WINAPI leave_apartment(struct tlsdata *data); void leave_apartment(struct tlsdata *data) DECLSPEC_HIDDEN;
void WINAPI apartment_release(struct apartment *apt); void apartment_release(struct apartment *apt) DECLSPEC_HIDDEN;
struct apartment * WINAPI apartment_get_current_or_mta(void); struct apartment * apartment_get_current_or_mta(void) DECLSPEC_HIDDEN;
HRESULT apartment_increment_mta_usage(CO_MTA_USAGE_COOKIE *cookie) DECLSPEC_HIDDEN; HRESULT apartment_increment_mta_usage(CO_MTA_USAGE_COOKIE *cookie) DECLSPEC_HIDDEN;
void apartment_decrement_mta_usage(CO_MTA_USAGE_COOKIE cookie) DECLSPEC_HIDDEN; void apartment_decrement_mta_usage(CO_MTA_USAGE_COOKIE cookie) DECLSPEC_HIDDEN;
struct apartment * apartment_get_mta(void) DECLSPEC_HIDDEN; struct apartment * apartment_get_mta(void) DECLSPEC_HIDDEN;
...@@ -152,6 +164,9 @@ void apartment_revoke_all_classes(const struct apartment *apt) DECLSPEC_HIDDEN; ...@@ -152,6 +164,9 @@ void apartment_revoke_all_classes(const struct apartment *apt) DECLSPEC_HIDDEN;
struct apartment * apartment_findfromoxid(OXID oxid) DECLSPEC_HIDDEN; struct apartment * apartment_findfromoxid(OXID oxid) DECLSPEC_HIDDEN;
struct apartment * apartment_findfromtid(DWORD tid) DECLSPEC_HIDDEN; struct apartment * apartment_findfromtid(DWORD tid) DECLSPEC_HIDDEN;
HRESULT marshal_object(struct apartment *apt, STDOBJREF *stdobjref, REFIID riid, IUnknown *object,
DWORD dest_context, void *dest_context_data, MSHLFLAGS mshlflags) DECLSPEC_HIDDEN;
/* Stub Manager */ /* Stub Manager */
/* signal to stub manager that this is a rem unknown object */ /* signal to stub manager that this is a rem unknown object */
...@@ -219,7 +234,7 @@ struct stub_manager ...@@ -219,7 +234,7 @@ struct stub_manager
BOOL disconnected; /* CoDisconnectObject has been called (CS lock) */ BOOL disconnected; /* CoDisconnectObject has been called (CS lock) */
}; };
ULONG WINAPI stub_manager_int_release(struct stub_manager *stub_manager) DECLSPEC_HIDDEN; ULONG stub_manager_int_release(struct stub_manager *stub_manager) DECLSPEC_HIDDEN;
struct stub_manager * get_stub_manager_from_object(struct apartment *apt, IUnknown *object, BOOL alloc) DECLSPEC_HIDDEN; struct stub_manager * get_stub_manager_from_object(struct apartment *apt, IUnknown *object, BOOL alloc) DECLSPEC_HIDDEN;
void stub_manager_disconnect(struct stub_manager *m) DECLSPEC_HIDDEN; void stub_manager_disconnect(struct stub_manager *m) 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;
...@@ -231,3 +246,7 @@ BOOL stub_manager_notify_unmarshal(struct stub_manager *m, const IPID *ipid) DEC ...@@ -231,3 +246,7 @@ BOOL stub_manager_notify_unmarshal(struct stub_manager *m, const IPID *ipid) DEC
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 ifstub * stub_manager_new_ifstub(struct stub_manager *m, IRpcStubBuffer *sb, 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) DECLSPEC_HIDDEN; void *dest_context_data, MSHLFLAGS flags) DECLSPEC_HIDDEN;
HRESULT ipid_get_dispatch_params(const IPID *ipid, struct apartment **stub_apt,
struct stub_manager **manager, IRpcStubBuffer **stub, IRpcChannelBuffer **chan,
IID *iid, IUnknown **iface) DECLSPEC_HIDDEN;
HRESULT start_apartment_remote_unknown(struct apartment *apt) DECLSPEC_HIDDEN;
...@@ -36,9 +36,6 @@ HRESULT WINAPI RPC_CreateClientChannel(const OXID *oxid, const IPID *ipid, ...@@ -36,9 +36,6 @@ HRESULT WINAPI RPC_CreateClientChannel(const OXID *oxid, const IPID *ipid,
const OXID_INFO *oxid_info, const IID *iid, const OXID_INFO *oxid_info, const IID *iid,
DWORD dest_context, void *dest_context_data, DWORD dest_context, void *dest_context_data,
IRpcChannelBuffer **chan, struct apartment *apt); IRpcChannelBuffer **chan, struct apartment *apt);
HRESULT WINAPI RPC_RegisterInterface(REFIID riid);
HRESULT WINAPI RPC_ResolveOxid(OXID oxid, OXID_INFO *oxid_info);
void WINAPI RPC_StartRemoting(struct apartment *apt);
static HRESULT unmarshal_object(const STDOBJREF *stdobjref, struct apartment *apt, static HRESULT unmarshal_object(const STDOBJREF *stdobjref, struct apartment *apt,
MSHCTX dest_context, void *dest_context_data, MSHCTX dest_context, void *dest_context_data,
...@@ -889,7 +886,7 @@ static inline HRESULT get_facbuf_for_iid(REFIID riid, IPSFactoryBuffer **facbuf) ...@@ -889,7 +886,7 @@ 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 WINAPI marshal_object(struct apartment *apt, STDOBJREF *stdobjref, REFIID riid, IUnknown *object, HRESULT marshal_object(struct apartment *apt, STDOBJREF *stdobjref, REFIID riid, IUnknown *object,
DWORD dest_context, void *dest_context_data, MSHLFLAGS mshlflags) DWORD dest_context, void *dest_context_data, MSHLFLAGS mshlflags)
{ {
struct stub_manager *manager; struct stub_manager *manager;
...@@ -971,7 +968,7 @@ HRESULT WINAPI marshal_object(struct apartment *apt, STDOBJREF *stdobjref, REFII ...@@ -971,7 +968,7 @@ HRESULT WINAPI marshal_object(struct apartment *apt, STDOBJREF *stdobjref, REFII
} }
/* FIXME: check return value */ /* FIXME: check return value */
RPC_RegisterInterface(riid); rpc_register_interface(riid);
stdobjref->ipid = ifstub->ipid; stdobjref->ipid = ifstub->ipid;
...@@ -979,8 +976,6 @@ HRESULT WINAPI marshal_object(struct apartment *apt, STDOBJREF *stdobjref, REFII ...@@ -979,8 +976,6 @@ HRESULT WINAPI marshal_object(struct apartment *apt, STDOBJREF *stdobjref, REFII
return S_OK; return S_OK;
} }
/* Client-side identity of the server object */ /* Client-side identity of the server object */
static HRESULT proxy_manager_get_remunknown(struct proxy_manager * This, IRemUnknown **remunk); static HRESULT proxy_manager_get_remunknown(struct proxy_manager * This, IRemUnknown **remunk);
...@@ -1583,7 +1578,7 @@ static HRESULT proxy_manager_construct( ...@@ -1583,7 +1578,7 @@ static HRESULT proxy_manager_construct(
} }
else else
{ {
HRESULT hr = RPC_ResolveOxid(oxid, &This->oxid_info); HRESULT hr = rpc_resolve_oxid(oxid, &This->oxid_info);
if (FAILED(hr)) if (FAILED(hr))
{ {
CloseHandle(This->remoting_mutex); CloseHandle(This->remoting_mutex);
...@@ -2081,7 +2076,7 @@ static HRESULT WINAPI StdMarshalImpl_MarshalInterface(IMarshal *iface, IStream * ...@@ -2081,7 +2076,7 @@ static HRESULT WINAPI StdMarshalImpl_MarshalInterface(IMarshal *iface, IStream *
} }
/* 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_start_remoting(apt);
fill_std_objref(&objref, riid, NULL); fill_std_objref(&objref, riid, NULL);
hr = marshal_object(apt, &objref.u_objref.u_standard.std, riid, pv, dest_context, hr = marshal_object(apt, &objref.u_objref.u_standard.std, riid, pv, dest_context,
...@@ -2134,14 +2129,11 @@ static HRESULT unmarshal_object(const STDOBJREF *stdobjref, struct apartment *ap ...@@ -2134,14 +2129,11 @@ static HRESULT unmarshal_object(const STDOBJREF *stdobjref, struct apartment *ap
if (hr == E_NOINTERFACE) if (hr == E_NOINTERFACE)
{ {
IRpcChannelBuffer *chanbuf; IRpcChannelBuffer *chanbuf;
hr = RPC_CreateClientChannel(&stdobjref->oxid, &stdobjref->ipid, hr = rpc_create_clientchannel(&stdobjref->oxid, &stdobjref->ipid,
&proxy_manager->oxid_info, riid, &proxy_manager->oxid_info, riid, proxy_manager->dest_context,
proxy_manager->dest_context, proxy_manager->dest_context_data, &chanbuf, apt);
proxy_manager->dest_context_data,
&chanbuf, apt);
if (hr == S_OK) if (hr == S_OK)
hr = proxy_manager_create_ifproxy(proxy_manager, stdobjref, hr = proxy_manager_create_ifproxy(proxy_manager, stdobjref, riid, chanbuf, &ifproxy);
riid, chanbuf, &ifproxy);
} }
else else
IUnknown_AddRef((IUnknown *)ifproxy->iface); IUnknown_AddRef((IUnknown *)ifproxy->iface);
......
...@@ -44,11 +44,6 @@ ...@@ -44,11 +44,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(ole); WINE_DEFAULT_DEBUG_CHANNEL(ole);
extern HRESULT WINAPI marshal_object(struct apartment *apt, STDOBJREF *stdobjref, REFIID riid, IUnknown *object,
DWORD dest_context, void *dest_context_data, MSHLFLAGS mshlflags);
extern HRESULT WINAPI RPC_CreateServerChannel(DWORD dest_context, void *dest_context_data, IRpcChannelBuffer **chan);
extern void WINAPI RPC_UnregisterInterface(REFIID riid, BOOL wait);
/* generates an ipid in the following format (similar to native version): /* generates an ipid in the following format (similar to native version):
* Data1 = apartment-local ipid counter * Data1 = apartment-local ipid counter
* Data2 = apartment creator thread ID * Data2 = apartment creator thread ID
...@@ -92,7 +87,7 @@ struct ifstub * stub_manager_new_ifstub(struct stub_manager *m, IRpcStubBuffer * ...@@ -92,7 +87,7 @@ struct ifstub * stub_manager_new_ifstub(struct stub_manager *m, IRpcStubBuffer *
return NULL; return NULL;
} }
hr = RPC_CreateServerChannel(dest_context, dest_context_data, &stub->chan); hr = rpc_create_serverchannel(dest_context, dest_context_data, &stub->chan);
if (hr != S_OK) if (hr != S_OK)
{ {
IUnknown_Release(stub->iface); IUnknown_Release(stub->iface);
...@@ -131,7 +126,7 @@ static void stub_manager_delete_ifstub(struct stub_manager *m, struct ifstub *if ...@@ -131,7 +126,7 @@ static void stub_manager_delete_ifstub(struct stub_manager *m, struct ifstub *if
list_remove(&ifstub->entry); list_remove(&ifstub->entry);
if (!m->disconnected) if (!m->disconnected)
RPC_UnregisterInterface(&ifstub->iid, TRUE); rpc_unregister_interface(&ifstub->iid, TRUE);
if (ifstub->stubbuffer) IRpcStubBuffer_Release(ifstub->stubbuffer); if (ifstub->stubbuffer) IRpcStubBuffer_Release(ifstub->stubbuffer);
IUnknown_Release(ifstub->iface); IUnknown_Release(ifstub->iface);
...@@ -255,7 +250,7 @@ void stub_manager_disconnect(struct stub_manager *m) ...@@ -255,7 +250,7 @@ void stub_manager_disconnect(struct stub_manager *m)
if (!m->disconnected) if (!m->disconnected)
{ {
LIST_FOR_EACH_ENTRY(ifstub, &m->ifstubs, struct ifstub, entry) LIST_FOR_EACH_ENTRY(ifstub, &m->ifstubs, struct ifstub, entry)
RPC_UnregisterInterface(&ifstub->iid, FALSE); rpc_unregister_interface(&ifstub->iid, FALSE);
m->disconnected = TRUE; m->disconnected = TRUE;
} }
...@@ -314,7 +309,7 @@ static ULONG stub_manager_int_addref(struct stub_manager *m) ...@@ -314,7 +309,7 @@ static ULONG stub_manager_int_addref(struct stub_manager *m)
} }
/* decrements the internal refcount */ /* decrements the internal refcount */
ULONG WINAPI stub_manager_int_release(struct stub_manager *m) ULONG stub_manager_int_release(struct stub_manager *m)
{ {
ULONG refs; ULONG refs;
struct apartment *apt = m->apt; struct apartment *apt = m->apt;
...@@ -542,10 +537,9 @@ static HRESULT ipid_to_stub_manager(const IPID *ipid, struct apartment **stub_ap ...@@ -542,10 +537,9 @@ static HRESULT ipid_to_stub_manager(const IPID *ipid, struct apartment **stub_ap
/* 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. */
HRESULT WINAPI 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, struct stub_manager **manager, IRpcStubBuffer **stub, IRpcChannelBuffer **chan,
IRpcStubBuffer **stub, IRpcChannelBuffer **chan, IID *iid, IUnknown **iface)
IID *iid, IUnknown **iface)
{ {
struct stub_manager *stubmgr; struct stub_manager *stubmgr;
struct ifstub *ifstub; struct ifstub *ifstub;
...@@ -826,7 +820,7 @@ static const IRemUnknownVtbl RemUnknown_Vtbl = ...@@ -826,7 +820,7 @@ static const IRemUnknownVtbl RemUnknown_Vtbl =
}; };
/* starts the IRemUnknown listener for the current apartment */ /* starts the IRemUnknown listener for the current apartment */
HRESULT WINAPI start_apartment_remote_unknown(struct apartment *apt) HRESULT start_apartment_remote_unknown(struct apartment *apt)
{ {
IRemUnknown *pRemUnknown; IRemUnknown *pRemUnknown;
HRESULT hr = S_OK; HRESULT hr = S_OK;
......
...@@ -33,7 +33,6 @@ C_SRCS = \ ...@@ -33,7 +33,6 @@ C_SRCS = \
oleobj.c \ oleobj.c \
oleproxy.c \ oleproxy.c \
pointermoniker.c \ pointermoniker.c \
rpc.c \
stg_prop.c \ stg_prop.c \
stg_stream.c \ stg_stream.c \
storage32.c \ storage32.c \
......
...@@ -930,26 +930,6 @@ HRESULT WINAPI CoGetObject(LPCWSTR pszName, BIND_OPTS *pBindOptions, ...@@ -930,26 +930,6 @@ HRESULT WINAPI CoGetObject(LPCWSTR pszName, BIND_OPTS *pBindOptions,
return hr; return hr;
} }
/***********************************************************************
* CoRegisterChannelHook [OLE32.@]
*
* Registers a process-wide hook that is called during ORPC calls.
*
* PARAMS
* guidExtension [I] GUID of the channel hook to register.
* pChannelHook [I] Channel hook object to register.
*
* RETURNS
* Success: S_OK.
* Failure: HRESULT code.
*/
HRESULT WINAPI CoRegisterChannelHook(REFGUID guidExtension, IChannelHook *pChannelHook)
{
TRACE("(%s, %p)\n", debugstr_guid(guidExtension), pChannelHook);
return RPC_RegisterChannelHook(guidExtension, pChannelHook);
}
/* Returns expanded dll path from the registry or activation context. */ /* Returns expanded dll path from the registry or activation context. */
static BOOL get_object_dll_path(const struct class_reg_data *regdata, WCHAR *dst, DWORD dstlen) static BOOL get_object_dll_path(const struct class_reg_data *regdata, WCHAR *dst, DWORD dstlen)
{ {
...@@ -1176,7 +1156,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID reserved) ...@@ -1176,7 +1156,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID reserved)
case DLL_PROCESS_DETACH: case DLL_PROCESS_DETACH:
if (reserved) break; if (reserved) break;
release_std_git(); release_std_git();
RPC_UnregisterAllChannelHooks();
break; break;
} }
return TRUE; return TRUE;
......
...@@ -39,113 +39,9 @@ ...@@ -39,113 +39,9 @@
#include "winreg.h" #include "winreg.h"
#include "winternl.h" #include "winternl.h"
struct apartment;
DEFINE_OLEGUID( CLSID_DfMarshal, 0x0000030b, 0, 0 ); DEFINE_OLEGUID( CLSID_DfMarshal, 0x0000030b, 0, 0 );
/* signal to stub manager that this is a rem unknown object */ struct apartment;
#define MSHLFLAGSP_REMUNKNOWN 0x80000000
/* Thread-safety Annotation Legend:
*
* RO - The value is read only. It never changes after creation, so no
* locking is required.
* LOCK - The value is written to only using Interlocked* functions.
* CS - The value is read or written to inside a critical section.
* The identifier following "CS" is the specific critical section that
* must be used.
* MUTEX - The value is read or written to with a mutex held.
* The identifier following "MUTEX" is the specific mutex that
* must be used.
*/
typedef enum ifstub_state
{
STUBSTATE_NORMAL_MARSHALED,
STUBSTATE_NORMAL_UNMARSHALED,
STUBSTATE_TABLE_WEAK_MARSHALED,
STUBSTATE_TABLE_WEAK_UNMARSHALED,
STUBSTATE_TABLE_STRONG,
} STUB_STATE;
/* an interface stub */
struct ifstub
{
struct list entry; /* entry in stub_manager->ifstubs list (CS stub_manager->lock) */
IRpcStubBuffer *stubbuffer; /* RO */
IID iid; /* RO */
IPID ipid; /* RO */
IUnknown *iface; /* RO */
MSHLFLAGS flags; /* so we can enforce process-local marshalling rules (RO) */
IRpcChannelBuffer*chan; /* channel passed to IRpcStubBuffer::Invoke (RO) */
};
/* stub managers hold refs on the object and each interface stub */
struct stub_manager
{
struct list entry; /* entry in apartment stubmgr list (CS apt->cs) */
struct list ifstubs; /* list of active ifstubs for the object (CS lock) */
CRITICAL_SECTION lock;
struct apartment *apt; /* owning apt (RO) */
ULONG extrefs; /* number of 'external' references (CS lock) */
ULONG refs; /* internal reference count (CS apt->cs) */
ULONG weakrefs; /* number of weak references (CS lock) */
OID oid; /* apartment-scoped unique identifier (RO) */
IUnknown *object; /* the object we are managing the stub for (RO) */
ULONG next_ipid; /* currently unused (LOCK) */
OXID_INFO oxid_info; /* string binding, ipid of rem unknown and other information (RO) */
IExternalConnection *extern_conn;
/* We need to keep a count of the outstanding marshals, so we can enforce the
* marshalling rules (ie, you can only unmarshal normal marshals once). Note
* that these counts do NOT include unmarshalled interfaces, once a stream is
* unmarshalled and a proxy set up, this count is decremented.
*/
ULONG norm_refs; /* refcount of normal marshals (CS lock) */
BOOL disconnected; /* CoDisconnectObject has been called (CS lock) */
};
struct apartment
{
struct list entry;
LONG refs; /* refcount of the apartment (LOCK) */
BOOL multi_threaded; /* multi-threaded or single-threaded apartment? (RO) */
DWORD tid; /* thread id (RO) */
OXID oxid; /* object exporter ID (RO) */
LONG ipidc; /* interface pointer ID counter, starts at 1 (LOCK) */
CRITICAL_SECTION cs; /* thread safety */
struct list proxies; /* imported objects (CS cs) */
struct list stubmgrs; /* stub managers for exported objects (CS cs) */
BOOL remunk_exported; /* has the IRemUnknown interface for this apartment been created yet? (CS cs) */
LONG remoting_started; /* has the RPC system been started for this apartment? (LOCK) */
struct list loaded_dlls; /* list of dlls loaded by this apartment (CS cs) */
DWORD host_apt_tid; /* thread ID of apartment hosting objects of differing threading model (CS cs) */
HWND host_apt_hwnd; /* handle to apartment window of host apartment (CS cs) */
struct local_server *local_server; /* A marshallable object exposing local servers (CS cs) */
BOOL being_destroyed; /* is currently being destroyed */
/* FIXME: OIDs should be given out by RPCSS */
OID oidc; /* object ID counter, starts at 1, zero is invalid OID (CS cs) */
/* STA-only fields */
HWND win; /* message window (LOCK) */
LPMESSAGEFILTER filter; /* message filter (CS cs) */
BOOL main; /* is this a main-threaded-apartment? (RO) */
/* MTA-only */
struct list usage_cookies; /* Used for refcount control with CoIncrementMTAUsage()/CoDecrementMTAUsage(). */
};
struct init_spy
{
struct list entry;
IInitializeSpy *spy;
unsigned int id;
};
/* this is what is stored in TEB->ReservedForOle */ /* this is what is stored in TEB->ReservedForOle */
struct oletls struct oletls
...@@ -170,7 +66,6 @@ struct oletls ...@@ -170,7 +66,6 @@ struct oletls
DWORD spies_lock; DWORD spies_lock;
}; };
/* Global Interface Table Functions */ /* Global Interface Table Functions */
extern void release_std_git(void) DECLSPEC_HIDDEN; extern void release_std_git(void) DECLSPEC_HIDDEN;
extern HRESULT StdGlobalInterfaceTable_GetFactory(LPVOID *ppv) DECLSPEC_HIDDEN; extern HRESULT StdGlobalInterfaceTable_GetFactory(LPVOID *ppv) DECLSPEC_HIDDEN;
...@@ -179,48 +74,9 @@ HRESULT COM_OpenKeyForCLSID(REFCLSID clsid, LPCWSTR keyname, REGSAM access, HKEY ...@@ -179,48 +74,9 @@ HRESULT COM_OpenKeyForCLSID(REFCLSID clsid, LPCWSTR keyname, REGSAM access, HKEY
HRESULT MARSHAL_GetStandardMarshalCF(LPVOID *ppv) DECLSPEC_HIDDEN; HRESULT MARSHAL_GetStandardMarshalCF(LPVOID *ppv) DECLSPEC_HIDDEN;
HRESULT FTMarshalCF_Create(REFIID riid, LPVOID *ppv) DECLSPEC_HIDDEN; HRESULT FTMarshalCF_Create(REFIID riid, LPVOID *ppv) DECLSPEC_HIDDEN;
/* Stub Manager */
extern ULONG WINAPI stub_manager_int_release(struct stub_manager *This) DECLSPEC_HIDDEN;
/* RPC Backend */
struct dispatch_params;
HRESULT WINAPI RPC_CreateClientChannel(const OXID *oxid, const IPID *ipid,
const OXID_INFO *oxid_info, const IID *iid,
DWORD dest_context, void *dest_context_data,
IRpcChannelBuffer **chan, struct apartment *apt) DECLSPEC_HIDDEN;
HRESULT WINAPI RPC_RegisterInterface(REFIID riid) DECLSPEC_HIDDEN;
HRESULT RPC_RegisterChannelHook(REFGUID rguid, IChannelHook *hook) DECLSPEC_HIDDEN;
void RPC_UnregisterAllChannelHooks(void) DECLSPEC_HIDDEN;
HRESULT WINAPI RPC_ResolveOxid(OXID oxid, OXID_INFO *oxid_info) DECLSPEC_HIDDEN;
/* Drag and drop */ /* Drag and drop */
void OLEDD_UnInitialize(void) DECLSPEC_HIDDEN; void OLEDD_UnInitialize(void) DECLSPEC_HIDDEN;
/* Apartment Functions */
extern void WINAPI apartment_release(struct apartment *apt) DECLSPEC_HIDDEN;
static inline HRESULT apartment_getoxid(const struct apartment *apt, OXID *oxid)
{
*oxid = apt->oxid;
return S_OK;
}
extern HWND WINAPI apartment_getwindow(const struct apartment *apt) DECLSPEC_HIDDEN;
extern HRESULT WINAPI enter_apartment(struct oletls *info, DWORD model) DECLSPEC_HIDDEN;
void WINAPI leave_apartment(struct oletls *info) DECLSPEC_HIDDEN;
extern struct apartment * WINAPI apartment_get_current_or_mta(void) DECLSPEC_HIDDEN;
extern HRESULT WINAPI apartment_get_local_server_stream(struct apartment *apt, IStream **ret) DECLSPEC_HIDDEN;
/* DCOM messages used by the apartment window (not compatible with native) */
#define DM_EXECUTERPC (WM_USER + 0) /* WPARAM = 0, LPARAM = (struct dispatch_params *) */
#define DM_HOSTOBJECT (WM_USER + 1) /* WPARAM = 0, LPARAM = (struct host_object_params *) */
/*
* Per-thread values are stored in the TEB on offset 0xF80
*/
extern HRESULT WINAPI InternalTlsAllocData(struct oletls **tlsdata); extern HRESULT WINAPI InternalTlsAllocData(struct oletls **tlsdata);
/* will create if necessary */ /* will create if necessary */
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
@ stdcall CoQueryClientBlanket(ptr ptr ptr ptr ptr ptr ptr) combase.CoQueryClientBlanket @ stdcall CoQueryClientBlanket(ptr ptr ptr ptr ptr ptr ptr) combase.CoQueryClientBlanket
@ stdcall CoQueryProxyBlanket(ptr ptr ptr ptr ptr ptr ptr ptr) combase.CoQueryProxyBlanket @ stdcall CoQueryProxyBlanket(ptr ptr ptr ptr ptr ptr ptr ptr) combase.CoQueryProxyBlanket
@ stub CoQueryReleaseObject @ stub CoQueryReleaseObject
@ stdcall CoRegisterChannelHook(ptr ptr) @ stdcall CoRegisterChannelHook(ptr ptr) combase.CoRegisterChannelHook
@ stdcall CoRegisterClassObject(ptr ptr long long ptr) combase.CoRegisterClassObject @ stdcall CoRegisterClassObject(ptr ptr long long ptr) combase.CoRegisterClassObject
@ stdcall CoRegisterInitializeSpy(ptr ptr) combase.CoRegisterInitializeSpy @ stdcall CoRegisterInitializeSpy(ptr ptr) combase.CoRegisterInitializeSpy
@ stdcall CoRegisterMallocSpy(ptr) combase.CoRegisterMallocSpy @ stdcall CoRegisterMallocSpy(ptr) combase.CoRegisterMallocSpy
...@@ -298,11 +298,3 @@ ...@@ -298,11 +298,3 @@
@ stdcall WriteFmtUserTypeStg(ptr long ptr) @ stdcall WriteFmtUserTypeStg(ptr long ptr)
@ stub WriteOleStg @ stub WriteOleStg
@ stub WriteStringStream @ stub WriteStringStream
@ stdcall Internal_RPC_ExecuteCall(ptr)
@ stdcall RPC_CreateServerChannel(long ptr ptr)
@ stdcall RPC_UnregisterInterface(ptr long)
@ stdcall RPC_RegisterInterface(ptr)
@ stdcall RPC_ResolveOxid(int64 ptr)
@ stdcall RPC_StartRemoting(ptr)
@ stdcall RPC_CreateClientChannel(ptr ptr ptr ptr long ptr ptr ptr)
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