Nikolay Sivov : combase: Move CoSwitchCallContext().
Alexandre Julliard
julliard at winehq.org
Wed Aug 19 15:46:01 CDT 2020
Module: wine
Branch: master
Commit: 5fbfee619d8ec6b82b1eeda1af244ed47ee7ba90
URL: https://source.winehq.org/git/wine.git/?a=commit;h=5fbfee619d8ec6b82b1eeda1af244ed47ee7ba90
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Wed Aug 19 11:29:10 2020 +0300
combase: Move CoSwitchCallContext().
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
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 c4a7f71912..52a159d7fe 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 8293c9de25..55ba999a37 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 2dc2d417e0..4e7cd3c667 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 4323755019..b64b511409 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
More information about the wine-cvs
mailing list