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.

242 lines
6.7 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997.
  5. //
  6. // File: A L A N E O B J . H
  7. //
  8. // Contents: Declaration of the CALaneCfg notify object model
  9. //
  10. // Notes:
  11. //
  12. // Author: v-lcleet 01 Aug 97
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. #include <ncxbase.h>
  17. #include <ncatlps.h>
  18. #include <nceh.h>
  19. #include <notifval.h>
  20. #include "resource.h"
  21. #include <laneinfo.h>
  22. #define ELAN_NAME_LIMIT 32
  23. enum ElanChangeType
  24. {
  25. ADD_ELAN = ATMLANE_RECONFIG_OP_ADD_ELAN,
  26. DEL_ELAN = ATMLANE_RECONFIG_OP_DEL_ELAN,
  27. MOD_ELAN = ATMLANE_RECONFIG_OP_MOD_ELAN
  28. };
  29. //
  30. // CALaneCfgElanData
  31. //
  32. class CALaneCfgElanInfo
  33. {
  34. public:
  35. CALaneCfgElanInfo(VOID);
  36. VOID SetElanBindName(PCWSTR pszElanBindName);
  37. PCWSTR SzGetElanBindName(VOID);
  38. VOID SetElanDeviceName(PCWSTR pszElanDeviceName);
  39. PCWSTR SzGetElanDeviceName(VOID);
  40. VOID SetElanName(PCWSTR pszElanName);
  41. VOID SetElanName(PWSTR pszElanName);
  42. PCWSTR SzGetElanName(VOID);
  43. BOOL m_fDeleted;
  44. BOOL m_fNewElan;
  45. BOOL m_fRemoveMiniportOnPropertyApply;
  46. BOOL m_fCreateMiniportOnPropertyApply;
  47. private:
  48. tstring m_strElanBindName;
  49. tstring m_strElanDeviceName;
  50. tstring m_strElanName;
  51. };
  52. typedef list<CALaneCfgElanInfo*> ELAN_INFO_LIST;
  53. //
  54. // CALaneCfgAdapterInfo
  55. //
  56. class CALaneCfgAdapterInfo
  57. {
  58. public:
  59. CALaneCfgAdapterInfo(VOID);
  60. ~CALaneCfgAdapterInfo(VOID);
  61. VOID SetAdapterBindName(PCWSTR pszAdapterBindName);
  62. PCWSTR SzGetAdapterBindName(VOID);
  63. VOID SetAdapterPnpId(PCWSTR szAdapterBindName);
  64. PCWSTR SzGetAdapterPnpId(VOID);
  65. GUID m_guidInstanceId;
  66. ELAN_INFO_LIST m_lstElans;
  67. ELAN_INFO_LIST m_lstOldElans;
  68. BOOL m_fDeleted;
  69. // If the adapter has been added, removed, enabled or disabled.
  70. BOOL m_fBindingChanged;
  71. private:
  72. tstring m_strAdapterBindName;
  73. tstring m_strAdapterPnpId;
  74. };
  75. typedef list<CALaneCfgAdapterInfo*> ATMLANE_ADAPTER_INFO_LIST;
  76. //
  77. // CALaneCfg
  78. //
  79. class ATL_NO_VTABLE CALaneCfg :
  80. public CComObjectRoot,
  81. public CComCoClass<CALaneCfg, &CLSID_CALaneCfg>,
  82. public INetCfgComponentControl,
  83. public INetCfgComponentSetup,
  84. public INetCfgComponentPropertyUi,
  85. public INetCfgComponentNotifyBinding
  86. {
  87. protected:
  88. CALaneCfg(VOID);
  89. ~CALaneCfg(VOID);
  90. public:
  91. BEGIN_COM_MAP(CALaneCfg)
  92. COM_INTERFACE_ENTRY(INetCfgComponentControl)
  93. COM_INTERFACE_ENTRY(INetCfgComponentSetup)
  94. COM_INTERFACE_ENTRY(INetCfgComponentPropertyUi)
  95. COM_INTERFACE_ENTRY(INetCfgComponentNotifyBinding)
  96. END_COM_MAP()
  97. // DECLARE_NOT_AGGREGATABLE(CSkeleton)
  98. // Remove the comment from the line above if you don't want your object to
  99. // support aggregation. The default is to support it
  100. DECLARE_REGISTRY_RESOURCEID(IDR_REG_ALANECFG)
  101. // INetCfgComponentControl
  102. STDMETHOD (Initialize) (
  103. IN INetCfgComponent* pIComp,
  104. IN INetCfg* pINetCfg,
  105. IN BOOL fInstalling);
  106. STDMETHOD (ApplyRegistryChanges) ();
  107. STDMETHOD (ApplyPnpChanges) (
  108. IN INetCfgPnpReconfigCallback* pICallback) { return S_OK; }
  109. STDMETHOD (CancelChanges) ();
  110. STDMETHOD (Validate) ();
  111. // INetCfgComponentSetup
  112. STDMETHOD (Install) (DWORD dwSetupFlags);
  113. STDMETHOD (Upgrade) (DWORD dwSetupFlags,
  114. DWORD dwUpgradeFomBuildNo );
  115. STDMETHOD (ReadAnswerFile) (PCWSTR pszAnswerFile,
  116. PCWSTR pszAnswerSection);
  117. STDMETHOD (Removing)();
  118. // INetCfgProperties
  119. STDMETHOD (QueryPropertyUi) (
  120. IN IUnknown* pUnk);
  121. STDMETHOD (SetContext) (
  122. IN IUnknown* pUnk);
  123. STDMETHOD (MergePropPages) (
  124. IN OUT DWORD* pdwDefPages,
  125. OUT LPBYTE* pahpspPrivate,
  126. OUT UINT* pcPrivate,
  127. IN HWND hwndParent,
  128. OUT PCWSTR* pszStartPage);
  129. STDMETHOD (ValidateProperties) (
  130. HWND hwndSheet);
  131. STDMETHOD (CancelProperties) ();
  132. STDMETHOD (ApplyProperties) ();
  133. // INetCfgNotifyBinding
  134. STDMETHOD (QueryBindingPath) (DWORD dwChangeFlag, INetCfgBindingPath* pncbp);
  135. STDMETHOD (NotifyBindingPath) (DWORD dwChangeFlag, INetCfgBindingPath* pncbp);
  136. private:
  137. INetCfgComponent* m_pncc;
  138. INetCfg* m_pnc;
  139. ATMLANE_ADAPTER_INFO_LIST m_lstAdaptersPrimary;
  140. CALaneCfgAdapterInfo * m_pAdapterSecondary;
  141. BOOL m_fDirty;
  142. BOOL m_fValid;
  143. BOOL m_fUpgrade;
  144. BOOL m_fNoElanInstalled;
  145. // Property sheet pages
  146. enum {c_cALanePages = 1};
  147. CPropSheetPage* m_ppsp;
  148. // Context
  149. IUnknown * m_pUnkContext;
  150. tstring m_strGuidConn;
  151. // Utility functions
  152. private:
  153. HRESULT HrNotifyBindingAdd(
  154. INetCfgComponent* pnccAdapter,
  155. PCWSTR pszBindName);
  156. HRESULT HrNotifyBindingRemove(
  157. INetCfgComponent* pnccAdapter,
  158. PCWSTR pszBindName);
  159. HRESULT HrLoadConfiguration();
  160. HRESULT HrLoadAdapterConfiguration(HKEY hkeyAdapterList,
  161. PWSTR szAdapterName);
  162. HRESULT HrLoadElanListConfiguration(HKEY hkeyAdapter,
  163. CALaneCfgAdapterInfo* pAdapterInfo);
  164. HRESULT HrLoadElanConfiguration(HKEY hkeyElanList,
  165. PWSTR szElanName, CALaneCfgAdapterInfo* pAdapterInfo);
  166. HRESULT HrFlushConfiguration();
  167. HRESULT HrFlushAdapterConfiguration(HKEY hkeyAdapterList,
  168. CALaneCfgAdapterInfo *pAdapterInfo);
  169. HRESULT HrFlushElanListConfiguration(HKEY hkeyAdapter,
  170. CALaneCfgAdapterInfo *pAdapterInfo);
  171. HRESULT HrFlushElanConfiguration(HKEY hkeyElanList,
  172. CALaneCfgElanInfo *pElanInfo);
  173. HRESULT HrRemoveMiniportInstance(PCWSTR pszBindNameToRemove);
  174. HRESULT HrFindNetCardInstance(PCWSTR pszBindNameToFind, INetCfgComponent **ppncc);
  175. VOID HrMarkAllDeleted();
  176. VOID UpdateElanDisplayNames();
  177. HRESULT HrSetConnectionContext();
  178. HRESULT HrALaneSetupPsh(HPROPSHEETPAGE** pahpsp);
  179. VOID CopyAdapterInfoPrimaryToSecondary();
  180. VOID CopyAdapterInfoSecondaryToPrimary();
  181. HRESULT HrReconfigLane(CALaneCfgAdapterInfo * pAdapterInfo);
  182. HRESULT HrNotifyElanChange(CALaneCfgAdapterInfo * pAdapterInfo,
  183. CALaneCfgElanInfo * pElanInfo,
  184. ElanChangeType elanChangeType);
  185. BOOL FIsAdapterEnabled(const GUID* pguidId);
  186. };
  187. // some utility functions
  188. void ClearElanList(ELAN_INFO_LIST *plstElans);
  189. void ClearAdapterList(ATMLANE_ADAPTER_INFO_LIST *plstAdapters);
  190. void ClearAdapterInfo(CALaneCfgAdapterInfo * pAdapterInfo);