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.

1599 lines
49 KiB

  1. //----------------------------------------------------------------------------
  2. //
  3. // Copyright (c) 1997-1999 Microsoft Corporation
  4. // All rights reserved.
  5. //
  6. // File Name:
  7. // savefile.c
  8. //
  9. // Description:
  10. // The wizard pages plug in here to get there settings queued to
  11. // the answer file. We read the globals in setupmgr.h and figure
  12. // out what needs to be written or deleted.
  13. //
  14. //----------------------------------------------------------------------------
  15. #include "pch.h"
  16. #include "allres.h"
  17. #include "encrypt.h"
  18. #include "optcomp.h"
  19. //
  20. // String constants
  21. //
  22. static const LPTSTR StrConstYes = _T("Yes");
  23. static const LPTSTR StrConstNo = _T("No");
  24. static const LPTSTR StrConstStar = _T("*");
  25. static const LPTSTR StrComma = _T(",");
  26. //
  27. // local prototypes
  28. //
  29. // NTRAID#NTBUG9-551746-2002/02/27-stelo,swamip - Unused code, should be removed
  30. //
  31. static VOID WriteOutOemBootFiles( VOID );
  32. static VOID WriteOutMassStorageDrivers( VOID );
  33. static VOID WriteOutTapiSettings(VOID);
  34. static VOID WriteOutRegionalSettings(VOID);
  35. static VOID WriteOutRemoteInstallSettings(VOID);
  36. static VOID WriteOutIeSettings(VOID);
  37. //
  38. // Call out to savenet.c to save the network settings
  39. //
  40. extern VOID WriteOutNetSettings( HWND );
  41. //----------------------------------------------------------------------------
  42. //
  43. // Function: QueueSettingsToAnswerFile
  44. //
  45. // Purpose: This function looks at the global structs that dlgprocs
  46. // have been scribbling into and queues up all the settings
  47. // in preparation to be written out to disk.
  48. //
  49. // This function is called by the SaveScript page indirectly.
  50. // See common\save.c for details.
  51. //
  52. // The answer file queue (and the .udf queue) is initialized
  53. // with the original settings in the answer file loaded near
  54. // the beginning of the wizard.
  55. //
  56. // Ensure that you clear settings that should not be present
  57. // in the answer file.
  58. //
  59. // Arguments: VOID
  60. //
  61. // Returns: BOOL
  62. //
  63. //----------------------------------------------------------------------------
  64. BOOL
  65. QueueSettingsToAnswerFile(HWND hwnd)
  66. {
  67. TCHAR *lpValue;
  68. TCHAR Buffer[MAX_INILINE_LEN];
  69. HRESULT hrPrintf;
  70. //
  71. // Create each of the sections in the order we want them to appear
  72. // in the outputed answer file.
  73. //
  74. SettingQueue_AddSetting(
  75. _T("Data"), _T(""), _T(""), SETTING_QUEUE_ANSWERS);
  76. SettingQueue_AddSetting(
  77. _T("SetupData"), _T(""), _T(""), SETTING_QUEUE_ANSWERS);
  78. SettingQueue_AddSetting(
  79. _T("Unattended"), _T(""), _T(""), SETTING_QUEUE_ANSWERS);
  80. SettingQueue_AddSetting(
  81. _T("GuiUnattended"), _T(""), _T(""), SETTING_QUEUE_ANSWERS);
  82. SettingQueue_AddSetting(
  83. _T("UserData"), _T(""), _T(""), SETTING_QUEUE_ANSWERS);
  84. SettingQueue_AddSetting(
  85. _T("Display"), _T(""), _T(""), SETTING_QUEUE_ANSWERS);
  86. SettingQueue_AddSetting(
  87. _T("LicenseFilePrintData"), _T(""), _T(""), SETTING_QUEUE_ANSWERS);
  88. SettingQueue_AddSetting(
  89. _T("TapiLocation"), _T(""), _T(""), SETTING_QUEUE_ANSWERS);
  90. SettingQueue_AddSetting(
  91. _T("RegionalSettings"), _T(""), _T(""), SETTING_QUEUE_ANSWERS);
  92. SettingQueue_AddSetting(
  93. _T("MassStorageDrivers"), _T(""), _T(""), SETTING_QUEUE_ANSWERS);
  94. SettingQueue_AddSetting(
  95. _T("OEMBootFiles"), _T(""), _T(""), SETTING_QUEUE_ANSWERS);
  96. SettingQueue_AddSetting(
  97. _T("OEM_Ads"), _T(""), _T(""), SETTING_QUEUE_ANSWERS);
  98. SettingQueue_AddSetting(
  99. _T("SetupMgr"), _T(""), _T(""), SETTING_QUEUE_ANSWERS);
  100. // Let networking go last, then remaining RIS sections
  101. //
  102. // Set the UnattendMode
  103. //
  104. lpValue = _T("");
  105. //
  106. // Don't write out the Unattend Mode on a sysprep
  107. //
  108. if( WizGlobals.iProductInstall != PRODUCT_SYSPREP ) {
  109. switch ( GenSettings.iUnattendMode ) {
  110. case UMODE_GUI_ATTENDED: lpValue = _T("GuiAttended"); break;
  111. case UMODE_PROVIDE_DEFAULT: lpValue = _T("ProvideDefault"); break;
  112. case UMODE_DEFAULT_HIDE: lpValue = _T("DefaultHide"); break;
  113. case UMODE_READONLY: lpValue = _T("ReadOnly"); break;
  114. case UMODE_FULL_UNATTENDED: lpValue = _T("FullUnattended"); break;
  115. default:
  116. AssertMsg(FALSE, "Bad case for UnattendMode");
  117. break;
  118. }
  119. }
  120. SettingQueue_AddSetting(_T("Unattended"),
  121. _T("UnattendMode"),
  122. lpValue,
  123. SETTING_QUEUE_ANSWERS);
  124. //
  125. // Skip the EULA if they said 'yes' on the EULA page
  126. //
  127. if( GenSettings.bSkipEulaAndWelcome ) {
  128. SettingQueue_AddSetting(_T("Unattended"),
  129. _T("OemSkipEula"),
  130. StrConstYes,
  131. SETTING_QUEUE_ANSWERS);
  132. }
  133. //
  134. // Write out OemPreInstall depending how user answer StandAlone page
  135. //
  136. if( WizGlobals.iProductInstall == PRODUCT_REMOTEINSTALL )
  137. lpValue = StrConstNo;
  138. else if( WizGlobals.iProductInstall == PRODUCT_SYSPREP )
  139. lpValue = _T("");
  140. else
  141. lpValue = WizGlobals.bStandAloneScript ? StrConstNo : StrConstYes;
  142. SettingQueue_AddSetting(_T("Unattended"),
  143. _T("OemPreinstall"),
  144. lpValue,
  145. SETTING_QUEUE_ANSWERS);
  146. //
  147. // Write out the PnpDriver path that was computed in adddirs.c
  148. //
  149. SettingQueue_AddSetting(_T("Unattended"),
  150. _T("OemPnPDriversPath"),
  151. WizGlobals.OemPnpDriversPath,
  152. SETTING_QUEUE_ANSWERS);
  153. if( WizGlobals.iProductInstall == PRODUCT_SYSPREP )
  154. {
  155. TCHAR szDrive[MAX_PATH];
  156. TCHAR szSysprepPath[MAX_PATH] = _T("");
  157. ExpandEnvironmentStrings( _T("%SystemDrive%"),
  158. szDrive,
  159. MAX_PATH );
  160. // Note-ConcatenatePaths truncates to prevent overflow
  161. ConcatenatePaths( szSysprepPath,
  162. szDrive,
  163. _T("\\sysprep\\i386"),
  164. NULL );
  165. SettingQueue_AddSetting(_T("Unattended"),
  166. _T("InstallFilesPath"),
  167. szSysprepPath,
  168. SETTING_QUEUE_ANSWERS);
  169. }
  170. //
  171. // Don't write out the AutoPartition, MsDosInitiated and the
  172. // UnattendedInstall keys on a sysprep install.
  173. //
  174. if( WizGlobals.iProductInstall != PRODUCT_SYSPREP )
  175. {
  176. SettingQueue_AddSetting(_T("Data"),
  177. _T("AutoPartition"),
  178. _T("1"),
  179. SETTING_QUEUE_ANSWERS);
  180. SettingQueue_AddSetting(_T("Data"),
  181. _T("MsDosInitiated"),
  182. _T("\"0\""),
  183. SETTING_QUEUE_ANSWERS);
  184. SettingQueue_AddSetting(_T("Data"),
  185. _T("UnattendedInstall"),
  186. _T("\"Yes\""),
  187. SETTING_QUEUE_ANSWERS);
  188. }
  189. //
  190. // Product ID
  191. //
  192. Buffer[0] = _T('\0');
  193. if ( GenSettings.ProductId[0][0] != _T('\0') ) {
  194. hrPrintf=StringCchPrintf(Buffer, AS(Buffer),
  195. _T("%s-%s-%s-%s-%s"),
  196. GenSettings.ProductId[0],
  197. GenSettings.ProductId[1],
  198. GenSettings.ProductId[2],
  199. GenSettings.ProductId[3],
  200. GenSettings.ProductId[4]);
  201. }
  202. SettingQueue_AddSetting(_T("UserData"),
  203. _T("ProductKey"),
  204. Buffer,
  205. SETTING_QUEUE_ANSWERS);
  206. SettingQueue_AddSetting(_T("UserData"),
  207. _T("ProductId"),
  208. NULLSTR,
  209. SETTING_QUEUE_ANSWERS);
  210. //
  211. // Username & org
  212. //
  213. {
  214. TCHAR szName[MAX_PATH],
  215. szOrg[MAX_PATH];
  216. hrPrintf=StringCchPrintf(szName, AS(szName), _T("\"%s\""), GenSettings.UserName);
  217. hrPrintf=StringCchPrintf(szOrg, AS(szOrg), _T("\"%s\""), GenSettings.Organization);
  218. SettingQueue_AddSetting(_T("UserData"),
  219. _T("FullName"),
  220. szName,
  221. SETTING_QUEUE_ANSWERS);
  222. SettingQueue_AddSetting(_T("UserData"),
  223. _T("OrgName"),
  224. szOrg,
  225. SETTING_QUEUE_ANSWERS);
  226. }
  227. #ifdef OPTCOMP
  228. //
  229. // Write out the windows component settings only if doing an unattended installation
  230. //
  231. if ( WizGlobals.iProductInstall == PRODUCT_UNATTENDED_INSTALL )
  232. {
  233. DWORD dwIndex;
  234. BOOL bInstallComponent = FALSE;
  235. // Iterate through each component and determine if we should install
  236. //
  237. for (dwIndex=0;dwIndex<AS(s_cComponent);dwIndex++)
  238. {
  239. // Determine if the component should be installed and write out proper setting
  240. //
  241. bInstallComponent = (GenSettings.dwWindowsComponents & s_cComponent[dwIndex].dwComponent) ? TRUE : FALSE;
  242. SettingQueue_AddSetting(_T("Components"), s_cComponent[dwIndex].lpComponentString, (bInstallComponent ? _T("On") : _T("Off")), SETTING_QUEUE_ANSWERS);
  243. }
  244. }
  245. #endif
  246. //
  247. // Write out IE settings
  248. //
  249. WriteOutIeSettings();
  250. //
  251. // Set the [LicenseFilePrintData] section.
  252. //
  253. // Note that we'll allow changing product type between workstation and
  254. // server on an edit, so be sure to clear these settings in case we're
  255. // changing from server to workstation.
  256. //
  257. {
  258. TCHAR *pAutoMode = _T("");
  259. TCHAR *pAutoUsers = _T("");
  260. if ( WizGlobals.iPlatform == PLATFORM_SERVER || WizGlobals.iPlatform == PLATFORM_ENTERPRISE || WizGlobals.iPlatform == PLATFORM_WEBBLADE) {
  261. if ( GenSettings.bPerSeat ) {
  262. pAutoMode = _T("PerSeat");
  263. } else {
  264. pAutoMode = _T("PerServer");
  265. hrPrintf=StringCchPrintf(Buffer, AS(Buffer), _T("%d"), GenSettings.NumConnections);
  266. pAutoUsers = Buffer;
  267. }
  268. }
  269. SettingQueue_AddSetting(_T("LicenseFilePrintData"),
  270. _T("AutoMode"),
  271. pAutoMode,
  272. SETTING_QUEUE_ANSWERS);
  273. SettingQueue_AddSetting(_T("LicenseFilePrintData"),
  274. _T("AutoUsers"),
  275. pAutoUsers,
  276. SETTING_QUEUE_ANSWERS);
  277. }
  278. //
  279. // Computer name(s).
  280. //
  281. // ComputerName=* means setup should autogenerate a name
  282. //
  283. {
  284. INT nEntries = GetNameListSize(&GenSettings.ComputerNames);
  285. INT i;
  286. LPTSTR pName;
  287. //
  288. // Figure out computername setting. Make sure it is not present
  289. // in the case of multiple computer names.
  290. //
  291. if( WizGlobals.iProductInstall == PRODUCT_REMOTEINSTALL )
  292. pName = _T("%MACHINENAME%");
  293. else if ( (GenSettings.bAutoComputerName && GenSettings.Organization[0]) || ( nEntries > 1 ) )
  294. pName = StrConstStar;
  295. else if ( nEntries == 1 )
  296. pName = GetNameListName(&GenSettings.ComputerNames, 0);
  297. else
  298. pName = _T("");
  299. SettingQueue_AddSetting(_T("UserData"),
  300. _T("ComputerName"),
  301. pName,
  302. SETTING_QUEUE_ANSWERS);
  303. //
  304. // If multiple computer names, we need to queue the proper settings
  305. // to the .udf.
  306. //
  307. // ISSUE-2002/02/27-stelo -Should read the .udf instead of saving in [SetupMgr]
  308. //
  309. // Here is a sample udf
  310. // [UniqueIds]
  311. // foo0=UserData
  312. // foo1=UserData
  313. //
  314. // [foo0:UserData]
  315. // ComputerName=foo0
  316. //
  317. // [foo1:UserData]
  318. // ComputerName=foo1
  319. //
  320. if ( nEntries > 1 ) {
  321. for ( i=0; i<nEntries; i++ ) {
  322. pName = GetNameListName(&GenSettings.ComputerNames, i);
  323. hrPrintf=StringCchPrintf(Buffer, AS(Buffer), _T("ComputerName%d"), i);
  324. SettingQueue_AddSetting(_T("SetupMgr"),
  325. Buffer,
  326. pName,
  327. SETTING_QUEUE_ANSWERS);
  328. //
  329. // Write the UniqueIds entry to the udf
  330. //
  331. SettingQueue_AddSetting(_T("UniqueIds"),
  332. pName,
  333. _T("UserData"),
  334. SETTING_QUEUE_UDF);
  335. //
  336. // Now write the foo0:UserData section for this pName
  337. //
  338. hrPrintf=StringCchPrintf(Buffer, AS(Buffer), _T("%s:UserData"), pName);
  339. SettingQueue_AddSetting(Buffer,
  340. _T("ComputerName"),
  341. pName,
  342. SETTING_QUEUE_UDF);
  343. }
  344. }
  345. }
  346. //
  347. // Targetpath
  348. //
  349. if ( GenSettings.iTargetPath == TARGPATH_WINNT )
  350. lpValue = _T("\\WINDOWS");
  351. else if ( GenSettings.iTargetPath == TARGPATH_SPECIFY )
  352. lpValue = GenSettings.TargetPath;
  353. else if ( GenSettings.iTargetPath == TARGPATH_AUTO )
  354. lpValue = StrConstStar;
  355. else
  356. lpValue = _T("");
  357. SettingQueue_AddSetting(_T("Unattended"),
  358. _T("TargetPath"),
  359. lpValue,
  360. SETTING_QUEUE_ANSWERS);
  361. //
  362. // Write out the HAL to be used
  363. //
  364. // ISSUE-2002/02/27-stelo -There are spaces in the friendly name so it gets quoted but I assume
  365. // the ,OEM has to be outside the quotes
  366. if( GenSettings.szHalFriendlyName[0] != _T('\0') ) {
  367. hrPrintf=StringCchPrintf( Buffer, AS(Buffer), _T("\"%s\",OEM"), GenSettings.szHalFriendlyName );
  368. SettingQueue_AddSetting(_T("Unattended"),
  369. _T("ComputerType"),
  370. Buffer,
  371. SETTING_QUEUE_ANSWERS);
  372. }
  373. WriteOutMassStorageDrivers();
  374. WriteOutOemBootFiles();
  375. //
  376. // Write out OEM Ads Logo and Background bitmaps
  377. //
  378. if ( ! (lpValue = MyGetFullPath( GenSettings.lpszLogoBitmap ) ) )
  379. lpValue = _T("");
  380. SettingQueue_AddSetting(_T("OEM_Ads"),
  381. _T("Logo"),
  382. lpValue,
  383. SETTING_QUEUE_ANSWERS);
  384. if ( ! (lpValue = MyGetFullPath( GenSettings.lpszBackgroundBitmap ) ) )
  385. lpValue = _T("");
  386. SettingQueue_AddSetting(_T("OEM_Ads"),
  387. _T("Background"),
  388. lpValue,
  389. SETTING_QUEUE_ANSWERS);
  390. //
  391. // Admin password
  392. //
  393. if ( GenSettings.bSpecifyPassword )
  394. {
  395. if ( GenSettings.AdminPassword[0] )
  396. {
  397. lpValue = GenSettings.AdminPassword;
  398. // See if we should encrypt the admin password
  399. if (GenSettings.bEncryptAdminPassword)
  400. {
  401. TCHAR owfPwd[STRING_ENCODED_PASSWORD_SIZE];
  402. if (StringEncodeOwfPassword (lpValue, owfPwd, NULL))
  403. {
  404. lpValue = (LPTSTR) owfPwd;
  405. }
  406. else
  407. {
  408. // Error Case. Popup up a message box asking if the user
  409. // wants to continue using an non-encrypted password
  410. int iRet = ReportErrorId(hwnd,
  411. MSGTYPE_YESNO,
  412. IDS_ERR_PASSWORD_ENCRYPT_FAILED);
  413. if ( iRet == IDYES )
  414. {
  415. GenSettings.bEncryptAdminPassword = FALSE;
  416. }
  417. else
  418. {
  419. SetLastError(ERROR_CANCELLED);
  420. return FALSE;
  421. }
  422. }
  423. }
  424. // Now make sure that the password is surrounded by quotes (if it hasn't been encrypted)
  425. //
  426. if (!GenSettings.bEncryptAdminPassword)
  427. {
  428. TCHAR szTemp[MAX_PASSWORD + 3]; // +3 is for surrounding quotes and terminating '\0"
  429. lstrcpyn(szTemp, GenSettings.AdminPassword,AS(szTemp));
  430. hrPrintf=StringCchPrintf(GenSettings.AdminPassword,AS(GenSettings.AdminPassword), _T("\"%s\""), szTemp);
  431. }
  432. }
  433. else
  434. {
  435. lpValue = StrConstStar; // blank password
  436. GenSettings.bEncryptAdminPassword = FALSE; // Cannot encrypt a blank password
  437. }
  438. }
  439. else
  440. {
  441. lpValue = _T(""); // prompt user
  442. GenSettings.bEncryptAdminPassword = FALSE; // Cannot encrypt nothing
  443. }
  444. SettingQueue_AddSetting(_T("GuiUnattended"),
  445. _T("AdminPassword"),
  446. lpValue,
  447. SETTING_QUEUE_ANSWERS);
  448. // set the value in the answer file indicating that
  449. // state of the admin password
  450. SettingQueue_AddSetting(_T("GuiUnattended"),
  451. _T("EncryptedAdminPassword"),
  452. GenSettings.bEncryptAdminPassword ? _T("Yes") : _T("NO"),
  453. SETTING_QUEUE_ANSWERS);
  454. {
  455. TCHAR *lpAutoLogonCount;
  456. if( GenSettings.bAutoLogon )
  457. {
  458. lpValue = StrConstYes;
  459. hrPrintf=StringCchPrintf( Buffer, AS(Buffer), _T("%d"), GenSettings.nAutoLogonCount );
  460. lpAutoLogonCount = Buffer;
  461. }
  462. else
  463. {
  464. lpValue = _T("");
  465. lpAutoLogonCount= _T("");
  466. }
  467. SettingQueue_AddSetting(_T("GuiUnattended"),
  468. _T("AutoLogon"),
  469. lpValue,
  470. SETTING_QUEUE_ANSWERS);
  471. SettingQueue_AddSetting(_T("GuiUnattended"),
  472. _T("AutoLogonCount"),
  473. lpAutoLogonCount,
  474. SETTING_QUEUE_ANSWERS);
  475. }
  476. //
  477. // Write out whether to show Regional Settings pages in NT setup
  478. //
  479. lpValue = _T("");
  480. //
  481. // If they didn't do advanced pages and
  482. //
  483. if( ! WizGlobals.bDoAdvancedPages ) {
  484. if( GenSettings.iUnattendMode == UMODE_FULL_UNATTENDED ) {
  485. lpValue = _T("1");
  486. }
  487. }
  488. else {
  489. switch( GenSettings.iRegionalSettings ) {
  490. case REGIONAL_SETTINGS_NOT_SPECIFIED:
  491. AssertMsg(FALSE, "User went to the regional settings page but regional settings data never got set.");
  492. break;
  493. case REGIONAL_SETTINGS_SKIP:
  494. lpValue = _T("0");
  495. break;
  496. case REGIONAL_SETTINGS_DEFAULT:
  497. case REGIONAL_SETTINGS_SPECIFY:
  498. lpValue = _T("1");
  499. break;
  500. default:
  501. AssertMsg(FALSE, "Bad case for Regional Settings");
  502. break;
  503. }
  504. }
  505. SettingQueue_AddSetting(_T("GuiUnattended"),
  506. _T("OEMSkipRegional"),
  507. lpValue,
  508. SETTING_QUEUE_ANSWERS);
  509. //
  510. // Write out Sysprep OEM Duplicator string
  511. //
  512. lpValue = _T("");
  513. if ( WizGlobals.iProductInstall == PRODUCT_SYSPREP )
  514. lpValue = GenSettings.szOemDuplicatorString;
  515. SettingQueue_AddSetting(_T("GuiUnattended"),
  516. _T("OEMDuplicatorstring"),
  517. lpValue,
  518. SETTING_QUEUE_ANSWERS);
  519. //
  520. // Display settings
  521. //
  522. lpValue = _T("");
  523. if ( GenSettings.DisplayColorBits >= 0 ) {
  524. hrPrintf=StringCchPrintf(Buffer, AS(Buffer), _T("%d"), GenSettings.DisplayColorBits);
  525. lpValue = Buffer;
  526. }
  527. SettingQueue_AddSetting(_T("Display"),
  528. _T("BitsPerPel"),
  529. lpValue,
  530. SETTING_QUEUE_ANSWERS);
  531. lpValue = _T("");
  532. if ( GenSettings.DisplayXResolution >= 0 ) {
  533. hrPrintf=StringCchPrintf(Buffer, AS(Buffer), _T("%d"), GenSettings.DisplayXResolution);
  534. lpValue = Buffer;
  535. }
  536. SettingQueue_AddSetting(_T("Display"),
  537. _T("Xresolution"),
  538. lpValue,
  539. SETTING_QUEUE_ANSWERS);
  540. lpValue = _T("");
  541. if ( GenSettings.DisplayYResolution >= 0 ) {
  542. hrPrintf=StringCchPrintf(Buffer, AS(Buffer), _T("%d"), GenSettings.DisplayYResolution);
  543. lpValue = Buffer;
  544. }
  545. SettingQueue_AddSetting(_T("Display"),
  546. _T("YResolution"),
  547. lpValue,
  548. SETTING_QUEUE_ANSWERS);
  549. lpValue = _T("");
  550. if ( GenSettings.DisplayRefreshRate >= 0 ) {
  551. hrPrintf=StringCchPrintf(Buffer, AS(Buffer), _T("%d"), GenSettings.DisplayRefreshRate);
  552. lpValue = Buffer;
  553. }
  554. SettingQueue_AddSetting(_T("Display"),
  555. _T("Vrefresh"),
  556. lpValue,
  557. SETTING_QUEUE_ANSWERS);
  558. //
  559. // RunOnce commands
  560. //
  561. {
  562. TCHAR szCommandLineBuffer[MAX_INILINE_LEN + 1];
  563. INT nEntries = GetNameListSize(&GenSettings.RunOnceCmds);
  564. INT i;
  565. LPTSTR pName;
  566. for ( i=0; i<nEntries; i++ )
  567. {
  568. hrPrintf=StringCchPrintf(Buffer,AS(Buffer), _T("Command%d"), i);
  569. pName = GetNameListName(&GenSettings.RunOnceCmds, i);
  570. //
  571. // Force the command line to always be quoted
  572. //
  573. hrPrintf=StringCchPrintf( szCommandLineBuffer,AS(szCommandLineBuffer), _T("\"%s\""), pName );
  574. SettingQueue_AddSetting(_T("GuiRunOnce"),
  575. Buffer,
  576. pName,
  577. SETTING_QUEUE_ANSWERS);
  578. }
  579. }
  580. //
  581. // Timezone
  582. //
  583. // Must handle the case that the user never went to the timezone page
  584. //
  585. if ( GenSettings.TimeZoneIdx == TZ_IDX_UNDEFINED )
  586. {
  587. if ( WizGlobals.iProductInstall == PRODUCT_REMOTEINSTALL )
  588. GenSettings.TimeZoneIdx = TZ_IDX_SETSAMEASSERVER;
  589. else
  590. GenSettings.TimeZoneIdx = TZ_IDX_DONOTSPECIFY;
  591. }
  592. if( GenSettings.TimeZoneIdx == TZ_IDX_SETSAMEASSERVER )
  593. lpValue = _T("%TIMEZONE%");
  594. else if ( GenSettings.TimeZoneIdx == TZ_IDX_DONOTSPECIFY )
  595. lpValue = _T("");
  596. else {
  597. hrPrintf=StringCchPrintf(Buffer, AS(Buffer),_T("%d"), GenSettings.TimeZoneIdx);
  598. lpValue = Buffer;
  599. }
  600. SettingQueue_AddSetting(_T("GuiUnattended"),
  601. _T("TimeZone"),
  602. lpValue,
  603. SETTING_QUEUE_ANSWERS);
  604. //
  605. // Skip the Welcome page if they said 'yes' on the EULA page
  606. //
  607. if( GenSettings.bSkipEulaAndWelcome ) {
  608. SettingQueue_AddSetting(_T("GuiUnattended"),
  609. _T("OemSkipWelcome"),
  610. _T("1"),
  611. SETTING_QUEUE_ANSWERS);
  612. }
  613. //
  614. // Write out the distribution share to the [SetupMgr] section so
  615. // that we remember it on an edit.
  616. //
  617. if( WizGlobals.bStandAloneScript ) {
  618. lpValue = _T("");
  619. }
  620. else {
  621. lpValue = WizGlobals.DistFolder;
  622. }
  623. SettingQueue_AddSetting(_T("SetupMgr"),
  624. _T("DistFolder"),
  625. lpValue,
  626. SETTING_QUEUE_ANSWERS);
  627. lpValue = !WizGlobals.bStandAloneScript ? WizGlobals.DistShareName : _T("");
  628. SettingQueue_AddSetting(_T("SetupMgr"),
  629. _T("DistShare"),
  630. lpValue,
  631. SETTING_QUEUE_ANSWERS);
  632. //
  633. // Write out [Identification] section
  634. //
  635. {
  636. LPTSTR lpWorkgroup = _T("");
  637. LPTSTR lpDomain = _T("");
  638. LPTSTR lpAdmin = _T("");
  639. LPTSTR lpPassword = _T("");
  640. if( WizGlobals.iProductInstall == PRODUCT_REMOTEINSTALL ) {
  641. lpDomain = _T("%MACHINEDOMAIN%");
  642. } else if ( NetSettings.bWorkgroup ) {
  643. lpWorkgroup = NetSettings.WorkGroupName;
  644. } else {
  645. lpDomain = NetSettings.DomainName;
  646. if ( NetSettings.bCreateAccount ) {
  647. lpAdmin = NetSettings.DomainAccount;
  648. lpPassword = NetSettings.DomainPassword;
  649. }
  650. }
  651. SettingQueue_AddSetting(_T("Identification"),
  652. _T("JoinWorkgroup"),
  653. lpWorkgroup,
  654. SETTING_QUEUE_ANSWERS);
  655. SettingQueue_AddSetting(_T("Identification"),
  656. _T("JoinDomain"),
  657. lpDomain,
  658. SETTING_QUEUE_ANSWERS);
  659. SettingQueue_AddSetting(_T("Identification"),
  660. _T("DomainAdmin"),
  661. lpAdmin,
  662. SETTING_QUEUE_ANSWERS);
  663. SettingQueue_AddSetting(_T("Identification"),
  664. _T("DomainAdminPassword"),
  665. lpPassword,
  666. SETTING_QUEUE_ANSWERS);
  667. }
  668. //
  669. // Write out network settings
  670. //
  671. WriteOutNetSettings( hwnd );
  672. //
  673. // TAPI and regional settings
  674. //
  675. WriteOutTapiSettings();
  676. WriteOutRegionalSettings();
  677. //
  678. // Write out the remaining RIS specific settings
  679. //
  680. if( WizGlobals.iProductInstall == PRODUCT_REMOTEINSTALL ) {
  681. WriteOutRemoteInstallSettings();
  682. }
  683. return TRUE;
  684. }
  685. //
  686. // NTRAID#NTBUG9-551746-2002/02/27-stelo,swamip - Unused code, should be removed
  687. //
  688. //----------------------------------------------------------------------------
  689. //
  690. // Function: WriteOutMassStorageDrivers
  691. //
  692. // Purpose:
  693. //
  694. // Arguments: VOID
  695. //
  696. // Returns: VOID
  697. //
  698. //----------------------------------------------------------------------------
  699. static VOID
  700. WriteOutMassStorageDrivers( VOID ) {
  701. INT i;
  702. TCHAR *lpValue;
  703. INT iEntries = GetNameListSize( &GenSettings.MassStorageDrivers );
  704. for( i = 0; i < iEntries; i++ ) {
  705. lpValue = GetNameListName( &GenSettings.MassStorageDrivers, i );
  706. SettingQueue_AddSetting(_T("MassStorageDrivers"),
  707. lpValue,
  708. _T("OEM"),
  709. SETTING_QUEUE_ANSWERS);
  710. }
  711. }
  712. //
  713. // NTRAID#NTBUG9-551746-2002/02/27-stelo,swamip - Unused code, should be removed
  714. //
  715. //----------------------------------------------------------------------------
  716. //
  717. // Function: WriteOutOemBootFiles
  718. //
  719. // Purpose: Write out OEM Boot files (this includes the filenames for the
  720. // HAL and SCSI drivers)
  721. //
  722. // Arguments: VOID
  723. //
  724. // Returns: VOID
  725. //
  726. //----------------------------------------------------------------------------
  727. static VOID
  728. WriteOutOemBootFiles( VOID ) {
  729. INT i;
  730. TCHAR *lpValue;
  731. INT iHalEntries = GetNameListSize( &GenSettings.OemHalFiles );
  732. INT iScsiEntries = GetNameListSize( &GenSettings.OemScsiFiles );
  733. if( iHalEntries != 0 || iScsiEntries != 0 ) {
  734. //
  735. // Write out the txtsetup.oem file
  736. //
  737. SettingQueue_AddSetting(_T("OEMBootFiles"),
  738. _T(""),
  739. OEM_TXTSETUP_NAME,
  740. SETTING_QUEUE_ANSWERS);
  741. //
  742. // Write out all the HAL and SCSI files
  743. //
  744. for( i = 0; i < iHalEntries; i++ ) {
  745. lpValue = GetNameListName( &GenSettings.OemHalFiles, i );
  746. SettingQueue_AddSetting(_T("OEMBootFiles"),
  747. _T(""),
  748. lpValue,
  749. SETTING_QUEUE_ANSWERS);
  750. }
  751. for( i = 0; i < iScsiEntries; i++ ) {
  752. lpValue = GetNameListName( &GenSettings.OemScsiFiles, i );
  753. SettingQueue_AddSetting(_T("OEMBootFiles"),
  754. _T(""),
  755. lpValue,
  756. SETTING_QUEUE_ANSWERS);
  757. }
  758. }
  759. }
  760. //----------------------------------------------------------------------------
  761. //
  762. // Function: WriteOutTapiSettings
  763. //
  764. // Purpose: Queue up the remaining settings that need to be in the
  765. // answerfile tapi settings.
  766. //
  767. // Arguments: VOID
  768. //
  769. // Returns: VOID
  770. //
  771. //----------------------------------------------------------------------------
  772. static VOID
  773. WriteOutTapiSettings( VOID ) {
  774. TCHAR Buffer[MAX_INILINE_LEN];
  775. TCHAR *lpValue;
  776. HRESULT hrPrintf;
  777. //
  778. // Set or clear the country code. If user selected DONTSPECIFY, be
  779. // sure the setting is removed.
  780. //
  781. Buffer[0] = _T('\0');
  782. if( GenSettings.dwCountryCode != DONTSPECIFYSETTING )
  783. {
  784. hrPrintf=StringCchPrintf(Buffer, AS(Buffer),_T("%d"), GenSettings.dwCountryCode);
  785. }
  786. SettingQueue_AddSetting(_T("TapiLocation"),
  787. _T("CountryCode"),
  788. Buffer,
  789. SETTING_QUEUE_ANSWERS);
  790. //
  791. // Set or clear the dialing method. Make sure it is cleared if "Don't
  792. // specify setting" was selected.
  793. //
  794. if ( GenSettings.iDialingMethod == TONE )
  795. lpValue = _T("Tone");
  796. else if ( GenSettings.iDialingMethod == PULSE )
  797. lpValue = _T("Pulse");
  798. else
  799. lpValue = _T("");
  800. SettingQueue_AddSetting( _T("TapiLocation"),
  801. _T("Dialing"),
  802. lpValue,
  803. SETTING_QUEUE_ANSWERS );
  804. SettingQueue_AddSetting( _T("TapiLocation"),
  805. _T("AreaCode"),
  806. GenSettings.szAreaCode,
  807. SETTING_QUEUE_ANSWERS );
  808. Buffer[0] = _T('\0');
  809. if( GenSettings.szOutsideLine[0] != _T('\0') )
  810. {
  811. hrPrintf=StringCchPrintf( Buffer,AS(Buffer), _T("\"%s\""), GenSettings.szOutsideLine );
  812. }
  813. SettingQueue_AddSetting( _T("TapiLocation"),
  814. _T("LongDistanceAccess"),
  815. Buffer,
  816. SETTING_QUEUE_ANSWERS );
  817. }
  818. //----------------------------------------------------------------------------
  819. //
  820. // Function: WriteOutRegionalSettings
  821. //
  822. // Purpose: Queue up the remaining settings that need to be in the
  823. // answerfile regional settings.
  824. //
  825. // Arguments: VOID
  826. //
  827. // Returns: VOID
  828. //
  829. //----------------------------------------------------------------------------
  830. static VOID
  831. WriteOutRegionalSettings( VOID ) {
  832. TCHAR Buffer[MAX_INILINE_LEN] = _T("");
  833. LPTSTR lpLanguageGroup = _T("");
  834. LPTSTR lpLanguage = _T("");
  835. LPTSTR lpSystemLocale = _T("");
  836. LPTSTR lpUserLocale = _T("");
  837. LPTSTR lpInputLocale = _T("");
  838. if( GenSettings.iRegionalSettings == REGIONAL_SETTINGS_SPECIFY ) {
  839. if( GenSettings.bUseCustomLocales ) {
  840. lpSystemLocale = GenSettings.szMenuLanguage;
  841. lpUserLocale = GenSettings.szNumberLanguage;
  842. lpInputLocale = GenSettings.szKeyboardLayout;
  843. }
  844. else {
  845. lpLanguage = GenSettings.szLanguage;
  846. }
  847. }
  848. if( GetNameListSize( &GenSettings.LanguageGroups ) > 0 ) {
  849. NamelistToCommaString( &GenSettings.LanguageGroups, Buffer, AS(Buffer) );
  850. lpLanguageGroup = Buffer;
  851. }
  852. SettingQueue_AddSetting(_T("RegionalSettings"),
  853. _T("LanguageGroup"),
  854. lpLanguageGroup,
  855. SETTING_QUEUE_ANSWERS);
  856. SettingQueue_AddSetting(_T("RegionalSettings"),
  857. _T("Language"),
  858. lpLanguage,
  859. SETTING_QUEUE_ANSWERS);
  860. SettingQueue_AddSetting(_T("RegionalSettings"),
  861. _T("SystemLocale"),
  862. lpSystemLocale,
  863. SETTING_QUEUE_ANSWERS);
  864. SettingQueue_AddSetting(_T("RegionalSettings"),
  865. _T("UserLocale"),
  866. lpUserLocale,
  867. SETTING_QUEUE_ANSWERS);
  868. SettingQueue_AddSetting(_T("RegionalSettings"),
  869. _T("InputLocale"),
  870. lpInputLocale,
  871. SETTING_QUEUE_ANSWERS);
  872. }
  873. //----------------------------------------------------------------------------
  874. //
  875. // Function: WriteOutRemoteInstallSettings
  876. //
  877. // Purpose: Queue up the remaining settings that need to be in the
  878. // answerfile for a remote install to work.
  879. //
  880. // Arguments: VOID
  881. //
  882. // Returns: VOID
  883. //
  884. //----------------------------------------------------------------------------
  885. //
  886. // Some long string constants used by this function
  887. //
  888. #define RIS_ORISRC _T("\"\\\\%SERVERNAME%\\RemInst\\%INSTALLPATH%\"")
  889. #define RIS_SRCDEVICE _T("\"\\Device\\LanmanRedirector\\") \
  890. _T("%SERVERNAME%\\RemInst\\%INSTALLPATH%\"")
  891. #define RIS_LAUNCHFILE _T("\"%INSTALLPATH%\\%MACHINETYPE%\\templates\\startrom.com\"")
  892. static VOID
  893. WriteOutRemoteInstallSettings(VOID)
  894. {
  895. SettingQueue_AddSetting(_T("Data"),
  896. _T("floppyless"),
  897. _T("\"1\""),
  898. SETTING_QUEUE_ANSWERS);
  899. SettingQueue_AddSetting(_T("Data"),
  900. _T("msdosinitiated"),
  901. _T("\"1\""),
  902. SETTING_QUEUE_ANSWERS);
  903. SettingQueue_AddSetting(_T("Data"),
  904. _T("OriSrc"),
  905. RIS_ORISRC,
  906. SETTING_QUEUE_ANSWERS);
  907. SettingQueue_AddSetting(_T("Data"),
  908. _T("OriTyp"),
  909. _T("\"4\""),
  910. SETTING_QUEUE_ANSWERS);
  911. SettingQueue_AddSetting(_T("Data"),
  912. _T("LocalSourceOnCD"),
  913. _T("1"),
  914. SETTING_QUEUE_ANSWERS);
  915. //
  916. // [SetupData] section. This section is only written out if RIS.
  917. //
  918. SettingQueue_AddSetting(_T("SetupData"),
  919. _T("OsLoadOptions"),
  920. _T("/noguiboot /fastdetect"),
  921. SETTING_QUEUE_ANSWERS);
  922. SettingQueue_AddSetting(_T("SetupData"),
  923. _T("SetupSourceDevice"),
  924. RIS_SRCDEVICE,
  925. SETTING_QUEUE_ANSWERS);
  926. //
  927. // Write some RIS specific settings to [Unattended]. Only write settings
  928. // that QueueSettingsToAnswerFile() does not write.
  929. //
  930. // RIS requires these settings to be present in the .sif and requires
  931. // them to have a fixed value. We will not preserve the value we read
  932. // on an edit (in case user changed it by hand).
  933. //
  934. SettingQueue_AddSetting(_T("Unattended"),
  935. _T("FileSystem"),
  936. _T("LeaveAlone"),
  937. SETTING_QUEUE_ANSWERS);
  938. SettingQueue_AddSetting(_T("Unattended"),
  939. _T("NtUpgrade"),
  940. StrConstNo,
  941. SETTING_QUEUE_ANSWERS);
  942. SettingQueue_AddSetting(_T("Unattended"),
  943. _T("OverwriteOemFilesOnUpgrade"),
  944. StrConstNo,
  945. SETTING_QUEUE_ANSWERS);
  946. //
  947. // Additional settings for
  948. // [RemoteInstall]
  949. // [Display]
  950. // [Networking]
  951. // [Identification]
  952. // [OSChooser]
  953. //
  954. SettingQueue_AddSetting(_T("RemoteInstall"),
  955. _T("Repartition"),
  956. StrConstYes,
  957. SETTING_QUEUE_ANSWERS);
  958. SettingQueue_AddSetting(_T("Networking"),
  959. _T("ProcessPageSections"),
  960. StrConstYes,
  961. SETTING_QUEUE_ANSWERS);
  962. SettingQueue_AddSetting(_T("Identification"),
  963. _T("DoOldStyleDomainJoin"),
  964. StrConstYes,
  965. SETTING_QUEUE_ANSWERS);
  966. SettingQueue_AddSetting(_T("OSChooser"),
  967. _T("Description"),
  968. GenSettings.szSifDescription,
  969. SETTING_QUEUE_ANSWERS);
  970. SettingQueue_AddSetting(_T("OSChooser"),
  971. _T("Help"),
  972. GenSettings.szSifHelpText,
  973. SETTING_QUEUE_ANSWERS);
  974. SettingQueue_AddSetting(_T("OSChooser"),
  975. _T("LaunchFile"),
  976. RIS_LAUNCHFILE,
  977. SETTING_QUEUE_ANSWERS);
  978. SettingQueue_AddSetting(_T("OSChooser"),
  979. _T("ImageType"),
  980. _T("Flat"),
  981. SETTING_QUEUE_ANSWERS);
  982. }
  983. //
  984. // Write out the IE Favorites
  985. //
  986. static VOID
  987. WriteOutIeFavorites( VOID )
  988. {
  989. INT nEntries = GetNameListSize( &GenSettings.Favorites );
  990. INT i;
  991. INT iEntryNumber;
  992. LPTSTR pFriendlyName;
  993. LPTSTR pWebAddress;
  994. TCHAR Key[MAX_INILINE_LEN + 1];
  995. TCHAR Value[MAX_INILINE_LEN + 1];
  996. HRESULT hrPrintf;
  997. // ISSUE-2002/02/27-stelo - make sure to clear the entries if they are no favorites
  998. for( i = 0; i < nEntries; i = i + 2 )
  999. {
  1000. iEntryNumber = ( i / 2 ) + 1;
  1001. pFriendlyName = GetNameListName( &GenSettings.Favorites, i );
  1002. pWebAddress = GetNameListName( &GenSettings.Favorites, i + 1 );
  1003. hrPrintf=StringCchPrintf( Key,AS(Key),
  1004. _T("Title%d"),
  1005. iEntryNumber );
  1006. //
  1007. // Always quote the friendly name
  1008. //
  1009. hrPrintf=StringCchPrintf( Value,AS(Value),
  1010. _T("\"%s.url\""),
  1011. pFriendlyName );
  1012. SettingQueue_AddSetting( _T("FavoritesEx"),
  1013. Key,
  1014. Value,
  1015. SETTING_QUEUE_ANSWERS );
  1016. hrPrintf=StringCchPrintf( Key,AS(Key),
  1017. _T("URL%d"),
  1018. iEntryNumber );
  1019. //
  1020. // Always quote the web address
  1021. //
  1022. hrPrintf=StringCchPrintf( Value,AS(Value),
  1023. _T("\"%s\""),
  1024. pWebAddress );
  1025. SettingQueue_AddSetting( _T("FavoritesEx"),
  1026. Key,
  1027. Value,
  1028. SETTING_QUEUE_ANSWERS );
  1029. }
  1030. }
  1031. static LPTSTR
  1032. AllocateAddressPortString( LPTSTR lpszAddressString, LPTSTR lpszPortString )
  1033. {
  1034. LPTSTR lpszAddressPortString;
  1035. int iAddressPortStringLen;
  1036. HRESULT hrCat;
  1037. iAddressPortStringLen=(lstrlen(lpszAddressString) + lstrlen(lpszPortString) + 2);
  1038. lpszAddressPortString = MALLOC(iAddressPortStringLen * sizeof(TCHAR) );
  1039. if ( lpszAddressPortString )
  1040. {
  1041. lstrcpyn( lpszAddressPortString, lpszAddressString, iAddressPortStringLen);
  1042. if ( *lpszPortString )
  1043. {
  1044. hrCat=StringCchCat( lpszAddressPortString, iAddressPortStringLen, _T(":") );
  1045. hrCat=StringCchCat( lpszAddressPortString, iAddressPortStringLen, lpszPortString );
  1046. }
  1047. }
  1048. return lpszAddressPortString;
  1049. }
  1050. //----------------------------------------------------------------------------
  1051. //
  1052. // Function: WriteOutIeSettings
  1053. //
  1054. // Purpose: Queue up the answerfile settings for IE.
  1055. //
  1056. // Arguments: VOID
  1057. //
  1058. // Returns: VOID
  1059. //
  1060. //----------------------------------------------------------------------------
  1061. static VOID
  1062. WriteOutIeSettings( VOID )
  1063. {
  1064. LPTSTR lpIeBrandingFile = _T("");
  1065. LPTSTR lpAutoConfig = _T("");
  1066. LPTSTR lpAutoConfigUrl = _T("");
  1067. LPTSTR lpAutoConfigUrlJscript = _T("");
  1068. LPTSTR lpUseProxyServer = _T("");
  1069. LPTSTR lpUseSameProxyForAllProtocols = _T("");
  1070. LPTSTR lpProxyExceptions = _T("");
  1071. LPTSTR lpHomePage = _T("");
  1072. LPTSTR lpHelpPage = _T("");
  1073. LPTSTR lpSearchPage = _T("");
  1074. LPTSTR lpHttpProxy = NULL;
  1075. LPTSTR lpSecureProxy = NULL;
  1076. LPTSTR lpFtpProxy = NULL;
  1077. LPTSTR lpGopherProxy = NULL;
  1078. LPTSTR lpSocksProxy = NULL;
  1079. LPTSTR lpUseUnattendFileForBranding = _T("Yes");
  1080. HRESULT hrCat;
  1081. if( GenSettings.IeCustomizeMethod == IE_NO_CUSTOMIZATION )
  1082. {
  1083. //
  1084. // Don't write out any IE keys when the choose not to customize IE
  1085. //
  1086. return;
  1087. }
  1088. else if( GenSettings.IeCustomizeMethod == IE_USE_BRANDING_FILE )
  1089. {
  1090. lpIeBrandingFile = GenSettings.szInsFile;
  1091. lpUseUnattendFileForBranding = _T("No");
  1092. //
  1093. // Write out the Auto Config settings
  1094. //
  1095. if( GenSettings.bUseAutoConfigScript )
  1096. {
  1097. lpAutoConfig = _T("1");
  1098. lpAutoConfigUrl = GenSettings.szAutoConfigUrl;
  1099. lpAutoConfigUrlJscript = GenSettings.szAutoConfigUrlJscriptOrPac;
  1100. }
  1101. else
  1102. {
  1103. lpAutoConfig = _T("0");
  1104. }
  1105. }
  1106. //
  1107. // Write out the proxy settings
  1108. //
  1109. if( GenSettings.bUseProxyServer )
  1110. {
  1111. lpUseProxyServer = _T("1");
  1112. }
  1113. else
  1114. {
  1115. lpUseProxyServer = _T("0");
  1116. }
  1117. if( GenSettings.bUseSameProxyForAllProtocols )
  1118. {
  1119. lpUseSameProxyForAllProtocols = _T("1");
  1120. }
  1121. else
  1122. {
  1123. lpUseSameProxyForAllProtocols = _T("0");
  1124. }
  1125. //
  1126. // For each proxy server, if the port is not empty concatenate it.
  1127. //
  1128. lpHttpProxy = AllocateAddressPortString( GenSettings.szHttpProxyAddress, GenSettings.szHttpProxyPort );
  1129. //
  1130. // Only write out the proxy server if they aren't using the same one
  1131. //
  1132. if( ! GenSettings.bUseSameProxyForAllProtocols )
  1133. {
  1134. lpSecureProxy = AllocateAddressPortString( GenSettings.szSecureProxyAddress, GenSettings.szSecureProxyPort );
  1135. lpFtpProxy = AllocateAddressPortString( GenSettings.szFtpProxyAddress, GenSettings.szFtpProxyPort );
  1136. lpGopherProxy = AllocateAddressPortString( GenSettings.szGopherProxyAddress, GenSettings.szGopherProxyPort );
  1137. lpSocksProxy = AllocateAddressPortString( GenSettings.szSocksProxyAddress, GenSettings.szSocksProxyPort );
  1138. }
  1139. //
  1140. // Append the string <local> to the exception list if the user wants to
  1141. // bypass the proxy for local addresses
  1142. //
  1143. if( GenSettings.bBypassProxyForLocalAddresses )
  1144. {
  1145. if( GenSettings.szProxyExceptions[0] != _T('\0') )
  1146. {
  1147. INT iLastChar;
  1148. iLastChar = lstrlen( GenSettings.szProxyExceptions );
  1149. if( GenSettings.szProxyExceptions[iLastChar - 1] != _T(';') )
  1150. {
  1151. hrCat=StringCchCat( GenSettings.szProxyExceptions, AS(GenSettings.szProxyExceptions),_T(";") );
  1152. }
  1153. }
  1154. hrCat=StringCchCat( GenSettings.szProxyExceptions, AS(GenSettings.szProxyExceptions),_T("<local>") );
  1155. }
  1156. lpProxyExceptions = GenSettings.szProxyExceptions;
  1157. lpHomePage = GenSettings.szHomePage;
  1158. lpHelpPage = GenSettings.szHelpPage;
  1159. lpSearchPage = GenSettings.szSearchPage;
  1160. //
  1161. // Write out the IE Favorites...
  1162. //
  1163. WriteOutIeFavorites( );
  1164. SettingQueue_AddSetting( _T("Branding"),
  1165. _T("BrandIEUsingUnattended"),
  1166. lpUseUnattendFileForBranding,
  1167. SETTING_QUEUE_ANSWERS );
  1168. SettingQueue_AddSetting( _T("Branding"),
  1169. _T("IEBrandingFile"),
  1170. lpIeBrandingFile,
  1171. SETTING_QUEUE_ANSWERS );
  1172. SettingQueue_AddSetting( _T("URL"),
  1173. _T("AutoConfig"),
  1174. lpAutoConfig,
  1175. SETTING_QUEUE_ANSWERS );
  1176. SettingQueue_AddSetting( _T("URL"),
  1177. _T("AutoConfigURL"),
  1178. lpAutoConfigUrl,
  1179. SETTING_QUEUE_ANSWERS );
  1180. SettingQueue_AddSetting( _T("URL"),
  1181. _T("AutoConfigJSURL"),
  1182. lpAutoConfigUrlJscript,
  1183. SETTING_QUEUE_ANSWERS );
  1184. SettingQueue_AddSetting( _T("Proxy"),
  1185. _T("Proxy_Enable"),
  1186. lpUseProxyServer,
  1187. SETTING_QUEUE_ANSWERS );
  1188. SettingQueue_AddSetting( _T("Proxy"),
  1189. _T("Use_Same_Proxy"),
  1190. lpUseSameProxyForAllProtocols,
  1191. SETTING_QUEUE_ANSWERS );
  1192. SettingQueue_AddSetting( _T("Proxy"),
  1193. _T("HTTP_Proxy_Server"),
  1194. lpHttpProxy ? lpHttpProxy : _T(""),
  1195. SETTING_QUEUE_ANSWERS );
  1196. SettingQueue_AddSetting( _T("Proxy"),
  1197. _T("Secure_Proxy_Server"),
  1198. lpSecureProxy ? lpSecureProxy : _T(""),
  1199. SETTING_QUEUE_ANSWERS );
  1200. SettingQueue_AddSetting( _T("Proxy"),
  1201. _T("FTP_Proxy_Server"),
  1202. lpFtpProxy ? lpFtpProxy : _T(""),
  1203. SETTING_QUEUE_ANSWERS );
  1204. SettingQueue_AddSetting( _T("Proxy"),
  1205. _T("Gopher_Proxy_Server"),
  1206. lpGopherProxy ? lpGopherProxy : _T(""),
  1207. SETTING_QUEUE_ANSWERS );
  1208. SettingQueue_AddSetting( _T("Proxy"),
  1209. _T("Socks_Proxy_Server"),
  1210. lpSocksProxy ? lpSocksProxy : _T(""),
  1211. SETTING_QUEUE_ANSWERS );
  1212. SettingQueue_AddSetting( _T("Proxy"),
  1213. _T("Proxy_Override"),
  1214. lpProxyExceptions,
  1215. SETTING_QUEUE_ANSWERS );
  1216. SettingQueue_AddSetting( _T("URL"),
  1217. _T("Home_Page"),
  1218. lpHomePage,
  1219. SETTING_QUEUE_ANSWERS );
  1220. SettingQueue_AddSetting( _T("URL"),
  1221. _T("Help_Page"),
  1222. lpHelpPage,
  1223. SETTING_QUEUE_ANSWERS );
  1224. SettingQueue_AddSetting( _T("URL"),
  1225. _T("Search_Page"),
  1226. lpSearchPage,
  1227. SETTING_QUEUE_ANSWERS );
  1228. //
  1229. // Free any memory we may have allocated...
  1230. //
  1231. if ( lpHttpProxy )
  1232. FREE ( lpHttpProxy );
  1233. if ( lpSecureProxy )
  1234. FREE ( lpSecureProxy );
  1235. if ( lpFtpProxy )
  1236. FREE ( lpFtpProxy );
  1237. if ( lpGopherProxy )
  1238. FREE ( lpGopherProxy );
  1239. if ( lpSocksProxy )
  1240. FREE ( lpSocksProxy );
  1241. }