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.

1259 lines
49 KiB

  1. #include "precomp.h"
  2. extern TCHAR g_szCustIns[];
  3. extern TCHAR g_szTempSign[];
  4. extern TCHAR g_szMastInf[];
  5. extern BOOL g_fOCW;
  6. extern BOOL g_fIntranet;
  7. extern BOOL g_fInteg;
  8. extern BOOL g_fCD, g_fLAN, g_fDownload, g_fBrandingOnly;
  9. extern PROPSHEETPAGE g_psp[];
  10. extern int g_iCurPage;
  11. // global variables
  12. TCHAR g_szInstallFolder[MAX_PATH] = TEXT("");
  13. BOOL g_fSilent = FALSE;
  14. BOOL g_fStealth = FALSE;
  15. BOOL g_fImportConnect = FALSE;
  16. int g_iInstallOpt;
  17. // static variables
  18. static TCHAR s_szInstallDir[MAX_PATH] = TEXT("");
  19. INT_PTR CALLBACK QueryAutoConfigDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
  20. {
  21. TCHAR szAutoConfigURL[MAX_URL],
  22. szAutoProxyURL[MAX_URL],
  23. szAutoConfigTime[7];
  24. BOOL fDetectConfig,
  25. fUseAutoConfig;
  26. switch (uMsg)
  27. {
  28. case WM_INITDIALOG:
  29. DisableDBCSChars(hDlg, IDE_AUTOCONFIGTIME);
  30. EnableDBCSChars(hDlg, IDE_AUTOCONFIGURL);
  31. EnableDBCSChars(hDlg, IDE_AUTOPROXYURL);
  32. Edit_LimitText(GetDlgItem(hDlg, IDE_AUTOCONFIGTIME), countof(szAutoConfigTime) - 1);
  33. Edit_LimitText(GetDlgItem(hDlg, IDE_AUTOCONFIGURL), countof(szAutoConfigURL) - 1);
  34. Edit_LimitText(GetDlgItem(hDlg, IDE_AUTOPROXYURL), countof(szAutoProxyURL) - 1);
  35. break;
  36. case WM_NOTIFY:
  37. switch (((NMHDR FAR *) lParam)->code)
  38. {
  39. case PSN_SETACTIVE:
  40. SetBannerText(hDlg);
  41. fDetectConfig = FALSE;
  42. if (IsWindowEnabled(GetDlgItem(hDlg, IDC_AUTODETECT))) {
  43. fDetectConfig = InsGetBool(IS_URL, IK_DETECTCONFIG, TRUE, g_szCustIns);
  44. CheckDlgButton(hDlg, IDC_AUTODETECT, fDetectConfig ? BST_CHECKED : BST_UNCHECKED);
  45. }
  46. fUseAutoConfig = InsGetBool(IS_URL, IK_USEAUTOCONF, FALSE, g_szCustIns);
  47. CheckDlgButton(hDlg, IDC_YESAUTOCON, fUseAutoConfig ? BST_CHECKED : BST_UNCHECKED);
  48. GetPrivateProfileString(IS_URL, IK_AUTOCONFTIME, TEXT(""), szAutoConfigTime, countof(szAutoConfigTime), g_szCustIns);
  49. SetDlgItemText(hDlg, IDE_AUTOCONFIGTIME, szAutoConfigTime);
  50. EnableDlgItem2(hDlg, IDE_AUTOCONFIGTIME, fUseAutoConfig);
  51. EnableDlgItem2(hDlg, IDC_AUTOCONFIGTEXT2, fUseAutoConfig);
  52. EnableDlgItem2(hDlg, IDC_AUTOCONFIGTEXT3, fUseAutoConfig);
  53. GetPrivateProfileString(IS_URL, IK_AUTOCONFURL, TEXT(""), szAutoConfigURL, countof(szAutoConfigURL), g_szCustIns);
  54. SetDlgItemText(hDlg, IDE_AUTOCONFIGURL, szAutoConfigURL);
  55. EnableDlgItem2(hDlg, IDE_AUTOCONFIGURL, fUseAutoConfig);
  56. EnableDlgItem2(hDlg, IDC_AUTOCONFIGURL_TXT, fUseAutoConfig);
  57. GetPrivateProfileString(IS_URL, IK_AUTOCONFURLJS, TEXT(""), szAutoProxyURL, countof(szAutoProxyURL), g_szCustIns);
  58. SetDlgItemText(hDlg, IDE_AUTOPROXYURL, szAutoProxyURL);
  59. EnableDlgItem2(hDlg, IDE_AUTOPROXYURL, fUseAutoConfig);
  60. EnableDlgItem2(hDlg, IDC_AUTOPROXYURL_TXT, fUseAutoConfig);
  61. PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_BACK | PSWIZB_NEXT);
  62. CheckBatchAdvance(hDlg);
  63. break;
  64. case PSN_WIZBACK:
  65. case PSN_WIZNEXT:
  66. fDetectConfig = (IsDlgButtonChecked(hDlg, IDC_AUTODETECT) == BST_CHECKED);
  67. fUseAutoConfig = (IsDlgButtonChecked(hDlg, IDC_YESAUTOCON) == BST_CHECKED);
  68. GetDlgItemText(hDlg, IDE_AUTOCONFIGTIME, szAutoConfigTime, countof(szAutoConfigTime));
  69. GetDlgItemText(hDlg, IDE_AUTOCONFIGURL, szAutoConfigURL, countof(szAutoConfigURL));
  70. GetDlgItemText(hDlg, IDE_AUTOPROXYURL, szAutoProxyURL, countof(szAutoProxyURL));
  71. // do error checking
  72. if (fUseAutoConfig) {
  73. if (IsWindowEnabled(GetDlgItem(hDlg, IDE_AUTOCONFIGTIME)) &&
  74. !CheckField(hDlg, IDE_AUTOCONFIGTIME, FC_NUMBER)) {
  75. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, -1);
  76. return TRUE;
  77. }
  78. if (*szAutoConfigURL == TEXT('\0') && *szAutoProxyURL == TEXT('\0')) {
  79. ErrorMessageBox(hDlg, IDS_AUTOCONFIG_NULL);
  80. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, -1);
  81. return TRUE;
  82. }
  83. if (!CheckField(hDlg, IDE_AUTOCONFIGURL, FC_URL) ||
  84. !CheckField(hDlg, IDE_AUTOPROXYURL, FC_URL)) {
  85. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, -1);
  86. return TRUE;
  87. }
  88. }
  89. // write the values to the INS file
  90. InsWriteBoolEx(IS_URL, IK_DETECTCONFIG, fDetectConfig, g_szCustIns);
  91. InsWriteBoolEx(IS_URL, IK_USEAUTOCONF, fUseAutoConfig, g_szCustIns);
  92. InsWriteString(IS_URL, IK_AUTOCONFTIME, szAutoConfigTime, g_szCustIns);
  93. InsWriteString(IS_URL, IK_AUTOCONFURL, szAutoConfigURL, g_szCustIns);
  94. InsWriteString(IS_URL, IK_AUTOCONFURLJS, szAutoProxyURL, g_szCustIns);
  95. g_iCurPage = PPAGE_QUERYAUTOCONFIG;
  96. EnablePages();
  97. (((NMHDR FAR *)lParam)->code == PSN_WIZNEXT) ? PageNext(hDlg) : PagePrev(hDlg);
  98. break;
  99. case PSN_HELP:
  100. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  101. break;
  102. case PSN_QUERYCANCEL:
  103. QueryCancel(hDlg);
  104. break;
  105. default:
  106. return FALSE;
  107. }
  108. break;
  109. case WM_COMMAND:
  110. switch (HIWORD(wParam))
  111. {
  112. case BN_CLICKED:
  113. switch(LOWORD(wParam))
  114. {
  115. case IDC_YESAUTOCON:
  116. fUseAutoConfig = (IsDlgButtonChecked(hDlg, IDC_YESAUTOCON) == BST_CHECKED);
  117. EnableDlgItem2(hDlg, IDE_AUTOCONFIGTIME, fUseAutoConfig);
  118. EnableDlgItem2(hDlg, IDC_AUTOCONFIGTEXT2, fUseAutoConfig);
  119. EnableDlgItem2(hDlg, IDC_AUTOCONFIGTEXT3, fUseAutoConfig);
  120. EnableDlgItem2(hDlg, IDE_AUTOCONFIGURL, fUseAutoConfig);
  121. EnableDlgItem2(hDlg, IDC_AUTOCONFIGURL_TXT, fUseAutoConfig);
  122. EnableDlgItem2(hDlg, IDE_AUTOPROXYURL, fUseAutoConfig);
  123. EnableDlgItem2(hDlg, IDC_AUTOPROXYURL_TXT, fUseAutoConfig);
  124. break;
  125. }
  126. break;
  127. }
  128. break;
  129. case WM_HELP:
  130. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  131. break;
  132. case IDM_BATCHADVANCE:
  133. DoBatchAdvance(hDlg);
  134. break;
  135. default:
  136. return FALSE;
  137. }
  138. return TRUE;
  139. }
  140. void EnableProxyControls(HWND hDlg, BOOL fSame, BOOL fUseProxy)
  141. {
  142. EnableDlgItem2(hDlg, IDE_FTPPROXY, (!fSame) && fUseProxy);
  143. EnableDlgItem2(hDlg, IDE_FTPPORT, (!fSame) && fUseProxy);
  144. EnableDlgItem2(hDlg, IDC_FTPPROXY1, (!fSame) && fUseProxy);
  145. EnableDlgItem2(hDlg, IDE_SECPROXY, (!fSame) && fUseProxy);
  146. EnableDlgItem2(hDlg, IDE_SECPORT, (!fSame) && fUseProxy);
  147. EnableDlgItem2(hDlg, IDC_SECPROXY1, (!fSame) && fUseProxy);
  148. EnableDlgItem2(hDlg, IDE_GOPHERPROXY, (!fSame) && fUseProxy);
  149. EnableDlgItem2(hDlg, IDE_GOPHERPORT, (!fSame) && fUseProxy);
  150. EnableDlgItem2(hDlg, IDC_GOPHERPROXY1, (!fSame) && fUseProxy);
  151. EnableDlgItem2(hDlg, IDE_SOCKSPROXY, (!fSame) && fUseProxy);
  152. EnableDlgItem2(hDlg, IDE_SOCKSPORT, (!fSame) && fUseProxy);
  153. EnableDlgItem2(hDlg, IDC_SOCKSPROXY1, (!fSame) && fUseProxy);
  154. EnableDlgItem2(hDlg, IDE_HTTPPROXY, fUseProxy);
  155. EnableDlgItem2(hDlg, IDE_HTTPPORT, fUseProxy);
  156. EnableDlgItem2(hDlg, IDC_HTTPPROXY1, fUseProxy);
  157. EnableDlgItem2(hDlg, IDC_SAMEFORALL, fUseProxy);
  158. EnableDlgItem2(hDlg, IDE_DISPROXYADR, fUseProxy);
  159. EnableDlgItem2(hDlg, IDC_DISPROXYADR1, fUseProxy);
  160. EnableDlgItem2(hDlg, IDC_DISPROXYLOCAL, fUseProxy);
  161. }
  162. void InitializeProxy(HWND hDlg, LPCTSTR szInsFile)
  163. {
  164. BOOL fUseProxy;
  165. BOOL fSameProxy;
  166. BOOL fLocal;
  167. LPTSTR pLocal;
  168. TCHAR szProxy[MAX_PATH];
  169. TCHAR szProxyOverride[MAX_STRING];
  170. fUseProxy = InsGetBool(IS_PROXY, IK_PROXYENABLE, FALSE, szInsFile);
  171. CheckDlgButton( hDlg, IDC_YESPROXY, fUseProxy );
  172. fSameProxy = InsGetBool(IS_PROXY, IK_SAMEPROXY, TRUE, szInsFile);
  173. CheckDlgButton( hDlg, IDC_SAMEFORALL, fSameProxy );
  174. GetPrivateProfileString( IS_PROXY, IK_HTTPPROXY, TEXT(""), szProxy,
  175. countof(szProxy), szInsFile );
  176. if( fSameProxy )
  177. {
  178. SetProxyDlg( hDlg, szProxy, IDE_HTTPPROXY, IDE_HTTPPORT, TRUE );
  179. SetProxyDlg( hDlg, szProxy, IDE_FTPPROXY, IDE_FTPPORT, TRUE );
  180. SetProxyDlg( hDlg, szProxy, IDE_GOPHERPROXY, IDE_GOPHERPORT, TRUE );
  181. SetProxyDlg( hDlg, szProxy, IDE_SECPROXY, IDE_SECPORT, TRUE );
  182. SetProxyDlg( hDlg, szProxy, IDE_SOCKSPROXY, IDE_SOCKSPORT, FALSE );
  183. }
  184. else
  185. {
  186. SetProxyDlg( hDlg, szProxy, IDE_HTTPPROXY, IDE_HTTPPORT, TRUE );
  187. GetPrivateProfileString( IS_PROXY, IK_FTPPROXY, TEXT(""), szProxy, countof(szProxy), szInsFile );
  188. SetProxyDlg( hDlg, szProxy, IDE_FTPPROXY, IDE_FTPPORT, TRUE );
  189. GetPrivateProfileString( IS_PROXY, IK_GOPHERPROXY, TEXT(""), szProxy, countof(szProxy), szInsFile );
  190. SetProxyDlg( hDlg, szProxy, IDE_GOPHERPROXY, IDE_GOPHERPORT, TRUE );
  191. GetPrivateProfileString( IS_PROXY, IK_SECPROXY, TEXT(""), szProxy, countof(szProxy), szInsFile );
  192. SetProxyDlg( hDlg, szProxy, IDE_SECPROXY, IDE_SECPORT, TRUE );
  193. GetPrivateProfileString( IS_PROXY, IK_SOCKSPROXY, TEXT(""), szProxy, countof(szProxy), szInsFile );
  194. if( lstrlen( szProxy ))
  195. SetProxyDlg( hDlg, szProxy, IDE_SOCKSPROXY, IDE_SOCKSPORT, FALSE );
  196. }
  197. GetPrivateProfileString( IS_PROXY, IK_PROXYOVERRIDE, LOCALPROXY, szProxyOverride,
  198. countof( szProxyOverride ), szInsFile );
  199. pLocal = StrStr(szProxyOverride, LOCALPROXY);
  200. if(pLocal != NULL)
  201. {
  202. if (pLocal == (LPTSTR) szProxyOverride) // at the beginning
  203. {
  204. LPTSTR pSemi = pLocal + 7;
  205. if( *pSemi == TEXT(';') ) pSemi++;
  206. MoveMemory( pLocal, pSemi, (StrLen(pSemi) + 1) * sizeof(TCHAR));
  207. }
  208. else if (*(pLocal + 7) == TEXT('\0')) // at the end
  209. *(pLocal - 1) = TEXT('\0');
  210. fLocal = TRUE;
  211. }
  212. else
  213. fLocal = FALSE;
  214. CheckDlgButton( hDlg, IDC_DISPROXYLOCAL, fLocal );
  215. SetDlgItemText( hDlg, IDE_DISPROXYADR, szProxyOverride );
  216. EnableProxyControls( hDlg, fSameProxy, fUseProxy );
  217. }
  218. BOOL SaveProxy(HWND hDlg, LPCTSTR szInsFile)
  219. {
  220. BOOL fUseProxy;
  221. BOOL fSameProxy;
  222. BOOL fLocal;
  223. TCHAR szProxy[MAX_PATH];
  224. TCHAR szProxyOverride[MAX_STRING];
  225. if (!CheckField(hDlg, IDE_HTTPPORT, FC_NUMBER) ||
  226. !CheckField(hDlg, IDE_FTPPORT, FC_NUMBER) ||
  227. !CheckField(hDlg, IDE_GOPHERPORT, FC_NUMBER) ||
  228. !CheckField(hDlg, IDE_SECPORT, FC_NUMBER) ||
  229. !CheckField(hDlg, IDE_SOCKSPORT, FC_NUMBER))
  230. return FALSE;
  231. fSameProxy = IsDlgButtonChecked( hDlg, IDC_SAMEFORALL );
  232. fUseProxy = IsDlgButtonChecked( hDlg, IDC_YESPROXY );
  233. fLocal = IsDlgButtonChecked( hDlg, IDC_DISPROXYLOCAL );
  234. GetProxyDlg( hDlg, szProxy, IDE_HTTPPROXY, IDE_HTTPPORT );
  235. WritePrivateProfileString( IS_PROXY, IK_HTTPPROXY, szProxy, szInsFile );
  236. GetProxyDlg( hDlg, szProxy, IDE_FTPPROXY, IDE_FTPPORT );
  237. WritePrivateProfileString( IS_PROXY, IK_FTPPROXY, szProxy, szInsFile );
  238. GetProxyDlg( hDlg, szProxy, IDE_GOPHERPROXY, IDE_GOPHERPORT );
  239. WritePrivateProfileString( IS_PROXY, IK_GOPHERPROXY, szProxy, szInsFile );
  240. GetProxyDlg( hDlg, szProxy, IDE_SECPROXY, IDE_SECPORT );
  241. WritePrivateProfileString( IS_PROXY, IK_SECPROXY, szProxy, szInsFile );
  242. GetProxyDlg( hDlg, szProxy, IDE_SOCKSPROXY, IDE_SOCKSPORT );
  243. WritePrivateProfileString( IS_PROXY, IK_SOCKSPROXY, szProxy, szInsFile );
  244. WritePrivateProfileString( IS_PROXY, IK_SAMEPROXY, fSameProxy ? TEXT("1") : TEXT("0"), szInsFile );
  245. WritePrivateProfileString( IS_PROXY, IK_PROXYENABLE, fUseProxy ? TEXT("1") : TEXT("0"), szInsFile );
  246. GetDlgItemText( hDlg, IDE_DISPROXYADR, szProxyOverride, countof(szProxyOverride) - 10 ); // 8 for ;<local> + 2 for ""
  247. if( fLocal )
  248. {
  249. if( *szProxyOverride )
  250. {
  251. TCHAR szPort[MAX_STRING];
  252. StrRemoveAllWhiteSpace(szProxyOverride);
  253. wnsprintf(szPort, countof(szPort), TEXT("%s;%s"), szProxyOverride, LOCALPROXY );
  254. InsWriteQuotedString( IS_PROXY, IK_PROXYOVERRIDE, szPort, szInsFile );
  255. }
  256. else
  257. WritePrivateProfileString( IS_PROXY, IK_PROXYOVERRIDE, LOCALPROXY, szInsFile );
  258. }
  259. else
  260. WritePrivateProfileString( IS_PROXY, IK_PROXYOVERRIDE, szProxyOverride, szInsFile );
  261. return TRUE;
  262. }
  263. INT_PTR CALLBACK ProxySettings( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam )
  264. {
  265. BOOL fSameProxy;
  266. BOOL fUseProxy;
  267. BOOL fLocal;
  268. TCHAR szProxy[MAX_PATH];
  269. switch( msg )
  270. {
  271. case WM_INITDIALOG:
  272. InitSysFont(hDlg, IDE_HTTPPROXY);
  273. InitSysFont(hDlg, IDE_SECPROXY);
  274. InitSysFont(hDlg, IDE_FTPPROXY);
  275. InitSysFont(hDlg, IDE_GOPHERPROXY);
  276. InitSysFont(hDlg, IDE_SOCKSPROXY);
  277. InitSysFont(hDlg, IDE_DISPROXYADR);
  278. Edit_LimitText(GetDlgItem(hDlg, IDE_HTTPPORT), 5);
  279. Edit_LimitText(GetDlgItem(hDlg, IDE_FTPPORT), 5);
  280. Edit_LimitText(GetDlgItem(hDlg, IDE_GOPHERPORT), 5);
  281. Edit_LimitText(GetDlgItem(hDlg, IDE_SECPORT), 5);
  282. Edit_LimitText(GetDlgItem(hDlg, IDE_SOCKSPORT), 5);
  283. Edit_LimitText(GetDlgItem(hDlg, IDE_DISPROXYADR), MAX_STRING - 11); // 8 for ;<local> + 2 for the double quotes
  284. g_hWizard = hDlg;
  285. break;
  286. case IDM_BATCHADVANCE:
  287. DoBatchAdvance(hDlg);
  288. break;
  289. case WM_HELP:
  290. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  291. break;
  292. case WM_COMMAND:
  293. fSameProxy = IsDlgButtonChecked( hDlg, IDC_SAMEFORALL );
  294. fUseProxy = IsDlgButtonChecked( hDlg, IDC_YESPROXY );
  295. fLocal = IsDlgButtonChecked( hDlg, IDC_DISPROXYLOCAL );
  296. if( HIWORD(wParam) == BN_CLICKED )
  297. {
  298. switch( LOWORD(wParam))
  299. {
  300. case IDC_SAMEFORALL:
  301. GetProxyDlg(hDlg, szProxy, IDE_HTTPPROXY, IDE_HTTPPORT);
  302. if( fSameProxy )
  303. {
  304. SetProxyDlg( hDlg, szProxy, IDE_HTTPPROXY, IDE_HTTPPORT, TRUE );
  305. SetProxyDlg( hDlg, szProxy, IDE_FTPPROXY, IDE_FTPPORT, TRUE );
  306. SetProxyDlg( hDlg, szProxy, IDE_GOPHERPROXY, IDE_GOPHERPORT, TRUE );
  307. SetProxyDlg( hDlg, szProxy, IDE_SECPROXY, IDE_SECPORT, TRUE );
  308. SetProxyDlg( hDlg, szProxy, IDE_SOCKSPROXY, IDE_SOCKSPORT, FALSE );
  309. }
  310. // fallthrough
  311. case IDC_YESPROXY:
  312. EnableProxyControls( hDlg, fSameProxy, fUseProxy );
  313. break;
  314. }
  315. }
  316. else if( (HIWORD(wParam) == EN_UPDATE) && fSameProxy && ((LOWORD(wParam) == IDE_HTTPPROXY) || (LOWORD(wParam) == IDE_HTTPPORT)))
  317. {
  318. GetProxyDlg(hDlg, szProxy, IDE_HTTPPROXY, IDE_HTTPPORT);
  319. SetProxyDlg( hDlg, szProxy, IDE_FTPPROXY, IDE_FTPPORT, TRUE );
  320. SetProxyDlg( hDlg, szProxy, IDE_GOPHERPROXY, IDE_GOPHERPORT, TRUE );
  321. SetProxyDlg( hDlg, szProxy, IDE_SECPROXY, IDE_SECPORT, TRUE );
  322. SetProxyDlg( hDlg, szProxy, IDE_SOCKSPROXY, IDE_SOCKSPORT, FALSE );
  323. }
  324. break;
  325. case WM_NOTIFY:
  326. switch (((NMHDR FAR *) lParam)->code)
  327. {
  328. case PSN_HELP:
  329. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  330. break;
  331. case PSN_SETACTIVE:
  332. SetBannerText(hDlg);
  333. InitializeProxy(hDlg, g_szCustIns);
  334. PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_BACK | PSWIZB_NEXT);
  335. CheckBatchAdvance(hDlg);
  336. break;
  337. case PSN_WIZNEXT:
  338. case PSN_WIZBACK:
  339. if (!SaveProxy(hDlg, g_szCustIns))
  340. {
  341. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, -1);
  342. return TRUE;
  343. }
  344. g_iCurPage = PPAGE_PROXY;
  345. EnablePages();
  346. if (((NMHDR FAR *) lParam)->code == PSN_WIZNEXT)
  347. PageNext(hDlg);
  348. else
  349. PagePrev(hDlg);
  350. break;
  351. case PSN_WIZFINISH:
  352. break;
  353. case PSN_QUERYCANCEL:
  354. QueryCancel(hDlg);
  355. break;
  356. default:
  357. return FALSE;
  358. }
  359. break;
  360. default:
  361. return FALSE;
  362. }
  363. return TRUE;
  364. }
  365. INT_PTR CALLBACK ConnectSetDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
  366. {
  367. switch (uMsg)
  368. {
  369. case WM_INITDIALOG:
  370. g_hWizard = hDlg;
  371. break;
  372. case IDM_BATCHADVANCE:
  373. DoBatchAdvance(hDlg);
  374. break;
  375. case WM_HELP:
  376. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  377. break;
  378. case WM_COMMAND:
  379. switch (HIWORD(wParam))
  380. {
  381. case BN_CLICKED:
  382. switch (LOWORD(wParam))
  383. {
  384. case IDC_CSNOIMPORT:
  385. DisableDlgItem(hDlg, IDC_MODIFYCONNECT);
  386. break;
  387. case IDC_CSIMPORT:
  388. EnableDlgItem(hDlg, IDC_MODIFYCONNECT);
  389. break;
  390. case IDC_MODIFYCONNECT:
  391. ShowInetcpl(hDlg, INET_PAGE_CONNECTION, g_fIntranet ? IEM_CORP : IEM_NEUTRAL);
  392. break;
  393. }
  394. break;
  395. }
  396. break;
  397. case WM_NOTIFY:
  398. switch (((NMHDR FAR *) lParam)->code)
  399. {
  400. case PSN_HELP:
  401. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  402. break;
  403. case PSN_SETACTIVE:
  404. {
  405. BOOL fImport;
  406. SetBannerText(hDlg);
  407. fImport = GetPrivateProfileInt(IS_CONNECTSET, OPTION, 0, g_szCustIns);
  408. EnableDlgItem2(hDlg, IDC_MODIFYCONNECT, fImport);
  409. CheckRadioButton(hDlg, IDC_CSNOIMPORT, IDC_CSIMPORT, fImport ? IDC_CSIMPORT : IDC_CSNOIMPORT);
  410. CheckDlgButton(hDlg, IDC_DELCONNECT,
  411. GetPrivateProfileInt(IS_CONNECTSET, IK_DELETECONN, 0, g_szCustIns) ? BST_CHECKED : BST_UNCHECKED);
  412. ShowWindow(GetDlgItem(hDlg, IDC_DELCONNECT), g_fIntranet ? SW_SHOWNORMAL : SW_HIDE);
  413. ShowWindow(GetDlgItem(hDlg, IDC_DELCONNECT_TXT), g_fIntranet ? SW_SHOWNORMAL : SW_HIDE);
  414. PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_BACK | PSWIZB_NEXT);
  415. CheckBatchAdvance(hDlg);
  416. break;
  417. }
  418. case PSN_WIZBACK:
  419. case PSN_WIZNEXT:
  420. {
  421. CNewCursor cur(IDC_WAIT);
  422. TCHAR szWorkDir[MAX_PATH];
  423. g_cmCabMappings.GetFeatureDir(FEATURE_CONNECT, szWorkDir);
  424. g_fImportConnect = (IsDlgButtonChecked(hDlg, IDC_CSIMPORT) == BST_CHECKED);
  425. ImportConnectSet(g_szCustIns, szWorkDir, g_szTempSign, g_fImportConnect, g_fIntranet ? IEM_CORP : IEM_NEUTRAL);
  426. InsWriteBool(IS_CONNECTSET, IK_DELETECONN,
  427. g_fIntranet && (BST_CHECKED == IsDlgButtonChecked(hDlg, IDC_DELCONNECT)), g_szCustIns);
  428. g_iCurPage = PPAGE_CONNECTSET;
  429. EnablePages();
  430. (((NMHDR FAR *) lParam)->code == PSN_WIZNEXT) ? PageNext(hDlg) : PagePrev(hDlg);
  431. break;
  432. }
  433. case PSN_QUERYCANCEL:
  434. QueryCancel(hDlg);
  435. break;
  436. default:
  437. return FALSE;
  438. }
  439. break;
  440. default:
  441. return FALSE;
  442. }
  443. return TRUE;
  444. }
  445. INT_PTR CALLBACK InstallDirectory(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
  446. {
  447. TCHAR szWrk[MAX_PATH];
  448. BOOL fAllow;
  449. switch (message)
  450. {
  451. case WM_INITDIALOG:
  452. g_hWizard = hDlg;
  453. InitSysFont( hDlg, IDE_INSTALLDIR);
  454. break;
  455. case IDM_BATCHADVANCE:
  456. DoBatchAdvance(hDlg);
  457. break;
  458. case WM_HELP:
  459. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  460. break;
  461. case WM_COMMAND:
  462. if (HIWORD(wParam) == BN_CLICKED)
  463. switch (LOWORD(wParam))
  464. {
  465. case IDC_BROWSEDIR:
  466. {
  467. TCHAR szInstructions[MAX_PATH];
  468. LoadString(g_rvInfo.hInst,IDS_INSTALLDIR,szInstructions,countof(szInstructions));
  469. if (BrowseForFolder(hDlg, s_szInstallDir, szInstructions))
  470. SetDlgItemText( hDlg, IDE_INSTALLDIR, s_szInstallDir );
  471. break;
  472. }
  473. case IDC_PROGFILES32:
  474. case IDC_FULLPATH32:
  475. CheckRadioButton( hDlg, IDC_PROGFILES32, IDC_FULLPATH32, LOWORD(wParam) );
  476. GetDlgItemText( hDlg, IDE_INSTALLDIR, s_szInstallDir, MAX_PATH );
  477. if (LOWORD(wParam) != IDC_FULLPATH32)
  478. {
  479. DisableDlgItem(hDlg, IDC_BROWSEDIR);
  480. if (StrChr(s_szInstallDir, TEXT('\\')) || lstrlen(s_szInstallDir) == 0)
  481. {
  482. LoadString( g_rvInfo.hInst, IDS_IE, s_szInstallDir, MAX_PATH );
  483. SetDlgItemText( hDlg, IDE_INSTALLDIR, s_szInstallDir );
  484. }
  485. }
  486. else
  487. {
  488. if (s_szInstallDir[1] != TEXT(':'))
  489. SetDlgItemText( hDlg, IDE_INSTALLDIR, TEXT("") );
  490. EnableDlgItem(hDlg, IDC_BROWSEDIR);
  491. }
  492. break;
  493. }
  494. break;
  495. case WM_NOTIFY:
  496. switch (((NMHDR FAR *) lParam)->code)
  497. {
  498. case PSN_HELP:
  499. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  500. break;
  501. case PSN_SETACTIVE:
  502. SetBannerText(hDlg);
  503. GetPrivateProfileString( IS_BRANDING, TEXT("InstallDir"), TEXT(""), szWrk, MAX_PATH, g_szCustIns );
  504. if (*szWrk != TEXT('%'))
  505. {
  506. g_iInstallOpt = INSTALL_OPT_FULL;
  507. if (ISNONNULL(szWrk))
  508. {
  509. StrCpy(s_szInstallDir, szWrk);
  510. CheckRadioButton( hDlg, IDC_PROGFILES32, IDC_FULLPATH32, IDC_FULLPATH32 );
  511. }
  512. else
  513. {
  514. LoadString( g_rvInfo.hInst, IDS_IE, s_szInstallDir, MAX_PATH );
  515. g_iInstallOpt = INSTALL_OPT_PROG;
  516. CheckRadioButton( hDlg, IDC_PROGFILES32, IDC_FULLPATH32, IDC_PROGFILES32 );
  517. DisableDlgItem(hDlg, IDC_BROWSEDIR);
  518. }
  519. }
  520. else
  521. {
  522. switch (szWrk[1])
  523. {
  524. case TEXT('p'):
  525. case TEXT('P'):
  526. default:
  527. g_iInstallOpt = INSTALL_OPT_PROG;
  528. CheckRadioButton( hDlg, IDC_PROGFILES32, IDC_FULLPATH32, IDC_PROGFILES32 );
  529. break;
  530. }
  531. DisableDlgItem(hDlg, IDC_BROWSEDIR);
  532. StrCpy(s_szInstallDir, &szWrk[3]);
  533. }
  534. SetDlgItemText( hDlg, IDE_INSTALLDIR, s_szInstallDir );
  535. PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_BACK | PSWIZB_NEXT);
  536. if (g_fSilent || g_fStealth)
  537. DisableDlgItem(hDlg, IDC_ALLOWINSTALLDIR);
  538. else
  539. {
  540. EnableDlgItem(hDlg, IDC_ALLOWINSTALLDIR);
  541. fAllow = GetPrivateProfileInt(IS_BRANDING, TEXT("AllowInstallDir"), 1, g_szCustIns);
  542. CheckDlgButton(hDlg, IDC_ALLOWINSTALLDIR,
  543. fAllow ? BST_CHECKED : BST_UNCHECKED);
  544. }
  545. CheckBatchAdvance(hDlg);
  546. break;
  547. case PSN_WIZBACK:
  548. case PSN_WIZNEXT:
  549. GetDlgItemText( hDlg, IDE_INSTALLDIR, g_szInstallFolder, MAX_PATH );
  550. if ((IsDlgButtonChecked( hDlg, IDC_FULLPATH32 ) == BST_CHECKED))
  551. {
  552. if (PathIsRelative(g_szInstallFolder))
  553. {
  554. ErrorMessageBox(hDlg, IDS_BADDEST);
  555. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, -1);
  556. return TRUE;
  557. }
  558. StrCpy(s_szInstallDir, g_szInstallFolder);
  559. g_iInstallOpt = INSTALL_OPT_FULL;
  560. }
  561. else
  562. {
  563. if (!PathIsRelative(g_szInstallFolder))
  564. {
  565. ErrorMessageBox(hDlg, IDS_RELATIVE_ONLY);
  566. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, -1);
  567. return TRUE;
  568. }
  569. if ((IsDlgButtonChecked( hDlg, IDC_PROGFILES32 ) == BST_CHECKED))
  570. {
  571. g_iInstallOpt = INSTALL_OPT_PROG;
  572. wnsprintf(s_szInstallDir, countof(s_szInstallDir), TEXT("%%p\\%s"), g_szInstallFolder);
  573. }
  574. }
  575. //----- Validate input -----
  576. if (!PathIsValidPath(g_szInstallFolder)) {
  577. HWND hEdit;
  578. UINT nID;
  579. ErrorMessageBox(hDlg, IDS_BADDEST);
  580. switch (g_iInstallOpt) {
  581. case INSTALL_OPT_FULL: nID = IDC_FULLPATH32;
  582. case INSTALL_OPT_PROG: nID = IDC_PROGFILES32;
  583. default: nID = (UINT)-1; ASSERT(FALSE);
  584. };
  585. hEdit = GetDlgItem(hDlg, nID);
  586. Edit_SetSel(hEdit, 0, -1);
  587. SetFocus(hEdit);
  588. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, -1);
  589. }
  590. WritePrivateProfileString( IS_BRANDING, TEXT("InstallDir"), s_szInstallDir, g_szCustIns );
  591. fAllow = (IsDlgButtonChecked(hDlg, IDC_ALLOWINSTALLDIR) == BST_CHECKED) && !g_fSilent && !g_fStealth;
  592. WritePrivateProfileString(IS_BRANDING, TEXT("AllowInstallDir"),
  593. fAllow ? TEXT("1") : TEXT("0"), g_szCustIns);
  594. g_iCurPage = PPAGE_INSTALLDIR;
  595. EnablePages();
  596. if (((NMHDR FAR *) lParam)->code == PSN_WIZNEXT) PageNext(hDlg);
  597. else
  598. {
  599. PagePrev(hDlg);
  600. }
  601. break;
  602. case PSN_WIZFINISH:
  603. break;
  604. case PSN_QUERYCANCEL:
  605. QueryCancel(hDlg);
  606. break;
  607. default:
  608. return FALSE;
  609. }
  610. break;
  611. default:
  612. return FALSE;
  613. }
  614. return TRUE;
  615. }
  616. //
  617. // FUNCTION: CorpCustomizeCustom(HWND, UINT, UINT, LONG)
  618. //
  619. // PURPOSE: Processes messages for "Corp Customize Custom" page
  620. //
  621. // MESSAGES:
  622. //
  623. // WM_INITDIALOG - intializes the page
  624. // WM_NOTIFY - processes the notifications sent to the page
  625. // WM_COMMAND - saves the id of the choice selected
  626. //
  627. INT_PTR CALLBACK CorpCustomizeCustom(
  628. HWND hDlg,
  629. UINT message,
  630. WPARAM,
  631. LPARAM lParam)
  632. {
  633. BOOL fCompatDisabled;
  634. BOOL fCustDisabled;
  635. BOOL fBackupDisabled;
  636. int iDefaultBrowserCheck;
  637. switch (message)
  638. {
  639. case WM_INITDIALOG:
  640. break;
  641. case IDM_BATCHADVANCE:
  642. DoBatchAdvance(hDlg);
  643. break;
  644. case WM_HELP:
  645. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  646. break;
  647. case WM_COMMAND:
  648. break;
  649. case WM_NOTIFY:
  650. switch (((NMHDR FAR *) lParam)->code)
  651. {
  652. case PSN_HELP:
  653. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  654. break;
  655. case PSN_SETACTIVE:
  656. SetBannerText(hDlg);
  657. //from the former shellinteg dlg
  658. g_fInteg = GetPrivateProfileInt( BRANDING, WEB_INTEGRATED, 0, g_szCustIns );
  659. CheckDlgButton(hDlg, IDC_DESKTOPUPDATE, g_fInteg ? BST_CHECKED : BST_UNCHECKED);
  660. // BUGBUG: <oliverl> should probably move this stuff into server side file for IEAK6
  661. EnableDlgItem2(hDlg, IDC_IECOMPAT, !(g_fSilent || g_fStealth));
  662. EnableDlgItem2(hDlg, IDC_CUSTCUST, !(g_fSilent || g_fStealth));
  663. EnableDlgItem2(hDlg, IDC_NOXFLAG, !(g_fSilent || g_fStealth));
  664. iDefaultBrowserCheck = GetPrivateProfileInt(IS_BRANDING, TEXT("BrowserDefault"), 2, g_szCustIns);
  665. if (!(g_fSilent || g_fStealth))
  666. {
  667. fCompatDisabled = GetPrivateProfileInt(IS_BRANDING, TEXT("HideCompat"), 0, g_szCustIns);
  668. CheckDlgButton(hDlg, IDC_IECOMPAT, fCompatDisabled ? BST_CHECKED : BST_UNCHECKED);
  669. fCustDisabled = GetPrivateProfileInt(IS_BRANDING, TEXT("HideCustom"), 0, g_szCustIns);
  670. CheckDlgButton(hDlg, IDC_CUSTCUST, fCustDisabled ? BST_CHECKED : BST_UNCHECKED);
  671. }
  672. else
  673. {
  674. if (iDefaultBrowserCheck == 2)
  675. iDefaultBrowserCheck = 0;
  676. }
  677. CheckRadioButton(hDlg, IDC_XFLAGFALSE, IDC_NOXFLAG, IDC_XFLAGFALSE + iDefaultBrowserCheck);
  678. fBackupDisabled = GetPrivateProfileInt(IS_BRANDING, TEXT("NoBackup"), 0, g_szCustIns);
  679. CheckDlgButton(hDlg, IDC_NOBACKUPDATA, fBackupDisabled ? BST_CHECKED : BST_UNCHECKED);
  680. CheckBatchAdvance(hDlg);
  681. break;
  682. case PSN_WIZNEXT:
  683. case PSN_WIZBACK:
  684. //from the former shellinteg dlg
  685. TCHAR szBrandingDir[MAX_PATH];
  686. g_fInteg = IsDlgButtonChecked(hDlg, IDC_DESKTOPUPDATE);
  687. if (g_fOCW)
  688. {
  689. HKEY hkIEAK;
  690. if(RegOpenKeyEx(HKEY_CURRENT_USER, RK_IEAK_SERVER, 0, KEY_READ, &hkIEAK) == ERROR_SUCCESS)
  691. {
  692. DWORD dwData;
  693. dwData = g_fInteg ? 1 : 0;
  694. RegSetValueEx(hkIEAK, TEXT("InstallShell"), 0, REG_DWORD, (LPBYTE) &dwData, sizeof(dwData));
  695. RegCloseKey(hkIEAK);
  696. }
  697. }
  698. WritePrivateProfileString( BRANDING, WEB_INTEGRATED,
  699. g_fInteg ? TEXT("1") : TEXT("0"), g_szCustIns );
  700. g_cmCabMappings.GetFeatureDir(FEATURE_BRAND, szBrandingDir);
  701. if (g_fInteg)
  702. {
  703. TCHAR szFixIEIcoInf[MAX_PATH];
  704. WritePrivateProfileString(EXTREGINF, TEXT("FixIEIco"), TEXT("*,fixieico.inf,DefaultInstall"), g_szCustIns);
  705. // fixieico.inf is under iebin\<lang>\optional
  706. StrCpy(szFixIEIcoInf, g_szMastInf);
  707. PathRemoveFileSpec(szFixIEIcoInf);
  708. PathAppend(szFixIEIcoInf, TEXT("fixieico.inf"));
  709. // copy fixieico.inf from iebin\<lang>\optional to the branding dir
  710. PathAppend(szBrandingDir, TEXT("fixieico.inf"));
  711. CopyFile(szFixIEIcoInf, szBrandingDir, FALSE);
  712. }
  713. else
  714. {
  715. // delete the FixIEIco line
  716. WritePrivateProfileString(EXTREGINF, TEXT("FixIEIco"), NULL, g_szCustIns);
  717. // delete fixieico.inf from the branding dir
  718. PathAppend(szBrandingDir, TEXT("fixieico.inf"));
  719. DeleteFile(szBrandingDir);
  720. }
  721. //
  722. if (!(g_fSilent || g_fStealth))
  723. {
  724. fCompatDisabled = (IsDlgButtonChecked(hDlg, IDC_IECOMPAT) == BST_CHECKED);
  725. WritePrivateProfileString(IS_BRANDING, TEXT("HideCompat"),
  726. fCompatDisabled ? TEXT("1") : TEXT("0"), g_szCustIns);
  727. fCustDisabled = (IsDlgButtonChecked(hDlg, IDC_CUSTCUST) == BST_CHECKED);
  728. WritePrivateProfileString(IS_BRANDING, TEXT("HideCustom"),
  729. fCustDisabled ? TEXT("1") : TEXT("0"), g_szCustIns);
  730. }
  731. fBackupDisabled = (IsDlgButtonChecked(hDlg, IDC_NOBACKUPDATA) == BST_CHECKED);
  732. WritePrivateProfileString(IS_BRANDING, TEXT("NoBackup"),
  733. fBackupDisabled ? TEXT("1") : TEXT("0"), g_szCustIns);
  734. if (IsDlgButtonChecked(hDlg, IDC_XFLAGFALSE) == BST_CHECKED)
  735. WritePrivateProfileString(IS_BRANDING, TEXT("BrowserDefault"), TEXT("0"), g_szCustIns);
  736. else
  737. {
  738. if (IsDlgButtonChecked(hDlg, IDC_XFLAGTRUE) == BST_CHECKED)
  739. WritePrivateProfileString(IS_BRANDING, TEXT("BrowserDefault"), TEXT("1"), g_szCustIns);
  740. else
  741. WritePrivateProfileString(IS_BRANDING, TEXT("BrowserDefault"), TEXT("2"), g_szCustIns);
  742. }
  743. g_iCurPage = PPAGE_CORPCUSTOM;
  744. EnablePages();
  745. if (((NMHDR FAR *) lParam)->code == PSN_WIZNEXT) PageNext(hDlg);
  746. else
  747. {
  748. PagePrev(hDlg);
  749. }
  750. break;
  751. case PSN_QUERYCANCEL:
  752. QueryCancel(hDlg);
  753. break;
  754. default:
  755. return FALSE;
  756. }
  757. break;
  758. default:
  759. return FALSE;
  760. }
  761. return TRUE;
  762. }
  763. INT_PTR CALLBACK SilentInstall(HWND hDlg, UINT message, WPARAM, LPARAM lParam)
  764. {
  765. switch (message)
  766. {
  767. case WM_INITDIALOG:
  768. g_hWizard = hDlg;
  769. break;
  770. case IDM_BATCHADVANCE:
  771. DoBatchAdvance(hDlg);
  772. break;
  773. case WM_HELP:
  774. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  775. break;
  776. case WM_NOTIFY:
  777. switch (((NMHDR FAR *) lParam)->code)
  778. {
  779. case PSN_HELP:
  780. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  781. break;
  782. case PSN_SETACTIVE:
  783. SetBannerText(hDlg);
  784. PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_BACK | PSWIZB_NEXT);
  785. if (!g_fDownload && !g_fLAN && !g_fCD)
  786. {
  787. g_fStealth = FALSE;
  788. DisableDlgItem(hDlg, IDC_SILENTALL);
  789. }
  790. g_fSilent = GetPrivateProfileInt( BRANDING, SILENT_INSTALL, 0, g_szCustIns );
  791. g_fStealth = GetPrivateProfileInt( BRANDING, TEXT("StealthInstall"), 0, g_szCustIns );
  792. CheckRadioButton(hDlg, IDC_SILENTNOT, IDC_SILENTSOME,
  793. g_fStealth ? IDC_SILENTALL : (g_fSilent ? IDC_SILENTSOME : IDC_SILENTNOT));
  794. if (g_fLAN && !g_fDownload && !g_fCD && !g_fBrandingOnly)
  795. {
  796. ShowDlgItem(hDlg, IDC_URD);
  797. ShowDlgItem(hDlg, IDC_URD_GROUP);
  798. ShowDlgItem(hDlg, IDC_URD_TEXT1);
  799. ShowDlgItem(hDlg, IDC_URD_TEXT2);
  800. ShowDlgItem(hDlg, IDC_URD_TEXT3);
  801. ReadBoolAndCheckButton(IS_HIDECUST, IK_URD_STR, FALSE, g_szCustIns, hDlg, IDC_URD);
  802. }
  803. else
  804. {
  805. CheckDlgButton(hDlg, IDC_URD, BST_UNCHECKED);
  806. HideDlgItem(hDlg, IDC_URD);
  807. HideDlgItem(hDlg, IDC_URD_GROUP);
  808. HideDlgItem(hDlg, IDC_URD_TEXT1);
  809. HideDlgItem(hDlg, IDC_URD_TEXT2);
  810. HideDlgItem(hDlg, IDC_URD_TEXT3);
  811. }
  812. CheckBatchAdvance(hDlg);
  813. break;
  814. case PSN_WIZBACK:
  815. case PSN_WIZNEXT:
  816. g_fSilent = IsDlgButtonChecked(hDlg, IDC_SILENTSOME);
  817. WritePrivateProfileString( BRANDING, SILENT_INSTALL, g_fSilent ? TEXT("1") : TEXT("0"), g_szCustIns );
  818. g_fStealth = IsDlgButtonChecked(hDlg, IDC_SILENTALL);
  819. WritePrivateProfileString( BRANDING, TEXT("StealthInstall"), g_fStealth ? TEXT("1") : TEXT("0"), g_szCustIns );
  820. CheckButtonAndWriteBool(hDlg, IDC_URD, IS_HIDECUST, IK_URD_STR, g_szCustIns);
  821. g_iCurPage = PPAGE_SILENTINSTALL;
  822. EnablePages();
  823. if (((NMHDR FAR *) lParam)->code == PSN_WIZNEXT) PageNext(hDlg);
  824. else
  825. {
  826. PagePrev(hDlg);
  827. }
  828. break;
  829. case PSN_WIZFINISH:
  830. break;
  831. case PSN_QUERYCANCEL:
  832. QueryCancel(hDlg);
  833. break;
  834. default:
  835. return FALSE;
  836. }
  837. break;
  838. default:
  839. return FALSE;
  840. }
  841. return TRUE;
  842. }
  843. INT_PTR CALLBACK SecurityZonesDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
  844. {
  845. switch (uMsg)
  846. {
  847. case WM_INITDIALOG:
  848. // ieaklite clean-up
  849. DeleteFileInDir(TEXT("seczones.inf"), g_szTempSign);
  850. DeleteFileInDir(TEXT("ratings.inf"), g_szTempSign);
  851. break;
  852. case WM_NOTIFY:
  853. switch (((NMHDR FAR *) lParam)->code)
  854. {
  855. case PSN_SETACTIVE:
  856. {
  857. BOOL fImport;
  858. SetBannerText(hDlg);
  859. fImport = InsGetBool(SECURITY_IMPORTS, TEXT("ImportSecZones"), FALSE, g_szCustIns);
  860. CheckRadioButton(hDlg, IDC_NOZONES, IDC_IMPORTZONES, fImport ? IDC_IMPORTZONES : IDC_NOZONES);
  861. EnableDlgItem2(hDlg, IDC_MODIFYZONES, fImport);
  862. fImport = InsGetBool(SECURITY_IMPORTS, TEXT("ImportRatings"), FALSE, g_szCustIns);
  863. CheckRadioButton(hDlg, IDC_NORAT, IDC_IMPORTRAT, fImport ? IDC_IMPORTRAT : IDC_NORAT);
  864. EnableDlgItem2(hDlg, IDC_MODIFYRAT, fImport);
  865. CheckBatchAdvance(hDlg);
  866. break;
  867. }
  868. case PSN_WIZBACK:
  869. case PSN_WIZNEXT:
  870. {
  871. TCHAR szBrandingDir[MAX_PATH];
  872. TCHAR szSecZonesInf[MAX_PATH];
  873. TCHAR szRatingsInf[MAX_PATH];
  874. HCURSOR hOldCur;
  875. hOldCur = SetCursor(LoadCursor(NULL, IDC_WAIT));
  876. // seczones.inf goes into the branding.cab
  877. g_cmCabMappings.GetFeatureDir(FEATURE_BRAND, szBrandingDir);
  878. PathCombine(szSecZonesInf, szBrandingDir, TEXT("seczones.inf"));
  879. ImportZones(g_szCustIns, NULL, szSecZonesInf, IsDlgButtonChecked(hDlg, IDC_IMPORTZONES) == BST_CHECKED);
  880. // ratings.inf goes into the branding.cab
  881. g_cmCabMappings.GetFeatureDir(FEATURE_BRAND, szBrandingDir);
  882. PathCombine(szRatingsInf, szBrandingDir, TEXT("ratings.inf"));
  883. ImportRatings(g_szCustIns, NULL, szRatingsInf, IsDlgButtonChecked(hDlg, IDC_IMPORTRAT) == BST_CHECKED);
  884. SetCursor(hOldCur);
  885. g_iCurPage = PPAGE_SECURITY;
  886. EnablePages();
  887. (((NMHDR FAR *) lParam)->code == PSN_WIZNEXT) ? PageNext(hDlg) : PagePrev(hDlg);
  888. break;
  889. }
  890. case PSN_HELP:
  891. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  892. break;
  893. case PSN_QUERYCANCEL:
  894. QueryCancel(hDlg);
  895. break;
  896. default:
  897. return FALSE;
  898. }
  899. break;
  900. case WM_COMMAND:
  901. switch (HIWORD(wParam))
  902. {
  903. case BN_CLICKED:
  904. switch (LOWORD(wParam))
  905. {
  906. case IDC_NOZONES:
  907. DisableDlgItem(hDlg, IDC_MODIFYZONES);
  908. break;
  909. case IDC_IMPORTZONES:
  910. EnableDlgItem(hDlg, IDC_MODIFYZONES);
  911. break;
  912. case IDC_MODIFYZONES:
  913. ModifyZones(hDlg);
  914. break;
  915. case IDC_NORAT:
  916. DisableDlgItem(hDlg, IDC_MODIFYRAT);
  917. break;
  918. case IDC_IMPORTRAT:
  919. EnableDlgItem(hDlg, IDC_MODIFYRAT);
  920. break;
  921. case IDC_MODIFYRAT:
  922. ModifyRatings(hDlg);
  923. break;
  924. }
  925. break;
  926. }
  927. break;
  928. case WM_HELP:
  929. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  930. break;
  931. case IDM_BATCHADVANCE:
  932. DoBatchAdvance(hDlg);
  933. break;
  934. default:
  935. return FALSE;
  936. }
  937. return TRUE;
  938. }
  939. INT_PTR CALLBACK SecurityCertsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
  940. {
  941. switch (uMsg)
  942. {
  943. case WM_INITDIALOG:
  944. // ieaklite clean-up
  945. DeleteFileInDir(TEXT("sitecert.inf"), g_szTempSign);
  946. DeleteFileInDir(TEXT("root.str"), g_szTempSign);
  947. DeleteFileInDir(TEXT("ca.str"), g_szTempSign);
  948. DeleteFileInDir(TEXT("authcode.inf"), g_szTempSign);
  949. break;
  950. case WM_NOTIFY:
  951. switch (((NMHDR FAR *) lParam)->code)
  952. {
  953. case PSN_SETACTIVE:
  954. {
  955. BOOL fImport;
  956. SetBannerText(hDlg);
  957. fImport = InsGetBool(SECURITY_IMPORTS, TEXT("ImportSiteCert"), FALSE, g_szCustIns);
  958. CheckRadioButton(hDlg, IDC_NOSC, IDC_IMPORTSC, fImport ? IDC_IMPORTSC : IDC_NOSC);
  959. EnableDlgItem2(hDlg, IDC_MODIFYSC, fImport);
  960. fImport = InsGetBool(SECURITY_IMPORTS, TEXT("ImportAuthCode"), FALSE, g_szCustIns);
  961. CheckRadioButton(hDlg, IDC_NOAUTH, IDC_IMPORTAUTH, fImport ? IDC_IMPORTAUTH : IDC_NOAUTH);
  962. EnableDlgItem2(hDlg, IDC_MODIFYAUTH, fImport);
  963. CheckBatchAdvance(hDlg);
  964. break;
  965. }
  966. case PSN_WIZBACK:
  967. case PSN_WIZNEXT:
  968. {
  969. TCHAR szBrandingDir[MAX_PATH];
  970. TCHAR szSiteCertInf[MAX_PATH];
  971. TCHAR szRootStr[MAX_PATH];
  972. TCHAR szCaStr[MAX_PATH];
  973. TCHAR szAuthCodeInf[MAX_PATH];
  974. HCURSOR hOldCur;
  975. hOldCur = SetCursor(LoadCursor(NULL, IDC_WAIT));
  976. // sitecert.inf, root.str and ca.str goes into the branding.cab
  977. g_cmCabMappings.GetFeatureDir(FEATURE_BRAND, szBrandingDir);
  978. PathCombine(szSiteCertInf, szBrandingDir, TEXT("sitecert.inf"));
  979. PathCombine(szRootStr, szBrandingDir, TEXT("root.str"));
  980. PathCombine(szCaStr, szBrandingDir, TEXT("ca.str"));
  981. ImportSiteCert(g_szCustIns, NULL, szSiteCertInf, IsDlgButtonChecked(hDlg, IDC_IMPORTSC) == BST_CHECKED);
  982. // authcode.inf goes into the branding.cab
  983. g_cmCabMappings.GetFeatureDir(FEATURE_BRAND, szBrandingDir);
  984. PathCombine(szAuthCodeInf, szBrandingDir, TEXT("authcode.inf"));
  985. ImportAuthCode(g_szCustIns, NULL, szAuthCodeInf, IsDlgButtonChecked(hDlg, IDC_IMPORTAUTH) == BST_CHECKED);
  986. SetCursor(hOldCur);
  987. g_iCurPage = PPAGE_SECURITYCERT;
  988. EnablePages();
  989. (((NMHDR FAR *) lParam)->code == PSN_WIZNEXT) ? PageNext(hDlg) : PagePrev(hDlg);
  990. break;
  991. }
  992. case PSN_HELP:
  993. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  994. break;
  995. case PSN_QUERYCANCEL:
  996. QueryCancel(hDlg);
  997. break;
  998. default:
  999. return FALSE;
  1000. }
  1001. break;
  1002. case WM_COMMAND:
  1003. switch (HIWORD(wParam))
  1004. {
  1005. case BN_CLICKED:
  1006. switch (LOWORD(wParam))
  1007. {
  1008. case IDC_NOSC:
  1009. DisableDlgItem(hDlg, IDC_MODIFYSC);
  1010. break;
  1011. case IDC_IMPORTSC:
  1012. EnableDlgItem(hDlg, IDC_MODIFYSC);
  1013. break;
  1014. case IDC_MODIFYSC:
  1015. ModifySiteCert(hDlg);
  1016. break;
  1017. case IDC_NOAUTH:
  1018. DisableDlgItem(hDlg, IDC_MODIFYAUTH);
  1019. break;
  1020. case IDC_IMPORTAUTH:
  1021. EnableDlgItem(hDlg, IDC_MODIFYAUTH);
  1022. break;
  1023. case IDC_MODIFYAUTH:
  1024. ModifyAuthCode(hDlg);
  1025. break;
  1026. }
  1027. break;
  1028. }
  1029. break;
  1030. case WM_HELP:
  1031. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  1032. break;
  1033. case IDM_BATCHADVANCE:
  1034. DoBatchAdvance(hDlg);
  1035. break;
  1036. default:
  1037. return FALSE;
  1038. }
  1039. return TRUE;
  1040. }