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.

637 lines
26 KiB

  1. #include "precomp.h"
  2. extern TCHAR g_szBuildRoot[MAX_PATH];
  3. extern TCHAR g_szWizRoot[];
  4. extern TCHAR g_szLanguage[16];
  5. extern TCHAR g_szCustIns[];
  6. extern TCHAR g_szMastInf[];
  7. extern PROPSHEETPAGE g_psp[];
  8. extern int g_iCurPage;
  9. DWORD DetermineISKColor( LONG );
  10. static ISKINFO s_iskInfo; // a structure containing isk configuration information
  11. //---------------------------------------------------------------------------
  12. void InsertComboString( HWND hDlg, UINT uControl, UINT uString )
  13. {
  14. TCHAR szString[128];
  15. LoadString( g_rvInfo.hInst, uString, szString, 128 );
  16. SendDlgItemMessage( hDlg, uControl, CB_INSERTSTRING, (WPARAM) 0, (LPARAM) szString);
  17. }
  18. //---------------------------------------------------------------------------
  19. INT_PTR CALLBACK ISKBackBitmap( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
  20. {
  21. LONG lIndex;
  22. TCHAR szData[MAX_PATH];
  23. TCHAR szNormalIndex[4];
  24. TCHAR szHighlightIndex[4];
  25. TCHAR szIniPath[MAX_PATH];
  26. DWORD dwResult;
  27. PathCombine(szIniPath, g_szBuildRoot, TEXT("INS"));
  28. PathAppend(szIniPath, GetOutputPlatformDir());
  29. PathAppend(szIniPath, g_szLanguage);
  30. PathAppend(szIniPath, TEXT("iak.ini"));
  31. switch (message) {
  32. case IDM_BATCHADVANCE:
  33. DoBatchAdvance(hDlg);
  34. break;
  35. case WM_HELP:
  36. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  37. break;
  38. case WM_INITDIALOG:
  39. EnableDBCSChars(hDlg, IDE_ISKTITLEBAR);
  40. EnableDBCSChars(hDlg, IDE_ISKBACKBITMAP);
  41. EnableDBCSChars(hDlg, IDE_ISKBUTTON);
  42. Edit_LimitText(GetDlgItem(hDlg, IDE_ISKTITLEBAR), countof(s_iskInfo.szISKTitleBar)-1);
  43. Edit_LimitText(GetDlgItem(hDlg, IDE_ISKBACKBITMAP), countof(s_iskInfo.szISKBackBitmap)-1);
  44. Edit_LimitText(GetDlgItem(hDlg, IDE_ISKBUTTON), countof(s_iskInfo.szISKBtnBitmap)-1);
  45. SendDlgItemMessage(hDlg, IDC_COOLBUTTON, BM_SETCHECK, 1, 0);
  46. GetPrivateProfileString( TEXT("ISK"), TEXT("Title"), TEXT(""), szData,
  47. countof(szData), szIniPath );
  48. StrCpy(s_iskInfo.szISKTitleBar, szData );
  49. GetPrivateProfileString( TEXT("ISK"), TEXT("BmpPath"), TEXT(""), szData,
  50. countof(szData), szIniPath );
  51. StrCpy(s_iskInfo.szISKBackBitmap, szData);
  52. GetPrivateProfileString( TEXT("ISK"), TEXT("BtnPath"), TEXT(""), szData,
  53. countof(szData), szIniPath );
  54. StrCpy(s_iskInfo.szISKBtnBitmap, szData);
  55. SendDlgItemMessage( hDlg, IDE_ISKBUTTON, WM_SETTEXT, 0, (LPARAM)s_iskInfo.szISKBtnBitmap);
  56. GetPrivateProfileString( TEXT("ISK"), TEXT("StandardColorIndex"), TEXT("6"),
  57. szData, countof(szData), szIniPath );
  58. s_iskInfo.dwNIndex = StrToLong( szData );
  59. GetPrivateProfileString( TEXT("ISK"), TEXT("HighlightColorIndex"), TEXT("0"),
  60. szData, countof(szData), szIniPath );
  61. s_iskInfo.dwHIndex = StrToLong( szData );
  62. DisableDlgItem(hDlg, IDE_ISKBUTTON);
  63. DisableDlgItem(hDlg, IDC_ISKBROWSE2);
  64. GetPrivateProfileString( TEXT("ISK"), TEXT("CustomButtonState"), TEXT(""),
  65. szData, countof(szData), szIniPath );
  66. if(!StrCmp(szData, TEXT("0")))
  67. {
  68. SendDlgItemMessage(hDlg, IDC_ISKCUST3D, BM_SETCHECK, 0, 0);
  69. SendDlgItemMessage(hDlg, IDC_COOLBUTTON, BM_SETCHECK, 0, 0);
  70. SendDlgItemMessage(hDlg, IDC_RADIO2, BM_SETCHECK, 1, 0);
  71. }
  72. else
  73. {
  74. if(s_iskInfo.szISKBtnBitmap[0])
  75. {
  76. SendDlgItemMessage(hDlg, IDC_ISKCUST3D, BM_SETCHECK, 1, 0);
  77. SendDlgItemMessage(hDlg, IDC_COOLBUTTON, BM_SETCHECK, 0, 0);
  78. SendDlgItemMessage(hDlg, IDC_RADIO2, BM_SETCHECK, 0, 0);
  79. EnableDlgItem( hDlg, IDE_ISKBUTTON );
  80. EnableDlgItem( hDlg, IDC_ISKBROWSE2 );
  81. }
  82. else
  83. {
  84. SendDlgItemMessage(hDlg, IDC_ISKCUST3D, BM_SETCHECK, 0, 0);
  85. SendDlgItemMessage(hDlg, IDC_COOLBUTTON, BM_SETCHECK, 1, 0);
  86. SendDlgItemMessage(hDlg, IDC_RADIO2, BM_SETCHECK, 0, 0);
  87. }
  88. }
  89. InsertComboString( hDlg, IDC_ISKNORMAL, IDS_DARKCYAN );
  90. InsertComboString( hDlg, IDC_ISKNORMAL, IDS_DARKYELLOW );
  91. InsertComboString( hDlg, IDC_ISKNORMAL, IDS_DARKMAGENTA );
  92. InsertComboString( hDlg, IDC_ISKNORMAL, IDS_DARKBLUE );
  93. InsertComboString( hDlg, IDC_ISKNORMAL, IDS_DARKGREEN );
  94. InsertComboString( hDlg, IDC_ISKNORMAL, IDS_DARKRED );
  95. InsertComboString( hDlg, IDC_ISKNORMAL, IDS_DARKGRAY );
  96. InsertComboString( hDlg, IDC_ISKNORMAL, IDS_YELLOW );
  97. InsertComboString( hDlg, IDC_ISKNORMAL, IDS_MAGENTA );
  98. InsertComboString( hDlg, IDC_ISKNORMAL, IDS_CYAN );
  99. InsertComboString( hDlg, IDC_ISKNORMAL, IDS_BLUE );
  100. InsertComboString( hDlg, IDC_ISKNORMAL, IDS_GREEN );
  101. InsertComboString( hDlg, IDC_ISKNORMAL, IDS_RED );
  102. InsertComboString( hDlg, IDC_ISKNORMAL, IDS_LIGHTGRAY );
  103. InsertComboString( hDlg, IDC_ISKNORMAL, IDS_BLACK );
  104. InsertComboString( hDlg, IDC_ISKNORMAL, IDS_WHITE );
  105. InsertComboString( hDlg, IDC_ISKHIGHLIGHT, IDS_DARKCYAN );
  106. InsertComboString( hDlg, IDC_ISKHIGHLIGHT, IDS_DARKYELLOW );
  107. InsertComboString( hDlg, IDC_ISKHIGHLIGHT, IDS_DARKMAGENTA );
  108. InsertComboString( hDlg, IDC_ISKHIGHLIGHT, IDS_DARKBLUE );
  109. InsertComboString( hDlg, IDC_ISKHIGHLIGHT, IDS_DARKGREEN );
  110. InsertComboString( hDlg, IDC_ISKHIGHLIGHT, IDS_DARKRED );
  111. InsertComboString( hDlg, IDC_ISKHIGHLIGHT, IDS_DARKGRAY );
  112. InsertComboString( hDlg, IDC_ISKHIGHLIGHT, IDS_YELLOW );
  113. InsertComboString( hDlg, IDC_ISKHIGHLIGHT, IDS_MAGENTA );
  114. InsertComboString( hDlg, IDC_ISKHIGHLIGHT, IDS_CYAN );
  115. InsertComboString( hDlg, IDC_ISKHIGHLIGHT, IDS_BLUE );
  116. InsertComboString( hDlg, IDC_ISKHIGHLIGHT, IDS_GREEN );
  117. InsertComboString( hDlg, IDC_ISKHIGHLIGHT, IDS_RED );
  118. InsertComboString( hDlg, IDC_ISKHIGHLIGHT, IDS_LIGHTGRAY );
  119. InsertComboString( hDlg, IDC_ISKHIGHLIGHT, IDS_BLACK );
  120. InsertComboString( hDlg, IDC_ISKHIGHLIGHT, IDS_WHITE );
  121. break;
  122. case WM_COMMAND:
  123. switch( LOWORD(wParam) )
  124. {
  125. case IDC_ISKBROWSE:
  126. GetDlgItemText(hDlg, IDE_ISKBACKBITMAP, s_iskInfo.szISKBackBitmap, countof(s_iskInfo.szISKBackBitmap));
  127. if (BrowseForFile(hDlg, s_iskInfo.szISKBackBitmap, countof(s_iskInfo.szISKBackBitmap), GFN_BMP))
  128. SetDlgItemText(hDlg, IDE_ISKBACKBITMAP, s_iskInfo.szISKBackBitmap);
  129. break;
  130. case IDC_ISKBROWSE2:
  131. GetDlgItemText(hDlg, IDE_ISKBUTTON, s_iskInfo.szISKBtnBitmap, countof(s_iskInfo.szISKBtnBitmap));
  132. if (BrowseForFile(hDlg, s_iskInfo.szISKBtnBitmap, countof(s_iskInfo.szISKBtnBitmap), GFN_BMP))
  133. SetDlgItemText(hDlg, IDE_ISKBUTTON, s_iskInfo.szISKBtnBitmap);
  134. break;
  135. case IDC_ISKCUST3D:
  136. EnableDlgItem(hDlg, IDE_ISKBUTTON);
  137. EnableDlgItem(hDlg, IDC_ISKBROWSE2);
  138. break;
  139. case IDC_COOLBUTTON:
  140. DisableDlgItem(hDlg, IDE_ISKBUTTON);
  141. DisableDlgItem(hDlg, IDC_ISKBROWSE2);
  142. PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_NEXT | PSWIZB_BACK);
  143. break;
  144. case IDC_RADIO2:
  145. DisableDlgItem(hDlg, IDE_ISKBUTTON);
  146. DisableDlgItem(hDlg, IDC_ISKBROWSE2);
  147. PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_NEXT | PSWIZB_BACK);
  148. break;
  149. }
  150. break;
  151. case WM_NOTIFY:
  152. switch (((NMHDR FAR *) lParam)->code)
  153. {
  154. case PSN_HELP:
  155. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  156. break;
  157. case PSN_SETACTIVE:
  158. SetBannerText(hDlg);
  159. PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_BACK|PSWIZB_NEXT);
  160. SendMessage(GetDlgItem(hDlg, IDE_ISKTITLEBAR), WM_SETTEXT, 0, (LPARAM)s_iskInfo.szISKTitleBar);
  161. SendMessage(GetDlgItem(hDlg, IDE_ISKBACKBITMAP), WM_SETTEXT, 0, (LPARAM)s_iskInfo.szISKBackBitmap);
  162. SendMessage(GetDlgItem(hDlg, IDE_ISKBUTTON), WM_SETTEXT, 0, (LPARAM)s_iskInfo.szISKBtnBitmap);
  163. SendDlgItemMessage( hDlg, IDC_ISKNORMAL, CB_SETCURSEL, (WPARAM) s_iskInfo.dwNIndex, 0);
  164. SendDlgItemMessage( hDlg, IDC_ISKHIGHLIGHT, CB_SETCURSEL, (WPARAM) s_iskInfo.dwHIndex, 0);
  165. CheckBatchAdvance(hDlg);
  166. break;
  167. case PSN_WIZNEXT:
  168. case PSN_WIZBACK:
  169. SendDlgItemMessage(hDlg, IDE_ISKTITLEBAR, WM_GETTEXT, (WPARAM)MAX_PATH, (LPARAM) s_iskInfo.szISKTitleBar);
  170. if (!IsBitmapFileValid(hDlg, IDE_ISKBACKBITMAP,
  171. s_iskInfo.szISKBackBitmap, NULL,
  172. 540, 347, IDS_TOOBIG540x347, IDS_TOOSMALL540x347))
  173. {
  174. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, -1);
  175. break;
  176. }
  177. else
  178. {
  179. WritePrivateProfileString( TEXT("ISK"), TEXT("BmpPath"),
  180. s_iskInfo.szISKBackBitmap, szIniPath );
  181. }
  182. if(SendDlgItemMessage(hDlg,IDC_ISKCUST3D,BM_GETCHECK,0,0)==BST_CHECKED)
  183. {
  184. if (!CheckField(hDlg, IDE_ISKBUTTON, FC_NONNULL | FC_FILE | FC_EXISTS))
  185. {
  186. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, -1);
  187. break;
  188. }
  189. if (!IsBitmapFileValid(hDlg, IDE_ISKBUTTON,
  190. s_iskInfo.szISKBtnBitmap, NULL,
  191. 0, 0, 0, 0))
  192. {
  193. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, -1);
  194. break;
  195. }
  196. else
  197. {
  198. WritePrivateProfileString( TEXT("ISK"), TEXT("BtnPath"),
  199. s_iskInfo.szISKBtnBitmap, szIniPath );
  200. }
  201. }
  202. else
  203. {
  204. StrCpy(s_iskInfo.szISKBtnBitmap, TEXT("\0"));
  205. WritePrivateProfileString( TEXT("ISK"), TEXT("BtnPath"), NULL, szIniPath );
  206. }
  207. WritePrivateProfileString( TEXT("ISK"), TEXT("Title"),
  208. s_iskInfo.szISKTitleBar, szIniPath );
  209. dwResult = (DWORD) SendDlgItemMessage(hDlg, IDC_COOLBUTTON, BM_GETCHECK, 0, 0);
  210. if( dwResult == BST_CHECKED )
  211. {
  212. s_iskInfo.fCoolButtons = TRUE;
  213. WritePrivateProfileString( TEXT("ISK"), TEXT("CustomButtonState"),
  214. TEXT("1"), szIniPath );
  215. }
  216. else
  217. {
  218. dwResult = (DWORD) SendDlgItemMessage(hDlg, IDC_ISKCUST3D, BM_GETCHECK, 0, 0);
  219. if( dwResult == BST_CHECKED )
  220. {
  221. s_iskInfo.fCoolButtons = TRUE;
  222. WritePrivateProfileString( TEXT("ISK"), TEXT("CustomButtonState"),
  223. TEXT("1"), szIniPath );
  224. }
  225. else
  226. {
  227. s_iskInfo.fCoolButtons = FALSE;
  228. WritePrivateProfileString( TEXT("ISK"), TEXT("CustomButtonState"),
  229. TEXT("0"), szIniPath );
  230. }
  231. }
  232. lIndex = (LONG) SendDlgItemMessage( hDlg, IDC_ISKNORMAL, CB_GETCURSEL, 0, 0);
  233. wnsprintf(szNormalIndex, countof(szNormalIndex), TEXT("%d"), lIndex);
  234. WritePrivateProfileString( TEXT("ISK"), TEXT("StandardColorIndex"),
  235. szNormalIndex, szIniPath );
  236. s_iskInfo.dwNormalColor = DetermineISKColor( lIndex );
  237. s_iskInfo.dwNIndex = (DWORD) lIndex;
  238. lIndex = (LONG) SendDlgItemMessage( hDlg, IDC_ISKHIGHLIGHT, CB_GETCURSEL, 0, 0);
  239. wnsprintf(szHighlightIndex, countof(szHighlightIndex), TEXT("%d"), lIndex);
  240. WritePrivateProfileString( TEXT("ISK"), TEXT("HighlightColorIndex"),
  241. szHighlightIndex, szIniPath );
  242. s_iskInfo.dwHighlightColor = DetermineISKColor( lIndex );
  243. s_iskInfo.dwHIndex = (DWORD) lIndex;
  244. EnablePages();
  245. if (((NMHDR FAR *) lParam)->code == PSN_WIZNEXT) PageNext(hDlg);
  246. else
  247. {
  248. PagePrev(hDlg);
  249. }
  250. break;
  251. break;
  252. case PSN_QUERYCANCEL:
  253. QueryCancel(hDlg);
  254. break;
  255. default:
  256. return FALSE;
  257. }
  258. break;
  259. default:
  260. return FALSE;
  261. }
  262. return TRUE;
  263. }
  264. //---------------------------------------------------------------------------
  265. void ISKSaveInfo( LPTSTR szIniPath )
  266. {
  267. TCHAR szNormalColor[32];
  268. TCHAR szHighlightColor[32];
  269. wnsprintf(szNormalColor, countof(szNormalColor), TEXT("%d"), s_iskInfo.dwNormalColor);
  270. wnsprintf(szHighlightColor, countof(szHighlightColor), TEXT("%d"), s_iskInfo.dwHighlightColor);
  271. if(ISNONNULL(s_iskInfo.szISKTitleBar))
  272. WritePrivateProfileString( TEXT("Custom"), TEXT("Title"), s_iskInfo.szISKTitleBar,
  273. szIniPath );
  274. WritePrivateProfileString( TEXT("Custom"), TEXT("NormalColor"), szNormalColor,
  275. szIniPath );
  276. WritePrivateProfileString( TEXT("Custom"), TEXT("HighlightColor"), szHighlightColor,
  277. szIniPath );
  278. if( s_iskInfo.fCoolButtons )
  279. {
  280. WritePrivateProfileString( TEXT("Custom"), TEXT("CoolButtons"), TEXT("1"), szIniPath );
  281. }
  282. }
  283. //---------------------------------------------------------------------------
  284. DWORD DetermineISKColor( LONG index )
  285. {
  286. switch( index )
  287. {
  288. case 0:
  289. return RGB( 255, 255, 255 ); // white
  290. break;
  291. case 1:
  292. return RGB( 0, 0, 0 ); // black
  293. break;
  294. case 2:
  295. return RGB( 192, 192, 192 ); // light gray
  296. break;
  297. case 3:
  298. return RGB( 255, 000, 000 ); // red
  299. break;
  300. case 4:
  301. return RGB( 000, 255, 000 ); // green
  302. break;
  303. case 5:
  304. return RGB( 000, 000, 255 ); // blue
  305. break;
  306. case 6:
  307. return RGB( 000, 255, 255 ); // cyan
  308. break;
  309. case 7:
  310. return RGB( 255, 000, 255 ); // magenta
  311. break;
  312. case 8:
  313. return RGB( 255, 255, 000 ); // yellow
  314. break;
  315. case 9:
  316. return RGB( 127, 127, 127 ); // dark gray
  317. break;
  318. case 10:
  319. return RGB( 127, 000, 000 ); // dark red
  320. break;
  321. case 11:
  322. return RGB( 000, 127, 000 ); // dark green
  323. break;
  324. case 12:
  325. return RGB( 000, 000, 127 ); // dark blue
  326. break;
  327. case 13:
  328. return RGB( 127, 000, 127 ); // dark magenta
  329. break;
  330. case 14:
  331. return RGB( 127, 127, 000 ); // dark yellow
  332. break;
  333. case 15:
  334. return RGB( 000, 127, 127 ); // dark cyan
  335. break;
  336. }
  337. return(0);
  338. }
  339. void CopyCDFile(TCHAR *lpszSourceRoot,TCHAR *lpszDestRoot,TCHAR *lpszSourceFile,TCHAR *lpszDestFile)
  340. {
  341. TCHAR szNewSource[MAX_PATH];
  342. TCHAR szNewDest[MAX_PATH];
  343. PathCombine(szNewSource, lpszSourceRoot, lpszSourceFile);
  344. PathCombine(szNewDest, lpszDestRoot, lpszDestFile);
  345. CopyFile(szNewSource,szNewDest,FALSE);
  346. }
  347. //---------------------------------------------------------------------------
  348. // CopyISK:
  349. // parameters
  350. // ----------
  351. // szDestPath - destination path for copy operation - should point to
  352. // "cdrom" directory on the hard drive. Example: "C:\BUILD\CD".
  353. // szSourcePath - source path for copy operation - should point to
  354. // the source isk directory. Example "\\PSD1\IAK\IAK001\BUILD\ISK"
  355. //---------------------------------------------------------------------------
  356. BOOL CopyISK( LPTSTR szDestPath, LPTSTR szSourcePath )
  357. {
  358. TCHAR szIniPath[MAX_PATH];
  359. TCHAR szBmpPath[MAX_PATH];
  360. TCHAR szNewDest[MAX_PATH];
  361. TCHAR szTemp[MAX_PATH];
  362. TCHAR szMoreInfo[MAX_PATH];
  363. TCHAR szStartHtm[MAX_PATH];
  364. BOOL res = TRUE;
  365. StrCpy(szNewDest,szDestPath);
  366. CopyCDFile(szSourcePath, szNewDest, TEXT("cdauto.inf"),TEXT("autorun.inf"));
  367. CopyCDFile(szSourcePath, szNewDest, TEXT("cdsetup.exe"),TEXT("cdsetup.exe"));
  368. PathAppend(szNewDest, GetOutputPlatformDir());
  369. CopyCDFile(szSourcePath, szNewDest, TEXT("cdie.exe"), TEXT("ie.exe"));
  370. CopyCDFile(szSourcePath, szNewDest, TEXT("isk3.ico"), TEXT("isk3.ico"));
  371. CopyCDFile(szSourcePath, szNewDest, TEXT("cdloc.ini"), TEXT("locale.ini"));
  372. PathAppend(szNewDest, g_szLanguage);
  373. PathAppend(szNewDest, TEXT("bin"));
  374. CreateDirectory(szNewDest,NULL);
  375. if (!GetPrivateProfileInt(IS_CDCUST, IK_DISABLESTART, 0, g_szCustIns))
  376. {
  377. if (GetPrivateProfileString(IS_CDCUST, IK_STARTHTM, TEXT(""), szStartHtm, countof(szStartHtm), g_szCustIns))
  378. {
  379. CopyHtmlImgs(szStartHtm, szNewDest, NULL, NULL);
  380. StrCpy(szTemp, szStartHtm);
  381. PathRemoveFileSpec(szTemp);
  382. CopyCDFile(szTemp, szNewDest, PathFindFileName(szStartHtm), TEXT("start.htm"));
  383. }
  384. }
  385. else
  386. {
  387. DeleteFileInDir(TEXT("start.htm"), szNewDest);
  388. DeleteHtmlImgs(TEXT("start.htm"), szNewDest, NULL, NULL);
  389. }
  390. CopyCDFile(szSourcePath, szNewDest, TEXT("iecd.exe"), TEXT("iecd.exe"));
  391. CopyCDFile(szSourcePath, szNewDest, TEXT("ie3inst.exe"),TEXT("ie3inst.exe"));
  392. CopyCDFile(szSourcePath, szNewDest, TEXT("closeie.exe"), TEXT("closeie.exe"));
  393. CopyCDFile(szSourcePath, szNewDest, TEXT("closeie.isk"), TEXT("closeie.isk"));
  394. CopyCDFile(szSourcePath, szNewDest, TEXT("icw.isk"), TEXT("icw.isk"));
  395. CopyCDFile(szSourcePath, szNewDest, TEXT("isp.isk"), TEXT("isp.isk"));
  396. CopyCDFile(szSourcePath, szNewDest, TEXT("runisp32.exe"), TEXT("runisp32.exe"));
  397. CopyCDFile(szSourcePath, szNewDest, TEXT("isk3ro.exe"), TEXT("isk3ro.exe"));
  398. CopyCDFile(szSourcePath, szNewDest, TEXT("iskrun.exe"), TEXT("iskrun.exe"));
  399. CopyCDFile(szSourcePath, szNewDest, TEXT("cdreadme.exe"), TEXT("readme.exe"));
  400. if (GetPrivateProfileString(IS_CDCUST, IK_MOREINFO, TEXT(""), szMoreInfo, countof(szMoreInfo), g_szCustIns))
  401. {
  402. StrCpy(szTemp, szMoreInfo);
  403. PathRemoveFileSpec(szTemp);
  404. CopyCDFile(szTemp, szNewDest, PathFindFileName(szMoreInfo), TEXT("moreinfo.txt"));
  405. }
  406. else
  407. CopyCDFile(szSourcePath, szNewDest, TEXT("cdinfo.txt"), TEXT("moreinfo.txt"));
  408. PathAppend( szDestPath, GetOutputPlatformDir() );
  409. PathCombine( szIniPath, szDestPath, TEXT("locale.ini") );
  410. WritePrivateProfileString(TEXT("Locale"), TEXT("default"), g_szLanguage, szIniPath);
  411. PathCombine(szIniPath, szNewDest, TEXT("iecd.ini"));
  412. ISKSaveInfo( szIniPath );
  413. PathCombine( szBmpPath, szNewDest, TEXT("back.bmp") );
  414. CopyFile( s_iskInfo.szISKBackBitmap, szBmpPath, FALSE );
  415. PathCombine( szBmpPath, szNewDest, TEXT("btns.bmp") );
  416. CopyFile( s_iskInfo.szISKBtnBitmap, szBmpPath, FALSE );
  417. return res;
  418. }
  419. //
  420. // FUNCTION: CDInfoProc(HWND, UINT, UINT, LONG)
  421. //
  422. // PURPOSE: Processes messages for "CD Info" page
  423. //
  424. // MESSAGES:
  425. //
  426. // WM_INITDIALOG - intializes the page
  427. // WM_NOTIFY - processes the notifications sent to the page
  428. //
  429. INT_PTR CALLBACK CDInfoProc(
  430. HWND hDlg,
  431. UINT message,
  432. WPARAM wParam,
  433. LPARAM lParam)
  434. {
  435. TCHAR szMoreInfo[MAX_PATH];
  436. TCHAR szStartHtm[MAX_PATH];
  437. BOOL fDisable;
  438. switch (message)
  439. {
  440. case WM_INITDIALOG:
  441. g_hWizard = hDlg;
  442. EnableDBCSChars(hDlg, IDE_STARTHTM);
  443. EnableDBCSChars(hDlg, IDE_MOREINFO);
  444. break;
  445. case WM_HELP:
  446. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  447. break;
  448. case IDM_BATCHADVANCE:
  449. DoBatchAdvance(hDlg);
  450. break;
  451. case WM_COMMAND:
  452. if( HIWORD(wParam) == BN_CLICKED )
  453. {
  454. switch (LOWORD(wParam))
  455. {
  456. case IDC_BROWSEMOREINFO:
  457. GetDlgItemText( hDlg, IDE_MOREINFO, szMoreInfo, countof(szMoreInfo));
  458. if( BrowseForFile( hDlg, szMoreInfo, countof(szMoreInfo), GFN_TXT ))
  459. SetDlgItemText( hDlg, IDE_MOREINFO, szMoreInfo );
  460. break;
  461. case IDC_BROWSESTARTHTM:
  462. GetDlgItemText( hDlg, IDE_STARTHTM, szStartHtm, countof(szStartHtm));
  463. if( BrowseForFile( hDlg, szStartHtm, countof(szStartHtm), GFN_LOCALHTM ))
  464. SetDlgItemText( hDlg, IDE_STARTHTM, szStartHtm );
  465. break;
  466. case IDC_ENABLESTARTHTM:
  467. fDisable = !(IsDlgButtonChecked(hDlg, IDC_ENABLESTARTHTM) == BST_CHECKED);
  468. EnableDlgItem2(hDlg, IDE_STARTHTM, !fDisable);
  469. EnableDlgItem2(hDlg, IDC_STARTHTM_TXT, !fDisable);
  470. EnableDlgItem2(hDlg, IDC_BROWSESTARTHTM, !fDisable);
  471. break;
  472. }
  473. }
  474. break;
  475. case WM_NOTIFY:
  476. switch (((NMHDR FAR *) lParam)->code)
  477. {
  478. case PSN_HELP:
  479. IeakPageHelp(hDlg, g_psp[g_iCurPage].pszTemplate);
  480. break;
  481. case PSN_SETACTIVE:
  482. SetBannerText(hDlg);
  483. // BUGBUG: <oliverl> these settings should be kept in server side file for IEAK6
  484. GetPrivateProfileString(IS_CDCUST, IK_MOREINFO, TEXT(""), szMoreInfo, countof(szMoreInfo), g_szCustIns);
  485. GetPrivateProfileString(IS_CDCUST, IK_STARTHTM, TEXT(""), szStartHtm, countof(szStartHtm), g_szCustIns);
  486. if (ISNULL(szMoreInfo))
  487. {
  488. StrCpy(szMoreInfo, g_szMastInf);
  489. PathRemoveFileSpec(szMoreInfo);
  490. PathAppend(szMoreInfo, TEXT("cdinfo.txt"));
  491. }
  492. SetDlgItemText( hDlg, IDE_MOREINFO, szMoreInfo );
  493. fDisable = GetPrivateProfileInt(IS_CDCUST, IK_DISABLESTART, 0, g_szCustIns);
  494. if (fDisable)
  495. {
  496. DisableDlgItem(hDlg, IDE_STARTHTM);
  497. DisableDlgItem(hDlg, IDC_STARTHTM_TXT);
  498. DisableDlgItem(hDlg, IDC_BROWSESTARTHTM);
  499. }
  500. else
  501. {
  502. if (ISNULL(szStartHtm))
  503. {
  504. StrCpy(szStartHtm, g_szMastInf);
  505. PathRemoveFileSpec(szStartHtm);
  506. PathAppend(szStartHtm, TEXT("cdstart.htm"));
  507. }
  508. SetDlgItemText( hDlg, IDE_STARTHTM, szStartHtm );
  509. }
  510. CheckDlgButton(hDlg, IDC_ENABLESTARTHTM, fDisable ? BST_UNCHECKED: BST_CHECKED);
  511. CheckBatchAdvance(hDlg);
  512. break;
  513. case PSN_WIZNEXT:
  514. case PSN_WIZBACK:
  515. fDisable = !(IsDlgButtonChecked(hDlg, IDC_ENABLESTARTHTM) == BST_CHECKED);
  516. if (!CheckField(hDlg, IDE_MOREINFO, FC_FILE | FC_EXISTS | FC_NONNULL))
  517. {
  518. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, -1);
  519. return TRUE;
  520. }
  521. GetDlgItemText( hDlg, IDE_MOREINFO, szMoreInfo, countof(szMoreInfo));
  522. if (!fDisable)
  523. {
  524. DWORD dwFlags = FC_FILE | FC_EXISTS | FC_NONNULL;
  525. if (!CheckField(hDlg, IDE_STARTHTM, dwFlags))
  526. {
  527. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, -1);
  528. return TRUE;
  529. }
  530. GetDlgItemText( hDlg, IDE_STARTHTM, szStartHtm, countof(szStartHtm));
  531. WritePrivateProfileString(IS_CDCUST, IK_STARTHTM, szStartHtm, g_szCustIns);
  532. }
  533. WritePrivateProfileString(IS_CDCUST, IK_DISABLESTART, fDisable ? TEXT("1") : TEXT("0"), g_szCustIns);
  534. WritePrivateProfileString(IS_CDCUST, IK_MOREINFO, szMoreInfo, g_szCustIns);
  535. g_iCurPage = PPAGE_CDINFO;
  536. EnablePages();
  537. if (((NMHDR FAR *) lParam)->code == PSN_WIZNEXT)
  538. PageNext(hDlg);
  539. else
  540. PagePrev(hDlg);
  541. break;
  542. case PSN_QUERYCANCEL:
  543. QueryCancel(hDlg);
  544. break;
  545. default:
  546. return FALSE;
  547. }
  548. break;
  549. default:
  550. return FALSE;
  551. }
  552. return TRUE;
  553. }