From 6e0e890fba94946bc0f8925be900338028bd9606 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Thu, 20 Aug 2020 10:34:42 +0300 Subject: [PATCH] combase: Move CoGetCurrentLogicalThreadId(). Signed-off-by: Nikolay Sivov Signed-off-by: Huw Davies Signed-off-by: Alexandre Julliard --- 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 a2e5ac93a53..8ad95329d08 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 806ee015371..af83e89d174 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 83644782589..671f60e231a 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 5d7bf50b73f..8419fd04ffa 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 9c663692484..543126e02bd 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 895aa4010cd..bd825fd6c10 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 */