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.

180 lines
4.1 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997.
  5. //
  6. // File: C O N F O L D . C P P
  7. //
  8. // Contents: CConnectionFolder base functions.
  9. //
  10. // Notes:
  11. //
  12. // Author: jeffspr 18 Mar 1998
  13. //
  14. //----------------------------------------------------------------------------
  15. #include "pch.h"
  16. #pragma hdrstop
  17. #include "foldinc.h" // Standard shell\folder includes
  18. #include "webview.h"
  19. // Map of replaceable items in connfold.rgs file
  20. // this allows us to localize these items
  21. //
  22. struct _ATL_REGMAP_ENTRY g_FolderRegMap[] =
  23. {
  24. { L"ConnectionsFolderName", NULL },
  25. { L"ConnectionsFolderInfoTip", NULL },
  26. { NULL, NULL }
  27. };
  28. //+---------------------------------------------------------------------------
  29. //
  30. // Function: CConnectionFolder::UpdateRegistry
  31. //
  32. // Purpose: Apply registry data in connfold.rgs
  33. //
  34. // Arguments:
  35. // fRegister [in] whether to register
  36. //
  37. // Returns: S_OK if success, otherwise an error code
  38. //
  39. // Author: kumarp 15-September-98
  40. //
  41. // Notes:
  42. //
  43. HRESULT WINAPI CConnectionFolder::UpdateRegistry(BOOL fRegister)
  44. {
  45. TraceFileFunc(ttidConFoldEntry);
  46. // fill-in localized strings for the two replaceable parameters
  47. g_FolderRegMap[0].szData = SzLoadIds(IDS_CONFOLD_NAME);
  48. g_FolderRegMap[1].szData = SzLoadIds(IDS_CONFOLD_INFOTIP);
  49. return _Module.UpdateRegistryFromResourceD(IDR_CONFOLD, fRegister,
  50. g_FolderRegMap);
  51. }
  52. //+---------------------------------------------------------------------------
  53. //
  54. // Member: CConnectionFolder::CConnectionFolder
  55. //
  56. // Purpose: Constructor for the primary Folder object
  57. //
  58. // Arguments:
  59. // (none)
  60. //
  61. // Returns:
  62. //
  63. // Author: jeffspr 18 Mar 1998
  64. //
  65. // Notes:
  66. //
  67. CConnectionFolder::CConnectionFolder()
  68. {
  69. TraceFileFunc(ttidConFoldEntry);
  70. DWORD dwLength = UNLEN+1;
  71. // By default, we want to enumerate all connection types
  72. //
  73. m_dwEnumerationType = CFCOPT_ENUMALL;
  74. m_hwndMain = NULL;
  75. m_pWebView = NULL;
  76. m_pWebView = new CNCWebView(this);
  77. }
  78. //+---------------------------------------------------------------------------
  79. //
  80. // Member: CConnectionFolder::~CConnectionFolder
  81. //
  82. // Purpose: Destructor for the primary folder object
  83. //
  84. // Arguments:
  85. // (none)
  86. //
  87. // Returns:
  88. //
  89. // Author: jeffspr 18 Mar 1998
  90. //
  91. // Notes:
  92. //
  93. CConnectionFolder::~CConnectionFolder()
  94. {
  95. Assert(m_pWebView);
  96. delete m_pWebView;
  97. }
  98. //+---------------------------------------------------------------------------
  99. //
  100. // Member: CConnectionFolder::PidlGetFolderRoot
  101. //
  102. // Purpose: Return the folder pidl. If NULL at this time, generate
  103. // the pidl for future usage.
  104. //
  105. // Arguments:
  106. // (none)
  107. //
  108. // Returns:
  109. //
  110. // Author: jeffspr 10 Jan 1999
  111. //
  112. // Notes:
  113. //
  114. PCONFOLDPIDLFOLDER& CConnectionFolder::PidlGetFolderRoot()
  115. {
  116. TraceFileFunc(ttidConFoldEntry);
  117. HRESULT hr = S_OK;
  118. if (m_pidlFolderRoot.empty())
  119. {
  120. // Ignore this hr. For debugging only
  121. //
  122. hr = HrGetConnectionsFolderPidl(m_pidlFolderRoot);
  123. }
  124. return m_pidlFolderRoot;
  125. }
  126. //+---------------------------------------------------------------------------
  127. //
  128. // Member: CConnectionFolder::pszGetUserName
  129. //
  130. // Purpose: Return the user name of the Connectoid.
  131. // Currently makes the assumption that any active user can only
  132. // read either System Wide or his own Connectoids.
  133. // Probably should cache the user name, however this component
  134. // is MTA and the UserName is per thread.
  135. // I don't want to use up a TLS just for this.
  136. //
  137. // Arguments:
  138. // (none)
  139. //
  140. // Returns:
  141. //
  142. // Author: deonb 19 June 1999
  143. //
  144. // Notes:
  145. //
  146. PCWSTR CConnectionFolder::pszGetUserName()
  147. {
  148. TraceFileFunc(ttidConFoldEntry);
  149. DWORD dwSize = UNLEN+1;
  150. if (GetUserName(m_szUserName, &dwSize))
  151. {
  152. return m_szUserName;
  153. }
  154. else
  155. {
  156. return NULL;
  157. }
  158. };