Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/combase/combase.c | 20 ++++++++++++++++++++ dlls/combase/combase.spec | 2 +- dlls/ole32/compobj.c | 29 ----------------------------- dlls/ole32/ole32.spec | 2 +- 4 files changed, 22 insertions(+), 31 deletions(-)
diff --git a/dlls/combase/combase.c b/dlls/combase/combase.c index c4a7f719129..52a159d7fe2 100644 --- a/dlls/combase/combase.c +++ b/dlls/combase/combase.c @@ -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; +} diff --git a/dlls/combase/combase.spec b/dlls/combase/combase.spec index 8293c9de259..55ba999a37d 100644 --- a/dlls/combase/combase.spec +++ b/dlls/combase/combase.spec @@ -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) diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c index 2dc2d417e07..4e7cd3c6672 100644 --- a/dlls/ole32/compobj.c +++ b/dlls/ole32/compobj.c @@ -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 */ diff --git a/dlls/ole32/ole32.spec b/dlls/ole32/ole32.spec index 43237550195..b64b5114093 100644 --- a/dlls/ole32/ole32.spec +++ b/dlls/ole32/ole32.spec @@ -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