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.

4179 lines
146 KiB

  1. #include "precomp.h"
  2. #include <htmlhelp.h> // for html help calls
  3. #include <regstr.h>
  4. #include "wizard.rcv" // for VER_PRODUCTVERSION_STR only
  5. #include "adjustui.h"
  6. #include "ieaklite.h"
  7. #include "ie4comp.h"
  8. CCabMappings g_cmCabMappings;
  9. REVIEWINFO g_rvInfo; // a structure containing the review information
  10. HWND g_hWizard;
  11. TCHAR g_szCustIns[MAX_PATH] = TEXT("");
  12. TCHAR g_szSrcRoot[MAX_PATH] = TEXT(""); //Batch mode only: use settings in g_szSrcRoot to build package in g_szBuildRoot.
  13. TCHAR g_szBuildRoot[MAX_PATH] = TEXT("");
  14. TCHAR g_szBuildTemp[MAX_PATH] = TEXT("");
  15. TCHAR g_szWizPath[MAX_PATH];
  16. TCHAR g_szWizRoot[MAX_PATH];
  17. TCHAR g_szTitle[MAX_PATH];
  18. TCHAR g_szLogFile[MAX_PATH] = TEXT("");
  19. HANDLE g_hLogFile = NULL; //Logfile handle;
  20. extern TCHAR g_szDefInf[];
  21. extern TCHAR g_szTempSign[];
  22. BOOL g_fDownload = TRUE;
  23. BOOL g_fCD = FALSE;
  24. BOOL g_fLAN = FALSE;
  25. BOOL g_fBrandingOnly = FALSE;
  26. BOOL g_fBranded = FALSE;
  27. BOOL g_fIntranet = FALSE;
  28. BOOL g_fMailNews95 = FALSE;
  29. BOOL g_fLangInit = FALSE;
  30. BOOL g_fSrcDirChanged = TRUE;
  31. static BOOL s_fDestDirChanged = TRUE;
  32. BOOL g_fDisableIMAPPage = FALSE;
  33. extern TCHAR g_szDeskTemp[];
  34. extern int g_iInstallOpt;
  35. extern TCHAR g_szInstallFolder[];
  36. extern TCHAR s_szBannerText[MAX_PATH];
  37. HANDLE g_hThread = NULL; // handle to DownloadSiteThreadProc
  38. extern HANDLE g_hAVSThread;
  39. extern BOOL g_fOptCompInit;
  40. BOOL g_fCancelled = FALSE;
  41. BOOL g_fDone = FALSE;
  42. BOOL g_fKeyGood = FALSE;
  43. static BOOL s_fNT5;
  44. int g_iKeyType = KEY_TYPE_STANDARD;
  45. TCHAR g_szKey[16] ;
  46. extern int MakeKey(TCHAR *, int);
  47. PROPSHEETPAGE g_psp[NUM_PAGES];
  48. static HPROPSHEETPAGE s_ahPsp[NUM_PAGES];
  49. static BOOL s_fPageEnabled[NUM_PAGES] =
  50. {
  51. TRUE, TRUE, TRUE, TRUE
  52. };
  53. int g_iCurPage;
  54. RECT g_dtRect;
  55. TCHAR g_szLanguage[16];
  56. extern TCHAR g_szActLang[];
  57. TCHAR g_aszLang[NUMLANG][16];
  58. DWORD g_aLangId[NUMLANG];
  59. BOOL g_fDemo = FALSE;
  60. #define MAX_STDOPT 5
  61. #define MIN_CUSTOPT 6
  62. #define MAX_CUSTOPT 7
  63. #define OPT_CUST1 6
  64. #define OPT_CUST2 7
  65. extern BOOL CheckKey(LPTSTR szKey);
  66. static HKEY s_hkIEAKUser;
  67. BOOL g_fUseIEWelcomePage = FALSE;
  68. static TCHAR s_szSourceDir[MAX_PATH] = TEXT("");
  69. TCHAR g_szLoadedIns[MAX_PATH] = TEXT("");
  70. static BOOL s_fLoadIns;
  71. static BOOL s_fAppendLang;
  72. BOOL g_fBatch = FALSE;
  73. BOOL g_fBatch2 = FALSE; //The second batch mode
  74. static TCHAR s_szType[16];
  75. int s_iType;
  76. extern BOOL g_fServerICW;
  77. extern BOOL g_fServerKiosk;
  78. extern BOOL g_fServerless;
  79. extern BOOL g_fNoSignup;
  80. extern BOOL g_fSkipServerIsps;
  81. extern BOOL g_fSkipIspIns;
  82. extern HANDLE g_hDownloadEvent;
  83. int g_iDownloadState = 0, g_nLangs = 0;
  84. HWND g_hDlg = 0;
  85. extern void IE4BatchSetup(void);
  86. extern BOOL InitList(HWND hwnd, UINT id);
  87. extern BOOL g_fSilent, g_fStealth;
  88. extern BOOL g_fUrlsInit;
  89. extern BOOL g_fLocalMode;
  90. extern BOOL g_fInteg, g_fImportConnect;
  91. extern PCOMPONENT g_paComp;
  92. extern UINT g_uiNumCabs;
  93. extern PCOMP_VERSION g_rgCompVer;
  94. extern HFONT g_hFont;
  95. DWORD g_dwPlatformId = PLATFORM_WIN32;
  96. // new cif format stuff
  97. CCifFile_t *g_lpCifFileNew = NULL;
  98. CCifRWFile_t *g_lpCifRWFile = NULL;
  99. CCifRWFile_t *g_lpCifRWFileDest = NULL;
  100. CCifRWFile_t *g_lpCifRWFileVer = NULL;
  101. // g_hBaseDllHandle is used by DelayLoadFailureHook() -- defined in ieakutil.lib
  102. // for more info, read the Notes section in ieak5\ieakutil\dload.cpp
  103. HANDLE g_hBaseDllHandle;
  104. //OCW specific
  105. BOOL g_fOCW = FALSE;
  106. BOOL g_fOCWCancel = FALSE;
  107. TCHAR g_szParentWindowName[MAX_PATH];
  108. BOOL ParseCmdLine(LPSTR lpCmdLine);
  109. void PositionWindow(HWND hWnd);
  110. //
  111. extern TCHAR g_szIEAKProg[MAX_PATH];
  112. void GetIEAKDir(LPTSTR szDir);
  113. extern HBITMAP g_hBannerBmp;
  114. extern HWND g_hWait;
  115. extern LPTSTR GetOutputPlatformDir();
  116. void GenerateCustomIns();
  117. extern void WriteMSTrustKey(BOOL bSet);
  118. DWORD g_wCurLang;
  119. static HWND s_hWndHelp = NULL;
  120. void CleanUp()
  121. {
  122. if (g_hAVSThread != NULL)
  123. {
  124. while ((MsgWaitForMultipleObjects(1, &g_hAVSThread, FALSE, INFINITE, QS_ALLINPUT)) != WAIT_OBJECT_0)
  125. {
  126. MSG msg;
  127. while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
  128. {
  129. TranslateMessage(&msg);
  130. DispatchMessage(&msg);
  131. }
  132. }
  133. CloseHandle(g_hAVSThread);
  134. }
  135. if (g_hThread != NULL)
  136. {
  137. while ((MsgWaitForMultipleObjects(1, &g_hThread, FALSE, INFINITE, QS_ALLINPUT)) != WAIT_OBJECT_0)
  138. {
  139. MSG msg;
  140. while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
  141. {
  142. TranslateMessage(&msg);
  143. DispatchMessage(&msg);
  144. }
  145. }
  146. CloseHandle(g_hThread);
  147. }
  148. if (g_paComp != NULL)
  149. {
  150. for (PCOMPONENT pComp = g_paComp; ISNONNULL(pComp->szSection); pComp++)
  151. {
  152. if (pComp->pszAVSDupeSections != NULL)
  153. CoTaskMemFree(pComp->pszAVSDupeSections);
  154. }
  155. LocalFree(g_paComp);
  156. }
  157. if (g_rgCompVer)
  158. {
  159. LocalFree(g_rgCompVer);
  160. }
  161. if (g_hFont != NULL) DeleteObject(g_hFont);
  162. if (g_lpCifRWFile != NULL)
  163. {
  164. delete g_lpCifRWFile;
  165. g_lpCifRWFile = NULL;
  166. }
  167. if (g_lpCifFileNew != NULL)
  168. {
  169. delete g_lpCifFileNew;
  170. g_lpCifFileNew = NULL;
  171. }
  172. if (g_lpCifRWFileDest != NULL)
  173. {
  174. delete g_lpCifRWFileDest;
  175. g_lpCifRWFileDest = NULL;
  176. }
  177. if (g_lpCifRWFileVer != NULL)
  178. {
  179. delete g_lpCifRWFileVer;
  180. g_lpCifRWFileVer = NULL;
  181. }
  182. if (g_hBannerBmp != NULL)
  183. DeleteObject(g_hBannerBmp);
  184. if (ISNONNULL(g_szDeskTemp))
  185. PathRemovePath(g_szDeskTemp);
  186. }
  187. int _stdcall ModuleEntry(void)
  188. {
  189. int i;
  190. STARTUPINFOA si;
  191. LPSTR pszCmdLine = GetCommandLineA();
  192. if ( *pszCmdLine == '\"' ) {
  193. /*
  194. * Scan, and skip over, subsequent characters until
  195. * another double-quote or a null is encountered.
  196. */
  197. while ( *++pszCmdLine && (*pszCmdLine != '\"') )
  198. ;
  199. /*
  200. * If we stopped on a double-quote (usual case), skip
  201. * over it.
  202. */
  203. if ( *pszCmdLine == '\"' )
  204. pszCmdLine++;
  205. }
  206. else {
  207. while (*pszCmdLine > ' ')
  208. pszCmdLine++;
  209. }
  210. /*
  211. * Skip past any white space preceeding the second token.
  212. */
  213. while (*pszCmdLine && (*pszCmdLine <= ' ')) {
  214. pszCmdLine++;
  215. }
  216. si.dwFlags = 0;
  217. GetStartupInfoA(&si);
  218. i = WinMain(GetModuleHandle(NULL), NULL, pszCmdLine,
  219. si.dwFlags & STARTF_USESHOWWINDOW ? si.wShowWindow : SW_SHOWDEFAULT);
  220. ExitProcess(i);
  221. }
  222. int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpCmdLine, int)
  223. {
  224. MSG msg;
  225. HANDLE hMutex;
  226. HRESULT hrOle;
  227. int iRetVal;
  228. // initialize g_hBaseDllHandle which is used by DelayLoadFailureHook()
  229. // in ieak5\ieakutil\dload.cpp
  230. g_hBaseDllHandle = hInstance;
  231. hMutex = NULL;
  232. // allow only one instance running at a time, except for build lab batch mode
  233. // also if ie6 is not installed, bail out
  234. if (lpCmdLine == NULL ||
  235. *lpCmdLine == '\0' ||
  236. StrCmpNIA(lpCmdLine, "/o", 2) == 0 ||
  237. StrCmpNIA(lpCmdLine, "/p", 2) == 0)
  238. {
  239. DWORD dwIEVer;
  240. hMutex = CreateMutex(NULL, TRUE, TEXT("IEAK6Wizard.Mutex"));
  241. if (hMutex != NULL && GetLastError() == ERROR_ALREADY_EXISTS)
  242. {
  243. CloseHandle(hMutex);
  244. ErrorMessageBox(NULL, IDS_ERROR_MULTWIZ);
  245. return ERROR_CANCELLED;
  246. }
  247. dwIEVer = GetIEVersion();
  248. if (HIWORD(dwIEVer) < 6)
  249. {
  250. ErrorMessageBox(NULL, IDS_NOIE);
  251. return ERROR_CANCELLED;
  252. }
  253. }
  254. ZeroMemory(&g_rvInfo, sizeof(g_rvInfo));
  255. g_rvInfo.hinstExe = hInstance;
  256. g_rvInfo.hInst = LoadLibrary(TEXT("ieakui.dll"));
  257. if (g_rvInfo.hInst == NULL)
  258. return ERROR_CANCELLED;
  259. // if the class registration fails, return.
  260. if (!InitApplication(hInstance))
  261. {
  262. FreeLibrary(g_rvInfo.hInst);
  263. return ERROR_CANCELLED;
  264. }
  265. SHCreateKeyHKCU(RK_IEAK_SERVER_MAIN, KEY_ALL_ACCESS, &s_hkIEAKUser);
  266. g_wCurLang = GetUserDefaultLCID() & 0xFFFF;
  267. s_fNT5 = IsOS(OS_NT5);
  268. hrOle = CoInitialize(NULL);
  269. GetIEAKDir(g_szWizPath);
  270. StrCpy(g_szWizRoot, g_szWizPath);
  271. CharUpper(g_szWizRoot);
  272. LoadString(g_rvInfo.hInst, IDS_TITLE, g_szTitle, countof(g_szTitle));
  273. //get the mode -- NOTE: THIS MUST COME BEFORE PARSECMDLINE SO THAT COMMANDLINE OPTIONS OVERRIDE THE REG ENTRY!!!
  274. DWORD dwSize = sizeof(DWORD);
  275. if (SHGetValue(HKEY_LOCAL_MACHINE, TEXT("Software\\Microsoft\\IEAK"), TEXT("Mode"), NULL, &s_iType, &dwSize) != ERROR_SUCCESS)
  276. s_iType = INTRANET; //if there is no reg entry, default to corp mode
  277. switch (s_iType)
  278. {
  279. case REDIST://icp
  280. StrCpy(s_szType, TEXT("REDIST"));
  281. g_fBranded = FALSE;
  282. g_iKeyType = KEY_TYPE_SUPER;
  283. g_fIntranet = g_fSilent = FALSE;
  284. break;
  285. case BRANDED://isp
  286. StrCpy(s_szType, TEXT("BRANDED"));
  287. g_fBranded = TRUE;
  288. g_iKeyType = KEY_TYPE_SUPER;
  289. g_fIntranet = g_fSilent = FALSE;
  290. break;
  291. case INTRANET:
  292. default:
  293. StrCpy(s_szType, TEXT("INTRANET"));
  294. g_iKeyType = KEY_TYPE_SUPERCORP;
  295. g_fBranded = TRUE;
  296. g_fIntranet = TRUE;
  297. break;
  298. }
  299. *g_szKey = TEXT('\0');
  300. if (lpCmdLine != NULL && *lpCmdLine)
  301. if (!ParseCmdLine(lpCmdLine))
  302. {
  303. FreeLibrary(g_rvInfo.hInst);
  304. return ERROR_CANCELLED;
  305. }
  306. if (*g_szLogFile != 0 && (g_hLogFile = CreateFile(g_szLogFile, GENERIC_WRITE,
  307. FILE_SHARE_READ, NULL, OPEN_ALWAYS,
  308. FILE_ATTRIBUTE_NORMAL, NULL)) == NULL)
  309. {
  310. MessageBox(NULL, TEXT("Cannot open log file"), NULL, MB_OK);
  311. return ERROR_CANCELLED;
  312. }
  313. // Perform initializations that apply to a specific instance
  314. if (!InitInstance(hInstance))
  315. {
  316. FreeLibrary(g_rvInfo.hInst);
  317. return ERROR_CANCELLED;
  318. }
  319. // Acquire and dispatch messages until a WM_QUIT message is received.
  320. iRetVal = GetMessage(&msg, NULL, 0, 0);
  321. while (iRetVal != -1 && iRetVal != 0)
  322. {
  323. TranslateMessage(&msg);
  324. DispatchMessage(&msg);
  325. iRetVal = GetMessage(&msg, NULL, 0, 0);
  326. }
  327. CleanUp();
  328. if (S_OK == hrOle)
  329. CoUninitialize();
  330. if (g_hLogFile)
  331. CloseHandle(g_hLogFile);
  332. #ifdef DBG
  333. if (g_fBatch || g_fBatch2 || MessageBox(NULL, TEXT("OK to Delete Temp Files"), TEXT("Wizard Complete"), MB_YESNO) == IDYES)
  334. #endif
  335. if (lstrlen(g_szBuildTemp))
  336. PathRemovePath(g_szBuildTemp);
  337. RegCloseKey(s_hkIEAKUser);
  338. WriteMSTrustKey(FALSE); // Mark MS as a trusted provider
  339. if (s_hWndHelp != NULL)
  340. SendMessage(s_hWndHelp, WM_CLOSE, 0, 0L);
  341. FreeLibrary(g_rvInfo.hInst);
  342. if (hMutex != NULL)
  343. CloseHandle(hMutex);
  344. if (g_fOCWCancel)
  345. return ERROR_CANCELLED;
  346. return (int) msg.wParam;
  347. }
  348. BOOL InitApplication(HINSTANCE hInstance)
  349. {
  350. WNDCLASS wcSample;
  351. wcSample.style = 0;
  352. wcSample.lpfnWndProc = MainWndProc;
  353. wcSample.cbClsExtra = 0;
  354. wcSample.cbWndExtra = 0;
  355. wcSample.hInstance = hInstance;
  356. wcSample.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_WIZARD));
  357. wcSample.hCursor = LoadCursor(NULL, IDC_ARROW);
  358. wcSample.hbrBackground = (HBRUSH) GetStockObject(GRAY_BRUSH);
  359. wcSample.lpszMenuName = NULL;
  360. wcSample.lpszClassName = TEXT("SampleWClass");
  361. return RegisterClass(&wcSample);
  362. }
  363. BOOL ParseCmdLine(LPSTR lpCmdLine)
  364. {
  365. TCHAR szCmdLine[MAX_PATH];
  366. LPTSTR pParam;
  367. TCHAR szWrkLang[8] = TEXT("en");
  368. HKEY hKey;
  369. DWORD dwSize;
  370. TCHAR szType[16]; //Mode: CORP(INTRANET), ICP(RETAIL) or ISP(BRANDED)
  371. *szType = TEXT('\0');
  372. A2Tbux(lpCmdLine, szCmdLine);
  373. CharUpper(szCmdLine);
  374. pParam = szCmdLine;
  375. while (pParam != NULL)
  376. {
  377. pParam = StrChr(pParam, TEXT('/'));
  378. if (pParam == NULL)
  379. break;
  380. switch (*++pParam)
  381. {
  382. case TEXT('S'): // srcpath
  383. if ( *(pParam+2) == '\"' )
  384. {
  385. pParam++; //skip the first quote, we don't want the quotes
  386. StrCpyN(g_szSrcRoot, pParam + 2, countof(g_szSrcRoot));
  387. StrTok(g_szSrcRoot, TEXT("\"\n\r\t")); //instead of stopping w/ a space, stop w/ "
  388. }
  389. else
  390. {
  391. StrCpyN(g_szSrcRoot, pParam + 2, countof(g_szSrcRoot));
  392. StrTok(g_szSrcRoot, TEXT(" \n\r\t"));
  393. }
  394. pParam += StrLen(g_szSrcRoot);
  395. break;
  396. case TEXT('I'):
  397. case TEXT('D'):
  398. if ( *(pParam+2) == '\"' )
  399. {
  400. pParam++; //skip the first quote, we don't want the quotes
  401. StrCpyN(g_szBuildRoot, pParam + 2, countof(g_szBuildRoot));
  402. StrTok(g_szBuildRoot, TEXT("\"\n\r\t")); //instead of stopping w/ a space, stop w/ "
  403. }
  404. else
  405. {
  406. StrCpyN(g_szBuildRoot, pParam + 2, countof(g_szBuildRoot));
  407. StrTok(g_szBuildRoot, TEXT(" \n\r\t"));
  408. }
  409. pParam += StrLen(g_szBuildRoot);
  410. break;
  411. case TEXT('K'):
  412. StrCpyN(g_szKey, pParam + 2, countof(g_szKey));
  413. StrTok(g_szKey, TEXT(" \n\r\t"));
  414. pParam += StrLen(g_szKey);
  415. break;
  416. case TEXT('M'): // Mode: corp, isp or icp
  417. StrCpyN(szType, pParam + 2, countof(szType));
  418. StrTok(szType, TEXT(" \n\r\t"));
  419. pParam += StrLen(szType);
  420. break;
  421. case TEXT('Q'): // logfile
  422. if ( *(pParam+2) == '\"' )
  423. {
  424. pParam++; //skip the first quote, we don't want the quotes
  425. StrCpyN(g_szLogFile, pParam + 2, countof(g_szLogFile));
  426. StrTok(g_szLogFile, TEXT("\"\n\r\t")); //instead of stopping w/ a space, stop w/ "
  427. }
  428. else
  429. {
  430. StrCpyN(g_szLogFile, pParam + 2, countof(g_szLogFile));
  431. StrTok(g_szLogFile, TEXT(" \n\r\t"));
  432. }
  433. pParam += StrLen(g_szLogFile);
  434. break;
  435. case TEXT('L'):
  436. StrCpyN(szWrkLang, pParam + 2, 3);
  437. pParam += 3;
  438. break;
  439. case TEXT('O'):
  440. g_fOCW = TRUE;
  441. g_dwPlatformId = PLATFORM_WIN32;
  442. // (a-saship) read all the data from the registry from HKCU\Software\Microsoft\IEAK since
  443. // office reads/writes data from/to this location. This is due to the fact that IEAK5_5
  444. // changed the registry location to HKCU\Software\Microsoft\IEAK5_5 and office is not aware
  445. // of it. These values is only used by Office and hence we are safe here.
  446. if (RegOpenKeyEx(HKEY_CURRENT_USER, RK_IEAK, 0, KEY_READ, &hKey) == ERROR_SUCCESS)
  447. {
  448. dwSize = sizeof(g_szKey);
  449. SHQueryValueEx(hKey, TEXT("KeyCode"), NULL, NULL, (LPVOID) g_szKey, &dwSize);
  450. dwSize = sizeof(g_szIEAKProg);
  451. SHQueryValueEx(hKey, TEXT("SourceDir"), NULL, NULL, (LPVOID) g_szIEAKProg, &dwSize);
  452. if (*g_szIEAKProg)
  453. {
  454. PathAddBackslash(g_szIEAKProg);
  455. StrCpy(s_szSourceDir, g_szIEAKProg);
  456. }
  457. dwSize = sizeof(g_szBuildRoot);
  458. SHQueryValueEx(hKey, TEXT("TargetDir"), NULL, NULL, (LPVOID) g_szBuildRoot, &dwSize);
  459. if (*g_szBuildRoot == TEXT('\0'))
  460. StrCpy(g_szBuildRoot, g_szIEAKProg);
  461. if (*g_szBuildRoot)
  462. PathRemoveBackslash(g_szBuildRoot);
  463. s_fAppendLang = TRUE;
  464. dwSize = sizeof(g_szParentWindowName);
  465. SHQueryValueEx(hKey, TEXT("ParentWindowName"), NULL, NULL, (LPVOID) g_szParentWindowName, &dwSize);
  466. RegCloseKey(hKey);
  467. }
  468. break;
  469. }
  470. }
  471. *g_szLanguage = TEXT('\\');
  472. StrCpy(&g_szLanguage[1], szWrkLang);
  473. g_szLanguage[3] = TEXT('\\');
  474. g_szLanguage[4] = TEXT('\0');
  475. StrCpy(g_szActLang, szWrkLang);
  476. if ((*g_szKey != TEXT('\0')) && (!szType[0])) //if they set a key, we should override the mode
  477. {
  478. CheckKey(g_szKey);
  479. if (g_iKeyType == KEY_TYPE_SUPERCORP)
  480. {
  481. StrCpy(s_szType, TEXT("INTRANET"));
  482. StrCpy(szType, TEXT("CORP"));
  483. }
  484. else StrCpy(szType, TEXT("ICP"));
  485. }
  486. /* removed--this is really crappy validation code and also makes it impossible to have spaces in paths
  487. if (StrCmpN(g_szBuildRoot, TEXT("\\\\"), 2) &&
  488. StrCmpN(&g_szBuildRoot[1], TEXT(":\\"), 2))
  489. {
  490. ErrorMessageBox(NULL, IDS_NEEDPATH);
  491. return FALSE;
  492. }
  493. */
  494. if (StrLen(g_szBuildRoot) <= 3)
  495. {
  496. ErrorMessageBox(NULL, IDS_ROOTILLEGAL);
  497. return FALSE;
  498. }
  499. if ((!PathIsDirectory(g_szBuildRoot)) && (!CreateDirectory(g_szBuildRoot,NULL)))
  500. {
  501. TCHAR szMsg[MAX_PATH];
  502. TCHAR szTemp[2 * MAX_PATH];
  503. LoadString(g_rvInfo.hInst, IDS_BADDIR, szMsg, countof(szMsg));
  504. wnsprintf(szTemp, countof(szTemp), szMsg, g_szBuildRoot);
  505. MessageBox(NULL, szTemp, g_szTitle, MB_OK | MB_SETFOREGROUND | MB_ICONEXCLAMATION);
  506. return FALSE;
  507. }
  508. GetTempPath(MAX_PATH, g_szBuildTemp);
  509. PathAppend(g_szBuildTemp, TEXT("iedktemp"));
  510. PathRemovePath(g_szBuildTemp);
  511. PathCreatePath(g_szBuildTemp);
  512. GenerateCustomIns();
  513. if (g_szSrcRoot[0])
  514. g_fBatch2 = TRUE;
  515. else
  516. g_fBatch = TRUE;
  517. if (szType[0])
  518. {
  519. if ( 0 == StrCmpI(szType, TEXT("CORP")))
  520. {
  521. // if type CORP, set CorpMode=1; this allows the Profile Manager to run
  522. DWORD dwVal = 1;
  523. RegSetValueEx(s_hkIEAKUser, TEXT("CorpMode"), 0, REG_DWORD, (CONST BYTE *) &dwVal, sizeof(dwVal));
  524. s_iType = INTRANET;
  525. }
  526. else if ( 0 == StrCmpI(szType, TEXT("ISP")))
  527. {
  528. RegDeleteValue(s_hkIEAKUser, TEXT("CorpMode"));
  529. s_iType = BRANDED;
  530. }
  531. else if ( 0 == StrCmpI(szType, TEXT("ICP")))
  532. {
  533. RegDeleteValue(s_hkIEAKUser, TEXT("CorpMode"));
  534. s_iType = REDIST;
  535. }
  536. else
  537. {
  538. if(g_hLogFile)
  539. {
  540. TCHAR szError[MAX_PATH];
  541. DWORD dwNumWritten;
  542. LoadString(g_rvInfo.hInst,IDS_ERROR_INVALIDMODE,szError,MAX_PATH);
  543. FormatString(szError,szType);
  544. WriteFile(g_hLogFile,szError,StrLen(szError),&dwNumWritten,NULL);
  545. }
  546. return FALSE;
  547. }
  548. }
  549. else
  550. s_iType = GetPrivateProfileInt( IS_BRANDING, TEXT("Type"), REDIST, g_szCustIns );
  551. switch (s_iType)
  552. {
  553. case REDIST:
  554. g_fBranded = g_fIntranet = g_fSilent = FALSE;
  555. break;
  556. case BRANDED:
  557. case BRANDEDPROXY:
  558. g_fBranded = TRUE;
  559. g_fIntranet = g_fSilent = FALSE;
  560. break;
  561. case INTRANET:
  562. g_fIntranet = g_fBranded = TRUE;
  563. break;
  564. }
  565. if (g_fOCW)
  566. {
  567. // set to corp mode
  568. g_fIntranet = g_fBranded = TRUE;
  569. s_iType = INTRANET;
  570. // set to flat install
  571. g_fDownload = g_fCD = g_fBrandingOnly = FALSE;
  572. g_fLAN = TRUE;
  573. return TRUE;
  574. }
  575. IE4BatchSetup();
  576. return TRUE;
  577. }
  578. //
  579. //
  580. // FUNCTION: InitInstance(HANDLE)
  581. //
  582. // PURPOSE: Creates the main window.
  583. //
  584. // COMMENTS: N/A
  585. //
  586. //
  587. HWND g_hWndCent;
  588. BOOL InitInstance(HINSTANCE hInstance)
  589. {
  590. InitCommonControls();
  591. GetWindowRect(GetDesktopWindow(), &g_dtRect);
  592. g_hWndCent = CreateWindow(
  593. TEXT("SampleWClass"),
  594. TEXT("IEAK"),
  595. WS_POPUPWINDOW | WS_CAPTION,
  596. g_dtRect.right/2, g_dtRect.bottom/2, 0, 0,
  597. HWND_DESKTOP,
  598. NULL,
  599. hInstance,
  600. (HINSTANCE) NULL);
  601. ShowWindow(g_hWndCent, SW_SHOWNORMAL);
  602. UpdateWindow(g_hWndCent);
  603. PostMessage(g_hWndCent, WM_COMMAND, IDM_WIZARD, (LPARAM) 0);
  604. return (TRUE);
  605. }
  606. IEAKLITEINFO g_IEAKLiteArray[NUM_GROUPS] = {
  607. {IDS_IL_ACTIVESETUP, IDS_IL_ACTIVESETUPDESC, IDS_IL_ACTIVESETUPDESC, IDS_IL_ACTIVESETUPDESC, -2, TRUE, TRUE, TRUE, TRUE},
  608. {IDS_IL_CORPINSTALL, IDS_IL_CORPINSTALLDESC, IDS_IL_CORPINSTALLDESC, IDS_IL_CORPINSTALLDESC, -2, FALSE, FALSE, TRUE, TRUE},
  609. {IDS_IL_CABSIGN, IDS_IL_CABSIGNDESC, IDS_IL_CABSIGNDESC, IDS_IL_CABSIGNDESC, -2, TRUE, TRUE, TRUE, TRUE},
  610. {IDS_IL_ICM, IDS_IL_ICMDESC, IDS_IL_ICMDESC, IDS_IL_ICMDESC, -2, FALSE, TRUE, TRUE, TRUE},
  611. {IDS_IL_BROWSER, IDS_IL_BROWSERDESC, IDS_IL_BROWSERDESC, IDS_IL_BROWSERDESC, -2, TRUE, TRUE, TRUE, TRUE},
  612. {IDS_IL_URL, IDS_IL_URLDESC, IDS_IL_URLDESC, IDS_IL_URLDESC, -2, TRUE, TRUE, TRUE, TRUE},
  613. {IDS_IL_FAV, IDS_IL_FAVDESC, IDS_IL_FAVDESC, IDS_IL_FAVDESC, -2, TRUE, TRUE, TRUE, TRUE},
  614. {IDS_IL_UASTR, IDS_IL_UASTRDESC, IDS_IL_UASTRDESC, IDS_IL_UASTRDESC, -2, TRUE, TRUE, TRUE, TRUE},
  615. {IDS_IL_CONNECT, IDS_IL_CONNECTDESC, IDS_IL_CONNECTDESC, IDS_IL_CONNECTDESC, -2, FALSE, TRUE, TRUE, TRUE},
  616. {IDS_IL_SIGNUP, IDS_IL_SIGNUPDESC, IDS_IL_SIGNUPDESC, IDS_IL_SIGNUPDESC, -2, FALSE, TRUE, FALSE, TRUE},
  617. {IDS_IL_CERT, IDS_IL_CERTDESC, IDS_IL_CERTDESC, IDS_IL_CERTDESC, -2, FALSE, TRUE, TRUE, TRUE},
  618. {IDS_IL_ZONES, IDS_IL_ZONESDESC, IDS_IL_ZONESDESC, IDS_IL_ZONESDESC, -2, FALSE, FALSE, TRUE, TRUE},
  619. {IDS_IL_PROGRAMS, IDS_IL_PROGRAMSDESC, IDS_IL_PROGRAMSDESC, IDS_IL_PROGRAMSDESC, -2, TRUE, TRUE, TRUE, TRUE},
  620. {IDS_IL_MAILNEWS, IDS_IL_MAILNEWSDESC, IDS_IL_MAILNEWSDESC, IDS_IL_MAILNEWSDESC, -2, FALSE, TRUE, TRUE, TRUE},
  621. {IDS_IL_ADM, IDS_IL_ADMDESC, IDS_IL_ADMDESC, IDS_IL_ADMDESC, -2, TRUE, TRUE, TRUE, TRUE}
  622. };
  623. void DisableIEAKLiteGroups()
  624. {
  625. TCHAR szIspFile[MAX_PATH];
  626. if (!g_IEAKLiteArray[IL_ACTIVESETUP].fEnabled)
  627. {
  628. s_fPageEnabled[PPAGE_SETUPWIZARD] = s_fPageEnabled[PPAGE_COMPSEL] = s_fPageEnabled[PPAGE_ISKBACK] = s_fPageEnabled[PPAGE_CDINFO] =
  629. s_fPageEnabled[PPAGE_CUSTOMCUSTOM] = s_fPageEnabled[PPAGE_COPYCOMP] = s_fPageEnabled[PPAGE_COMPURLS] =
  630. s_fPageEnabled[PPAGE_CUSTCOMP] = FALSE;
  631. }
  632. if (!g_IEAKLiteArray[IL_CORPINSTALL].fEnabled)
  633. {
  634. s_fPageEnabled[PPAGE_CORPCUSTOM] = s_fPageEnabled[PPAGE_INSTALLDIR] = s_fPageEnabled[PPAGE_SILENTINSTALL] = FALSE;
  635. }
  636. if (!g_IEAKLiteArray[IL_CABSIGN].fEnabled)
  637. {
  638. s_fPageEnabled[PPAGE_CABSIGN] = FALSE;
  639. }
  640. if (!g_IEAKLiteArray[IL_ICM].fEnabled)
  641. {
  642. s_fPageEnabled[PPAGE_ICM] = FALSE;
  643. }
  644. if (!g_IEAKLiteArray[IL_BROWSER].fEnabled)
  645. {
  646. s_fPageEnabled[PPAGE_TITLE] = s_fPageEnabled[PPAGE_CUSTICON] =
  647. s_fPageEnabled[PPAGE_BTOOLBARS] = FALSE;
  648. }
  649. if (!g_IEAKLiteArray[IL_URL].fEnabled)
  650. {
  651. s_fPageEnabled[PPAGE_STARTSEARCH] = s_fPageEnabled[PPAGE_WELCOMEMSGS] =
  652. s_fPageEnabled[PPAGE_ADDON] = FALSE;
  653. }
  654. if (!g_IEAKLiteArray[IL_FAV].fEnabled)
  655. {
  656. s_fPageEnabled[PPAGE_FAVORITES] = FALSE;
  657. }
  658. if (!g_IEAKLiteArray[IL_UASTR].fEnabled)
  659. {
  660. s_fPageEnabled[PPAGE_UASTRDLG] = FALSE;
  661. }
  662. if (!g_IEAKLiteArray[IL_CONNECT].fEnabled)
  663. {
  664. s_fPageEnabled[PPAGE_PROXY] = s_fPageEnabled[PPAGE_CONNECTSET] = s_fPageEnabled[PPAGE_QUERYAUTOCONFIG] = FALSE;
  665. }
  666. if (!g_IEAKLiteArray[IL_SIGNUP].fEnabled)
  667. {
  668. s_fPageEnabled[PPAGE_QUERYSIGNUP] =
  669. s_fPageEnabled[PPAGE_SIGNUPFILES] =
  670. s_fPageEnabled[PPAGE_SERVERISPS] =
  671. s_fPageEnabled[PPAGE_ICW] = s_fPageEnabled[PPAGE_ISPINS] = FALSE;
  672. }
  673. if (!g_IEAKLiteArray[IL_CERT].fEnabled)
  674. {
  675. s_fPageEnabled[PPAGE_ADDROOT] = s_fPageEnabled[PPAGE_SECURITYCERT] = FALSE;
  676. }
  677. if (!g_IEAKLiteArray[IL_ZONES].fEnabled)
  678. {
  679. s_fPageEnabled[PPAGE_SECURITY] = FALSE;
  680. }
  681. if (!g_IEAKLiteArray[IL_PROGRAMS].fEnabled)
  682. {
  683. s_fPageEnabled[PPAGE_PROGRAMS] = FALSE;
  684. }
  685. if (!g_IEAKLiteArray[IL_MAILNEWS].fEnabled)
  686. {
  687. s_fPageEnabled[PPAGE_MAIL] = s_fPageEnabled[PPAGE_IMAP] = s_fPageEnabled[PPAGE_LDAP] =
  688. s_fPageEnabled[PPAGE_OE] = s_fPageEnabled[PPAGE_SIG] = s_fPageEnabled[PPAGE_PRECONFIG] =
  689. s_fPageEnabled[PPAGE_OEVIEW] = FALSE;
  690. }
  691. if (!g_IEAKLiteArray[IL_ADM].fEnabled)
  692. {
  693. s_fPageEnabled[PPAGE_ADMDESC] = FALSE;
  694. s_fPageEnabled[PPAGE_ADM] = FALSE;
  695. }
  696. // do not show stage 4 page if nothing has been left on in the stage
  697. if (!(g_IEAKLiteArray[IL_BROWSER].fEnabled || g_IEAKLiteArray[IL_URL].fEnabled
  698. || g_IEAKLiteArray[IL_FAV].fEnabled || g_IEAKLiteArray[IL_UASTR].fEnabled ||
  699. (g_IEAKLiteArray[IL_CONNECT].fEnabled && g_fBranded) || (g_IEAKLiteArray[IL_SIGNUP].fEnabled && !g_fIntranet && g_fBranded) ||
  700. ((g_IEAKLiteArray[IL_CERT].fEnabled || g_IEAKLiteArray[IL_ZONES].fEnabled) && g_fIntranet)))
  701. s_fPageEnabled[PPAGE_STAGE4] = FALSE;
  702. if (!(g_IEAKLiteArray[IL_PROGRAMS].fEnabled || (g_IEAKLiteArray[IL_MAILNEWS].fEnabled && g_fBranded) ||
  703. g_IEAKLiteArray[IL_ADM].fEnabled))
  704. s_fPageEnabled[PPAGE_STAGE5] = FALSE;
  705. // szIspFile used as temp buf
  706. if (g_fDownload && !g_fOCW && ISNONNULL(g_szCustIns) && !GetPrivateProfileString(IS_ACTIVESETUP_SITES, TEXT("SiteUrl0"), TEXT(""), szIspFile, countof(szIspFile), g_szCustIns))
  707. s_fPageEnabled[PPAGE_COMPURLS] = TRUE;
  708. // do not show stage 3 page if nothing has been left on in the stage
  709. if (!(s_fPageEnabled[PPAGE_COMPURLS] || g_IEAKLiteArray[IL_ACTIVESETUP].fEnabled ||
  710. (g_IEAKLiteArray[IL_CORPINSTALL].fEnabled && g_fIntranet) || g_IEAKLiteArray[IL_CABSIGN].fEnabled ||
  711. (g_IEAKLiteArray[IL_ICM].fEnabled) && g_fBranded && !g_fBrandingOnly))
  712. s_fPageEnabled[PPAGE_STAGE3] = FALSE;
  713. // always enable download urls page for download packages
  714. // the page itself has logic to skip
  715. if (g_fDownload)
  716. s_fPageEnabled[PPAGE_COMPURLS] = TRUE;
  717. }
  718. void EnablePages()
  719. {
  720. int i;
  721. static BOOL s_fRunningOnIntegShell = WhichPlatform() & PLATFORM_INTEGRATED;
  722. for (i = 0; i < NUM_PAGES; i++)
  723. {
  724. s_fPageEnabled[i] = TRUE;
  725. }
  726. // NOTE: pages should not explicitly be set to TRUE after this point
  727. // g_fIntranet and g_fBranded are set to the following values depending on the role
  728. // ICP: (g_fIntranet == FALSE && g_fBranded == FALSE)
  729. // ISP: (g_fIntranet == FALSE && g_fBranded == TRUE )
  730. // CORP: (g_fIntranet == TRUE && g_fBranded == TRUE )
  731. //
  732. // So, check for
  733. // ICP is (!g_fBranded)
  734. // ISP is (!g_fIntranet && g_fBranded)
  735. // CORP is (g_fIntranet)
  736. if (!g_fBranded)
  737. { // ICP mode
  738. s_fPageEnabled[PPAGE_PROXY] =
  739. s_fPageEnabled[PPAGE_INSTALLDIR] =
  740. s_fPageEnabled[PPAGE_ICM] =
  741. s_fPageEnabled[PPAGE_ICW] =
  742. s_fPageEnabled[PPAGE_QUERYAUTOCONFIG] =
  743. s_fPageEnabled[PPAGE_MAIL] =
  744. s_fPageEnabled[PPAGE_IMAP] =
  745. s_fPageEnabled[PPAGE_LDAP] =
  746. s_fPageEnabled[PPAGE_PRECONFIG] =
  747. s_fPageEnabled[PPAGE_OEVIEW] =
  748. s_fPageEnabled[PPAGE_OE] = s_fPageEnabled[PPAGE_CORPCUSTOM] = s_fPageEnabled[PPAGE_ADMDESC] =
  749. s_fPageEnabled[PPAGE_SIG] = s_fPageEnabled[PPAGE_FOLDERMCCP] = s_fPageEnabled[PPAGE_ADDROOT] =
  750. s_fPageEnabled[PPAGE_SECURITY] = s_fPageEnabled[PPAGE_SECURITYCERT] = s_fPageEnabled[PPAGE_QUERYSIGNUP] =
  751. s_fPageEnabled[PPAGE_SILENTINSTALL] =
  752. s_fPageEnabled[PPAGE_DESKTOP] = s_fPageEnabled[PPAGE_DTOOLBARS] = s_fPageEnabled[PPAGE_CONNECTSET] =
  753. s_fPageEnabled[PPAGE_SIGNUPFILES] = s_fPageEnabled[PPAGE_SERVERISPS] = s_fPageEnabled[PPAGE_ISPINS] = FALSE;
  754. }
  755. else if (!g_fIntranet)
  756. { // Either ISP or Super ISP
  757. s_fPageEnabled[PPAGE_QUERYAUTOCONFIG] =
  758. s_fPageEnabled[PPAGE_SIG] =
  759. s_fPageEnabled[PPAGE_INSTALLDIR] =
  760. s_fPageEnabled[PPAGE_SILENTINSTALL] =
  761. s_fPageEnabled[PPAGE_DESKTOP] = s_fPageEnabled[PPAGE_DTOOLBARS] = s_fPageEnabled[PPAGE_ADMDESC] =
  762. s_fPageEnabled[PPAGE_SECURITY] = s_fPageEnabled[PPAGE_SECURITYCERT] =
  763. s_fPageEnabled[PPAGE_FOLDERMCCP] = s_fPageEnabled[PPAGE_CORPCUSTOM] = FALSE;
  764. s_fPageEnabled[PPAGE_SERVERISPS] = (g_fServerICW || g_fServerKiosk) && !g_fSkipServerIsps;
  765. s_fPageEnabled[PPAGE_ISPINS] = !g_fNoSignup && !g_fSkipIspIns;
  766. s_fPageEnabled[PPAGE_ICW] = g_fServerICW;
  767. s_fPageEnabled[PPAGE_SIGNUPFILES] = !g_fNoSignup;
  768. }
  769. else
  770. { // CorpAdmin mode
  771. s_fPageEnabled[PPAGE_ADDROOT] = s_fPageEnabled[PPAGE_ICW] =
  772. s_fPageEnabled[PPAGE_SERVERISPS] = s_fPageEnabled[PPAGE_ISPINS] =
  773. s_fPageEnabled[PPAGE_QUERYSIGNUP] = s_fPageEnabled[PPAGE_SIGNUPFILES] = FALSE;
  774. s_fPageEnabled[PPAGE_DTOOLBARS] = s_fPageEnabled[PPAGE_DESKTOP] = g_fInteg && s_fRunningOnIntegShell && !s_fNT5;
  775. s_fPageEnabled[PPAGE_FOLDERMCCP] = g_fInteg && !s_fNT5;
  776. s_fPageEnabled[PPAGE_ADMDESC] = ADMEnablePage();
  777. }
  778. if (!g_fCD)
  779. s_fPageEnabled[PPAGE_ISKBACK] = s_fPageEnabled[PPAGE_CDINFO] = FALSE;
  780. if (!g_fDownload)
  781. s_fPageEnabled[PPAGE_COMPURLS] = FALSE;
  782. if (!g_fMailNews95 && !g_fOCW)
  783. {
  784. s_fPageEnabled[PPAGE_MAIL] = s_fPageEnabled[PPAGE_IMAP] = s_fPageEnabled[PPAGE_PRECONFIG] =
  785. s_fPageEnabled[PPAGE_OEVIEW] = s_fPageEnabled[PPAGE_LDAP] = s_fPageEnabled[PPAGE_OE] =
  786. s_fPageEnabled[PPAGE_SIG] = FALSE;
  787. }
  788. if (!g_fDownload && (g_fSilent || g_fStealth))
  789. s_fPageEnabled[PPAGE_CUSTOMCUSTOM] = FALSE;
  790. // pages to disable for single disk branding only builds
  791. if (g_fBrandingOnly && !(g_fDownload || g_fLAN || g_fCD))
  792. {
  793. s_fPageEnabled[PPAGE_CUSTCOMP] = s_fPageEnabled[PPAGE_COMPSEL] = s_fPageEnabled[PPAGE_COMPURLS] =
  794. s_fPageEnabled[PPAGE_INSTALLDIR] = s_fPageEnabled[PPAGE_CORPCUSTOM] = s_fPageEnabled[PPAGE_CUSTOMCUSTOM] =
  795. s_fPageEnabled[PPAGE_COPYCOMP] = s_fPageEnabled[PPAGE_ICM] =
  796. s_fPageEnabled[PPAGE_ADDON] = FALSE;
  797. g_fInteg = TRUE; // set this flag to true so admins can still make desktop customizations
  798. }
  799. // disable advanced installation options page if no download media and custom mode
  800. // disabled
  801. if (!g_fDownload && InsGetBool(IS_BRANDING, TEXT("HideCustom"), FALSE, g_szCustIns))
  802. s_fPageEnabled[PPAGE_CUSTOMCUSTOM] = FALSE;
  803. if (g_fImportConnect)
  804. s_fPageEnabled[PPAGE_PROXY] = s_fPageEnabled[PPAGE_QUERYAUTOCONFIG] = FALSE;
  805. s_fPageEnabled[PPAGE_ADM] = ADMEnablePage();
  806. if(g_fOCW)
  807. {
  808. s_fPageEnabled[PPAGE_FINISH] =
  809. s_fPageEnabled[PPAGE_MEDIA] = s_fPageEnabled[PPAGE_ISPINS] =
  810. s_fPageEnabled[PPAGE_ICM] = s_fPageEnabled[PPAGE_QUERYSIGNUP] = s_fPageEnabled[PPAGE_ICW] =
  811. s_fPageEnabled[PPAGE_SIGNUPFILES] = s_fPageEnabled[PPAGE_SERVERISPS] = s_fPageEnabled[PPAGE_SETUPWIZARD] =
  812. s_fPageEnabled[PPAGE_STAGE1] = s_fPageEnabled[PPAGE_STAGE2] = s_fPageEnabled[PPAGE_STAGE3] =
  813. s_fPageEnabled[PPAGE_STAGE4] = s_fPageEnabled[PPAGE_STAGE5] = s_fPageEnabled[PPAGE_SILENTINSTALL] =
  814. s_fPageEnabled[PPAGE_COMPURLS] = s_fPageEnabled[PPAGE_INSTALLDIR] = FALSE;
  815. }
  816. else
  817. {
  818. s_fPageEnabled[PPAGE_OCWSTAGE2] = FALSE;
  819. }
  820. // Special case IMAP page
  821. if (g_fDisableIMAPPage)
  822. s_fPageEnabled[PPAGE_IMAP] = FALSE;
  823. DisableIEAKLiteGroups();
  824. }
  825. BOOL PageEnabled(int iPage)
  826. {
  827. TCHAR szTemp[4];
  828. // this should eventually just index into s_fPageEnabled, but for now we need to do this
  829. // manually since we must still use the page array for PageNext and PageBack
  830. if (iPage == PPAGE_COMPURLS)
  831. return (g_IEAKLiteArray[IL_ACTIVESETUP].fEnabled
  832. || !GetPrivateProfileString(IS_ACTIVESETUP_SITES, TEXT("SiteUrl0"),
  833. TEXT(""), szTemp, countof(szTemp), g_szCustIns));
  834. return TRUE; // default to show page
  835. }
  836. static TCHAR s_aSzTitle[NUM_PAGES][MAX_PATH];
  837. void PageNext(HWND hDlg)
  838. {
  839. if (s_fPageEnabled[++g_iCurPage]) return;
  840. while (1)
  841. {
  842. if (s_fPageEnabled[++g_iCurPage])
  843. {
  844. DWORD id = (DWORD) PtrToUlong(g_psp[g_iCurPage].pszTemplate);
  845. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, id);
  846. return;
  847. }
  848. }
  849. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, IDD_FINISH);
  850. }
  851. void PagePrev(HWND hDlg)
  852. {
  853. if (s_fPageEnabled[--g_iCurPage]) return;
  854. while (1)
  855. {
  856. if (s_fPageEnabled[--g_iCurPage])
  857. {
  858. DWORD id = (DWORD) PtrToUlong(g_psp[g_iCurPage].pszTemplate);
  859. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, id);
  860. return;
  861. }
  862. }
  863. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, IDD_KEYINS);
  864. }
  865. SHFILEOPSTRUCT g_shfStruc;
  866. void DoCancel()
  867. {
  868. g_fCancelled = TRUE;
  869. g_fOCWCancel = TRUE;
  870. if (g_hDownloadEvent) SetEvent(g_hDownloadEvent);
  871. PostQuitMessage(0);
  872. }
  873. BOOL QueryCancel(HWND hDlg)
  874. {
  875. TCHAR szMsg[MAX_PATH];
  876. LoadString( g_rvInfo.hInst, IDS_CANCELOK, szMsg, countof(szMsg) );
  877. if (MessageBox(hDlg, szMsg, g_szTitle, MB_YESNO | MB_SETFOREGROUND) == IDNO)
  878. {
  879. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, -1);
  880. g_fCancelled = FALSE;
  881. return(FALSE);
  882. }
  883. DoCancel();
  884. return(TRUE);
  885. }
  886. BOOL IeakPageHelp(HWND hWnd, LPCTSTR pszData)
  887. {
  888. static TCHAR szHelpPath[MAX_PATH] = TEXT("");
  889. UNREFERENCED_PARAMETER(hWnd);
  890. if (ISNULL(szHelpPath))
  891. PathCombine(szHelpPath, g_szWizRoot, TEXT("ieakhelp.chm"));
  892. // (pritobla): If we pass hWnd to HtmlHelp, the HTML help window
  893. // would stay on top of our window (parent->child relationship).
  894. // This is bad because the user can't switch between these windows
  895. // for cross referencing. This is especially bad on a 640x480
  896. // resolution monitor.
  897. s_hWndHelp = HtmlHelp(NULL, szHelpPath, HH_HELP_CONTEXT, (ULONG_PTR) pszData);
  898. // (pritobla): On OSR2 machines, the HTML help window comes up behind
  899. // our window. On a 640x480 resolution monitor, we pretty much occupy
  900. // the entire screen, so the user won't know that the HTML help window
  901. // is up. Setting it to the foreground solves the problem.
  902. SetForegroundWindow(s_hWndHelp);
  903. return TRUE;
  904. }
  905. extern DWORD BuildIE4(LPVOID );
  906. //
  907. // FUNCTION: MainWndProc(HWND, UINT, UINT, LONG)
  908. //
  909. // PURPOSE: Processes messages for the main window procedure
  910. //
  911. // MESSAGES:
  912. //
  913. // WM_CREATE - creates the main MLE for the window
  914. // WM_COMMAND - processes the menu commands for the application
  915. // WM_SIZE - sizes the MLE to fill the client area of the window
  916. // WM_DESTROY - posts a quit message and returns
  917. //
  918. LRESULT APIENTRY MainWndProc(
  919. HWND hWnd, // window handle
  920. UINT message, // type of message
  921. WPARAM wParam, // additional information
  922. LPARAM lParam) // additional information
  923. {
  924. int i;
  925. switch (message)
  926. {
  927. case WM_CREATE:
  928. return FALSE;
  929. case WM_INITDIALOG:
  930. return FALSE;
  931. case WM_SIZE:
  932. if (!IsIconic(hWnd) && (hWnd != g_hWndCent))
  933. ShowWindow(hWnd, SW_MINIMIZE);
  934. if (g_hWizard != NULL)
  935. SetFocus(g_hWizard);
  936. return (DefWindowProc(hWnd, message, wParam, lParam));
  937. case WM_HELP:
  938. IeakPageHelp(hWnd, g_psp[g_iCurPage].pszTemplate);
  939. break;
  940. case WM_COMMAND:
  941. switch( LOWORD( wParam ))
  942. {
  943. case IDM_WIZARD:
  944. if (g_fCancelled)
  945. break;
  946. i = CreateWizard(g_hWndCent);
  947. if (i < 0) {
  948. PostQuitMessage(0);
  949. break;
  950. }
  951. PostMessage(hWnd, WM_COMMAND, IDM_LAST, (LPARAM) 0);
  952. break;
  953. case IDM_LAST:
  954. PostQuitMessage(0);
  955. break;
  956. case IDM_EXIT:
  957. PostQuitMessage(0);
  958. break;
  959. default:
  960. return (DefWindowProc(hWnd, message, wParam, lParam));
  961. }
  962. break;
  963. case WM_CLOSE:
  964. QueryCancel(hWnd);
  965. break;
  966. case WM_DESTROY: /* message: window being destroyed */
  967. PostQuitMessage(0);
  968. DestroyWindow(g_hWndCent);
  969. break;
  970. default:
  971. return (DefWindowProc(hWnd, message, wParam, lParam));
  972. }
  973. return (0);
  974. }
  975. DWORD GetRootFree(LPCTSTR pcszPath)
  976. {
  977. DWORD dwSecPerClus, dwBytesPerSec, dwTotClusters, dwFreeClusters, dwClustK;
  978. CHAR szPathA[MAX_PATH];
  979. // thunk to ANSI since shlwapi doesn't have a wrapper fot GetDiskFreeSpace and
  980. // the W version is stubbed out on Win95
  981. T2Abux(pcszPath, szPathA);
  982. if (szPathA[1] == ':')
  983. {
  984. szPathA[3] = '\0';
  985. }
  986. else
  987. {
  988. if ((szPathA[0] == '\\') && (szPathA[1] == '\\'))
  989. {
  990. NETRESOURCEA netRes;
  991. DWORD erc = ERROR_ALREADY_ASSIGNED;
  992. CHAR szLocalPathA[4] = "D:";
  993. LPSTR pBack = StrChrA(&szPathA[2], '\\');
  994. if (!pBack) return(0);
  995. pBack = StrChrA(CharNextA(pBack), '\\');
  996. if (pBack) *pBack = '\0';
  997. ZeroMemory(&netRes, sizeof(netRes));
  998. netRes.dwType = RESOURCETYPE_DISK;
  999. netRes.lpRemoteName = szPathA;
  1000. for (*szLocalPathA = 'D'; *szLocalPathA <= 'Z' ; (*szLocalPathA)++ )
  1001. {
  1002. netRes.lpLocalName = szLocalPathA;
  1003. erc = WNetAddConnection2A(&netRes, NULL, NULL, 0);
  1004. if (erc == ERROR_ALREADY_ASSIGNED) continue;
  1005. if (erc == NO_ERROR) break;
  1006. }
  1007. if (erc == NO_ERROR)
  1008. {
  1009. if (!GetDiskFreeSpaceA( szLocalPathA, &dwSecPerClus, &dwBytesPerSec, &dwFreeClusters, &dwTotClusters ))
  1010. dwSecPerClus = dwBytesPerSec = 0;
  1011. WNetCancelConnection2A(szLocalPathA, 0, FALSE);
  1012. if (dwSecPerClus == 1) return(dwFreeClusters/2);
  1013. dwClustK = dwSecPerClus * dwBytesPerSec / 1024;
  1014. return(dwClustK * dwFreeClusters);
  1015. }
  1016. }
  1017. else return(0);
  1018. }
  1019. if (!GetDiskFreeSpaceA( szPathA, &dwSecPerClus, &dwBytesPerSec, &dwFreeClusters, &dwTotClusters ))
  1020. return(0);
  1021. if (dwSecPerClus == 1) return(dwFreeClusters/2);
  1022. dwClustK = dwSecPerClus * dwBytesPerSec / 1024;
  1023. return(dwClustK * dwFreeClusters);
  1024. }
  1025. void CheckBatchAdvance(HWND hDlg)
  1026. {
  1027. if (g_fBatch || g_fBatch2) PostMessage(hDlg, IDM_BATCHADVANCE, 0, 0);
  1028. }
  1029. void DoBatchAdvance(HWND hDlg)
  1030. {
  1031. if (g_fBatch || g_fBatch2) PostMessage(GetParent(hDlg), PSM_PRESSBUTTON, PSBTN_NEXT, 0);
  1032. }
  1033. INT_PTR CALLBACK MediaDlgProc(HWND hDlg, UINT uMsg, WPARAM, LPARAM lParam)
  1034. {
  1035. static BOOL s_fNext = TRUE;
  1036. switch (uMsg)
  1037. {
  1038. case IDM_BATCHADVANCE:
  1039. DoBatchAdvance(hDlg);
  1040. break;
  1041. case WM_HELP:
  1042. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  1043. break;
  1044. case WM_NOTIFY:
  1045. switch (((NMHDR FAR *) lParam)->code)
  1046. {
  1047. case PSN_HELP:
  1048. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  1049. break;
  1050. case PSN_SETACTIVE:
  1051. SetBannerText(hDlg);
  1052. g_fDownload = GetPrivateProfileInt(TEXT("Media"), TEXT("Build_Download"), 1, g_szCustIns);
  1053. g_fCD = GetPrivateProfileInt(TEXT("Media"), TEXT("Build_CD"), 0, g_szCustIns);
  1054. g_fLAN = GetPrivateProfileInt(TEXT("Media"), TEXT("Build_LAN"), 0, g_szCustIns);
  1055. g_fBrandingOnly = GetPrivateProfileInt(TEXT("Media"), TEXT("Build_BrandingOnly"), 0, g_szCustIns);
  1056. if (IsWindowEnabled(GetDlgItem(hDlg, IDC_CHECKDL)))
  1057. CheckDlgButton(hDlg, IDC_CHECKDL, g_fDownload ? BST_CHECKED : BST_UNCHECKED);
  1058. if (IsWindowEnabled(GetDlgItem(hDlg, IDC_CHECKCD)))
  1059. CheckDlgButton(hDlg, IDC_CHECKCD, g_fCD ? BST_CHECKED : BST_UNCHECKED);
  1060. if (IsWindowEnabled(GetDlgItem(hDlg, IDC_CHECKLAN)))
  1061. CheckDlgButton(hDlg, IDC_CHECKLAN, g_fLAN ? BST_CHECKED : BST_UNCHECKED);
  1062. if (IsWindowEnabled(GetDlgItem(hDlg, IDC_CHECKSDB)))
  1063. CheckDlgButton(hDlg, IDC_CHECKSDB, g_fBrandingOnly ? BST_CHECKED : BST_UNCHECKED);
  1064. PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_BACK | PSWIZB_NEXT);
  1065. CheckBatchAdvance(hDlg);
  1066. break;
  1067. case PSN_WIZBACK:
  1068. case PSN_WIZNEXT:
  1069. g_fDownload = g_fCD = g_fLAN = g_fBrandingOnly = FALSE;
  1070. if (IsWindowEnabled(GetDlgItem(hDlg, IDC_CHECKDL)))
  1071. g_fDownload = (IsDlgButtonChecked(hDlg, IDC_CHECKDL) == BST_CHECKED);
  1072. if (IsWindowEnabled(GetDlgItem(hDlg, IDC_CHECKCD)))
  1073. g_fCD = (IsDlgButtonChecked(hDlg, IDC_CHECKCD) == BST_CHECKED);
  1074. if (IsWindowEnabled(GetDlgItem(hDlg, IDC_CHECKLAN)))
  1075. g_fLAN = (IsDlgButtonChecked(hDlg, IDC_CHECKLAN) == BST_CHECKED);
  1076. if (IsWindowEnabled(GetDlgItem(hDlg, IDC_CHECKSDB)))
  1077. g_fBrandingOnly = (IsDlgButtonChecked(hDlg, IDC_CHECKSDB) == BST_CHECKED);
  1078. // if none of the media boxes are selected, display an error msg
  1079. if (!g_fDownload && !g_fCD && !g_fLAN && !g_fBrandingOnly)
  1080. {
  1081. ErrorMessageBox(hDlg, IDS_NOMEDIA);
  1082. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, -1);
  1083. break;
  1084. }
  1085. WritePrivateProfileString(TEXT("Media"), TEXT("Build_Download"), g_fDownload ? TEXT("1") : TEXT("0"), g_szCustIns );
  1086. WritePrivateProfileString(TEXT("Media"), TEXT("Build_CD"), g_fCD ? TEXT("1") : TEXT("0"), g_szCustIns );
  1087. WritePrivateProfileString(TEXT("Media"), TEXT("Build_LAN"), g_fLAN ? TEXT("1") : TEXT("0"), g_szCustIns );
  1088. WritePrivateProfileString(TEXT("Media"), TEXT("Build_BrandingOnly"), g_fBrandingOnly ? TEXT("1") : TEXT("0"), g_szCustIns );
  1089. s_fNext = (((NMHDR FAR *) lParam)->code == PSN_WIZNEXT) ? FALSE : TRUE;
  1090. g_iCurPage = PPAGE_MEDIA;
  1091. EnablePages();
  1092. (((NMHDR FAR *) lParam)->code == PSN_WIZNEXT) ? PageNext(hDlg) : PagePrev(hDlg);
  1093. break;
  1094. case PSN_QUERYCANCEL:
  1095. QueryCancel(hDlg);
  1096. break;
  1097. default:
  1098. return FALSE;
  1099. }
  1100. break;
  1101. default:
  1102. return FALSE;
  1103. }
  1104. return TRUE;
  1105. }
  1106. void DisplayBitmap(HWND hControl, LPCTSTR pcszFileName, int nBitmapId)
  1107. {
  1108. HANDLE hBmp = (HANDLE) GetWindowLongPtr(hControl, GWLP_USERDATA);
  1109. if(ISNONNULL(pcszFileName) && PathFileExists(pcszFileName))
  1110. ShowBitmap(hControl, pcszFileName, 0, &hBmp);
  1111. else
  1112. ShowBitmap(hControl, TEXT(""), nBitmapId, &hBmp);
  1113. SetWindowLongPtr(hControl, GWLP_USERDATA, (LONG_PTR)hBmp);
  1114. }
  1115. void ReleaseBitmap(HWND hControl)
  1116. {
  1117. HANDLE hBmp = (HANDLE) GetWindowLongPtr(hControl, GWLP_USERDATA);
  1118. if (hBmp)
  1119. DeleteObject(hBmp);
  1120. }
  1121. void InitializeAnimBmps(HWND hDlg, LPCTSTR szInsFile)
  1122. {
  1123. TCHAR szBig[MAX_PATH];
  1124. TCHAR szSmall[MAX_PATH];
  1125. BOOL fBrandBmps;
  1126. // load information from ins file
  1127. fBrandBmps = InsGetString(IS_ANIMATION, TEXT("Big_Path"),
  1128. szBig, countof(szBig), szInsFile);
  1129. SetDlgItemTextTriState(hDlg, IDE_BIGANIMBITMAP, IDC_ANIMBITMAP, szBig, fBrandBmps);
  1130. InsGetString(IS_ANIMATION, TEXT("Small_Path"),
  1131. szSmall, countof(szSmall), szInsFile, NULL, &fBrandBmps);
  1132. SetDlgItemTextTriState(hDlg, IDE_SMALLANIMBITMAP, IDC_ANIMBITMAP, szSmall, fBrandBmps);
  1133. EnableDlgItem2(hDlg, IDE_BIGANIMBITMAP, fBrandBmps);
  1134. EnableDlgItem2(hDlg, IDC_BROWSEBIG, fBrandBmps);
  1135. EnableDlgItem2(hDlg, IDC_BIGANIMBITMAP_TXT, fBrandBmps);
  1136. EnableDlgItem2(hDlg, IDE_SMALLANIMBITMAP, fBrandBmps);
  1137. EnableDlgItem2(hDlg, IDC_BROWSESMALL, fBrandBmps);
  1138. EnableDlgItem2(hDlg, IDC_SMALLANIMBITMAP_TXT, fBrandBmps);
  1139. }
  1140. //
  1141. // FUNCTION: CustIcon(HWND, UINT, UINT, LONG)
  1142. //
  1143. // PURPOSE: Processes messages for "Work Habits" page
  1144. //
  1145. // MESSAGES:
  1146. //
  1147. // WM_INITDIALOG - intializes the page
  1148. // WM_NOTIFY - processes the notifications sent to the page
  1149. // WM_COMMAND - saves the id of the choice selected
  1150. //
  1151. INT_PTR CALLBACK CustIcon( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam )
  1152. {
  1153. TCHAR szBig[MAX_PATH];
  1154. TCHAR szSmall[MAX_PATH];
  1155. TCHAR szLargeBmp[MAX_PATH];
  1156. TCHAR szSmallBmp[MAX_PATH];
  1157. LPDRAWITEMSTRUCT lpDrawItem = NULL;
  1158. TCHAR szWorkDir[MAX_PATH];
  1159. BOOL fBrandBmps,fBrandAnim;
  1160. switch( msg )
  1161. {
  1162. case WM_INITDIALOG:
  1163. //from anim
  1164. EnableDBCSChars(hDlg, IDE_SMALLANIMBITMAP);
  1165. EnableDBCSChars(hDlg, IDE_BIGANIMBITMAP);
  1166. Edit_LimitText(GetDlgItem(hDlg, IDE_SMALLANIMBITMAP), countof(szSmallBmp) - 1);
  1167. Edit_LimitText(GetDlgItem(hDlg, IDE_BIGANIMBITMAP), countof(szLargeBmp) - 1);
  1168. //custicon
  1169. EnableDBCSChars(hDlg, IDC_BITMAP);
  1170. EnableDBCSChars(hDlg, IDC_BITMAP2);
  1171. Edit_LimitText(GetDlgItem(hDlg, IDC_BITMAP), countof(szBig) - 1);
  1172. Edit_LimitText(GetDlgItem(hDlg, IDC_BITMAP2), countof(szSmall) - 1);
  1173. g_hWizard = hDlg;
  1174. break;
  1175. case IDM_BATCHADVANCE:
  1176. DoBatchAdvance(hDlg);
  1177. break;
  1178. case WM_HELP:
  1179. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  1180. break;
  1181. case WM_COMMAND:
  1182. switch (GET_WM_COMMAND_ID(wParam, lParam))
  1183. {
  1184. case IDC_BROWSEBIG:
  1185. GetDlgItemText(hDlg, IDE_BIGANIMBITMAP, szLargeBmp, countof(szLargeBmp));
  1186. if(BrowseForFile(hDlg, szLargeBmp, countof(szLargeBmp), GFN_BMP))
  1187. SetDlgItemText(hDlg, IDE_BIGANIMBITMAP, szLargeBmp);
  1188. break;
  1189. case IDC_BROWSESMALL:
  1190. GetDlgItemText(hDlg, IDE_SMALLANIMBITMAP, szSmallBmp, countof(szSmallBmp));
  1191. if(BrowseForFile(hDlg, szSmallBmp, countof(szSmallBmp), GFN_BMP))
  1192. SetDlgItemText(hDlg, IDE_SMALLANIMBITMAP, szSmallBmp);
  1193. break;
  1194. case IDC_ANIMBITMAP:
  1195. fBrandAnim = (IsDlgButtonChecked(hDlg, IDC_ANIMBITMAP) == BST_CHECKED);
  1196. EnableDlgItem2(hDlg, IDE_BIGANIMBITMAP, fBrandAnim);
  1197. EnableDlgItem2(hDlg, IDC_BROWSEBIG, fBrandAnim);
  1198. EnableDlgItem2(hDlg, IDC_BIGANIMBITMAP_TXT, fBrandAnim);
  1199. EnableDlgItem2(hDlg, IDE_SMALLANIMBITMAP, fBrandAnim);
  1200. EnableDlgItem2(hDlg, IDC_BROWSESMALL, fBrandAnim);
  1201. EnableDlgItem2(hDlg, IDC_SMALLANIMBITMAP_TXT, fBrandAnim);
  1202. break;
  1203. case IDC_BROWSEICON:
  1204. if(HIWORD(wParam) == BN_CLICKED)
  1205. {
  1206. GetDlgItemText(hDlg, IDC_BITMAP, szBig, countof(szBig));
  1207. if(BrowseForFile(hDlg, szBig, countof(szBig), GFN_BMP))
  1208. SetDlgItemText(hDlg, IDC_BITMAP, szBig);
  1209. break;
  1210. }
  1211. return FALSE;
  1212. case IDC_BROWSEICON2:
  1213. if(HIWORD(wParam) == BN_CLICKED)
  1214. {
  1215. GetDlgItemText(hDlg, IDC_BITMAP2, szSmall, countof(szSmall));
  1216. if(BrowseForFile(hDlg, szSmall, countof(szSmall), GFN_BMP))
  1217. SetDlgItemText(hDlg, IDC_BITMAP2, szSmall);
  1218. break;
  1219. }
  1220. return FALSE;
  1221. case IDC_BITMAPCHECK:
  1222. if(HIWORD(wParam) == BN_CLICKED)
  1223. {
  1224. fBrandBmps = (IsDlgButtonChecked(hDlg, IDC_BITMAPCHECK) == BST_CHECKED);
  1225. EnableDlgItem2(hDlg, IDC_BITMAP, fBrandBmps);
  1226. EnableDlgItem2(hDlg, IDC_BROWSEICON, fBrandBmps);
  1227. EnableDlgItem2(hDlg, IDC_LARGEBITMAP_TXT, fBrandBmps);
  1228. EnableDlgItem2(hDlg, IDC_BROWSEICON2, fBrandBmps);
  1229. EnableDlgItem2(hDlg, IDC_BITMAP2, fBrandBmps);
  1230. EnableDlgItem2(hDlg, IDC_SMALLBITMAP_TXT, fBrandBmps);
  1231. break;
  1232. }
  1233. return FALSE;
  1234. default:
  1235. return FALSE;
  1236. }
  1237. break;
  1238. case WM_NOTIFY:
  1239. switch (((NMHDR FAR *) lParam)->code)
  1240. {
  1241. case PSN_HELP:
  1242. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  1243. break;
  1244. case PSN_SETACTIVE:
  1245. SetBannerText(hDlg);
  1246. PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_NEXT | PSWIZB_BACK);
  1247. // load information from ins file
  1248. InitializeAnimBmps(hDlg, g_szCustIns);
  1249. InsGetString(IS_SMALLLOGO, TEXT("Path"),
  1250. szSmall, countof(szSmall), g_szCustIns);
  1251. InsGetString(IS_LARGELOGO, TEXT("Path"),
  1252. szBig, countof(szBig), g_szCustIns, NULL, &fBrandBmps);
  1253. SetDlgItemTextTriState(hDlg, IDC_BITMAP2, IDC_BITMAPCHECK, szSmall, fBrandBmps);
  1254. SetDlgItemTextTriState(hDlg, IDC_BITMAP, IDC_BITMAPCHECK, szBig, fBrandBmps);
  1255. EnableDlgItem2(hDlg, IDC_BROWSEICON, fBrandBmps);
  1256. EnableDlgItem2(hDlg, IDC_BROWSEICON2, fBrandBmps);
  1257. EnableDlgItem2(hDlg, IDC_LARGEBITMAP_TXT, fBrandBmps);
  1258. EnableDlgItem2(hDlg, IDC_SMALLBITMAP_TXT, fBrandBmps);
  1259. {
  1260. TCHAR szTmp[MAX_PATH];
  1261. if (ISNONNULL(szSmall))
  1262. {
  1263. PathCombine(szTmp, g_szTempSign, PathFindFileName(szSmall));
  1264. DeleteFile(szTmp);
  1265. }
  1266. if (ISNONNULL(szBig))
  1267. {
  1268. PathCombine(szTmp, g_szTempSign, PathFindFileName(szBig));
  1269. DeleteFile(szTmp);
  1270. }
  1271. }
  1272. CheckBatchAdvance(hDlg);
  1273. break;
  1274. case PSN_WIZNEXT:
  1275. case PSN_WIZBACK:
  1276. //from animbmp
  1277. g_cmCabMappings.GetFeatureDir(FEATURE_BRAND, szWorkDir);
  1278. GetDlgItemTextTriState(hDlg, IDE_SMALLANIMBITMAP, IDC_ANIMBITMAP, szSmallBmp,
  1279. countof(szSmallBmp));
  1280. fBrandAnim = GetDlgItemTextTriState(hDlg, IDE_BIGANIMBITMAP, IDC_ANIMBITMAP,
  1281. szLargeBmp, countof(szLargeBmp));
  1282. if ((fBrandAnim && !IsAnimBitmapFileValid(hDlg, IDE_BIGANIMBITMAP, szLargeBmp, NULL, IDS_TOOBIG38, IDS_TOOSMALL38, 38, 38)) ||
  1283. !CopyAnimBmp(hDlg, szLargeBmp, szWorkDir, IK_LARGEBITMAP, TEXT("Big_Path"), g_szCustIns))
  1284. {
  1285. SetFocus(GetDlgItem(hDlg, IDE_BIGANIMBITMAP));
  1286. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, -1);
  1287. break;
  1288. }
  1289. if ((fBrandAnim && !IsAnimBitmapFileValid(hDlg, IDE_SMALLANIMBITMAP, szSmallBmp, NULL, IDS_TOOBIG22, IDS_TOOSMALL22, 22, 22)) ||
  1290. !CopyAnimBmp(hDlg, szSmallBmp, szWorkDir, IK_SMALLBITMAP, TEXT("Small_Path"), g_szCustIns))
  1291. {
  1292. SetFocus(GetDlgItem(hDlg, IDE_SMALLANIMBITMAP));
  1293. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, -1);
  1294. break;
  1295. }
  1296. if ((fBrandAnim && ISNULL(szSmallBmp) && ISNONNULL(szLargeBmp)) || (fBrandAnim && ISNONNULL(szSmallBmp) && ISNULL(szLargeBmp)))
  1297. {
  1298. ErrorMessageBox(hDlg, IDS_BOTHBMP_ERROR);
  1299. if (ISNULL(szSmallBmp))
  1300. SetFocus(GetDlgItem(hDlg, IDE_SMALLANIMBITMAP));
  1301. else
  1302. SetFocus(GetDlgItem(hDlg, IDE_BIGANIMBITMAP));
  1303. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, -1);
  1304. break;
  1305. }
  1306. InsWriteBool(IS_ANIMATION, IK_DOANIMATION, fBrandAnim, g_szCustIns);
  1307. //custicon
  1308. fBrandBmps = (IsDlgButtonChecked(hDlg, IDC_BITMAPCHECK) == BST_CHECKED);
  1309. //----- Validate the bitmap -----
  1310. GetDlgItemText(hDlg, IDC_BITMAP2, szSmall, countof(szSmall));
  1311. if (fBrandBmps && !IsBitmapFileValid(hDlg, IDC_BITMAP2, szSmall, NULL, 22, 22, IDS_TOOBIG22, IDS_TOOSMALL22))
  1312. {
  1313. SetFocus(GetDlgItem(hDlg, IDC_BITMAP2));
  1314. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, -1);
  1315. break;
  1316. }
  1317. CopyLogoBmp(hDlg, szSmall, IS_SMALLLOGO, szWorkDir, g_szCustIns);
  1318. GetDlgItemText(hDlg, IDC_BITMAP, szBig, countof(szBig));
  1319. if (fBrandBmps && !IsBitmapFileValid(hDlg, IDC_BITMAP, szBig, NULL, 38, 38, IDS_TOOBIG38, IDS_TOOSMALL38))
  1320. {
  1321. SetFocus(GetDlgItem(hDlg, IDC_BITMAP));
  1322. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, -1);
  1323. break;
  1324. }
  1325. CopyLogoBmp(hDlg, szBig, IS_LARGELOGO, szWorkDir, g_szCustIns);
  1326. if ((fBrandBmps && ISNULL(szSmall) && ISNONNULL(szBig)) || (fBrandBmps && ISNONNULL(szSmall) && ISNULL(szBig)))
  1327. {
  1328. ErrorMessageBox(hDlg, IDS_BOTHBMP_ERROR);
  1329. if (ISNULL(szSmall))
  1330. SetFocus(GetDlgItem(hDlg, IDC_BITMAP2));
  1331. else
  1332. SetFocus(GetDlgItem(hDlg, IDC_BITMAP));
  1333. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, -1);
  1334. break;
  1335. }
  1336. g_iCurPage = PPAGE_CUSTICON;
  1337. EnablePages();
  1338. if (((NMHDR FAR *) lParam)->code == PSN_WIZNEXT)
  1339. PageNext(hDlg);
  1340. else
  1341. PagePrev(hDlg);
  1342. break;
  1343. case PSN_QUERYCANCEL:
  1344. QueryCancel(hDlg);
  1345. break;
  1346. default:
  1347. return FALSE;
  1348. }
  1349. break;
  1350. default:
  1351. return FALSE;
  1352. }
  1353. return TRUE;
  1354. }
  1355. INT_PTR CALLBACK Favorites(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
  1356. {
  1357. TCHAR szWorkDir[MAX_PATH],
  1358. szValue[16],
  1359. szUrl[INTERNET_MAX_URL_LENGTH];
  1360. HWND hTv = GetDlgItem(hDlg, IDC_TREE1);
  1361. LPCTSTR pszValue;
  1362. BOOL fQL,
  1363. fFavoritesOnTop, fFavoritesDelete, fIEAKFavoritesDelete;
  1364. DWORD dwFavoritesDeleteFlags;
  1365. switch(msg) {
  1366. case WM_INITDIALOG:
  1367. EnableDBCSChars(hDlg, IDC_TREE1);
  1368. MigrateFavorites(g_szCustIns);
  1369. #ifdef UNICODE
  1370. TreeView_SetUnicodeFormat(hTv, TRUE);
  1371. #else
  1372. TreeView_SetUnicodeFormat(hTv, FALSE);
  1373. #endif
  1374. g_hWizard = hDlg;
  1375. break;
  1376. case IDM_BATCHADVANCE:
  1377. DoBatchAdvance(hDlg);
  1378. break;
  1379. case WM_HELP:
  1380. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  1381. break;
  1382. case WM_COMMAND:
  1383. switch(HIWORD(wParam)) {
  1384. case BN_CLICKED:
  1385. switch(LOWORD(wParam)) {
  1386. case IDC_FAVONTOP:
  1387. if (BST_CHECKED == IsDlgButtonChecked(hDlg, IDC_FAVONTOP)) {
  1388. HTREEITEM hti;
  1389. TV_ITEM tvi;
  1390. EnableDlgItem(hDlg, IDC_FAVONTOP);
  1391. hti = TreeView_GetSelection(hTv);
  1392. if (hti != NULL) {
  1393. ZeroMemory(&tvi, sizeof(tvi));
  1394. tvi.mask = TVIF_STATE;
  1395. tvi.hItem = hti;
  1396. TreeView_GetItem(hTv, &tvi);
  1397. if (!HasFlag(tvi.state, TVIS_BOLD)) {
  1398. EnableDlgItem2(hDlg, IDC_FAVUP, (NULL != TreeView_GetPrevSibling(hTv, hti)));
  1399. EnableDlgItem2(hDlg, IDC_FAVDOWN, (NULL != TreeView_GetNextSibling(hTv, hti)));
  1400. }
  1401. }
  1402. }
  1403. else {
  1404. DisableDlgItem(hDlg, IDC_FAVUP);
  1405. DisableDlgItem(hDlg, IDC_FAVDOWN);
  1406. }
  1407. break;
  1408. case IDC_DELFAVORITES:
  1409. fFavoritesDelete = (IsDlgButtonChecked(hDlg, IDC_DELFAVORITES) == BST_CHECKED);
  1410. EnableDlgItem2(hDlg, IDC_DELIEAKFAVORITES, fFavoritesDelete);
  1411. break;
  1412. case IDC_FAVUP:
  1413. MoveUpFavorite(hTv, TreeView_GetSelection(hTv));
  1414. break;
  1415. case IDC_FAVDOWN:
  1416. MoveDownFavorite(hTv, TreeView_GetSelection(hTv));
  1417. break;
  1418. case IDC_ADDURL:
  1419. fQL = !IsFavoriteItem(hTv, TreeView_GetSelection(hTv));
  1420. if (GetFavoritesNumber(hTv, fQL) >= GetFavoritesMaxNumber(fQL)) {
  1421. UINT nID;
  1422. nID = (!fQL ? IDS_ERROR_MAXFAVS : IDS_ERROR_MAXQLS);
  1423. ErrorMessageBox(hDlg, nID);
  1424. break;
  1425. }
  1426. g_cmCabMappings.GetFeatureDir(FEATURE_FAVORITES, szWorkDir);
  1427. NewUrl(hTv, szWorkDir, g_dwPlatformId, g_fIntranet ? IEM_CORP : IEM_NEUTRAL);
  1428. break;
  1429. case IDC_ADDFOLDER:
  1430. ASSERT(IsFavoriteItem(hTv, TreeView_GetSelection(hTv)));
  1431. if (GetFavoritesNumber(hTv) >= GetFavoritesMaxNumber()) {
  1432. ErrorMessageBox(hDlg, IDS_ERROR_MAXFAVS);
  1433. break;
  1434. }
  1435. NewFolder(hTv);
  1436. break;
  1437. case IDC_MODIFY:
  1438. g_cmCabMappings.GetFeatureDir(FEATURE_FAVORITES, szWorkDir);
  1439. ModifyFavorite(hTv, TreeView_GetSelection(hTv), szWorkDir, g_szTempSign, g_dwPlatformId, g_fIntranet ? IEM_CORP : IEM_NEUTRAL);
  1440. break;
  1441. case IDC_REMOVE:
  1442. g_cmCabMappings.GetFeatureDir(FEATURE_FAVORITES, szWorkDir);
  1443. DeleteFavorite(hTv, TreeView_GetSelection(hTv), szWorkDir);
  1444. break;
  1445. case IDC_TESTFAVURL:
  1446. if (GetFavoriteUrl(hTv, TreeView_GetSelection(hTv), szUrl, countof(szUrl)))
  1447. TestURL(szUrl);
  1448. break;
  1449. case IDC_IMPORT: {
  1450. CNewCursor cursor(IDC_WAIT);
  1451. g_cmCabMappings.GetFeatureDir(FEATURE_FAVORITES, szWorkDir);
  1452. ImportFavoritesCmd(hTv, szWorkDir);
  1453. break;
  1454. }
  1455. }
  1456. }
  1457. break;
  1458. case WM_NOTIFY:
  1459. switch(((NMHDR FAR *)lParam)->code) {
  1460. case PSN_SETACTIVE:
  1461. SetBannerText(hDlg);
  1462. g_cmCabMappings.GetFeatureDir(FEATURE_FAVORITES, szWorkDir);
  1463. PathCreatePath(szWorkDir);
  1464. ASSERT(GetFavoritesNumber(hTv, FALSE) == 0 && GetFavoritesNumber(hTv, TRUE) == 0);
  1465. ImportFavorites (hTv, g_szDefInf, g_szCustIns, szWorkDir, g_szTempSign, !g_fIntranet);
  1466. ImportQuickLinks(hTv, g_szDefInf, g_szCustIns, szWorkDir, g_szTempSign, !g_fIntranet);
  1467. TreeView_SelectItem(hTv, TreeView_GetRoot(hTv));
  1468. fFavoritesOnTop = GetPrivateProfileInt(IS_BRANDING, IK_FAVORITES_ONTOP, (int)FALSE, g_szCustIns);
  1469. CheckDlgButton(hDlg, IDC_FAVONTOP, fFavoritesOnTop ? BST_CHECKED : BST_UNCHECKED);
  1470. //delete channels checkbox
  1471. if (g_fIntranet)
  1472. {
  1473. EnableDlgItem(hDlg, IDC_DELETECHANNELS);
  1474. ShowDlgItem (hDlg, IDC_DELETECHANNELS);
  1475. ReadBoolAndCheckButton(IS_DESKTOPOBJS, IK_DELETECHANNELS, FALSE, g_szCustIns, hDlg, IDC_DELETECHANNELS);
  1476. }
  1477. else
  1478. {
  1479. DisableDlgItem(hDlg, IDC_DELETECHANNELS);
  1480. HideDlgItem (hDlg, IDC_DELETECHANNELS);
  1481. }
  1482. if (!fFavoritesOnTop) {
  1483. DisableDlgItem(hDlg, IDC_FAVUP);
  1484. DisableDlgItem(hDlg, IDC_FAVDOWN);
  1485. }
  1486. if (g_fIntranet) {
  1487. ShowWindow(GetDlgItem(hDlg, IDC_DELFAVORITES), SW_SHOW);
  1488. ShowWindow(GetDlgItem(hDlg, IDC_DELIEAKFAVORITES), SW_SHOW);
  1489. dwFavoritesDeleteFlags = (DWORD) GetPrivateProfileInt(IS_BRANDING, IK_FAVORITES_DELETE, (int)FD_DEFAULT, g_szCustIns);
  1490. fFavoritesDelete = HasFlag(dwFavoritesDeleteFlags, ~FD_REMOVE_IEAK_CREATED);
  1491. CheckDlgButton(hDlg, IDC_DELFAVORITES, fFavoritesDelete ? BST_CHECKED : BST_UNCHECKED);
  1492. fIEAKFavoritesDelete = HasFlag(dwFavoritesDeleteFlags, FD_REMOVE_IEAK_CREATED);
  1493. CheckDlgButton(hDlg, IDC_DELIEAKFAVORITES, fIEAKFavoritesDelete ? BST_CHECKED : BST_UNCHECKED);
  1494. // only if delete Favorites is TRUE should the delete IEAK Favorites checkbox be enabled
  1495. EnableDlgItem2(hDlg, IDC_DELIEAKFAVORITES, fFavoritesDelete);
  1496. }
  1497. else {
  1498. ShowWindow(GetDlgItem(hDlg, IDC_DELFAVORITES), SW_HIDE);
  1499. ShowWindow(GetDlgItem(hDlg, IDC_DELIEAKFAVORITES), SW_HIDE);
  1500. }
  1501. CheckBatchAdvance(hDlg);
  1502. break;
  1503. case TVN_GETINFOTIP:
  1504. ASSERT(wParam == IDC_TREE1);
  1505. GetFavoritesInfoTip((LPNMTVGETINFOTIP)lParam);
  1506. break;
  1507. case NM_DBLCLK:
  1508. ASSERT(wParam == IDC_TREE1);
  1509. if (IsWindowEnabled(GetDlgItem(hDlg, IDC_MODIFY)))
  1510. SendMessage(hDlg, WM_COMMAND, MAKEWPARAM(IDC_MODIFY, BN_CLICKED), (LPARAM)GetDlgItem(hDlg, IDC_MODIFY));
  1511. break;
  1512. case TVN_KEYDOWN:
  1513. ASSERT(wParam == IDC_TREE1);
  1514. if (((LPNMTVKEYDOWN)lParam)->wVKey == VK_DELETE && IsWindowEnabled(GetDlgItem(hDlg, IDC_REMOVE)))
  1515. SendMessage(hDlg, WM_COMMAND, MAKEWPARAM(IDC_REMOVE, BN_CLICKED), (LPARAM)GetDlgItem(hDlg, IDC_REMOVE));
  1516. break;
  1517. case TVN_SELCHANGED:
  1518. ASSERT(wParam == IDC_TREE1);
  1519. ProcessFavSelChange(hDlg, hTv, (LPNMTREEVIEW)lParam);
  1520. break;
  1521. case PSN_WIZBACK:
  1522. case PSN_WIZNEXT:
  1523. fFavoritesOnTop = (IsDlgButtonChecked(hDlg, IDC_FAVONTOP) == BST_CHECKED);
  1524. dwFavoritesDeleteFlags = 0;
  1525. szValue[0] = TEXT('\0');
  1526. pszValue = NULL;
  1527. fFavoritesDelete = (IsDlgButtonChecked(hDlg, IDC_DELFAVORITES) == BST_CHECKED);
  1528. fIEAKFavoritesDelete = (IsDlgButtonChecked(hDlg, IDC_DELIEAKFAVORITES) == BST_CHECKED);
  1529. if (fFavoritesDelete) {
  1530. // NOTE. (andrewgu) flags explanation:
  1531. // 1. FD_FAVORITES means "empty favorites";
  1532. // 2. FD_CHANNELS means "don't delete channels folder";
  1533. // 3. FD_SOFTWAREUPDATES means "don't delete sofware updates folder";
  1534. // 4. FD_QUICKLINKS means "don't delete quick links folder";
  1535. // 5. FD_EMPTY_QUICKLINKS means "but make it empty";
  1536. // 6. FD_REMOVE_HIDDEN means "don't hesitate to party on HIDDEN folders and favorites";
  1537. // 7. FD_REMOVE_SYSTEM means "don't hesitate to party on SYSTEM folders and favorites";
  1538. dwFavoritesDeleteFlags |= FD_FAVORITES |
  1539. FD_CHANNELS | FD_SOFTWAREUPDATES | FD_QUICKLINKS | FD_EMPTY_QUICKLINKS |
  1540. FD_REMOVE_HIDDEN | FD_REMOVE_SYSTEM;
  1541. }
  1542. //delete channels
  1543. if (g_fIntranet)
  1544. CheckButtonAndWriteBool(hDlg, IDC_DELETECHANNELS, IS_DESKTOPOBJS, IK_DELETECHANNELS, g_szCustIns);
  1545. if (fIEAKFavoritesDelete)
  1546. // FD_REMOVE_IEAK_CREATED means "delete those items created by the IEAK";
  1547. dwFavoritesDeleteFlags |= FD_REMOVE_IEAK_CREATED;
  1548. if (dwFavoritesDeleteFlags) {
  1549. wnsprintf(szValue, countof(szValue), TEXT("0x%X"), dwFavoritesDeleteFlags);
  1550. pszValue = szValue;
  1551. }
  1552. WritePrivateProfileString(IS_BRANDING, IK_FAVORITES_DELETE, pszValue, g_szCustIns);
  1553. WritePrivateProfileString(IS_BRANDING, IK_FAVORITES_ONTOP, fFavoritesOnTop ? TEXT("1") : TEXT("0"), g_szCustIns);
  1554. g_cmCabMappings.GetFeatureDir(FEATURE_FAVORITES, szWorkDir);
  1555. ExportFavorites (hTv, g_szCustIns, szWorkDir, TRUE);
  1556. ExportQuickLinks(hTv, g_szCustIns, szWorkDir, TRUE);
  1557. if (!g_fBatch)
  1558. {
  1559. // (pritobla) if in batch mode, no need to export to the old IE4 format
  1560. // because there is no scenario that the ms install.ins will be installed
  1561. // without the IE6 branding dll.
  1562. MigrateToOldFavorites(g_szCustIns);
  1563. }
  1564. DeleteFavorite(hTv, TreeView_GetRoot(hTv), NULL);
  1565. DeleteFavorite(hTv, TreeView_GetRoot(hTv), NULL);
  1566. g_iCurPage = PPAGE_FAVORITES;
  1567. EnablePages();
  1568. if (((LPNMHDR)lParam)->code != PSN_WIZBACK)
  1569. PageNext(hDlg);
  1570. else
  1571. PagePrev(hDlg);
  1572. break;
  1573. case PSN_HELP:
  1574. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  1575. break;
  1576. case PSN_QUERYCANCEL:
  1577. if (QueryCancel(hDlg)) {
  1578. DeleteFavorite(hTv, TreeView_GetRoot(hTv), NULL);
  1579. DeleteFavorite(hTv, TreeView_GetRoot(hTv), NULL);
  1580. }
  1581. break;
  1582. default:
  1583. return FALSE;
  1584. }
  1585. break;
  1586. default:
  1587. return FALSE;
  1588. }
  1589. return TRUE;
  1590. }
  1591. //
  1592. // FUNCTION: Welcome(HWND, UINT, UINT, LONG)
  1593. //
  1594. // PURPOSE: Processes messages for welcome page
  1595. //
  1596. // MESSAGES:
  1597. //
  1598. // WM_INITDIALOG - intializes the page
  1599. // WM_NOTIFY - processes the notifications sent to the page
  1600. // WM_COMMAND - saves the id of the choice selected
  1601. //
  1602. INT_PTR CALLBACK Welcome(
  1603. HWND hDlg,
  1604. UINT message,
  1605. WPARAM,
  1606. LPARAM lParam)
  1607. {
  1608. static fInitWindowPos = FALSE;
  1609. switch (message)
  1610. {
  1611. case IDM_BATCHADVANCE:
  1612. DoBatchAdvance(hDlg);
  1613. break;
  1614. case WM_HELP:
  1615. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  1616. break;
  1617. case WM_INITDIALOG:
  1618. LoadString(g_rvInfo.hInst, IDS_TITLE, g_szTitle, countof(g_szTitle));
  1619. SetWindowText(g_hWndCent, g_szTitle);
  1620. g_hWizard = hDlg;
  1621. return(TRUE);
  1622. case WM_NOTIFY:
  1623. switch (((NMHDR FAR *) lParam)->code)
  1624. {
  1625. case PSN_HELP:
  1626. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  1627. break;
  1628. case PSN_SETACTIVE:
  1629. TCHAR szWizardVer[MAX_PATH];
  1630. TCHAR szType[MAX_PATH];
  1631. TCHAR szTemp1[MAX_PATH], szTemp2[MAX_PATH];
  1632. SetBannerText(hDlg);
  1633. LoadString(g_rvInfo.hInst,IDS_WIZARDTYPETEXT,szWizardVer,countof(szWizardVer));
  1634. switch (s_iType)
  1635. {
  1636. case BRANDED:
  1637. LoadString(g_rvInfo.hInst,IDS_ISPTYPE,szType,countof(szType));
  1638. break;
  1639. case REDIST:
  1640. LoadString(g_rvInfo.hInst,IDS_ICPTYPE,szType,countof(szType));
  1641. break;
  1642. case INTRANET:
  1643. default:
  1644. LoadString(g_rvInfo.hInst,IDS_CORPTYPE,szType,countof(szType));
  1645. break;
  1646. }
  1647. wnsprintf(szTemp1,countof(szTemp1),szWizardVer,szType);
  1648. wnsprintf(szTemp2,countof(szTemp2),s_szBannerText,szTemp1);
  1649. StrCpy(s_szBannerText,szTemp2);
  1650. ChangeBannerText(hDlg);
  1651. PropSheet_SetTitle(hDlg, 0, s_aSzTitle[g_iCurPage]);
  1652. if (g_fDone)
  1653. {
  1654. EndDialog(hDlg, 0);
  1655. return FALSE;
  1656. }
  1657. if(!fInitWindowPos)
  1658. {
  1659. PositionWindow(GetParent(hDlg));
  1660. ShowWindow(GetParent(hDlg), SW_SHOWNORMAL);
  1661. fInitWindowPos = TRUE;
  1662. }
  1663. PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_NEXT);
  1664. CheckBatchAdvance(hDlg);
  1665. break;
  1666. case PSN_WIZBACK:
  1667. case PSN_WIZNEXT:
  1668. EnablePages();
  1669. if (((NMHDR FAR *) lParam)->code == PSN_WIZNEXT) PageNext(hDlg);
  1670. else
  1671. {
  1672. PagePrev(hDlg);
  1673. }
  1674. break;
  1675. case PSN_QUERYCANCEL:
  1676. QueryCancel(hDlg);
  1677. break;
  1678. }
  1679. break;
  1680. default:
  1681. return FALSE;
  1682. }
  1683. return TRUE;
  1684. }
  1685. //
  1686. // FUNCTION: Stage(HWND, UINT, UINT, LONG)
  1687. //
  1688. // PURPOSE: Processes messages for welcome page
  1689. //
  1690. // MESSAGES:
  1691. //
  1692. // WM_INITDIALOG - intializes the page
  1693. // WM_NOTIFY - processes the notifications sent to the page
  1694. // WM_COMMAND - saves the id of the choice selected
  1695. //
  1696. INT_PTR CALLBACK Stage(
  1697. HWND hDlg,
  1698. UINT message,
  1699. WPARAM,
  1700. LPARAM lParam)
  1701. {
  1702. switch (message)
  1703. {
  1704. case IDM_BATCHADVANCE:
  1705. DoBatchAdvance(hDlg);
  1706. break;
  1707. case WM_HELP:
  1708. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  1709. break;
  1710. case WM_INITDIALOG:
  1711. return(FALSE);
  1712. case WM_NOTIFY:
  1713. switch (((NMHDR FAR *) lParam)->code)
  1714. {
  1715. case PSN_HELP:
  1716. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  1717. break;
  1718. case PSN_SETACTIVE:
  1719. SetBannerText(hDlg);
  1720. PropSheet_SetTitle(hDlg, 0, s_aSzTitle[g_iCurPage]);
  1721. PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_BACK | PSWIZB_NEXT);
  1722. CheckBatchAdvance(hDlg);
  1723. break;
  1724. case PSN_WIZBACK:
  1725. case PSN_WIZNEXT:
  1726. if (((NMHDR FAR *) lParam)->code == PSN_WIZNEXT)
  1727. PageNext(hDlg);
  1728. else
  1729. PagePrev(hDlg);
  1730. break;
  1731. case PSN_QUERYCANCEL:
  1732. QueryCancel(hDlg);
  1733. break;
  1734. }
  1735. break;
  1736. default:
  1737. return FALSE;
  1738. }
  1739. return TRUE;
  1740. }
  1741. static UINT_PTR s_idTim;
  1742. INT_PTR CALLBACK BrandTitle(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
  1743. {
  1744. TCHAR szTitle[MAX_PATH];
  1745. TCHAR szFullTitle[MAX_PATH];
  1746. TCHAR szTemp[MAX_PATH];
  1747. DWORD dwTitlePrefixLen;
  1748. BOOL fTitle;
  1749. switch (uMsg)
  1750. {
  1751. case WM_INITDIALOG:
  1752. EnableDBCSChars(hDlg, IDE_TITLE);
  1753. LoadString(g_rvInfo.hInst, IDS_TITLE_PREFIX, szTitle, countof(szTitle));
  1754. dwTitlePrefixLen = StrLen(szTitle);
  1755. // browser will only display 74 chars before cutting off title
  1756. Edit_LimitText(GetDlgItem(hDlg, IDE_TITLE), 74 - dwTitlePrefixLen);
  1757. break;
  1758. case WM_NOTIFY:
  1759. switch (((LPNMHDR) lParam)->code)
  1760. {
  1761. case PSN_SETACTIVE:
  1762. SetBannerText(hDlg);
  1763. // title
  1764. InsGetString(IS_BRANDING, TEXT("Window_Title_CN"), szTitle, countof(szTitle),
  1765. g_szCustIns, NULL, &fTitle);
  1766. if (!fTitle && *szTitle == '\0')
  1767. InsGetString(IS_BRANDING, TEXT("CompanyName"), szTitle, countof(szTitle), g_szCustIns);
  1768. SetDlgItemTextTriState(hDlg, IDE_TITLE, IDC_TITLE, szTitle, fTitle);
  1769. EnableDlgItem2(hDlg, IDC_TITLE_TXT, fTitle);
  1770. CheckBatchAdvance(hDlg);
  1771. break;
  1772. case PSN_WIZBACK:
  1773. case PSN_WIZNEXT:
  1774. // title
  1775. if (g_fBatch)
  1776. {
  1777. InsGetString(TEXT("BatchMode"), IK_WINDOWTITLE, szFullTitle, countof(szFullTitle), g_szCustIns);
  1778. InsWriteString(IS_BRANDING, IK_WINDOWTITLE, szFullTitle, g_szCustIns, TRUE, NULL, INSIO_TRISTATE);
  1779. InsGetString(TEXT("BatchMode"), TEXT("Window_Title_OE"), szFullTitle, countof(szFullTitle), g_szCustIns);
  1780. InsWriteString(IS_INTERNETMAIL, IK_WINDOWTITLE, szFullTitle, g_szCustIns, TRUE, NULL, INSIO_TRISTATE);
  1781. }
  1782. else
  1783. {
  1784. fTitle = GetDlgItemTextTriState(hDlg, IDE_TITLE, IDC_TITLE, szTitle, countof(szTitle));
  1785. InsWriteString(IS_BRANDING, TEXT("Window_Title_CN"), szTitle, g_szCustIns, fTitle, NULL, INSIO_SERVERONLY | INSIO_TRISTATE);
  1786. // browser title
  1787. *szFullTitle = TEXT('\0');
  1788. if (*szTitle)
  1789. {
  1790. *szTemp = TEXT('\0');
  1791. InsGetString(IS_STRINGS, TEXT("IE_TITLE"), szTemp, countof(szTemp), g_szDefInf);
  1792. if (*szTemp)
  1793. wnsprintf(szFullTitle, countof(szFullTitle), szTemp, szTitle);
  1794. }
  1795. InsWriteString(IS_BRANDING, IK_WINDOWTITLE, szFullTitle, g_szCustIns, fTitle, NULL, INSIO_TRISTATE);
  1796. // OE title
  1797. *szFullTitle = TEXT('\0');
  1798. if (*szTitle)
  1799. {
  1800. *szTemp = TEXT('\0');
  1801. InsGetString(IS_STRINGS, TEXT("OE_TITLE"), szTemp, countof(szTemp), g_szDefInf);
  1802. if (*szTemp)
  1803. wnsprintf(szFullTitle, countof(szFullTitle), szTemp, szTitle);
  1804. }
  1805. InsWriteString(IS_INTERNETMAIL, IK_WINDOWTITLE, szFullTitle, g_szCustIns, fTitle, NULL, INSIO_TRISTATE);
  1806. }
  1807. g_iCurPage = PPAGE_TITLE;
  1808. EnablePages();
  1809. (((LPNMHDR) lParam)->code == PSN_WIZNEXT) ? PageNext(hDlg) : PagePrev(hDlg);
  1810. break;
  1811. case PSN_HELP:
  1812. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  1813. break;
  1814. case PSN_QUERYCANCEL:
  1815. QueryCancel(hDlg);
  1816. break;
  1817. default:
  1818. return FALSE;
  1819. }
  1820. break;
  1821. case WM_COMMAND:
  1822. if (GET_WM_COMMAND_CMD(wParam, lParam) != BN_CLICKED)
  1823. return FALSE;
  1824. switch (GET_WM_COMMAND_ID(wParam, lParam))
  1825. {
  1826. case IDC_TITLE:
  1827. fTitle = (IsDlgButtonChecked(hDlg, IDC_TITLE) == BST_CHECKED);
  1828. EnableDlgItem2(hDlg, IDC_TITLE_TXT, fTitle);
  1829. EnableDlgItem2(hDlg, IDE_TITLE, fTitle);
  1830. break;
  1831. default:
  1832. return FALSE;
  1833. }
  1834. break;
  1835. case WM_HELP:
  1836. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  1837. break;
  1838. case IDM_BATCHADVANCE:
  1839. DoBatchAdvance(hDlg);
  1840. break;
  1841. default:
  1842. return FALSE;
  1843. }
  1844. return TRUE;
  1845. }
  1846. INT_PTR CALLBACK WelcomeMessageDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
  1847. {
  1848. TCHAR szInitHomePage[INTERNET_MAX_URL_LENGTH];
  1849. INT id;
  1850. switch (uMsg)
  1851. {
  1852. case WM_INITDIALOG:
  1853. EnableDBCSChars(hDlg, IDE_WELCOMEURL);
  1854. Edit_LimitText(GetDlgItem(hDlg, IDE_WELCOMEURL), countof(szInitHomePage) - 1);
  1855. break;
  1856. case WM_NOTIFY:
  1857. switch (((LPNMHDR) lParam)->code)
  1858. {
  1859. case PSN_SETACTIVE:
  1860. SetBannerText(hDlg);
  1861. g_fUseIEWelcomePage = !InsGetBool(IS_URL, IK_NO_WELCOME_URL, FALSE, g_szCustIns);
  1862. InsGetString(IS_URL, IK_FIRSTHOMEPAGE, szInitHomePage, countof(szInitHomePage), g_szCustIns);
  1863. if (g_fUseIEWelcomePage)
  1864. id = IDC_WELCOMEDEF;
  1865. else
  1866. id = (*szInitHomePage ? IDC_WELCOMECUST : IDC_WELCOMENO);
  1867. CheckRadioButton(hDlg, IDC_WELCOMEDEF, IDC_WELCOMECUST, id);
  1868. if (id == IDC_WELCOMECUST)
  1869. {
  1870. SetDlgItemText(hDlg, IDE_WELCOMEURL, szInitHomePage);
  1871. EnableDlgItem (hDlg, IDE_WELCOMEURL);
  1872. }
  1873. else
  1874. DisableDlgItem(hDlg, IDE_WELCOMEURL);
  1875. CheckBatchAdvance(hDlg);
  1876. break;
  1877. case PSN_WIZBACK:
  1878. case PSN_WIZNEXT:
  1879. // if custom home page radio button is checked, verify that a URL is specified
  1880. if (IsDlgButtonChecked(hDlg, IDC_WELCOMECUST) == BST_CHECKED)
  1881. if (!CheckField(hDlg, IDE_WELCOMEURL, FC_NONNULL | FC_URL))
  1882. {
  1883. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, -1);
  1884. return TRUE;
  1885. }
  1886. g_fUseIEWelcomePage = (IsDlgButtonChecked(hDlg, IDC_WELCOMEDEF) == BST_CHECKED);
  1887. InsWriteBool(IS_URL, IK_NO_WELCOME_URL, !g_fUseIEWelcomePage, g_szCustIns);
  1888. GetDlgItemText(hDlg, IDE_WELCOMEURL, szInitHomePage, countof(szInitHomePage));
  1889. InsWriteString(IS_URL, IK_FIRSTHOMEPAGE, szInitHomePage, g_szCustIns);
  1890. g_iCurPage = PPAGE_WELCOMEMSGS;
  1891. EnablePages();
  1892. (((NMHDR FAR *) lParam)->code == PSN_WIZNEXT) ? PageNext(hDlg) : PagePrev(hDlg);
  1893. break;
  1894. case PSN_HELP:
  1895. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  1896. break;
  1897. case PSN_QUERYCANCEL:
  1898. QueryCancel(hDlg);
  1899. break;
  1900. default:
  1901. return FALSE;
  1902. }
  1903. break;
  1904. case WM_COMMAND:
  1905. if (GET_WM_COMMAND_CMD(wParam, lParam) != BN_CLICKED)
  1906. return FALSE;
  1907. switch (GET_WM_COMMAND_ID(wParam, lParam))
  1908. {
  1909. case IDC_WELCOMENO:
  1910. case IDC_WELCOMEDEF:
  1911. SetDlgItemText(hDlg, IDE_WELCOMEURL, TEXT(""));
  1912. DisableDlgItem(hDlg, IDE_WELCOMEURL);
  1913. break;
  1914. case IDC_WELCOMECUST:
  1915. EnableDlgItem(hDlg, IDE_WELCOMEURL);
  1916. break;
  1917. }
  1918. break;
  1919. case WM_HELP:
  1920. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  1921. break;
  1922. case IDM_BATCHADVANCE:
  1923. DoBatchAdvance(hDlg);
  1924. break;
  1925. default:
  1926. return FALSE;
  1927. }
  1928. return TRUE;
  1929. }
  1930. void LoadInsFile(LPCTSTR pcszNewInsFile)
  1931. {
  1932. TCHAR szSrcPath[MAX_PATH];
  1933. TCHAR szDestDir[MAX_PATH];
  1934. TCHAR szPlatform[8];
  1935. TCHAR szFilePath[MAX_PATH];
  1936. TCHAR szData[8];
  1937. CopyFile(pcszNewInsFile, g_szCustIns, FALSE);
  1938. SetFileAttributes(g_szCustIns, FILE_ATTRIBUTE_NORMAL);
  1939. StrCpy(szSrcPath, pcszNewInsFile);
  1940. PathRemoveFileSpec(szSrcPath);
  1941. StrCpy(szDestDir, g_szCustIns);
  1942. PathRemoveFileSpec(szDestDir);
  1943. // make sure platform info is correct
  1944. wnsprintf(szPlatform, countof(szPlatform), TEXT("%lu"), g_dwPlatformId);
  1945. WritePrivateProfileString(BRANDING, TEXT("Platform"), szPlatform, g_szCustIns);
  1946. // the delete adms flag will be cleared out when we hit next on the adm page
  1947. WritePrivateProfileString(IS_BRANDING, TEXT("DeleteAdms"), TEXT("1"), g_szCustIns);
  1948. WritePrivateProfileString(IS_BRANDING, TEXT("ImportIns"), pcszNewInsFile, g_szCustIns);
  1949. // branding.cab file is cross platform
  1950. CopyFilesSrcToDest(szSrcPath, TEXT("BRANDING.CAB"), szDestDir);
  1951. PathCombine(szFilePath, szSrcPath, TEXT("iesetup.inf"));
  1952. // only copy over iesetup.inf if it's also a win32 inf
  1953. if (GetPrivateProfileString(OPTIONS, TEXT("CifName"), TEXT(""), szData, countof(szData), szFilePath))
  1954. CopyFilesSrcToDest(szSrcPath, TEXT("iesetup.inf"), szDestDir);
  1955. CopyFilesSrcToDest(szSrcPath, TEXT("iak.ini"), szDestDir);
  1956. CopyFilesSrcToDest(szSrcPath, TEXT("iesetup.cif"), szDestDir);
  1957. CopyFilesSrcToDest(szSrcPath, TEXT("custom.cif"), szDestDir);
  1958. CopyFilesSrcToDest(szSrcPath, TEXT("DESKTOP.CAB"), szDestDir);
  1959. CopyFilesSrcToDest(szSrcPath, TEXT("CHNLS.CAB"), szDestDir);
  1960. SetAttribAllEx(szDestDir, TEXT("*.*"), FILE_ATTRIBUTE_NORMAL, FALSE);
  1961. // clear out CMAK guid when importing so we'll generate a new one for this package
  1962. PathCombine(szFilePath, szDestDir, TEXT("custom.cif"));
  1963. WritePrivateProfileString( CUSTCMSECT, TEXT("GUID"), NULL, szFilePath );
  1964. WritePrivateProfileString( CUSTCMSECT, VERSION, NULL, szFilePath );
  1965. // copy singup files
  1966. // BUGBUG: pritobla- should implement a function in ieakutil to xcopy a folder (including its subdirs)
  1967. // to another location and use that function here.
  1968. PathAppend(szSrcPath, TEXT("signup"));
  1969. PathAppend(szDestDir, TEXT("signup"));
  1970. PathAppend(szSrcPath, TEXT("icw"));
  1971. PathAppend(szDestDir, TEXT("icw"));
  1972. CopyFilesSrcToDest(szSrcPath, TEXT("*.*"), szDestDir);
  1973. PathRemoveFileSpec(szSrcPath);
  1974. PathRemoveFileSpec(szDestDir);
  1975. PathAppend(szSrcPath, TEXT("kiosk"));
  1976. PathAppend(szDestDir, TEXT("kiosk"));
  1977. CopyFilesSrcToDest(szSrcPath, TEXT("*.*"), szDestDir);
  1978. PathRemoveFileSpec(szSrcPath);
  1979. PathRemoveFileSpec(szDestDir);
  1980. PathAppend(szSrcPath, TEXT("servless"));
  1981. PathAppend(szDestDir, TEXT("servless"));
  1982. CopyFilesSrcToDest(szSrcPath, TEXT("*.*"), szDestDir);
  1983. }
  1984. //
  1985. // FUNCTION: Language(HWND, UINT, UINT, LONG)
  1986. //
  1987. // PURPOSE: Processes messages for "Language" page
  1988. //
  1989. // MESSAGES:
  1990. //
  1991. // WM_INITDIALOG - intializes the page
  1992. // WM_NOTIFY - processes the notifications sent to the page
  1993. // WM_COMMAND - saves the id of the choice selected
  1994. //
  1995. INT_PTR CALLBACK Language(
  1996. HWND hDlg,
  1997. UINT message,
  1998. WPARAM,
  1999. LPARAM lParam)
  2000. {
  2001. TCHAR szBuf[1024];
  2002. int i;
  2003. static BOOL s_fNext = TRUE;
  2004. TCHAR szTemp[MAX_PATH];
  2005. DWORD dwSelLangId;
  2006. USES_CONVERSION;
  2007. switch (message)
  2008. {
  2009. case WM_INITDIALOG:
  2010. g_hWizard = hDlg;
  2011. InitSysFont( hDlg, IDC_LANGUAGE);
  2012. PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_BACK | PSWIZB_NEXT);
  2013. //from the download pg
  2014. if (!g_fUrlsInit && !g_fBatch && !g_fBatch2 && !g_hWait && g_hDownloadEvent && !g_fLocalMode)
  2015. {
  2016. g_hWizard = hDlg;
  2017. g_hWait = CreateDialog( g_rvInfo.hInst, MAKEINTRESOURCE(IDD_WAITSITES), hDlg,
  2018. DownloadStatusDlgProc );
  2019. ShowWindow( g_hWait, SW_SHOWNORMAL );
  2020. PropSheet_SetWizButtons(GetParent(hDlg), 0 );
  2021. g_iDownloadState = DOWN_STATE_ENUM_URL;
  2022. g_hDlg = hDlg;
  2023. SetEvent(g_hDownloadEvent);
  2024. }
  2025. break;
  2026. case IDM_BATCHADVANCE:
  2027. DoBatchAdvance(hDlg);
  2028. break;
  2029. case IDM_INITIALIZE:
  2030. if (g_hWait && g_fLangInit)
  2031. {
  2032. SendMessage(g_hWait, WM_CLOSE, 0, 0);
  2033. g_hWait = NULL;
  2034. }
  2035. break;
  2036. // this resets the focus away from cancel when we disable back/next
  2037. case IDM_SETDEFBUTTON:
  2038. SetFocus( GetDlgItem( GetParent(hDlg), IDC_STATIC ) );
  2039. SendMessage(GetParent(hDlg), DM_SETDEFID, (WPARAM)IDC_STATIC, (LPARAM)0);
  2040. break;
  2041. case WM_HELP:
  2042. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  2043. break;
  2044. case WM_COMMAND:
  2045. break;
  2046. case WM_NOTIFY:
  2047. switch (((NMHDR FAR *) lParam)->code)
  2048. {
  2049. case PSN_HELP:
  2050. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  2051. break;
  2052. case PSN_SETACTIVE:
  2053. SetBannerText(hDlg);
  2054. if (!g_fLangInit && !g_fBatch && !g_fBatch2)
  2055. {
  2056. DWORD dwTid;
  2057. g_iDownloadState = DOWN_STATE_ENUM_LANG;
  2058. g_hDlg = hDlg;
  2059. PropSheet_SetWizButtons(GetParent(hDlg), 0);
  2060. if (!g_fLocalMode)
  2061. {
  2062. g_hWait = CreateDialog(g_rvInfo.hInst, MAKEINTRESOURCE(IDD_WAITSITES), hDlg,
  2063. DownloadStatusDlgProc);
  2064. ShowWindow( g_hWait, SW_SHOWNORMAL );
  2065. }
  2066. g_hThread = CreateThread(NULL, 4096, DownloadSiteThreadProc, &g_hWizard, 0, &dwTid);
  2067. PostMessage(hDlg, IDM_SETDEFBUTTON, 0, 0);
  2068. break;
  2069. }
  2070. if (g_fOptCompInit)
  2071. DisableDlgItem(hDlg, IDC_LANGUAGE);
  2072. CheckBatchAdvance(hDlg);
  2073. break;
  2074. case PSN_WIZBACK:
  2075. case PSN_WIZNEXT:
  2076. if (!g_nLangs && !g_fBatch && !g_fBatch2)
  2077. {
  2078. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, -1);
  2079. g_fCancelled = FALSE;
  2080. return(TRUE);
  2081. }
  2082. //original processing
  2083. dwSelLangId = 1033;
  2084. if (!g_fBatch && !g_fBatch2)
  2085. {
  2086. i = (int) SendDlgItemMessage( hDlg, IDC_LANGUAGE, CB_GETCURSEL, 0, 0 );
  2087. StrCpy(g_szLanguage + 1, g_aszLang[i]);
  2088. *g_szLanguage = g_szLanguage[3] = TEXT('\\');
  2089. g_szLanguage[4] = TEXT('\0');
  2090. dwSelLangId = g_aLangId[i];
  2091. if (StrCmpI(g_szActLang, g_aszLang[i]) != 0)
  2092. {
  2093. s_fAppendLang = TRUE;
  2094. g_fSrcDirChanged = TRUE;
  2095. StrCpy(g_szActLang, g_aszLang[i]);
  2096. }
  2097. if (s_fAppendLang)
  2098. {
  2099. PathCombine(g_szIEAKProg, s_szSourceDir, &g_szLanguage[1]);
  2100. if (!PathFileExists(g_szIEAKProg))
  2101. PathCreatePath(g_szIEAKProg);
  2102. s_fAppendLang = FALSE;
  2103. }
  2104. }
  2105. CharUpper(g_szLanguage);
  2106. CharUpper(g_szActLang);
  2107. StrCpy(szBuf, g_szLanguage + 1);
  2108. szBuf[lstrlen(szBuf) - 1] = TEXT('\0');
  2109. GenerateCustomIns();
  2110. if (ISNONNULL(g_szLoadedIns) && s_fLoadIns)
  2111. {
  2112. TCHAR szLoadLang[8];
  2113. s_fLoadIns = FALSE;
  2114. if (GetPrivateProfileString(IS_BRANDING, LANG_LOCALE, TEXT(""),
  2115. szLoadLang, countof(szLoadLang), g_szLoadedIns) && (StrCmpI(szLoadLang, g_szActLang) != 0))
  2116. {
  2117. TCHAR szMsgParam[MAX_PATH];
  2118. TCHAR szMsg[MAX_PATH*2];
  2119. LoadString(g_rvInfo.hInst, IDS_LANGDIFFERS, szMsgParam, countof(szMsgParam));
  2120. wnsprintf(szMsg, countof(szMsg), szMsgParam, g_szLoadedIns);
  2121. if (MessageBox(hDlg, szMsg, g_szTitle, MB_YESNO) == IDNO)
  2122. {
  2123. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, -1);
  2124. return TRUE;
  2125. }
  2126. }
  2127. LoadInsFile(g_szLoadedIns);
  2128. }
  2129. wnsprintf(s_szType, countof(s_szType), TEXT("%i"), s_iType);
  2130. WritePrivateProfileString(BRANDING, TEXT("Type"), s_szType, g_szCustIns);
  2131. WritePrivateProfileString( BRANDING, IK_WIZVERSION, A2CT(VER_PRODUCTVERSION_STR), g_szCustIns );
  2132. //clear others so we know this is wizard
  2133. WritePrivateProfileString(BRANDING, PMVERKEY, NULL, g_szCustIns);
  2134. WritePrivateProfileString(BRANDING, GPVERKEY, NULL, g_szCustIns);
  2135. StrCpy(szTemp, g_szKey);
  2136. szTemp[7] = TEXT('\0');
  2137. WritePrivateProfileString( BRANDING, TEXT("Custom_Key"), szTemp, g_szCustIns );
  2138. if (*(g_rvInfo.pszName) == 0)
  2139. GetPrivateProfileString(BRANDING, TEXT("CompanyName"), TEXT(""), g_rvInfo.pszName, countof(g_rvInfo.pszName), g_szCustIns);
  2140. WritePrivateProfileString(BRANDING, TEXT("CompanyName"), g_rvInfo.pszName, g_szCustIns);
  2141. if (g_iKeyType < KEY_TYPE_ENHANCED)
  2142. {
  2143. WritePrivateProfileString( TEXT("Animation"), NULL, NULL, g_szCustIns );
  2144. WritePrivateProfileString( TEXT("Big_Logo"), NULL, NULL, g_szCustIns );
  2145. WritePrivateProfileString( TEXT("Small_Logo"), NULL, NULL, g_szCustIns );
  2146. }
  2147. if (!g_fBatch)
  2148. {
  2149. TCHAR szLngID[16];
  2150. wnsprintf(szLngID, countof(szLngID), TEXT("%lu"), dwSelLangId);
  2151. WritePrivateProfileString(BRANDING, LANG_LOCALE, g_szActLang, g_szCustIns);
  2152. WritePrivateProfileString(BRANDING, LANG_ID, szLngID, g_szCustIns);
  2153. }
  2154. g_iCurPage = PPAGE_LANGUAGE;
  2155. EnablePages();
  2156. if (((NMHDR FAR *) lParam)->code == PSN_WIZNEXT)
  2157. {
  2158. s_fNext = FALSE;
  2159. PageNext(hDlg);
  2160. }
  2161. else
  2162. {
  2163. s_fNext = TRUE;
  2164. PagePrev(hDlg);
  2165. }
  2166. break;
  2167. case PSN_QUERYCANCEL:
  2168. QueryCancel(hDlg);
  2169. break;
  2170. default:
  2171. return FALSE;
  2172. }
  2173. break;
  2174. default:
  2175. return FALSE;
  2176. }
  2177. return TRUE;
  2178. }
  2179. INT_PTR CALLBACK StartSearch(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
  2180. {
  2181. BOOL fStartPage, fSearchPage, fSupportPage;
  2182. switch (uMsg)
  2183. {
  2184. case WM_INITDIALOG:
  2185. EnableDBCSChars(hDlg, IDE_STARTPAGE);
  2186. EnableDBCSChars(hDlg, IDE_SEARCHPAGE);
  2187. EnableDBCSChars(hDlg, IDE_CUSTOMSUPPORT);
  2188. Edit_LimitText(GetDlgItem(hDlg, IDE_STARTPAGE), INTERNET_MAX_URL_LENGTH - 1);
  2189. Edit_LimitText(GetDlgItem(hDlg, IDE_SEARCHPAGE), INTERNET_MAX_URL_LENGTH - 1);
  2190. Edit_LimitText(GetDlgItem(hDlg, IDE_CUSTOMSUPPORT), INTERNET_MAX_URL_LENGTH - 1);
  2191. break;
  2192. case WM_NOTIFY:
  2193. switch (((LPNMHDR) lParam)->code)
  2194. {
  2195. case PSN_SETACTIVE:
  2196. SetBannerText(hDlg);
  2197. InitializeStartSearch(hDlg, g_szCustIns, NULL);
  2198. CheckBatchAdvance(hDlg);
  2199. break;
  2200. case PSN_WIZBACK:
  2201. case PSN_WIZNEXT:
  2202. fStartPage = (IsDlgButtonChecked(hDlg, IDC_STARTPAGE) == BST_CHECKED);
  2203. fSearchPage = (IsDlgButtonChecked(hDlg, IDC_SEARCHPAGE) == BST_CHECKED);
  2204. fSupportPage = (IsDlgButtonChecked(hDlg, IDC_CUSTOMSUPPORT) == BST_CHECKED);
  2205. if ((fStartPage && !CheckField(hDlg, IDE_STARTPAGE, FC_URL)) ||
  2206. (fSearchPage && !CheckField(hDlg, IDE_SEARCHPAGE, FC_URL)) ||
  2207. (fSupportPage && !CheckField(hDlg, IDE_CUSTOMSUPPORT, FC_URL)))
  2208. {
  2209. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, -1);
  2210. return TRUE;
  2211. }
  2212. SaveStartSearch(hDlg, g_szCustIns, NULL);
  2213. g_iCurPage = PPAGE_STARTSEARCH;
  2214. EnablePages();
  2215. (((LPNMHDR) lParam)->code == PSN_WIZNEXT) ? PageNext(hDlg) : PagePrev(hDlg);
  2216. break;
  2217. case PSN_HELP:
  2218. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  2219. break;
  2220. case PSN_QUERYCANCEL:
  2221. QueryCancel(hDlg);
  2222. break;
  2223. default:
  2224. return FALSE;
  2225. }
  2226. break;
  2227. case WM_COMMAND:
  2228. if (GET_WM_COMMAND_CMD(wParam, lParam) != BN_CLICKED)
  2229. return FALSE;
  2230. switch (GET_WM_COMMAND_ID(wParam, lParam))
  2231. {
  2232. case IDC_STARTPAGE:
  2233. fStartPage = (IsDlgButtonChecked(hDlg, IDC_STARTPAGE) == BST_CHECKED);
  2234. EnableDlgItem2(hDlg, IDE_STARTPAGE, fStartPage);
  2235. EnableDlgItem2(hDlg, IDC_STARTPAGE_TXT, fStartPage);
  2236. break;
  2237. case IDC_SEARCHPAGE:
  2238. fSearchPage = (IsDlgButtonChecked(hDlg, IDC_SEARCHPAGE) == BST_CHECKED);
  2239. EnableDlgItem2(hDlg, IDE_SEARCHPAGE, fSearchPage);
  2240. EnableDlgItem2(hDlg, IDC_SEARCHPAGE_TXT, fSearchPage);
  2241. break;
  2242. case IDC_CUSTOMSUPPORT:
  2243. fSupportPage = (IsDlgButtonChecked(hDlg, IDC_CUSTOMSUPPORT) == BST_CHECKED);
  2244. EnableDlgItem2(hDlg, IDE_CUSTOMSUPPORT, fSupportPage);
  2245. EnableDlgItem2(hDlg, IDC_CUSTOMSUPPORT_TXT, fSupportPage);
  2246. break;
  2247. default:
  2248. return FALSE;
  2249. }
  2250. break;
  2251. case WM_HELP:
  2252. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  2253. break;
  2254. case IDM_BATCHADVANCE:
  2255. DoBatchAdvance(hDlg);
  2256. break;
  2257. default:
  2258. return FALSE;
  2259. }
  2260. return TRUE;
  2261. }
  2262. INT_PTR CALLBACK Finish(HWND hDlg, UINT message, WPARAM, LPARAM lParam)
  2263. {
  2264. TCHAR szPlatform[8];
  2265. TCHAR szWinDir[MAX_PATH];
  2266. static s_fFinished = FALSE;
  2267. switch (message)
  2268. {
  2269. case WM_INITDIALOG:
  2270. g_hWizard = hDlg;
  2271. if (s_fFinished)
  2272. EnableDBCSChars(hDlg, IDC_FINISHTXT3);
  2273. break;
  2274. case IDM_BATCHADVANCE:
  2275. DoBatchAdvance(hDlg);
  2276. break;
  2277. case WM_HELP:
  2278. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  2279. break;
  2280. case WM_COMMAND:
  2281. break;
  2282. case WM_NOTIFY:
  2283. switch (((NMHDR FAR *) lParam)->code)
  2284. {
  2285. case PSN_HELP:
  2286. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  2287. break;
  2288. case PSN_SETACTIVE:
  2289. SetBannerText(hDlg);
  2290. if (!s_fFinished)
  2291. {
  2292. PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_BACK | PSWIZB_NEXT);
  2293. ShowWindow(GetDlgItem(hDlg, IDC_FINISHTXT1), SW_HIDE);
  2294. ShowWindow(GetDlgItem(hDlg, IDC_STEP1), SW_HIDE);
  2295. ShowWindow(GetDlgItem(hDlg, IDC_STEP3), SW_HIDE);
  2296. ShowWindow(GetDlgItem(hDlg, IDC_PROGRESS), SW_HIDE);
  2297. CheckBatchAdvance(hDlg);
  2298. }
  2299. else
  2300. {
  2301. SetWindowText(GetDlgItem(hDlg, IDC_FINISHTXT3), g_szBuildRoot);
  2302. PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_FINISH);
  2303. if (g_fBatch || g_fBatch2)
  2304. PostMessage(GetParent(hDlg), PSM_PRESSBUTTON, PSBTN_FINISH, 0);
  2305. }
  2306. break;
  2307. case PSN_WIZBACK:
  2308. PagePrev(hDlg);
  2309. break;
  2310. case PSN_WIZNEXT:
  2311. if (!g_fCancelled && !g_fDemo)
  2312. {
  2313. CNewCursor cur(IDC_WAIT);
  2314. HANDLE hThread;
  2315. DWORD dwTid;
  2316. wnsprintf(szPlatform, countof(szPlatform), TEXT("%lu"), g_dwPlatformId);
  2317. WritePrivateProfileString(BRANDING, TEXT("Platform"), szPlatform, g_szCustIns);
  2318. ShowWindow(GetDlgItem(hDlg, IDC_FINISHTXT1), SW_SHOW);
  2319. ShowWindow(GetDlgItem(hDlg, IDC_STEP1), SW_SHOW);
  2320. ShowWindow(GetDlgItem(hDlg, IDC_STEP3), SW_SHOW);
  2321. ShowWindow(GetDlgItem(hDlg, IDC_PROGRESS), SW_SHOW);
  2322. PropSheet_SetWizButtons(GetParent(hDlg), 0);
  2323. DisableDlgItem(GetParent(hDlg), IDHELP);
  2324. DisableDlgItem(GetParent(hDlg), IDCANCEL);
  2325. Animate_Open( GetDlgItem( hDlg, IDC_ANIM ), IDA_GEARS );
  2326. Animate_Play( GetDlgItem( hDlg, IDC_ANIM ), 0, -1, -1 );
  2327. SetAttribAllEx(g_szBuildRoot, TEXT("*.*"), FILE_ATTRIBUTE_NORMAL, TRUE);
  2328. g_fCancelled = TRUE;
  2329. GetWindowsDirectory(szWinDir, MAX_PATH);
  2330. memset(&g_shfStruc, 0, sizeof(g_shfStruc));
  2331. g_shfStruc.hwnd = hDlg;
  2332. g_shfStruc.wFunc = FO_COPY;
  2333. SetAttribAllEx(g_szBuildTemp, TEXT("*.*"), FILE_ATTRIBUTE_NORMAL, TRUE);
  2334. hThread = CreateThread(NULL, 4096, BuildIE4, hDlg, 0, &dwTid);
  2335. while (MsgWaitForMultipleObjects(1, &hThread, FALSE, INFINITE, QS_ALLINPUT) != WAIT_OBJECT_0)
  2336. {
  2337. MSG msg;
  2338. while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
  2339. {
  2340. TranslateMessage(&msg);
  2341. DispatchMessage(&msg);
  2342. }
  2343. }
  2344. CloseHandle(hThread);
  2345. // this sets the last 'platform/language' package built in this build directory.
  2346. // its used to get the settings used in the last .ins file.
  2347. {
  2348. TCHAR szPlatformLang[MAX_PATH];
  2349. TCHAR szRegKey[MAX_PATH];
  2350. wnsprintf(szRegKey, countof(szRegKey), TEXT("%s\\INS"), RK_IEAK_SERVER);
  2351. wnsprintf(szPlatformLang, countof(szPlatformLang), TEXT("%s%s"), GetOutputPlatformDir(), g_szActLang);
  2352. SHSetValue(HKEY_CURRENT_USER, szRegKey, g_szBuildRoot, REG_SZ, (LPBYTE)szPlatformLang,
  2353. (StrLen(szPlatformLang)+1)*sizeof(TCHAR));
  2354. }
  2355. }
  2356. if (g_fDemo)
  2357. {
  2358. TCHAR szMsg[MAX_PATH];
  2359. SetCurrentDirectory(g_szBuildRoot);
  2360. PathRemovePath(g_szBuildTemp);
  2361. LoadString( g_rvInfo.hInst, IDS_ENDEMO, szMsg, countof(szMsg) );
  2362. MessageBox(hDlg, szMsg, g_szTitle, MB_OK | MB_SETFOREGROUND);
  2363. g_fDone = TRUE;
  2364. SetEvent(g_hDownloadEvent);
  2365. }
  2366. PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_FINISH);
  2367. g_fCancelled = TRUE;
  2368. s_fFinished = TRUE;
  2369. break;
  2370. case PSN_WIZFINISH:
  2371. break;
  2372. case PSN_QUERYCANCEL:
  2373. if (IsWindowEnabled(GetDlgItem(GetParent(hDlg), IDCANCEL)))
  2374. QueryCancel(hDlg);
  2375. break;
  2376. default:
  2377. return FALSE;
  2378. }
  2379. break;
  2380. default:
  2381. return FALSE;
  2382. }
  2383. return TRUE;
  2384. }
  2385. #define OLDPRSHTSIZE 0x28
  2386. #define OLDPPAGESIZE 0x28
  2387. #define SSF_ALL SSF_SHOWALLOBJECTS | SSF_SHOWEXTENSIONS | SSF_SHOWCOMPCOLOR | SSF_SHOWSYSFILES | SSF_DESKTOPHTML | SSF_WIN95CLASSIC
  2388. void FillInPropertyPage(int iPsp, WORD idDlg, DLGPROC pfnDlgProc)
  2389. {
  2390. LPPROPSHEETPAGE pPsp;
  2391. TCHAR szPage[MAX_PATH];
  2392. LPDLGTEMPLATE pDlg;
  2393. if (iPsp < 0 || iPsp > NUM_PAGES)
  2394. return;
  2395. if (idDlg == 0)
  2396. return;
  2397. if (pfnDlgProc == NULL)
  2398. return;
  2399. pDlg = NULL;
  2400. LoadString(g_rvInfo.hInst, IDS_TITLE, szPage, countof(szPage));
  2401. if (iPsp != PPAGE_WELCOME && iPsp != PPAGE_OCWWELCOME && iPsp != PPAGE_FINISH)
  2402. {
  2403. TCHAR szStage[MAX_PATH];
  2404. if (iPsp < PPAGE_STAGE2)
  2405. LoadString(g_rvInfo.hInst, IDS_STAGE1, szStage, countof(szStage));
  2406. else
  2407. {
  2408. if (iPsp < PPAGE_STAGE3)
  2409. LoadString(g_rvInfo.hInst, IDS_STAGE2, szStage, countof(szStage));
  2410. else
  2411. {
  2412. if (iPsp < PPAGE_STAGE4)
  2413. LoadString(g_rvInfo.hInst, IDS_STAGE3, szStage, countof(szStage));
  2414. else
  2415. {
  2416. if (iPsp < PPAGE_STAGE5)
  2417. LoadString(g_rvInfo.hInst, IDS_STAGE4, szStage, countof(szStage));
  2418. else
  2419. LoadString(g_rvInfo.hInst, IDS_STAGE5, szStage, countof(szStage));
  2420. }
  2421. }
  2422. }
  2423. StrCpy(s_aSzTitle[iPsp], szStage);
  2424. }
  2425. else
  2426. StrCpy(s_aSzTitle[iPsp], szPage);
  2427. pPsp = &g_psp[iPsp];
  2428. ZeroMemory(pPsp, sizeof(PROPSHEETPAGE));
  2429. pPsp->dwSize = sizeof(PROPSHEETPAGE);
  2430. pPsp->dwFlags = PSP_USETITLE | PSP_HASHELP;
  2431. pPsp->hInstance = g_rvInfo.hInst;
  2432. pPsp->pfnDlgProc = pfnDlgProc;
  2433. pPsp->pszTitle = s_aSzTitle[iPsp];
  2434. pPsp->pszTemplate = MAKEINTRESOURCE(idDlg);
  2435. /* if (!IsTahomaFontExist(g_hWndCent))
  2436. {
  2437. pPsp->dwFlags |= PSP_DLGINDIRECT;
  2438. pPsp->pResource = pDlg;
  2439. }*/
  2440. s_ahPsp[iPsp] = CreatePropertySheetPage(pPsp);
  2441. }
  2442. int CreateWizard(HWND hwndOwner)
  2443. {
  2444. PROPSHEETHEADER psh;
  2445. LPTSTR pLastSlash;
  2446. GetModuleFileName(GetModuleHandle(NULL), g_szWizPath, MAX_PATH);
  2447. pLastSlash = StrRChr(g_szWizPath, NULL, TEXT('\\'));
  2448. if (pLastSlash)
  2449. {
  2450. pLastSlash[1] = TEXT('\0');
  2451. }
  2452. StrCpy(g_szWizRoot, g_szWizPath);
  2453. CharUpper(g_szWizRoot);
  2454. pLastSlash = StrStr(g_szWizRoot, TEXT("IEBIN"));
  2455. if (pLastSlash) *pLastSlash = TEXT('\0');
  2456. LoadString( g_rvInfo.hInst, IDS_TITLE, g_szTitle, countof(g_szTitle) );
  2457. ZeroMemory(&psh, sizeof(psh));
  2458. if(!g_fOCW)
  2459. FillInPropertyPage( PPAGE_WELCOME, IDD_WELCOME, Welcome);
  2460. else
  2461. FillInPropertyPage( PPAGE_OCWWELCOME, IDD_OCWWELCOME, Welcome);
  2462. FillInPropertyPage( PPAGE_STAGE1, IDD_STAGE1, Stage);
  2463. FillInPropertyPage( PPAGE_TARGET, IDD_TARGET, TargetProc);
  2464. FillInPropertyPage( PPAGE_LANGUAGE, IDD_LANGUAGE, Language);
  2465. FillInPropertyPage( PPAGE_MEDIA, IDD_MEDIA, MediaDlgProc);
  2466. FillInPropertyPage( PPAGE_IEAKLITE, IDD_IEAKLITE, IEAKLiteProc);
  2467. FillInPropertyPage( PPAGE_STAGE2, IDD_STAGE2, Stage);
  2468. FillInPropertyPage( PPAGE_OPTDOWNLOAD, IDD_OPTDOWNLOAD, OptionalDownload);
  2469. FillInPropertyPage( PPAGE_CUSTCOMP, IDD_CUSTCOMP4, CustomComponents);
  2470. FillInPropertyPage( PPAGE_STAGE3, IDD_STAGE3, Stage);
  2471. FillInPropertyPage( PPAGE_ISKBACK, IDD_ISKBACKBITMAP, ISKBackBitmap);
  2472. FillInPropertyPage( PPAGE_CDINFO, IDD_CD, CDInfoProc);
  2473. FillInPropertyPage( PPAGE_SETUPWIZARD, IDD_SETUPWIZARD, ActiveSetupDlgProc);
  2474. FillInPropertyPage( PPAGE_ICM, IDD_ICM, InternetConnMgr);
  2475. FillInPropertyPage( PPAGE_COMPSEL, IDD_COMPSEL4, ComponentSelect);
  2476. FillInPropertyPage( PPAGE_COMPURLS, IDD_COMPURLS, ComponentUrls);
  2477. FillInPropertyPage( PPAGE_ADDON, IDD_ADDON, AddOnDlgProc);
  2478. FillInPropertyPage( PPAGE_CORPCUSTOM, IDD_CORPCUSTOM, CorpCustomizeCustom);
  2479. FillInPropertyPage( PPAGE_CUSTOMCUSTOM, IDD_CUSTOMCUSTOM, CustomizeCustom);
  2480. FillInPropertyPage( PPAGE_COPYCOMP, IDD_COPYCOMP, CopyComp);
  2481. FillInPropertyPage( PPAGE_CABSIGN, IDD_CABSIGN, CabSignDlgProc);
  2482. FillInPropertyPage( PPAGE_STAGE4, IDD_STAGE4, Stage);
  2483. FillInPropertyPage( PPAGE_OCWSTAGE2, IDD_OCWSTAGE2, Stage);
  2484. FillInPropertyPage( PPAGE_INSTALLDIR, IDD_INSTALLDIR, InstallDirectory);
  2485. FillInPropertyPage( PPAGE_SILENTINSTALL, IDD_SILENTINSTALL, SilentInstall);
  2486. FillInPropertyPage( PPAGE_TITLE, IDD_BTITLE, BrandTitle);
  2487. FillInPropertyPage( PPAGE_BTOOLBARS, IDD_BTOOLBARS, BToolbarProc);
  2488. FillInPropertyPage( PPAGE_CUSTICON, IDD_CUSTICON, CustIcon);
  2489. FillInPropertyPage( PPAGE_STARTSEARCH, IDD_STARTSEARCH, StartSearch);
  2490. FillInPropertyPage( PPAGE_FAVORITES, IDD_FAVORITES, Favorites);
  2491. FillInPropertyPage( PPAGE_WELCOMEMSGS, IDD_WELCOMEMSGS, WelcomeMessageDlgProc);
  2492. FillInPropertyPage( PPAGE_UASTRDLG, IDD_UASTRDLG, UserAgentString);
  2493. FillInPropertyPage( PPAGE_QUERYAUTOCONFIG, IDD_QUERYAUTOCONFIG, QueryAutoConfigDlgProc);
  2494. FillInPropertyPage( PPAGE_PROXY, IDD_PROXY, ProxySettings);
  2495. FillInPropertyPage( PPAGE_CONNECTSET, IDD_CONNECTSET, ConnectSetDlgProc);
  2496. FillInPropertyPage( PPAGE_QUERYSIGNUP, IDD_QUERYSIGNUP, QuerySignupDlgProc);
  2497. FillInPropertyPage( PPAGE_SIGNUPFILES, IDD_SIGNUPFILES, SignupFilesDlgProc);
  2498. FillInPropertyPage( PPAGE_SERVERISPS, IDD_SERVERISPS, ServerIspsDlgProc);
  2499. FillInPropertyPage( PPAGE_ISPINS, IDD_SIGNUPINS, SignupInsDlgProc);
  2500. FillInPropertyPage( PPAGE_ICW, IDD_ICW, NewICWDlgProc);
  2501. FillInPropertyPage( PPAGE_ADDROOT, IDD_ADDROOT, ISPAddRootCertDlgProc);
  2502. FillInPropertyPage( PPAGE_SECURITYCERT, IDD_SECURITYCERT, SecurityCertsDlgProc);
  2503. FillInPropertyPage( PPAGE_SECURITY, IDD_SECURITY1, SecurityZonesDlgProc);
  2504. FillInPropertyPage( PPAGE_STAGE5, IDD_STAGE5, Stage);
  2505. FillInPropertyPage( PPAGE_PROGRAMS, IDD_PROGRAMS, ProgramsDlgProc);
  2506. FillInPropertyPage( PPAGE_MAIL, IDD_MAIL, MailServer);
  2507. FillInPropertyPage( PPAGE_IMAP, IDD_IMAP, IMAPSettings);
  2508. FillInPropertyPage( PPAGE_PRECONFIG,IDD_PRECONFIG,PreConfigSettings);
  2509. FillInPropertyPage( PPAGE_OEVIEW,IDD_OEVIEW,ViewSettings);
  2510. FillInPropertyPage( PPAGE_LDAP, IDD_LDAP, LDAPServer);
  2511. FillInPropertyPage( PPAGE_OE, IDD_OE, CustomizeOE);
  2512. FillInPropertyPage( PPAGE_SIG, IDD_SIG, Signature);
  2513. FillInPropertyPage( PPAGE_ADMDESC, IDD_ADMDESC, ADMDesc);
  2514. FillInPropertyPage( PPAGE_ADM, IDD_ADM, ADMParse);
  2515. FillInPropertyPage( PPAGE_STATUS, IDD_STATUS, Finish);
  2516. FillInPropertyPage( PPAGE_FINISH, IDD_FINISH, Finish);
  2517. psh.dwSize = sizeof(PROPSHEETHEADER);
  2518. psh.dwFlags = PSH_WIZARD | PSH_NOAPPLYNOW | PSH_USEPAGELANG | PSH_USECALLBACK;
  2519. psh.hInstance = g_rvInfo.hInst;
  2520. psh.hwndParent = hwndOwner;
  2521. psh.pszCaption = TEXT("Review Wizard");
  2522. psh.nPages = NUM_PAGES;
  2523. psh.nStartPage = 0;
  2524. psh.phpage = s_ahPsp;
  2525. psh.pfnCallback= &PropSheetProc;
  2526. INT_PTR iResult = PropertySheet(&psh);
  2527. /* if (!IsTahomaFontExist(g_hWndCent))
  2528. {
  2529. for (int i = 0; i < NUM_PAGES; i++) {
  2530. CoTaskMemFree((PVOID)g_psp[i].pResource);
  2531. g_psp[i].pResource = NULL;
  2532. }
  2533. }*/
  2534. return (iResult < 0) ? -1 : 1;
  2535. }
  2536. BOOL CheckAVS(LPCTSTR pcszDownloadDir)
  2537. {
  2538. TCHAR szDownloadDir[MAX_PATH];
  2539. TCHAR szCabFile[MAX_PATH];
  2540. HANDLE hFind = NULL;
  2541. WIN32_FIND_DATA fd;
  2542. static TCHAR s_szLocaleIni[MAX_PATH];
  2543. if (ISNULL(s_szLocaleIni))
  2544. PathCombine(s_szLocaleIni, g_szWizRoot, TEXT("locale.ini"));
  2545. PathCombine(szDownloadDir, pcszDownloadDir, TEXT("*.*"));
  2546. hFind = FindFirstFile(szDownloadDir, &fd);
  2547. if (hFind != INVALID_HANDLE_VALUE)
  2548. {
  2549. do
  2550. {
  2551. if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
  2552. || (StrCmp(fd.cFileName, TEXT(".")) == 0)
  2553. || (StrCmp(fd.cFileName, TEXT("..")) == 0))
  2554. continue;
  2555. if (!InsIsKeyEmpty(IS_STRINGS, fd.cFileName, s_szLocaleIni))
  2556. {
  2557. PathCombine(szCabFile, pcszDownloadDir, fd.cFileName);
  2558. PathAppend(szCabFile, TEXT("setupw95.cab"));
  2559. if (PathFileExists(szCabFile))
  2560. {
  2561. FindClose(hFind);
  2562. return TRUE;
  2563. }
  2564. }
  2565. }
  2566. while (FindNextFile(hFind, &fd));
  2567. FindClose(hFind);
  2568. }
  2569. return FALSE;
  2570. }
  2571. INT_PTR CALLBACK AdvancedDlgProc(
  2572. HWND hDlg,
  2573. UINT message,
  2574. WPARAM wParam,
  2575. LPARAM)
  2576. {
  2577. TCHAR szTemp[MAX_PATH];
  2578. TCHAR szTempFile[MAX_PATH];
  2579. DWORD dwVal;
  2580. BOOL fLocalMode = TRUE;
  2581. HANDLE hTemp;
  2582. DWORD dwFlags;
  2583. switch (message)
  2584. {
  2585. case WM_INITDIALOG:
  2586. EnableDBCSChars(hDlg, IDE_LOADINS);
  2587. EnableDBCSChars(hDlg, IDE_SOURCEDIR);
  2588. SetDlgItemText(hDlg, IDE_SOURCEDIR, g_szIEAKProg);
  2589. CheckDlgButton( hDlg, IDC_OFFLINE, g_fLocalMode ? BST_UNCHECKED : BST_CHECKED );
  2590. if (g_fLangInit)
  2591. DisableDlgItem(hDlg, IDC_OFFLINE);
  2592. SetDlgItemText(hDlg, IDE_LOADINS, g_szLoadedIns);
  2593. break;
  2594. case WM_COMMAND:
  2595. switch(HIWORD(wParam))
  2596. {
  2597. case BN_CLICKED:
  2598. switch (LOWORD(wParam))
  2599. {
  2600. case IDC_BROWSE:
  2601. {
  2602. TCHAR szInstructions[MAX_PATH];
  2603. LoadString(g_rvInfo.hInst,IDS_COMPDLDIR,szInstructions,countof(szInstructions));
  2604. if (BrowseForFolder(hDlg, szTemp, szInstructions))
  2605. SetDlgItemText(hDlg, IDE_SOURCEDIR, szTemp);
  2606. }
  2607. break;
  2608. case IDC_BROWSEINS:
  2609. GetDlgItemText( hDlg, IDE_LOADINS, szTemp, countof(szTemp));
  2610. if( BrowseForFile( hDlg, szTemp, countof(szTemp), GFN_INS ))
  2611. SetDlgItemText( hDlg, IDE_LOADINS, szTemp );
  2612. break;
  2613. case IDCANCEL:
  2614. EndDialog( hDlg, IDCANCEL );
  2615. break;
  2616. case IDOK:
  2617. dwFlags = FC_FILE | FC_EXISTS;
  2618. if (!CheckField(hDlg, IDE_LOADINS, dwFlags))
  2619. break;
  2620. GetDlgItemText(hDlg, IDE_SOURCEDIR, szTemp, countof(szTemp));
  2621. if (!CheckField(hDlg, IDE_SOURCEDIR, FC_PATH | FC_DIR))
  2622. {
  2623. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, -1);
  2624. break;
  2625. }
  2626. if (!PathIsUNC(szTemp))
  2627. {
  2628. if ((PathIsRoot(szTemp)) || (PathIsRelative(szTemp)))
  2629. {
  2630. ErrorMessageBox(hDlg, IDS_SRCNEEDPATH);
  2631. break;
  2632. }
  2633. }
  2634. if ((StrLen(szTemp) <= 3) || PathIsUNCServer(szTemp))
  2635. {
  2636. ErrorMessageBox(hDlg, IDS_SRCROOTILLEGAL);
  2637. break;;
  2638. }
  2639. fLocalMode = !IsDlgButtonChecked( hDlg, IDC_OFFLINE );
  2640. if (!g_fBatch && fLocalMode && !CheckAVS(szTemp))
  2641. {
  2642. ErrorMessageBox(hDlg, IDS_NEEDAVS);
  2643. break;
  2644. }
  2645. PathCombine(szTempFile, szTemp, TEXT("~~!!foo.txt"));
  2646. if (!PathCreatePath(szTemp) ||
  2647. ((hTemp = CreateFile(szTempFile, GENERIC_WRITE, 0, NULL,
  2648. CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE))
  2649. {
  2650. TCHAR szMsg[128];
  2651. TCHAR szMsgTemp[MAX_PATH+128];
  2652. LoadString(g_rvInfo.hInst, IDS_BADDIR, szMsg, countof(szMsg));
  2653. wnsprintf(szMsgTemp, countof(szMsgTemp), szMsg, szTemp);
  2654. MessageBox(hDlg, szMsgTemp, g_szTitle, MB_OK | MB_SETFOREGROUND);
  2655. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, -1);
  2656. break;
  2657. }
  2658. CloseHandle(hTemp);
  2659. DeleteFile(szTempFile);
  2660. PathAddBackslash(szTemp);
  2661. StrCpy(g_szIEAKProg, szTemp);
  2662. GetDlgItemText(hDlg, IDE_LOADINS, g_szLoadedIns, countof(g_szLoadedIns));
  2663. if (ISNONNULL(g_szLoadedIns))
  2664. {
  2665. int nPlatformId = 0;
  2666. InsGetString(IS_BRANDING, TEXT("Platform"), szTemp, countof(szTemp), g_szLoadedIns);
  2667. nPlatformId = StrToInt(szTemp);
  2668. if (nPlatformId != 0 && nPlatformId != PLATFORM_WIN32 && nPlatformId != PLATFORM_W2K)
  2669. {
  2670. TCHAR szMsgParam[128];
  2671. TCHAR szMsg[MAX_PATH+128];
  2672. LoadString(g_rvInfo.hInst, IDS_UNSUPPORTED_PLATFORM, szMsgParam, countof(szMsgParam));
  2673. wnsprintf(szMsg, countof(szMsg), szMsgParam, g_szLoadedIns);
  2674. MessageBox(hDlg, szMsg, g_szTitle, MB_ICONINFORMATION | MB_OK);
  2675. *g_szLoadedIns = TEXT('\0');
  2676. SetFocus(GetDlgItem(hDlg, IDE_LOADINS));
  2677. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, -1);
  2678. break;
  2679. }
  2680. else if (nPlatformId == 0)
  2681. nPlatformId = PLATFORM_WIN32;
  2682. }
  2683. s_fLoadIns = TRUE;
  2684. g_fLocalMode = fLocalMode;
  2685. dwVal = g_fLocalMode ? 0 : 1;
  2686. switch (g_dwPlatformId)
  2687. {
  2688. case PLATFORM_WIN32:
  2689. default:
  2690. SHSetValue(HKEY_CURRENT_USER, RK_IEAK_SERVER, TEXT("WIN32_AVS"), REG_DWORD, (LPBYTE)&dwVal, sizeof(dwVal));
  2691. break;
  2692. }
  2693. EndDialog( hDlg, IDOK );
  2694. break;
  2695. }
  2696. break;
  2697. }
  2698. break;
  2699. default:
  2700. return FALSE;
  2701. }
  2702. return TRUE;
  2703. }
  2704. //
  2705. // FUNCTION: TargetProc(HWND, UINT, UINT, LONG)
  2706. //
  2707. // PURPOSE: Processes messages for "OCW Source Target" page
  2708. //
  2709. // MESSAGES:
  2710. //
  2711. // WM_INITDIALOG - intializes the page
  2712. // WM_NOTIFY - processes the notifications sent to the page
  2713. //
  2714. INT_PTR CALLBACK TargetProc(
  2715. HWND hDlg,
  2716. UINT message,
  2717. WPARAM wParam,
  2718. LPARAM lParam)
  2719. {
  2720. TCHAR szMsg[MAX_PATH];
  2721. TCHAR szTemp[MAX_PATH+128];
  2722. TCHAR szTempFile[MAX_PATH];
  2723. TCHAR szDeskDir[MAX_PATH];
  2724. TCHAR szRealRoot[MAX_PATH];
  2725. TCHAR szDestRoot[MAX_PATH];
  2726. TCHAR szTempRoot[MAX_PATH];
  2727. DWORD dwDestFree, dwDestNeed;
  2728. DWORD dwSRet, dwAttrib = 0xFFFFFFFF;
  2729. BOOL fNext = FALSE;
  2730. HANDLE hTemp;
  2731. static BOOL s_fFirst = TRUE;
  2732. switch (message)
  2733. {
  2734. case WM_INITDIALOG:
  2735. g_hWizard = hDlg;
  2736. EnableDBCSChars(hDlg, IDE_TARGETDIR);
  2737. break;
  2738. case WM_HELP:
  2739. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  2740. break;
  2741. case IDM_BATCHADVANCE:
  2742. DoBatchAdvance(hDlg);
  2743. break;
  2744. case WM_COMMAND:
  2745. if( HIWORD(wParam) == BN_CLICKED )
  2746. {
  2747. switch (LOWORD(wParam))
  2748. {
  2749. case IDC_BROWSE2:
  2750. {
  2751. TCHAR szInstructions[MAX_PATH];
  2752. LoadString(g_rvInfo.hInst,IDS_TARGETDIR,szInstructions,countof(szInstructions));
  2753. if (BrowseForFolder(hDlg, szTemp,szInstructions))
  2754. SetDlgItemText(hDlg, IDE_TARGETDIR, szTemp);
  2755. }
  2756. break;
  2757. case IDC_ADVANCED:
  2758. DialogBox( g_rvInfo.hInst, (LPTSTR) IDD_ADVANCEDPOPUP, hDlg, AdvancedDlgProc);
  2759. break;
  2760. }
  2761. }
  2762. break;
  2763. case WM_NOTIFY:
  2764. switch (((NMHDR FAR *) lParam)->code)
  2765. {
  2766. case PSN_HELP:
  2767. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  2768. break;
  2769. case PSN_SETACTIVE:
  2770. SetBannerText(hDlg);
  2771. //file locs
  2772. dwSRet = countof(g_szBuildRoot);
  2773. if(!g_fBatch && !g_fBatch2)
  2774. {
  2775. if (ISNULL(s_szSourceDir))
  2776. {
  2777. DWORD dwSize = sizeof(g_szIEAKProg);
  2778. SHGetValue(HKEY_CURRENT_USER, RK_IEAK_SERVER, TEXT("SourceDir"), NULL, (LPBYTE)s_szSourceDir, &dwSize);
  2779. if (ISNULL(s_szSourceDir))
  2780. {
  2781. GetIEAKDir(s_szSourceDir);
  2782. PathAppend(s_szSourceDir, TEXT("Download"));
  2783. }
  2784. }
  2785. StrCpy(g_szIEAKProg, s_szSourceDir);
  2786. PathAddBackslash(s_szSourceDir);
  2787. s_fAppendLang = TRUE;
  2788. }
  2789. if (s_fFirst)
  2790. {
  2791. DWORD dwSize, dwVal;
  2792. s_fFirst = FALSE;
  2793. dwSize = sizeof(dwVal);
  2794. switch (g_dwPlatformId)
  2795. {
  2796. case PLATFORM_WIN32:
  2797. default:
  2798. if ((SHGetValue(HKEY_CURRENT_USER, RK_IEAK_SERVER, TEXT("WIN32_AVS"), NULL, (LPBYTE)&dwVal, &dwSize) == ERROR_SUCCESS)
  2799. && !dwVal)
  2800. g_fLocalMode = TRUE;
  2801. break;
  2802. }
  2803. }
  2804. if (ISNONNULL(g_szIEAKProg))
  2805. PathRemoveBackslash(g_szIEAKProg);
  2806. if (!g_fOCW)
  2807. {
  2808. if (!g_fBatch && !g_fBatch2)
  2809. {
  2810. DWORD dwSize = sizeof(g_szBuildRoot);
  2811. SHGetValue(HKEY_CURRENT_USER, RK_IEAK_SERVER, TEXT("DestPath"), NULL, (LPVOID)g_szBuildRoot, &dwSize);
  2812. }
  2813. }
  2814. if (ISNONNULL(g_szBuildRoot))
  2815. PathRemoveBackslash(g_szBuildRoot);
  2816. else
  2817. {
  2818. SYSTEMTIME SystemTime;
  2819. TCHAR szDate[MAX_PATH];
  2820. TCHAR szDefaultTarget[MAX_PATH];
  2821. GetLocalTime(&SystemTime);
  2822. wnsprintf(szDate, countof(szDate), TEXT("%02d%02d%d"), SystemTime.wMonth, SystemTime.wDay, SystemTime.wYear);
  2823. LoadString(g_rvInfo.hInst, IDS_DEFAULT_TARGETDIR, szDefaultTarget, countof(szDefaultTarget));
  2824. wnsprintf(g_szBuildRoot, countof(g_szBuildRoot), szDefaultTarget, szDate);
  2825. }
  2826. SetDlgItemText(hDlg, IDE_TARGETDIR, g_szBuildRoot);
  2827. CheckBatchAdvance(hDlg);
  2828. break;
  2829. case PSN_WIZNEXT:
  2830. fNext = TRUE;
  2831. case PSN_WIZBACK:
  2832. //file locs
  2833. if (!g_fBatch && g_fLocalMode && !CheckAVS(g_szIEAKProg))
  2834. {
  2835. ErrorMessageBox(hDlg, IDS_NEEDAVS2);
  2836. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, -1);
  2837. break;
  2838. }
  2839. StrCpy(szTemp, g_szBuildRoot);
  2840. GetDlgItemText(hDlg, IDE_TARGETDIR, g_szBuildRoot, countof(g_szBuildRoot));
  2841. StrTrim(g_szBuildRoot, TEXT(" \t"));
  2842. if (!PathIsUNC(g_szBuildRoot))
  2843. {
  2844. if ((PathIsRoot(g_szBuildRoot)) || (PathIsRelative(g_szBuildRoot)))
  2845. {
  2846. ErrorMessageBox(hDlg, IDS_NEEDPATH);
  2847. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, -1);
  2848. break;
  2849. }
  2850. }
  2851. if ((StrLen(g_szBuildRoot) <= 3) || PathIsUNCServer(g_szBuildRoot))
  2852. {
  2853. ErrorMessageBox(hDlg, IDS_ROOTILLEGAL);
  2854. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, -1);
  2855. break;
  2856. }
  2857. if (!CheckField(hDlg, IDE_TARGETDIR, FC_PATH | FC_DIR))
  2858. {
  2859. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, -1);
  2860. break;
  2861. }
  2862. if (ISNONNULL(g_szBuildRoot))
  2863. PathRemoveBackslash(g_szBuildRoot);
  2864. PathRemoveBackslash(g_szIEAKProg);
  2865. if (StrCmpI(g_szBuildRoot, g_szIEAKProg) == 0)
  2866. {
  2867. LoadString(g_rvInfo.hInst, IDS_SAMEDIR, szMsg, countof(szMsg));
  2868. MessageBox(hDlg, szMsg, g_szTitle, MB_OK | MB_SETFOREGROUND);
  2869. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, -1);
  2870. break;
  2871. }
  2872. StrCpy(szRealRoot, g_szBuildRoot);
  2873. hTemp = NULL;
  2874. PathCombine(szTempFile, g_szIEAKProg, TEXT("~~!!foo.txt"));
  2875. if (!PathCreatePath(g_szIEAKProg) ||
  2876. ((hTemp = CreateFile(szTempFile, GENERIC_WRITE, 0, NULL,
  2877. CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE))
  2878. {
  2879. LoadString(g_rvInfo.hInst, IDS_BADDIR2, szMsg, countof(szMsg));
  2880. wnsprintf(szTemp, countof(szTemp), szMsg, g_szIEAKProg);
  2881. MessageBox(hDlg, szTemp, g_szTitle, MB_OK | MB_SETFOREGROUND);
  2882. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, -1);
  2883. break;
  2884. }
  2885. if (hTemp != INVALID_HANDLE_VALUE)
  2886. CloseHandle(hTemp);
  2887. DeleteFile(szTempFile);
  2888. PathAddBackslash(g_szIEAKProg);
  2889. hTemp = NULL;
  2890. PathCombine(szTempFile, g_szBuildRoot, TEXT("~~!!foo.txt"));
  2891. if (!PathCreatePath(g_szBuildRoot) || (hTemp = CreateFile(szTempFile, GENERIC_WRITE, 0, NULL,
  2892. CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE)
  2893. {
  2894. LoadString(g_rvInfo.hInst, IDS_BADDIR, szMsg, countof(szMsg));
  2895. wnsprintf(szTemp, countof(szTemp), szMsg, g_szBuildRoot);
  2896. MessageBox(hDlg, szTemp, g_szTitle, MB_OK | MB_SETFOREGROUND);
  2897. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, -1);
  2898. break;
  2899. }
  2900. if (hTemp != INVALID_HANDLE_VALUE)
  2901. CloseHandle(hTemp);
  2902. DeleteFile(szTempFile);
  2903. PathCombine(szDeskDir, g_szBuildRoot, TEXT("Desktop"));
  2904. if ((dwAttrib = GetFileAttributes(szDeskDir)) != 0xFFFFFFFF)
  2905. SetFileAttributes(szDeskDir, dwAttrib & ~FILE_ATTRIBUTE_HIDDEN);
  2906. if (!g_fBatch)
  2907. SHSetValue(HKEY_CURRENT_USER, RK_IEAK_SERVER, TEXT("DestPath"), REG_SZ, (LPBYTE)szRealRoot,
  2908. (StrLen(szRealRoot)+1)*sizeof(TCHAR));
  2909. GetTempPath(MAX_PATH, g_szBuildTemp);
  2910. PathAppend(g_szBuildTemp, TEXT("IEDKTEMP"));
  2911. PathRemovePath(g_szBuildTemp);
  2912. PathCreatePath(g_szBuildTemp);
  2913. PathCombine(g_szTempSign, g_szBuildTemp, TEXT("CUSTSIGN"));
  2914. PathCreatePath(g_szTempSign);
  2915. // BUGBUG: (andrewgu) no man's land starts...
  2916. StrCpy(szDestRoot, g_szBuildRoot);
  2917. StrCpy(szTempRoot, g_szBuildTemp);
  2918. CharUpper(szDestRoot);
  2919. CharUpper(szTempRoot);
  2920. dwDestFree = GetRootFree(szDestRoot);
  2921. dwDestNeed = MIN_PACKAGE_SIZE;
  2922. if (fNext)
  2923. {
  2924. if (dwDestFree < dwDestNeed)
  2925. {
  2926. TCHAR szTitle[MAX_PATH];
  2927. TCHAR szTemplate[MAX_PATH];
  2928. TCHAR szMsg[MAX_PATH];
  2929. LoadString( g_rvInfo.hInst, IDS_DISKERROR, szTitle, MAX_PATH );
  2930. LoadString( g_rvInfo.hInst, IDS_DESTDISKMSG, szTemplate, MAX_PATH );
  2931. wnsprintf(szMsg, countof(szMsg), szTemplate, dwDestFree, dwDestNeed);
  2932. if (MessageBox(hDlg, szMsg, szTitle, MB_OKCANCEL | MB_SETFOREGROUND) == IDCANCEL)
  2933. {
  2934. LoadString( g_rvInfo.hInst, IDS_ERROREXIT, szMsg, countof(szMsg) );
  2935. MessageBox(hDlg, szMsg, szTitle, MB_OK | MB_SETFOREGROUND);
  2936. DoCancel();
  2937. }
  2938. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, -1);
  2939. return TRUE;
  2940. }
  2941. }
  2942. if(!g_fBatch && !g_fBatch2)
  2943. {
  2944. if (StrCmpI(s_szSourceDir, g_szIEAKProg) != 0)
  2945. {
  2946. SHSetValue(HKEY_CURRENT_USER, RK_IEAK_SERVER, TEXT("SourceDir"), REG_SZ,
  2947. (LPBYTE)g_szIEAKProg, (lstrlen(g_szIEAKProg)+1)*sizeof(TCHAR));
  2948. g_fSrcDirChanged = TRUE;
  2949. s_fAppendLang = TRUE;
  2950. StrCpy(s_szSourceDir, g_szIEAKProg);
  2951. }
  2952. if (StrCmpI(szTemp, g_szBuildRoot))
  2953. s_fDestDirChanged = TRUE;
  2954. }
  2955. g_iCurPage = PPAGE_TARGET;
  2956. EnablePages();
  2957. if (fNext)
  2958. PageNext(hDlg);
  2959. else
  2960. PagePrev(hDlg);
  2961. break;
  2962. case PSN_QUERYCANCEL:
  2963. QueryCancel(hDlg);
  2964. break;
  2965. default:
  2966. return FALSE;
  2967. }
  2968. break;
  2969. default:
  2970. return FALSE;
  2971. }
  2972. return TRUE;
  2973. }
  2974. void InitIEAKLite(HWND hwndList)
  2975. {
  2976. ListView_DeleteAllItems(hwndList);
  2977. for (int i = 0, iItem = 0; i < IL_END; i++)
  2978. {
  2979. TCHAR szGroupName[MAX_PATH];
  2980. LVITEM lvItem;
  2981. // do not show groups that are not relevant for the current role (ICP, ISP, or Corp)
  2982. // recap:
  2983. // ICP is (!g_fBranded)
  2984. // ISP is (g_fBranded && !g_fIntranet)
  2985. // CORP is (g_fIntranet)
  2986. if ((!g_fBranded && g_IEAKLiteArray[i].fICP == FALSE) ||
  2987. ( g_fBranded && !g_fIntranet && g_IEAKLiteArray[i].fISP == FALSE) ||
  2988. ( g_fIntranet && g_IEAKLiteArray[i].fCorp == FALSE))
  2989. {
  2990. g_IEAKLiteArray[i].iListBox = -2;
  2991. g_IEAKLiteArray[i].fEnabled = TRUE;
  2992. continue;
  2993. }
  2994. // do not show ICM group in IEAKLite if only doing single disk branding since it's
  2995. // not available anyway
  2996. if (i == IL_ICM)
  2997. {
  2998. if (g_fBrandingOnly && !g_fDownload && !g_fCD && !g_fLAN)
  2999. {
  3000. g_IEAKLiteArray[i].iListBox = -2;
  3001. g_IEAKLiteArray[i].fEnabled = TRUE;
  3002. continue;
  3003. }
  3004. }
  3005. // if adms haven't been deleted yet, show adm page
  3006. // by not creating an entry in the IEAKLite box
  3007. if (i == IL_ADM)
  3008. {
  3009. if (InsGetBool(IS_BRANDING, TEXT("DeleteAdms"), FALSE, g_szCustIns))
  3010. {
  3011. g_IEAKLiteArray[i].iListBox = -2;
  3012. g_IEAKLiteArray[i].fEnabled = TRUE;
  3013. continue;
  3014. }
  3015. }
  3016. // BUGBUG: pritobla: should have separate flags similar to DeleteAdms for activesetup
  3017. // and icm so that even if the user cancels out of wizard before reaching these
  3018. // pages, we can force them again.
  3019. // Should consider this while reworking ieaklite.
  3020. // force active setup, CMAK and adms to show up if imported an ins
  3021. // by not creating an entry in the IEAKLite box
  3022. if (*g_szLoadedIns)
  3023. {
  3024. if (i == IL_ACTIVESETUP || i == IL_ICM || i == IL_ADM)
  3025. {
  3026. g_IEAKLiteArray[i].iListBox = -2;
  3027. g_IEAKLiteArray[i].fEnabled = TRUE;
  3028. continue;
  3029. }
  3030. }
  3031. LoadString(g_rvInfo.hInst, g_IEAKLiteArray[i].idGroupName, szGroupName, countof(szGroupName));
  3032. g_IEAKLiteArray[i].fEnabled = !InsGetBool(IS_IEAKLITE, szGroupName, FALSE, g_szCustIns);
  3033. ZeroMemory(&lvItem, sizeof(lvItem));
  3034. lvItem.mask = LVIF_TEXT | LVIF_IMAGE;
  3035. lvItem.iItem = iItem++;
  3036. lvItem.pszText = szGroupName;
  3037. lvItem.iImage = g_IEAKLiteArray[i].fEnabled ? 1 : 0;
  3038. #ifdef _DEBUG
  3039. {
  3040. LVFINDINFO lvFind;
  3041. ZeroMemory(&lvFind, sizeof(lvFind));
  3042. lvFind.flags = LVFI_STRING;
  3043. lvFind.psz = szGroupName;
  3044. ASSERT(ListView_FindItem(hwndList, -1, &lvFind) == -1);
  3045. }
  3046. #endif
  3047. g_IEAKLiteArray[i].iListBox = ListView_InsertItem(hwndList, &lvItem);
  3048. }
  3049. ListView_SetColumnWidth(hwndList, 0, LVSCW_AUTOSIZE);
  3050. }
  3051. void IEAKLiteMaintToggleCheckItem(HWND hwndList, int iItem)
  3052. {
  3053. int i;
  3054. LVITEM lvItem;
  3055. for (i = 0; i < IL_END; i++)
  3056. {
  3057. if (g_IEAKLiteArray[i].iListBox == iItem)
  3058. break;
  3059. }
  3060. ZeroMemory(&lvItem, sizeof(lvItem));
  3061. g_IEAKLiteArray[i].fEnabled = !(g_IEAKLiteArray[i].fEnabled);
  3062. lvItem.iItem = iItem;
  3063. lvItem.mask = LVIF_IMAGE;
  3064. lvItem.iImage = g_IEAKLiteArray[i].fEnabled ? 1 : 0;
  3065. ListView_SetItem(hwndList, &lvItem);
  3066. }
  3067. BOOL ExtractOldInfo(LPCTSTR pcszCabname, LPTSTR pcszDestDir, BOOL fExe)
  3068. {
  3069. TCHAR szCabPath[MAX_PATH];
  3070. TCHAR szCmd[MAX_PATH*3];
  3071. StrCpy(szCabPath, g_szCustIns);
  3072. PathRemoveFileSpec(szCabPath);
  3073. PathAppend(szCabPath, pcszCabname);
  3074. if (!PathFileExists(szCabPath))
  3075. return TRUE;
  3076. if (!fExe)
  3077. return (ExtractFilesWrap(szCabPath, pcszDestDir, 0, NULL, NULL, 0) == ERROR_SUCCESS);
  3078. wnsprintf(szCmd, countof(szCmd), TEXT("\"%s\" /c /t:\"%s\""), szCabPath, pcszDestDir);
  3079. return (RunAndWait(szCmd, g_szBuildTemp, SW_HIDE) == S_OK);
  3080. }
  3081. // BUGBUG: <oliverl> should probably persist this server side only info in a server side file for IEAK6
  3082. DWORD SaveIEAKLiteThreadProc(LPVOID)
  3083. {
  3084. static BOOL s_fDesk;
  3085. static BOOL s_fBrand;
  3086. static BOOL s_fExe;
  3087. TCHAR szGroupName[128];
  3088. TCHAR szTmp[MAX_PATH];
  3089. if (s_fDestDirChanged)
  3090. s_fDestDirChanged = s_fDesk = s_fBrand = s_fExe = FALSE;
  3091. for (int i=0; i < IL_END; i++)
  3092. {
  3093. LoadString(g_rvInfo.hInst, g_IEAKLiteArray[i].idGroupName, szGroupName, countof(szGroupName));
  3094. WritePrivateProfileString(IS_IEAKLITE, szGroupName, g_IEAKLiteArray[i].fEnabled ? NULL : TEXT("1"), g_szCustIns);
  3095. }
  3096. if (!s_fExe && !g_IEAKLiteArray[IL_ACTIVESETUP].fEnabled)
  3097. {
  3098. ExtractOldInfo(TEXT("IE6SETUP.EXE"), g_szBuildTemp, TRUE);
  3099. s_fExe = TRUE;
  3100. }
  3101. if (!s_fBrand &&
  3102. (!g_IEAKLiteArray[IL_BROWSER].fEnabled || !g_IEAKLiteArray[IL_SIGNUP].fEnabled || !g_IEAKLiteArray[IL_CONNECT].fEnabled ||
  3103. !g_IEAKLiteArray[IL_ZONES].fEnabled || !g_IEAKLiteArray[IL_CERT].fEnabled || !g_IEAKLiteArray[IL_MAILNEWS].fEnabled ||
  3104. !g_IEAKLiteArray[IL_ADM].fEnabled || IsIconsInFavs(IS_FAVORITESEX, g_szCustIns) ||
  3105. IsIconsInFavs(IS_URL, g_szCustIns)))
  3106. {
  3107. ExtractOldInfo(TEXT("BRANDING.CAB"), g_szTempSign, FALSE);
  3108. PathCombine(szTmp, g_szTempSign, TEXT("install.inf"));
  3109. DeleteFile(szTmp);
  3110. PathCombine(szTmp, g_szTempSign, TEXT("setup.inf"));
  3111. DeleteFile(szTmp);
  3112. s_fBrand = TRUE;
  3113. }
  3114. if (ISNULL(g_szDeskTemp) && g_fIntranet)
  3115. {
  3116. PathCombine(g_szDeskTemp, g_szBuildRoot, TEXT("DESKTOP"));
  3117. PathCreatePath(g_szDeskTemp);
  3118. }
  3119. if (!s_fDesk)
  3120. {
  3121. ExtractOldInfo(TEXT("DESKTOP.CAB"), g_szDeskTemp, FALSE);
  3122. PathCombine(szTmp, g_szDeskTemp, TEXT("install.inf"));
  3123. DeleteFile(szTmp);
  3124. PathCombine(szTmp, g_szDeskTemp, TEXT("setup.inf"));
  3125. DeleteFile(szTmp);
  3126. s_fDesk = TRUE;
  3127. }
  3128. if (!g_fIntranet && g_fBranded)
  3129. {
  3130. // ISP
  3131. g_fServerICW = g_fServerKiosk = g_fServerless = g_fNoSignup = FALSE;
  3132. // make sure that only one of the variables is set to TRUE
  3133. g_fServerICW = InsGetBool(IS_BRANDING, IK_USEICW, 0, g_szCustIns);
  3134. if (!g_fServerICW)
  3135. {
  3136. g_fServerKiosk = InsGetBool(IS_BRANDING, IK_SERVERKIOSK, 0, g_szCustIns);
  3137. if (!g_fServerKiosk)
  3138. {
  3139. g_fServerless = InsGetBool(IS_BRANDING, IK_SERVERLESS, 0, g_szCustIns);
  3140. if (!g_fServerless)
  3141. {
  3142. // in lots of other functions like BuildIE4, BuildBrandingOnly, BuildCDandMflop, etc.,
  3143. // !g_fNoSignup is used to mean that some signup mode was chosen;
  3144. // therefore, default to TRUE for g_fNoSignup
  3145. g_fNoSignup = InsGetBool(IS_BRANDING, IK_NODIAL, 1, g_szCustIns);
  3146. }
  3147. }
  3148. }
  3149. }
  3150. else
  3151. {
  3152. if (g_fIntranet)
  3153. {
  3154. // Corp
  3155. g_fSilent = GetPrivateProfileInt( BRANDING, SILENT_INSTALL, 0, g_szCustIns );
  3156. g_fStealth = GetPrivateProfileInt( BRANDING, TEXT("StealthInstall"), 0, g_szCustIns );
  3157. g_fInteg = GetPrivateProfileInt( BRANDING, WEB_INTEGRATED, 0, g_szCustIns );
  3158. }
  3159. }
  3160. g_fUseIEWelcomePage = !InsGetBool(IS_URL, IK_NO_WELCOME_URL, FALSE, g_szCustIns);
  3161. // take care of install dir for corp case
  3162. if (g_fIntranet)
  3163. {
  3164. TCHAR szWrk[MAX_PATH];
  3165. GetPrivateProfileString( IS_BRANDING, TEXT("InstallDir"), TEXT(""), szWrk, countof(szWrk), g_szCustIns );
  3166. if (*szWrk != TEXT('%'))
  3167. {
  3168. g_iInstallOpt = INSTALL_OPT_FULL;
  3169. if (ISNONNULL(szWrk))
  3170. StrCpy(g_szInstallFolder, szWrk);
  3171. else
  3172. {
  3173. LoadString( g_rvInfo.hInst, IDS_IE, g_szInstallFolder, MAX_PATH );
  3174. g_iInstallOpt = INSTALL_OPT_PROG;
  3175. }
  3176. }
  3177. else
  3178. {
  3179. switch (szWrk[1])
  3180. {
  3181. case 'p':
  3182. case 'P':
  3183. default:
  3184. g_iInstallOpt = INSTALL_OPT_PROG;
  3185. break;
  3186. }
  3187. StrCpy(g_szInstallFolder, &szWrk[3]);
  3188. }
  3189. }
  3190. return 0;
  3191. }
  3192. void SetIEAKLiteDesc(HWND hDlg, int iItem)
  3193. {
  3194. WORD wId;
  3195. int i;
  3196. TCHAR szDesc[512];
  3197. for (i = 0; i < IL_END; i++)
  3198. {
  3199. if (g_IEAKLiteArray[i].iListBox == iItem)
  3200. break;
  3201. }
  3202. if (!g_fBranded)
  3203. wId = g_IEAKLiteArray[i].idICPDesc;
  3204. else
  3205. {
  3206. if (!g_fIntranet)
  3207. wId = g_IEAKLiteArray[i].idISPDesc;
  3208. else
  3209. wId = g_IEAKLiteArray[i].idCorpDesc;
  3210. }
  3211. LoadString(g_rvInfo.hInst, wId, szDesc, countof(szDesc));
  3212. SetDlgItemText(hDlg, IDC_IEAKLITEDESC, szDesc);
  3213. }
  3214. void IEAKLiteSelectAll(HWND hCompList, BOOL fSet)
  3215. {
  3216. for (int i=0; i < IL_END; i++)
  3217. {
  3218. if (g_IEAKLiteArray[i].iListBox != -2)
  3219. {
  3220. LV_ITEM lvItem;
  3221. g_IEAKLiteArray[i].fEnabled = fSet;
  3222. ZeroMemory(&lvItem, sizeof(lvItem));
  3223. lvItem.iImage = fSet ? 1 : 0;
  3224. lvItem.mask = LVIF_IMAGE;
  3225. lvItem.iItem = g_IEAKLiteArray[i].iListBox;
  3226. ListView_SetItem(hCompList, &lvItem);
  3227. }
  3228. }
  3229. }
  3230. //
  3231. // FUNCTION: IEAKLiteProc(HWND, UINT, UINT, LONG)
  3232. //
  3233. // PURPOSE: Processes messages for "IEAKLite" page
  3234. //
  3235. // MESSAGES:
  3236. //
  3237. // WM_INITDIALOG - intializes the page
  3238. // WM_NOTIFY - processes the notifications sent to the page
  3239. //
  3240. INT_PTR CALLBACK IEAKLiteProc(
  3241. HWND hDlg,
  3242. UINT message,
  3243. WPARAM wParam,
  3244. LPARAM lParam)
  3245. {
  3246. HWND hwndList = GetDlgItem(hDlg, IDC_IEAKLITE);
  3247. HWND hWait;
  3248. HANDLE hThread;
  3249. int iItem;
  3250. DWORD dwTid;
  3251. switch (message)
  3252. {
  3253. case WM_INITDIALOG:
  3254. EnableDBCSChars(hDlg, IDC_IEAKLITE);
  3255. InitList(hDlg, IDC_IEAKLITE);
  3256. g_hWizard = hDlg;
  3257. break;
  3258. case WM_HELP:
  3259. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  3260. break;
  3261. case IDM_BATCHADVANCE:
  3262. DoBatchAdvance(hDlg);
  3263. break;
  3264. case WM_COMMAND:
  3265. if (HIWORD(wParam) == BN_CLICKED)
  3266. {
  3267. switch (LOWORD(wParam))
  3268. {
  3269. case IDC_LITECHECKALL:
  3270. IEAKLiteSelectAll(hwndList, TRUE);
  3271. break;
  3272. case IDC_LITEUNCHECKALL:
  3273. IEAKLiteSelectAll(hwndList, FALSE);
  3274. break;
  3275. }
  3276. }
  3277. break;
  3278. case WM_NOTIFY:
  3279. switch (((NMHDR FAR *) lParam)->code)
  3280. {
  3281. case LVN_KEYDOWN:
  3282. {
  3283. NMLVKEYDOWN *pnm = (NMLVKEYDOWN*) lParam;
  3284. if ( pnm->wVKey == VK_SPACE )
  3285. {
  3286. iItem = ListView_GetSelectionMark(hwndList);
  3287. IEAKLiteMaintToggleCheckItem(hwndList, iItem);
  3288. }
  3289. break;
  3290. }
  3291. case NM_CLICK:
  3292. {
  3293. POINT pointScreen, pointLVClient;
  3294. DWORD dwPos;
  3295. LVHITTESTINFO HitTest;
  3296. dwPos = GetMessagePos();
  3297. pointScreen.x = LOWORD (dwPos);
  3298. pointScreen.y = HIWORD (dwPos);
  3299. pointLVClient = pointScreen;
  3300. // Convert the point from screen to client coordinates,
  3301. // relative to the Listview
  3302. ScreenToClient (hwndList, &pointLVClient);
  3303. HitTest.pt = pointLVClient;
  3304. ListView_HitTest(hwndList, &HitTest);
  3305. // Only if the user clicked on the checkbox icon/bitmap, change
  3306. if (HitTest.flags == LVHT_ONITEMICON)
  3307. IEAKLiteMaintToggleCheckItem(hwndList, HitTest.iItem);
  3308. SetIEAKLiteDesc(hDlg, HitTest.iItem);
  3309. }
  3310. break;
  3311. case NM_DBLCLK:
  3312. if ( ((LPNMHDR)lParam)->idFrom == IDC_IEAKLITE)
  3313. {
  3314. iItem = ListView_GetSelectionMark(hwndList);
  3315. IEAKLiteMaintToggleCheckItem(hwndList, iItem);
  3316. SetIEAKLiteDesc(hDlg, iItem);
  3317. }
  3318. break;
  3319. case LVN_ITEMCHANGED:
  3320. iItem = ListView_GetSelectionMark(hwndList);
  3321. SetIEAKLiteDesc(hDlg, iItem);
  3322. break;
  3323. case PSN_HELP:
  3324. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  3325. break;
  3326. case PSN_SETACTIVE:
  3327. SetBannerText(hDlg);
  3328. InitIEAKLite(GetDlgItem(hDlg, IDC_IEAKLITE));
  3329. ListView_SetItemState(hwndList, 0, LVIS_SELECTED, LVIS_SELECTED);
  3330. SetIEAKLiteDesc(hDlg, 0);
  3331. CheckBatchAdvance(hDlg);
  3332. break;
  3333. case PSN_WIZNEXT:
  3334. case PSN_WIZBACK:
  3335. PropSheet_SetWizButtons(GetParent(hDlg), 0);
  3336. hWait = CreateDialog(g_rvInfo.hInst, MAKEINTRESOURCE(IDD_WAITIEAKLITE), hDlg,
  3337. DownloadStatusDlgProc);
  3338. ShowWindow( hWait, SW_SHOWNORMAL );
  3339. hThread = CreateThread(NULL, 4096, SaveIEAKLiteThreadProc, NULL, 0, &dwTid);
  3340. while (MsgWaitForMultipleObjects(1, &hThread, FALSE, INFINITE, QS_ALLINPUT) != WAIT_OBJECT_0)
  3341. {
  3342. MSG msg;
  3343. while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
  3344. {
  3345. TranslateMessage(&msg);
  3346. DispatchMessage(&msg);
  3347. }
  3348. }
  3349. if (hThread) CloseHandle(hThread);
  3350. DestroyWindow(hWait);
  3351. PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_BACK | PSWIZB_NEXT);
  3352. g_iCurPage = PPAGE_IEAKLITE;
  3353. EnablePages();
  3354. if (((NMHDR FAR *) lParam)->code == PSN_WIZNEXT) PageNext(hDlg);
  3355. else
  3356. {
  3357. PagePrev(hDlg);
  3358. }
  3359. break;
  3360. case PSN_QUERYCANCEL:
  3361. QueryCancel(hDlg);
  3362. break;
  3363. default:
  3364. return FALSE;
  3365. }
  3366. break;
  3367. case WM_LV_GETITEMS:
  3368. LVGetItems(GetDlgItem(hDlg, IDC_IEAKLITE));
  3369. break;
  3370. default:
  3371. return FALSE;
  3372. }
  3373. return TRUE;
  3374. }
  3375. void PositionWindow(HWND hWnd)
  3376. {
  3377. int nXPos, nYPos, nWidth, nHeight;
  3378. RECT rectWnd, rectDesktop;
  3379. if (hWnd == NULL && !IsWindow(hWnd))
  3380. return;
  3381. GetWindowRect(GetDesktopWindow(), &rectDesktop);
  3382. GetWindowRect(hWnd, &rectWnd);
  3383. nXPos = nYPos = -1;
  3384. nWidth = rectWnd.right - rectWnd.left;
  3385. nHeight = rectWnd.bottom - rectWnd.top;
  3386. if (g_fOCW && *g_szParentWindowName)
  3387. {
  3388. HWND hOCWWnd;
  3389. RECT rect;
  3390. hOCWWnd = FindWindow(NULL, g_szParentWindowName);
  3391. if (hOCWWnd != NULL && IsWindow(hOCWWnd) && !IsIconic(hOCWWnd))
  3392. {
  3393. GetWindowRect(hOCWWnd, &rect);
  3394. nXPos = rect.left;
  3395. nYPos = rect.top;
  3396. }
  3397. }
  3398. if (nXPos == -1 && nYPos == -1)
  3399. {
  3400. nXPos = (rectDesktop.right - nWidth) / 2;
  3401. nYPos = (rectDesktop.bottom - nHeight) / 2;
  3402. }
  3403. MoveWindow(hWnd, nXPos, nYPos, nWidth, nHeight, TRUE);
  3404. }
  3405. void GetIEAKDir(LPTSTR szDir)
  3406. {
  3407. TCHAR szIEAKDir[MAX_PATH];
  3408. *szIEAKDir = TEXT('\0');
  3409. if (GetModuleFileName(NULL, szIEAKDir, countof(szIEAKDir)))
  3410. PathRemoveFileSpec(szIEAKDir);
  3411. else
  3412. {
  3413. DWORD dwSize;
  3414. dwSize = sizeof(szIEAKDir);
  3415. if (SHGetValue(HKEY_LOCAL_MACHINE, REGSTR_PATH_APPPATHS TEXT("\\ieak6WIZ.EXE"),
  3416. TEXT("Path"), NULL, (LPVOID) szIEAKDir, &dwSize) != ERROR_SUCCESS)
  3417. {
  3418. dwSize = sizeof(szIEAKDir);
  3419. if (SHGetValue(HKEY_LOCAL_MACHINE, REGSTR_PATH_SETUP, TEXT("ProgramFilesDir"),
  3420. NULL, (LPVOID) szIEAKDir, &dwSize) == ERROR_SUCCESS)
  3421. PathAppend(szIEAKDir, TEXT("IEAK"));
  3422. }
  3423. }
  3424. StrCpy(szDir, szIEAKDir);
  3425. }
  3426. // get the ins file from the selected "platform/language" directory if exists
  3427. // else copy the last ins file used for this build directory if one exists
  3428. // else start with a new ins file
  3429. void GenerateCustomIns()
  3430. {
  3431. TCHAR szSrcCustIns[MAX_PATH];
  3432. PathCombine(g_szCustIns, g_szBuildRoot, TEXT("INS"));
  3433. PathAppend(g_szCustIns, GetOutputPlatformDir());
  3434. PathAppend(g_szCustIns, g_szLanguage);
  3435. PathCreatePath(g_szCustIns);
  3436. PathAppend(g_szCustIns, TEXT("INSTALL.INS"));
  3437. if (g_szSrcRoot[0])
  3438. {
  3439. PathCombine(szSrcCustIns, g_szSrcRoot, TEXT("INS"));
  3440. PathAppend(szSrcCustIns, GetOutputPlatformDir());
  3441. PathAppend(szSrcCustIns, g_szLanguage);
  3442. PathCreatePath(szSrcCustIns);
  3443. PathAppend(szSrcCustIns, TEXT("INSTALL.INS"));
  3444. }
  3445. if (PathFileExists(szSrcCustIns))
  3446. CopyFile(szSrcCustIns, g_szCustIns, FALSE); //Overwrite if already exists
  3447. if (!PathFileExists(g_szCustIns))
  3448. {
  3449. TCHAR szInsFile[MAX_PATH];
  3450. TCHAR szPlatformLang[MAX_PATH];
  3451. DWORD dwSize = sizeof(szPlatformLang);
  3452. TCHAR szRegKey[MAX_PATH];
  3453. wnsprintf(szRegKey, countof(szRegKey), TEXT("%s\\INS"), RK_IEAK_SERVER);
  3454. if (SHGetValue(HKEY_CURRENT_USER, szRegKey, g_szBuildRoot, NULL, (LPBYTE)szPlatformLang, &dwSize) == ERROR_SUCCESS)
  3455. {
  3456. TCHAR szTemp[MAX_PATH];
  3457. StrCpy(szTemp, szPlatformLang);
  3458. PathRemoveFileSpec(szTemp);
  3459. if (StrCmpI(szTemp, TEXT("WIN32")) == 0)
  3460. {
  3461. PathCombine(szInsFile, g_szBuildRoot, TEXT("INS"));
  3462. PathAppend(szInsFile, szPlatformLang);
  3463. PathAppend(szInsFile, TEXT("INSTALL.INS"));
  3464. CopyFile(szInsFile, g_szCustIns, TRUE);
  3465. if (ISNULL(g_szLoadedIns) && (StrCmpI(g_szLoadedIns, szInsFile) != 0))
  3466. {
  3467. StrCpy(g_szLoadedIns, szInsFile);
  3468. s_fLoadIns = TRUE;
  3469. }
  3470. }
  3471. }
  3472. }
  3473. }