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.

659 lines
19 KiB

  1. ;----------------------------------------------------------------
  2. ; HARDWARE OPTION CLASSES APPEARING IN SYSTEM INFORMATION DIALOG
  3. ;----------------------------------------------------------------
  4. [SystemInformationClasses]
  5. ;
  6. ; Video
  7. ; Layout
  8. Language
  9. ;-----------------------------------------------------------------------
  10. ;
  11. ; ROUTINE: InitialHardwareInstall
  12. ;
  13. ; DESCRIPTION: This does the system information screen
  14. ;
  15. ; INPUTS: $0: Language to use
  16. ;
  17. ; OUTPUTS: $R0: STATUS: STATUS_SUCCESSFUL |
  18. ; STATUS_FAILED
  19. ;
  20. ; $R1: Hardware Options to configure
  21. ;
  22. ;------------------------------------------------------------------------
  23. [InitialHardwareInstall]
  24. ;
  25. ;
  26. StartWait
  27. set Status = STATUS_FAILED
  28. set !STF_LANGUAGE_HACK = NO
  29. set ConfigureOptions = {}
  30. read-syms OemOptionDiskettes$(!STF_LANGUAGE)
  31. read-syms Strings$(!STF_LANGUAGE)
  32. shell "subroutn.inf" PushBillboard STATUSDLG $(Error6)
  33. set OptionTypeList = {Language}
  34. ForListDo $(OptionTypeList)
  35. read-syms $($)Vars
  36. detect $($)Vars
  37. EndForListDo
  38. ;
  39. ; initialize all the option vars
  40. ;
  41. ForListDo $(OptionTypeList)
  42. shell "" InitOptionVars $(!STF_LANGUAGE) $($) $($($)HardwareDetected) $($($)SystemSet) $($($)Default)
  43. ifstr(i) $($R0) == "STATUS_SUCCESSFUL"
  44. set $($)OurINFOptions = $($R1)
  45. set $($)OemINFOptions = $($R2)
  46. set $($)MergedOptions = $($R3)
  47. set $($)SpecialOption = $($R4)
  48. set $($)CurrentOption = $($R5)
  49. set $($)Option = *($($R5), 1)
  50. else
  51. shell "subroutn.inf" PopBillboard
  52. EndWait
  53. shell "subroutn.inf" SetupMessage $(!STF_LANGUAGE) "FATAL" $(Error1)
  54. StartWait
  55. goto finish_system
  56. endif
  57. EndForListDo
  58. ;
  59. ; Initalize the listbox vars
  60. ;
  61. ForListDo $(OptionTypeList)
  62. shell "" InitListBoxVars $(!STF_LANGUAGE) $($($)MergedOptions) $($($)SpecialOption) $(Other)
  63. ifstr(i) $($R0) == "STATUS_SUCCESSFUL"
  64. set $($)OptionList = $($R1)
  65. set $($)OptionTextList = $($R2)
  66. else
  67. shell "subroutn.inf" PopBillboard
  68. EndWait
  69. shell "subroutn.inf" SetupMessage $(!STF_LANGUAGE) "FATAL" $(Error2)
  70. StartWait
  71. goto finish_system
  72. endif
  73. EndForListDo
  74. shell "subroutn.inf" PopBillboard
  75. system = +
  76. ; ifstr(i) $(!STF_INSTALL_MODE) == EXPRESS
  77. ; goto install_system
  78. ; endif
  79. read-syms SystemDlg$(!STF_LANGUAGE)
  80. EndWait
  81. ui start "System"
  82. ifstr(i) $(DLGEVENT) == "CONTINUE"
  83. ForListDo $(OptionTypeList)
  84. set $($)Option = *($($($)OptionList), ~($(Combo$(#)List), $(Combo$(#)Out)))
  85. EndForListDo
  86. ui pop 1
  87. goto install_system
  88. else-ifstr(i) $(DLGEVENT) == "NOTIFY"
  89. ;
  90. ; Find out the option which changed.
  91. ;
  92. set OptionNum = $(ButtonChecked)
  93. set Option = *($(OptionTypeList), $(ButtonChecked))
  94. set ReInit = YES
  95. ifstr(i) $(Combo$(OptionNum)Out) != $(Other)
  96. set $(Option)Option = *($($(Option)OptionList), ~($(Combo$(OptionNum)List), $(Combo$(OptionNum)Out)))
  97. set ReInit = NO
  98. else
  99. shell "other.inf" GetNewOEMOption $(!STF_LANGUAGE) $($(Option)OemINFOptions) $(Option) $($(Option)DisketteSrc)
  100. ifstr(i) $($R0) == STATUS_SUCCESSFUL
  101. ;
  102. ; extract the new variables
  103. ;
  104. set $(Option)OemINFOptions = $($R1)
  105. set $(Option)Option = $($R2)
  106. set $(Option)DisketteSrc = $($R4)
  107. ;
  108. ; Merge our options with the oem options
  109. ;
  110. shell "" MergeOptions $($(Option)OurINFOptions) $($(Option)OemINFOptions)
  111. ifstr(i) $($R0) == STATUS_SUCCESSFUL
  112. set $(Option)MergedOptions = {$($R1), $($R2)}
  113. else
  114. shell "subroutn.inf" SetupMessage $(!STF_LANGUAGE) "FATAL" $(Error4)
  115. ui pop 1
  116. StartWait
  117. goto finish_system
  118. endif
  119. ;
  120. ; Initialise the listbox vars
  121. ;
  122. shell "" InitListBoxVars $(!STF_LANGUAGE) $($(Option)MergedOptions) $($(Option)SpecialOption) $(Other)
  123. ifstr(i) $($R0) == "STATUS_SUCCESSFUL"
  124. set $(Option)OptionList = $($R1)
  125. set $(Option)OptionTextList = $($R2)
  126. else
  127. shell "subroutn.inf" SetupMessage $(!STF_LANGUAGE) "FATAL" $(Error2)
  128. ui pop 1
  129. StartWait
  130. goto finish_system
  131. endif
  132. set ReInit = YES
  133. goto system
  134. else-ifstr(i) $($R0) == "STATUS_USERCANCEL"
  135. set ReInit = YES
  136. goto system
  137. else
  138. shell "subroutn.inf" SetupMessage $(!STF_LANGUAGE) "NONFATAL" $(Error3)
  139. set ReInit = YES
  140. goto system
  141. endif
  142. endif
  143. goto system
  144. else-ifstr(i) $(DLGEVENT) == "EXIT"
  145. shell "subroutn.inf" QueryUserQuit $(!STF_LANGUAGE)
  146. ifstr(i) $($R1) == "OK"
  147. set Status = STATUS_USERQUIT
  148. ui pop 1
  149. StartWait
  150. goto finish_system
  151. else
  152. set ReInit = NO
  153. goto system
  154. endif
  155. else
  156. ui pop 1
  157. StartWait
  158. goto finish_system
  159. endif
  160. install_system = +
  161. StartWait
  162. ;
  163. ; find out for each option whether it should be installed and if so the
  164. ; inf that represents the option.
  165. ;
  166. ForListDo $(OptionTypeList)
  167. ;
  168. ; See if option has changed
  169. ;
  170. set Changed = YES
  171. ifstr(i) $($($)Option) == $($($)SystemSet)
  172. set Changed = NO
  173. endif
  174. ;
  175. ; If option has not changed and we are SETUPBOOTED mode then skip
  176. ;
  177. ifstr(i) $(Changed) == "NO"
  178. ifstr(i) $(!STF_INSTALL_TYPE) == "SETUPBOOTED"
  179. set $($)Install = "NO"
  180. goto skip_setinstall
  181. endif
  182. endif
  183. set $($)Install = "YES"
  184. ;
  185. ; check special option first.. skip
  186. ;
  187. ifstr(i) $($($)SpecialOption) != {}
  188. ifstr(i) $($($)Option) == *($($($)SpecialOption), 1)
  189. goto skip_setinstall
  190. endif
  191. endif
  192. ;
  193. ; check if oem option
  194. ;
  195. shell "" GetOptionFile $($($)Option) $($($)OemINFOptions)
  196. ifstr(i) $($R0) == "STATUS_SUCCESSFUL"
  197. set $($)INF = $(!STF_WINDOWSSYSPATH)"\"$($R1)
  198. set $($)SrcDir = $($($)DisketteSrc)
  199. goto skip_setinstall
  200. endif
  201. ;
  202. ; check if our option
  203. ;
  204. shell "" GetOptionFile $($($)Option) $($($)OurINFOptions)
  205. ifstr(i) $($R0) == "STATUS_SUCCESSFUL"
  206. set $($)INF = $($R1)
  207. set $($)SrcDir = $(!STF_SRCDIR)
  208. goto skip_setinstall
  209. endif
  210. skip_setinstall = +
  211. EndForListDo
  212. ;
  213. ; For each of the hardware options find if they are to be installed and
  214. ; if there is an INF representing the option
  215. ;
  216. ForListDo $(OptionTypeList)
  217. ;
  218. ifstr(i) $($($)Install) == "YES"
  219. ifstr(i) $($($)INF) != ""
  220. shell $($($)INF) InstallOption $(!STF_LANGUAGE) $($($)Option) $($($)SrcDir) "YES" "NO" "NO"
  221. set ConfigureOptions = >($(ConfigureOptions), {$($), $($($)INF), $($($)Option), $($($)SrcDir)})
  222. endif
  223. endif
  224. EndForListDo
  225. ;
  226. ; If we have not installed any language do a hack to be able to install the
  227. ; OS2 Message file for the current locale
  228. ;
  229. ifstr(i) $(LanguageInstall) != "YES"
  230. set !STF_LANGUAGE_HACK = YES
  231. shell "language.inf" InstallOption $(!STF_LANGUAGE) $(LanguageOption) $(!STF_SRCDIR) "YES" "NO" "NO"
  232. endif
  233. set Status = STATUS_SUCCESSFUL
  234. finish_system = +
  235. Return $(Status) $(ConfigureOptions)
  236. ;-----------------------------------------------------------------------
  237. ;
  238. ; ROUTINE: ConfigureHardwareOptions
  239. ;
  240. ; DESCRIPTION: This configures the system information screen options
  241. ;
  242. ; INPUTS: $0: Options to configure
  243. ;
  244. ; OUTPUTS: $R0: STATUS: STATUS_SUCCESSFUL |
  245. ; STATUS_FAILED
  246. ;
  247. ;------------------------------------------------------------------------
  248. [ConfigureHardwareOptions]
  249. ;
  250. set Status = STATUS_SUCCESSFUL
  251. ;
  252. ; first make the setup entry under the current control set\control
  253. ;
  254. shell "registry.inf" MakeSetupKey
  255. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  256. Debug-Output "Shell to MakeSetupKey failed"
  257. set Status = STATUS_FAILED
  258. goto finish_ConfigureHardware
  259. endif
  260. ifstr(i) $($R0) != STATUS_SUCCESSFUL
  261. Debug-Output "MakeSetupKey failed"
  262. set Status = STATUS_FAILED
  263. goto finish_ConfigureHardware
  264. endif
  265. ForListDo $($0)
  266. ;
  267. ; install the option
  268. ;
  269. shell *($($), 2) InstallOption $(!STF_LANGUAGE) *($($), 3) *($($), 4) "NO" "NO" "YES"
  270. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  271. Debug-Output "Shell to Configure Hardware Option Type "*($($), 3)" failed"
  272. set Status = STATUS_FAILED
  273. else-ifstr(i) $($R0) != STATUS_SUCCESSFUL
  274. Debug-Output "Configure Hardware Option Type "*($($), 3)" failed"
  275. set Status = STATUS_FAILED
  276. else
  277. ;
  278. ; keep a record of what option we installed in the setup node
  279. ;
  280. shell "registry.inf" MakeSetupOptionEntry *($($), 1) *($($), 3)
  281. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  282. Debug-Output "shelling MakeSetupOptionEntry failed"
  283. set Status = STATUS_FAILED
  284. endif
  285. ifstr(i) $($R0) != STATUS_SUCCESSFUL
  286. ; ignore error
  287. Debug-Output "Making setup entry for "*($($), 1)" = "*($($), 3)" failed."
  288. set Status = STATUS_FAILED
  289. endif
  290. endif
  291. EndForListDo
  292. ifstr(i) $(!STF_LANGUAGE_HACK) == "YES"
  293. read-syms LanguageVars
  294. LibraryProcedure STATUS, $(!LIBHANDLE), SetCurrentLocale $(LanguageSystemSet) "YES"
  295. ifstr(i) $(STATUS) != "SUCCESS"
  296. set Status = STATUS_FAILED
  297. Debug-Output "REGISTRY.INF: Failed in SetCurrentLocale function"
  298. goto finish_ConfigureHardware
  299. endif
  300. endif
  301. finish_ConfigureHardware = +
  302. Return $(Status)
  303. ;-----------------------------------------------------------------------
  304. ;
  305. ; ROUTINE: InitOptionVars
  306. ;
  307. ; DESCRIPTION: This routine intialises the values for the option we are
  308. ; dealing with. It finds out the options supported by setup.
  309. ; It also sees if there is an OEM INF in the windows system
  310. ; directory which represents this option. If so it reads in
  311. ; the options supported by this INF and then forms a merged
  312. ; list from the two.
  313. ;
  314. ; INPUTS: $0: Language to use
  315. ; $1: OptionType
  316. ; $2: Hardware detected option
  317. ; $3: Software set option
  318. ; $4: Default value for option
  319. ;
  320. ; OUTPUTS: $R0: STATUS: STATUS_SUCCESSFUL |
  321. ; STATUS_FAILED
  322. ;
  323. ; $R1: OurINFOptions var {{filename, {OptionList}, {OptionTextList}}}
  324. ; $R2: OemINFOptions var {{filename, {OptionList}, {OptionTextList}}, ..}
  325. ; $R3: Merged INF Options {{OptionList}, {OptionTextList}}
  326. ; $R4: Special Options {Option, OptionText}
  327. ; $R5: Current Option {Option, OptionText}
  328. ;
  329. ;------------------------------------------------------------------------
  330. [InitOptionVars]
  331. set Status = STATUS_FAILED
  332. set OurINFOptions = {}
  333. set OemINFOptions = {}
  334. set MergedINFOptions = {}
  335. set SpecialOption = {}
  336. set CurrentOption = {}
  337. ;
  338. ; Determine our INF options
  339. ;
  340. set OurINFFile = $($1)".inf"
  341. shell "other.inf", GetOptionsFromINF $($0) $($1) $(OurINFFile)
  342. ifstr(i) $($R0) == STATUS_SUCCESSFUL
  343. set OurINFOptions = {{$(OurINFFile), $($R1), $($R2)}}
  344. else
  345. EndWait
  346. read-syms Strings$(!STF_LANGUAGE)
  347. shell "subroutn.inf" SetupMessage $(!STF_LANGUAGE) "FATAL" $(Error7)
  348. StartWait
  349. goto finish_InitOptionVars
  350. endif
  351. ;
  352. ; Determine all Oem options
  353. ;
  354. shell "other.inf" ReturnOemOptions $($0) $($1)
  355. ifstr(i) $($R0) == "STATUS_SUCCESSFUL"
  356. set OemINFOptions = $($R1)
  357. endif
  358. ;
  359. ; Merge the two and set the merged list
  360. ;
  361. shell "" MergeOptions $(OurINFOptions) $(OemINFOptions)
  362. ifstr(i) $($R0) == STATUS_SUCCESSFUL
  363. set MergedINFOptionList = $($R1)
  364. set MergedINFOptionTextList = $($R2)
  365. set MergedINFOptions = {$($R1), $($R2)}
  366. else
  367. goto finish_InitOptionVars
  368. endif
  369. ;
  370. ; For video, see if the detected value is in
  371. ; the merged option list. if it isn't then shell out to out option
  372. ; inf trying to find a mapping to a supported option for the detected
  373. ; hardware option
  374. ;
  375. set SubOptionList = {Video}
  376. set Detected = $($2)
  377. ifcontains(i) $($1) in $(SubOptionList)
  378. ifcontains(i) $(Detected) in $(MergedINFOptionList)
  379. else
  380. shell $(OurINFFile) MapToSupportedOption $(Detected)
  381. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  382. Debug-Output "Shelling MapToSupportedOption in "$(OurINFFile)" failed"
  383. else-ifstr(i) $($R0) == STATUS_SUCCESSFUL
  384. set Detected = $($R1)
  385. endif
  386. endif
  387. endif
  388. ;
  389. ; Form current option.
  390. ;
  391. ; Algorithm:
  392. ;
  393. ;
  394. ; On initial install software set values have little meaning, so
  395. ; try first hardware detected value, if not exists take system set
  396. ; value, if this also doesn't exist then take default. the logic
  397. ; above is more appropriate for upgrade or maintenance mode.
  398. ifstr(i) $(!STF_UPGRADE) == "YES"
  399. set Option = ""
  400. ifstr(i) $($3) != ""
  401. set Option = $($3)
  402. else
  403. ifstr(i) $(Detected) != ""
  404. set Option = $(Detected)
  405. else
  406. set Option = $($4)
  407. endif
  408. endif
  409. else
  410. set Option = ""
  411. ifstr(i) $(Detected) != ""
  412. set Option = $(Detected)
  413. else-ifstr(i) $($3) != ""
  414. set Option = $($3)
  415. else
  416. set Option = $($4)
  417. endif
  418. endif
  419. ;
  420. ; Check Option against all the options supported
  421. ; If found set Current Option, else set the special options var
  422. ; and set this to the current option.
  423. ;
  424. ifcontains(i) $(Option) in $(MergedINFOptionList)
  425. set OptionText = *($(MergedINFOptionTextList), ~($(MergedINFOptionList), $(Option)))
  426. else
  427. set OptionText = "Oem Installed Option"
  428. set Option = $(Option)
  429. set SpecialOption = {$(Option), $(OptionText)}
  430. endif
  431. set CurrentOption = {$(Option), $(OptionText)}
  432. set Status = STATUS_SUCCESSFUL
  433. finish_InitOptionVars = +
  434. Return $(Status) $(OurINFOptions) $(OemINFOptions) $(MergedINFOptions) $(SpecialOption) $(CurrentOption)
  435. ;-------------------------------------------------------------------------
  436. ;
  437. ; ROUTINE: InitListBoxVars
  438. ;
  439. ; DESCRIPTION: This routine initialises the option list and the option text
  440. ; list to be displayed to the user.
  441. ;
  442. ; INPUTS: $0: Language
  443. ; $1: MergedINFOptions
  444. ; $2: SpecialOption
  445. ; $3: OtherOption
  446. ;
  447. ; OUTPUTS: $R0: STATUS: STATUS_FAILED |
  448. ; STATUS_SUCCESSFUL
  449. ;
  450. ; $R1: OptionList
  451. ; $R2: OptionTextList
  452. ;
  453. ;----------------------------------------------------------------------------
  454. [InitListBoxVars]
  455. set Status = STATUS_FAILED
  456. set OptionList = {}
  457. set OptionTextList = {}
  458. ;
  459. ; Process the standard options
  460. ;
  461. ifstr(i) $($1) != {}
  462. set OptionList = *($($1), 1)
  463. set OptionTextList = *($($1), 2)
  464. endif
  465. ;
  466. ; Process the special option if present
  467. ;
  468. ifstr(i) $($2) != {}
  469. set OptionList = >($(OptionList), *($($2), 1))
  470. set OptionTextList = >($(OptionTextList), *($($2), 2))
  471. endif
  472. ;
  473. ; Add the "other" option only to the text list
  474. ;
  475. set OptionTextList = >($(OptionTextList), $($3))
  476. set Status = STATUS_SUCCESSFUL
  477. Return $(Status) $(OptionList) $(OptionTextList)
  478. ;-----------------------------------------------------------------------
  479. ;
  480. ; ROUTINE: MergeOptions
  481. ;
  482. ; DESCRIPTION: This merges the option lists to form the master list of
  483. ; options and optiontext.
  484. ;
  485. ; INPUTS: $0: OurOptionList
  486. ; $1: OemOptionList
  487. ;
  488. ; OUTPUTS: $R0: STATUS: STATUS_SUCCESSFUL |
  489. ; STATUS_FAILED
  490. ;
  491. ; $R1: MergedOptionList
  492. ; $R2: MergedOptionTextList
  493. ;
  494. ;
  495. ;------------------------------------------------------------------------
  496. [MergeOptions]
  497. set Status = STATUS_FAILED
  498. set MergedOptionList = {}
  499. set MergedOptionTextList = {}
  500. ;
  501. ; First merge our options in
  502. ;
  503. ForListDo $($0)
  504. set OptionList = *($($), 2)
  505. set OptionTextList = *($($), 3)
  506. ForListDo $(OptionList)
  507. Ifcontains $($) in $(MergedOptionList)
  508. else
  509. set MergedOptionList = >($(MergedOptionList), $($))
  510. set MergedOptionTextList = >($(MergedOptionTextList), *($(OptionTextList), $(#)))
  511. endif
  512. EndForListDo
  513. EndForListDo
  514. ;
  515. ; Then merge the oem options in
  516. ;
  517. ForListDo $($1)
  518. set OptionList = *($($), 2)
  519. set OptionTextList = *($($), 3)
  520. ForListDo $(OptionList)
  521. Ifcontains $($) in $(MergedOptionList)
  522. else
  523. set MergedOptionList = >($(MergedOptionList), $($))
  524. set MergedOptionTextList = >($(MergedOptionTextList), *($(OptionTextList), $(#)))
  525. endif
  526. EndForListDo
  527. EndForListDo
  528. set Status = STATUS_SUCCESSFUL
  529. Return $(Status) $(MergedOptionList) $(MergedOptionTextList)
  530. ;-----------------------------------------------------------------------
  531. ;
  532. ; ROUTINE: GetOptionFile
  533. ;
  534. ; DESCRIPTION: Given the Option list and the current option, determines
  535. ; if the current option is a supported option and returns the
  536. ; file representing the option
  537. ;
  538. ; INPUTS: $0: OptionChosen
  539. ; $1: OptionList {{filename, {optionlist}, {optiontextlist}}
  540. ;
  541. ; OUTPUTS: $R0: STATUS: STATUS_SUCCESSFUL |
  542. ; STATUS_FILENOTFOUND |
  543. ; STATUS_FAILED
  544. ;
  545. ; $R1: FileName
  546. ;
  547. ;------------------------------------------------------------------------
  548. [GetOptionFile]
  549. set Status = STATUS_FILENOTFOUND
  550. set FileName = ""
  551. ;
  552. ForListDo $($1)
  553. set OptionFile = *($($), 1)
  554. set OptionList = *($($), 2)
  555. ForListDo $(OptionList)
  556. ifstr(i) $($) == $($0)
  557. set Status = STATUS_SUCCESSFUL
  558. set FileName = $(OptionFile)
  559. ;
  560. ; BUGBUG** For now comment this out, this is causing a bug
  561. ;
  562. ; goto finish_GetOptionFile
  563. endif
  564. EndForListDo
  565. EndForListDo
  566. finish_GetOptionFile = +
  567. Return $(Status) $(FileName)