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.

255 lines
7.9 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. connect.h
  5. Abstract:
  6. defines for event/sink interface for IIS DCOM Admin.
  7. Author:
  8. Sophia Chung (sophiac) 14-Jan-97
  9. Revision History:
  10. --*/
  11. #if !defined(CONNECT_H)
  12. #define CONNECT_H
  13. #ifdef __cplusplus
  14. // Types that should be in OLE2.H
  15. #ifndef PPVOID
  16. typedef LPVOID* PPVOID;
  17. #endif
  18. enum
  19. {
  20. // A constant for the number of connections to add to the allocation
  21. // of the dynamic connection array.
  22. ALLOC_CONNECTIONS = 8,
  23. // The start value for the connection key (cookie) counter.
  24. COOKIE_START_VALUE = 500
  25. };
  26. /*O+O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O
  27. ObjectClass: COEnumConnectionPoints
  28. Summary: COM object class for enumerating the Connection Points
  29. offered by a connectable object.
  30. Interfaces: IUnknown
  31. Standard interface providing COM object features.
  32. IEnumConnectionPoints
  33. Interface for connection point enumeration.
  34. Aggregation: COEnumConnectionPoints COM Objects are not aggregatable.
  35. O---O---O---O---O---O---O---O---O---O---O---O---O---O---O---O---O---O---O-O*/
  36. class COEnumConnectionPoints : public IEnumConnectionPoints
  37. {
  38. public:
  39. // Main Object Constructor & Destructor.
  40. COEnumConnectionPoints(IUnknown* pHostObj);
  41. ~COEnumConnectionPoints(void);
  42. // A general method for initializing this newly created object.
  43. // Creates any subordinate arrays, structures, or objects.
  44. HRESULT Init(
  45. ULONG cConnPts,
  46. IConnectionPoint** paConnPts,
  47. ULONG iEnumIndex);
  48. // IUnknown methods. Main object, non-delegating.
  49. STDMETHODIMP QueryInterface(REFIID, PPVOID);
  50. STDMETHODIMP_(ULONG) AddRef(void);
  51. STDMETHODIMP_(ULONG) Release(void);
  52. // IEnumConnectionPoints methods.
  53. STDMETHODIMP Next(ULONG, IConnectionPoint**, ULONG*);
  54. STDMETHODIMP Skip(ULONG);
  55. STDMETHODIMP Reset(void);
  56. STDMETHODIMP Clone(IEnumConnectionPoints**);
  57. private:
  58. // Private data of COEnumConnectionPoints COM objects.
  59. // Main Object reference count.
  60. ULONG m_cRefs;
  61. // IUnknown pointer to host COM object being enumerated.
  62. IUnknown* m_pHostObj;
  63. // Connection Point index variable.
  64. ULONG m_iEnumIndex;
  65. // Number of Connection Points being enumerated.
  66. ULONG m_cConnPts;
  67. // Allocated array of Connection Point interface pointers.
  68. IConnectionPoint** m_paConnPts;
  69. };
  70. typedef COEnumConnectionPoints* PCOEnumConnectionPoints;
  71. /*O+O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O
  72. ObjectClass: COConnectionPoint
  73. Summary: Connection Point COM object class. Implements a native
  74. IConnectionPoint interface. The Advise, Unadvise, and
  75. EnumConnections methods use the CThreaded OwnThis mechanism
  76. to provide thread-safe mutually exclusive access to this
  77. connection point object.
  78. Interfaces: IUnknown
  79. Standard interface providing COM object features.
  80. IConnectionPoint
  81. Interface for connection point features.
  82. Aggregation: COConnectionPoint COM Objects are not aggregatable.
  83. O---O---O---O---O---O---O---O---O---O---O---O---O---O---O---O---O---O---O-O*/
  84. class COConnectionPoint : public IConnectionPoint
  85. {
  86. public:
  87. // Main Object Constructor & Destructor.
  88. COConnectionPoint();
  89. ~COConnectionPoint(void);
  90. // A general method for initializing this newly created object.
  91. // Creates any subordinate arrays, structures, or objects.
  92. HRESULT Init(IUnknown* pHostObj, REFIID riid);
  93. // IUnknown methods. Main object, non-delegating.
  94. STDMETHODIMP QueryInterface(REFIID, PPVOID);
  95. STDMETHODIMP_(ULONG) AddRef(void);
  96. STDMETHODIMP_(ULONG) Release(void);
  97. // IConnectionPoint methods.
  98. STDMETHODIMP GetConnectionInterface(IID*);
  99. STDMETHODIMP GetConnectionPointContainer(IConnectionPointContainer**);
  100. STDMETHODIMP Advise(IUnknown*, DWORD*);
  101. STDMETHODIMP Unadvise(DWORD);
  102. STDMETHODIMP EnumConnections(IEnumConnections**);
  103. // Our own methods
  104. STDMETHODIMP ListenersPresent(VOID);
  105. STDMETHODIMP Terminate(VOID);
  106. STDMETHODIMP Disable(VOID);
  107. STDMETHODIMP InternalEnumSinks(
  108. CONNECTDATA **prgConnections,
  109. ULONG *pcConnections);
  110. private:
  111. // Private utility methods of COConnectionPoint.
  112. STDMETHODIMP Unadvise_Worker(DWORD dwCookie);
  113. HRESULT GetSlot(UINT* puiFreeSlot);
  114. HRESULT FindSlot(DWORD dwCookie, UINT* puiSlot);
  115. // Private data of COConnectionPoint COM objects.
  116. // Used to protect access to the member data.
  117. CReaderWriterLock3 m_Lock;
  118. // IUnknown pointer to host COM object offering this connection point.
  119. IUnknown* m_pHostObj;
  120. // The IID of the sink interface associated with this connection point.
  121. IID m_iidSink;
  122. // The current number of live sink connections to this connection point.
  123. UINT m_cConnections;
  124. // The current maximum index into the dynamic connection array.
  125. UINT m_uiMaxIndex;
  126. // The dynamic array of sink connections to this connection point.
  127. CONNECTDATA* m_paConnections;
  128. // Determines whether the host object is shuting down and force terminated us
  129. volatile BOOL m_bTerminated;
  130. BOOL m_bEnabled;
  131. IGlobalInterfaceTable* m_pGIT;
  132. };
  133. typedef COConnectionPoint* PCOConnectionPoint;
  134. /*O+O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O+++O
  135. ObjectClass: COEnumConnections
  136. Summary: COM object class for enumerating the connections of a
  137. connection point of a connectable object.
  138. Interfaces: IUnknown
  139. Standard interface providing COM object features.
  140. IEnumConnections
  141. Interface for connection enumeration features.
  142. Aggregation: COEnumConnections COM Objects are not aggregatable.
  143. O---O---O---O---O---O---O---O---O---O---O---O---O---O---O---O---O---O---O-O*/
  144. class COEnumConnections : public IEnumConnections
  145. {
  146. public:
  147. // Main Object Constructor & Destructor.
  148. COEnumConnections(IUnknown* pHostObj);
  149. ~COEnumConnections(void);
  150. // A general method for initializing this newly created object.
  151. // Creates any subordinate arrays, structures, or objects.
  152. HRESULT Init(
  153. ULONG cConnections,
  154. CONNECTDATA* paConnections,
  155. ULONG iEnumIndex,
  156. IGlobalInterfaceTable* pGIT = NULL
  157. );
  158. // IUnknown methods. Main object, non-delegating.
  159. STDMETHODIMP QueryInterface(REFIID, PPVOID);
  160. STDMETHODIMP_(ULONG) AddRef(void);
  161. STDMETHODIMP_(ULONG) Release(void);
  162. // IEnumConnections methods.
  163. STDMETHODIMP Next(ULONG, CONNECTDATA*, ULONG*);
  164. STDMETHODIMP Skip(ULONG);
  165. STDMETHODIMP Reset(void);
  166. STDMETHODIMP Clone(IEnumConnections**);
  167. private:
  168. // Private data of COEnumConnections COM objects.
  169. // Main Object reference count.
  170. ULONG m_cRefs;
  171. // IUnknown pointer to host connection point COM object being
  172. // enumerated.
  173. IUnknown* m_pHostObj;
  174. // Connection index variable.
  175. ULONG m_iEnumIndex;
  176. // Number of Connections being enumerated.
  177. ULONG m_cConnections;
  178. // Allocated array of live Connections only.
  179. CONNECTDATA* m_paConnections;
  180. };
  181. typedef COEnumConnections* PCOEnumConnections;
  182. HRESULT SetSinkCallbackSecurityBlanket(
  183. IUnknown * pUnkSink);
  184. #endif // __cplusplus
  185. #endif // CONNECT_H