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.

134 lines
2.6 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997.
  5. //
  6. // File: P P T P . C P P
  7. //
  8. // Contents: Implementation of PPPOE configuration object.
  9. //
  10. // Notes:
  11. //
  12. // Author: shaunco 10 Mar 1997
  13. //
  14. //----------------------------------------------------------------------------
  15. #include "pch.h"
  16. #pragma hdrstop
  17. #include "ndiswan.h"
  18. #include "rasobj.h"
  19. extern const WCHAR c_szInfId_MS_PppoeMiniport[];
  20. CPppoe::CPppoe () : CRasBindObject ()
  21. {
  22. m_pnccMe = NULL;
  23. m_fSaveAfData = FALSE;
  24. }
  25. CPppoe::~CPppoe ()
  26. {
  27. ReleaseObj (m_pnccMe);
  28. }
  29. //+---------------------------------------------------------------------------
  30. // INetCfgComponentControl
  31. //
  32. STDMETHODIMP
  33. CPppoe::Initialize (
  34. INetCfgComponent* pncc,
  35. INetCfg* pnc,
  36. BOOL fInstalling)
  37. {
  38. Validate_INetCfgNotify_Initialize (pncc, pnc, fInstalling);
  39. // Hold on to our the component representing us and our host
  40. // INetCfg object.
  41. //
  42. AddRefObj (m_pnccMe = pncc);
  43. AddRefObj (m_pnc = pnc);
  44. return S_OK;
  45. }
  46. STDMETHODIMP
  47. CPppoe::Validate ()
  48. {
  49. return S_OK;
  50. }
  51. STDMETHODIMP
  52. CPppoe::CancelChanges ()
  53. {
  54. return S_OK;
  55. }
  56. STDMETHODIMP
  57. CPppoe::ApplyRegistryChanges ()
  58. {
  59. if (m_fSaveAfData)
  60. {
  61. m_AfData.SaveToRegistry (m_pnc);
  62. m_fSaveAfData = FALSE;
  63. }
  64. return S_OK;
  65. }
  66. //+---------------------------------------------------------------------------
  67. // INetCfgComponentSetup
  68. //
  69. STDMETHODIMP
  70. CPppoe::ReadAnswerFile (
  71. PCWSTR pszAnswerFile,
  72. PCWSTR pszAnswerSection)
  73. {
  74. Validate_INetCfgNotify_ReadAnswerFile (pszAnswerFile, pszAnswerSection);
  75. // Read data from the answer file.
  76. // Don't let this affect the HRESULT we return.
  77. //
  78. if (SUCCEEDED(m_AfData.HrOpenAndRead (pszAnswerFile, pszAnswerSection)))
  79. {
  80. m_fSaveAfData = TRUE;
  81. }
  82. return S_OK;
  83. }
  84. STDMETHODIMP
  85. CPppoe::Install (DWORD dwSetupFlags)
  86. {
  87. HRESULT hr;
  88. Validate_INetCfgNotify_Install (dwSetupFlags);
  89. // Install the PPPOE miniport driver.
  90. //
  91. hr = HrEnsureZeroOrOneAdapter (m_pnc, c_szInfId_MS_PppoeMiniport, ARA_ADD);
  92. TraceError ("CPppoe::Install", hr);
  93. return hr;
  94. }
  95. STDMETHODIMP
  96. CPppoe::Removing ()
  97. {
  98. HRESULT hr;
  99. // Remove the PPPOE miniport driver.
  100. //
  101. hr = HrEnsureZeroOrOneAdapter (m_pnc, c_szInfId_MS_PppoeMiniport, ARA_REMOVE);
  102. TraceError ("CPppoe::Removing", hr);
  103. return hr;
  104. }
  105. STDMETHODIMP
  106. CPppoe::Upgrade (
  107. DWORD dwSetupFlags,
  108. DWORD dwUpgradeFromBuildNo)
  109. {
  110. return S_FALSE;
  111. }