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.

206 lines
5.6 KiB

  1. //-----------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997.
  5. //
  6. // File: A R P S O B J . H
  7. //
  8. // Contents: CArpsCfg declaration
  9. //
  10. // Notes:
  11. //
  12. // Author: tongl 12 Mar 1997
  13. //
  14. //-----------------------------------------------------------------------
  15. #pragma once
  16. #include <ncxbase.h>
  17. #include <nceh.h>
  18. #include <notifval.h>
  19. #include "atmutil.h"
  20. #include "resource.h"
  21. // Reg key value names for parameters
  22. static const WCHAR c_szSapSel[] = L"Selector";
  23. static const WCHAR c_szRegAddrs[] = L"RegisteredAddresses";
  24. static const WCHAR c_szMCAddrs[] = L"MulticastAddresses";
  25. // Default parameter values
  26. static const c_dwDefSapSel = 0;
  27. static const WCHAR c_szDefRegAddrs[] =
  28. L"4700790001020000000000000000A03E00000200";
  29. #pragma warning( disable : 4125 )
  30. static const WCHAR c_szDefMCAddr1[] = L"224.0.0.1-239.255.255.255";
  31. static const WCHAR c_szDefMCAddr2[] = L"255.255.255.255-255.255.255.255";
  32. #pragma warning( default : 4125 )
  33. //
  34. // parameter data structure
  35. //
  36. class CArpsAdapterInfo
  37. {
  38. public:
  39. CArpsAdapterInfo() {};
  40. ~CArpsAdapterInfo(){};
  41. CArpsAdapterInfo & operator=(const CArpsAdapterInfo & AdapterInfo); // copy operator
  42. HRESULT HrSetDefaults(PCWSTR pszBindName);
  43. // the adapter's binding state
  44. AdapterBindingState m_BindingState;
  45. // Instance Guid of net card
  46. tstring m_strBindName;
  47. // SAP selector
  48. DWORD m_dwSapSelector;
  49. DWORD m_dwOldSapSelector;
  50. // Registered ATM Address
  51. VECSTR m_vstrRegisteredAtmAddrs;
  52. VECSTR m_vstrOldRegisteredAtmAddrs;
  53. // Multicast IP address
  54. VECSTR m_vstrMulticastIpAddrs;
  55. VECSTR m_vstrOldMulticastIpAddrs;
  56. // flags
  57. BOOL m_fDeleted;
  58. };
  59. typedef list<CArpsAdapterInfo*> ARPS_ADAPTER_LIST;
  60. /////////////////////////////////////////////////////////////////////////////
  61. // ArpsCfg
  62. class ATL_NO_VTABLE CArpsCfg :
  63. public CComObjectRoot,
  64. public CComCoClass<CArpsCfg, &CLSID_CArpsCfg>,
  65. public INetCfgComponentControl,
  66. public INetCfgComponentSetup,
  67. public INetCfgComponentNotifyBinding,
  68. public INetCfgComponentPropertyUi
  69. {
  70. public:
  71. CArpsCfg();
  72. ~CArpsCfg();
  73. BEGIN_COM_MAP(CArpsCfg)
  74. COM_INTERFACE_ENTRY(INetCfgComponentControl)
  75. COM_INTERFACE_ENTRY(INetCfgComponentSetup)
  76. COM_INTERFACE_ENTRY(INetCfgComponentNotifyBinding)
  77. COM_INTERFACE_ENTRY(INetCfgComponentPropertyUi)
  78. END_COM_MAP()
  79. // DECLARE_NOT_AGGREGATABLE(CArpsCfg)
  80. // Remove the comment from the line above if you don't want your object to
  81. // support aggregation. The default is to support it
  82. DECLARE_REGISTRY_RESOURCEID(IDR_REG_ARPSCFG)
  83. // INetCfgComponentControl
  84. STDMETHOD (Initialize) (
  85. IN INetCfgComponent* pIComp,
  86. IN INetCfg* pINetCfg,
  87. IN BOOL fInstalling);
  88. STDMETHOD (ApplyRegistryChanges) ();
  89. STDMETHOD (ApplyPnpChanges) (
  90. IN INetCfgPnpReconfigCallback* pICallback) { return S_OK; }
  91. STDMETHOD (CancelChanges) ();
  92. STDMETHOD (Validate) ();
  93. // INetCfgComponentSetup
  94. STDMETHOD (Install) (DWORD dwSetupFlags);
  95. STDMETHOD (Upgrade) (DWORD dwSetupFlags,
  96. DWORD dwUpgradeFomBuildNo );
  97. STDMETHOD (ReadAnswerFile) (PCWSTR pszAnswerFile,
  98. PCWSTR pszAnswerSection);
  99. STDMETHOD (Removing)();
  100. // INetCfgNotifyBinding
  101. STDMETHOD (QueryBindingPath) (DWORD dwChangeFlag, INetCfgBindingPath* pncbp);
  102. STDMETHOD (NotifyBindingPath) (DWORD dwChangeFlag, INetCfgBindingPath* pncbp);
  103. // INetCfgProperties
  104. STDMETHOD (QueryPropertyUi) (
  105. IN IUnknown* pUnk);
  106. STDMETHOD (SetContext) (
  107. IN IUnknown* pUnk);
  108. STDMETHOD (MergePropPages) (
  109. IN OUT DWORD* pdwDefPages,
  110. OUT LPBYTE* pahpspPrivate,
  111. OUT UINT* pcPrivate,
  112. IN HWND hwndParent,
  113. OUT PCWSTR* pszStartPage);
  114. STDMETHOD (ValidateProperties) (
  115. HWND hwndSheet);
  116. STDMETHOD (CancelProperties) ();
  117. STDMETHOD (ApplyProperties) ();
  118. // help functions
  119. CArpsAdapterInfo * GetSecondMemoryAdapterInfo()
  120. {
  121. return m_pSecondMemoryAdapterInfo;
  122. }
  123. void SetSecondMemoryModified()
  124. {
  125. m_fSecondMemoryModified = TRUE;
  126. }
  127. // Private state info and help functions
  128. private:
  129. // Place to keep corresponding component object, i.e. ATMARPS
  130. INetCfgComponent *m_pnccArps;
  131. // Place to keep the pointer to UI context
  132. IUnknown * m_pUnkContext;
  133. // (STL) List of adapter info structures
  134. ARPS_ADAPTER_LIST m_listAdapters;
  135. // Guid of the current connection
  136. tstring m_strGuidConn;
  137. // Second memory adapter info structures
  138. CArpsAdapterInfo * m_pSecondMemoryAdapterInfo;
  139. // Do we need to update registry on Apply
  140. BOOL m_fSaveRegistry;
  141. BOOL m_fReconfig;
  142. BOOL m_fSecondMemoryModified;
  143. BOOL m_fRemoving;
  144. // property page
  145. class CArpsPage * m_arps;
  146. // Update registry with contents of m_listAdapters
  147. HRESULT HrSaveSettings();
  148. HRESULT HrLoadSettings();
  149. HRESULT HrLoadArpsRegistry(HKEY hkey);
  150. // Set the default parameter values to registry
  151. HRESULT HrSetDefaultAdapterParam(HKEY hkey);
  152. // Handling add or remove a card in memory
  153. HRESULT HrAddAdapter(INetCfgComponent * pncc);
  154. HRESULT HrRemoveAdapter(INetCfgComponent * pncc);
  155. HRESULT HrBindAdapter(INetCfgComponent * pnccAdapter);
  156. HRESULT HrUnBindAdapter(INetCfgComponent * pnccAdapter);
  157. HRESULT HrSetConnectionContext();
  158. HRESULT HrSetupPropSheets(HPROPSHEETPAGE ** pahpsp, INT * pcPages);
  159. // load and save adapter parameters to second memory
  160. HRESULT HrLoadAdapterInfo();
  161. HRESULT HrSaveAdapterInfo();
  162. };