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.

101 lines
2.2 KiB

  1. //***************************************************************************
  2. //
  3. // Copyright � Microsoft Corporation. All rights reserved.
  4. //
  5. // ProvExce.h
  6. //
  7. // Purpose: Exception handling classes
  8. //
  9. //***************************************************************************
  10. #if _MSC_VER > 1000
  11. #pragma once
  12. #endif
  13. #ifndef _PROVIDER_EXCEPT_H
  14. #define _PROVIDER_EXCEPT_H
  15. /**************************************************************
  16. *
  17. **************************************************************/
  18. #include <eh.h>
  19. /**************************************************************
  20. *
  21. **************************************************************/
  22. class CHeap_Exception
  23. {
  24. public:
  25. enum HEAP_ERROR
  26. {
  27. E_ALLOCATION_ERROR = 0 ,
  28. E_FREE_ERROR
  29. };
  30. private:
  31. HEAP_ERROR m_Error;
  32. public:
  33. CHeap_Exception ( HEAP_ERROR e ) : m_Error ( e ) {}
  34. ~CHeap_Exception () {}
  35. HEAP_ERROR GetError() { return m_Error ; }
  36. } ;
  37. /**************************************************************
  38. *
  39. **************************************************************/
  40. class CStructured_Exception
  41. {
  42. private:
  43. UINT m_nSE ;
  44. EXCEPTION_POINTERS *m_pExp ;
  45. public:
  46. CStructured_Exception () {}
  47. CStructured_Exception ( UINT n , EXCEPTION_POINTERS *pExp ) : m_nSE ( n ) , m_pExp ( pExp ) {}
  48. ~CStructured_Exception () {}
  49. UINT GetSENumber () { return m_nSE ; }
  50. EXCEPTION_POINTERS *GetExtendedInfo() { return m_pExp ; }
  51. } ;
  52. /**************************************************************
  53. *
  54. **************************************************************/
  55. class CSetStructuredExceptionHandler
  56. {
  57. private:
  58. _se_translator_function m_PrevFunc ;
  59. public:
  60. static void _cdecl trans_func ( UINT u , EXCEPTION_POINTERS *pExp )
  61. {
  62. throw CStructured_Exception ( u , pExp ) ;
  63. }
  64. CSetStructuredExceptionHandler () : m_PrevFunc ( NULL )
  65. {
  66. m_PrevFunc = _set_se_translator ( trans_func ) ;
  67. }
  68. ~CSetStructuredExceptionHandler ()
  69. {
  70. _set_se_translator ( m_PrevFunc ) ;
  71. }
  72. } ;
  73. /**************************************************************
  74. *
  75. **************************************************************/
  76. #endif //_PROVIDER_EXCEPT_H