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.

146 lines
3.8 KiB

  1. /*++
  2. Copyright (C) 1996-2001 Microsoft Corporation
  3. Module Name:
  4. REGEREQ.H
  5. Abstract:
  6. History:
  7. --*/
  8. #ifndef __WBEM_REGEVENT_REQUEST__H_
  9. #define __WBEM_REGEVENT_REQUEST__H_
  10. #include <windows.h>
  11. #include <stdio.h>
  12. #include <wbemidl.h>
  13. #include "CWbemTime.h"
  14. #include <tss.h>
  15. #include <ql.h>
  16. #include <wbemcomn.h>
  17. #include "regedefs.h"
  18. class CRegEventProvider;
  19. class CRegistryEventRequest;
  20. class CRegistryEventRequest
  21. {
  22. protected:
  23. long m_lRef;
  24. BOOL m_bOK;
  25. CRegEventProvider* m_pProvider;
  26. DWORD m_dwMsWait;
  27. CFlexArray m_adwIds;
  28. HKEY m_hHive;
  29. WString m_wsHive;
  30. WString m_wsKey;
  31. HKEY m_hKey;
  32. HANDLE m_hEvent;
  33. DWORD m_dwLastCRC;
  34. long m_lActiveCount;
  35. BOOL m_bNew;
  36. HANDLE m_hWaitRegistration;
  37. CCritSec m_cs;
  38. public:
  39. CRegistryEventRequest(CRegEventProvider* pProvider,
  40. WBEM_QL1_TOLERANCE& Tolerance, DWORD dwId,
  41. HKEY hHive, LPWSTR wszHive, LPWSTR wszKey);
  42. virtual ~CRegistryEventRequest();
  43. BOOL IsOK() {return m_bOK;}
  44. BOOL IsActive() {return m_lActiveCount >= 0;}
  45. DWORD GetPrimaryId();
  46. BOOL DoesContainId(DWORD dwId);
  47. BOOL IsNew() {return m_bNew;}
  48. CRegEventProvider* GetProvider() { return m_pProvider; }
  49. void AddRef();
  50. void Release();
  51. DWORD GetMsWait() {return m_dwMsWait;}
  52. HRESULT Activate();
  53. HRESULT Reactivate(DWORD dwId, DWORD dwMsWait);
  54. HRESULT Deactivate(DWORD dwId);
  55. HRESULT ForceDeactivate(void);
  56. virtual HRESULT Execute(BOOL bOnTimer);
  57. HANDLE GetOnChangeHandle();
  58. BOOL ResetOnChangeHandle();
  59. virtual void CacheValue(){}
  60. virtual int GetType() = 0;
  61. virtual HRESULT CreateNewEvent(IWbemClassObject** ppEvent) = 0;
  62. virtual HRESULT ComputeCRC(DWORD& dwCRC) = 0;
  63. virtual BOOL IsSameAs(CRegistryEventRequest* pOther);
  64. void ProcessEvent();
  65. protected:
  66. HRESULT SetCommonProperties(IWbemClassObject* pEvent);
  67. };
  68. class CRegistryValueEventRequest : public CRegistryEventRequest
  69. {
  70. protected:
  71. WString m_wsValue;
  72. public:
  73. CRegistryValueEventRequest(CRegEventProvider* pProvider,
  74. WBEM_QL1_TOLERANCE& Tolerance, DWORD dwId, HKEY hHive,
  75. LPWSTR wszHive, LPWSTR wszKey, LPWSTR wszValue)
  76. : CRegistryEventRequest(pProvider, Tolerance, dwId, hHive,
  77. wszHive, wszKey), m_wsValue(wszValue)
  78. {}
  79. int GetType() {return e_RegValueChange;}
  80. HRESULT CreateNewEvent(IWbemClassObject** ppEvent);
  81. HRESULT ComputeCRC(DWORD& dwCRC);
  82. virtual HRESULT Execute(BOOL bOnTimer);
  83. virtual void CacheValue();
  84. BOOL IsSameAs(CRegistryEventRequest* pOther);
  85. };
  86. class CRegistryKeyEventRequest : public CRegistryEventRequest
  87. {
  88. public:
  89. CRegistryKeyEventRequest(CRegEventProvider* pProvider,
  90. WBEM_QL1_TOLERANCE& Tolerance, DWORD dwId, HKEY hHive,
  91. LPWSTR wszHive, LPWSTR wszKey)
  92. : CRegistryEventRequest(pProvider, Tolerance, dwId, hHive,
  93. wszHive, wszKey)
  94. {}
  95. int GetType() {return e_RegKeyChange;}
  96. HRESULT CreateNewEvent(IWbemClassObject** ppEvent);
  97. HRESULT ComputeCRC(DWORD& dwCRC);
  98. };
  99. class CRegistryTreeEventRequest : public CRegistryEventRequest
  100. {
  101. public:
  102. CRegistryTreeEventRequest(CRegEventProvider* pProvider,
  103. WBEM_QL1_TOLERANCE& Tolerance, DWORD dwId, HKEY hHive,
  104. LPWSTR wszHive, LPWSTR wszKey)
  105. : CRegistryEventRequest(pProvider, Tolerance, dwId, hHive,
  106. wszHive, wszKey)
  107. {}
  108. int GetType() {return e_RegTreeChange;}
  109. HRESULT CreateNewEvent(IWbemClassObject** ppEvent);
  110. HRESULT ComputeCRC(DWORD& dwCRC);
  111. };
  112. #endif