From 7551b82cca1240375ccdd0f3d574851efe3d70b9 Mon Sep 17 00:00:00 2001 From: Rob Shearman Date: Mon, 14 Jul 2008 08:08:03 +0100 Subject: [PATCH] rpcrt4: Implement RpcCancelThreadEx. Implement RpcCancelThreadEx using existing code moved into a new function, rpc_ccancel_thread. Implement RpcCancelThread based on RpcCancelThreadEx with timeout of 0. --- dlls/rpcrt4/rpcrt4_main.c | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/dlls/rpcrt4/rpcrt4_main.c b/dlls/rpcrt4/rpcrt4_main.c index f70892cd6e9..1f0b1bbd615 100644 --- a/dlls/rpcrt4/rpcrt4_main.c +++ b/dlls/rpcrt4/rpcrt4_main.c @@ -968,20 +968,10 @@ NDR_SCONTEXT RPCRT4_PopThreadContextHandle(void) return context_handle; } -/****************************************************************************** - * RpcCancelThread (rpcrt4.@) - */ -RPC_STATUS RPC_ENTRY RpcCancelThread(void* ThreadHandle) +static RPC_STATUS rpc_cancel_thread(DWORD target_tid) { - DWORD target_tid; struct threaddata *tdata; - TRACE("(%p)\n", ThreadHandle); - - target_tid = GetThreadId(ThreadHandle); - if (!target_tid) - return RPC_S_INVALID_ARG; - EnterCriticalSection(&threaddata_cs); LIST_FOR_EACH_ENTRY(tdata, &threaddata_list, struct threaddata, entry) if (tdata->thread_id == target_tid) @@ -996,11 +986,33 @@ RPC_STATUS RPC_ENTRY RpcCancelThread(void* ThreadHandle) return RPC_S_OK; } +/****************************************************************************** + * RpcCancelThread (rpcrt4.@) + */ +RPC_STATUS RPC_ENTRY RpcCancelThread(void* ThreadHandle) +{ + TRACE("(%p)\n", ThreadHandle); + return RpcCancelThreadEx(ThreadHandle, 0); +} + /****************************************************************************** * RpcCancelThreadEx (rpcrt4.@) */ RPC_STATUS RPC_ENTRY RpcCancelThreadEx(void* ThreadHandle, LONG Timeout) { + DWORD target_tid; + FIXME("(%p, %d)\n", ThreadHandle, Timeout); - return RPC_S_OK; + + target_tid = GetThreadId(ThreadHandle); + if (!target_tid) + return RPC_S_INVALID_ARG; + + if (Timeout) + { + FIXME("(%p, %d)\n", ThreadHandle, Timeout); + return RPC_S_OK; + } + else + return rpc_cancel_thread(target_tid); }