Commit in reactos/lib/kernel32 on MAIN
except/except.c+16-281.20 -> 1.21
include/kernel32.h+21.7 -> 1.8
process/create.c+23-101.89 -> 1.90
thread/thread.c+34-61.58 -> 1.59
+75-44
4 modified files
- Get handling of unhandled exceptions working again.

reactos/lib/kernel32/except
except.c 1.20 -> 1.21
diff -u -r1.20 -r1.21
--- except.c	12 Dec 2004 23:03:56 -0000	1.20
+++ except.c	13 Dec 2004 13:32:23 -0000	1.21
@@ -1,4 +1,4 @@
-/* $Id: except.c,v 1.20 2004/12/12 23:03:56 weiden Exp $
+/* $Id: except.c,v 1.21 2004/12/13 13:32:23 navaraf Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS system libraries
@@ -88,10 +88,11 @@
 LONG STDCALL
 UnhandledExceptionFilter(struct _EXCEPTION_POINTERS *ExceptionInfo)
 {
+#if 0
    DWORD RetValue;
+#endif
    HANDLE DebugPort = NULL;
    NTSTATUS ErrCode;
-   static int RecursionTrap = 3;
 
 #if 0
    if (ExceptionInfo->ExceptionRecord->ExceptionCode == STATUS_ACCESS_VIOLATION &&
@@ -104,36 +105,23 @@
    }
 #endif
 
-   if (RecursionTrap > 0)
+   /* Is there a debugger running ? */
+   ErrCode = NtQueryInformationProcess(NtCurrentProcess(), ProcessDebugPort,
+                                       &DebugPort, sizeof(HANDLE), NULL);
+   if (!NT_SUCCESS(ErrCode) && ErrCode != STATUS_NOT_IMPLEMENTED)
    {
-      /* Is there a debugger running ? */
-      ErrCode = NtQueryInformationProcess(NtCurrentProcess(), ProcessDebugPort,
-                                          &DebugPort, sizeof(HANDLE), NULL);
-      if (!NT_SUCCESS(ErrCode) && ErrCode != STATUS_NOT_IMPLEMENTED)
-      {
-         SetLastErrorByStatus(ErrCode);
-         return EXCEPTION_EXECUTE_HANDLER;
-      }
-
-      if (DebugPort)
-      {
-         /* Pass the exception to debugger. */
-         DPRINT("Passing exception to debugger\n");
-         return EXCEPTION_CONTINUE_SEARCH;
-      }
+      SetLastErrorByStatus(ErrCode);
+      return EXCEPTION_EXECUTE_HANDLER;
+   }
 
-      /* Run unhandled exception handler. */
-      if (GlobalTopLevelExceptionFilter != NULL)
-      {
-         RetValue = GlobalTopLevelExceptionFilter(ExceptionInfo);
-         if (RetValue == EXCEPTION_EXECUTE_HANDLER)
-            return EXCEPTION_EXECUTE_HANDLER;
-         if (RetValue == EXCEPTION_CONTINUE_EXECUTION) 
-            return EXCEPTION_CONTINUE_EXECUTION;
-      }
+   if (DebugPort)
+   {
+      /* Pass the exception to debugger. */
+      DPRINT("Passing exception to debugger\n");
+      return EXCEPTION_CONTINUE_SEARCH;
    }
 
-   if (RecursionTrap-- > 0 && (GetErrorMode() & SEM_NOGPFAULTERRORBOX) == 0)
+   if ((GetErrorMode() & SEM_NOGPFAULTERRORBOX) == 0)
    {
 #ifdef _X86_
       PULONG Frame;

reactos/lib/kernel32/include
kernel32.h 1.7 -> 1.8
diff -u -r1.7 -r1.8
--- kernel32.h	9 Dec 2004 17:28:10 -0000	1.7
+++ kernel32.h	13 Dec 2004 13:32:23 -0000	1.8
@@ -43,6 +43,8 @@
 
 extern UNICODE_STRING DllDirectory;
 
+extern LPTOP_LEVEL_EXCEPTION_FILTER GlobalTopLevelExceptionFilter;
+
 /* FUNCTION PROTOTYPES *******************************************************/
 
 BOOL STDCALL IsConsoleHandle(HANDLE Handle);

reactos/lib/kernel32/process
create.c 1.89 -> 1.90
diff -u -r1.89 -r1.90
--- create.c	21 Nov 2004 21:09:42 -0000	1.89
+++ create.c	13 Dec 2004 13:32:24 -0000	1.90
@@ -1,4 +1,4 @@
-/* $Id: create.c,v 1.89 2004/11/21 21:09:42 weiden Exp $
+/* $Id: create.c,v 1.90 2004/12/13 13:32:24 navaraf Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS system libraries
@@ -12,6 +12,7 @@
 /* INCLUDES ****************************************************************/
 
 #include <k32.h>
+#include <pseh/framebased.h>
 
 #define NDEBUG
 #include "../include/debug.h"
@@ -291,20 +292,30 @@
 {
    EXCEPTION_POINTERS ExceptionInfo;
    EXCEPTION_DISPOSITION ExceptionDisposition;
+
    ExceptionInfo.ExceptionRecord = ExceptionRecord;
    ExceptionInfo.ContextRecord = ContextRecord;
-   ExceptionDisposition = UnhandledExceptionFilter(&ExceptionInfo);
-   if (ExceptionDisposition == EXCEPTION_EXECUTE_HANDLER)
+
+   if (GlobalTopLevelExceptionFilter != NULL)
    {
-      /* FIXME */
-#if 0
-      if (_BaseRunningInServerProcess)
-         ExitThread(ExceptionRecord->ExceptionCode);
-      else
-#endif
-         ExitProcess(ExceptionRecord->ExceptionCode);
+      _SEH_TRY
+      {
+         ExceptionDisposition = GlobalTopLevelExceptionFilter(&ExceptionInfo);
+      }
+      _SEH_HANDLE
+      {
+         ExceptionDisposition = UnhandledExceptionFilter(&ExceptionInfo);
+      }
+      _SEH_END;
+   }
+   else 
+   {
+      ExceptionDisposition = EXCEPTION_EXECUTE_HANDLER;
    }
 
+   if (ExceptionDisposition == EXCEPTION_EXECUTE_HANDLER)
+      ExitProcess(ExceptionRecord->ExceptionCode);
+
    /* translate EXCEPTION_XXX defines into EXCEPTION_DISPOSITION enum values */
    if (ExceptionDisposition == EXCEPTION_CONTINUE_EXECUTION)
      return ExceptionContinueExecution;
@@ -327,6 +338,8 @@
    {
       uExitCode = (lpStartAddress)((PVOID)lpParameter);
    } __except1
+
+   ExitProcess(uExitCode);
 }
 
 

reactos/lib/kernel32/thread
thread.c 1.58 -> 1.59
diff -u -r1.58 -r1.59
--- thread.c	9 Dec 2004 19:11:07 -0000	1.58
+++ thread.c	13 Dec 2004 13:32:24 -0000	1.59
@@ -1,4 +1,4 @@
-/* $Id: thread.c,v 1.58 2004/12/09 19:11:07 weiden Exp $
+/* $Id: thread.c,v 1.59 2004/12/13 13:32:24 navaraf Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS system libraries
@@ -14,6 +14,7 @@
 /* INCLUDES ******************************************************************/
 
 #include <k32.h>
+#include <pseh/framebased.h>
 
 #define NDEBUG
 #include "../include/debug.h"
@@ -28,10 +29,39 @@
 		CONTEXT *ContextRecord,
 		void * DispatcherContext)
 {
-  ExitThread(0);
+   EXCEPTION_POINTERS ExceptionInfo;
+   EXCEPTION_DISPOSITION ExceptionDisposition;
 
-  /* We should not get to here */
-  return(ExceptionContinueSearch);
+   ExceptionInfo.ExceptionRecord = ExceptionRecord;
+   ExceptionInfo.ContextRecord = ContextRecord;
+
+   if (GlobalTopLevelExceptionFilter != NULL)
+   {
+      _SEH_TRY
+      {
+         ExceptionDisposition = GlobalTopLevelExceptionFilter(&ExceptionInfo);
+      }
+      _SEH_HANDLE
+      {
+         ExceptionDisposition = UnhandledExceptionFilter(&ExceptionInfo);
+      }
+      _SEH_END;
+   }
+   else 
+   {
+      ExceptionDisposition = EXCEPTION_EXECUTE_HANDLER;
+   }
+
+   if (ExceptionDisposition == EXCEPTION_EXECUTE_HANDLER)
+      ExitThread(ExceptionRecord->ExceptionCode);
+
+   /* translate EXCEPTION_XXX defines into EXCEPTION_DISPOSITION enum values */
+   if (ExceptionDisposition == EXCEPTION_CONTINUE_EXECUTION)
+     return ExceptionContinueExecution;
+   else if (ExceptionDisposition == EXCEPTION_CONTINUE_SEARCH)
+     return ExceptionContinueSearch;
+
+   return -1; /* unknown return from UnhandledExceptionFilter */
 }
 
 
@@ -50,8 +80,6 @@
     uExitCode = (lpStartAddress)(lpParameter);
   }
   __except1
-  {
-  }
 
   ExitThread(uExitCode);
 }
CVSspam 0.2.8