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.

62 lines
1.6 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation
  3. Module Name:
  4. sxsexceptionhandling.cpp
  5. Abstract:
  6. Author:
  7. Jay Krell (a-JayK, JayKrell) October 2000
  8. Revision History:
  9. --*/
  10. #include "stdinc.h"
  11. #include <stdio.h>
  12. LONG
  13. SxspExceptionFilter(
  14. PEXCEPTION_POINTERS ExceptionPointers,
  15. PCSTR Function
  16. )
  17. {
  18. // add handling for unhandled status in RtlUnhandledExceptionFilter
  19. switch ( ExceptionPointers->ExceptionRecord->ExceptionCode )
  20. {
  21. case STATUS_NO_MEMORY:
  22. case STATUS_INSUFFICIENT_RESOURCES:
  23. return EXCEPTION_EXECUTE_HANDLER;
  24. default:
  25. break;
  26. }
  27. #if defined(FUSION_WIN)
  28. INT i = ::FusionpRtlUnhandledExceptionFilter(ExceptionPointers);
  29. if (i == EXCEPTION_CONTINUE_SEARCH)
  30. {
  31. i = EXCEPTION_EXECUTE_HANDLER;
  32. }
  33. return i;
  34. #else
  35. // ISSUE:2002-03-14:jonwis It always seemed to me like you should do snprintf and then
  36. // stomp in the null termination, rather than the other way around.
  37. char buf[64];
  38. buf[RTL_NUMBER_OF(buf) - 1] = 0;
  39. ::_snprintf(buf, RTL_NUMBER_OF(buf) - 1, "** Unhandled exception 0x%x\n", ExceptionPointers->ExceptionRecord->ExceptionCode);
  40. ::OutputDebugStringA(buf);
  41. #if DBG
  42. ::_snprintf(buf, RTL_NUMBER_OF(buf) - 1, "** .exr %p\n", ExceptionPointers->ExceptionRecord);
  43. ::OutputDebugStringA(buf);
  44. ::_snprintf(buf, RTL_NUMBER_OF(buf) - 1, "** .cxr %p\n", ExceptionPointers->ContextRecord);
  45. ::OutputDebugStringA(buf);
  46. ::DebugBreak();
  47. #endif
  48. return EXCEPTION_EXECUTE_HANDLER;
  49. #endif
  50. }