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.

100 lines
2.6 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. CCritSec m_cs;
  46. HANDLE m_hQueueSemaphore;
  47. CCritSec m_csQueueLock;
  48. CRefedPointerQueue<CRegistryEventRequest> m_qEventQueue;
  49. protected:
  50. static DWORD Worker(void* p);
  51. HRESULT GetValuesForProp(QL_LEVEL_1_RPN_EXPRESSION* pExpr,
  52. CPropertyName& PropName, CWStringArray& awsVals);
  53. HKEY TranslateHiveName(LPCWSTR wszName);
  54. HRESULT AddRequest(CRegistryEventRequest* pNewReq);
  55. void KillWorker();
  56. void CreateWorker();
  57. friend class CRegistryEventRequest;
  58. friend class CRegistryKeyEventRequest;
  59. friend class CRegistryValueEventRequest;
  60. friend class CRegistryTreeEventRequest;
  61. public:
  62. CRegEventProvider();
  63. ~CRegEventProvider();
  64. void* GetInterface(REFIID riid);
  65. HRESULT RaiseEvent(IWbemClassObject* pEvent);
  66. };
  67. extern const CLSID CLSID_RegistryEventProvider;
  68. class CRegEventProviderFactory : public CCFDyn
  69. {
  70. public:
  71. IUnknown* CreateImpObj();
  72. };
  73. #endif