combase: Move ORPC functionality.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
11057c1370
commit
5c15a6c1ec
|
@ -443,7 +443,7 @@ void apartment_freeunusedlibraries(struct apartment *apt, DWORD delay)
|
|||
LeaveCriticalSection(&apt->cs);
|
||||
}
|
||||
|
||||
void WINAPI apartment_release(struct apartment *apt)
|
||||
void apartment_release(struct apartment *apt)
|
||||
{
|
||||
DWORD refcount;
|
||||
|
||||
|
@ -615,7 +615,7 @@ struct apartment * apartment_get_mta(void)
|
|||
|
||||
/* Return the current apartment if it exists, or, failing that, the MTA. Caller
|
||||
* 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();
|
||||
if (apt)
|
||||
|
@ -1098,14 +1098,13 @@ static HRESULT apartment_hostobject(struct apartment *apt, const struct host_obj
|
|||
}
|
||||
|
||||
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)
|
||||
{
|
||||
switch (msg)
|
||||
{
|
||||
case DM_EXECUTERPC:
|
||||
Internal_RPC_ExecuteCall((struct dispatch_params *)lParam);
|
||||
rpc_execute_call((struct dispatch_params *)lParam);
|
||||
return 0;
|
||||
case DM_HOSTOBJECT:
|
||||
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)
|
|||
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;
|
||||
|
||||
|
@ -1143,7 +1142,7 @@ HRESULT WINAPI enter_apartment(struct tlsdata *data, DWORD model)
|
|||
return hr;
|
||||
}
|
||||
|
||||
void WINAPI leave_apartment(struct tlsdata *data)
|
||||
void leave_apartment(struct tlsdata *data)
|
||||
{
|
||||
if (!--data->inits)
|
||||
{
|
||||
|
@ -1262,7 +1261,7 @@ HRESULT apartment_createwindowifneeded(struct apartment *apt)
|
|||
}
|
||||
|
||||
/* 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);
|
||||
return apt->win;
|
||||
|
|
|
@ -3052,6 +3052,16 @@ HRESULT WINAPI CoLockObjectExternal(IUnknown *object, BOOL lock, BOOL last_unloc
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* 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.@)
|
||||
*/
|
||||
|
@ -3068,6 +3078,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID reserved)
|
|||
if (reserved) break;
|
||||
apartment_global_cleanup();
|
||||
DeleteCriticalSection(®istered_classes_cs);
|
||||
rpc_unregister_channel_hooks();
|
||||
break;
|
||||
case DLL_THREAD_DETACH:
|
||||
com_cleanup_tlsdata();
|
||||
|
|
|
@ -139,6 +139,7 @@
|
|||
@ stdcall CoQueryProxyBlanket(ptr ptr ptr ptr ptr ptr ptr ptr)
|
||||
@ stub CoReactivateObject
|
||||
@ stub CoRegisterActivationFilter
|
||||
@ stdcall CoRegisterChannelHook(ptr ptr)
|
||||
@ stdcall CoRegisterClassObject(ptr ptr long long ptr)
|
||||
@ stdcall CoRegisterInitializeSpy(ptr ptr)
|
||||
@ stdcall CoRegisterMallocSpy(ptr)
|
||||
|
@ -350,12 +351,3 @@
|
|||
@ stdcall WindowsSubstringWithSpecifiedLength(ptr long long ptr)
|
||||
@ stdcall WindowsTrimStringEnd(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)
|
|||
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;
|
||||
void apartment_freeunusedlibraries(struct apartment *apt, DWORD unload_delay) DECLSPEC_HIDDEN;
|
||||
void apartment_global_cleanup(void) 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_start_local_server(REFCLSID clsid, IStream *stream, BOOL multi_use, 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
|
||||
{
|
||||
|
@ -136,10 +148,10 @@ struct class_reg_data
|
|||
} u;
|
||||
};
|
||||
|
||||
HRESULT WINAPI enter_apartment(struct tlsdata *data, DWORD model);
|
||||
void WINAPI leave_apartment(struct tlsdata *data);
|
||||
void WINAPI apartment_release(struct apartment *apt);
|
||||
struct apartment * WINAPI apartment_get_current_or_mta(void);
|
||||
HRESULT enter_apartment(struct tlsdata *data, DWORD model) DECLSPEC_HIDDEN;
|
||||
void leave_apartment(struct tlsdata *data) DECLSPEC_HIDDEN;
|
||||
void apartment_release(struct apartment *apt) DECLSPEC_HIDDEN;
|
||||
struct apartment * apartment_get_current_or_mta(void) 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;
|
||||
struct apartment * apartment_get_mta(void) 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_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 */
|
||||
|
||||
/* signal to stub manager that this is a rem unknown object */
|
||||
|
@ -219,7 +234,7 @@ struct stub_manager
|
|||
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;
|
||||
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;
|
||||
|
@ -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_new_ifstub(struct stub_manager *m, IRpcStubBuffer *sb, REFIID iid, DWORD dest_context,
|
||||
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,
|
|||
const OXID_INFO *oxid_info, const IID *iid,
|
||||
DWORD dest_context, void *dest_context_data,
|
||||
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,
|
||||
MSHCTX dest_context, void *dest_context_data,
|
||||
|
@ -889,7 +886,7 @@ static inline HRESULT get_facbuf_for_iid(REFIID riid, IPSFactoryBuffer **facbuf)
|
|||
}
|
||||
|
||||
/* 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)
|
||||
{
|
||||
struct stub_manager *manager;
|
||||
|
@ -971,7 +968,7 @@ HRESULT WINAPI marshal_object(struct apartment *apt, STDOBJREF *stdobjref, REFII
|
|||
}
|
||||
|
||||
/* FIXME: check return value */
|
||||
RPC_RegisterInterface(riid);
|
||||
rpc_register_interface(riid);
|
||||
|
||||
stdobjref->ipid = ifstub->ipid;
|
||||
|
||||
|
@ -979,8 +976,6 @@ HRESULT WINAPI marshal_object(struct apartment *apt, STDOBJREF *stdobjref, REFII
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Client-side identity of the server object */
|
||||
|
||||
static HRESULT proxy_manager_get_remunknown(struct proxy_manager * This, IRemUnknown **remunk);
|
||||
|
@ -1583,7 +1578,7 @@ static HRESULT proxy_manager_construct(
|
|||
}
|
||||
else
|
||||
{
|
||||
HRESULT hr = RPC_ResolveOxid(oxid, &This->oxid_info);
|
||||
HRESULT hr = rpc_resolve_oxid(oxid, &This->oxid_info);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
CloseHandle(This->remoting_mutex);
|
||||
|
@ -2081,7 +2076,7 @@ static HRESULT WINAPI StdMarshalImpl_MarshalInterface(IMarshal *iface, IStream *
|
|||
}
|
||||
|
||||
/* make sure this apartment can be reached from other threads / processes */
|
||||
RPC_StartRemoting(apt);
|
||||
rpc_start_remoting(apt);
|
||||
|
||||
fill_std_objref(&objref, riid, NULL);
|
||||
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
|
|||
if (hr == E_NOINTERFACE)
|
||||
{
|
||||
IRpcChannelBuffer *chanbuf;
|
||||
hr = RPC_CreateClientChannel(&stdobjref->oxid, &stdobjref->ipid,
|
||||
&proxy_manager->oxid_info, riid,
|
||||
proxy_manager->dest_context,
|
||||
proxy_manager->dest_context_data,
|
||||
&chanbuf, apt);
|
||||
hr = rpc_create_clientchannel(&stdobjref->oxid, &stdobjref->ipid,
|
||||
&proxy_manager->oxid_info, riid, proxy_manager->dest_context,
|
||||
proxy_manager->dest_context_data, &chanbuf, apt);
|
||||
if (hr == S_OK)
|
||||
hr = proxy_manager_create_ifproxy(proxy_manager, stdobjref,
|
||||
riid, chanbuf, &ifproxy);
|
||||
hr = proxy_manager_create_ifproxy(proxy_manager, stdobjref, riid, chanbuf, &ifproxy);
|
||||
}
|
||||
else
|
||||
IUnknown_AddRef((IUnknown *)ifproxy->iface);
|
||||
|
|
1615
dlls/combase/rpc.c
1615
dlls/combase/rpc.c
File diff suppressed because it is too large
Load Diff
|
@ -44,11 +44,6 @@
|
|||
|
||||
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):
|
||||
* Data1 = apartment-local ipid counter
|
||||
* Data2 = apartment creator thread ID
|
||||
|
@ -92,7 +87,7 @@ struct ifstub * stub_manager_new_ifstub(struct stub_manager *m, IRpcStubBuffer *
|
|||
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)
|
||||
{
|
||||
IUnknown_Release(stub->iface);
|
||||
|
@ -131,7 +126,7 @@ static void stub_manager_delete_ifstub(struct stub_manager *m, struct ifstub *if
|
|||
list_remove(&ifstub->entry);
|
||||
|
||||
if (!m->disconnected)
|
||||
RPC_UnregisterInterface(&ifstub->iid, TRUE);
|
||||
rpc_unregister_interface(&ifstub->iid, TRUE);
|
||||
|
||||
if (ifstub->stubbuffer) IRpcStubBuffer_Release(ifstub->stubbuffer);
|
||||
IUnknown_Release(ifstub->iface);
|
||||
|
@ -255,7 +250,7 @@ void stub_manager_disconnect(struct stub_manager *m)
|
|||
if (!m->disconnected)
|
||||
{
|
||||
LIST_FOR_EACH_ENTRY(ifstub, &m->ifstubs, struct ifstub, entry)
|
||||
RPC_UnregisterInterface(&ifstub->iid, FALSE);
|
||||
rpc_unregister_interface(&ifstub->iid, FALSE);
|
||||
|
||||
m->disconnected = TRUE;
|
||||
}
|
||||
|
@ -314,7 +309,7 @@ static ULONG stub_manager_int_addref(struct stub_manager *m)
|
|||
}
|
||||
|
||||
/* 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;
|
||||
struct apartment *apt = m->apt;
|
||||
|
@ -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
|
||||
* release the references to all objects (except iface) if the function
|
||||
* returned success, otherwise no references are returned. */
|
||||
HRESULT WINAPI ipid_get_dispatch_params(const IPID *ipid, struct apartment **stub_apt,
|
||||
struct stub_manager **manager,
|
||||
IRpcStubBuffer **stub, IRpcChannelBuffer **chan,
|
||||
IID *iid, IUnknown **iface)
|
||||
HRESULT ipid_get_dispatch_params(const IPID *ipid, struct apartment **stub_apt,
|
||||
struct stub_manager **manager, IRpcStubBuffer **stub, IRpcChannelBuffer **chan,
|
||||
IID *iid, IUnknown **iface)
|
||||
{
|
||||
struct stub_manager *stubmgr;
|
||||
struct ifstub *ifstub;
|
||||
|
@ -826,7 +820,7 @@ static const IRemUnknownVtbl RemUnknown_Vtbl =
|
|||
};
|
||||
|
||||
/* 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;
|
||||
HRESULT hr = S_OK;
|
||||
|
|
|
@ -33,7 +33,6 @@ C_SRCS = \
|
|||
oleobj.c \
|
||||
oleproxy.c \
|
||||
pointermoniker.c \
|
||||
rpc.c \
|
||||
stg_prop.c \
|
||||
stg_stream.c \
|
||||
storage32.c \
|
||||
|
|
|
@ -930,26 +930,6 @@ HRESULT WINAPI CoGetObject(LPCWSTR pszName, BIND_OPTS *pBindOptions,
|
|||
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. */
|
||||
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)
|
|||
case DLL_PROCESS_DETACH:
|
||||
if (reserved) break;
|
||||
release_std_git();
|
||||
RPC_UnregisterAllChannelHooks();
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
|
|
|
@ -39,113 +39,9 @@
|
|||
#include "winreg.h"
|
||||
#include "winternl.h"
|
||||
|
||||
struct apartment;
|
||||
|
||||
DEFINE_OLEGUID( CLSID_DfMarshal, 0x0000030b, 0, 0 );
|
||||
|
||||
/* signal to stub manager that this is a rem unknown object */
|
||||
#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;
|
||||
};
|
||||
struct apartment;
|
||||
|
||||
/* this is what is stored in TEB->ReservedForOle */
|
||||
struct oletls
|
||||
|
@ -170,7 +66,6 @@ struct oletls
|
|||
DWORD spies_lock;
|
||||
};
|
||||
|
||||
|
||||
/* Global Interface Table Functions */
|
||||
extern void release_std_git(void) DECLSPEC_HIDDEN;
|
||||
extern HRESULT StdGlobalInterfaceTable_GetFactory(LPVOID *ppv) DECLSPEC_HIDDEN;
|
||||
|
@ -179,48 +74,9 @@ HRESULT COM_OpenKeyForCLSID(REFCLSID clsid, LPCWSTR keyname, REGSAM access, HKEY
|
|||
HRESULT MARSHAL_GetStandardMarshalCF(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 */
|
||||
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);
|
||||
|
||||
/* will create if necessary */
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
@ stdcall CoQueryClientBlanket(ptr ptr ptr ptr ptr ptr ptr) combase.CoQueryClientBlanket
|
||||
@ stdcall CoQueryProxyBlanket(ptr ptr ptr ptr ptr ptr ptr ptr) combase.CoQueryProxyBlanket
|
||||
@ stub CoQueryReleaseObject
|
||||
@ stdcall CoRegisterChannelHook(ptr ptr)
|
||||
@ stdcall CoRegisterChannelHook(ptr ptr) combase.CoRegisterChannelHook
|
||||
@ stdcall CoRegisterClassObject(ptr ptr long long ptr) combase.CoRegisterClassObject
|
||||
@ stdcall CoRegisterInitializeSpy(ptr ptr) combase.CoRegisterInitializeSpy
|
||||
@ stdcall CoRegisterMallocSpy(ptr) combase.CoRegisterMallocSpy
|
||||
|
@ -298,11 +298,3 @@
|
|||
@ stdcall WriteFmtUserTypeStg(ptr long ptr)
|
||||
@ stub WriteOleStg
|
||||
@ 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)
|
||||
|
|
1654
dlls/ole32/rpc.c
1654
dlls/ole32/rpc.c
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue