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.

147 lines
3.6 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997.
  5. //
  6. // File: P P P O E U I . C P P
  7. //
  8. // Contents: PPPoE connection UI object.
  9. //
  10. // Notes:
  11. //
  12. // Author: mbend 10 May 2000
  13. //
  14. //----------------------------------------------------------------------------
  15. #include "pch.h"
  16. #pragma hdrstop
  17. #include "pppoeui.h"
  18. //+---------------------------------------------------------------------------
  19. // INetConnectionConnectUi
  20. //
  21. STDMETHODIMP
  22. CPPPoEUi::SetConnection (
  23. INetConnection* pCon)
  24. {
  25. return HrSetConnection (pCon, this);
  26. }
  27. STDMETHODIMP
  28. CPPPoEUi::Connect (
  29. HWND hwndParent,
  30. DWORD dwFlags)
  31. {
  32. HRESULT hr = HrConnect (hwndParent, dwFlags, this,
  33. static_cast<INetConnectionConnectUi*>(this));
  34. TraceError ("CPPPoEUi::Connect", (S_FALSE == hr) ? S_OK : hr);
  35. return hr;
  36. }
  37. STDMETHODIMP
  38. CPPPoEUi::Disconnect (
  39. HWND hwndParent,
  40. DWORD dwFlags)
  41. {
  42. return HrDisconnect (hwndParent, dwFlags);
  43. }
  44. //+---------------------------------------------------------------------------
  45. // INetConnectionPropertyUi2
  46. //
  47. STDMETHODIMP
  48. CPPPoEUi::AddPages (
  49. HWND hwndParent,
  50. LPFNADDPROPSHEETPAGE pfnAddPage,
  51. LPARAM lParam)
  52. {
  53. HRESULT hr = HrAddPropertyPages (hwndParent, pfnAddPage, lParam);
  54. TraceError ("CPPPoEUi::AddPages (INetConnectionPropertyUi)", hr);
  55. return hr;
  56. }
  57. STDMETHODIMP
  58. CPPPoEUi::GetIcon (
  59. DWORD dwSize,
  60. HICON *phIcon )
  61. {
  62. HRESULT hr;
  63. Assert (phIcon);
  64. hr = HrGetIconFromMediaType(dwSize, NCM_PPPOE, NCSM_NONE, 7, 0, phIcon);
  65. TraceError ("CLanConnectionUi::GetIcon (INetConnectionPropertyUi2)", hr);
  66. return hr;
  67. }
  68. //+---------------------------------------------------------------------------
  69. // INetConnectionWizardUi
  70. //
  71. STDMETHODIMP
  72. CPPPoEUi::QueryMaxPageCount (
  73. INetConnectionWizardUiContext* pContext,
  74. DWORD* pcMaxPages)
  75. {
  76. HRESULT hr = HrQueryMaxPageCount (pContext, pcMaxPages);
  77. TraceError ("CPPPoEUi::QueryMaxPageCount", hr);
  78. return hr;
  79. }
  80. STDMETHODIMP
  81. CPPPoEUi::AddPages (
  82. INetConnectionWizardUiContext* pContext,
  83. LPFNADDPROPSHEETPAGE pfnAddPage,
  84. LPARAM lParam)
  85. {
  86. HRESULT hr = HrAddWizardPages (pContext, pfnAddPage, lParam,
  87. RASEDFLAG_NewBroadbandEntry | RASEDFLAG_InternetEntry);
  88. TraceError ("CPPPoEUi::AddPages (INetConnectionWizardUi)", hr);
  89. return hr;
  90. }
  91. STDMETHODIMP
  92. CPPPoEUi::GetSuggestedConnectionName (
  93. PWSTR* ppszwSuggestedName)
  94. {
  95. HRESULT hr = HrGetSuggestedConnectionName (ppszwSuggestedName);
  96. TraceError ("CPPPoEUi::GetSuggestedConnectionName", hr);
  97. return hr;
  98. }
  99. STDMETHODIMP
  100. CPPPoEUi::GetNewConnectionInfo (
  101. DWORD* pdwFlags,
  102. NETCON_MEDIATYPE* pMediaType)
  103. {
  104. HRESULT hr;
  105. *pdwFlags = 0;
  106. hr = HrGetNewConnectionInfo(pdwFlags);
  107. if (SUCCEEDED(hr))
  108. {
  109. *pdwFlags |= NCWF_SHORTCUT_ENABLE;
  110. *pMediaType = NCM_PPPOE;
  111. }
  112. return S_OK;
  113. }
  114. STDMETHODIMP
  115. CPPPoEUi::SetConnectionName (
  116. PCWSTR pszwConnectionName)
  117. {
  118. HRESULT hr = HrSetConnectionName (pszwConnectionName);
  119. TraceError ("CPPPoEUi::SetConnectionName", hr);
  120. return hr;
  121. }
  122. STDMETHODIMP
  123. CPPPoEUi::GetNewConnection (
  124. INetConnection** ppCon)
  125. {
  126. HRESULT hr = HrGetNewConnection (ppCon);
  127. TraceError ("CPPPoEUi::GetNewConnection", hr);
  128. return hr;
  129. }