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.7 KiB

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