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.

98 lines
2.1 KiB

  1. //***************************************************************************
  2. //
  3. // NTEVTTHRD.H
  4. //
  5. // Module: WBEM NT EVENT PROVIDER
  6. //
  7. // Copyright (c) 1996-2001 Microsoft Corporation, All Rights Reserved
  8. //
  9. //***************************************************************************
  10. #ifndef _NT_EVT_PROV_NTEVTTHRD_H
  11. #define _NT_EVT_PROV_NTEVTTHRD_H
  12. class CNTEventProvider;
  13. class CEventLogMonitor;
  14. class CEventProviderManager;
  15. class CMonitoredEventLogFile;
  16. class CControlObjectMap : public CMap< UINT_PTR, UINT_PTR, CNTEventProvider*, CNTEventProvider* >
  17. {
  18. private:
  19. UINT HashKey(UINT_PTR key) { return key; }
  20. public:
  21. CCriticalSection m_Lock;
  22. BOOL Lock() { return m_Lock.Lock(); }
  23. BOOL Unlock() { return m_Lock.Unlock(); }
  24. };
  25. class CEventLogMonitor : public ProvThreadObject
  26. {
  27. private:
  28. void Initialise();
  29. void Uninitialise();
  30. void TimedOut();
  31. CEventProviderManager* m_pParent;
  32. BOOL m_bMonitoring;
  33. static const DWORD m_PollTimeOut;
  34. CMonitoredEventLogFile** m_Logs;
  35. ULONG m_LogCount;
  36. CArray<CStringW*, CStringW*> m_LogNames;
  37. LONG m_Ref;
  38. public:
  39. CEventLogMonitor(CEventProviderManager* parentptr, CArray<CStringW*, CStringW*>& logs);
  40. void Poll();
  41. void StartMonitoring();
  42. BOOL IsMonitoring() { return m_bMonitoring; }
  43. LONG AddRef();
  44. LONG Release();
  45. ~CEventLogMonitor();
  46. };
  47. class CEventProviderManager
  48. {
  49. private:
  50. CControlObjectMap m_ControlObjects;
  51. CEventLogMonitor** m_monitorArray;
  52. CCriticalSection m_MonitorLock;
  53. CStringW m_BootTimeString;
  54. BOOL m_IsFirstSinceLogon;
  55. BOOL InitialiseMonitorArray();
  56. void DestroyMonitorArray();
  57. BSTR GetLastBootTime();
  58. public:
  59. CEventProviderManager();
  60. void SendEvent(IWbemClassObject* evtObj);
  61. BOOL Register(CNTEventProvider* prov);
  62. void UnRegister(CNTEventProvider* prov);
  63. BOOL IsFirstSinceLogon() { return m_IsFirstSinceLogon; }
  64. void SetFirstSinceLogon(IWbemServices *ns, IWbemContext *pCtx);
  65. IWbemServices* GetNamespacePtr();
  66. ~CEventProviderManager();
  67. };
  68. #endif //_NT_EVT_PROV_NTEVTTHRD_H