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.

205 lines
4.7 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1999.
  5. //
  6. // File: I E N U M . H
  7. //
  8. // Contents: Implements the IEnumNetCfgBindingInterface,
  9. // IEnumNetCfgBindingPath, and IEnumNetCfgComponent COM
  10. // interfaces.
  11. //
  12. // Notes:
  13. //
  14. // Author: shaunco 15 Jan 1999
  15. //
  16. //----------------------------------------------------------------------------
  17. #pragma once
  18. #include "bindings.h"
  19. #include "compdefs.h"
  20. #include "complist.h"
  21. #include "iatl.h"
  22. #include "inetcfg.h"
  23. //+---------------------------------------------------------------------------
  24. // IEnumNetCfgBindingInterface -
  25. //
  26. class ATL_NO_VTABLE CImplIEnumNetCfgBindingInterface :
  27. public CImplINetCfgHolder,
  28. public IEnumNetCfgBindingInterface
  29. {
  30. private:
  31. class CImplINetCfgBindingPath* m_pIPath;
  32. UINT m_unIndex;
  33. private:
  34. HRESULT
  35. HrNextOrSkip (
  36. IN ULONG celt,
  37. OUT INetCfgBindingInterface** rgelt,
  38. OUT ULONG* pceltFetched);
  39. public:
  40. CImplIEnumNetCfgBindingInterface ()
  41. {
  42. m_pIPath = NULL;
  43. m_unIndex = 1;
  44. }
  45. VOID FinalRelease ();
  46. BEGIN_COM_MAP(CImplIEnumNetCfgBindingInterface)
  47. COM_INTERFACE_ENTRY(IEnumNetCfgBindingInterface)
  48. END_COM_MAP()
  49. // IEnumNetCfgBindingInterface
  50. STDMETHOD (Next) (
  51. IN ULONG celt,
  52. OUT INetCfgBindingInterface** rgelt,
  53. OUT ULONG* pceltFetched);
  54. STDMETHOD (Skip) (
  55. IN ULONG celt);
  56. STDMETHOD (Reset) ();
  57. STDMETHOD (Clone) (
  58. OUT IEnumNetCfgBindingInterface** ppIEnum);
  59. public:
  60. static HRESULT HrCreateInstance (
  61. IN CImplINetCfg* pINetCfg,
  62. IN class CImplINetCfgBindingPath* pIPath,
  63. OUT IEnumNetCfgBindingInterface** ppIEnum);
  64. };
  65. //+---------------------------------------------------------------------------
  66. // IEnumNetCfgBindingPath -
  67. //
  68. enum EBPC_FLAGS
  69. {
  70. EBPC_CREATE_EMPTY = 0x00000001,
  71. EBPC_COPY_BINDSET = 0x00000002,
  72. EBPC_TAKE_OWNERSHIP = 0x00000004,
  73. };
  74. class ATL_NO_VTABLE CImplIEnumNetCfgBindingPath :
  75. public CImplINetCfgHolder,
  76. public IEnumNetCfgBindingPath
  77. {
  78. friend CImplINetCfgComponent;
  79. private:
  80. CBindingSet m_InternalBindSet;
  81. // m_pBindSet is the pointer through which we access the data being
  82. // enumerated. It will either point to m_InternalBindSet above or some
  83. // other bindset that we were given ownership of via HrCreateInstance.
  84. //
  85. const CBindingSet* m_pBindSet;
  86. // The current enumeration position.
  87. //
  88. CBindingSet::const_iterator m_iter;
  89. private:
  90. HRESULT
  91. HrNextOrSkip (
  92. IN ULONG celt,
  93. OUT INetCfgBindingPath** rgelt,
  94. OUT ULONG* pceltFetched);
  95. public:
  96. CImplIEnumNetCfgBindingPath ()
  97. {
  98. m_pBindSet = NULL;
  99. m_iter = NULL;
  100. }
  101. ~CImplIEnumNetCfgBindingPath ()
  102. {
  103. // Delete m_pBindSet if we own it. (If it's not aliasing a copied
  104. // bindset.)
  105. //
  106. if (&m_InternalBindSet != m_pBindSet)
  107. {
  108. delete m_pBindSet;
  109. }
  110. }
  111. BEGIN_COM_MAP(CImplIEnumNetCfgBindingPath)
  112. COM_INTERFACE_ENTRY(IEnumNetCfgBindingPath)
  113. END_COM_MAP()
  114. // IEnumNetCfgBindingPath
  115. STDMETHOD (Next) (
  116. IN ULONG celt,
  117. OUT INetCfgBindingPath** rgelt,
  118. OUT ULONG* pceltFetched);
  119. STDMETHOD (Skip) (
  120. IN ULONG celt);
  121. STDMETHOD (Reset) ();
  122. STDMETHOD (Clone) (
  123. OUT IEnumNetCfgBindingPath** ppIEnum);
  124. public:
  125. static HRESULT HrCreateInstance (
  126. IN CImplINetCfg* pINetCfg,
  127. IN const CBindingSet* pBindSet OPTIONAL,
  128. IN DWORD dwFlags,
  129. OUT CImplIEnumNetCfgBindingPath** ppIEnum);
  130. };
  131. //+---------------------------------------------------------------------------
  132. // IEnumNetCfgComponent -
  133. //
  134. class ATL_NO_VTABLE CImplIEnumNetCfgComponent :
  135. public CImplINetCfgHolder,
  136. public IEnumNetCfgComponent
  137. {
  138. private:
  139. UINT m_unIndex;
  140. NETCLASS m_Class;
  141. private:
  142. HRESULT
  143. HrNextOrSkip (
  144. IN ULONG celt,
  145. OUT INetCfgComponent** rgelt,
  146. OUT ULONG* pceltFetched);
  147. public:
  148. CImplIEnumNetCfgComponent ()
  149. {
  150. m_unIndex = 0;
  151. }
  152. BEGIN_COM_MAP(CImplIEnumNetCfgComponent)
  153. COM_INTERFACE_ENTRY(IEnumNetCfgComponent)
  154. END_COM_MAP()
  155. // IEnumNetCfgComponent
  156. STDMETHOD (Next) (
  157. IN ULONG celt,
  158. OUT INetCfgComponent** rgelt,
  159. OUT ULONG* pceltFetched);
  160. STDMETHOD (Skip) (
  161. IN ULONG celt);
  162. STDMETHOD (Reset) ();
  163. STDMETHOD (Clone) (
  164. OUT IEnumNetCfgComponent** ppIEnum);
  165. public:
  166. static HRESULT HrCreateInstance (
  167. IN CImplINetCfg* pINetCfg,
  168. IN NETCLASS Class,
  169. OUT IEnumNetCfgComponent** ppIEnum);
  170. };