Author: mjmartin
Date: Tue Dec  1 12:48:06 2009
New Revision: 44341

URL: http://svn.reactos.org/svn/reactos?rev=44341&view=rev
Log:
[kernel32]
- Fix broken code inside SXS_SUPPORT_ENABLED define and add some DPRINTs. Still 
unused.

Modified:
    trunk/reactos/dll/win32/kernel32/thread/thread.c

Modified: trunk/reactos/dll/win32/kernel32/thread/thread.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/thread/thread.c?rev=44341&r1=44340&r2=44341&view=diff
==============================================================================
--- trunk/reactos/dll/win32/kernel32/thread/thread.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/thread/thread.c [iso-8859-1] Tue Dec  1 
12:48:06 2009
@@ -160,46 +160,60 @@
 
     #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
 


Reply via email to