combase: Move CoSwitchCallContext().

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:
Nikolay Sivov 2020-08-19 11:29:10 +03:00 committed by Alexandre Julliard
parent 06a90f7f11
commit 5fbfee619d
4 changed files with 22 additions and 31 deletions

View File

@ -1406,3 +1406,23 @@ HRESULT WINAPI CoGetCallContext(REFIID riid, void **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;
}

View File

@ -158,7 +158,7 @@
@ stdcall CoSetErrorInfo(long ptr) SetErrorInfo
@ stdcall CoSetProxyBlanket(ptr long long ptr long long ptr long)
@ stdcall CoSuspendClassObjects() ole32.CoSuspendClassObjects
@ stdcall CoSwitchCallContext(ptr ptr) ole32.CoSwitchCallContext
@ stdcall CoSwitchCallContext(ptr ptr)
@ stdcall CoTaskMemAlloc(long)
@ stdcall CoTaskMemFree(ptr)
@ stdcall CoTaskMemRealloc(ptr long)

View File

@ -3458,35 +3458,6 @@ HRESULT WINAPI CoAllowSetForegroundWindow(IUnknown *pUnk, void *pvReserved)
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)
{
/* first try to retrieve messages for incoming COM calls to the apartment window */

View File

@ -82,7 +82,7 @@
@ stdcall CoSetProxyBlanket(ptr long long ptr long long ptr long) combase.CoSetProxyBlanket
@ stdcall CoSetState(ptr)
@ stdcall CoSuspendClassObjects()
@ stdcall CoSwitchCallContext(ptr ptr)
@ stdcall CoSwitchCallContext(ptr ptr) combase.CoSwitchCallContext
@ stdcall CoTaskMemAlloc(long) combase.CoTaskMemAlloc
@ stdcall CoTaskMemFree(ptr) combase.CoTaskMemFree
@ stdcall CoTaskMemRealloc(ptr long) combase.CoTaskMemRealloc