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.

104 lines
2.8 KiB

  1. /*++
  2. Copyright (C) 1996-2001 Microsoft Corporation
  3. Module Name:
  4. REGEPROV.H
  5. Abstract:
  6. History:
  7. --*/
  8. #ifndef __WBEM_REG_EVENT_PROVIDER__H_
  9. #define __WBEM_REG_EVENT_PROVIDER__H_
  10. #include <windows.h>
  11. #include <wbemidl.h>
  12. #include <stdio.h>
  13. #include "regereq.h"
  14. #include <ql.h>
  15. #include "cfdyn.h"
  16. class CRegEventProvider : public IWbemEventProvider,
  17. public IWbemEventProviderQuerySink,
  18. public IWbemEventProviderSecurity,
  19. public IWbemProviderInit
  20. {
  21. public:
  22. STDMETHOD(QueryInterface)(REFIID riid, void** ppv);
  23. STDMETHOD_(ULONG, AddRef)();
  24. STDMETHOD_(ULONG, Release)();
  25. STDMETHOD(Initialize)(LPWSTR wszUser, long lFlags, LPWSTR wszNamespace,
  26. LPWSTR wszLocale, IWbemServices* pNamespace, IWbemContext* pCtx,
  27. IWbemProviderInitSink* pSink);
  28. STDMETHOD(ProvideEvents)(IWbemObjectSink* pSink, long lFlags);
  29. STDMETHOD(NewQuery)(DWORD dwId, WBEM_WSTR wszLanguage, WBEM_WSTR wszQuery);
  30. STDMETHOD(CancelQuery)(DWORD dwId);
  31. STDMETHOD(AccessCheck)(WBEM_CWSTR wszLanguage, WBEM_CWSTR wszQuery,
  32. long lSidLength, const BYTE* aSid);
  33. static VOID CALLBACK EnqueueEvent(PVOID lpParameter,
  34. BOOLEAN TimerOrWaitFired);
  35. void EnqueueEvent(CRegistryEventRequest *pReq);
  36. protected:
  37. long m_lRef;
  38. IWbemClassObject* m_pKeyClass;
  39. IWbemClassObject* m_pValueClass;
  40. IWbemClassObject* m_pTreeClass;
  41. DWORD m_dwId;
  42. HANDLE m_hThread;
  43. IWbemObjectSink* m_pSink;
  44. CRefedPointerArray<CRegistryEventRequest> m_apRequests;
  45. CRITICAL_SECTION m_cs;
  46. HANDLE m_hQueueSemaphore;
  47. CRITICAL_SECTION m_csQueueLock;
  48. CRefedPointerQueue<CRegistryEventRequest> m_qEventQueue;
  49. //CPointerQueue<CRegistryEventRequest,CReferenceManager<CRegistryEventRequest> > m_qEventQueue;
  50. protected:
  51. static DWORD Worker(void* p);
  52. void Enter() {EnterCriticalSection(&m_cs);}
  53. void Leave() {LeaveCriticalSection(&m_cs);}
  54. HRESULT GetValuesForProp(QL_LEVEL_1_RPN_EXPRESSION* pExpr,
  55. CPropertyName& PropName, CWStringArray& awsVals);
  56. HKEY TranslateHiveName(LPCWSTR wszName);
  57. HRESULT AddRequest(CRegistryEventRequest* pNewReq);
  58. void KillWorker();
  59. void CreateWorker();
  60. friend class CRegistryEventRequest;
  61. friend class CRegistryKeyEventRequest;
  62. friend class CRegistryValueEventRequest;
  63. friend class CRegistryTreeEventRequest;
  64. public:
  65. CRegEventProvider();
  66. ~CRegEventProvider();
  67. void* GetInterface(REFIID riid);
  68. HRESULT SetTimerInstruction(CTimerInstruction* pInst);
  69. HRESULT RemoveTimerInstructions(CRegistryInstructionTest* pTest);
  70. HRESULT RaiseEvent(IWbemClassObject* pEvent);
  71. };
  72. extern const CLSID CLSID_RegistryEventProvider;
  73. class CRegEventProviderFactory : public CCFDyn
  74. {
  75. public:
  76. IUnknown* CreateImpObj();
  77. };
  78. #endif