Commit 33606dbc authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

combase: Expose ROT access helpers.

parent 769dd6ae
...@@ -2245,7 +2245,7 @@ DWORD WINAPI CoGetCurrentProcess(void) ...@@ -2245,7 +2245,7 @@ DWORD WINAPI CoGetCurrentProcess(void)
return 0; return 0;
if (!tlsdata->thread_seqid) if (!tlsdata->thread_seqid)
tlsdata->thread_seqid = rpcss_get_next_seqid(); rpcss_get_next_seqid(&tlsdata->thread_seqid);
return tlsdata->thread_seqid; return tlsdata->thread_seqid;
} }
...@@ -255,13 +255,13 @@ ...@@ -255,13 +255,13 @@
@ stub InternalFillLocalOXIDInfo @ stub InternalFillLocalOXIDInfo
@ stub InternalFreeObjRef @ stub InternalFreeObjRef
@ stub InternalGetWindowPropInterface @ stub InternalGetWindowPropInterface
@ stub InternalIrotEnumRunning @ stdcall InternalIrotEnumRunning(ptr)
@ stub InternalIrotGetObject @ stdcall InternalIrotGetObject(ptr ptr ptr)
@ stub InternalIrotGetTimeOfLastChange @ stdcall InternalIrotGetTimeOfLastChange(ptr ptr)
@ stub InternalIrotIsRunning @ stdcall InternalIrotIsRunning(ptr)
@ stub InternalIrotNoteChangeTime @ stdcall InternalIrotNoteChangeTime(long ptr)
@ stub InternalIrotRegister @ stdcall InternalIrotRegister(ptr ptr ptr ptr long ptr ptr)
@ stub InternalIrotRevoke @ stdcall InternalIrotRevoke(long ptr ptr ptr)
@ stub InternalIsApartmentInitialized @ stub InternalIsApartmentInitialized
@ stub InternalIsProcessInitialized @ stub InternalIsProcessInitialized
@ stub InternalMarshalObjRef @ stub InternalMarshalObjRef
......
...@@ -90,4 +90,4 @@ static inline struct apartment* com_get_current_apt(void) ...@@ -90,4 +90,4 @@ static inline struct apartment* com_get_current_apt(void)
} }
/* RpcSs interface */ /* RpcSs interface */
DWORD rpcss_get_next_seqid(void) DECLSPEC_HIDDEN; HRESULT rpcss_get_next_seqid(DWORD *id) DECLSPEC_HIDDEN;
...@@ -18,4 +18,5 @@ ...@@ -18,4 +18,5 @@
#pragma makedep client #pragma makedep client
#include "wine/irot.idl"
#include "wine/irpcss.idl" #include "wine/irpcss.idl"
...@@ -127,29 +127,97 @@ static RPC_BINDING_HANDLE get_irpcss_handle(void) ...@@ -127,29 +127,97 @@ static RPC_BINDING_HANDLE get_irpcss_handle(void)
return irpcss_handle; return irpcss_handle;
} }
DWORD rpcss_get_next_seqid(void) static RPC_BINDING_HANDLE get_irot_handle(void)
{ {
DWORD id = 0; static RPC_BINDING_HANDLE irot_handle;
HRESULT hr;
for (;;) if (!irot_handle)
{ {
__TRY unsigned short protseq[] = IROT_PROTSEQ;
{ unsigned short endpoint[] = IROT_ENDPOINT;
hr = irpcss_get_thread_seq_id(get_irpcss_handle(), &id);
} RPC_BINDING_HANDLE new_handle = get_rpc_handle(protseq, endpoint);
__EXCEPT(rpc_filter) if (InterlockedCompareExchangePointer(&irot_handle, new_handle, NULL))
{ /* another thread beat us to it */
hr = HRESULT_FROM_WIN32(GetExceptionCode()); RpcBindingFree(&new_handle);
}
__ENDTRY
if (hr == HRESULT_FROM_WIN32(RPC_S_SERVER_UNAVAILABLE))
{
if (start_rpcss())
continue;
}
break;
} }
return irot_handle;
}
#define RPCSS_CALL_START \
HRESULT hr; \
for (;;) { \
__TRY {
#define RPCSS_CALL_END \
} __EXCEPT(rpc_filter) { \
hr = HRESULT_FROM_WIN32(GetExceptionCode()); \
} \
__ENDTRY \
if (hr == HRESULT_FROM_WIN32(RPC_S_SERVER_UNAVAILABLE)) { \
if (start_rpcss()) \
continue; \
} \
break; \
} \
return hr;
HRESULT rpcss_get_next_seqid(DWORD *id)
{
RPCSS_CALL_START
hr = irpcss_get_thread_seq_id(get_irpcss_handle(), id);
RPCSS_CALL_END
}
HRESULT WINAPI InternalIrotRegister(const MonikerComparisonData *moniker_data,
const InterfaceData *object, const InterfaceData *moniker,
const FILETIME *time, DWORD flags, IrotCookie *cookie, IrotContextHandle *ctxt_handle)
{
RPCSS_CALL_START
hr = IrotRegister(get_irot_handle(), moniker_data, object, moniker, time, flags, cookie, ctxt_handle);
RPCSS_CALL_END
}
HRESULT WINAPI InternalIrotIsRunning(const MonikerComparisonData *moniker_data)
{
RPCSS_CALL_START
hr = IrotIsRunning(get_irot_handle(), moniker_data);
RPCSS_CALL_END
}
HRESULT WINAPI InternalIrotGetObject(const MonikerComparisonData *moniker_data, PInterfaceData *obj,
IrotCookie *cookie)
{
RPCSS_CALL_START
hr = IrotGetObject(get_irot_handle(), moniker_data, obj, cookie);
RPCSS_CALL_END
}
HRESULT WINAPI InternalIrotNoteChangeTime(IrotCookie cookie, const FILETIME *time)
{
RPCSS_CALL_START
hr = IrotNoteChangeTime(get_irot_handle(), cookie, time);
RPCSS_CALL_END
}
return id; HRESULT WINAPI InternalIrotGetTimeOfLastChange(const MonikerComparisonData *moniker_data, FILETIME *time)
{
RPCSS_CALL_START
hr = IrotGetTimeOfLastChange(get_irot_handle(), moniker_data, time);
RPCSS_CALL_END
}
HRESULT WINAPI InternalIrotEnumRunning(PInterfaceList *list)
{
RPCSS_CALL_START
hr = IrotEnumRunning(get_irot_handle(), list);
RPCSS_CALL_END
}
HRESULT WINAPI InternalIrotRevoke(IrotCookie cookie, IrotContextHandle *ctxt_handle, PInterfaceData *object,
PInterfaceData *moniker)
{
RPCSS_CALL_START
hr = IrotRevoke(get_irot_handle(), cookie, ctxt_handle, object, moniker);
RPCSS_CALL_END
} }
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