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.

99 lines
2.9 KiB

  1. // File: connpnts.h
  2. #ifndef _IMCONNPT_H_
  3. #define _IMCONNPT_H_
  4. #include "nmenum.h"
  5. typedef HRESULT (*CONN_NOTIFYPROC)(IUnknown *pUnk, void *pv, REFIID riid);
  6. //****************************************************************************
  7. // CConnectionPoint definition
  8. //****************************************************************************
  9. //
  10. class CConnectionPoint : public IConnectionPoint, public DllRefCount
  11. {
  12. private:
  13. IID m_riid;
  14. IConnectionPointContainer *m_pCPC;
  15. ULONG m_cSinks;
  16. ULONG m_cAllocatedSinks;
  17. IUnknown **m_rgSinks;
  18. public:
  19. // Constructor and destructor
  20. CConnectionPoint (
  21. const IID *pIID,
  22. IConnectionPointContainer *pCPCInit);
  23. ~CConnectionPoint (void);
  24. // Class public functions
  25. void ContainerReleased() {m_pCPC = NULL;}
  26. STDMETHODIMP Notify (void *pv, CONN_NOTIFYPROC pfn);
  27. // IUnknown
  28. STDMETHODIMP QueryInterface (REFIID iid, void **ppv);
  29. STDMETHODIMP_(ULONG) AddRef (void);
  30. STDMETHODIMP_(ULONG) Release (void);
  31. // IConnectionPoint
  32. STDMETHODIMP GetConnectionInterface(IID *pIID);
  33. STDMETHODIMP GetConnectionPointContainer(IConnectionPointContainer **ppCPC);
  34. STDMETHODIMP Advise(IUnknown *pUnk, DWORD *pdwCookie);
  35. STDMETHODIMP Unadvise(DWORD dwCookie);
  36. STDMETHODIMP EnumConnections(IEnumConnections **ppEnum);
  37. };
  38. //****************************************************************************
  39. // CEnumConnections definition
  40. //****************************************************************************
  41. //
  42. class CEnumConnections : public IEnumConnections, public DllRefCount
  43. {
  44. private:
  45. int m_iIndex;
  46. int m_cConnections;
  47. CONNECTDATA* m_pCD;
  48. public:
  49. // Constructor and Initialization
  50. CEnumConnections (IUnknown **pSinks, ULONG cSink, ULONG cAllocatedSinks);
  51. ~CEnumConnections (void);
  52. // IUnknown
  53. STDMETHODIMP QueryInterface (REFIID iid, void **ppv);
  54. STDMETHODIMP_(ULONG) AddRef (void);
  55. STDMETHODIMP_(ULONG) Release (void);
  56. // IEnumConnections
  57. STDMETHODIMP Next(ULONG cConnections, CONNECTDATA *rgpcn,
  58. ULONG *pcFetched);
  59. STDMETHODIMP Skip(ULONG cConnections);
  60. STDMETHODIMP Reset();
  61. STDMETHODIMP Clone(IEnumConnections **ppEnum);
  62. };
  63. VOID RemoveCp(CConnectionPoint ** ppCp);
  64. class CConnectionPointContainer : public IConnectionPointContainer
  65. {
  66. private:
  67. CConnectionPoint ** m_ppCp;
  68. int m_cCp;
  69. public:
  70. CConnectionPointContainer(const IID **ppiid, int cCp);
  71. ~CConnectionPointContainer();
  72. HRESULT STDMETHODCALLTYPE NotifySink(void *pv, CONN_NOTIFYPROC pfn);
  73. // IConnectionPointContainer methods
  74. STDMETHODIMP EnumConnectionPoints(IEnumConnectionPoints **ppEnum);
  75. STDMETHODIMP FindConnectionPoint(REFIID riid, IConnectionPoint **ppCp);
  76. };
  77. typedef CEnumNmX<IEnumConnectionPoints, &IID_IEnumConnectionPoints, IConnectionPoint, CConnectionPoint> CEnumConnectionPoints;
  78. #endif // _IMCONNPT_H_
  79.