Source code of Windows XP (NT5)
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.

90 lines
1.6 KiB

  1. #ifndef _MWMIError_H
  2. #define _MWMIError_H
  3. //
  4. // Copyright (c) Microsoft. All Rights Reserved
  5. //
  6. // THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF Microsoft.
  7. // The copyright notice above does not evidence any
  8. // actual or intended publication of such source code.
  9. //
  10. // OneLiner : MWmi interface.
  11. // DevUnit : wlbstest
  12. // Author : Murtaza Hakim
  13. //
  14. // Description:
  15. // -----------
  16. // Singleton
  17. //
  18. // include files
  19. //
  20. #include "mwmidefs.h"
  21. #include <wbemidl.h>
  22. #include <comdef.h>
  23. class MWmiError
  24. {
  25. public:
  26. enum MWmiError_Error
  27. {
  28. MWmiError_SUCCESS = 0,
  29. COM_FAILURE = 1,
  30. };
  31. //
  32. // Description:
  33. // -----------
  34. // gets instance of MWmiError singleton class.
  35. //
  36. // Parameters:
  37. // ----------
  38. // none
  39. //
  40. // Returns:
  41. // -------
  42. // the MWmiError singleton object.
  43. static MWmiError*
  44. Instance();
  45. //
  46. // Description:
  47. // -----------
  48. // gets text corresponding to the HRESULT value.
  49. //
  50. // Parameters:
  51. // ----------
  52. // hr IN : error code for which text representation requested.
  53. // errText OUT : the text corresponding to error code.
  54. //
  55. // Returns:
  56. // -------
  57. // MWmiError_SUCCESS else error.
  58. MWmiError_Error
  59. GetErrorCodeText( const HRESULT hr,
  60. _bstr_t& errText );
  61. protected:
  62. MWmiError();
  63. private:
  64. static MWmiError* _instance;
  65. IWbemStatusCodeTextPtr pStatus;
  66. };
  67. //
  68. // Ensure type safety
  69. typedef class MWmiError MWmiError;
  70. // helper function
  71. //
  72. MWmiError::MWmiError_Error
  73. GetErrorCodeText( const HRESULT hr, _bstr_t& errText );
  74. #endif