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.

1081 lines
41 KiB

  1. #include "pch.h"
  2. //_________________________________________________________________________
  3. //
  4. // D I A L O G B O X P R O C E D U R E S
  5. //_________________________________________________________________________
  6. //
  7. void InitializeTitle(HWND hDlg, LPCTSTR szInsFile)
  8. {
  9. SetDlgItemTextFromIns(hDlg, IDE_TITLE, IDC_TITLE, IS_BRANDING, TEXT("Window_Title_CN"),
  10. szInsFile, NULL, INSIO_TRISTATE);
  11. EnableDlgItem2(hDlg, IDC_TITLE_TXT, (IsDlgButtonChecked(hDlg, IDC_TITLE) == BST_CHECKED));
  12. }
  13. BOOL SaveTitle(HWND hDlg, LPCTSTR szDefInf, LPCTSTR /*szInsFile*/, BOOL fCheckDirtyOnly)
  14. {
  15. TCHAR szTitle[MAX_PATH];
  16. TCHAR szMsg[512];
  17. TCHAR szFullTitle[MAX_PATH];
  18. TCHAR szOEFullTitle[MAX_PATH];
  19. TCHAR szTemp[MAX_PATH];
  20. BOOL fTitle, fTemp;
  21. szFullTitle[0] = TEXT('\0');
  22. szOEFullTitle[0] = TEXT('\0');
  23. fTitle = GetDlgItemTextTriState(hDlg, IDE_TITLE, IDC_TITLE, szTitle,
  24. ARRAYSIZE(szTitle));
  25. if(fTitle && ISNONNULL(szTitle))
  26. {
  27. if(GetPrivateProfileString(TEXT("Strings"), TEXT("IE_TITLE"), TEXT(""), szMsg, ARRAYSIZE(szMsg), szDefInf))
  28. wsprintf(szFullTitle, szMsg, szTitle);
  29. // customize the OE title also
  30. if(GetPrivateProfileString(TEXT("Strings"), TEXT("OE_TITLE"), TEXT(""), szMsg, ARRAYSIZE(szMsg), szDefInf))
  31. wsprintf(szOEFullTitle, szMsg, szTitle);
  32. }
  33. if (!g_fInsDirty)
  34. {
  35. InsGetString(IS_BRANDING, TEXT("Window_Title_CN"),
  36. szTemp, ARRAYSIZE(szTemp), g_szInsFile, NULL, &fTemp);
  37. if (fTitle != fTemp || StrCmp(szTemp, szTitle) != 0)
  38. g_fInsDirty = TRUE;
  39. InsGetString(IS_BRANDING, IK_WINDOWTITLE,
  40. szTemp, ARRAYSIZE(szTemp), g_szInsFile);
  41. if (StrCmp(szTemp, szFullTitle) != 0)
  42. g_fInsDirty = TRUE;
  43. }
  44. if (!fCheckDirtyOnly)
  45. {
  46. InsWriteString(IS_BRANDING, TEXT("Window_Title_CN"), szTitle, g_szInsFile,
  47. fTitle, NULL, INSIO_SERVERONLY | INSIO_TRISTATE);
  48. InsWriteString(IS_BRANDING, IK_WINDOWTITLE, szFullTitle, g_szInsFile,
  49. fTitle, NULL, INSIO_TRISTATE);
  50. // save the customized OE title
  51. InsWriteString(IS_INTERNETMAIL, IK_WINDOWTITLE, szOEFullTitle, g_szInsFile,
  52. fTitle, NULL, INSIO_TRISTATE);
  53. }
  54. return TRUE;
  55. }
  56. INT_PTR CALLBACK TitleProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam )
  57. {
  58. TCHAR szTitle[MAX_PATH];
  59. DWORD dwTitlePrefixLen;
  60. switch( msg )
  61. {
  62. case WM_INITDIALOG:
  63. EnableDBCSChars(hDlg, IDE_TITLE);
  64. LoadString(g_hInst, IDS_TITLE_PREFIX, szTitle, ARRAYSIZE(szTitle));
  65. dwTitlePrefixLen = StrLen(szTitle);
  66. // browser will only display 74 chars before cutting off title
  67. Edit_LimitText(GetDlgItem(hDlg, IDE_TITLE), 74 - dwTitlePrefixLen);
  68. // load information from ins file
  69. InitializeTitle(hDlg, g_szInsFile);
  70. break;
  71. case WM_COMMAND:
  72. if (GET_WM_COMMAND_CMD(wParam, lParam) != BN_CLICKED)
  73. return FALSE;
  74. switch (GET_WM_COMMAND_ID(wParam, lParam))
  75. {
  76. case IDC_TITLE:
  77. EnableDlgItem2(hDlg, IDE_TITLE, (IsDlgButtonChecked(hDlg, IDC_TITLE) == BST_CHECKED));
  78. EnableDlgItem2(hDlg, IDC_TITLE_TXT, (IsDlgButtonChecked(hDlg, IDC_TITLE) == BST_CHECKED));
  79. break;
  80. default:
  81. return FALSE;
  82. }
  83. break;
  84. case UM_SAVE:
  85. // write the information back to the ins file
  86. *((LPBOOL)wParam) = SaveTitle(hDlg, g_szDefInf, g_szInsFile, (BOOL) lParam);
  87. break;
  88. case WM_CLOSE:
  89. DestroyWindow(hDlg);
  90. return FALSE;
  91. default:
  92. return FALSE;
  93. }
  94. return TRUE;
  95. }
  96. INT_PTR CALLBACK CabSignProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam )
  97. {
  98. TCHAR szDesc[MAX_PATH];
  99. TCHAR szPVKPath[MAX_PATH];
  100. TCHAR szSPCPath[MAX_PATH];
  101. TCHAR szInfoUrl[INTERNET_MAX_URL_LENGTH];
  102. TCHAR szTimeUrl[INTERNET_MAX_URL_LENGTH];
  103. TCHAR szTemp[INTERNET_MAX_URL_LENGTH];
  104. switch( msg )
  105. {
  106. case WM_INITDIALOG:
  107. // not needed for profile manager
  108. DisableDlgItem(hDlg, IDC_CSADD);
  109. EnableDBCSChars(hDlg, IDE_CSPVK);
  110. EnableDBCSChars(hDlg, IDE_CSSPC);
  111. EnableDBCSChars(hDlg, IDE_CSURL);
  112. EnableDBCSChars(hDlg, IDE_CSDESC);
  113. EnableDBCSChars(hDlg, IDE_CSTIME);
  114. Edit_LimitText(GetDlgItem(hDlg, IDE_CSSPC), countof(szSPCPath) - 1);
  115. Edit_LimitText(GetDlgItem(hDlg, IDE_CSPVK), countof(szPVKPath) - 1);
  116. Edit_LimitText(GetDlgItem(hDlg, IDE_CSDESC), countof(szDesc) - 1);
  117. Edit_LimitText(GetDlgItem(hDlg, IDE_CSURL), countof(szInfoUrl) - 1);
  118. Edit_LimitText(GetDlgItem(hDlg, IDE_CSTIME), countof(szTimeUrl) - 1);
  119. InsGetString(IS_CABSIGN, IK_PVK, szPVKPath, countof(szPVKPath), g_szInsFile);
  120. InsGetString(IS_CABSIGN, IK_SPC, szSPCPath, countof(szSPCPath), g_szInsFile);
  121. InsGetString(IS_CABSIGN, IK_CSURL, szInfoUrl, countof(szInfoUrl), g_szInsFile);
  122. InsGetString(IS_CABSIGN, IK_NAME, szDesc, countof(szDesc), g_szInsFile);
  123. InsGetString(IS_CABSIGN, IK_CSTIME, szTimeUrl, countof(szTimeUrl), g_szInsFile);
  124. SetDlgItemText(hDlg, IDE_CSPVK, szPVKPath);
  125. SetDlgItemText(hDlg, IDE_CSSPC, szSPCPath);
  126. SetDlgItemText(hDlg, IDE_CSURL, szInfoUrl);
  127. SetDlgItemText(hDlg, IDE_CSDESC, szDesc);
  128. SetDlgItemText(hDlg, IDE_CSTIME, szTimeUrl);
  129. DisableDlgItem(hDlg, IDC_CSCOMP);
  130. DisableDlgItem(hDlg, IDC_CSCOMP_TXT);
  131. break;
  132. case WM_COMMAND:
  133. if (HIWORD(wParam) == BN_CLICKED)
  134. {
  135. switch(LOWORD(wParam))
  136. {
  137. case IDC_BROWSECSPVK:
  138. GetDlgItemText( hDlg, IDE_CSPVK, szPVKPath, ARRAYSIZE(szPVKPath));
  139. if( BrowseForFile( hDlg, szPVKPath, ARRAYSIZE(szPVKPath), GFN_PVK ))
  140. SetDlgItemText( hDlg, IDE_CSPVK, szPVKPath );
  141. SetFocus(GetDlgItem(hDlg, IDC_BROWSECSPVK));
  142. break;
  143. case IDC_BROWSECSSPC:
  144. GetDlgItemText( hDlg, IDE_CSSPC, szSPCPath, ARRAYSIZE(szSPCPath));
  145. if( BrowseForFile( hDlg, szSPCPath, ARRAYSIZE(szSPCPath), GFN_SPC ))
  146. SetDlgItemText( hDlg, IDE_CSSPC, szSPCPath );
  147. SetFocus(GetDlgItem(hDlg, IDC_BROWSECSSPC));
  148. break;
  149. }
  150. }
  151. break;
  152. case UM_SAVE:
  153. // write the information back to the ins file
  154. {
  155. BOOL fDirty = FALSE;
  156. BOOL fCheckDirtyOnly = (BOOL) lParam;
  157. GetDlgItemText(hDlg, IDE_CSPVK, szPVKPath, countof(szPVKPath));
  158. GetDlgItemText(hDlg, IDE_CSSPC, szSPCPath, countof(szSPCPath));
  159. GetDlgItemText(hDlg, IDE_CSURL, szInfoUrl, countof(szInfoUrl));
  160. GetDlgItemText(hDlg, IDE_CSDESC, szDesc, countof(szDesc));
  161. GetDlgItemText(hDlg, IDE_CSTIME, szTimeUrl, countof(szTimeUrl));
  162. InsGetString(IS_CABSIGN, IK_PVK, szTemp, ARRAYSIZE(szTemp), g_szInsFile);
  163. if (StrCmp(szTemp, szPVKPath) != 0)
  164. fDirty = TRUE;
  165. InsGetString(IS_CABSIGN, IK_SPC, szTemp, ARRAYSIZE(szTemp), g_szInsFile);
  166. if (StrCmp(szTemp, szSPCPath) != 0)
  167. fDirty = TRUE;
  168. InsGetString(IS_CABSIGN, IK_CSURL, szTemp, ARRAYSIZE(szTemp), g_szInsFile);
  169. if (StrCmp(szTemp, szInfoUrl) != 0)
  170. fDirty = TRUE;
  171. InsGetString(IS_CABSIGN, IK_NAME, szTemp, ARRAYSIZE(szTemp), g_szInsFile);
  172. if (StrCmp(szTemp, szDesc) != 0)
  173. fDirty = TRUE;
  174. InsGetString(IS_CABSIGN, IK_CSTIME, szTemp, ARRAYSIZE(szTemp), g_szInsFile);
  175. if (StrCmp(szTemp, szTimeUrl) != 0)
  176. fDirty = TRUE;
  177. if (!fCheckDirtyOnly)
  178. {
  179. if (ISNONNULL(szPVKPath) || ISNONNULL(szSPCPath)
  180. || ISNONNULL(szInfoUrl) || ISNONNULL(szDesc) || ISNONNULL(szTimeUrl))
  181. {
  182. if (!CheckField(hDlg, IDE_CSPVK, FC_NONNULL | FC_FILE | FC_EXISTS) ||
  183. !CheckField(hDlg, IDE_CSSPC, FC_NONNULL | FC_FILE | FC_EXISTS) ||
  184. !CheckField(hDlg, IDE_CSDESC, FC_NONNULL) ||
  185. !CheckField(hDlg, IDE_CSURL, FC_URL) || !CheckField(hDlg, IDE_CSTIME, FC_URL))
  186. {
  187. return TRUE;
  188. }
  189. }
  190. InsWriteString(IS_CABSIGN, IK_PVK, szPVKPath, g_szInsFile);
  191. InsWriteString(IS_CABSIGN, IK_SPC, szSPCPath, g_szInsFile);
  192. InsWriteString(IS_CABSIGN, IK_CSURL, szInfoUrl, g_szInsFile);
  193. InsWriteString(IS_CABSIGN, IK_NAME, szDesc, g_szInsFile);
  194. InsWriteString(IS_CABSIGN, IK_CSTIME, szTimeUrl, g_szInsFile);
  195. }
  196. if (fDirty)
  197. g_fInsDirty = TRUE;
  198. }
  199. *((LPBOOL)wParam) = TRUE;
  200. break;
  201. case WM_CLOSE:
  202. DestroyWindow(hDlg);
  203. return FALSE;
  204. default:
  205. return FALSE;
  206. }
  207. return TRUE;
  208. }
  209. void SaveUserAgent(HWND hDlg, LPCTSTR szInsFile, BOOL fCheckDirtyOnly)
  210. {
  211. TCHAR szUserAgent[MAX_PATH];
  212. TCHAR szTemp[MAX_PATH];
  213. BOOL fUserAgent;
  214. fUserAgent = GetDlgItemTextTriState(hDlg, IDC_UASTRING, IDC_UASTRINGCHECK, szUserAgent,
  215. countof(szUserAgent));
  216. if (!g_fInsDirty)
  217. {
  218. BOOL fTemp;
  219. InsGetString(IS_BRANDING, USER_AGENT, szTemp, ARRAYSIZE(szTemp), szInsFile, NULL, &fTemp);
  220. if (fUserAgent != fTemp || StrCmp(szTemp, szUserAgent) != 0)
  221. g_fInsDirty = TRUE;
  222. }
  223. if (!fCheckDirtyOnly)
  224. InsWriteString(IS_BRANDING, USER_AGENT, szUserAgent, szInsFile,
  225. fUserAgent, NULL, INSIO_TRISTATE);
  226. }
  227. INT_PTR CALLBACK UserAgentProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam )
  228. {
  229. switch( msg )
  230. {
  231. case WM_INITDIALOG:
  232. EnableDBCSChars(hDlg, IDC_UASTRING);
  233. Edit_LimitText(GetDlgItem(hDlg, IDC_UASTRING), MAX_PATH - 1);
  234. // load information from ins file
  235. SetDlgItemTextFromIns(hDlg, IDC_UASTRING, IDC_UASTRINGCHECK, IS_BRANDING,
  236. USER_AGENT, g_szInsFile, NULL, INSIO_TRISTATE);
  237. EnableDlgItem2(hDlg, IDC_UASTRING_TXT, (IsDlgButtonChecked(hDlg, IDC_UASTRINGCHECK) == BST_CHECKED));
  238. break;
  239. case WM_COMMAND:
  240. if (GET_WM_COMMAND_CMD(wParam, lParam) != BN_CLICKED)
  241. return FALSE;
  242. switch (GET_WM_COMMAND_ID(wParam, lParam))
  243. {
  244. case IDC_UASTRINGCHECK:
  245. EnableDlgItem2(hDlg, IDC_UASTRING, (IsDlgButtonChecked(hDlg, IDC_UASTRINGCHECK) == BST_CHECKED));
  246. EnableDlgItem2(hDlg, IDC_UASTRING_TXT, (IsDlgButtonChecked(hDlg, IDC_UASTRINGCHECK) == BST_CHECKED));
  247. break;
  248. default:
  249. return FALSE;
  250. }
  251. break;
  252. case UM_SAVE:
  253. // write the information back to the ins file
  254. SaveUserAgent(hDlg, g_szInsFile, (BOOL) lParam);
  255. *((LPBOOL)wParam) = TRUE;
  256. break;
  257. case WM_CLOSE:
  258. DestroyWindow(hDlg);
  259. return FALSE;
  260. default:
  261. return FALSE;
  262. }
  263. return TRUE;
  264. }
  265. void InitializeAnimBmps(HWND hDlg, LPCTSTR szInsFile)
  266. {
  267. TCHAR szBig[MAX_PATH];
  268. TCHAR szSmall[MAX_PATH];
  269. BOOL fBrandBmps;
  270. // load information from ins file
  271. InsGetString(IS_ANIMATION, TEXT("Big_Path"),
  272. szBig, ARRAYSIZE(szBig), szInsFile, NULL, &fBrandBmps);
  273. SetDlgItemTextTriState(hDlg, IDE_BIGANIMBITMAP, IDC_ANIMBITMAP, szBig, fBrandBmps);
  274. EnableDlgItem2(hDlg, IDC_BROWSEBIG, fBrandBmps);
  275. EnableDlgItem2(hDlg, IDC_BIGANIMBITMAP_TXT, fBrandBmps);
  276. InsGetString(IS_ANIMATION, TEXT("Small_Path"),
  277. szSmall, ARRAYSIZE(szSmall), szInsFile, NULL, &fBrandBmps);
  278. SetDlgItemTextTriState(hDlg, IDE_SMALLANIMBITMAP, IDC_ANIMBITMAP, szSmall, fBrandBmps);
  279. EnableDlgItem2(hDlg, IDC_BROWSESMALL, fBrandBmps);
  280. EnableDlgItem2(hDlg, IDC_SMALLANIMBITMAP_TXT, fBrandBmps);
  281. }
  282. BOOL SaveAnimBmps(HWND hDlg, LPCTSTR szInsFile, BOOL fCheckDirtyOnly)
  283. {
  284. TCHAR szBig[MAX_PATH];
  285. TCHAR szSmall[MAX_PATH];
  286. TCHAR szBigTemp[MAX_PATH];
  287. TCHAR szSmallTemp[MAX_PATH];
  288. BOOL fBmpDirty = FALSE;
  289. BOOL fBrandBmps, fTemp;
  290. fBrandBmps = (IsDlgButtonChecked(hDlg, IDC_ANIMBITMAP) == BST_CHECKED);
  291. GetDlgItemText(hDlg, IDE_BIGANIMBITMAP, szBig, countof(szBig));
  292. InsGetString(IS_ANIMATION, TEXT("Big_Path"), szBigTemp, ARRAYSIZE(szBigTemp), szInsFile,
  293. NULL, &fTemp);
  294. GetDlgItemText(hDlg, IDE_SMALLANIMBITMAP, szSmall, countof(szSmall));
  295. InsGetString(IS_ANIMATION, TEXT("Small_Path"), szSmallTemp, ARRAYSIZE(szSmallTemp), szInsFile);
  296. if (fCheckDirtyOnly)
  297. {
  298. if(fBrandBmps != fTemp || StrCmpI(szBig, szBigTemp) != 0 || StrCmpI(szSmall, szSmallTemp) != 0)
  299. fBmpDirty = TRUE;
  300. }
  301. else
  302. {
  303. if(fBrandBmps != fTemp || StrCmpI(szBig, szBigTemp) != 0)
  304. {
  305. if(fBrandBmps && !IsAnimBitmapFileValid(hDlg, IDE_BIGANIMBITMAP, szBig, NULL, IDS_TOOBIG38, IDS_TOOSMALL38, 30, 45))
  306. return FALSE;
  307. fBmpDirty = TRUE;
  308. }
  309. CopyAnimBmp(hDlg, szBig, g_szWorkDir, IK_LARGEBITMAP, TEXT("Big_Path"), szInsFile);
  310. if(fBrandBmps != fTemp || StrCmpI(szSmall, szSmallTemp) != 0)
  311. {
  312. if(fBrandBmps && !IsAnimBitmapFileValid(hDlg, IDE_SMALLANIMBITMAP, szSmall, NULL, IDS_TOOBIG22, IDS_TOOSMALL22, 0, 30))
  313. return FALSE;
  314. fBmpDirty = TRUE;
  315. }
  316. CopyAnimBmp(hDlg, szSmall, g_szWorkDir, IK_SMALLBITMAP, TEXT("Small_Path"), szInsFile);
  317. if ((fBrandBmps && ISNULL(szSmall) && ISNONNULL(szBig)) || (fBrandBmps && ISNONNULL(szSmall) && ISNULL(szBig)))
  318. {
  319. ErrorMessageBox(hDlg, IDS_BOTHBMP_ERROR);
  320. if (ISNULL(szSmall))
  321. SetFocus(GetDlgItem(hDlg, IDE_SMALLANIMBITMAP));
  322. else
  323. SetFocus(GetDlgItem(hDlg, IDE_BIGANIMBITMAP));
  324. return FALSE;
  325. }
  326. InsWriteBool(IS_ANIMATION, IK_DOANIMATION, fBrandBmps, szInsFile);
  327. WritePrivateProfileString(NULL, NULL, NULL, szInsFile);
  328. }
  329. if (fBmpDirty)
  330. g_fInsDirty = TRUE;
  331. return TRUE;
  332. }
  333. void DisplayBitmap(HWND hControl, LPCTSTR pcszFileName, int nBitmapId)
  334. {
  335. HANDLE hBmp = (HANDLE) GetWindowLongPtr(hControl, GWLP_USERDATA);
  336. if(ISNONNULL(pcszFileName) && PathFileExists(pcszFileName))
  337. ShowBitmap(hControl, pcszFileName, 0, &hBmp);
  338. else
  339. ShowBitmap(hControl, TEXT(""), nBitmapId, &hBmp);
  340. SetWindowLongPtr(hControl, GWLP_USERDATA, (LONG_PTR)hBmp);
  341. }
  342. void ReleaseBitmap(HWND hControl)
  343. {
  344. HANDLE hBmp = (HANDLE) GetWindowLongPtr(hControl, GWLP_USERDATA);
  345. if (hBmp)
  346. DeleteObject(hBmp);
  347. }
  348. INT_PTR CALLBACK LogoProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam )
  349. {
  350. TCHAR szBig[MAX_PATH];
  351. TCHAR szSmall[MAX_PATH];
  352. TCHAR szTemp[MAX_PATH];
  353. BOOL fBrandBmps, fBrandAnim;
  354. switch( msg )
  355. {
  356. case WM_INITDIALOG:
  357. //from old animbmp
  358. EnableDBCSChars(hDlg, IDE_SMALLANIMBITMAP);
  359. EnableDBCSChars(hDlg, IDE_BIGANIMBITMAP);
  360. Edit_LimitText(GetDlgItem(hDlg, IDE_SMALLANIMBITMAP), countof(szSmall) - 1);
  361. Edit_LimitText(GetDlgItem(hDlg, IDE_BIGANIMBITMAP), countof(szBig) - 1);
  362. // load information from ins file
  363. InitializeAnimBmps(hDlg, g_szInsFile);
  364. //from old logo
  365. EnableDBCSChars(hDlg, IDC_BITMAP);
  366. EnableDBCSChars(hDlg, IDC_BITMAP2);
  367. Edit_LimitText(GetDlgItem(hDlg, IDC_BITMAP), countof(szBig) - 1);
  368. Edit_LimitText(GetDlgItem(hDlg, IDC_BITMAP2), countof(szSmall) - 1);
  369. // load information from ins file
  370. InsGetString(IS_SMALLLOGO, TEXT("Path"),
  371. szSmall, ARRAYSIZE(szSmall), g_szInsFile, NULL, &fBrandBmps);
  372. SetDlgItemTextTriState(hDlg, IDC_BITMAP2, IDC_BITMAPCHECK, szSmall, fBrandBmps);
  373. EnableDlgItem2(hDlg, IDC_BROWSEICON2, fBrandBmps);
  374. EnableDlgItem2(hDlg, IDC_SMALLBITMAP_TXT, fBrandBmps);
  375. if (ISNONNULL(szSmall))
  376. {
  377. if(!PathFileExists(szSmall))
  378. {
  379. PathCombine(szTemp, g_szWorkDir, PathFindFileName(szSmall));
  380. StrCpy(szSmall, szTemp);
  381. }
  382. }
  383. InsGetString(IS_LARGELOGO, TEXT("Path"),
  384. szBig, ARRAYSIZE(szBig), g_szInsFile, NULL, &fBrandBmps);
  385. SetDlgItemTextTriState(hDlg, IDC_BITMAP, IDC_BITMAPCHECK, szBig, fBrandBmps);
  386. EnableDlgItem2(hDlg, IDC_BROWSEICON, fBrandBmps);
  387. EnableDlgItem2(hDlg, IDC_LARGEBITMAP_TXT, fBrandBmps);
  388. if(ISNONNULL(szBig))
  389. {
  390. if(!PathFileExists( szBig ))
  391. {
  392. PathCombine(szTemp, g_szWorkDir, PathFindFileName(szBig));
  393. StrCpy(szBig, szTemp);
  394. }
  395. }
  396. break;
  397. case WM_COMMAND:
  398. switch (GET_WM_COMMAND_ID(wParam, lParam))
  399. {
  400. case IDC_BROWSEBIG:
  401. GetDlgItemText(hDlg, IDE_BIGANIMBITMAP, szBig, countof(szBig));
  402. if(BrowseForFile(hDlg, szBig, countof(szBig), GFN_BMP))
  403. SetDlgItemText(hDlg, IDE_BIGANIMBITMAP, szBig);
  404. SetFocus(GetDlgItem(hDlg, IDC_BROWSEBIG));
  405. break;
  406. case IDC_BROWSESMALL:
  407. GetDlgItemText(hDlg, IDE_SMALLANIMBITMAP, szSmall, countof(szSmall));
  408. if(BrowseForFile(hDlg, szSmall, countof(szSmall), GFN_BMP))
  409. SetDlgItemText(hDlg, IDE_SMALLANIMBITMAP, szSmall);
  410. SetFocus(GetDlgItem(hDlg, IDC_BROWSESMALL));
  411. break;
  412. case IDC_ANIMBITMAP:
  413. fBrandAnim = (IsDlgButtonChecked(hDlg, IDC_ANIMBITMAP) == BST_CHECKED);
  414. EnableDlgItem2(hDlg, IDE_BIGANIMBITMAP, fBrandAnim);
  415. EnableDlgItem2(hDlg, IDC_BROWSEBIG, fBrandAnim);
  416. EnableDlgItem2(hDlg, IDC_BIGANIMBITMAP_TXT, fBrandAnim);
  417. EnableDlgItem2(hDlg, IDE_SMALLANIMBITMAP, fBrandAnim);
  418. EnableDlgItem2(hDlg, IDC_BROWSESMALL, fBrandAnim);
  419. EnableDlgItem2(hDlg, IDC_SMALLANIMBITMAP_TXT, fBrandAnim);
  420. break;
  421. case IDC_BROWSEICON:
  422. if(HIWORD(wParam) == BN_CLICKED)
  423. {
  424. GetDlgItemText(hDlg, IDC_BITMAP, szBig, countof(szBig));
  425. if(BrowseForFile(hDlg, szBig, countof(szBig), GFN_BMP))
  426. SetDlgItemText(hDlg, IDC_BITMAP, szBig);
  427. SetFocus(GetDlgItem(hDlg, IDC_BROWSEICON));
  428. break;
  429. }
  430. return FALSE;
  431. case IDC_BROWSEICON2:
  432. if(HIWORD(wParam) == BN_CLICKED)
  433. {
  434. GetDlgItemText(hDlg, IDC_BITMAP2, szSmall, countof(szSmall));
  435. if(BrowseForFile(hDlg, szSmall, countof(szSmall), GFN_BMP))
  436. SetDlgItemText(hDlg, IDC_BITMAP2, szSmall);
  437. SetFocus(GetDlgItem(hDlg, IDC_BROWSEICON2));
  438. break;
  439. }
  440. return FALSE;
  441. case IDC_BITMAPCHECK:
  442. if(HIWORD(wParam) == BN_CLICKED)
  443. {
  444. fBrandBmps = (IsDlgButtonChecked(hDlg, IDC_BITMAPCHECK) == BST_CHECKED);
  445. EnableDlgItem2(hDlg, IDC_BITMAP, fBrandBmps);
  446. EnableDlgItem2(hDlg, IDC_BITMAP2, fBrandBmps);
  447. EnableDlgItem2(hDlg, IDC_BROWSEICON2, fBrandBmps);
  448. EnableDlgItem2(hDlg, IDC_BROWSEICON, fBrandBmps);
  449. EnableDlgItem2(hDlg, IDC_SMALLBITMAP_TXT, fBrandBmps);
  450. EnableDlgItem2(hDlg, IDC_LARGEBITMAP_TXT, fBrandBmps);
  451. break;
  452. }
  453. return FALSE;
  454. default:
  455. return FALSE;
  456. }
  457. break;
  458. case UM_SAVE:
  459. // write the information back to the ins file
  460. {
  461. *((LPBOOL)wParam) = SaveAnimBmps(hDlg, g_szInsFile, (BOOL) lParam);
  462. TCHAR szSmallTemp[MAX_PATH];
  463. TCHAR szBigTemp[MAX_PATH];
  464. BOOL fBmpDirty = FALSE;
  465. BOOL fCheckDirtyOnly = (BOOL) lParam;
  466. BOOL fTemp;
  467. fBrandBmps = (IsDlgButtonChecked(hDlg, IDC_BITMAPCHECK) == BST_CHECKED);
  468. GetDlgItemText(hDlg, IDC_BITMAP2, szSmall, countof(szSmall));
  469. InsGetString(IS_SMALLLOGO, TEXT("Path"), szSmallTemp, ARRAYSIZE(szSmallTemp),
  470. g_szInsFile, NULL, &fTemp);
  471. GetDlgItemText(hDlg, IDC_BITMAP, szBig, countof(szBig));
  472. InsGetString(IS_LARGELOGO, TEXT("Path"), szBigTemp, ARRAYSIZE(szBigTemp), g_szInsFile);
  473. if (fCheckDirtyOnly)
  474. {
  475. if(fBrandBmps != fTemp || StrCmpI(szSmall, szSmallTemp) != 0 || StrCmpI(szBig, szBigTemp) != 0)
  476. fBmpDirty = TRUE;
  477. }
  478. else
  479. {
  480. if(fBrandBmps != fTemp || StrCmpI(szSmall, szSmallTemp) != 0)
  481. {
  482. if (fBrandBmps && !IsBitmapFileValid(hDlg, IDC_BITMAP2, szSmall, NULL, 22, 22, IDS_TOOBIG22, IDS_TOOSMALL22))
  483. return FALSE;
  484. fBmpDirty = TRUE;
  485. }
  486. CopyLogoBmp(hDlg, szSmall, IS_SMALLLOGO, g_szWorkDir, g_szInsFile);
  487. if(fBrandBmps != fTemp || StrCmpI(szBig, szBigTemp) != 0)
  488. {
  489. if (fBrandBmps && !IsBitmapFileValid(hDlg, IDC_BITMAP, szBig, NULL, 38, 38, IDS_TOOBIG38, IDS_TOOSMALL38))
  490. return FALSE;
  491. fBmpDirty = TRUE;
  492. }
  493. CopyLogoBmp(hDlg, szBig, IS_LARGELOGO, g_szWorkDir, g_szInsFile);
  494. if ((fBrandBmps && ISNULL(szSmall) && ISNONNULL(szBig)) || (fBrandBmps && ISNONNULL(szSmall) && ISNULL(szBig)))
  495. {
  496. ErrorMessageBox(hDlg, IDS_BOTHBMP_ERROR);
  497. if (ISNULL(szSmall))
  498. SetFocus(GetDlgItem(hDlg, IDC_BITMAP2));
  499. else
  500. SetFocus(GetDlgItem(hDlg, IDC_BITMAP));
  501. return FALSE;
  502. }
  503. WritePrivateProfileString(NULL, NULL, NULL, g_szInsFile);
  504. }
  505. if (fBmpDirty)
  506. g_fInsDirty = TRUE;
  507. }
  508. *((LPBOOL)wParam) = TRUE;
  509. break;
  510. case WM_CLOSE:
  511. DestroyWindow(hDlg);
  512. return FALSE;
  513. default:
  514. return FALSE;
  515. }
  516. return TRUE;
  517. }
  518. void EnableProxyControls( HWND hDlg, BOOL fSame, BOOL fUseProxy )
  519. {
  520. EnableDlgItem2(hDlg, IDE_FTPPROXY, (!fSame) && fUseProxy);
  521. EnableDlgItem2(hDlg, IDE_FTPPORT, (!fSame) && fUseProxy);
  522. EnableDlgItem2(hDlg, IDC_FTPPROXY1, (!fSame) && fUseProxy);
  523. EnableDlgItem2(hDlg, IDE_SECPROXY, (!fSame) && fUseProxy);
  524. EnableDlgItem2(hDlg, IDE_SECPORT, (!fSame) && fUseProxy);
  525. EnableDlgItem2(hDlg, IDC_SECPROXY1, (!fSame) && fUseProxy);
  526. EnableDlgItem2(hDlg, IDE_GOPHERPROXY, (!fSame) && fUseProxy);
  527. EnableDlgItem2(hDlg, IDE_GOPHERPORT, (!fSame) && fUseProxy);
  528. EnableDlgItem2(hDlg, IDC_GOPHERPROXY1, (!fSame) && fUseProxy);
  529. EnableDlgItem2(hDlg, IDE_SOCKSPROXY, (!fSame) && fUseProxy);
  530. EnableDlgItem2(hDlg, IDE_SOCKSPORT, (!fSame) && fUseProxy);
  531. EnableDlgItem2(hDlg, IDC_SOCKSPROXY1, (!fSame) && fUseProxy);
  532. EnableDlgItem2(hDlg, IDE_HTTPPROXY, fUseProxy);
  533. EnableDlgItem2(hDlg, IDE_HTTPPORT, fUseProxy);
  534. EnableDlgItem2(hDlg, IDC_HTTPPROXY1, fUseProxy);
  535. EnableDlgItem2(hDlg, IDC_SAMEFORALL, fUseProxy);
  536. EnableDlgItem2(hDlg, IDE_DISPROXYADR, fUseProxy);
  537. EnableDlgItem2(hDlg, IDC_DISPROXYADR1, fUseProxy);
  538. EnableDlgItem2(hDlg, IDC_DISPROXYLOCAL, fUseProxy);
  539. }
  540. void InitializeProxy(HWND hDlg, LPCTSTR szInsFile)
  541. {
  542. BOOL fUseProxy;
  543. BOOL fSameProxy;
  544. BOOL fLocal;
  545. LPTSTR pLocal;
  546. TCHAR szProxy[MAX_PATH];
  547. TCHAR szProxyOverride[MAX_STRING];
  548. fUseProxy = InsGetBool(IS_PROXY, IK_PROXYENABLE, FALSE, szInsFile);
  549. CheckDlgButton( hDlg, IDC_YESPROXY, fUseProxy );
  550. fSameProxy = InsGetBool(IS_PROXY, IK_SAMEPROXY, TRUE, szInsFile);
  551. CheckDlgButton( hDlg, IDC_SAMEFORALL, fSameProxy );
  552. GetPrivateProfileString( TEXT("Proxy"), TEXT("HTTP_Proxy_Server"), TEXT(""), szProxy,
  553. ARRAYSIZE(szProxy), szInsFile );
  554. if( fSameProxy )
  555. {
  556. SetProxyDlg( hDlg, szProxy, IDE_HTTPPROXY, IDE_HTTPPORT, TRUE );
  557. SetProxyDlg( hDlg, szProxy, IDE_FTPPROXY, IDE_FTPPORT, TRUE );
  558. SetProxyDlg( hDlg, szProxy, IDE_GOPHERPROXY, IDE_GOPHERPORT, TRUE );
  559. SetProxyDlg( hDlg, szProxy, IDE_SECPROXY, IDE_SECPORT, TRUE );
  560. SetProxyDlg( hDlg, szProxy, IDE_SOCKSPROXY, IDE_SOCKSPORT, FALSE );
  561. }
  562. else
  563. {
  564. SetProxyDlg( hDlg, szProxy, IDE_HTTPPROXY, IDE_HTTPPORT, TRUE );
  565. GetPrivateProfileString( TEXT("Proxy"), TEXT("FTP_Proxy_Server"), TEXT(""), szProxy, ARRAYSIZE(szProxy), szInsFile );
  566. SetProxyDlg( hDlg, szProxy, IDE_FTPPROXY, IDE_FTPPORT, TRUE );
  567. GetPrivateProfileString( TEXT("Proxy"), TEXT("Gopher_Proxy_Server"), TEXT(""), szProxy, ARRAYSIZE(szProxy), szInsFile );
  568. SetProxyDlg( hDlg, szProxy, IDE_GOPHERPROXY, IDE_GOPHERPORT, TRUE );
  569. GetPrivateProfileString( TEXT("Proxy"), TEXT("Secure_Proxy_Server"), TEXT(""), szProxy, ARRAYSIZE(szProxy), szInsFile );
  570. SetProxyDlg( hDlg, szProxy, IDE_SECPROXY, IDE_SECPORT, TRUE );
  571. GetPrivateProfileString( TEXT("Proxy"), TEXT("Socks_Proxy_Server"), TEXT(""), szProxy, ARRAYSIZE(szProxy), szInsFile );
  572. if( *szProxy != 0 )
  573. SetProxyDlg( hDlg, szProxy, IDE_SOCKSPROXY, IDE_SOCKSPORT, FALSE );
  574. }
  575. GetPrivateProfileString( TEXT("Proxy"), TEXT("Proxy_Override"), TEXT("<local>"), szProxyOverride,
  576. ARRAYSIZE( szProxyOverride ), szInsFile );
  577. pLocal = StrStr(szProxyOverride, TEXT("<local>"));
  578. if(pLocal)
  579. {
  580. if (pLocal == (LPTSTR) szProxyOverride) // at the beginning
  581. {
  582. LPTSTR pSemi = pLocal + 7;
  583. if( *pSemi == TEXT(';') ) pSemi++;
  584. MoveMemory(pLocal, pSemi, StrCbFromSz(pSemi));
  585. }
  586. else if (*(pLocal + 7) == TEXT('\0')) // at the end
  587. *(pLocal - 1) = TEXT('\0');
  588. fLocal = TRUE;
  589. }
  590. else
  591. fLocal = FALSE;
  592. CheckDlgButton( hDlg, IDC_DISPROXYLOCAL, fLocal );
  593. SetDlgItemText( hDlg, IDE_DISPROXYADR, szProxyOverride );
  594. EnableProxyControls( hDlg, fSameProxy, fUseProxy );
  595. }
  596. BOOL SaveProxy(HWND hDlg, LPCTSTR szInsFile, BOOL fCheckDirtyOnly)
  597. {
  598. BOOL fUseProxy;
  599. BOOL fSameProxy;
  600. BOOL fLocal;
  601. TCHAR szProxy[MAX_PATH];
  602. BOOL fTemp;
  603. TCHAR szTemp[MAX_STRING];
  604. TCHAR szProxyOverride[MAX_STRING];
  605. if (!fCheckDirtyOnly &&
  606. (!CheckField(hDlg, IDE_HTTPPORT, FC_NUMBER) ||
  607. !CheckField(hDlg, IDE_FTPPORT, FC_NUMBER) ||
  608. !CheckField(hDlg, IDE_GOPHERPORT, FC_NUMBER) ||
  609. !CheckField(hDlg, IDE_SECPORT, FC_NUMBER) ||
  610. !CheckField(hDlg, IDE_SOCKSPORT, FC_NUMBER)))
  611. return FALSE;
  612. fSameProxy = IsDlgButtonChecked( hDlg, IDC_SAMEFORALL );
  613. fUseProxy = IsDlgButtonChecked( hDlg, IDC_YESPROXY );
  614. fLocal = IsDlgButtonChecked( hDlg, IDC_DISPROXYLOCAL );
  615. GetProxyDlg( hDlg, szProxy, IDE_HTTPPROXY, IDE_HTTPPORT );
  616. if (!g_fInsDirty)
  617. {
  618. GetPrivateProfileString( TEXT("Proxy"), TEXT("HTTP_Proxy_Server"), TEXT(""), szTemp, ARRAYSIZE(szTemp), szInsFile );
  619. if (StrCmp(szTemp, szProxy) != 0)
  620. g_fInsDirty = TRUE;
  621. }
  622. if (!fCheckDirtyOnly)
  623. WritePrivateProfileString( TEXT("Proxy"), TEXT("HTTP_Proxy_Server"), szProxy, szInsFile );
  624. GetProxyDlg( hDlg, szProxy, IDE_FTPPROXY, IDE_FTPPORT );
  625. if (!g_fInsDirty)
  626. {
  627. GetPrivateProfileString( TEXT("Proxy"), TEXT("FTP_Proxy_Server"), TEXT(""), szTemp, ARRAYSIZE(szTemp), szInsFile );
  628. if (StrCmp(szTemp, szProxy) != 0)
  629. g_fInsDirty = TRUE;
  630. }
  631. if (!fCheckDirtyOnly)
  632. WritePrivateProfileString( TEXT("Proxy"), TEXT("FTP_Proxy_Server"), szProxy, szInsFile );
  633. GetProxyDlg( hDlg, szProxy, IDE_GOPHERPROXY, IDE_GOPHERPORT );
  634. if (!g_fInsDirty)
  635. {
  636. GetPrivateProfileString( TEXT("Proxy"), TEXT("Gopher_Proxy_Server"), TEXT(""), szTemp, ARRAYSIZE(szTemp), szInsFile );
  637. if (StrCmp(szTemp, szProxy) != 0)
  638. g_fInsDirty = TRUE;
  639. }
  640. if (!fCheckDirtyOnly)
  641. WritePrivateProfileString( TEXT("Proxy"), TEXT("Gopher_Proxy_Server"), szProxy, szInsFile );
  642. GetProxyDlg( hDlg, szProxy, IDE_SECPROXY, IDE_SECPORT );
  643. if (!g_fInsDirty)
  644. {
  645. GetPrivateProfileString( TEXT("Proxy"), TEXT("Secure_Proxy_Server"), TEXT(""), szTemp, ARRAYSIZE(szTemp), szInsFile );
  646. if (StrCmp(szTemp, szProxy) != 0)
  647. g_fInsDirty = TRUE;
  648. }
  649. if (!fCheckDirtyOnly)
  650. WritePrivateProfileString( TEXT("Proxy"), TEXT("Secure_Proxy_Server"), szProxy, szInsFile );
  651. GetProxyDlg( hDlg, szProxy, IDE_SOCKSPROXY, IDE_SOCKSPORT );
  652. if (!g_fInsDirty)
  653. {
  654. GetPrivateProfileString( TEXT("Proxy"), TEXT("Socks_Proxy_Server"), TEXT(""), szTemp, ARRAYSIZE(szTemp), szInsFile );
  655. if (StrCmp(szTemp, szProxy) != 0)
  656. g_fInsDirty = TRUE;
  657. }
  658. if (!fCheckDirtyOnly)
  659. WritePrivateProfileString( TEXT("Proxy"), TEXT("Socks_Proxy_Server"), szProxy, szInsFile );
  660. if (!g_fInsDirty)
  661. {
  662. fTemp = (BOOL) GetPrivateProfileInt( TEXT("Proxy"), TEXT("Use_Same_Proxy"), 0, szInsFile );
  663. if (fTemp != fSameProxy)
  664. g_fInsDirty = TRUE;
  665. }
  666. if (!fCheckDirtyOnly)
  667. WritePrivateProfileString( TEXT("Proxy"), TEXT("Use_Same_Proxy"), fSameProxy ? TEXT("1") : TEXT("0"), szInsFile );
  668. if (!g_fInsDirty)
  669. {
  670. fTemp = (BOOL) GetPrivateProfileInt( TEXT("Proxy"), TEXT("Proxy_Enable"), 0, szInsFile );
  671. if (fTemp != fUseProxy)
  672. g_fInsDirty = TRUE;
  673. }
  674. if (!fCheckDirtyOnly)
  675. WritePrivateProfileString( TEXT("Proxy"), TEXT("Proxy_Enable"), fUseProxy ? TEXT("1") : TEXT("0"), szInsFile );
  676. GetDlgItemText( hDlg, IDE_DISPROXYADR, szProxyOverride, countof(szProxyOverride) - 10 ); // 8 for ;<local> + 2 for ""
  677. GetPrivateProfileString( TEXT("Proxy"), TEXT("Proxy_Override"), TEXT(""), szTemp, ARRAYSIZE(szTemp), szInsFile );
  678. if( fLocal )
  679. {
  680. if( *szProxyOverride != 0 )
  681. {
  682. TCHAR szPort[MAX_STRING];
  683. StrRemoveAllWhiteSpace(szProxyOverride);
  684. wsprintf( szPort, TEXT("%s;<local>"), szProxyOverride );
  685. if (!g_fInsDirty)
  686. {
  687. if (StrCmp(szTemp, szPort) != 0)
  688. g_fInsDirty = TRUE;
  689. }
  690. if (!fCheckDirtyOnly)
  691. InsWriteQuotedString( TEXT("Proxy"), TEXT("Proxy_Override"), szPort, szInsFile );
  692. }
  693. else
  694. {
  695. if (!g_fInsDirty)
  696. {
  697. if (StrCmp(szTemp, TEXT("<local>")) != 0)
  698. g_fInsDirty = TRUE;
  699. }
  700. if (!fCheckDirtyOnly)
  701. WritePrivateProfileString( TEXT("Proxy"), TEXT("Proxy_Override"), TEXT("<local>"), szInsFile );
  702. }
  703. }
  704. else
  705. {
  706. if (!g_fInsDirty)
  707. {
  708. if (StrCmp(szTemp, szProxyOverride) != 0)
  709. g_fInsDirty = TRUE;
  710. }
  711. if (!fCheckDirtyOnly)
  712. WritePrivateProfileString( TEXT("Proxy"), TEXT("Proxy_Override"), szProxyOverride, szInsFile );
  713. }
  714. return TRUE;
  715. }
  716. INT_PTR CALLBACK ProxyProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam )
  717. {
  718. BOOL fSameProxy;
  719. BOOL fUseProxy;
  720. BOOL fLocal;
  721. TCHAR szProxy[MAX_PATH];
  722. TCHAR szPort[MAX_PATH];
  723. switch( msg )
  724. {
  725. case WM_INITDIALOG:
  726. // warn the user that settings on this page will override imported connection settings
  727. if (InsGetBool(IS_CONNECTSET, IK_OPTION, FALSE, g_szInsFile))
  728. ErrorMessageBox(hDlg, IDS_CONNECTSET_WARN);
  729. EnableDBCSChars(hDlg, IDE_HTTPPROXY);
  730. EnableDBCSChars(hDlg, IDE_SECPROXY);
  731. EnableDBCSChars(hDlg, IDE_FTPPROXY);
  732. EnableDBCSChars(hDlg, IDE_GOPHERPROXY);
  733. EnableDBCSChars(hDlg, IDE_SOCKSPROXY);
  734. EnableDBCSChars(hDlg, IDE_DISPROXYADR);
  735. Edit_LimitText(GetDlgItem(hDlg, IDE_HTTPPORT), 5);
  736. Edit_LimitText(GetDlgItem(hDlg, IDE_FTPPORT), 5);
  737. Edit_LimitText(GetDlgItem(hDlg, IDE_GOPHERPORT), 5);
  738. Edit_LimitText(GetDlgItem(hDlg, IDE_SECPORT), 5);
  739. Edit_LimitText(GetDlgItem(hDlg, IDE_SOCKSPORT), 5);
  740. Edit_LimitText(GetDlgItem(hDlg, IDE_DISPROXYADR), MAX_STRING - 11); // 8 for ;<local> + 2 for the double quotes
  741. // load information from ins file
  742. InitializeProxy(hDlg, g_szInsFile);
  743. break;
  744. case WM_COMMAND:
  745. fSameProxy = IsDlgButtonChecked( hDlg, IDC_SAMEFORALL );
  746. fUseProxy = IsDlgButtonChecked( hDlg, IDC_YESPROXY );
  747. fLocal = IsDlgButtonChecked( hDlg, IDC_DISPROXYLOCAL );
  748. if( HIWORD(wParam) == BN_CLICKED )
  749. {
  750. switch( LOWORD(wParam))
  751. {
  752. case IDC_SAMEFORALL:
  753. GetDlgItemText( hDlg, IDE_HTTPPROXY, szProxy, MAX_PATH );
  754. GetDlgItemText( hDlg, IDE_HTTPPORT, szPort, MAX_PATH );
  755. StrCat( szProxy, TEXT(":") );
  756. StrCat( szProxy, szPort );
  757. if( fSameProxy )
  758. {
  759. SetProxyDlg( hDlg, szProxy, IDE_HTTPPROXY, IDE_HTTPPORT, TRUE );
  760. SetProxyDlg( hDlg, szProxy, IDE_FTPPROXY, IDE_FTPPORT, TRUE );
  761. SetProxyDlg( hDlg, szProxy, IDE_GOPHERPROXY, IDE_GOPHERPORT, TRUE );
  762. SetProxyDlg( hDlg, szProxy, IDE_SECPROXY, IDE_SECPORT, TRUE );
  763. SetProxyDlg( hDlg, szProxy, IDE_SOCKSPROXY, IDE_SOCKSPORT, FALSE );
  764. }
  765. // fallthrough
  766. case IDC_YESPROXY:
  767. EnableProxyControls( hDlg, fSameProxy, fUseProxy );
  768. break;
  769. }
  770. }
  771. else if( (HIWORD(wParam) == EN_UPDATE) && fSameProxy && ((LOWORD(wParam) == IDE_HTTPPROXY) || (LOWORD(wParam) == IDE_HTTPPORT)))
  772. {
  773. GetDlgItemText( hDlg, IDE_HTTPPROXY, szProxy, MAX_PATH );
  774. GetDlgItemText( hDlg, IDE_HTTPPORT, szPort, MAX_PATH );
  775. StrCat( szProxy, TEXT(":") );
  776. StrCat( szProxy, szPort );
  777. SetProxyDlg( hDlg, szProxy, IDE_FTPPROXY, IDE_FTPPORT, TRUE );
  778. SetProxyDlg( hDlg, szProxy, IDE_GOPHERPROXY, IDE_GOPHERPORT, TRUE );
  779. SetProxyDlg( hDlg, szProxy, IDE_SECPROXY, IDE_SECPORT, TRUE );
  780. SetProxyDlg( hDlg, szProxy, IDE_SOCKSPROXY, IDE_SOCKSPORT, FALSE );
  781. }
  782. break;
  783. case UM_SAVE:
  784. *((LPBOOL)wParam) = SaveProxy(hDlg, g_szInsFile, (BOOL) lParam);
  785. break;
  786. case WM_CLOSE:
  787. DestroyWindow(hDlg);
  788. return FALSE;
  789. default:
  790. return FALSE;
  791. }
  792. return TRUE;
  793. }
  794. INT_PTR CALLBACK ConnectionSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
  795. {
  796. switch (uMsg)
  797. {
  798. case WM_INITDIALOG:
  799. CheckRadioButton(hDlg, IDC_CSNOIMPORT, IDC_CSIMPORT, IDC_CSNOIMPORT);
  800. ReadBoolAndCheckButton(IS_CONNECTSET, IK_DELETECONN, 0, g_szInsFile, hDlg, IDC_DELCONNECT);
  801. DisableDlgItem(hDlg, IDC_MODIFYCONNECT);
  802. return TRUE;
  803. case WM_COMMAND:
  804. switch (HIWORD(wParam))
  805. {
  806. case BN_CLICKED:
  807. switch (LOWORD(wParam))
  808. {
  809. case IDC_CSNOIMPORT:
  810. DisableDlgItem(hDlg, IDC_MODIFYCONNECT);
  811. break;
  812. case IDC_CSIMPORT:
  813. EnableDlgItem(hDlg, IDC_MODIFYCONNECT);
  814. break;
  815. case IDC_MODIFYCONNECT:
  816. ShowInetcpl(hDlg, INET_PAGE_CONNECTION);
  817. SetFocus(GetDlgItem(hDlg, IDC_MODIFYCONNECT));
  818. break;
  819. }
  820. break;
  821. }
  822. break;
  823. case UM_SAVE:
  824. {
  825. TCHAR szCSWorkDir[MAX_PATH];
  826. BOOL fCheckDirtyOnly = (BOOL) lParam;
  827. BOOL fDeleteCS;
  828. if (IsDlgButtonChecked(hDlg, IDC_CSIMPORT) == BST_CHECKED)
  829. {
  830. if (!fCheckDirtyOnly)
  831. {
  832. PathCombine(szCSWorkDir, g_szWorkDir, TEXT("connect.wrk"));
  833. ImportConnectSet(g_szInsFile, szCSWorkDir, g_szWorkDir, TRUE, IEM_PROFMGR);
  834. CheckRadioButton(hDlg, IDC_CSNOIMPORT, IDC_CSIMPORT, IDC_CSNOIMPORT);
  835. DisableDlgItem(hDlg, IDC_MODIFYCONNECT);
  836. }
  837. g_fInsDirty = TRUE;
  838. }
  839. fDeleteCS = (IsDlgButtonChecked(hDlg, IDC_DELCONNECT) == BST_CHECKED);
  840. if (!g_fInsDirty)
  841. {
  842. BOOL fTemp;
  843. fTemp = InsGetBool(IS_CONNECTSET, IK_DELETECONN, 0, g_szInsFile);
  844. if (fTemp != fDeleteCS)
  845. g_fInsDirty = TRUE;
  846. }
  847. if (!fCheckDirtyOnly)
  848. InsWriteBool(IS_CONNECTSET, IK_DELETECONN, fDeleteCS, g_szInsFile);
  849. }
  850. *((LPBOOL)wParam) = TRUE;
  851. break;
  852. case WM_CLOSE:
  853. DestroyWindow(hDlg);
  854. return FALSE;
  855. default:
  856. return FALSE;
  857. }
  858. return TRUE;
  859. }
  860. HRESULT ConnectionSettingsFinalCopy(LPCTSTR pcszDestDir, DWORD dwFlags, LPDWORD pdwCabState)
  861. {
  862. TCHAR szFrom[MAX_PATH];
  863. PathCombine(szFrom, g_szWorkDir, TEXT("connect.wrk"));
  864. if (HasFlag(dwFlags, PM_CHECK) && pdwCabState != NULL && !PathIsEmptyPath(szFrom, FILES_ONLY))
  865. SetFlag(pdwCabState, CAB_TYPE_CONFIG);
  866. if (HasFlag(dwFlags, PM_COPY))
  867. CopyFileToDir(szFrom, pcszDestDir);
  868. if (HasFlag(dwFlags, PM_CLEAR))
  869. PathRemovePath(szFrom);
  870. return S_OK;
  871. }
  872. INT_PTR CALLBACK StartSearchProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam )
  873. {
  874. switch( msg )
  875. {
  876. case WM_INITDIALOG:
  877. EnableDBCSChars(hDlg, IDE_STARTPAGE);
  878. EnableDBCSChars(hDlg, IDE_SEARCHPAGE);
  879. EnableDBCSChars(hDlg, IDE_CUSTOMSUPPORT);
  880. Edit_LimitText(GetDlgItem(hDlg, IDE_STARTPAGE), INTERNET_MAX_URL_LENGTH - 1);
  881. Edit_LimitText(GetDlgItem(hDlg, IDE_SEARCHPAGE), INTERNET_MAX_URL_LENGTH - 1);
  882. Edit_LimitText(GetDlgItem(hDlg, IDE_CUSTOMSUPPORT), INTERNET_MAX_URL_LENGTH - 1);
  883. // load information from ins file
  884. InitializeStartSearch(hDlg, g_szInsFile, NULL);
  885. break;
  886. case WM_COMMAND:
  887. if (GET_WM_COMMAND_CMD(wParam, lParam) != BN_CLICKED)
  888. return FALSE;
  889. switch (GET_WM_COMMAND_ID(wParam, lParam))
  890. {
  891. case IDC_STARTPAGE:
  892. EnableDlgItem2(hDlg, IDE_STARTPAGE, (IsDlgButtonChecked(hDlg, IDC_STARTPAGE) == BST_CHECKED));
  893. EnableDlgItem2(hDlg, IDC_STARTPAGE_TXT, (IsDlgButtonChecked(hDlg, IDC_STARTPAGE) == BST_CHECKED));
  894. break;
  895. case IDC_SEARCHPAGE:
  896. EnableDlgItem2(hDlg, IDE_SEARCHPAGE, (IsDlgButtonChecked(hDlg, IDC_SEARCHPAGE) == BST_CHECKED));
  897. EnableDlgItem2(hDlg, IDC_SEARCHPAGE_TXT, (IsDlgButtonChecked(hDlg, IDC_SEARCHPAGE) == BST_CHECKED));
  898. break;
  899. case IDC_CUSTOMSUPPORT:
  900. EnableDlgItem2(hDlg, IDE_CUSTOMSUPPORT, (IsDlgButtonChecked(hDlg, IDC_CUSTOMSUPPORT) == BST_CHECKED));
  901. EnableDlgItem2(hDlg, IDC_CUSTOMSUPPORT_TXT, (IsDlgButtonChecked(hDlg, IDC_CUSTOMSUPPORT) == BST_CHECKED));
  902. break;
  903. default:
  904. return FALSE;
  905. }
  906. break;
  907. case UM_SAVE:
  908. // write the information back to the ins file
  909. {
  910. BOOL fStartPage = (IsDlgButtonChecked(hDlg, IDC_STARTPAGE) == BST_CHECKED);
  911. BOOL fSearchPage = (IsDlgButtonChecked(hDlg, IDC_SEARCHPAGE) == BST_CHECKED);
  912. BOOL fSupportPage = (IsDlgButtonChecked(hDlg, IDC_CUSTOMSUPPORT) == BST_CHECKED);
  913. if ((fStartPage && !CheckField(hDlg, IDE_STARTPAGE, FC_URL)) ||
  914. (fSearchPage && !CheckField(hDlg, IDE_SEARCHPAGE, FC_URL)) ||
  915. (fSupportPage && !CheckField(hDlg, IDE_CUSTOMSUPPORT, FC_URL)))
  916. return FALSE;
  917. *((LPBOOL)wParam) = SaveStartSearch(hDlg, g_szInsFile, NULL, &g_fInsDirty, (BOOL) lParam);
  918. }
  919. break;
  920. case WM_CLOSE:
  921. DestroyWindow(hDlg);
  922. return FALSE;
  923. default:
  924. return FALSE;
  925. }
  926. return TRUE;
  927. }