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.

132 lines
4.0 KiB

  1. /*++
  2. Copyright (C) 1998-1999 Microsoft Corporation
  3. Module Name:
  4. smlogs.h
  5. Abstract:
  6. Base class representing the Performance Logs and Alerts
  7. service.
  8. --*/
  9. #ifndef _CLASS_SMLOGSERVICE_
  10. #define _CLASS_SMLOGSERVICE_
  11. #include "smnode.h"
  12. #include "smlogqry.h" // for query objects in the service
  13. #include <pdhp.h>
  14. class CSmRootNode;
  15. //
  16. // Need change the macro when .NET ships
  17. //
  18. #define OS_DOT_NET(buildNumber) ((buildNumber) >= 3500)
  19. typedef enum {
  20. OS_NOT_SUPPORTED = 0,
  21. OS_WIN2K = 1,
  22. OS_WINXP = 2,
  23. OS_WINNET = 3
  24. } OS_TYPE;
  25. class CSmLogService : public CSmNode
  26. {
  27. // constructor/destructor
  28. public:
  29. CSmLogService();
  30. virtual ~CSmLogService();
  31. // public methods
  32. public:
  33. virtual DWORD Open ( const CString& rstrMachineName );
  34. virtual DWORD Close ( void );
  35. DWORD Synchronize( void );
  36. BOOL IsRunning( void );
  37. BOOL IsOpen( void ){return m_bIsOpen; };
  38. INT GetQueryCount( void );
  39. const CString& GetDefaultLogFileFolder( void );
  40. DWORD CreateDefaultLogQueries( void );
  41. OS_TYPE TargetOs ( void );
  42. BOOL CanAccessWbemRemote();
  43. virtual DWORD SyncWithRegistry( PSLQUERY* ppActiveQuery = NULL );
  44. virtual PSLQUERY CreateQuery ( const CString& rstrName ) = 0;
  45. virtual DWORD DeleteQuery ( PSLQUERY plQuery );
  46. virtual DWORD DeleteQuery ( const CString& rstrName ); // Unused method
  47. virtual CSmLogService* CastToLogService( void ) { return this; };
  48. BOOL IsAutoStart ( VOID );
  49. void SetRootNode ( CSmRootNode* pRootNode );
  50. void SetRefreshOnShow ( BOOL bRefresh ) { m_bRefreshOnShow = bRefresh; };
  51. BOOL GetRefreshOnShow ( void ) { return m_bRefreshOnShow; };
  52. DWORD CheckForActiveQueries ( PSLQUERY* ppActiveQuery = NULL );
  53. // public member variables
  54. public:
  55. // list of queries
  56. CTypedPtrList<CPtrList, PSLQUERY> m_QueryList;
  57. HRESULT m_hWbemAccessStatus;
  58. protected:
  59. void SetBaseName( const CString& ); // Exception thrown on error
  60. PSLQUERY CreateTypedQuery ( const CString& rstrName, DWORD dwLogType );
  61. virtual DWORD LoadQueries( void ) = 0;
  62. DWORD LoadQueries( DWORD dwLogType );
  63. HKEY GetMachineRegistryKey ( void )
  64. { ASSERT ( m_hKeyMachine ); return m_hKeyMachine; };
  65. void SetOpen ( BOOL bOpen ) { m_bIsOpen = bOpen; };
  66. private:
  67. DWORD GetState( void );
  68. DWORD Install( const CString& rstrMachineName );
  69. DWORD UnloadQueries ( PSLQUERY* ppActiveQuery = NULL );
  70. DWORD LoadDefaultLogFileFolder( void );
  71. DWORD UnloadSingleQuery ( PSLQUERY pQuery );
  72. DWORD LoadSingleQuery (
  73. PSLQUERY* ppQuery,
  74. DWORD dwLogType,
  75. const CString& rstrName,
  76. const CString& rstrLogKeyName,
  77. HKEY hKeyQuery,
  78. BOOL bNew );
  79. DWORD FindDuplicateQuery (
  80. const CString cstrName,
  81. BOOL& rbFound );
  82. CSmRootNode* GetRootNode ( void );
  83. CString m_strBaseName;
  84. HKEY m_hKeyMachine;
  85. HKEY m_hKeyLogService;
  86. BOOL m_bReadOnly;
  87. BOOL m_bIsOpen;
  88. BOOL m_bRefreshOnShow;
  89. CSmRootNode* m_pRootNode;
  90. HKEY m_hKeyLogServiceRoot;
  91. CString m_strDefaultLogFileFolder;
  92. PLA_VERSION m_OSVersion;
  93. };
  94. typedef CSmLogService SLSVC;
  95. typedef CSmLogService* PSLSVC;
  96. #endif //_CLASS_SMLOGSERVICE_