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.

101 lines
4.1 KiB

  1. #include "precomp.h"
  2. static void initializeStartSearchHelper(HWND hDlg, LPCTSTR pcszInsFile, LPCTSTR pcszServerFile);
  3. static BOOL saveStartSearchHelper(HWND hDlg, LPCTSTR pcszInsFile, LPCTSTR pcszServerFile, BOOL *pfInsDirty,
  4. BOOL fCheckDirtyOnly);
  5. void WINAPI InitializeStartSearchA(HWND hDlg, LPCSTR pcszInsFile, LPCSTR pcszServerFile)
  6. {
  7. USES_CONVERSION;
  8. initializeStartSearchHelper(hDlg, A2CT(pcszInsFile), A2CT(pcszServerFile));
  9. }
  10. void WINAPI InitializeStartSearchW(HWND hDlg, LPCWSTR pcwszInsFile, LPCWSTR pcwszServerFile)
  11. {
  12. USES_CONVERSION;
  13. initializeStartSearchHelper(hDlg, W2CT(pcwszInsFile), W2CT(pcwszServerFile));
  14. }
  15. BOOL WINAPI SaveStartSearchA(HWND hDlg, LPCSTR pcszInsFile, LPCSTR pcszServerFile, BOOL *pfInsDirty /*= NULL */,
  16. BOOL fCheckDirtyOnly /* = FALSE */)
  17. {
  18. USES_CONVERSION;
  19. return saveStartSearchHelper(hDlg, A2CT(pcszInsFile), A2CT(pcszServerFile), pfInsDirty, fCheckDirtyOnly);
  20. }
  21. BOOL WINAPI SaveStartSearchW(HWND hDlg, LPCWSTR pcwszInsFile, LPCWSTR pcwszServerFile, BOOL *pfInsDirty /* = NULL */,
  22. BOOL fCheckDirtyOnly /* = FALSE */)
  23. {
  24. USES_CONVERSION;
  25. return saveStartSearchHelper(hDlg, W2CT(pcwszInsFile), W2CT(pcwszServerFile), pfInsDirty, fCheckDirtyOnly);
  26. }
  27. static void initializeStartSearchHelper(HWND hDlg, LPCTSTR pcszInsFile, LPCTSTR pcszServerFile)
  28. {
  29. SetDlgItemTextFromIns(hDlg, IDE_STARTPAGE, IDC_STARTPAGE, IS_URL, IK_HOMEPAGE, pcszInsFile,
  30. pcszServerFile, INSIO_TRISTATE);
  31. EnableDlgItem2(hDlg, IDC_STARTPAGE_TXT, (IsDlgButtonChecked(hDlg, IDC_STARTPAGE) == BST_CHECKED));
  32. SetDlgItemTextFromIns(hDlg, IDE_SEARCHPAGE, IDC_SEARCHPAGE, IS_URL, IK_SEARCHPAGE, pcszInsFile,
  33. pcszServerFile, INSIO_TRISTATE);
  34. EnableDlgItem2(hDlg, IDC_SEARCHPAGE_TXT, (IsDlgButtonChecked(hDlg, IDC_SEARCHPAGE) == BST_CHECKED));
  35. SetDlgItemTextFromIns(hDlg, IDE_CUSTOMSUPPORT, IDC_CUSTOMSUPPORT, IS_URL, IK_HELPPAGE, pcszInsFile,
  36. pcszServerFile, INSIO_TRISTATE);
  37. EnableDlgItem2(hDlg, IDC_CUSTOMSUPPORT_TXT, (IsDlgButtonChecked(hDlg, IDC_CUSTOMSUPPORT) == BST_CHECKED));
  38. }
  39. static BOOL saveStartSearchHelper(HWND hDlg, LPCTSTR pcszInsFile, LPCTSTR pcszServerFile, BOOL *pfInsDirty /* = NULL */,
  40. BOOL fCheckDirtyOnly /* = FALSE */)
  41. {
  42. TCHAR szStart[INTERNET_MAX_URL_LENGTH];
  43. TCHAR szSearch[INTERNET_MAX_URL_LENGTH];
  44. TCHAR szSupport[INTERNET_MAX_URL_LENGTH];
  45. TCHAR szTemp[INTERNET_MAX_URL_LENGTH];
  46. BOOL fStart, fSearch, fSupport, fTemp;
  47. fStart = GetDlgItemTextTriState(hDlg, IDE_STARTPAGE, IDC_STARTPAGE, szStart, countof(szStart));
  48. if (pfInsDirty != NULL && *pfInsDirty == FALSE)
  49. {
  50. InsGetString(IS_URL, IK_HOMEPAGE, szTemp, countof(szTemp), pcszInsFile, NULL, &fTemp);
  51. if (fStart != fTemp || StrCmpI(szTemp, szStart) != 0)
  52. *pfInsDirty = TRUE;
  53. }
  54. fSearch = GetDlgItemTextTriState(hDlg, IDE_SEARCHPAGE, IDC_SEARCHPAGE, szSearch, countof(szSearch));
  55. if (pfInsDirty != NULL && *pfInsDirty == FALSE)
  56. {
  57. InsGetString(IS_URL, IK_SEARCHPAGE, szTemp, countof(szTemp), pcszInsFile, NULL, &fTemp);
  58. if (fSearch != fTemp || StrCmpI(szTemp, szSearch) != 0)
  59. *pfInsDirty = TRUE;
  60. }
  61. fSupport = GetDlgItemTextTriState(hDlg, IDE_CUSTOMSUPPORT, IDC_CUSTOMSUPPORT, szSupport,
  62. countof(szSupport));
  63. if (pfInsDirty != NULL && *pfInsDirty == FALSE)
  64. {
  65. InsGetString(IS_URL, IK_HELPPAGE, szTemp, countof(szTemp), pcszInsFile, NULL, &fTemp);
  66. if (fSupport != fTemp || StrCmpI(szTemp, szSupport) != 0)
  67. *pfInsDirty = TRUE;
  68. }
  69. if (!fCheckDirtyOnly)
  70. {
  71. InsWriteString(IS_URL, IK_HOMEPAGE, szStart, pcszInsFile, fStart, pcszServerFile,
  72. INSIO_TRISTATE);
  73. InsWriteString(IS_URL, IK_SEARCHPAGE, szSearch, pcszInsFile, fSearch, pcszServerFile,
  74. INSIO_TRISTATE);
  75. InsWriteString(IS_URL, IK_HELPPAGE, szSupport, pcszInsFile, fSupport, pcszServerFile,
  76. INSIO_TRISTATE);
  77. }
  78. return TRUE;
  79. }