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.

166 lines
4.0 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1999.
  5. //
  6. // File: I B I N D . H
  7. //
  8. // Contents: Implements the INetCfgBindingInterface and INetCfgBindingPath
  9. // COM interfaces.
  10. //
  11. // Notes:
  12. //
  13. // Author: shaunco 15 Jan 1999
  14. //
  15. //----------------------------------------------------------------------------
  16. #pragma once
  17. #include "bindings.h"
  18. #include "iatl.h"
  19. #include "ienum.h"
  20. #include "icomp.h"
  21. #include "inetcfg.h"
  22. //+---------------------------------------------------------------------------
  23. // INetCfgBindingInterface -
  24. //
  25. class ATL_NO_VTABLE CImplINetCfgBindingInterface :
  26. public CImplINetCfgHolder,
  27. public INetCfgBindingInterface
  28. {
  29. private:
  30. CImplINetCfgComponent* m_pUpper;
  31. CImplINetCfgComponent* m_pLower;
  32. private:
  33. HRESULT HrLockAndTestForValidInterface (
  34. DWORD dwFlags);
  35. public:
  36. CImplINetCfgBindingInterface ()
  37. {
  38. m_pUpper = NULL;
  39. m_pLower = NULL;
  40. }
  41. VOID FinalRelease ()
  42. {
  43. AssertH (m_pUpper);
  44. AssertH (m_pLower);
  45. ReleaseObj (m_pUpper->GetUnknown());
  46. ReleaseObj (m_pLower->GetUnknown());
  47. CImplINetCfgHolder::FinalRelease();
  48. }
  49. BEGIN_COM_MAP(CImplINetCfgBindingInterface)
  50. COM_INTERFACE_ENTRY(INetCfgBindingInterface)
  51. END_COM_MAP()
  52. // INetCfgBindingInterface
  53. //
  54. STDMETHOD (GetName) (
  55. OUT PWSTR* ppszInterfaceName);
  56. STDMETHOD (GetUpperComponent) (
  57. OUT INetCfgComponent** ppComp);
  58. STDMETHOD (GetLowerComponent) (
  59. OUT INetCfgComponent** ppComp);
  60. public:
  61. static HRESULT HrCreateInstance (
  62. IN CImplINetCfg* pINetCfg,
  63. IN CImplINetCfgComponent* pUpper,
  64. IN CImplINetCfgComponent* pLower,
  65. OUT INetCfgBindingInterface** ppv);
  66. };
  67. //+---------------------------------------------------------------------------
  68. // INetCfgBindingPath -
  69. //
  70. class ATL_NO_VTABLE CImplINetCfgBindingPath :
  71. public CImplINetCfgHolder,
  72. public INetCfgBindingPath
  73. {
  74. friend class CImplIEnumNetCfgBindingInterface;
  75. private:
  76. // Note: For code coverage, we keep the static array small to
  77. // test the case where we don't fit and have to allocate.
  78. // Make this number 8 after we test both cases.
  79. //
  80. INetCfgComponent* m_apIComp [8];
  81. INetCfgComponent** m_papIComp;
  82. ULONG m_cpIComp;
  83. private:
  84. HRESULT HrLockAndTestForValidInterface (
  85. IN DWORD dwFlags,
  86. OUT CBindPath* pBindPath);
  87. public:
  88. CImplINetCfgBindingPath ()
  89. {
  90. m_papIComp = NULL;
  91. m_cpIComp = 0;
  92. }
  93. VOID FinalRelease ()
  94. {
  95. AssertH (m_cpIComp);
  96. AssertH (m_papIComp);
  97. ReleaseIUnknownArray (m_cpIComp, (IUnknown**)m_papIComp);
  98. // If we are not using our static array, free what we allocated.
  99. //
  100. if (m_papIComp != m_apIComp)
  101. {
  102. MemFree (m_papIComp);
  103. }
  104. CImplINetCfgHolder::FinalRelease();
  105. }
  106. HRESULT
  107. HrIsValidInterface (
  108. IN DWORD dwFlags,
  109. OUT CBindPath* pBindPath);
  110. BEGIN_COM_MAP(CImplINetCfgBindingPath)
  111. COM_INTERFACE_ENTRY(INetCfgBindingPath)
  112. END_COM_MAP()
  113. // INetCfgBindingPath
  114. //
  115. STDMETHOD (IsSamePathAs) (
  116. IN INetCfgBindingPath* pIPath);
  117. STDMETHOD (IsSubPathOf) (
  118. IN INetCfgBindingPath* pIPath);
  119. STDMETHOD (IsEnabled) ();
  120. STDMETHOD (Enable) (
  121. IN BOOL fEnable);
  122. STDMETHOD (GetPathToken) (
  123. OUT PWSTR* ppszPathToken);
  124. STDMETHOD (GetOwner) (
  125. OUT INetCfgComponent** ppIComp);
  126. STDMETHOD (GetDepth) (
  127. OUT ULONG* pulDepth);
  128. STDMETHOD (EnumBindingInterfaces) (
  129. OUT IEnumNetCfgBindingInterface** ppIEnum);
  130. public:
  131. static HRESULT HrCreateInstance (
  132. IN CImplINetCfg* pINetCfg,
  133. IN const CBindPath* pBindPath,
  134. OUT INetCfgBindingPath** ppIPath);
  135. };