Nikolay Sivov : combase: Move CoGetCurrentLogicalThreadId().

Alexandre Julliard julliard at winehq.org
Thu Aug 20 16:03:35 CDT 2020


Module: wine
Branch: master
Commit: 6e0e890fba94946bc0f8925be900338028bd9606
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=6e0e890fba94946bc0f8925be900338028bd9606

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Thu Aug 20 10:34:42 2020 +0300

combase: Move CoGetCurrentLogicalThreadId().

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       | 22 ++++++++++++++++++++++
 dlls/combase/combase.spec    |  2 +-
 dlls/ole32/compobj.c         | 14 --------------
 dlls/ole32/compobj_private.h | 10 ----------
 dlls/ole32/ole32.spec        |  2 +-
 dlls/ole32/rpc.c             |  2 +-
 6 files changed, 25 insertions(+), 27 deletions(-)

diff --git a/dlls/combase/combase.c b/dlls/combase/combase.c
index a2e5ac93a5..8ad95329d0 100644
--- a/dlls/combase/combase.c
+++ b/dlls/combase/combase.c
@@ -2211,3 +2211,25 @@ HRESULT WINAPI CoGetContextToken(ULONG_PTR *token)
 
     return S_OK;
 }
+
+/***********************************************************************
+ *              CoGetCurrentLogicalThreadId    (combase.@)
+ */
+HRESULT WINAPI CoGetCurrentLogicalThreadId(GUID *id)
+{
+    struct tlsdata *tlsdata;
+    HRESULT hr;
+
+    if (!id)
+        return E_INVALIDARG;
+
+    if (FAILED(hr = com_get_tlsdata(&tlsdata)))
+        return hr;
+
+    if (IsEqualGUID(&tlsdata->causality_id, &GUID_NULL))
+        CoCreateGuid(&tlsdata->causality_id);
+
+    *id = tlsdata->causality_id;
+
+    return S_OK;
+}
diff --git a/dlls/combase/combase.spec b/dlls/combase/combase.spec
index 806ee01537..af83e89d17 100644
--- a/dlls/combase/combase.spec
+++ b/dlls/combase/combase.spec
@@ -104,7 +104,7 @@
 @ stdcall CoGetClassObject(ptr long ptr ptr ptr) ole32.CoGetClassObject
 @ stub CoGetClassVersion
 @ stdcall CoGetContextToken(ptr)
-@ stdcall CoGetCurrentLogicalThreadId(ptr) ole32.CoGetCurrentLogicalThreadId
+@ stdcall CoGetCurrentLogicalThreadId(ptr)
 @ stdcall CoGetCurrentProcess() ole32.CoGetCurrentProcess
 @ stdcall CoGetDefaultContext(long ptr ptr)
 @ stdcall CoGetErrorInfo(long ptr) GetErrorInfo
diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c
index 8364478258..671f60e231 100644
--- a/dlls/ole32/compobj.c
+++ b/dlls/ole32/compobj.c
@@ -2914,20 +2914,6 @@ DWORD WINAPI CoGetCurrentProcess(void)
     return info->thread_seqid;
 }
 
-/***********************************************************************
- *              CoGetCurrentLogicalThreadId        [OLE32.@]
- */
-HRESULT WINAPI CoGetCurrentLogicalThreadId(GUID *id)
-{
-    TRACE("(%p)\n", id);
-
-    if (!id)
-        return E_INVALIDARG;
-
-    *id = COM_CurrentCausalityId();
-    return S_OK;
-}
-
 /***********************************************************************
  *           CoIsOle1Class [OLE32.@]
  *
diff --git a/dlls/ole32/compobj_private.h b/dlls/ole32/compobj_private.h
index 5d7bf50b73..8419fd04ff 100644
--- a/dlls/ole32/compobj_private.h
+++ b/dlls/ole32/compobj_private.h
@@ -287,16 +287,6 @@ static inline APARTMENT* COM_CurrentApt(void)
     return COM_CurrentInfo()->apt;
 }
 
-static inline GUID COM_CurrentCausalityId(void)
-{
-    struct oletls *info = COM_CurrentInfo();
-    if (!info)
-        return GUID_NULL;
-    if (IsEqualGUID(&info->causality_id, &GUID_NULL))
-        CoCreateGuid(&info->causality_id);
-    return info->causality_id;
-}
-
 /* helpers for debugging */
 # define DEBUG_SET_CRITSEC_NAME(cs, name) (cs)->DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": " name)
 # define DEBUG_CLEAR_CRITSEC_NAME(cs) (cs)->DebugInfo->Spare[0] = 0
diff --git a/dlls/ole32/ole32.spec b/dlls/ole32/ole32.spec
index 9c66369248..543126e02b 100644
--- a/dlls/ole32/ole32.spec
+++ b/dlls/ole32/ole32.spec
@@ -32,7 +32,7 @@
 @ stdcall CoGetCallerTID(ptr)
 @ stdcall CoGetClassObject(ptr long ptr ptr ptr)
 @ stdcall CoGetContextToken(ptr) combase.CoGetContextToken
-@ stdcall CoGetCurrentLogicalThreadId(ptr)
+@ stdcall CoGetCurrentLogicalThreadId(ptr) combase.CoGetCurrentLogicalThreadId
 @ stdcall CoGetCurrentProcess()
 @ stdcall CoGetDefaultContext(long ptr ptr) combase.CoGetDefaultContext
 @ stdcall CoGetInstanceFromFile(ptr ptr ptr long long wstr long ptr) combase.CoGetInstanceFromFile
diff --git a/dlls/ole32/rpc.c b/dlls/ole32/rpc.c
index 895aa4010c..bd825fd6c1 100644
--- a/dlls/ole32/rpc.c
+++ b/dlls/ole32/rpc.c
@@ -659,7 +659,7 @@ static HRESULT WINAPI ClientRpcChannelBuffer_GetBuffer(LPRPCCHANNELBUFFER iface,
 
     message_state->channel_hook_info.iid = *riid;
     message_state->channel_hook_info.cbSize = sizeof(message_state->channel_hook_info);
-    message_state->channel_hook_info.uCausality = COM_CurrentCausalityId();
+    CoGetCurrentLogicalThreadId(&message_state->channel_hook_info.uCausality);
     message_state->channel_hook_info.dwServerPid = This->server_pid;
     message_state->channel_hook_info.iMethod = msg->ProcNum & ~RPC_FLAGS_VALID_BIT;
     message_state->channel_hook_info.pObject = NULL; /* only present on server-side */




More information about the wine-cvs mailing list