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.

275 lines
10 KiB

  1. /**************************************************************************
  2. Copyright (C) 1999 Microsoft Corporation. All Rights Reserved.
  3. MODULE: MESSAGE.CPP
  4. PURPOSE: Source module for Passport Manager config tool
  5. FUNCTIONS:
  6. COMMENTS:
  7. **************************************************************************/
  8. /**************************************************************************
  9. Include Files
  10. **************************************************************************/
  11. #include "pmcfg.h"
  12. struct
  13. {
  14. UINT uErrorID;
  15. UINT uWarningID;
  16. } g_ControlMessageTable[] =
  17. {
  18. {IDS_TIMEWINDOW_ERROR, IDS_CONSISTENCY_WARN}, //IDC_TIMEWINDOW
  19. {0, IDS_CONSISTENCY_WARN}, //IDC_FORCESIGNIN
  20. {IDS_LANGUAGEID_ERROR, IDS_CONSISTENCY_WARN}, //IDC_LANGUAGEID
  21. {IDS_COBRANDING_ERROR, IDS_CONSISTENCY_WARN}, //IDC_COBRANDING_TEMPLATE
  22. {IDS_SITEID_ERROR, IDS_SITEID_WARN}, //IDC_SITEID
  23. {IDS_RETURNURL_ERROR, IDS_CONSISTENCY_WARN}, //IDC_RETURNURL
  24. {IDS_COOKIEDOMAIN_ERROR, IDS_CONSISTENCY_WARN}, //IDC_COOKIEDOMAIN
  25. {IDS_COOKIEPATH_ERROR, IDS_CONSISTENCY_WARN}, //IDC_COOKIEPATH
  26. {0, IDS_STANDALONE_WARN}, //IDC_STANDALONE
  27. {0, IDS_DISABLECOOKIE_WARN}, //IDC_DISABLECOOKIES
  28. {IDS_DISASTERURL_ERROR, IDS_CONSISTENCY_WARN}, //IDC_DISASTERURL
  29. {IDS_HOSTNAME_ERROR, IDS_CONSISTENCY_WARN}, //IDC_HOSTNAMEEDIT
  30. {IDS_HOSTIP_ERROR, IDS_CONSISTENCY_WARN}, //IDC_HOSTIPEDIT
  31. {IDS_PROFILEDOMAIN_ERROR, IDS_CONSISTENCY_WARN}, //IDC_PROFILEDOMAIN
  32. {IDS_PROFILEPATH_ERROR, IDS_CONSISTENCY_WARN}, //IDC_PROFILEPATH
  33. {IDS_SECUREDOMAIN_ERROR, IDS_CONSISTENCY_WARN}, //IDC_SECUREDOMAIN
  34. {IDS_SECUREPATH_ERROR, IDS_CONSISTENCY_WARN} //IDC_SECUREPATH
  35. };
  36. LRESULT CALLBACK CommitOKDlgProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  37. void ReportControlMessage
  38. (
  39. HWND hWnd,
  40. INT idCtrl,
  41. WORD wMessageType
  42. )
  43. {
  44. UINT uMBType = MB_OK;
  45. TCHAR szMessageBoxTitle[MAX_TITLE];
  46. TCHAR szMessage[MAX_MESSAGE];
  47. UINT uID;
  48. // Load the appropriate title
  49. switch (wMessageType)
  50. {
  51. case VALIDATION_ERROR:
  52. LoadString(g_hInst, IDS_ERROR, szMessageBoxTitle, sizeof(szMessageBoxTitle));
  53. uMBType |= MB_ICONERROR;
  54. uID = g_ControlMessageTable[idCtrl - CTRL_BASE].uErrorID;
  55. break;
  56. case CHANGE_WARNING:
  57. LoadString(g_hInst, IDS_WARNING, szMessageBoxTitle, sizeof(szMessageBoxTitle));
  58. uMBType |= MB_ICONWARNING;
  59. uID = g_ControlMessageTable[idCtrl - CTRL_BASE].uWarningID;
  60. break;
  61. }
  62. // Load the appropriate message
  63. LoadString(g_hInst, uID, szMessage, sizeof(szMessage));
  64. MessageBox(hWnd, szMessage, szMessageBoxTitle, uMBType);
  65. }
  66. BOOL CommitOKWarning
  67. (
  68. HWND hWndDlg
  69. )
  70. {
  71. if (IDOK == DialogBox( g_hInst,
  72. MAKEINTRESOURCE (IDD_CONFIRM_COMMIT),
  73. hWndDlg,
  74. (DLGPROC)CommitOKDlgProc ))
  75. return TRUE;
  76. else
  77. return FALSE;
  78. }
  79. void ReportError
  80. (
  81. HWND hWndDlg,
  82. UINT idError
  83. )
  84. {
  85. TCHAR szMessageBoxTitle[MAX_TITLE];
  86. TCHAR szMessage[MAX_MESSAGE];
  87. LoadString(g_hInst, IDS_ERROR, szMessageBoxTitle, sizeof(szMessageBoxTitle));
  88. LoadString(g_hInst, idError, szMessage, sizeof(szMessage));
  89. MessageBox(hWndDlg, szMessage, szMessageBoxTitle, MB_OK | MB_ICONERROR);
  90. }
  91. LRESULT CALLBACK CommitOKDlgProc
  92. (
  93. HWND hWndDlg,
  94. UINT uMsg,
  95. WPARAM wParam,
  96. LPARAM lParam
  97. )
  98. {
  99. switch ( uMsg )
  100. {
  101. case WM_INITDIALOG:
  102. {
  103. TCHAR szTemp[MAX_RESOURCE];
  104. TCHAR szFields[MAX_MESSAGE];
  105. BOOL bOther = FALSE;
  106. // See if we need to hide the other process warning.
  107. if (VerifyRegConfigSet(hWndDlg, &g_OriginalSettings, g_szRemoteComputer))
  108. {
  109. ShowWindow(GetDlgItem(hWndDlg, IDC_OTHERPROCESS), SW_HIDE);
  110. }
  111. // See which of the "other" fields have been modified
  112. szFields[0] = '\0';
  113. if (g_OriginalSettings.dwTimeWindow != g_CurrentSettings.dwTimeWindow)
  114. {
  115. bOther = TRUE;
  116. LoadString(g_hInst, IDS_TIMEWINDOW, szTemp, sizeof(szTemp));
  117. lstrcat(szFields, szTemp);
  118. }
  119. if (g_OriginalSettings.dwForceSignIn != g_CurrentSettings.dwForceSignIn)
  120. {
  121. bOther = TRUE;
  122. LoadString(g_hInst, IDS_FORCESIGNIN, szTemp, sizeof(szTemp));
  123. lstrcat(szFields, szTemp);
  124. }
  125. if (g_OriginalSettings.dwLanguageID != g_CurrentSettings.dwLanguageID)
  126. {
  127. bOther = TRUE;
  128. LoadString(g_hInst, IDS_LANGUAGEID, szTemp, sizeof(szTemp));
  129. lstrcat(szFields, szTemp);
  130. }
  131. if (0 != lstrcmpi(g_OriginalSettings.szCoBrandTemplate, g_CurrentSettings.szCoBrandTemplate))
  132. {
  133. bOther = TRUE;
  134. LoadString(g_hInst, IDS_COBRANDTEMPLATE, szTemp, sizeof(szTemp));
  135. lstrcat(szFields, szTemp);
  136. }
  137. if (0 != lstrcmpi(g_OriginalSettings.szReturnURL, g_CurrentSettings.szReturnURL))
  138. {
  139. bOther = TRUE;
  140. LoadString(g_hInst, IDS_RETURNURL, szTemp, sizeof(szTemp));
  141. lstrcat(szFields, szTemp);
  142. }
  143. if (0 != lstrcmpi(g_OriginalSettings.szTicketDomain, g_CurrentSettings.szTicketDomain))
  144. {
  145. bOther = TRUE;
  146. LoadString(g_hInst, IDS_COOKIEDOMAIN, szTemp, sizeof(szTemp));
  147. lstrcat(szFields, szTemp);
  148. }
  149. if (0 != lstrcmpi(g_OriginalSettings.szTicketPath, g_CurrentSettings.szTicketPath))
  150. {
  151. bOther = TRUE;
  152. LoadString(g_hInst, IDS_COOKIEPATH, szTemp, sizeof(szTemp));
  153. lstrcat(szFields, szTemp);
  154. }
  155. if (0 != lstrcmpi(g_OriginalSettings.szProfileDomain, g_CurrentSettings.szProfileDomain))
  156. {
  157. bOther = TRUE;
  158. LoadString(g_hInst, IDS_PROFILEDOMAIN, szTemp, sizeof(szTemp));
  159. lstrcat(szFields, szTemp);
  160. }
  161. if (0 != lstrcmpi(g_OriginalSettings.szProfilePath, g_CurrentSettings.szProfilePath))
  162. {
  163. bOther = TRUE;
  164. LoadString(g_hInst, IDS_PROFILEPATH, szTemp, sizeof(szTemp));
  165. lstrcat(szFields, szTemp);
  166. }
  167. if (0 != lstrcmpi(g_OriginalSettings.szSecureDomain, g_CurrentSettings.szSecureDomain))
  168. {
  169. bOther = TRUE;
  170. LoadString(g_hInst, IDS_SECUREDOMAIN, szTemp, sizeof(szTemp));
  171. lstrcat(szFields, szTemp);
  172. }
  173. if (0 != lstrcmpi(g_OriginalSettings.szSecurePath, g_CurrentSettings.szSecurePath))
  174. {
  175. bOther = TRUE;
  176. LoadString(g_hInst, IDS_SECUREPATH, szTemp, sizeof(szTemp));
  177. lstrcat(szFields, szTemp);
  178. }
  179. if (0 != lstrcmpi(g_OriginalSettings.szDisasterURL, g_CurrentSettings.szDisasterURL))
  180. {
  181. bOther = TRUE;
  182. LoadString(g_hInst, IDS_DISASTERURL, szTemp, sizeof(szTemp));
  183. lstrcat(szFields, szTemp);
  184. }
  185. if (0 != lstrcmpi(g_OriginalSettings.szHostName, g_CurrentSettings.szHostName))
  186. {
  187. bOther = TRUE;
  188. LoadString(g_hInst, IDS_HOSTNAME, szTemp, sizeof(szTemp));
  189. lstrcat(szFields, szTemp);
  190. }
  191. if (0 != lstrcmpi(g_OriginalSettings.szHostIP, g_CurrentSettings.szHostIP))
  192. {
  193. bOther = TRUE;
  194. LoadString(g_hInst, IDS_HOSTIP, szTemp, sizeof(szTemp));
  195. lstrcat(szFields, szTemp);
  196. }
  197. if (bOther)
  198. {
  199. // Kill the final comma and space, since each of the above field names has a
  200. // comma and space for concatenation purposes
  201. szFields[lstrlen(szFields)-2] ='\0';
  202. SetDlgItemText(hWndDlg, IDC_OTHER_TYPE, szFields);
  203. }
  204. else
  205. {
  206. ShowWindow(GetDlgItem(hWndDlg,IDC_OTHER_TYPE), SW_HIDE);
  207. ShowWindow(GetDlgItem(hWndDlg,IDC_OTHER_WARN), SW_HIDE);
  208. }
  209. // See if DisableCookies has been changed
  210. if (g_OriginalSettings.dwDisableCookies == g_CurrentSettings.dwDisableCookies)
  211. {
  212. ShowWindow(GetDlgItem(hWndDlg,IDC_COOKIES_TYPE), SW_HIDE);
  213. ShowWindow(GetDlgItem(hWndDlg,IDC_COOKIES_WARN), SW_HIDE);
  214. }
  215. // See if SiteID has been changed
  216. if (g_OriginalSettings.dwSiteID == g_CurrentSettings.dwSiteID)
  217. {
  218. ShowWindow(GetDlgItem(hWndDlg,IDC_SITEID_TYPE), SW_HIDE);
  219. ShowWindow(GetDlgItem(hWndDlg,IDC_SITEID_WARN), SW_HIDE);
  220. }
  221. // See if StandAlone Mode has been changed
  222. if (g_OriginalSettings.dwStandAlone == g_CurrentSettings.dwStandAlone)
  223. {
  224. ShowWindow(GetDlgItem(hWndDlg,IDC_STANDALONE_TYPE), SW_HIDE);
  225. ShowWindow(GetDlgItem(hWndDlg,IDC_STANDALONE_WARN), SW_HIDE);
  226. }
  227. return TRUE;
  228. }
  229. case WM_COMMAND:
  230. {
  231. switch (LOWORD(wParam))
  232. {
  233. case IDOK:
  234. {
  235. EndDialog( hWndDlg, TRUE );
  236. break;
  237. }
  238. case IDCANCEL:
  239. {
  240. EndDialog( hWndDlg, FALSE );
  241. break;
  242. }
  243. }
  244. break;
  245. }
  246. }
  247. return FALSE;
  248. }