Source code of Windows XP (NT5)
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.

1015 lines
31 KiB

  1. //----------------------------------------------------------------------------
  2. //
  3. // Copyright (c) 1997-1999 Microsoft Corporation
  4. // All rights reserved.
  5. //
  6. // File Name:
  7. // init.c
  8. //
  9. // Description: This file contains all of the functions that handle
  10. // initialization of the App.
  11. //
  12. //----------------------------------------------------------------------------
  13. #include "pch.h"
  14. #include "allres.h"
  15. //
  16. // Net support
  17. //
  18. static VOID
  19. LoadStringsAndDefaultsForNetworkComponents( VOID);
  20. //
  21. // Timezone support
  22. //
  23. static BOOL ReadZoneData(TIME_ZONE_ENTRY* zone, HKEY key);
  24. static TIME_ZONE_LIST *BuildTimeZoneList(VOID);
  25. //
  26. // Regional Settings support
  27. //
  28. static VOID BuildLanguageLists( VOID );
  29. extern BOOL GetCommaDelimitedEntry( OUT TCHAR szString[],
  30. IN OUT TCHAR **pBuffer );
  31. //----------------------------------------------------------------------------
  32. //
  33. // Function: InitTheWizard
  34. //
  35. // Purpose: Performs one time initialization for the App. This function
  36. // is to be called once and only once each time the App is run.
  37. //
  38. // Arguments: VOID
  39. //
  40. // Returns: VOID
  41. //
  42. //----------------------------------------------------------------------------
  43. VOID InitTheWizard(VOID) {
  44. //
  45. // Save the dir the program was launched from
  46. //
  47. GetCurrentDirectory( MAX_PATH + 1, FixedGlobals.szSavePath );
  48. //
  49. // Have to load the strings for the titles on the networking property
  50. // sheets here because the title is displayed before the WM_INITDIALOG
  51. // message is sent
  52. //
  53. g_StrTcpipTitle = MyLoadString( IDS_TCPIP_TITLE );
  54. g_StrAdvancedTcpipSettings = MyLoadString( IDS_ADVANCED_TCPIP_SETTINGS );
  55. g_StrIpxProtocolTitle = MyLoadString( IDS_IPX_PROTOCOL_TITLE );
  56. g_StrAppletalkProtocolTitle = MyLoadString( IDS_APPLETALK_TITLE );
  57. g_StrMsClientTitle = MyLoadString( IDS_MSCLIENT_TITLE );
  58. //
  59. // Initialize network settings
  60. //
  61. NetSettings.NetworkAdapterHead = malloc( sizeof( NETWORK_ADAPTER_NODE ) );
  62. NetSettings.pCurrentAdapter = NetSettings.NetworkAdapterHead;
  63. CreateListWithDefaults( NetSettings.pCurrentAdapter );
  64. //
  65. // Initialize the number of network card variables
  66. //
  67. NetSettings.iNumberOfNetworkCards = 1;
  68. NetSettings.iCurrentNetworkCard = 1;
  69. NetSettings.NetworkAdapterHead->next = NULL;
  70. LoadStringsAndDefaultsForNetworkComponents();
  71. //
  72. // Build the list of timezones
  73. //
  74. FixedGlobals.TimeZoneList = BuildTimeZoneList();
  75. //
  76. // Build the list of Language Groups and Locales
  77. //
  78. BuildLanguageLists();
  79. }
  80. //--------------------------------------------------------------------------
  81. //
  82. // Support for loading timezone info from the registry
  83. //
  84. //--------------------------------------------------------------------------
  85. //--------------------------------------------------------------------------
  86. //
  87. // Function: ReadZoneData
  88. //
  89. // Purpose: Fills in a TIME_ZONE_ENTRY.
  90. //
  91. // Returns: BOOL
  92. //
  93. //--------------------------------------------------------------------------
  94. static BOOL ReadZoneData(TIME_ZONE_ENTRY* zone, HKEY key)
  95. {
  96. DWORD len;
  97. //
  98. // Get the display name
  99. //
  100. len = sizeof(zone->DisplayName);
  101. if ( RegQueryValueEx(key,
  102. REGVAL_TZ_DISPLAY,
  103. 0,
  104. NULL,
  105. (LPBYTE)zone->DisplayName,
  106. &len) != ERROR_SUCCESS ) {
  107. return (FALSE);
  108. }
  109. //
  110. // Get the StandardName
  111. //
  112. len = sizeof(zone->StdName);
  113. if ( RegQueryValueEx(key,
  114. REGVAL_TZ_STDNAME,
  115. 0,
  116. NULL,
  117. (LPBYTE)zone->StdName,
  118. &len) != ERROR_SUCCESS ) {
  119. return (FALSE);
  120. }
  121. //
  122. // Get the number associatted with this timezone
  123. //
  124. zone->Index = 0;
  125. len = sizeof(zone->Index);
  126. if ( RegQueryValueEx(key,
  127. REGVAL_TZ_INDEX,
  128. 0,
  129. NULL,
  130. (LPBYTE)&zone->Index,
  131. &len) != ERROR_SUCCESS ) {
  132. return (FALSE);
  133. }
  134. return (TRUE);
  135. }
  136. //----------------------------------------------------------------------------
  137. //
  138. // Function: InsertZone
  139. //
  140. // Purpose: Inserts a timezone entry into the timezone list maintains a sorted
  141. // order.
  142. //
  143. // Arguments: IN OUT TIME_ZONE_LIST *TzList - time zone list the entry is to
  144. // be inserted to
  145. // IN TIME_ZONE_ENTRY NewTimeZoneEntry - the timezone entry to be
  146. // inserted
  147. // IN INT iNumberOfZonesInserted - number of timezone entries
  148. // already inserted in to the TzList
  149. //
  150. // Returns: VOID
  151. //
  152. //----------------------------------------------------------------------------
  153. VOID
  154. InsertZone( IN OUT TIME_ZONE_LIST *TzList,
  155. IN TIME_ZONE_ENTRY NewTimeZoneEntry,
  156. IN INT iNumberOfZonesInserted ) {
  157. INT i = 0;
  158. INT j;
  159. while( i < iNumberOfZonesInserted ) {
  160. if( TzList->TimeZones[i].Index < NewTimeZoneEntry.Index ) {
  161. i++;
  162. }
  163. else {
  164. break; // we found the insertion point
  165. }
  166. }
  167. //
  168. // Slide all the entries up 1 to make room for the new entry
  169. //
  170. for( j = iNumberOfZonesInserted - 1; j >= i; j-- ) {
  171. lstrcpyn( TzList->TimeZones[j+1].DisplayName,
  172. TzList->TimeZones[j].DisplayName, AS(TzList->TimeZones[j+1].DisplayName) );
  173. lstrcpyn( TzList->TimeZones[j+1].StdName,
  174. TzList->TimeZones[j].StdName, AS(TzList->TimeZones[j+1].StdName) );
  175. TzList->TimeZones[j+1].Index = TzList->TimeZones[j].Index;
  176. }
  177. //
  178. // Add the new entry to the array
  179. //
  180. lstrcpyn( TzList->TimeZones[i].DisplayName, NewTimeZoneEntry.DisplayName, AS(TzList->TimeZones[i].DisplayName) );
  181. lstrcpyn( TzList->TimeZones[i].StdName, NewTimeZoneEntry.StdName, AS(TzList->TimeZones[i].StdName) );
  182. TzList->TimeZones[i].Index = NewTimeZoneEntry.Index;
  183. }
  184. //--------------------------------------------------------------------------
  185. //
  186. // Function: BuildTimeZoneList
  187. //
  188. // Purpose: Mallocs and fills in a TIME_ZONE_LIST which has an array of
  189. // timezone data.
  190. //
  191. // Returns: BOOL - success
  192. //
  193. //--------------------------------------------------------------------------
  194. static TIME_ZONE_LIST *BuildTimeZoneList(VOID)
  195. {
  196. HKEY TimeZoneRootKey = NULL;
  197. WCHAR SubKeyName[TZNAME_SIZE];
  198. HKEY SubKey = NULL;
  199. int i;
  200. INT iNumberOfZonesInserted;
  201. TIME_ZONE_ENTRY TempTimeZoneEntry;
  202. DWORD NumTimeZones = 0;
  203. TIME_ZONE_LIST *TzList;
  204. TCHAR *szTempString;
  205. //
  206. // Open the root of the timezone list in the registry.
  207. //
  208. if (RegOpenKey( HKEY_LOCAL_MACHINE,
  209. REGKEY_TIMEZONES,
  210. &TimeZoneRootKey ) != ERROR_SUCCESS) {
  211. return NULL;
  212. }
  213. //
  214. // Find out how many sub-keys (timezones) there are.
  215. //
  216. RegQueryInfoKey(TimeZoneRootKey,
  217. NULL,
  218. NULL,
  219. NULL,
  220. &NumTimeZones,
  221. NULL,
  222. NULL,
  223. NULL,
  224. NULL,
  225. NULL,
  226. NULL,
  227. NULL);
  228. //
  229. // We need to fudge the number of TIME_ZONE_ENTRIES because we add
  230. // 2 special ones "Set Same As Server" and "Do Not Specify".
  231. //
  232. NumTimeZones += 2;
  233. //
  234. // Malloc the memory we need
  235. //
  236. if ( (TzList = malloc(sizeof(TIME_ZONE_LIST))) == NULL ) {
  237. RegCloseKey(TimeZoneRootKey);
  238. return NULL;
  239. }
  240. TzList->NumEntries = NumTimeZones;
  241. TzList->TimeZones = malloc(NumTimeZones * sizeof(TIME_ZONE_ENTRY));
  242. if ( TzList->TimeZones == NULL ) {
  243. RegCloseKey(TimeZoneRootKey);
  244. free(TzList);
  245. return NULL;
  246. }
  247. //
  248. // Enumerate the sub-keys under the timezone root. Each key at this
  249. // level is the standard name of a timezone. Under that key are
  250. // the values we care about. Call ReadZoneData() for each one to
  251. // retrieve the display name and index.
  252. //
  253. i = 0;
  254. iNumberOfZonesInserted = 0;
  255. while ( RegEnumKey(TimeZoneRootKey,
  256. i,
  257. SubKeyName,
  258. TZNAME_SIZE) == ERROR_SUCCESS) {
  259. if (RegOpenKey(TimeZoneRootKey,
  260. SubKeyName,
  261. &SubKey) == ERROR_SUCCESS) {
  262. if ( ReadZoneData( &TempTimeZoneEntry, SubKey) ) {
  263. InsertZone( TzList,
  264. TempTimeZoneEntry,
  265. iNumberOfZonesInserted );
  266. iNumberOfZonesInserted++;
  267. }
  268. }
  269. RegCloseKey(SubKey);
  270. i++;
  271. }
  272. RegCloseKey(TimeZoneRootKey);
  273. //
  274. // Put the 2 special entries in at the end of the list
  275. //
  276. szTempString = MyLoadString(IDS_DONTSPECIFYSETTING);
  277. if (szTempString == NULL)
  278. {
  279. free(TzList->TimeZones);
  280. free(TzList);
  281. return NULL;
  282. }
  283. lstrcpyn(TzList->TimeZones[NumTimeZones-2].DisplayName, szTempString, AS(TzList->TimeZones[NumTimeZones-2].DisplayName));
  284. lstrcpyn(TzList->TimeZones[NumTimeZones-2].StdName, _T(""), AS(TzList->TimeZones[NumTimeZones-2].StdName));
  285. TzList->TimeZones[NumTimeZones-2].Index = TZ_IDX_DONOTSPECIFY;
  286. free( szTempString );
  287. szTempString = MyLoadString(IDS_SET_SAME_AS_SERVER);
  288. if (szTempString == NULL)
  289. {
  290. free(TzList->TimeZones);
  291. free(TzList);
  292. return NULL;
  293. }
  294. lstrcpyn(TzList->TimeZones[NumTimeZones-1].DisplayName, szTempString, AS(TzList->TimeZones[NumTimeZones-1].DisplayName));
  295. lstrcpyn(TzList->TimeZones[NumTimeZones-1].StdName, _T(""), AS(TzList->TimeZones[NumTimeZones-1].StdName));
  296. TzList->TimeZones[NumTimeZones-1].Index = TZ_IDX_SETSAMEASSERVER;
  297. free(szTempString);
  298. //
  299. // Add in the 2 special strings
  300. //
  301. iNumberOfZonesInserted = iNumberOfZonesInserted + 2;
  302. if ( iNumberOfZonesInserted != (int) NumTimeZones ) {
  303. free(TzList->TimeZones);
  304. free(TzList);
  305. return NULL;
  306. }
  307. return TzList;
  308. }
  309. //----------------------------------------------------------------------------
  310. //
  311. // Function: ReadAllFilesUnderSection
  312. //
  313. // Purpose:
  314. //
  315. // Arguments:
  316. //
  317. // Returns: VOID
  318. //
  319. //----------------------------------------------------------------------------
  320. static VOID
  321. ReadAllFilesUnderSection( IN HINF hInterntlInf,
  322. IN LPCTSTR pszSubSectionName,
  323. OUT NAMELIST *CurrentNameList )
  324. {
  325. TCHAR szLangFileName[MAX_PATH + 1];
  326. INFCONTEXT LangInfContext = { 0 };
  327. INT iRet;
  328. AssertMsg( hInterntlInf != INVALID_HANDLE_VALUE,
  329. "Bad handle" );
  330. AssertMsg( GetNameListSize( CurrentNameList ) < 100,
  331. "Too many entries" );
  332. iRet = SetupFindFirstLine( hInterntlInf, pszSubSectionName, NULL, &LangInfContext );
  333. if( iRet == 0 )
  334. {
  335. //
  336. // If the subsection can't be found, just return. When this happens, it
  337. // mostly likely means there are no files under this subsection.
  338. //
  339. return;
  340. }
  341. do {
  342. szLangFileName[0] = _T('\0');
  343. iRet = SetupGetStringField( &LangInfContext,
  344. 1,
  345. szLangFileName,
  346. MAX_PATH,
  347. NULL );
  348. if( iRet == 0 )
  349. {
  350. //
  351. // If a file cannot be obtained, move on to the next one.
  352. //
  353. continue;
  354. }
  355. if( szLangFileName[0] != _T('\0') )
  356. {
  357. AddNameToNameListNoDuplicates( CurrentNameList,
  358. szLangFileName );
  359. }
  360. } // move to the next line of the .inf file
  361. while( SetupFindNextLine( &LangInfContext, &LangInfContext ) );
  362. }
  363. //----------------------------------------------------------------------------
  364. //
  365. // Function: BuildAdditionalLanguageList
  366. //
  367. // Purpose: Populate the LangGroupAdditionalFiles array
  368. //
  369. // LangGroupAdditionalFiles is a dynamically allocated array of Namelists
  370. // that contain the extra files in the intl.inf that need to be copied for
  371. // a language group in addition to its sub-directory.
  372. //
  373. // Arguments:
  374. //
  375. // Returns: VOID
  376. //
  377. //----------------------------------------------------------------------------
  378. static VOID
  379. BuildAdditionalLanguageList( IN HINF hInterntlInf, IN const INT iLangGroupCount )
  380. {
  381. INT i;
  382. INT j;
  383. INT iRetVal;
  384. INT iSubSectionEntries;
  385. TCHAR szBuffer[MAX_INILINE_LEN];
  386. TCHAR szIniBuffer[MAX_INILINE_LEN];
  387. TCHAR szSectionName[MAX_INILINE_LEN];
  388. TCHAR szIntlInf[MAX_PATH + 1];
  389. TCHAR *pszSubSectionName;
  390. TCHAR *pszIniBuffer;
  391. NAMELIST SubSectionList = { 0 };
  392. HRESULT hrCat;
  393. AssertMsg( hInterntlInf != INVALID_HANDLE_VALUE,
  394. "Bad handle" );
  395. iRetVal = GetWindowsDirectory( szIntlInf, MAX_PATH );
  396. if( iRetVal == 0 || iRetVal > MAX_PATH )
  397. {
  398. return;
  399. }
  400. hrCat=StringCchCat( szIntlInf, AS(szIntlInf), _T("\\inf\\intl.inf") );
  401. FixedGlobals.LangGroupAdditionalFiles = malloc( sizeof(NAMELIST) * iLangGroupCount );
  402. if (FixedGlobals.LangGroupAdditionalFiles == NULL)
  403. {
  404. TerminateTheWizard(IDS_ERROR_OUTOFMEMORY);
  405. }
  406. ZeroMemory( FixedGlobals.LangGroupAdditionalFiles,
  407. sizeof(NAMELIST) * iLangGroupCount );
  408. for( i = 1; i <= iLangGroupCount; i++ )
  409. {
  410. lstrcpyn( szSectionName, _T("LG_INSTALL_"), AS(szSectionName) );
  411. hrCat=StringCchCat( szSectionName, AS(szSectionName), _itot( i, szBuffer, 10 ) );
  412. GetPrivateProfileString( szSectionName,
  413. _T("CopyFiles"),
  414. _T(""),
  415. szIniBuffer,
  416. StrBuffSize(szIniBuffer),
  417. szIntlInf );
  418. //
  419. // Loop grabbing each of the sub-section names and inserting them into
  420. // the namelist
  421. //
  422. pszIniBuffer = szIniBuffer;
  423. while( GetCommaDelimitedEntry( szBuffer, &pszIniBuffer ) )
  424. {
  425. AddNameToNameListNoDuplicates( &SubSectionList,
  426. szBuffer );
  427. }
  428. iSubSectionEntries = GetNameListSize( &SubSectionList );
  429. for( j = 0; j < iSubSectionEntries; j++ )
  430. {
  431. pszSubSectionName = GetNameListName( &SubSectionList, j );
  432. ReadAllFilesUnderSection( hInterntlInf,
  433. pszSubSectionName,
  434. &( FixedGlobals.LangGroupAdditionalFiles[i - 1] ) );
  435. }
  436. ResetNameList( &SubSectionList );
  437. }
  438. }
  439. //----------------------------------------------------------------------------
  440. //
  441. // Function: BuildLanguageLists
  442. //
  443. // Purpose: Mallocs and fills in a LANGUAGEGROUP_LIST and a LANGUAGELOCALE_LIST
  444. // which are lists that that maintain language settings read from intl.inf
  445. //
  446. // Adjusts the global variables FixedGlobals.LanguageGroupList and
  447. // FixedGlobals.LanguageLocaleList to point to their respective lists
  448. //
  449. // Arguments: VOID
  450. //
  451. // Returns: VOID
  452. //
  453. //----------------------------------------------------------------------------
  454. static VOID
  455. BuildLanguageLists( VOID )
  456. {
  457. #define INTERNATIONAL_INF _T("intl.inf")
  458. #define LANGUAGE_GROUP_NAME 1
  459. #define LANGUAGE_GROUP_ID 3
  460. #define LANGUAGE_LOCALE_NAME 1
  461. #define LANGUAGE_LOCALE_ID 0
  462. #define KEYBOARD_LAYOUT 5
  463. HINF hInterntlInf = NULL;
  464. INFCONTEXT LangInfContext = { 0 };
  465. INFCONTEXT LocaleInfContext = { 0 };
  466. TCHAR szBuffer[MAX_STRING_LEN] = _T("");
  467. INT iLangGroupCount = 0;
  468. LANGUAGEGROUP_LIST *LangNode = NULL;
  469. LANGUAGEGROUP_LIST *CurrentLangNode = NULL;
  470. LANGUAGELOCALE_LIST *LocaleNode = NULL;
  471. LANGUAGELOCALE_LIST *CurrentLocaleNode = NULL;
  472. //
  473. // Read in from the file intl.inf and build the language list
  474. //
  475. hInterntlInf = SetupOpenInfFile( INTERNATIONAL_INF, NULL, INF_STYLE_WIN4, NULL );
  476. if( hInterntlInf == INVALID_HANDLE_VALUE ) {
  477. // ISSUE-2002/02/28-stelo - should allow browse for file here?
  478. }
  479. LangInfContext.Inf = hInterntlInf;
  480. LangInfContext.CurrentInf = hInterntlInf;
  481. LocaleInfContext.Inf = hInterntlInf;
  482. LocaleInfContext.CurrentInf = hInterntlInf;
  483. //
  484. // For each Language Group, add its corresponding data to the language group list
  485. //
  486. SetupFindFirstLine( hInterntlInf, _T("LanguageGroups"), NULL, &LangInfContext );
  487. do {
  488. LangNode = malloc( sizeof( LANGUAGEGROUP_LIST ) );
  489. if (LangNode == NULL)
  490. {
  491. TerminateTheWizard(IDS_ERROR_OUTOFMEMORY);
  492. }
  493. else
  494. {
  495. LangNode->next = NULL;
  496. SetupGetStringField( &LangInfContext,
  497. 0,
  498. LangNode->szLanguageGroupId,
  499. MAX_STRING_LEN,
  500. NULL );
  501. SetupGetStringField( &LangInfContext,
  502. 1,
  503. LangNode->szLanguageGroupName,
  504. MAX_STRING_LEN,
  505. NULL );
  506. SetupGetStringField( &LangInfContext,
  507. 2,
  508. LangNode->szLangFilePath,
  509. MAX_STRING_LEN,
  510. NULL );
  511. }
  512. // See if the LanguageGroupList has been assigned yet. It will not be if
  513. // it is NULL. If currentLangNode is NULL, then resetart LanguageGroupList
  514. // at the new LangNode as well.
  515. if( (FixedGlobals.LanguageGroupList == NULL) ||
  516. (CurrentLangNode == NULL))
  517. {
  518. FixedGlobals.LanguageGroupList = LangNode;
  519. CurrentLangNode = LangNode;
  520. }
  521. else
  522. {
  523. CurrentLangNode->next = LangNode;
  524. CurrentLangNode = CurrentLangNode->next;
  525. }
  526. iLangGroupCount++;
  527. } // move to the next line of the .inf file
  528. while( SetupFindNextLine( &LangInfContext, &LangInfContext ) );
  529. //
  530. // For each locale, add its corresponding data to the language locale list
  531. //
  532. SetupFindFirstLine( hInterntlInf, _T("Locales"), NULL, &LocaleInfContext );
  533. do
  534. {
  535. LocaleNode = malloc( sizeof( LANGUAGELOCALE_LIST ) );
  536. if (LocaleNode == NULL)
  537. {
  538. TerminateTheWizard(IDS_ERROR_OUTOFMEMORY);
  539. }
  540. else
  541. {
  542. LocaleNode->next = NULL;
  543. //
  544. // Get the Language Locale Name
  545. //
  546. SetupGetStringField( &LocaleInfContext,
  547. LANGUAGE_LOCALE_NAME,
  548. LocaleNode->szLanguageLocaleName,
  549. MAX_STRING_LEN,
  550. NULL );
  551. //
  552. // Get the Language Locale ID
  553. //
  554. SetupGetStringField( &LocaleInfContext,
  555. LANGUAGE_LOCALE_ID,
  556. LocaleNode->szLanguageLocaleId,
  557. MAX_STRING_LEN,
  558. NULL );
  559. //
  560. // Get the Keyboard Layout
  561. //
  562. SetupGetStringField( &LocaleInfContext,
  563. KEYBOARD_LAYOUT,
  564. LocaleNode->szKeyboardLayout,
  565. MAX_STRING_LEN,
  566. NULL );
  567. //
  568. // Get the Language Group ID
  569. //
  570. SetupGetStringField( &LocaleInfContext,
  571. LANGUAGE_GROUP_ID,
  572. szBuffer,
  573. MAX_STRING_LEN,
  574. NULL );
  575. //
  576. // Find the Language Group string that goes with the Language Group ID
  577. //
  578. for( CurrentLangNode = FixedGlobals.LanguageGroupList;
  579. CurrentLangNode != NULL;
  580. CurrentLangNode = CurrentLangNode->next ) {
  581. if( lstrcmp( CurrentLangNode->szLanguageGroupId,
  582. szBuffer ) == 0 ) {
  583. LocaleNode->pLanguageGroup = CurrentLangNode;
  584. break; // found what we were looking for so break
  585. }
  586. }
  587. }
  588. //
  589. // Add the new node into the linked list
  590. //
  591. // See if the LanguageLocaleList has been assigned yet. It will not be if
  592. // it is NULL. If currentLocaleNode is NULL, then resetart LanguageLocaleList
  593. // at the new LocaleNode as well.
  594. if( (FixedGlobals.LanguageLocaleList == NULL) ||
  595. (CurrentLocaleNode == NULL))
  596. {
  597. FixedGlobals.LanguageLocaleList = LocaleNode;
  598. CurrentLocaleNode = LocaleNode;
  599. }
  600. else
  601. {
  602. CurrentLocaleNode->next = LocaleNode;
  603. CurrentLocaleNode = CurrentLocaleNode->next;
  604. }
  605. } // move to the next line of the .inf file
  606. while( SetupFindNextLine( &LocaleInfContext, &LocaleInfContext ) );
  607. //
  608. // Set the default locale
  609. //
  610. SetupFindFirstLine( hInterntlInf,
  611. _T("DefaultValues"),
  612. NULL,
  613. &LocaleInfContext );
  614. SetupGetStringField( &LocaleInfContext,
  615. 1,
  616. g_szDefaultLocale,
  617. MAX_LANGUAGE_LEN,
  618. NULL );
  619. BuildAdditionalLanguageList( hInterntlInf, iLangGroupCount );
  620. SetupCloseInfFile( hInterntlInf );
  621. }
  622. //----------------------------------------------------------------------------
  623. //
  624. // Function: LoadStringsAndDefaultsForNetworkComponents
  625. //
  626. // Purpose:
  627. //
  628. // Arguments: VOID
  629. //
  630. // Returns: VOID
  631. //
  632. //----------------------------------------------------------------------------
  633. static VOID
  634. LoadStringsAndDefaultsForNetworkComponents( VOID )
  635. {
  636. //
  637. // Load strings from resources and setup initial values for global
  638. // network components list
  639. //
  640. NETWORK_COMPONENT *pNetComponent;
  641. pNetComponent = malloc( sizeof( NETWORK_COMPONENT ) );
  642. if (pNetComponent == NULL)
  643. TerminateTheWizard(IDS_ERROR_OUTOFMEMORY);
  644. NetSettings.NetComponentsList = pNetComponent;
  645. pNetComponent->StrComponentName = MyLoadString( IDS_CLIENT_FOR_MS_NETWORKS );
  646. pNetComponent->StrComponentDescription = MyLoadString( IDS_CLIENT_FOR_MS_NETWORKS_DESC );
  647. pNetComponent->iPosition = MS_CLIENT_POSITION;
  648. pNetComponent->ComponentType = CLIENT;
  649. pNetComponent->bHasPropertiesTab = TRUE;
  650. pNetComponent->bInstalled = FALSE;
  651. pNetComponent->bSysprepSupport = TRUE;
  652. pNetComponent->dwPlatforms = 0x0 | PERSONAL_INSTALL | WORKSTATION_INSTALL | SERVER_INSTALL;
  653. pNetComponent->next = malloc( sizeof( NETWORK_COMPONENT ) );
  654. pNetComponent = pNetComponent->next;
  655. if (pNetComponent == NULL)
  656. TerminateTheWizard(IDS_ERROR_OUTOFMEMORY);
  657. pNetComponent->StrComponentName = MyLoadString( IDS_CLIENT_FOR_NETWARE );
  658. pNetComponent->StrComponentDescription = MyLoadString( IDS_CLIENT_FOR_NETWARE_DESC );
  659. pNetComponent->iPosition = NETWARE_CLIENT_POSITION;
  660. pNetComponent->ComponentType = CLIENT;
  661. pNetComponent->bHasPropertiesTab = TRUE;
  662. pNetComponent->bInstalled = FALSE;
  663. pNetComponent->bSysprepSupport = TRUE;
  664. pNetComponent->dwPlatforms = 0x0 | WORKSTATION_INSTALL;
  665. pNetComponent->next = malloc( sizeof( NETWORK_COMPONENT ) );
  666. pNetComponent = pNetComponent->next;
  667. if (pNetComponent == NULL)
  668. TerminateTheWizard(IDS_ERROR_OUTOFMEMORY);
  669. pNetComponent->StrComponentName = MyLoadString( IDS_FILE_AND_PRINT_SHARING );
  670. pNetComponent->StrComponentDescription = MyLoadString( IDS_FILE_AND_PRINT_SHARING_DESC );
  671. pNetComponent->iPosition = FILE_AND_PRINT_SHARING_POSITION;
  672. pNetComponent->ComponentType = SERVICE;
  673. pNetComponent->bHasPropertiesTab = FALSE;
  674. pNetComponent->bInstalled = FALSE;
  675. pNetComponent->bSysprepSupport = FALSE;
  676. pNetComponent->dwPlatforms = 0x0 | PERSONAL_INSTALL | WORKSTATION_INSTALL | SERVER_INSTALL;
  677. pNetComponent->next = malloc( sizeof( NETWORK_COMPONENT ) );
  678. pNetComponent = pNetComponent->next;
  679. if (pNetComponent == NULL)
  680. TerminateTheWizard(IDS_ERROR_OUTOFMEMORY);
  681. pNetComponent->StrComponentName = MyLoadString( IDS_PACKET_SCHEDULING_DRIVER );
  682. pNetComponent->StrComponentDescription = MyLoadString( IDS_PACKET_SCHEDULING_DRIVER_DESC );
  683. pNetComponent->iPosition = PACKET_SCHEDULING_POSITION;
  684. pNetComponent->ComponentType = SERVICE;
  685. pNetComponent->bHasPropertiesTab = FALSE;
  686. pNetComponent->bInstalled = FALSE;
  687. pNetComponent->bSysprepSupport = FALSE;
  688. pNetComponent->dwPlatforms = 0x0 | PERSONAL_INSTALL | WORKSTATION_INSTALL | SERVER_INSTALL;
  689. pNetComponent->next = malloc( sizeof( NETWORK_COMPONENT ) );
  690. pNetComponent = pNetComponent->next;
  691. if (pNetComponent == NULL)
  692. TerminateTheWizard(IDS_ERROR_OUTOFMEMORY);
  693. pNetComponent->StrComponentName = MyLoadString( IDS_APPLETALK_PROTOCOL );
  694. pNetComponent->StrComponentDescription = MyLoadString( IDS_APPLETALK_PROTOCOL_DESC );
  695. pNetComponent->iPosition = APPLETALK_POSITION;
  696. pNetComponent->ComponentType = PROTOCOL;
  697. pNetComponent->bHasPropertiesTab = FALSE;
  698. pNetComponent->bInstalled = FALSE;
  699. pNetComponent->bSysprepSupport = FALSE;
  700. pNetComponent->dwPlatforms = 0x0 | PERSONAL_INSTALL | WORKSTATION_INSTALL | SERVER_INSTALL;
  701. pNetComponent->next = malloc( sizeof( NETWORK_COMPONENT ) );
  702. pNetComponent = pNetComponent->next;
  703. if (pNetComponent == NULL)
  704. TerminateTheWizard(IDS_ERROR_OUTOFMEMORY);
  705. pNetComponent->StrComponentName = MyLoadString( IDS_TCPIP );
  706. pNetComponent->StrComponentDescription = MyLoadString( IDS_TCPIP_DESC );
  707. pNetComponent->iPosition = TCPIP_POSITION;
  708. pNetComponent->ComponentType = PROTOCOL;
  709. pNetComponent->bHasPropertiesTab = TRUE;
  710. pNetComponent->bInstalled = FALSE;
  711. pNetComponent->bSysprepSupport = FALSE;
  712. pNetComponent->dwPlatforms = 0x0 | PERSONAL_INSTALL | WORKSTATION_INSTALL | SERVER_INSTALL;
  713. pNetComponent->next = malloc( sizeof( NETWORK_COMPONENT ) );
  714. pNetComponent = pNetComponent->next;
  715. if (pNetComponent == NULL)
  716. TerminateTheWizard(IDS_ERROR_OUTOFMEMORY);
  717. pNetComponent->StrComponentName = MyLoadString( IDS_NETWORK_MONITOR_AGENT );
  718. pNetComponent->StrComponentDescription = MyLoadString( IDS_NETWORK_MONITOR_AGENT_DESC );
  719. pNetComponent->iPosition = NETWORK_MONITOR_AGENT_POSITION;
  720. pNetComponent->ComponentType = PROTOCOL;
  721. pNetComponent->bHasPropertiesTab = FALSE;
  722. pNetComponent->bInstalled = FALSE;
  723. pNetComponent->bSysprepSupport = FALSE;
  724. pNetComponent->dwPlatforms = 0x0 | PERSONAL_INSTALL | WORKSTATION_INSTALL | SERVER_INSTALL;
  725. pNetComponent->next = malloc( sizeof( NETWORK_COMPONENT ) );
  726. pNetComponent = pNetComponent->next;
  727. if (pNetComponent == NULL)
  728. TerminateTheWizard(IDS_ERROR_OUTOFMEMORY);
  729. pNetComponent->StrComponentName = MyLoadString( IDS_IPX_PROTOCOL );
  730. pNetComponent->StrComponentDescription = MyLoadString( IDS_IPX_PROTOCOL_DESC );
  731. pNetComponent->iPosition = IPX_POSITION;
  732. pNetComponent->ComponentType = PROTOCOL;
  733. pNetComponent->bHasPropertiesTab = TRUE;
  734. pNetComponent->bInstalled = FALSE;
  735. pNetComponent->bSysprepSupport = FALSE;
  736. pNetComponent->dwPlatforms = 0x0 | PERSONAL_INSTALL | WORKSTATION_INSTALL | SERVER_INSTALL;
  737. pNetComponent->next = malloc( sizeof( NETWORK_COMPONENT ) );
  738. pNetComponent = pNetComponent->next;
  739. if (pNetComponent == NULL)
  740. TerminateTheWizard(IDS_ERROR_OUTOFMEMORY);
  741. pNetComponent->StrComponentName = MyLoadString( IDS_DLC_PROTOCOL );
  742. pNetComponent->StrComponentDescription = MyLoadString( IDS_DLC_PROTOCOL_DESC );
  743. pNetComponent->iPosition = DLC_POSITION;
  744. pNetComponent->ComponentType = PROTOCOL;
  745. pNetComponent->bHasPropertiesTab = FALSE;
  746. pNetComponent->bInstalled = FALSE;
  747. pNetComponent->bSysprepSupport = FALSE;
  748. pNetComponent->dwPlatforms = 0x0 | PERSONAL_INSTALL | WORKSTATION_INSTALL | SERVER_INSTALL;
  749. pNetComponent->next = malloc( sizeof( NETWORK_COMPONENT ) );
  750. pNetComponent = pNetComponent->next;
  751. if (pNetComponent == NULL)
  752. TerminateTheWizard(IDS_ERROR_OUTOFMEMORY);
  753. pNetComponent->StrComponentName = MyLoadString( IDS_NETBEUI_PROTOCOL );
  754. pNetComponent->StrComponentDescription = MyLoadString( IDS_NETBEUI_PROTOCOL_DESC );
  755. pNetComponent->iPosition = NETBEUI_POSITION;
  756. pNetComponent->ComponentType = PROTOCOL;
  757. pNetComponent->bHasPropertiesTab = FALSE;
  758. pNetComponent->bInstalled = FALSE;
  759. pNetComponent->bSysprepSupport = FALSE;
  760. pNetComponent->dwPlatforms = 0x0 | PERSONAL_INSTALL | WORKSTATION_INSTALL | SERVER_INSTALL;
  761. pNetComponent->next = malloc( sizeof( NETWORK_COMPONENT ) );
  762. pNetComponent = pNetComponent->next;
  763. if (pNetComponent == NULL)
  764. TerminateTheWizard(IDS_ERROR_OUTOFMEMORY);
  765. pNetComponent->StrComponentName = MyLoadString( IDS_SAP_AGENT );
  766. pNetComponent->StrComponentDescription = MyLoadString( IDS_SAP_AGENT_DESC );
  767. pNetComponent->iPosition = SAP_AGENT_POSITION;
  768. pNetComponent->ComponentType = SERVICE;
  769. pNetComponent->bHasPropertiesTab = FALSE;
  770. pNetComponent->bInstalled = FALSE;
  771. pNetComponent->bSysprepSupport = FALSE;
  772. pNetComponent->dwPlatforms = 0x0 | PERSONAL_INSTALL | WORKSTATION_INSTALL | SERVER_INSTALL;
  773. pNetComponent->next = malloc( sizeof( NETWORK_COMPONENT ) );
  774. pNetComponent = pNetComponent->next;
  775. if (pNetComponent == NULL)
  776. TerminateTheWizard(IDS_ERROR_OUTOFMEMORY);
  777. pNetComponent->StrComponentName = MyLoadString( IDS_GATEWAY_FOR_NETWARE );
  778. pNetComponent->StrComponentDescription = MyLoadString( IDS_GATEWAY_FOR_NETWARE_DESC );
  779. pNetComponent->iPosition = GATEWAY_FOR_NETWARE_POSITION;
  780. pNetComponent->ComponentType = CLIENT;
  781. pNetComponent->bHasPropertiesTab = TRUE;
  782. pNetComponent->bInstalled = FALSE;
  783. pNetComponent->bSysprepSupport = TRUE;
  784. pNetComponent->dwPlatforms = 0x0 | SERVER_INSTALL;
  785. pNetComponent->next = NULL; // terminate the list
  786. NetSettings.NumberOfNetComponents = 11;
  787. }