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.

127 lines
4.2 KiB

  1. //****************************************************************************
  2. //
  3. // Module: ULS.DLL
  4. // File: connpt.h
  5. // Content: This file contains the connection container object definition.
  6. // History:
  7. // Wed 17-Apr-1996 11:18:47 -by- Viroon Touranachun [viroont]
  8. //
  9. // Copyright (c) Microsoft Corporation 1996-1997
  10. //
  11. //****************************************************************************
  12. #ifndef _CONNPT_H_
  13. #define _CONNPT_H_
  14. //****************************************************************************
  15. // CEnumConnectionPoints definition
  16. //****************************************************************************
  17. //
  18. class CEnumConnectionPoints : public IEnumConnectionPoints
  19. {
  20. private:
  21. ULONG cRef;
  22. ULONG iIndex;
  23. IConnectionPoint *pcnp;
  24. public:
  25. // Constructor and Initialization
  26. CEnumConnectionPoints (void);
  27. ~CEnumConnectionPoints (void);
  28. STDMETHODIMP Init (IConnectionPoint *pcnpInit);
  29. // IUnknown
  30. STDMETHODIMP QueryInterface (REFIID iid, void **ppv);
  31. STDMETHODIMP_(ULONG) AddRef (void);
  32. STDMETHODIMP_(ULONG) Release (void);
  33. // IEnumConnectionPoints
  34. STDMETHODIMP Next(ULONG cConnections, IConnectionPoint **rgpcn,
  35. ULONG *pcFetched);
  36. STDMETHODIMP Skip(ULONG cConnections);
  37. STDMETHODIMP Reset();
  38. STDMETHODIMP Clone(IEnumConnectionPoints **ppEnum);
  39. };
  40. //****************************************************************************
  41. // CConnectionPoint definition
  42. //****************************************************************************
  43. //
  44. typedef struct tagSinkNode
  45. {
  46. struct tagSinkNode *pNext;
  47. IUnknown *pUnk;
  48. ULONG uFlags;
  49. DWORD dwCookie;
  50. } SINKNODE, *PSINKNODE;
  51. typedef HRESULT (*CONN_NOTIFYPROC)(IUnknown *pUnk, void *);
  52. #define COOKIE_INIT_VALUE 1
  53. #define SN_LOCKED 0x00000001
  54. #define SN_REMOVED 0x00000002
  55. class CConnectionPoint : public IConnectionPoint
  56. {
  57. private:
  58. ULONG cRef;
  59. IID riid;
  60. IConnectionPointContainer *pCPC;
  61. DWORD dwNextCookie;
  62. ULONG cSinkNodes;
  63. PSINKNODE pSinkList;
  64. public:
  65. // Constructor and destructor
  66. CConnectionPoint (const IID *pIID, IConnectionPointContainer *pCPCInit);
  67. ~CConnectionPoint (void);
  68. // Class public functions
  69. void ContainerReleased() {pCPC = NULL; return;}
  70. STDMETHODIMP Notify (void *pv, CONN_NOTIFYPROC pfn);
  71. // IUnknown
  72. STDMETHODIMP QueryInterface (REFIID iid, void **ppv);
  73. STDMETHODIMP_(ULONG) AddRef (void);
  74. STDMETHODIMP_(ULONG) Release (void);
  75. // IConnectionPoint
  76. STDMETHODIMP GetConnectionInterface(IID *pIID);
  77. STDMETHODIMP GetConnectionPointContainer(IConnectionPointContainer **ppCPC);
  78. STDMETHODIMP Advise(IUnknown *pUnk, DWORD *pdwCookie);
  79. STDMETHODIMP Unadvise(DWORD dwCookie);
  80. STDMETHODIMP EnumConnections(IEnumConnections **ppEnum);
  81. };
  82. //****************************************************************************
  83. // CEnumConnections definition
  84. //****************************************************************************
  85. //
  86. class CEnumConnections : public IEnumConnections
  87. {
  88. private:
  89. ULONG cRef;
  90. ULONG iIndex;
  91. ULONG cConnections;
  92. CONNECTDATA *pConnectData;
  93. public:
  94. // Constructor and Initialization
  95. CEnumConnections (void);
  96. ~CEnumConnections (void);
  97. STDMETHODIMP Init(PSINKNODE pSinkList, ULONG cSinkNodes);
  98. // IUnknown
  99. STDMETHODIMP QueryInterface (REFIID iid, void **ppv);
  100. STDMETHODIMP_(ULONG) AddRef (void);
  101. STDMETHODIMP_(ULONG) Release (void);
  102. // IEnumConnections
  103. STDMETHODIMP Next(ULONG cConnections, CONNECTDATA *rgpcn,
  104. ULONG *pcFetched);
  105. STDMETHODIMP Skip(ULONG cConnections);
  106. STDMETHODIMP Reset();
  107. STDMETHODIMP Clone(IEnumConnections **ppEnum);
  108. };
  109. #endif //_CONNPT_H_