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.

169 lines
4.9 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 () throw() : 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. IN PCWSTR pszDuplicateName,
  52. OUT INetConnection** ppCon);
  53. STDMETHOD (GetProperties) (
  54. OUT NETCON_PROPERTIES** ppProps);
  55. STDMETHOD (GetUiObjectClassId) (
  56. OUT CLSID* pclsid);
  57. STDMETHOD (Rename) (
  58. IN PCWSTR pszNewName);
  59. // INetRasConnection
  60. STDMETHOD (GetRasConnectionInfo) (
  61. OUT RASCON_INFO* pRasConInfo);
  62. STDMETHOD (SetRasConnectionInfo) (
  63. IN const RASCON_INFO* pRasConInfo);
  64. STDMETHOD (GetRasConnectionHandle) (
  65. OUT ULONG_PTR* phRasConn);
  66. // IPersistNetConnection
  67. STDMETHOD (GetClassID) (
  68. OUT CLSID* pclsid);
  69. STDMETHOD (GetSizeMax) (
  70. OUT ULONG* pcbSize);
  71. STDMETHOD (Load) (
  72. IN const BYTE* pbBuf,
  73. IN ULONG cbSize);
  74. STDMETHOD (Save) (
  75. OUT BYTE* pbBuf,
  76. IN ULONG cbSize);
  77. // INetConnectionBrandingInfo
  78. STDMETHOD (GetBrandingIconPaths) (OUT CON_BRANDING_INFO ** ppConBrandInfo);
  79. STDMETHOD (GetTrayMenuEntries)(OUT CON_TRAY_MENU_DATA ** ppMenuData);
  80. // INetDefaultConnection
  81. STDMETHOD (SetDefault (IN BOOL bDefault));
  82. STDMETHOD (GetDefault (OUT 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 () throw()
  97. {
  98. AssertH (!m_strCmsFile.empty());
  99. return m_strCmsFile.c_str();
  100. }
  101. PCWSTR
  102. PszwProfileDir () throw()
  103. {
  104. AssertH (!m_strProfileDir.empty());
  105. return m_strProfileDir.c_str();
  106. }
  107. PCWSTR
  108. PszwCmDir () throw()
  109. {
  110. AssertH (!m_strCmDir.empty());
  111. return m_strCmDir.c_str();
  112. }
  113. PCWSTR
  114. PszwShortServiceName () throw()
  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(IN PCWSTR pszPhonebook, IN PCWSTR pszEntryName, OUT PWSTR pszCmpFilePath);
  121. HRESULT HrEnsureCmStringsLoaded();
  122. HRESULT HrGetPrivateProfileSectionWithAlloc(OUT WCHAR** pszwSection, OUT int* nSize);
  123. HRESULT HrGetMenuNameAndCmdLine(IN PCWSTR pszString, OUT PWSTR pszName, OUT PWSTR pszProgram, OUT PWSTR pszParams);
  124. HRESULT HrFillInConTrayMenuEntry(IN PCWSTR pszName, IN PCWSTR pszCmdLine, IN PCWSTR pszParams, OUT CON_TRAY_MENU_ENTRY* pMenuEntry);
  125. public:
  126. static HRESULT
  127. CreateInstanceUninitialized (
  128. IN REFIID riid,
  129. OUT VOID** ppv,
  130. OUT CDialupConnection** ppObj);
  131. static HRESULT
  132. CreateInstanceFromDetails (
  133. const RASENUMENTRYDETAILS* pEntryDetails,
  134. REFIID riid,
  135. VOID** ppv);
  136. static HRESULT
  137. CreateInstanceFromPbkFileAndEntryName (
  138. IN PCWSTR pszwPbkFile,
  139. IN PCWSTR pszwEntryName,
  140. IN REFIID riid,
  141. OUT VOID** ppv);
  142. };