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.

179 lines
6.2 KiB

  1. //+----------------------------------------------------------------------------
  2. //
  3. // File: netsettings.h
  4. //
  5. // Module: CMAK.EXE
  6. //
  7. // Synopsis: Function headers and structures dealing with network
  8. // settings (DUN settings)
  9. //
  10. // Copyright (c) 2000 Microsoft Corporation
  11. //
  12. // Author: quintinb Created 03/22/00
  13. //
  14. //+----------------------------------------------------------------------------
  15. #define SAME_ON_ALL_PLATFORMS 0
  16. #define SEPARATE_FOR_LEGACY_AND_WIN2K 1
  17. #define FORCE_WIN2K_AND_ABOVE 2
  18. class CDunSetting
  19. {
  20. public:
  21. //
  22. // Functions
  23. //
  24. CDunSetting(BOOL bTunnel = FALSE);
  25. ~CDunSetting();
  26. //
  27. // Basic Settings
  28. //
  29. BOOL bNetworkLogon; // defaults to zero on Dialup but 1 on Tunnel
  30. BOOL bPppSoftwareCompression;
  31. BOOL bDisableLCP;
  32. TCHAR szScript[MAX_PATH+1];
  33. DWORD dwVpnStrategy;
  34. BOOL bTunnelDunSetting;
  35. //
  36. // TCP/IP Settings
  37. //
  38. DWORD dwPrimaryDns;
  39. DWORD dwSecondaryDns;
  40. DWORD dwPrimaryWins;
  41. DWORD dwSecondaryWins;
  42. BOOL bIpHeaderCompression;
  43. BOOL bGatewayOnRemote;
  44. //
  45. // Security Settings
  46. //
  47. BOOL bPWEncrypt;
  48. BOOL bPWEncrypt_MS;
  49. BOOL bDataEncrypt;
  50. DWORD dwEncryptionType;
  51. BOOL bAllowPap;
  52. BOOL bAllowSpap;
  53. BOOL bAllowEap;
  54. BOOL bAllowChap;
  55. BOOL bAllowMsChap;
  56. BOOL bAllowMsChap2;
  57. BOOL bAllowW95MsChap;
  58. BOOL bSecureLocalFiles;
  59. int iHowToHandleSecuritySettings;
  60. //
  61. // EAP Data
  62. //
  63. DWORD dwCustomAuthKey;
  64. LPBYTE pCustomAuthData;
  65. DWORD dwCustomAuthDataSize;
  66. //
  67. // Pre-shared Key
  68. //
  69. BOOL bUsePresharedKey;
  70. };
  71. //
  72. // From RAS\UI\COMMON\PBK\UTIL.C
  73. //
  74. #ifndef EAP_CUSTOM_DATA
  75. #define EAP_CUSTOM_KEY 0x43424431
  76. typedef struct _EAP_CUSTOM_DATA
  77. {
  78. DWORD dwSignature;
  79. DWORD dwCustomAuthKey;
  80. DWORD dwSize;
  81. BYTE abdata[1];
  82. } EAP_CUSTOM_DATA;
  83. #endif
  84. typedef struct EAPDataStruct
  85. {
  86. DWORD dwCustomAuthKey;
  87. LPBYTE pCustomAuthData;
  88. DWORD dwCustomAuthDataSize;
  89. LPTSTR pszFriendlyName;
  90. LPTSTR pszConfigDllPath;
  91. BOOL bSupportsEncryption;
  92. BOOL bMustConfig;
  93. BOOL bNotInstalled;
  94. }EAPData;
  95. typedef struct GetBoolSettingsStruct
  96. {
  97. LPCTSTR pszKeyName;
  98. LPBOOL pbValue;
  99. BOOL bDefault;
  100. }GetBoolSettings;
  101. typedef struct SetBoolSettingsStruct
  102. {
  103. LPTSTR pszSectionName;
  104. LPCTSTR pszKeyName;
  105. BOOL bValue;
  106. }SetBoolSettings;
  107. BOOL ReadDunServerSettings(LPCTSTR pszSectionName, CDunSetting* pDunSetting, LPCTSTR pszCmsFile, BOOL bTunnelDunSetting);
  108. BOOL ReadDunNetworkingSettings(LPCTSTR pszSectionName, CDunSetting* pDunSetting, LPCTSTR pszCmsFile, BOOL bTunnel);
  109. DWORD ConvertIpStringToDword(LPTSTR pszIpAddress);
  110. int ConvertIpDwordToString(DWORD dwIpAddress, LPTSTR pszIpAddress);
  111. BOOL ReadDunTcpIpSettings(LPCTSTR pszSectionName, CDunSetting* pDunSetting, LPCTSTR pszCmsFile);
  112. BOOL ReadDunScriptingSettings(LPCTSTR pszSectionName, CDunSetting* pDunSetting, LPCTSTR pszOsDir, LPCTSTR pszCmsFile);
  113. BOOL AddDunNameToListIfDoesNotExist(LPCTSTR pszDunName, ListBxList **pHeadDns, ListBxList** pTailDns, BOOL bTunnelDunName);
  114. BOOL GetDunEntryNamesFromPbk(LPCTSTR pszPhoneBook, ListBxList **pHeadDns, ListBxList** pTailDns);
  115. BOOL ReadNetworkSettings(LPCTSTR pszCmsFile, LPCTSTR pszLongServiceName, LPCTSTR pszPhoneBook,
  116. ListBxList **pHeadDns, ListBxList** pTailDns, LPCTSTR pszOsDir, BOOL bLookingForVpnEntries);
  117. void WriteOutNetworkingEntry(LPCTSTR pszDunName, CDunSetting* pDunSetting, LPCTSTR pszShortServiceName, LPCTSTR pszCmsFile);
  118. void EraseNetworkingSections(LPCTSTR pszDunName, LPCTSTR pszCmsFile);
  119. void WriteNetworkingEntries(LPCTSTR pszCmsFile, LPCTSTR pszLongServiceName, LPCTSTR pszShortServiceName, ListBxList *pHeadDns);
  120. void EnableAppropriateSecurityControls(HWND hDlg);
  121. void EnableDisableSecurityButtons(HWND hDlg);
  122. INT_PTR CreateNetworkingEntryPropertySheet(HINSTANCE hInstance, HWND hWizard, LPARAM lParam, BOOL bEdit);
  123. void OnProcessDunEntriesAdd(HINSTANCE hInstance, HWND hDlg, UINT uListCtrlId, ListBxStruct** pHeadDns, ListBxStruct** pTailDns, BOOL bCreateTunnelEntry, LPCTSTR pszLongServiceName, LPCTSTR pszCmsFile);
  124. void OnProcessDunEntriesEdit(HINSTANCE hInstance, HWND hDlg, UINT uListCtrlId, ListBxStruct** pHeadDns, ListBxStruct** pTailDns, LPCTSTR pszLongServiceName, LPCTSTR pszCmsFile);
  125. void OnProcessDunEntriesDelete(HINSTANCE hInstance, HWND hDlg, UINT uListCtrlId, ListBxStruct** pHeadDns, ListBxStruct** pTailDns, LPCTSTR pszLongServiceName, LPCTSTR pszCmsFile);
  126. void EnableDisableIpAddressControls(HWND hDlg);
  127. INT_PTR APIENTRY ProcessSecurityPopup(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
  128. INT_PTR APIENTRY ProcessWin2kSecurityPopup(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
  129. INT_PTR APIENTRY GeneralPropSheetProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
  130. INT_PTR APIENTRY TcpIpPropSheetProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
  131. INT_PTR APIENTRY SecurityPropSheetProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
  132. void RefreshDnsList(HINSTANCE hInstance, HWND hDlg, UINT uCtrlId, ListBxList * pHead, LPCTSTR pszLongServiceName, LPCTSTR pszCmsFile, LPTSTR pszItemToSelect);
  133. HRESULT HrAddAvailableEAPsToCombo(HWND hDlg, UINT uCtrlId, CDunSetting* pDunSetting);
  134. HRESULT HrQueryRegStringWithAlloc(HKEY hKey, LPCTSTR pszValueName, TCHAR** ppszReturnString);
  135. void SelectAppropriateEAP(HWND hDlg, UINT uCtrlId, CDunSetting* pDunSetting);
  136. void FreeEapData(HWND hDlg, UINT uCtrlId);
  137. BOOL ReadDunSettingsEapData(LPCTSTR pszSection, LPBYTE* ppbEapData, LPDWORD pdwEapSize, const DWORD dwCustomAuthKey, LPCTSTR pszCmsFile);
  138. HRESULT WriteDunSettingsEapData(LPCTSTR pszSection, CDunSetting* pDunSetting, LPCTSTR pszCmsFile);
  139. HRESULT EraseDunSettingsEapData(LPCTSTR pszSection, LPCTSTR pszCmsFile);
  140. BYTE HexValue(IN CHAR ch);
  141. CHAR HexChar(IN BYTE byte);
  142. void FreeDnsList(ListBxList ** pHeadPtr, ListBxList ** pTailPtr);
  143. void EnableDisableDunEntryButtons(HINSTANCE hInstance, HWND hDlg, LPCTSTR pszCmsFile, LPCTSTR pszLongServiceName);
  144. int MapEncryptionTypeToComboId(DWORD dwEncryptionType);
  145. DWORD MapComboIdToEncryptionType(INT_PTR iComboIndex);
  146. BOOL VerifyVpnFile(LPCTSTR pszVpnFile);
  147. BOOL CheckForDUNversusVPNNameConflicts(HWND hDlg, ListBxList * pHeadDunEntry, ListBxList * pHeadVpnEntry);