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.

174 lines
6.3 KiB

  1. // Pre-compiled header for Passport Manager config/admin tool
  2. #include <windows.h>
  3. #include <windowsx.h>
  4. #include <commctrl.h>
  5. #include <commdlg.h>
  6. #include <winsock.h>
  7. #include <wininet.h> // for INTERNET_MAX_URL_LENGTH
  8. #include <shlobj.h>
  9. #include <shlwapi.h>
  10. #include <tchar.h>
  11. #include "resource.h"
  12. #include "pmhelp.h"
  13. #include "mru.h"
  14. #ifndef GET_WM_COMMAND_ID
  15. #define GET_WM_COMMAND_ID(wp, lp) (wp)
  16. #define GET_WM_COMMAND_HWND(wp, lp) (HWND)(LOWORD(lp))
  17. #define GET_WM_COMMAND_CMD(wp, lp) HIWORD(lp)
  18. #endif
  19. #ifdef WIN32
  20. #define CBACK CALLBACK
  21. #else
  22. #define CBACK _export CALLBACK
  23. #endif
  24. // constant defines
  25. #define MAX_REGISTRY_STRING 256
  26. #define DEFAULT_TIME_WINDOW 14400
  27. #define MIN_TIME_WINDOW_SECONDS 100
  28. #define MAX_TIME_WINDOW_SECONDS 1000000
  29. #define DEFAULT_LANGID 1033
  30. #define MAX_SITEID 0xFFFFFFFF
  31. #define PRODUCTID_LEN 24
  32. #define MAX_TITLE 80
  33. #define MAX_MESSAGE 1024
  34. #define MAX_RESOURCE 255
  35. #define MAX_CONFIGSETNAME 256
  36. #define MAX_IPLEN 16
  37. #define SECONDS_PER_MIN 60
  38. #define SECONDS_PER_HOUR (60 * SECONDS_PER_MIN)
  39. #define SECONDS_PER_DAY (24 * SECONDS_PER_HOUR)
  40. #define VALIDATION_ERROR 1
  41. #define CHANGE_WARNING 2
  42. #define COMPUTER_MRU_SIZE 4
  43. #define FILE_MRU_SIZE 4
  44. // Type defines
  45. typedef struct PMSettings_tag
  46. {
  47. DWORD dwTimeWindow; // Time Window in Seconds
  48. DWORD dwForceSignIn;
  49. DWORD dwLanguageID;
  50. TCHAR szCoBrandTemplate[INTERNET_MAX_URL_LENGTH];
  51. DWORD cbCoBrandTemplate; // Size of the CobBrand template buffer
  52. DWORD dwSiteID;
  53. TCHAR szReturnURL[INTERNET_MAX_URL_LENGTH];
  54. DWORD cbReturnURL; // Size of the ReturnURL buffer
  55. TCHAR szTicketDomain[INTERNET_MAX_URL_LENGTH];
  56. DWORD cbTicketDomain; // Size of the CookieDomain buffer
  57. TCHAR szTicketPath[INTERNET_MAX_URL_LENGTH];
  58. DWORD cbTicketPath; // Size of the CookiePath buffer
  59. TCHAR szProfileDomain[INTERNET_MAX_URL_LENGTH];
  60. DWORD cbProfileDomain; // Size of the CookieDomain buffer
  61. TCHAR szProfilePath[INTERNET_MAX_URL_LENGTH];
  62. DWORD cbProfilePath; // Size of the CookiePath buffer
  63. TCHAR szSecureDomain[INTERNET_MAX_URL_LENGTH];
  64. DWORD cbSecureDomain; // Size of the CookiePath buffer
  65. TCHAR szSecurePath[INTERNET_MAX_URL_LENGTH];
  66. DWORD cbSecurePath; // Size of the CookiePath buffer
  67. TCHAR szDisasterURL[INTERNET_MAX_URL_LENGTH];
  68. DWORD cbDisasterURL; // Size of the DisasterURL buffer
  69. #ifdef DO_KEYSTUFF
  70. DWORD dwCurrentKey;
  71. #endif
  72. DWORD dwDisableCookies;
  73. DWORD dwStandAlone;
  74. TCHAR szHostName[INTERNET_MAX_HOST_NAME_LENGTH];
  75. DWORD cbHostName;
  76. TCHAR szHostIP[MAX_IPLEN];
  77. DWORD cbHostIP;
  78. } PMSETTINGS, FAR * LPPMSETTINGS;
  79. typedef struct LanguageIDMap_tag
  80. {
  81. WORD wLangID;
  82. LPCTSTR lpszLang;
  83. } LANGIDMAP, FAR * LPLANGIDMAP;
  84. // declarations for globals that are shared across modules
  85. extern TCHAR g_szTRUE[];
  86. extern TCHAR g_szFALSE[];
  87. extern TCHAR g_szYes[];
  88. extern TCHAR g_szNo[];
  89. extern HINSTANCE g_hInst;
  90. extern HWND g_hwndMain;
  91. extern PMSETTINGS g_CurrentSettings;
  92. extern PMSETTINGS g_OriginalSettings;
  93. extern TCHAR g_szClassName[];
  94. extern LANGIDMAP g_szLanguageIDMap[];
  95. extern TCHAR g_szInstallPath[];
  96. extern TCHAR g_szPMVersion[];
  97. extern TCHAR g_szHelpFileName[];
  98. extern TCHAR g_szRemoteComputer[];
  99. extern TCHAR g_szPassportReg[];
  100. extern TCHAR g_szPassportSites[];
  101. extern PpMRU g_ComputerMRU;
  102. // These globals are shared by the reg and file config read/write functions
  103. extern TCHAR g_szEncryptionKeyData[];
  104. extern TCHAR g_szInstallDir[];
  105. extern TCHAR g_szVersion[];
  106. extern TCHAR g_szTimeWindow[];
  107. extern TCHAR g_szForceSignIn[];
  108. extern TCHAR g_szLanguageID[];
  109. extern TCHAR g_szCoBrandTemplate[];
  110. extern TCHAR g_szSiteID[];
  111. extern TCHAR g_szReturnURL[];
  112. extern TCHAR g_szTicketDomain[];
  113. extern TCHAR g_szTicketPath[];
  114. extern TCHAR g_szProfileDomain[];
  115. extern TCHAR g_szProfilePath[];
  116. extern TCHAR g_szSecureDomain[];
  117. extern TCHAR g_szSecurePath[];
  118. extern TCHAR g_szCurrentKey[];
  119. extern TCHAR g_szStandAlone[];
  120. extern TCHAR g_szDisableCookies[];
  121. extern TCHAR g_szDisasterURL[];
  122. extern TCHAR g_szHostName[];
  123. extern TCHAR g_szHostIP[];
  124. // declaractions for functions that are shared across modules
  125. BOOL ReadRegConfigSet(HWND hWndDlg, LPPMSETTINGS lpPMConfig, LPTSTR lpszRemoteComputer, LPTSTR lpszConfigSetName = NULL);
  126. BOOL WriteRegConfigSet(HWND hWndDlg, LPPMSETTINGS lpPMConfig, LPTSTR lpszRemoteComputer, LPTSTR lpszConfigSetName = NULL);
  127. BOOL RemoveRegConfigSet(HWND hWndDlg, LPTSTR lpszRemoteComputer, LPTSTR lpszConfigSetName);
  128. BOOL VerifyRegConfigSet(HWND hWndDlg, LPPMSETTINGS lpPMConfig, LPTSTR lpszRemoteComputer, LPTSTR lpszConfigSetName = NULL);
  129. BOOL ReadRegConfigSetNames(HWND hWndDlg, LPTSTR lpszRemoteComputer, LPTSTR* lppszConfigSetNames);
  130. void InitializePMConfigStruct(LPPMSETTINGS lpPMConfig);
  131. void ReportControlMessage(HWND hWnd, INT idCtrl, WORD wMessageType);
  132. BOOL CommitOKWarning(HWND hWndDlg);
  133. void ReportError(HWND hWndDlg, UINT idError);
  134. BOOL PMAdmin_OnCommandConnect(HWND hWnd, LPTSTR lpszRemoteName);
  135. BOOL PMAdmin_GetFileName(HWND hWnd, BOOL fOpen, LPTSTR lpFileName, DWORD cbFileName);
  136. BOOL ReadFileConfigSet(LPPMSETTINGS lpPMConfig, LPCTSTR lpszFileName);
  137. BOOL WriteFileConfigSet(LPPMSETTINGS lpPMConfig, LPCTSTR lpszFileName);
  138. BOOL NewConfigSet(HWND hWndDlg,
  139. LPTSTR szSiteNameBuf,
  140. DWORD dwBufLen,
  141. LPTSTR szHostNameBuf,
  142. DWORD dwHostNameLen,
  143. LPTSTR szHostIPBuf,
  144. DWORD dwHostIPLen);
  145. BOOL RemoveConfigSetWarning(HWND hWndDlg);
  146. BOOL IsValidIP(LPCTSTR lpszIP);