[NTOSKRNL]
[reactos.git] / reactos / ntoskrnl / ke / i386 / traphdlr.c
index 571d88c..627c32c 100644 (file)
@@ -1517,8 +1517,18 @@ VOID
 FASTCALL
 KiCallbackReturnHandler(IN PKTRAP_FRAME TrapFrame)
 {
+    PKTHREAD Thread;
     NTSTATUS Status;
 
+    /* Save the SEH chain, NtCallbackReturn will restore this */
+    TrapFrame->ExceptionList = KeGetPcr()->NtTib.ExceptionList;
+
+    /* Set thread fields */
+    Thread = KeGetCurrentThread();
+    Thread->TrapFrame = TrapFrame;
+    Thread->PreviousMode = KiUserTrap(TrapFrame);
+    NT_ASSERT(Thread->PreviousMode != KernelMode);
+
     /* Pass the register parameters to NtCallbackReturn.
        Result pointer is in ecx, result length in edx, status in eax */
     Status = NtCallbackReturn((PVOID)TrapFrame->Ecx,
@@ -1663,7 +1673,6 @@ KiSystemServiceHandler(IN PKTRAP_FRAME TrapFrame,
         if (!NT_SUCCESS(Result))
         {
             /* Set the last error and fail */
-            //SetLastWin32Error(RtlNtStatusToDosError(Result));
             goto ExitCall;
         }