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.

245 lines
10 KiB

  1. // Copyright (c) 1995, Microsoft Corporation, all rights reserved
  2. //
  3. // pbkp.h
  4. // Remote Access phonebook file (.PBK) library
  5. // Private header
  6. //
  7. // 06/20/95 Steve Cobb
  8. #ifndef _PBKP_H_
  9. #define _PBKP_H_
  10. #include <windows.h>
  11. #include <pbk.h> // RAS phonebook library (our public header)
  12. #include <stdlib.h> // ltoa
  13. #include <debug.h> // Trace/Assert library
  14. #include <ras.h> // Win32 RAS header, for constants
  15. #include <serial.h> // RAS serial media header, for SERIAL_TXT, SER_*
  16. #include <tchar.h> // TCHAR equivalents for CRT
  17. #include <isdn.h> // RAS ISDN media header, for ISDN_TXT, for ISDN_*
  18. #include <x25.h> // RAS X.25 media header, for X25_TXT
  19. #include <rasmxs.h> // RAS modem/X.25/switch device header, for MXS_*
  20. #include <PbkCache.h>
  21. //----------------------------------------------------------------------------
  22. // Constants
  23. //----------------------------------------------------------------------------
  24. // PBK file section names.
  25. //
  26. #define GLOBALSECTIONNAME "."
  27. // PBK file key names.
  28. //
  29. #define KEY_Port "Port"
  30. #define KEY_InitBps SER_CONNECTBPS_KEY
  31. #define KEY_HwFlow MXS_HDWFLOWCONTROL_KEY
  32. #define KEY_Ec MXS_PROTOCOL_KEY
  33. #define KEY_Ecc MXS_COMPRESSION_KEY
  34. #define KEY_PhoneNumber "PhoneNumber"
  35. #define KEY_PromoteAlternates "PromoteAlternates"
  36. #define KEY_AutoLogon "AutoLogon"
  37. #define KEY_Domain "Domain"
  38. #define KEY_User "User"
  39. #define KEY_UID "DialParamsUID"
  40. #define KEY_SavePw "SavePw"
  41. #define KEY_Device "Device"
  42. #define KEY_SwCompression "SwCompression"
  43. #define KEY_NegotiateMultilinkAlways "NegotiateMultilinkAlways"
  44. #define KEY_UseCountryAndAreaCodes "UseCountryAndAreaCodes"
  45. #define KEY_AreaCode "AreaCode"
  46. #define KEY_CountryID "CountryID"
  47. #define KEY_CountryCode "CountryCode"
  48. #define KEY_DialMode "DialMode"
  49. #define KEY_DialPercent "DialPercent"
  50. #define KEY_DialSeconds "DialSeconds"
  51. #define KEY_HangUpPercent "HangUpPercent"
  52. #define KEY_HangUpSeconds "HangUpSeconds"
  53. #define KEY_AuthRestrictions "AuthRestrictions"
  54. #define KEY_TypicalAuth "TypicalAuth"
  55. #define KEY_TapiBlob "TapiBlob"
  56. #define KEY_Type "Type"
  57. #define KEY_PAD_Type MXS_X25PAD_KEY
  58. #define KEY_PAD_Address MXS_X25ADDRESS_KEY
  59. #define KEY_PAD_UserData MXS_USERDATA_KEY
  60. #define KEY_PAD_Facilities MXS_FACILITIES_KEY
  61. #define KEY_X25_Address X25_ADDRESS_KEY
  62. #define KEY_X25_UserData X25_USERDATA_KEY
  63. #define KEY_X25_Facilities X25_FACILITIES_KEY
  64. #define KEY_RedialAttempts "RedialAttempts"
  65. #define KEY_RedialPauseSecs "RedialPauseSecs"
  66. #define KEY_RedialOnLinkFailure "RedialOnLinkFailure"
  67. #define KEY_CallbackNumber "CallbackNumber"
  68. #define KEY_ExcludedProtocols "ExcludedProtocols"
  69. #define KEY_LcpExtensions "LcpExtensions"
  70. #define KEY_Authentication "Authentication"
  71. #define KEY_BaseProtocol "BaseProtocol"
  72. #define KEY_VpnStrategy "VpnStrategy"
  73. #define KEY_Item "Item"
  74. #define KEY_Selection "Selection"
  75. #define KEY_SlipHeaderCompression "SlipHeaderCompression"
  76. #define KEY_SlipFrameSize "SlipFrameSize"
  77. #define KEY_SlipIpAddress "SlipIpAddress"
  78. #define KEY_SlipPrioritizeRemote "SlipPrioritizeRemote"
  79. #define KEY_PppIpPrioritizeRemote "PppIpPrioritizeRemote"
  80. #define KEY_PppIpVjCompression "PppIpVjCompression"
  81. #define KEY_PppIpAddress "PppIpAddress"
  82. #define KEY_PppIpAddressSource "PppIpAssign"
  83. #define KEY_PppIpDnsAddress "PppIpDnsAddress"
  84. #define KEY_PppIpDns2Address "PppIpDns2Address"
  85. #define KEY_PppIpWinsAddress "PppIpWinsAddress"
  86. #define KEY_PppIpWins2Address "PppIpWins2Address"
  87. #define KEY_PppIpNameSource "PppIpNameAssign"
  88. #define KEY_IpPrioritizeRemote "IpPrioritizeRemote"
  89. #define KEY_IpHeaderCompression "IpHeaderCompression"
  90. #define KEY_IpAddress "IpAddress"
  91. #define KEY_IpAddressSource "IpAssign"
  92. #define KEY_IpDnsAddress "IpDnsAddress"
  93. #define KEY_IpDns2Address "IpDns2Address"
  94. #define KEY_IpWinsAddress "IpWinsAddress"
  95. #define KEY_IpWins2Address "IpWins2Address"
  96. #define KEY_IpNameSource "IpNameAssign"
  97. #define KEY_IpFrameSize "IpFrameSize"
  98. #define KEY_IpDnsFlags "IpDnsFlags"
  99. #define KEY_IpNbtFlags "IpNBTFlags"
  100. #define KEY_TcpWindowSize "TcpWindowSize"
  101. #define KEY_IpDnsSuffix "IpDnsSuffix"
  102. #define KEY_SkipNwcWarning "SkipNwcWarning"
  103. #define KEY_SkipDownLevelDialog "SkipDownLevelDialog"
  104. #define KEY_SkipDoubleDialDialog "SkipDoubleDialDialog"
  105. #define KEY_PppTextAuthentication "PppTextAuthentication"
  106. #define KEY_DataEncryption "DataEncryption"
  107. #define KEY_CustomDialDll "CustomDialDll"
  108. #define KEY_CustomDialFunc "CustomDialFunc"
  109. #define KEY_CustomDialerName "CustomRasDialDll"
  110. #define KEY_IdleDisconnectSeconds "IdleDisconnectSeconds"
  111. #define KEY_SecureLocalFiles "SecureLocalFiles"
  112. #define KEY_LineType ISDN_LINETYPE_KEY
  113. #define KEY_Fallback ISDN_FALLBACK_KEY
  114. #define KEY_Compression ISDN_COMPRESSION_KEY
  115. #define KEY_Channels ISDN_CHANNEL_AGG_KEY
  116. #define KEY_Description "Description"
  117. #define KEY_Speaker "Speaker"
  118. #define KEY_MdmProtocol "MdmProtocol"
  119. #define KEY_ProprietaryIsdn "Proprietary"
  120. #define KEY_DisableModemSpeaker "DisableModemSpeaker"
  121. #define KEY_DisableSwCompression "DisableSwCompression"
  122. #define KEY_OtherPortOk "OtherPortOk"
  123. #define KEY_OverridePref "OverridePref"
  124. #define KEY_RedialAttempts "RedialAttempts"
  125. #define KEY_RedialSeconds "RedialSeconds"
  126. #define KEY_RedialOnLinkFailure "RedialOnLinkFailure"
  127. #define KEY_CallbackMode "CallbackMode"
  128. #define KEY_AuthenticateServer "AuthenticateServer"
  129. #define KEY_ShareMsFilePrint "ShareMsFilePrint"
  130. #define KEY_BindMsNetClient "BindMsNetClient"
  131. #define KEY_SharedPhoneNumbers "SharedPhoneNumbers"
  132. #define KEY_GlobalDeviceSettings "GlobalDeviceSettings" // whist bug 281306
  133. #define KEY_PrerequisiteEntry "PrerequisiteEntry"
  134. #define KEY_PrerequisitePbk "PrerequisitePbk"
  135. #define KEY_PreferredPort "PreferredPort"
  136. #define KEY_PreferredDevice "PreferredDevice"
  137. #define KEY_PreferredModemProtocol "PreferredMdmProtocol" //whistler 402522
  138. #define KEY_PreferredBps "PreferredBps" //.Net 639551
  139. #define KEY_PreferredHwFlow "PreferredHwFlow" //.Net 639551
  140. #define KEY_PreferredEc "PreferredProtocol" //.Net 639551
  141. #define KEY_PreferredEcc "PreferredCompression" //.Net 639551
  142. #define KEY_PreferredSpeaker "PreferredSpeaker" //.Net 639551
  143. #define KEY_PreviewUserPw "PreviewUserPw"
  144. #define KEY_PreviewDomain "PreviewDomain"
  145. #define KEY_PreviewPhoneNumber "PreviewPhoneNumber"
  146. #define KEY_ShowDialingProgress "ShowDialingProgress"
  147. #define KEY_CustomScript "CustomScript"
  148. #define KEY_Comment "Comment"
  149. #define KEY_UseDialingRules "UseDialingRules"
  150. #define KEY_TryNextAlternateOnFail "TryNextAlternateOnFail"
  151. #define KEY_ShowMonitorIconInTaskBar "ShowMonitorIconInTaskBar"
  152. #define KEY_Guid "Guid"
  153. #define KEY_SharePhoneNumbers "SharePhoneNumbers"
  154. #define KEY_CustomAuthKey "CustomAuthKey"
  155. #define KEY_CustomAuthStdCreds "CustomAuthStdCreds"
  156. #define KEY_CustomAuthData "CustomAuthData"
  157. #define KEY_Terminal "Terminal"
  158. #define KEY_Script "Script"
  159. #define KEY_Name "Name"
  160. #define KEY_LastSelectedPhone "LastSelectedPhone"
  161. #define KEY_Version "Version"
  162. #define KEY_Encoding "Encoding"
  163. #define KEY_UseRasCredentials "UseRasCredentials"
  164. #define KEY_IpSecFlags "IpSecFlags" //For whistler bug 193987
  165. #define KEY_UseFlags "UseFlags" // Special uses for connection
  166. // The switch device type text value written to the phonebook file.
  167. //
  168. #define SM_TerminalText "Terminal"
  169. // Whistler 326015 PBK: if ATM device name is NULL, we should seek out a device
  170. // name just like w/serial/ISDN
  171. //
  172. #define S_WIN9XATM "ATM"
  173. #define S_SYSRASDIR TEXT("\\System32\\Ras")
  174. #define S_SYSRASDIR_LENGTH ((sizeof(S_SYSRASDIR)) / sizeof(TCHAR))
  175. //----------------------------------------------------------------------------
  176. // Prototypes
  177. //----------------------------------------------------------------------------
  178. BOOL
  179. IsDeviceLine(
  180. IN CHAR* pszText );
  181. BOOL
  182. IsMediaLine(
  183. IN CHAR* pszText );
  184. BOOL
  185. IsNetComponentsLine(
  186. IN CHAR* pszText );
  187. BOOL
  188. IsServerOS ( );
  189. typedef struct _PbkPathInfo
  190. {
  191. CRITICAL_SECTION csLock;
  192. BOOL fLoaded;
  193. HMODULE hSwapiDll; // Handle to shlwapi.dll instance
  194. FARPROC pPathCanonicalize; // shlwapi!PathCanonicalize
  195. FARPROC pPathRemoveFileSpec; // shlwapi!PathRemoveFileSpec
  196. TCHAR* pszAllUsers; // Canonicalized all user profile path
  197. TCHAR* pszSysRas; // Canonicalized system32\ras path
  198. } PbkPathInfo;
  199. DWORD
  200. PbkPathInfoInit(
  201. IN PbkPathInfo* pInfo);
  202. DWORD
  203. PbkPathInfoLoad(
  204. OUT PbkPathInfo* pInfo);
  205. DWORD
  206. PbkPathInfoClear(
  207. OUT PbkPathInfo* pInfo);
  208. extern PbkPathInfo g_PbkPathInfo;
  209. DWORD
  210. ReadPhonebookFileEx(
  211. IN LPCTSTR pszPhonebookPath,
  212. IN PBUSER* pUser,
  213. IN LPCTSTR pszSection,
  214. IN DWORD dwFlags,
  215. OUT PBFILE* pFile,
  216. OUT OPTIONAL FILETIME* pTime);
  217. #ifdef _PBK_CACHE_
  218. DWORD
  219. GetFileLastWriteTime(
  220. IN PWCHAR pwszFileName,
  221. OUT FILETIME* pTime );
  222. #endif
  223. #endif // _PBKP_H_