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.

171 lines
4.3 KiB

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