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.

120 lines
3.3 KiB

  1. // logrec.h: interface for the CLogRecord class.
  2. //
  3. // Copyright (c)1997-1999 Microsoft Corporation
  4. //
  5. //////////////////////////////////////////////////////////////////////
  6. #if !defined(AFX_LOGREC_H__BD7570F7_9F0E_4C6B_B525_E078691B6D0E__INCLUDED_)
  7. #define AFX_LOGREC_H__BD7570F7_9F0E_4C6B_B525_E078691B6D0E__INCLUDED_
  8. #if _MSC_VER >= 1000
  9. #pragma once
  10. #endif // _MSC_VER >= 1000
  11. #include "GenericClass.h"
  12. /*
  13. Class description
  14. Naming:
  15. CLogRecord stands for Logging Record.
  16. Base class:
  17. CGenericClass, because it is a class representing a WMI
  18. object - its WMI class name is Sce_ConfigurationLogRecord
  19. Purpose of class:
  20. (1) Implement Sce_ConfigurationLogRecord WMI class.
  21. Design:
  22. (1) Almost trivial other than implementing necessary method as a concrete class.
  23. (2) Since log record is to create a log files for human to read, we don't support
  24. creating WMI object of this class. We only support PutInstance (writing to the
  25. log file).
  26. Use:
  27. (1) This class allows us to log information into a log file. That use has been
  28. encapulated by CMethodResultRecorder::LogResult. If you have to do it without
  29. the help from CMethodResultRecorder, then read that function for details.
  30. */
  31. class CLogRecord : public CGenericClass
  32. {
  33. public:
  34. CLogRecord (
  35. ISceKeyChain *pKeyChain,
  36. IWbemServices *pNamespace,
  37. IWbemContext *pCtx = NULL
  38. );
  39. virtual ~CLogRecord ();
  40. virtual HRESULT PutInst (
  41. IWbemClassObject *pInst,
  42. IWbemObjectSink *pHandler,
  43. IWbemContext *pCtx
  44. );
  45. virtual HRESULT CreateObject (
  46. IWbemObjectSink *pHandler,
  47. ACTIONTYPE atAction
  48. )
  49. {
  50. return WBEM_E_NOT_SUPPORTED;
  51. }
  52. };
  53. /*
  54. Class description
  55. Naming:
  56. CErrorInfo error information.
  57. Base class:
  58. none.
  59. Purpose of class:
  60. (1) Wrapper for using WMI COM interface of IWbemStatusCodeText.
  61. Design:
  62. (1) Instead of requiring each caller to requesting their own IWbemStatusCodeText
  63. from WMI, we can create a global (single) instance to translate the HRESULT
  64. into text form. This is precisely why we design this class.
  65. Use:
  66. (1) This class allows us to log information into a log file. That use has been
  67. encapulated by CMethodResultRecorder::LogResult. If you have to do it without
  68. the help from CMethodResultRecorder, then read that function for details.
  69. */
  70. class CErrorInfo
  71. {
  72. public:
  73. CErrorInfo();
  74. HRESULT GetErrorText (
  75. HRESULT hr,
  76. BSTR* pbstrErrText
  77. );
  78. private:
  79. CComPtr<IWbemStatusCodeText> m_srpStatusCodeText;
  80. };
  81. #endif // !defined(AFX_LOGREC_H__BD7570F7_9F0E_4C6B_B525_E078691B6D0E__INCLUDED_)