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.

98 lines
3.3 KiB

  1. // scuOsExc.h -- Operating System EXCeption class declaration
  2. // (c) Copyright Schlumberger Technology Corp., unpublished work, created
  3. // 1999. This computer program includes Confidential, Proprietary
  4. // Information and is a Trade Secret of Schlumberger Technology Corp. All
  5. // use, disclosure, and/or reproduction is prohibited unless authorized
  6. // in writing. All Rights Reserved.
  7. #if !defined(SCU_OSEXC_H)
  8. #define SCU_OSEXC_H
  9. #include <windows.h>
  10. #include <winerror.h>
  11. #include "scuExc.h"
  12. namespace scu
  13. {
  14. // Instantiate ExcTemplate so that OsException can be derived from it
  15. // and properly exported in a DLL. See MSDN Knowledge Base Article
  16. // Q168958 for more information.
  17. #if defined(SCU_IN_DLL)
  18. #pragma warning(push)
  19. // Non-standard extension used: 'extern' before template explicit
  20. // instantiation
  21. #pragma warning(disable : 4231)
  22. SCU_EXPIMP_TEMPLATE template class SCU_DLLAPI
  23. ExcTemplate<Exception::fcOS, DWORD>;
  24. #pragma warning(pop)
  25. #endif
  26. // A general exception class to represent OS error codes as
  27. // exceptions. For example, on the Windows platform a DWORD is
  28. // returned by a Windows routine (usually through GetLastError). The
  29. // value could be translated into an OsException with value as the
  30. // CauseCode.
  31. //
  32. // On Windows, the error return codes are found in WINERROR.H
  33. // and other header files as described by the Windows function.
  34. // OsException will take an HRESULT, mapping it to a DWORD (which is
  35. // what GetLastError returns).
  36. class SCU_DLLAPI OsException
  37. : public ExcTemplate<Exception::fcOS, DWORD>
  38. {
  39. public:
  40. // Types
  41. // C'tors/D'tors
  42. explicit
  43. OsException(CauseCode cc) throw();
  44. explicit
  45. OsException(HRESULT hr) throw();
  46. OsException(OsException const &rhs);
  47. virtual
  48. ~OsException() throw();
  49. // Operators
  50. virtual scu::Exception *
  51. Clone() const;
  52. virtual void
  53. Raise() const;
  54. // Operations
  55. // Access
  56. virtual char const *
  57. Description() const;
  58. // Predicates
  59. protected:
  60. // Types
  61. // C'tors/D'tors
  62. // Operators
  63. // Operations
  64. // Access
  65. // Predicates
  66. // Variables
  67. private:
  68. // Types
  69. // C'tors/D'tors
  70. // Operators
  71. // Operations
  72. // Access
  73. // Predicates
  74. // Variables
  75. LPTSTR mutable m_lpDescription; // cached description
  76. };
  77. } // namespace
  78. #endif // SCU_OSEXC_H