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.

229 lines
7.7 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 <winsock2.h>
  7. #include <wininet.h> // for INTERNET_MAX_URL_LENGTH
  8. #include <shlobj.h>
  9. #include <shlwapi.h>
  10. #include <shellapi.h>
  11. #include <tchar.h>
  12. #include "resource.h"
  13. #include "pmhelp.h"
  14. #include "mru.h"
  15. #ifndef GET_WM_COMMAND_ID
  16. #define GET_WM_COMMAND_ID(wp, lp) (wp)
  17. #define GET_WM_COMMAND_HWND(wp, lp) (HWND)(LOWORD(lp))
  18. #define GET_WM_COMMAND_CMD(wp, lp) HIWORD(lp)
  19. #endif
  20. #ifdef WIN32
  21. #define CBACK CALLBACK
  22. #else
  23. #define CBACK _export CALLBACK
  24. #endif
  25. // macros
  26. #define DIMENSION(a) (sizeof(a) / sizeof(a[0]))
  27. // constant defines
  28. #define MAX_REGISTRY_STRING 256
  29. #define DEFAULT_TIME_WINDOW 1800
  30. #define MIN_TIME_WINDOW_SECONDS 100
  31. #define MAX_TIME_WINDOW_SECONDS 1000000
  32. #define DEFAULT_LANGID 1033
  33. const DWORD MAX_SITEID = 0xFFFFFFFF;
  34. //#define MAX_SITEID 0xFFFFFFFF
  35. #define PRODUCTID_LEN 24
  36. #define MAX_TITLE 80
  37. #define MAX_MESSAGE 1024
  38. #define MAX_RESOURCE 255
  39. #define MAX_CONFIGSETNAME 256
  40. #define MAX_IPLEN 16
  41. #define MAX_ENVNAME 256
  42. #define SECONDS_PER_MIN 60
  43. #define SECONDS_PER_HOUR (60 * SECONDS_PER_MIN)
  44. #define SECONDS_PER_DAY (24 * SECONDS_PER_HOUR)
  45. #define VALIDATION_ERROR 1
  46. #define CHANGE_WARNING 2
  47. #define COMPUTER_MRU_SIZE 4
  48. #define FILE_MRU_SIZE 4
  49. // Type defines
  50. typedef struct PMSettings_tag
  51. {
  52. DWORD dwTimeWindow; // Time Window in Seconds
  53. DWORD dwForceSignIn;
  54. DWORD dwLanguageID;
  55. TCHAR szCoBrandTemplate[INTERNET_MAX_URL_LENGTH];
  56. DWORD cbCoBrandTemplate; // Size of the CobBrand template buffer
  57. DWORD dwSiteID;
  58. TCHAR szReturnURL[INTERNET_MAX_URL_LENGTH];
  59. DWORD cbReturnURL; // Size of the ReturnURL buffer
  60. TCHAR szTicketDomain[INTERNET_MAX_URL_LENGTH];
  61. DWORD cbTicketDomain; // Size of the CookieDomain buffer
  62. TCHAR szTicketPath[INTERNET_MAX_URL_LENGTH];
  63. DWORD cbTicketPath; // Size of the CookiePath buffer
  64. TCHAR szProfileDomain[INTERNET_MAX_URL_LENGTH];
  65. DWORD cbProfileDomain; // Size of the CookieDomain buffer
  66. TCHAR szProfilePath[INTERNET_MAX_URL_LENGTH];
  67. DWORD cbProfilePath; // Size of the CookiePath buffer
  68. TCHAR szSecureDomain[INTERNET_MAX_URL_LENGTH];
  69. DWORD cbSecureDomain; // Size of the CookiePath buffer
  70. TCHAR szSecurePath[INTERNET_MAX_URL_LENGTH];
  71. DWORD cbSecurePath; // Size of the CookiePath buffer
  72. TCHAR szDisasterURL[INTERNET_MAX_URL_LENGTH];
  73. DWORD cbDisasterURL; // Size of the DisasterURL buffer
  74. #ifdef DO_KEYSTUFF
  75. DWORD dwCurrentKey;
  76. #endif
  77. DWORD dwDisableCookies;
  78. DWORD dwStandAlone;
  79. TCHAR szHostName[INTERNET_MAX_HOST_NAME_LENGTH];
  80. DWORD cbHostName;
  81. TCHAR szHostIP[MAX_IPLEN];
  82. DWORD cbHostIP;
  83. //JVP - 3/2/2000
  84. DWORD dwVerboseMode;
  85. TCHAR szEnvName[MAX_ENVNAME];
  86. DWORD cbEnvName;
  87. TCHAR szRemoteFile[INTERNET_MAX_URL_LENGTH];
  88. DWORD cbRemoteFile; // Size of the RemoteFile buffer
  89. DWORD dwEnableManualRefresh;
  90. DWORD dwSecureLevel;
  91. } PMSETTINGS, FAR * LPPMSETTINGS;
  92. typedef struct LanguageIDMap_tag
  93. {
  94. WORD wLangID;
  95. LPCTSTR lpszLang;
  96. } LANGIDMAP, FAR * LPLANGIDMAP;
  97. // declarations for globals that are shared across modules
  98. extern TCHAR g_szTRUE[];
  99. extern TCHAR g_szFALSE[];
  100. extern TCHAR g_szYes[];
  101. extern TCHAR g_szNo[];
  102. extern HINSTANCE g_hInst;
  103. extern HWND g_hwndMain;
  104. extern PMSETTINGS g_CurrentSettings;
  105. extern PMSETTINGS g_OriginalSettings;
  106. extern TCHAR g_szClassName[];
  107. extern LANGIDMAP g_szLanguageIDMap[];
  108. extern TCHAR g_szInstallPath[];
  109. extern TCHAR g_szPMVersion[];
  110. extern TCHAR g_szHelpFileName[];
  111. extern TCHAR g_szRemoteComputer[];
  112. extern TCHAR g_szPassportReg[];
  113. extern TCHAR g_szPassportSites[];
  114. extern PpMRU g_ComputerMRU;
  115. // These globals are shared by the reg and file config read/write functions
  116. extern TCHAR g_szEncryptionKeyData[];
  117. extern TCHAR g_szInstallDir[];
  118. extern TCHAR g_szVersion[];
  119. extern TCHAR g_szTimeWindow[];
  120. extern TCHAR g_szForceSignIn[];
  121. extern TCHAR g_szNSRefresh[];
  122. extern TCHAR g_szLanguageID[];
  123. extern TCHAR g_szCoBrandTemplate[];
  124. extern TCHAR g_szSiteID[];
  125. extern TCHAR g_szReturnURL[];
  126. extern TCHAR g_szTicketDomain[];
  127. extern TCHAR g_szTicketPath[];
  128. extern TCHAR g_szProfileDomain[];
  129. extern TCHAR g_szProfilePath[];
  130. extern TCHAR g_szSecureDomain[];
  131. extern TCHAR g_szSecurePath[];
  132. extern TCHAR g_szCurrentKey[];
  133. extern TCHAR g_szStandAlone[];
  134. extern TCHAR g_szDisableCookies[];
  135. extern TCHAR g_szDisasterURL[];
  136. extern TCHAR g_szHostName[];
  137. extern TCHAR g_szHostIP[];
  138. extern TCHAR g_szVerboseMode[];
  139. extern TCHAR g_szEnvName[];
  140. extern TCHAR g_szRemoteFile[];
  141. extern TCHAR g_szVersion14[];
  142. // declaractions for functions that are shared across modules
  143. BOOL ReadRegConfigSet(HWND hWndDlg, LPPMSETTINGS lpPMConfig, LPTSTR lpszRemoteComputer, LPTSTR lpszConfigSetName = NULL);
  144. BOOL WriteRegConfigSet(HWND hWndDlg, LPPMSETTINGS lpPMConfig, LPTSTR lpszRemoteComputer, LPTSTR lpszConfigSetName = NULL);
  145. BOOL RemoveRegConfigSet(HWND hWndDlg, LPTSTR lpszRemoteComputer, LPTSTR lpszConfigSetName);
  146. BOOL VerifyRegConfigSet(HWND hWndDlg, LPPMSETTINGS lpPMConfig, LPTSTR lpszRemoteComputer, LPTSTR lpszConfigSetName = NULL);
  147. BOOL ReadRegConfigSetNames(HWND hWndDlg, LPTSTR lpszRemoteComputer, LPTSTR* lppszConfigSetNames);
  148. void InitializePMConfigStruct(LPPMSETTINGS lpPMConfig);
  149. void ReportControlMessage(HWND hWnd, INT idCtrl, WORD wMessageType);
  150. BOOL CommitOKWarning(HWND hWndDlg);
  151. void ReportError(HWND hWndDlg, UINT idError);
  152. BOOL PMAdmin_OnCommandConnect(HWND hWnd, LPTSTR lpszRemoteName);
  153. BOOL PMAdmin_GetFileName(HWND hWnd, BOOL fOpen, LPTSTR lpFileName, DWORD cbFileName);
  154. BOOL ReadFileConfigSet(LPPMSETTINGS lpPMConfig, LPCTSTR lpszFileName);
  155. BOOL WriteFileConfigSet(LPPMSETTINGS lpPMConfig, LPCTSTR lpszFileName);
  156. BOOL NewConfigSet(HWND hWndDlg,
  157. LPTSTR szSiteNameBuf,
  158. DWORD dwBufLen,
  159. LPTSTR szHostNameBuf,
  160. DWORD dwHostNameLen,
  161. LPTSTR szHostIPBuf,
  162. DWORD dwHostIPLen);
  163. BOOL RemoveConfigSetWarning(HWND hWndDlg);
  164. BOOL IsValidIP(LPCTSTR lpszIP);
  165. BOOL EnvChange
  166. (
  167. HWND hWndDlg,
  168. LPTSTR szEnvNameBuf,
  169. DWORD dwEnvNameBufLen
  170. );
  171. BOOL WriteRegEnv
  172. (
  173. HWND hWndDlg,
  174. LPPMSETTINGS lpPMConfig,
  175. HKEY hklm,
  176. LPTSTR lpszEnvName
  177. );
  178. BOOL ReadRegRemoteFile
  179. (
  180. HWND hWndDlg,
  181. LPTSTR lpszRemoteFile,
  182. LPTSTR lpszRemoteComputer,
  183. LPTSTR lpszEnvName
  184. );
  185. BOOL ReadRegLocalFile
  186. (
  187. HWND hWndDlg,
  188. LPTSTR lpszRemoteComputer,
  189. LPTSTR lpszLocalFile
  190. );