From db4cbee9dc0c0872b4736ad1073e5cc373c73114 Mon Sep 17 00:00:00 2001 From: Michael Martin Date: Tue, 1 Dec 2009 11:48:06 +0000 Subject: [PATCH] [kernel32] - Fix broken code inside SXS_SUPPORT_ENABLED define and add some DPRINTs. Still unused. svn path=/trunk/; revision=44341 --- reactos/dll/win32/kernel32/thread/thread.c | 72 +++++++++++++--------- 1 file changed, 43 insertions(+), 29 deletions(-) diff --git a/reactos/dll/win32/kernel32/thread/thread.c b/reactos/dll/win32/kernel32/thread/thread.c index 3fb6a6da7e7..8bbe32c7fe0 100644 --- a/reactos/dll/win32/kernel32/thread/thread.c +++ b/reactos/dll/win32/kernel32/thread/thread.c @@ -160,46 +160,60 @@ CreateRemoteThread(HANDLE hProcess, #ifdef SXS_SUPPORT_ENABLED /* Are we in the same process? */ - if (Process = NtCurrentProcess()) + if (hProcess == NtCurrentProcess()) { PTEB Teb; PVOID ActivationContextStack; - PTHREAD_BASIC_INFORMATION ThreadBasicInfo; - PACTIVATION_CONTEXT_BASIC_INFORMATION ActivationCtxInfo; + THREAD_BASIC_INFORMATION ThreadBasicInfo; + ACTIVATION_CONTEXT_BASIC_INFORMATION ActivationCtxInfo; ULONG_PTR Cookie; + ULONG retLen; /* Get the TEB */ Status = NtQueryInformationThread(hThread, - ThreadBasicIformation, + ThreadBasicInformation, &ThreadBasicInfo, sizeof(ThreadBasicInfo), - NULL); - - /* Allocate the Activation Context Stack */ - Status = RtlAllocateActivationContextStack(&ActivationContextStack); - Teb = ThreadBasicInfo.TebBaseAddress; - - /* Save it */ - Teb->ActivationContextStackPointer = ActivationContextStack; - - /* Query the Context */ - Status = RtlQueryInformationActivationContext(1, - 0, - NULL, - ActivationContextBasicInformation, - &ActivationCtxInfo, - sizeof(ActivationCtxInfo), - NULL); - - /* Does it need to be activated? */ - if (!ActivationCtxInfo.hActCtx) + &retLen); + if (NT_SUCCESS(Status)) { - /* Activate it */ - Status = RtlActivateActivationContextEx(1, - Teb, - ActivationCtxInfo.hActCtx, - &Cookie); + /* Allocate the Activation Context Stack */ + Status = RtlAllocateActivationContextStack(&ActivationContextStack); } + + if (NT_SUCCESS(Status)) + { + Teb = ThreadBasicInfo.TebBaseAddress; + + /* Save it */ + Teb->ActivationContextStackPointer = ActivationContextStack; + + /* Query the Context */ + Status = RtlQueryInformationActivationContext(1, + 0, + NULL, + ActivationContextBasicInformation, + &ActivationCtxInfo, + sizeof(ActivationCtxInfo), + &retLen); + if (NT_SUCCESS(Status)) + { + /* Does it need to be activated? */ + if (!ActivationCtxInfo.hActCtx) + { + /* Activate it */ + Status = RtlActivateActivationContext(1, + ActivationCtxInfo.hActCtx, + &Cookie); + if (!NT_SUCCESS(Status)) + DPRINT1("RtlActivateActivationContext failed %x\n", Status); + } + } + else + DPRINT1("RtlQueryInformationActivationContext failed %x\n", Status); + } + else + DPRINT1("RtlAllocateActivationContextStack failed %x\n", Status); } #endif