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.

69 lines
1.6 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997.
  5. //
  6. // File: N C E H . H
  7. //
  8. // Contents: Exception handling stuff.
  9. //
  10. // Notes:
  11. //
  12. // Author: shaunco 27 Mar 1997
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. // NC_TRY and NC_CATCH_ALL are #defined to allow easy replacement. This
  17. // is handy when evaulating SEH (__try, __except) vs. C++ EH (try, catch).
  18. //
  19. #define NC_TRY try
  20. #define NC_CATCH_NC_EXCEPTION catch (SE_Exception)
  21. #define NC_CATCH_BAD_ALLOC catch (std::bad_alloc)
  22. #define NC_CATCH_STD catch (std::exception)
  23. #define NC_CATCH_ALL catch (...)
  24. /*
  25. #define NC_FINALLY
  26. */
  27. class SE_Exception
  28. {
  29. private:
  30. unsigned int m_nSE;
  31. public:
  32. SE_Exception(unsigned int nSE) : m_nSE(nSE) {}
  33. SE_Exception() : m_nSE(0) {}
  34. ~SE_Exception() {}
  35. unsigned int getSeNumber() { return m_nSE; }
  36. };
  37. void __cdecl nc_trans_func( unsigned int uSECode, EXCEPTION_POINTERS* pExp );
  38. void EnableCPPExceptionHandling();
  39. void DisableCPPExceptionHandling();
  40. // For DEBUG builds, don't catch anything. This allows the debugger to locate
  41. // the exact source of the exception.
  42. /*
  43. #ifdef DBG
  44. */
  45. #define COM_PROTECT_TRY
  46. #define COM_PROTECT_CATCH ;
  47. /*
  48. #else // DBG
  49. #define COM_PROTECT_TRY __try
  50. #define COM_PROTECT_CATCH \
  51. __except (EXCEPTION_EXECUTE_HANDLER ) \
  52. { \
  53. hr = E_UNEXPECTED; \
  54. }
  55. #endif // DBG
  56. */