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.

210 lines
5.3 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997.
  5. //
  6. // File: R A S C O N O B . H
  7. //
  8. // Contents: Declares the base class used to implement the Dialup, Direct,
  9. // and Vpn connection objects. Also includes RAS-related
  10. // utility functions used only within netman.exe.
  11. //
  12. // Notes:
  13. //
  14. // Author: shaunco 23 Sep 1997
  15. //
  16. //----------------------------------------------------------------------------
  17. #pragma once
  18. #include "netconp.h"
  19. #include "nmhnet.h"
  20. #include <ras.h>
  21. #include <rasapip.h>
  22. class CRasConnectionBase
  23. {
  24. protected:
  25. BOOL m_fInitialized;
  26. // These are the 'primary id' for the connection. Every property of
  27. // a connection can be obtained using these two pieces of information.
  28. //
  29. tstring m_strPbkFile;
  30. GUID m_guidId;
  31. // m_fEntryPropertiesCached is set to TRUE after the first call
  32. // to HrEnsureEntryPropertiesCached. The following members are cached
  33. // as a result of this.
  34. //
  35. BOOL m_fEntryPropertiesCached;
  36. LONG m_lRasEntryModifiedVersionEra;
  37. tstring m_strEntryName;
  38. tstring m_strDeviceName;
  39. BOOL m_fBranded;
  40. BOOL m_fForAllUsers;
  41. BOOL m_fShowMonitorIconInTaskBar;
  42. NETCON_MEDIATYPE m_MediaType;
  43. DWORD m_dwFlagsPriv;
  44. tstring m_strPhoneNumber;
  45. // This is required for checking permission on Firewall etc.
  46. CComPtr<INetMachinePolicies> m_pNetMachinePolicies;
  47. // Home networking support. m_fHNetPropertiesCached is set to TRUE
  48. // after the first successful call to HrEnsureHNetPropertiesCached.
  49. //
  50. BOOL m_fHNetPropertiesCached;
  51. LONG m_lHNetModifiedEra;
  52. LONG m_lUpdatingHNetProperties;
  53. HNET_CONN_PROPERTIES m_HNetProperties;
  54. protected:
  55. CRasConnectionBase () throw()
  56. {
  57. // Warning: this class should never have any virtual methods
  58. // or derive from a class with virtual methods. If it does,
  59. // you'll have to remove the ZeroMemory and replace it with
  60. // induhvidual moves. (Did you catch the Dilbert reference?)
  61. //
  62. ZeroMemory (this, sizeof(CRasConnectionBase));
  63. }
  64. BOOL FAllowRemoval (
  65. OUT HRESULT* phReason) throw();
  66. BOOL
  67. FIsBranded () throw()
  68. {
  69. AssertH (m_fEntryPropertiesCached);
  70. return m_fBranded;
  71. }
  72. BOOL
  73. FShowIcon () throw()
  74. {
  75. AssertH (m_fEntryPropertiesCached);
  76. return m_fShowMonitorIconInTaskBar;
  77. }
  78. GUID
  79. GuidId () throw()
  80. {
  81. AssertH (m_fEntryPropertiesCached);
  82. AssertH (m_guidId != GUID_NULL);
  83. return m_guidId;
  84. }
  85. PCWSTR
  86. PszwPbkFile () throw()
  87. {
  88. AssertH (!m_strPbkFile.empty());
  89. return m_strPbkFile.c_str();
  90. }
  91. PCWSTR
  92. PszwEntryName () throw()
  93. {
  94. AssertH (!m_strEntryName.empty());
  95. return m_strEntryName.c_str();
  96. }
  97. VOID
  98. SetPbkFile (
  99. PCWSTR pszwPbkFile) throw()
  100. {
  101. AssertH (pszwPbkFile);
  102. m_strPbkFile = pszwPbkFile;
  103. AssertH (!m_strPbkFile.empty());
  104. }
  105. VOID
  106. SetEntryName (
  107. PCWSTR pszwEntryName) throw()
  108. {
  109. AssertH (pszwEntryName);
  110. m_strEntryName = pszwEntryName;
  111. AssertH (!m_strEntryName.empty());
  112. }
  113. PCWSTR
  114. PszwDeviceName () throw()
  115. {
  116. AssertH (m_fEntryPropertiesCached);
  117. return (!m_strDeviceName.empty()) ? m_strDeviceName.c_str()
  118. : NULL;
  119. }
  120. NETCON_MEDIATYPE
  121. MediaType () throw()
  122. {
  123. AssertH (m_fEntryPropertiesCached);
  124. return m_MediaType;
  125. }
  126. VOID
  127. CacheProperties (
  128. IN const RASENUMENTRYDETAILS* pDetails) throw();
  129. HRESULT
  130. HrEnsureEntryPropertiesCached ();
  131. HRESULT
  132. HrFindRasConn (
  133. OUT HRASCONN* phRasConn,
  134. OUT RASCONN* pRasConn OPTIONAL);
  135. HRESULT HrGetCharacteristics (
  136. OUT DWORD* pFlags);
  137. HRESULT HrGetStatus (
  138. OUT NETCON_STATUS* pStatus);
  139. HRESULT
  140. HrLockAndRenameEntry (
  141. IN PCWSTR pszwNewName,
  142. IN CComObjectRootEx <CComMultiThreadModel>* pObj);
  143. HRESULT
  144. HrGetRasConnectionInfo (
  145. OUT RASCON_INFO* pRasConInfo);
  146. HRESULT
  147. HrSetRasConnectionInfo (
  148. IN const RASCON_INFO* pRasConInfo);
  149. HRESULT
  150. HrGetRasConnectionHandle (
  151. OUT HRASCONN* phRasConn);
  152. HRESULT
  153. HrPersistGetSizeMax (
  154. OUT ULONG* pcbSize);
  155. HRESULT
  156. HrPersistLoad (
  157. IN const BYTE* pbBuf,
  158. IN ULONG cbSize);
  159. HRESULT
  160. HrPersistSave (
  161. OUT BYTE* pbBuf,
  162. IN ULONG cbSize);
  163. HRESULT
  164. HrEnsureHNetPropertiesCached ();
  165. HRESULT
  166. HrGetIHNetConnection (
  167. OUT IHNetConnection **ppHNetConnection);
  168. HRESULT
  169. HrIsConnectionFirewalled(
  170. OUT BOOL* pfFirewalled);
  171. HRESULT
  172. HrEnsureValidNlaPolicyEngine();
  173. };