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.

169 lines
4.5 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997.
  5. //
  6. // File: D I A L U P . H
  7. //
  8. // Contents: Dial-up Connection UI object.
  9. //
  10. // Notes:
  11. //
  12. // Author: shaunco 15 Oct 1997
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. #include "nmbase.h"
  17. #include "nmres.h"
  18. #include "rasconob.h"
  19. #include <rasapip.h>
  20. class ATL_NO_VTABLE CDialupConnection :
  21. public CComObjectRootEx <CComMultiThreadModel>,
  22. public CComCoClass <CDialupConnection,
  23. &CLSID_DialupConnection>,
  24. public CRasConnectionBase,
  25. public INetConnection,
  26. public INetRasConnection,
  27. public IPersistNetConnection,
  28. public INetConnectionBrandingInfo,
  29. public INetDefaultConnection,
  30. public INetConnection2
  31. {
  32. public:
  33. CDialupConnection () : CRasConnectionBase ()
  34. {
  35. m_fCmPathsLoaded = FALSE;
  36. }
  37. DECLARE_REGISTRY_RESOURCEID(IDR_DIALUP_CONNECTION)
  38. BEGIN_COM_MAP(CDialupConnection)
  39. COM_INTERFACE_ENTRY(INetConnection)
  40. COM_INTERFACE_ENTRY(INetConnection2)
  41. COM_INTERFACE_ENTRY(INetRasConnection)
  42. COM_INTERFACE_ENTRY(INetDefaultConnection)
  43. COM_INTERFACE_ENTRY(IPersistNetConnection)
  44. COM_INTERFACE_ENTRY(INetConnectionBrandingInfo)
  45. END_COM_MAP()
  46. // INetConnection
  47. STDMETHOD (Connect) ();
  48. STDMETHOD (Disconnect) ();
  49. STDMETHOD (Delete) ();
  50. STDMETHOD (Duplicate) (
  51. PCWSTR pszDuplicateName,
  52. INetConnection** ppCon);
  53. STDMETHOD (GetProperties) (
  54. NETCON_PROPERTIES** ppProps);
  55. STDMETHOD (GetUiObjectClassId) (
  56. CLSID* pclsid);
  57. STDMETHOD (Rename) (
  58. PCWSTR pszNewName);
  59. // INetRasConnection
  60. STDMETHOD (GetRasConnectionInfo) (
  61. RASCON_INFO* pRasConInfo);
  62. STDMETHOD (SetRasConnectionInfo) (
  63. const RASCON_INFO* pRasConInfo);
  64. STDMETHOD (GetRasConnectionHandle) (
  65. ULONG_PTR* phRasConn);
  66. // IPersistNetConnection
  67. STDMETHOD (GetClassID) (
  68. CLSID* pclsid);
  69. STDMETHOD (GetSizeMax) (
  70. ULONG* pcbSize);
  71. STDMETHOD (Load) (
  72. const BYTE* pbBuf,
  73. ULONG cbSize);
  74. STDMETHOD (Save) (
  75. BYTE* pbBuf,
  76. ULONG cbSize);
  77. // INetConnectionBrandingInfo
  78. STDMETHOD (GetBrandingIconPaths) (CON_BRANDING_INFO ** ppConBrandInfo);
  79. STDMETHOD (GetTrayMenuEntries)(CON_TRAY_MENU_DATA ** ppMenuData);
  80. // INetDefaultConnection
  81. STDMETHOD (SetDefault (BOOL bDefault));
  82. STDMETHOD (GetDefault (BOOL* pbDefault));
  83. // INetConnection2
  84. STDMETHOD (GetPropertiesEx)(OUT NETCON_PROPERTIES_EX** ppConnectionPropertiesEx);
  85. private:
  86. // Private Vars to hold the paths to the CM file and keep track if they have been loaded or not.
  87. //
  88. tstring m_strCmsFile;
  89. tstring m_strProfileDir;
  90. tstring m_strShortServiceName;
  91. tstring m_strCmDir;
  92. BOOL m_fCmPathsLoaded;
  93. // Private Accessor functions for the above strings
  94. //
  95. PCWSTR
  96. PszwCmsFile ()
  97. {
  98. AssertH (!m_strCmsFile.empty());
  99. return m_strCmsFile.c_str();
  100. }
  101. PCWSTR
  102. PszwProfileDir ()
  103. {
  104. AssertH (!m_strProfileDir.empty());
  105. return m_strProfileDir.c_str();
  106. }
  107. PCWSTR
  108. PszwCmDir ()
  109. {
  110. AssertH (!m_strCmDir.empty());
  111. return m_strCmDir.c_str();
  112. }
  113. PCWSTR
  114. PszwShortServiceName ()
  115. {
  116. AssertH (!m_strShortServiceName.empty());
  117. return m_strShortServiceName.c_str();
  118. }
  119. // Private methods for handling of type NCT_Internet
  120. HRESULT HrGetCmpFileLocation(PCWSTR pszPhonebook, PCWSTR pszEntryName, PWSTR pszCmpFilePath);
  121. HRESULT HrEnsureCmStringsLoaded();
  122. HRESULT HrGetPrivateProfileSectionWithAlloc(WCHAR** pszwSection, int* nSize);
  123. HRESULT HrGetMenuNameAndCmdLine(PWSTR pszString, PWSTR pszName, PWSTR pszProgram, PWSTR pszParams);
  124. HRESULT HrFillInConTrayMenuEntry(PCWSTR pszName, PCWSTR pszCmdLine, PCWSTR pszParams, CON_TRAY_MENU_ENTRY* pMenuEntry);
  125. public:
  126. static HRESULT
  127. CreateInstanceUninitialized (
  128. REFIID riid,
  129. VOID** ppv,
  130. CDialupConnection** ppObj);
  131. static HRESULT
  132. CreateInstanceFromDetails (
  133. const RASENUMENTRYDETAILS* pEntryDetails,
  134. REFIID riid,
  135. VOID** ppv);
  136. static HRESULT
  137. CreateInstanceFromPbkFileAndEntryName (
  138. PCWSTR pszwPbkFile,
  139. PCWSTR pszwEntryName,
  140. REFIID riid,
  141. VOID** ppv);
  142. };