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

combase: Move CoSwitchCallContext().

parent 06a90f7f
...@@ -1406,3 +1406,23 @@ HRESULT WINAPI CoGetCallContext(REFIID riid, void **obj) ...@@ -1406,3 +1406,23 @@ HRESULT WINAPI CoGetCallContext(REFIID riid, void **obj)
return IUnknown_QueryInterface(tlsdata->call_state, riid, obj); return IUnknown_QueryInterface(tlsdata->call_state, riid, obj);
} }
/***********************************************************************
* CoSwitchCallContext (combase.@)
*/
HRESULT WINAPI CoSwitchCallContext(IUnknown *context, IUnknown **old_context)
{
struct tlsdata *tlsdata;
HRESULT hr;
TRACE("%p, %p\n", context, old_context);
if (FAILED(hr = com_get_tlsdata(&tlsdata)))
return hr;
/* Reference counts are not touched. */
*old_context = tlsdata->call_state;
tlsdata->call_state = context;
return S_OK;
}
...@@ -158,7 +158,7 @@ ...@@ -158,7 +158,7 @@
@ stdcall CoSetErrorInfo(long ptr) SetErrorInfo @ stdcall CoSetErrorInfo(long ptr) SetErrorInfo
@ stdcall CoSetProxyBlanket(ptr long long ptr long long ptr long) @ stdcall CoSetProxyBlanket(ptr long long ptr long long ptr long)
@ stdcall CoSuspendClassObjects() ole32.CoSuspendClassObjects @ stdcall CoSuspendClassObjects() ole32.CoSuspendClassObjects
@ stdcall CoSwitchCallContext(ptr ptr) ole32.CoSwitchCallContext @ stdcall CoSwitchCallContext(ptr ptr)
@ stdcall CoTaskMemAlloc(long) @ stdcall CoTaskMemAlloc(long)
@ stdcall CoTaskMemFree(ptr) @ stdcall CoTaskMemFree(ptr)
@ stdcall CoTaskMemRealloc(ptr long) @ stdcall CoTaskMemRealloc(ptr long)
......
...@@ -3458,35 +3458,6 @@ HRESULT WINAPI CoAllowSetForegroundWindow(IUnknown *pUnk, void *pvReserved) ...@@ -3458,35 +3458,6 @@ HRESULT WINAPI CoAllowSetForegroundWindow(IUnknown *pUnk, void *pvReserved)
return S_OK; return S_OK;
} }
/***********************************************************************
* CoSwitchCallContext [OLE32.@]
*
* Switches the context of the currently executing server call in the current
* thread.
*
* PARAMS
* pObject [I] Pointer to new context object
* ppOldObject [O] Pointer to memory that will receive old context object pointer
*
* RETURNS
* Success: S_OK.
* Failure: HRESULT code.
*/
HRESULT WINAPI CoSwitchCallContext(IUnknown *pObject, IUnknown **ppOldObject)
{
struct oletls *info = COM_CurrentInfo();
TRACE("(%p, %p)\n", pObject, ppOldObject);
if (!info)
return E_OUTOFMEMORY;
*ppOldObject = info->call_state;
info->call_state = pObject; /* CoSwitchCallContext does not addref nor release objects */
return S_OK;
}
static BOOL COM_PeekMessage(struct apartment *apt, MSG *msg) static BOOL COM_PeekMessage(struct apartment *apt, MSG *msg)
{ {
/* first try to retrieve messages for incoming COM calls to the apartment window */ /* first try to retrieve messages for incoming COM calls to the apartment window */
......
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
@ stdcall CoSetProxyBlanket(ptr long long ptr long long ptr long) combase.CoSetProxyBlanket @ stdcall CoSetProxyBlanket(ptr long long ptr long long ptr long) combase.CoSetProxyBlanket
@ stdcall CoSetState(ptr) @ stdcall CoSetState(ptr)
@ stdcall CoSuspendClassObjects() @ stdcall CoSuspendClassObjects()
@ stdcall CoSwitchCallContext(ptr ptr) @ stdcall CoSwitchCallContext(ptr ptr) combase.CoSwitchCallContext
@ stdcall CoTaskMemAlloc(long) combase.CoTaskMemAlloc @ stdcall CoTaskMemAlloc(long) combase.CoTaskMemAlloc
@ stdcall CoTaskMemFree(ptr) combase.CoTaskMemFree @ stdcall CoTaskMemFree(ptr) combase.CoTaskMemFree
@ stdcall CoTaskMemRealloc(ptr long) combase.CoTaskMemRealloc @ stdcall CoTaskMemRealloc(ptr long) combase.CoTaskMemRealloc
......
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