Commit in reactos/lib/pseh on KJKHyperion-RtlUnwind
framebased.c+44-241.4 -> 1.4.2.1
i386/framebased.asm+7-41.4 -> 1.4.6.1
+51-28
2 modified files
Fixed some slightl logical flaws in PSEH
Experimental changes to _SEHUnwind: make less assumptions about the correctness of RtlUnwind

reactos/lib/pseh
framebased.c 1.4 -> 1.4.2.1
diff -u -r1.4 -r1.4.2.1
--- framebased.c	21 Jun 2004 20:55:16 -0000	1.4
+++ framebased.c	26 Jun 2004 16:36:36 -0000	1.4.2.1
@@ -38,10 +38,14 @@
 extern void __stdcall RtlUnwind(void *, void *, void *, void *);
 void const * _SEHRtlUnwind = RtlUnwind;
 
+extern void __cdecl DbgPrint(const char *, ...);
+
 __declspec(noreturn) void __cdecl _SEHCallHandler(_SEHPortableFrame_t * frame)
 {
  frame->SPF_Handling = 1;
+ DbgPrint("Before _SEHUnwind\n");
  _SEHUnwind(frame);
+ DbgPrint("After _SEHUnwind\n");
  frame->SPF_Handlers->SH_Handler(frame);
 }
 
@@ -62,52 +66,68 @@
  /* Unwinding */
  if(ExceptionRecord->ExceptionFlags & (4 | 2))
  {
+  DbgPrint("_SEHFrameHandler unwinding\n");
+
   if(frame->SPF_Handlers->SH_Finally && !frame->SPF_Handling)
    frame->SPF_Handlers->SH_Finally(frame);
  }
  /* Handling */
  else
  {
+  int ret;
+
+  DbgPrint("_SEHFrameHandler handling\n");
+
   if(ExceptionRecord->ExceptionCode)
    frame->SPF_Code = ExceptionRecord->ExceptionCode;
   else
    frame->SPF_Code = 0xC0000001; 
 
-  if(frame->SPF_Handlers->SH_Filter)
+  switch((UINT_PTR)frame->SPF_Handlers->SH_Filter)
   {
-   int ret;
-
-   switch((UINT_PTR)frame->SPF_Handlers->SH_Filter)
+   case _SEH_EXECUTE_HANDLER + 1:
+   case _SEH_CONTINUE_SEARCH + 1:
+   case _SEH_CONTINUE_EXECUTION + 1:
    {
-    case _SEH_EXECUTE_HANDLER + 1:
-    case _SEH_CONTINUE_SEARCH + 1:
-    case _SEH_CONTINUE_EXECUTION + 1:
-    {
-     ret = (int)((UINT_PTR)frame->SPF_Handlers->SH_Filter) - 1;
-     break;
-    }
+    ret = (int)((UINT_PTR)frame->SPF_Handlers->SH_Filter) - 1;
+    break;
+   }
 
-    default:
+   default:
+   {
+    if(frame->SPF_Handlers->SH_Filter)
     {
      EXCEPTION_POINTERS ep;
-
+ 
      ep.ExceptionRecord = ExceptionRecord;
      ep.ContextRecord = ContextRecord;
-
+ 
      ret = frame->SPF_Handlers->SH_Filter(&ep, frame);
-     break;
     }
+    else
+     ret = _SEH_CONTINUE_SEARCH;
+
+    break;
    }
+  }
 
-   /* _SEH_CONTINUE_EXECUTION */
-   if(ret < 0)
-    return ExceptionContinueExecution;
-   /* _SEH_EXECUTE_HANDLER */
-   else if(ret > 0)
-    _SEHCallHandler(frame);
-   /* _SEH_CONTINUE_SEARCH */
-   else
-    /* fall through */;
+  /* _SEH_CONTINUE_EXECUTION */
+  if(ret < 0)
+  {
+   DbgPrint("_SEHFrameHandler: ExceptionContinueExecution\n");
+   return ExceptionContinueExecution;
+  }
+  /* _SEH_EXECUTE_HANDLER */
+  else if(ret > 0)
+  {
+   DbgPrint("_SEHFrameHandler: call handler\n");
+   _SEHCallHandler(frame);
+  }
+  /* _SEH_CONTINUE_SEARCH */
+  else
+  {
+   DbgPrint("_SEHFrameHandler: ExceptionContinueSearch\n");
+   /* fall through */;
   }
  }
 

reactos/lib/pseh/i386
framebased.asm 1.4 -> 1.4.6.1
diff -u -r1.4 -r1.4.6.1
--- framebased.asm	3 Jun 2004 22:19:10 -0000	1.4
+++ framebased.asm	26 Jun 2004 16:36:36 -0000	1.4.6.1
@@ -54,12 +54,15 @@
  push ebx
 
  xor eax, eax
- push eax
- push eax
- push eax
- push ecx
+ push esp    ; ReturnValue
+ push eax    ; ExceptionRecord
+ push .leave ; TargetIp
+ push ecx    ; TargetFrame
  call [__SEHRtlUnwind]
 
+.leave
+ mov esp, eax
+
  pop ebx
  pop edi
  pop esi
CVSspam 0.2.8