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.

265 lines
6.2 KiB

  1. #ifndef __CONNECTION_POINT_STUFF_H
  2. #define __CONNECTION_POINT_STUFF_H
  3. ///////////////////////////////////////////////////////////////////////////////
  4. /* File: connect.h
  5. Description: Provides declarations required for the quota controller to
  6. support OLE connection points.
  7. Revision History:
  8. Date Description Programmer
  9. -------- --------------------------------------------------- ----------
  10. 06/19/96 Initial creation. BrianAu
  11. */
  12. ///////////////////////////////////////////////////////////////////////////////
  13. #ifndef _INC_DSKQUOTA_H
  14. # include "dskquota.h"
  15. #endif
  16. #ifndef _INC_DSKQUOTA_USER_H
  17. # include "user.h" // MAX_USERNAME
  18. #endif
  19. #ifndef _INC_DSKQUOTA_OADISP_H
  20. # include "oadisp.h" // OleAutoDispatch class.
  21. #endif
  22. #ifndef _INC_DSKQUOTA_DISPATCH_H
  23. # include "dispatch.h"
  24. #endif
  25. class ConnectionPoint : public IConnectionPoint, public IDispatch
  26. {
  27. private:
  28. LONG m_cRef; // Class object ref count.
  29. DWORD m_cConnections; // Number of connections.
  30. DWORD m_dwCookieNext; // Next cookie value to hand out.
  31. LPUNKNOWN m_pUnkContainer; // IUnknown of ConnectionPointEnumerator
  32. REFIID m_riid; // Reference to IID supported by conn pt.
  33. HANDLE m_hMutex;
  34. OleAutoDispatch m_Dispatch;
  35. CArray<CONNECTDATA> m_ConnectionList;
  36. void Lock(void)
  37. { WaitForSingleObject(m_hMutex, INFINITE); }
  38. void ReleaseLock(void)
  39. { ReleaseMutex(m_hMutex); }
  40. //
  41. // Prevent copying.
  42. //
  43. ConnectionPoint(const ConnectionPoint&);
  44. void operator = (const ConnectionPoint&);
  45. public:
  46. ConnectionPoint(LPUNKNOWN pUnkContainer, REFIID riid);
  47. ~ConnectionPoint(void);
  48. //
  49. // IUnknown methods.
  50. //
  51. STDMETHODIMP
  52. QueryInterface(
  53. REFIID,
  54. LPVOID *);
  55. STDMETHODIMP_(ULONG)
  56. AddRef(
  57. VOID);
  58. STDMETHODIMP_(ULONG)
  59. Release(
  60. VOID);
  61. //
  62. // IConnectionPoint methods.
  63. //
  64. STDMETHODIMP
  65. GetConnectionInterface(
  66. LPIID pIID);
  67. STDMETHODIMP
  68. GetConnectionPointContainer(
  69. PCONNECTIONPOINTCONTAINER *ppCPC);
  70. STDMETHODIMP
  71. Advise(
  72. LPUNKNOWN pUnkSink,
  73. LPDWORD pdwCookie);
  74. STDMETHODIMP
  75. Unadvise(
  76. DWORD dwCookie);
  77. STDMETHODIMP
  78. EnumConnections(
  79. PENUMCONNECTIONS *ppEnum);
  80. //
  81. // IDispatch methods.
  82. //
  83. STDMETHODIMP
  84. GetIDsOfNames(
  85. REFIID riid,
  86. OLECHAR ** rgszNames,
  87. UINT cNames,
  88. LCID lcid,
  89. DISPID *rgDispId);
  90. STDMETHODIMP
  91. GetTypeInfo(
  92. UINT iTInfo,
  93. LCID lcid,
  94. ITypeInfo **ppTInfo);
  95. STDMETHODIMP
  96. GetTypeInfoCount(
  97. UINT *pctinfo);
  98. STDMETHODIMP
  99. Invoke(
  100. DISPID dispIdMember,
  101. REFIID riid,
  102. LCID lcid,
  103. WORD wFlags,
  104. DISPPARAMS *pDispParams,
  105. VARIANT *pVarResult,
  106. EXCEPINFO *pExcepInfo,
  107. UINT *puArgErr);
  108. };
  109. class ConnectionEnum : public IEnumConnections
  110. {
  111. private:
  112. LONG m_cRef; // Object ref count.
  113. UINT m_iCurrent; // "Current" enum index.
  114. UINT m_cConnections; // Connection count.
  115. PCONNECTDATA m_rgConnections; // Array of connection info.
  116. LPUNKNOWN m_pUnkContainer; // Connection pt container.
  117. //
  118. // Prevent assignment.
  119. //
  120. void operator = (const ConnectionEnum&);
  121. public:
  122. ConnectionEnum(
  123. LPUNKNOWN pUnkContainer,
  124. UINT cConnection,
  125. PCONNECTDATA rgConnections);
  126. ConnectionEnum(
  127. const ConnectionEnum& refEnum);
  128. ~ConnectionEnum(void);
  129. HRESULT
  130. Initialize(
  131. UINT cConnection,
  132. PCONNECTDATA rgConnections);
  133. //
  134. // IUnknown methods.
  135. //
  136. STDMETHODIMP
  137. QueryInterface(
  138. REFIID,
  139. LPVOID *);
  140. STDMETHODIMP_(ULONG)
  141. AddRef(
  142. VOID);
  143. STDMETHODIMP_(ULONG)
  144. Release(
  145. VOID);
  146. //
  147. // IEnumConnections methods.
  148. //
  149. STDMETHODIMP
  150. Next(
  151. DWORD,
  152. PCONNECTDATA,
  153. LPDWORD);
  154. STDMETHODIMP
  155. Skip(
  156. DWORD);
  157. STDMETHODIMP
  158. Reset(
  159. VOID);
  160. STDMETHODIMP
  161. Clone(
  162. PENUMCONNECTIONS *);
  163. };
  164. class ConnectionPointEnum : public IEnumConnectionPoints
  165. {
  166. private:
  167. LONG m_cRef; // Object ref count.
  168. UINT m_iCurrent; // "Current" enum index.
  169. UINT m_cConnPts; // Connection point count.
  170. PCONNECTIONPOINT *m_rgConnPts; // Array of connection info.
  171. LPUNKNOWN m_pUnkContainer; // IUnknown of DiskQuotaController.
  172. //
  173. // Prevent assignment.
  174. //
  175. void operator = (const ConnectionPointEnum&);
  176. public:
  177. ConnectionPointEnum(
  178. LPUNKNOWN pUnkContainer,
  179. UINT cConnPts,
  180. PCONNECTIONPOINT *rgConnPts);
  181. ConnectionPointEnum(
  182. const ConnectionPointEnum& refEnum);
  183. ~ConnectionPointEnum(void);
  184. //
  185. // IUnknown methods.
  186. //
  187. STDMETHODIMP
  188. QueryInterface(
  189. REFIID,
  190. LPVOID *);
  191. STDMETHODIMP_(ULONG)
  192. AddRef(
  193. VOID);
  194. STDMETHODIMP_(ULONG)
  195. Release(
  196. VOID);
  197. //
  198. // IEnumConnections methods.
  199. //
  200. STDMETHODIMP
  201. Next(
  202. DWORD,
  203. PCONNECTIONPOINT *,
  204. LPDWORD);
  205. STDMETHODIMP
  206. Skip(
  207. DWORD);
  208. STDMETHODIMP
  209. Reset(
  210. VOID);
  211. STDMETHODIMP
  212. Clone(
  213. PENUMCONNECTIONPOINTS *);
  214. };
  215. #endif // CONNECTION_POINT_STUFF_H