Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
2.2 KiB

  1. //
  2. // Created by TiborL 06/01/97
  3. //
  4. #ifdef WIN32_LEAN_AND_MEAN
  5. #undef WIN32_LEAN_AND_MEAN
  6. #endif
  7. #pragma warning(disable:4102 4700)
  8. extern "C" {
  9. #include <windows.h>
  10. };
  11. #include <mtdll.h>
  12. #include <ehassert.h>
  13. #include <ehdata.h>
  14. #include <trnsctrl.h>
  15. #include <eh.h>
  16. #include <ehhooks.h>
  17. #pragma hdrstop
  18. extern "C" void _UnwindNestedFrames(
  19. EHRegistrationNode *pFrame, // Unwind up to (but not including) this frame
  20. EHExceptionRecord *pExcept, // The exception that initiated this unwind
  21. CONTEXT *pContext // Context info for current exception
  22. ) {
  23. void *pReturnPoint; // The address we want to return from RtlUnwind
  24. CONTEXT LocalContext; // Create context for this routine to return from RtlUnwind
  25. CONTEXT OriginalContext; // Restore pContext from this
  26. CONTEXT ScratchContext; // Context record to pass to RtlUnwind2 to be used as scratch
  27. //
  28. // set up the return label
  29. //
  30. BASE:
  31. _MoveContext(&OriginalContext,pContext);
  32. RtlCaptureContext(&LocalContext);
  33. _MoveContext(&ScratchContext,&LocalContext);
  34. _SaveUnwindContext(&LocalContext);
  35. RtlUnwind2((PVOID)*pFrame, pReturnPoint, (PEXCEPTION_RECORD)pExcept, NULL, &ScratchContext);
  36. LABEL:
  37. _MoveContext(pContext,&OriginalContext);
  38. _SaveUnwindContext(0);
  39. PER_FLAGS(pExcept) &= ~EXCEPTION_UNWINDING;
  40. }
  41. /*
  42. ;;++
  43. ;;
  44. ;;extern "C"
  45. ;;PVOID
  46. ;;__Cxx_ExecuteHandler (
  47. ;; ULONGLONG MemoryStack,
  48. ;; ULONGLONG BackingStore,
  49. ;; ULONGLONG Handler,
  50. ;; ULONGLONG GlobalPointer
  51. ;; );
  52. ;;
  53. ;;Routine Description:
  54. ;;
  55. ;; This function scans the scope tables associated with the specified
  56. ;; procedure and calls exception and termination handlers as necessary.
  57. ;;
  58. ;;Arguments:
  59. ;;
  60. ;; MemoryStack (rcx) - memory stack pointer of establisher frame
  61. ;;
  62. ;; BackingStore (rdx) - backing store pointer of establisher frame
  63. ;;
  64. ;; Handler (r8) - Entry point of handler
  65. ;;
  66. ;; GlobalPointer (r9) - GP of termination handler
  67. ;;
  68. ;;Return Value:
  69. ;;
  70. ;; Returns the continuation point
  71. ;;
  72. ;;--
  73. PUBLIC __Cxx_ExecuteHandler
  74. _TEXT SEGMENT
  75. __Cxx_ExecuteHandler PROC NEAR
  76. mov gp, r9
  77. jmp r8
  78. __Cxx_ExecuteHandler ENDP
  79. _TEXT ENDS
  80. */