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.

96 lines
2.0 KiB

  1. /*++
  2. Copyright (C) 1996-2001 Microsoft Corporation
  3. Module Name:
  4. WBEMERROR.H
  5. Abstract:
  6. Implements string table based, error msgs for all of wbem.
  7. History:
  8. a-khint 5-mar-98 Created.
  9. --*/
  10. #include "wbemcli.h"
  11. typedef LPVOID * PPVOID;
  12. extern long g_cObj;
  13. //***************************************************************************
  14. //
  15. // CLASS NAME:
  16. //
  17. // CWbemError
  18. //
  19. // DESCRIPTION:
  20. //
  21. // Provides error and facility code info.
  22. //
  23. //***************************************************************************
  24. class CWbemError : IWbemStatusCodeText
  25. {
  26. protected:
  27. long m_cRef;
  28. public:
  29. CWbemError(void)
  30. {
  31. InterlockedIncrement(&g_cObj);
  32. m_cRef=1L;
  33. return;
  34. };
  35. ~CWbemError(void)
  36. {
  37. InterlockedDecrement(&g_cObj);
  38. return;
  39. }
  40. //IUnknown members
  41. STDMETHODIMP QueryInterface(REFIID riid, PPVOID ppv)
  42. {
  43. *ppv=NULL;
  44. if (IID_IUnknown==riid || IID_IWbemStatusCodeText==riid)
  45. *ppv=this;
  46. if (NULL!=*ppv)
  47. {
  48. AddRef();
  49. return NOERROR;
  50. }
  51. return E_NOINTERFACE;
  52. };
  53. STDMETHODIMP_(ULONG) AddRef(void)
  54. {
  55. return ++m_cRef;
  56. };
  57. STDMETHODIMP_(ULONG) Release(void)
  58. {
  59. long lRef = InterlockedDecrement(&m_cRef);
  60. if (0L == lRef)
  61. delete this;
  62. return lRef;
  63. };
  64. HRESULT STDMETHODCALLTYPE GetErrorCodeText(
  65. HRESULT hRes,
  66. LCID LocaleId,
  67. long lFlags,
  68. BSTR * MessageText);
  69. HRESULT STDMETHODCALLTYPE GetFacilityCodeText(
  70. HRESULT hRes,
  71. LCID LocaleId,
  72. long lFlags,
  73. BSTR * MessageText);
  74. void InitEmpty(){};
  75. };