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.

399 lines
14 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. events.h
  5. Abstract:
  6. This module contains the definition for the Server
  7. Extension Objects Server Events classes.
  8. Author:
  9. Don Dumitru (dondu@microsoft.com)
  10. Revision History:
  11. dondu 04/04/97 created
  12. --*/
  13. // events.h : Declaration of the Server Events classes
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CEventDatabasePlugin
  16. class ATL_NO_VTABLE CEventDatabasePlugin :
  17. public IEventDatabasePlugin
  18. {
  19. // IEventDatabasePlugin
  20. public:
  21. HRESULT STDMETHODCALLTYPE get_Database(IEventPropertyBag **ppDatabase);
  22. HRESULT STDMETHODCALLTYPE put_Database(IEventPropertyBag *pDatabase);
  23. HRESULT STDMETHODCALLTYPE putref_Database(IEventPropertyBag **ppDatabase);
  24. HRESULT STDMETHODCALLTYPE get_Name(BSTR *pstrName);
  25. HRESULT STDMETHODCALLTYPE put_Name(BSTR strName);
  26. HRESULT STDMETHODCALLTYPE putref_Name(BSTR *pstrName);
  27. HRESULT STDMETHODCALLTYPE get_Parent(IEventPropertyBag **ppParent);
  28. HRESULT STDMETHODCALLTYPE put_Parent(IEventPropertyBag *pParent);
  29. HRESULT STDMETHODCALLTYPE putref_Parent(IEventPropertyBag **ppParent);
  30. protected:
  31. CComPtr<IEventPropertyBag> m_pDatabase;
  32. CComBSTR m_strName;
  33. CComPtr<IEventPropertyBag> m_pParent;
  34. };
  35. /////////////////////////////////////////////////////////////////////////////
  36. // CEventManager
  37. class ATL_NO_VTABLE CEventManager :
  38. public CComObjectRootEx<CComMultiThreadModelNoCS>,
  39. public CComCoClass<CEventManager, &CLSID_CEventManager>,
  40. public IDispatchImpl<IEventManager, &IID_IEventManager, &LIBID_SEOLib>,
  41. public CEventDatabasePlugin
  42. {
  43. DEBUG_OBJECT_DEF(CEventManager)
  44. public:
  45. HRESULT FinalConstruct();
  46. void FinalRelease();
  47. DECLARE_PROTECT_FINAL_CONSTRUCT();
  48. DECLARE_REGISTRY_RESOURCEID_EX(IDR_StdAfx,
  49. L"EventManager Class",
  50. L"Event.Manager.1",
  51. L"Event.Manager");
  52. DECLARE_GET_CONTROLLING_UNKNOWN();
  53. BEGIN_COM_MAP(CEventManager)
  54. COM_INTERFACE_ENTRY(IEventManager)
  55. COM_INTERFACE_ENTRY_IID(IID_IDispatch, IEventManager)
  56. COM_INTERFACE_ENTRY(IEventDatabasePlugin)
  57. COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p)
  58. END_COM_MAP()
  59. // IEventManager
  60. public:
  61. HRESULT STDMETHODCALLTYPE get_SourceTypes(IEventSourceTypes **ppSourceTypes);
  62. HRESULT STDMETHODCALLTYPE CreateSink(IEventBinding *pBinding,
  63. IEventDeliveryOptions *pDeliveryOptions,
  64. IUnknown **ppUnkSink);
  65. private:
  66. CComPtr<IEventLock> m_pLock;
  67. CComPtr<IUnknown> m_pUnkMarshaler;
  68. };
  69. /////////////////////////////////////////////////////////////////////////////
  70. // CEventBindingManager
  71. class ATL_NO_VTABLE CEventBindingManager :
  72. public CComObjectRootEx<CComMultiThreadModelNoCS>,
  73. public CComCoClass<CEventBindingManager, &CLSID_CEventBindingManager>,
  74. public IDispatchImpl<IEventBindingManager, &IID_IEventBindingManager, &LIBID_SEOLib>,
  75. public CEventDatabasePlugin,
  76. public ISEOInitObject,
  77. public IConnectionPointContainerImpl<CEventBindingManager>,
  78. public CSEOConnectionPointImpl<CEventBindingManager, &IID_IEventNotifyBindingChange>,
  79. public CSEOConnectionPointImpl<CEventBindingManager, &IID_IEventNotifyBindingChangeDisp>,
  80. public IEventNotifyBindingChange,
  81. public IProvideClassInfo2Impl<&CLSID_CEventBindingManager,&IID_IEventNotifyBindingChangeDisp,&LIBID_SEOLib>,
  82. public IDispatchImpl<IEventBindingManagerCopier, &IID_IEventBindingManagerCopier, &LIBID_SEOLib>
  83. {
  84. DEBUG_OBJECT_DEF(CEventBindingManager)
  85. public:
  86. HRESULT FinalConstruct();
  87. void FinalRelease();
  88. DECLARE_PROTECT_FINAL_CONSTRUCT();
  89. DECLARE_REGISTRY_RESOURCEID_EX(IDR_StdAfx,
  90. L"EventBindingManager Class",
  91. L"Event.BindingManager.1",
  92. L"Event.BindingManager");
  93. DECLARE_GET_CONTROLLING_UNKNOWN();
  94. BEGIN_COM_MAP(CEventBindingManager)
  95. COM_INTERFACE_ENTRY(IEventBindingManager)
  96. COM_INTERFACE_ENTRY_IID(IID_IDispatch, IEventBindingManager)
  97. COM_INTERFACE_ENTRY(IEventDatabasePlugin)
  98. COM_INTERFACE_ENTRY(ISEOInitObject)
  99. COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
  100. COM_INTERFACE_ENTRY(IEventNotifyBindingChange)
  101. COM_INTERFACE_ENTRY(IProvideClassInfo2)
  102. COM_INTERFACE_ENTRY(IEventBindingManagerCopier)
  103. COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p)
  104. END_COM_MAP()
  105. BEGIN_CONNECTION_POINT_MAP(CEventBindingManager)
  106. CONNECTION_POINT_ENTRY(IID_IEventNotifyBindingChange)
  107. CONNECTION_POINT_ENTRY(IID_IEventNotifyBindingChangeDisp)
  108. END_CONNECTION_POINT_MAP()
  109. // IEventBindingManager
  110. public:
  111. HRESULT STDMETHODCALLTYPE get_Bindings(BSTR pszEventType, IEventBindings **ppBindings);
  112. HRESULT STDMETHODCALLTYPE get__NewEnum(IUnknown **ppUnkEnum);
  113. // ISEOInitObject (IPersistPropertyBag)
  114. public:
  115. HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID);
  116. HRESULT STDMETHODCALLTYPE InitNew(void);
  117. HRESULT STDMETHODCALLTYPE Load(IPropertyBag *pPropBag, IErrorLog *pErrorLog);
  118. HRESULT STDMETHODCALLTYPE Save(IPropertyBag *pPropBag, BOOL fClearDirty, BOOL fSaveAllProperties);
  119. // IEventNotifyBindingChange
  120. public:
  121. HRESULT STDMETHODCALLTYPE OnChange();
  122. // IEventBindingManagerCopier
  123. public:
  124. HRESULT STDMETHODCALLTYPE Copy(long lTimeout, IEventBindingManager **ppBindingManager);
  125. HRESULT STDMETHODCALLTYPE EmptyCopy(IEventBindingManager **ppBindingManager);
  126. // CSEOConnectionPointImpl<>
  127. public:
  128. void AdviseCalled(IUnknown *pUnk, DWORD *pdwCookie, REFIID riid, DWORD dwCount);
  129. void UnadviseCalled(DWORD dwCookie, REFIID riid, DWORD dwCount);
  130. private:
  131. typedef CSEOConnectionPointImpl<CEventBindingManager, &IID_IEventNotifyBindingChange> CP_ENBC;
  132. typedef CSEOConnectionPointImpl<CEventBindingManager, &IID_IEventNotifyBindingChangeDisp> CP_ENBCD;
  133. DWORD m_dwCPCookie;
  134. CComPtr<IConnectionPoint> m_pCP;
  135. CComBSTR m_strDatabaseManager;
  136. CComPtr<IUnknown> m_pUnkMarshaler;
  137. };
  138. /////////////////////////////////////////////////////////////////////////////
  139. // CEventMetabaseDatabaseManager
  140. class ATL_NO_VTABLE CEventMetabaseDatabaseManager :
  141. public CComObjectRootEx<CComMultiThreadModelNoCS>,
  142. public CComCoClass<CEventMetabaseDatabaseManager, &CLSID_CEventMetabaseDatabaseManager>,
  143. public IDispatchImpl<IEventDatabaseManager, &IID_IEventDatabaseManager, &LIBID_SEOLib>
  144. {
  145. DEBUG_OBJECT_DEF(CEventMetabaseDatabaseManager)
  146. public:
  147. HRESULT FinalConstruct();
  148. void FinalRelease();
  149. DECLARE_PROTECT_FINAL_CONSTRUCT();
  150. DECLARE_REGISTRY_RESOURCEID_EX(IDR_StdAfx,
  151. L"EventMetabaseDatabaseManager Class",
  152. L"Event.MetabaseDatabaseManager.1",
  153. L"Event.MetabaseDatabaseManager");
  154. DECLARE_GET_CONTROLLING_UNKNOWN();
  155. BEGIN_COM_MAP(CEventMetabaseDatabaseManager)
  156. COM_INTERFACE_ENTRY(IEventDatabaseManager)
  157. COM_INTERFACE_ENTRY_IID(IID_IDispatch, IEventDatabaseManager)
  158. COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p)
  159. END_COM_MAP()
  160. // IEventDatabaseManager
  161. public:
  162. HRESULT STDMETHODCALLTYPE CreateDatabase(BSTR strPath, IUnknown **ppMonDatabase);
  163. HRESULT STDMETHODCALLTYPE EraseDatabase(BSTR strPath);
  164. HRESULT STDMETHODCALLTYPE MakeVServerPath(BSTR strService, long lInstance, BSTR *pstrPath);
  165. HRESULT STDMETHODCALLTYPE MakeVRootPath(BSTR strService, long lInstance, BSTR strRoot, BSTR *pstrPath);
  166. private:
  167. CComPtr<IUnknown> m_pUnkMarshaler;
  168. };
  169. /////////////////////////////////////////////////////////////////////////////
  170. // CEventUtil
  171. class ATL_NO_VTABLE CEventUtil :
  172. public CComObjectRootEx<CComMultiThreadModelNoCS>,
  173. public CComCoClass<CEventUtil, &CLSID_CEventUtil>,
  174. public IDispatchImpl<IEventUtil, &IID_IEventUtil, &LIBID_SEOLib>
  175. {
  176. DEBUG_OBJECT_DEF(CEventUtil)
  177. public:
  178. HRESULT FinalConstruct();
  179. void FinalRelease();
  180. DECLARE_PROTECT_FINAL_CONSTRUCT();
  181. DECLARE_REGISTRY_RESOURCEID_EX(IDR_StdAfx,
  182. L"EventUtil Class",
  183. L"Event.Util.1",
  184. L"Event.Util");
  185. DECLARE_GET_CONTROLLING_UNKNOWN();
  186. BEGIN_COM_MAP(CEventUtil)
  187. COM_INTERFACE_ENTRY(IEventUtil)
  188. COM_INTERFACE_ENTRY_IID(IID_IDispatch, IEventUtil)
  189. COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p)
  190. END_COM_MAP()
  191. // IEventUtil
  192. public:
  193. HRESULT STDMETHODCALLTYPE DisplayNameFromMoniker(IUnknown *pUnkMoniker, BSTR *pstrDisplayName);
  194. HRESULT STDMETHODCALLTYPE MonikerFromDisplayName(BSTR strDisplayName, IUnknown **ppUnkMoniker);
  195. HRESULT STDMETHODCALLTYPE ObjectFromMoniker(IUnknown *pUnkMoniker, IUnknown **ppUnkObject);
  196. HRESULT STDMETHODCALLTYPE GetNewGUID(BSTR *pstrGUID);
  197. HRESULT STDMETHODCALLTYPE CopyPropertyBag(IUnknown *pUnkInput, IUnknown **ppUnkOutput);
  198. HRESULT STDMETHODCALLTYPE CopyPropertyBagShallow(IUnknown *pUnkInput, IUnknown **ppUnkOutput);
  199. HRESULT STDMETHODCALLTYPE DispatchFromObject(IUnknown *pUnkObject, IDispatch **ppDispOutput);
  200. HRESULT STDMETHODCALLTYPE GetIndexedGUID(BSTR strGUID, long lIndex, BSTR *pstrResult);
  201. HRESULT STDMETHODCALLTYPE RegisterSource(BSTR strSourceType,
  202. BSTR strSource,
  203. long lInstance,
  204. BSTR strService,
  205. BSTR strVRoot,
  206. BSTR strDatabaseManager,
  207. BSTR strDisplayName,
  208. IEventBindingManager **ppBindingManager);
  209. private:
  210. CComPtr<IUnknown> m_pUnkMarshaler;
  211. };
  212. /////////////////////////////////////////////////////////////////////////////
  213. // CEventComCat
  214. class ATL_NO_VTABLE CEventComCat :
  215. public CComObjectRootEx<CComMultiThreadModelNoCS>,
  216. public CComCoClass<CEventComCat, &CLSID_CEventComCat>,
  217. public IDispatchImpl<IEventComCat, &IID_IEventComCat, &LIBID_SEOLib>
  218. {
  219. DEBUG_OBJECT_DEF(CEventComCat)
  220. public:
  221. HRESULT FinalConstruct();
  222. void FinalRelease();
  223. DECLARE_PROTECT_FINAL_CONSTRUCT();
  224. DECLARE_REGISTRY_RESOURCEID_EX(IDR_StdAfx,
  225. L"EventComCat Class",
  226. L"Event.ComCat.1",
  227. L"Event.ComCat");
  228. DECLARE_GET_CONTROLLING_UNKNOWN();
  229. BEGIN_COM_MAP(CEventComCat)
  230. COM_INTERFACE_ENTRY(IEventComCat)
  231. COM_INTERFACE_ENTRY_IID(IID_IDispatch, IEventComCat)
  232. COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p)
  233. END_COM_MAP()
  234. // IEventComCat
  235. public:
  236. HRESULT STDMETHODCALLTYPE RegisterCategory(BSTR pszCategory, BSTR pszDescription, long lcidLanguage);
  237. HRESULT STDMETHODCALLTYPE UnRegisterCategory(BSTR pszCategory);
  238. HRESULT STDMETHODCALLTYPE RegisterClassImplementsCategory(BSTR pszClass, BSTR pszCategory);
  239. HRESULT STDMETHODCALLTYPE UnRegisterClassImplementsCategory(BSTR pszClass, BSTR pszCategory);
  240. HRESULT STDMETHODCALLTYPE RegisterClassRequiresCategory(BSTR pszClass, BSTR pszCategory);
  241. HRESULT STDMETHODCALLTYPE UnRegisterClassRequiresCategory(BSTR pszClass, BSTR pszCategory);
  242. HRESULT STDMETHODCALLTYPE GetCategories(SAFEARRAY **ppsaCategories);
  243. HRESULT STDMETHODCALLTYPE GetCategoryDescription(BSTR strCategory, long lcidLanguage, BSTR *pstrDescription);
  244. private:
  245. CComPtr<IUnknown> m_pUnkMarshaler;
  246. };
  247. /////////////////////////////////////////////////////////////////////////////
  248. // CEventRouter
  249. class ATL_NO_VTABLE CEventRouter :
  250. public CComObjectRootEx<CComMultiThreadModelNoCS>,
  251. public CComCoClass<CEventRouter, &CLSID_CEventRouter>,
  252. public IEventRouter
  253. {
  254. DEBUG_OBJECT_DEF(CEventRouter)
  255. public:
  256. HRESULT FinalConstruct();
  257. void FinalRelease();
  258. DECLARE_PROTECT_FINAL_CONSTRUCT();
  259. DECLARE_REGISTRY_RESOURCEID_EX(IDR_StdAfx,
  260. L"EventRouter Class",
  261. L"Event.Router.1",
  262. L"Event.Router");
  263. DECLARE_GET_CONTROLLING_UNKNOWN();
  264. BEGIN_COM_MAP(CEventRouter)
  265. COM_INTERFACE_ENTRY(IEventRouter)
  266. COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p)
  267. END_COM_MAP()
  268. // IEventRouter
  269. public:
  270. HRESULT STDMETHODCALLTYPE get_Database(IEventBindingManager **ppBindingManager);
  271. HRESULT STDMETHODCALLTYPE put_Database(IEventBindingManager *pBindingManager);
  272. HRESULT STDMETHODCALLTYPE putref_Database(IEventBindingManager **ppBindingManager);
  273. HRESULT STDMETHODCALLTYPE GetDispatcher(REFIID iidEvent,
  274. REFIID iidDesired,
  275. IUnknown **ppUnkResult);
  276. HRESULT STDMETHODCALLTYPE GetDispatcherByCLSID(REFCLSID clsidDispatcher,
  277. REFIID iidEvent,
  278. REFIID iidDesired,
  279. IUnknown **ppUnkResult);
  280. HRESULT STDMETHODCALLTYPE GetDispatcherByClassFactory(REFCLSID clsidDispatcher,
  281. IClassFactory *piClassFactory,
  282. REFIID iidEvent,
  283. REFIID iidDesired,
  284. IUnknown **ppUnkResult);
  285. private:
  286. CComPtr<IEventRouter> m_pRouter;
  287. CComPtr<IUnknown> m_pUnkMarshaler;
  288. };
  289. EXTERN_C const CLSID CLSID_CEventServiceObject;
  290. /////////////////////////////////////////////////////////////////////////////
  291. // CEventServiceObject
  292. class ATL_NO_VTABLE CEventServiceObject :
  293. public CComObjectRootEx<CComMultiThreadModelNoCS>,
  294. public CComCoClass<CEventServiceObject, &CLSID_CEventServiceObject>,
  295. public IUnknown
  296. {
  297. DEBUG_OBJECT_DEF(CEventServiceObject)
  298. public:
  299. HRESULT FinalConstruct();
  300. void FinalRelease();
  301. DECLARE_PROTECT_FINAL_CONSTRUCT();
  302. DECLARE_REGISTRY_RESOURCEID_EX(IDR_StdAfx,
  303. L"EventServiceObject Class",
  304. L"Event.ServiceObject.1",
  305. L"Event.ServiceObject");
  306. DECLARE_GET_CONTROLLING_UNKNOWN();
  307. BEGIN_COM_MAP(CEventServiceObject)
  308. COM_INTERFACE_ENTRY(IUnknown)
  309. COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p)
  310. END_COM_MAP()
  311. // IEventNotifyBindingChange
  312. public:
  313. HRESULT STDMETHODCALLTYPE OnChange();
  314. private:
  315. CComQIPtr<IConnectionPointContainer,&IID_IConnectionPointContainer> m_pCPC;
  316. DWORD m_dwCookie;
  317. CComPtr<IUnknown> m_pSubObject;
  318. CComPtr<IUnknown> m_pUnkMetabase;
  319. CComPtr<IUnknown> m_pUnkMarshaler;
  320. };