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.

110 lines
3.3 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 CSmLogService : public CSmNode
  15. {
  16. // constructor/destructor
  17. public:
  18. CSmLogService();
  19. virtual ~CSmLogService();
  20. // public methods
  21. public:
  22. virtual DWORD Open ( const CString& rstrMachineName );
  23. virtual DWORD Close ( void );
  24. DWORD Synchronize( void );
  25. BOOL IsRunning( void );
  26. BOOL IsOpen( void ){return m_bIsOpen; };
  27. INT GetQueryCount( void );
  28. const CString& GetDefaultLogFileFolder( void );
  29. DWORD CreateDefaultLogQueries( void );
  30. BOOL IsWindows2000Server ( void );
  31. BOOL CanAccessWbemRemote();
  32. virtual DWORD SyncWithRegistry();
  33. virtual PSLQUERY CreateQuery ( const CString& rstrName ) = 0;
  34. virtual DWORD DeleteQuery ( PSLQUERY plQuery );
  35. virtual DWORD DeleteQuery ( const CString& rstrName ); // Unused method
  36. virtual CSmLogService* CastToLogService( void ) { return this; };
  37. // public member variables
  38. public:
  39. // list of queries
  40. CTypedPtrList<CPtrList, PSLQUERY> m_QueryList;
  41. HRESULT m_hWbemAccessStatus;
  42. protected:
  43. void SetBaseName( const CString& ); // Exception thrown on error
  44. PSLQUERY CreateTypedQuery ( const CString& rstrName, DWORD dwLogType );
  45. virtual DWORD LoadQueries( void ) = 0;
  46. DWORD LoadQueries( DWORD dwLogType );
  47. HKEY GetMachineRegistryKey ( void )
  48. { ASSERT ( m_hKeyMachine ); return m_hKeyMachine; };
  49. void SetOpen ( BOOL bOpen ) { m_bIsOpen = bOpen; };
  50. private:
  51. enum ePrivateValue {
  52. eResetDelaySeconds = 60,
  53. eRestartDelayMilliseconds = 0
  54. };
  55. DWORD GetState( void );
  56. DWORD UpdateConfig();
  57. DWORD Install( const CString& rstrMachineName );
  58. DWORD UnloadQueries ( void );
  59. DWORD LoadDefaultLogFileFolder( void );
  60. DWORD UnloadSingleQuery ( PSLQUERY pQuery );
  61. DWORD LoadSingleQuery (
  62. PSLQUERY* ppQuery,
  63. DWORD dwLogType,
  64. const CString& rstrName,
  65. const CString& rstrLogKeyName,
  66. HKEY hKeyQuery,
  67. BOOL bNew );
  68. DWORD FindDuplicateQuery (
  69. const CString cstrName,
  70. BOOL& rbFound );
  71. CString m_strBaseName;
  72. HKEY m_hKeyMachine;
  73. HKEY m_hKeyLogService;
  74. BOOL m_bReadOnly;
  75. BOOL m_bIsOpen;
  76. HKEY m_hKeyLogServiceRoot;
  77. CString m_strDefaultLogFileFolder;
  78. PLA_VERSION m_OSVersion;
  79. };
  80. typedef CSmLogService SLSVC;
  81. typedef CSmLogService* PSLSVC;
  82. #endif //_CLASS_SMLOGSERVICE_