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.

1040 lines
30 KiB

  1. ;--------------------------------------
  2. ; HARDWARE OPTION CLASSES WE UNDERSTAND
  3. ;--------------------------------------
  4. [Options]
  5. ;
  6. Computer = cpt
  7. Video = vio
  8. Layout = lay
  9. Language = lng
  10. Printer = prn
  11. Sound = snd
  12. Driver = drv
  13. NetAdapter = nad
  14. NetDriver = ndr
  15. NetTransport = nxp
  16. NetService = nsv
  17. Network = nwk
  18. NetProvider = npr
  19. [OemOptionFiles]
  20. OemFiles = {} ? $(!LIBHANDLE) FindFileInstances $(!STF_WINDOWSSYSPATH)"\oem"$(Abb)"*.inf"
  21. [DetectFileTime]
  22. FileDateTime = {"0","0"} ? $(!LIBHANDLE) GetFileLastWriteTime $(!STF_WINDOWSSYSPATH)"\"$(FileDateTimeName)
  23. ;-----------------------------------------------------------------------
  24. ;
  25. ; ROUTINE: ReturnOemOptions
  26. ;
  27. ; DESCRIPTION: This routine finds out if an OEM file representing
  28. ; the option exists in the windows sytem directory
  29. ; and returns the options represented in the INF.
  30. ;
  31. ; INPUTS: $0: Language to use
  32. ; $1: Option Type (Computer|Video|...)
  33. ;
  34. ; OUTPUTS: $R0: STATUS: STATUS_SUCCESSFUL |
  35. ; STATUS_FAILED
  36. ;
  37. ; $R1: OemOptionList: This is of form:
  38. ; { {Oemfile1, Option1List, Option1TextList},
  39. ; {Oemfile2, Option2List, Option2TextList},
  40. ; ...
  41. ; }
  42. ;
  43. ;
  44. ;------------------------------------------------------------------------
  45. [ReturnOemOptions]
  46. ;
  47. ; Initialize
  48. ;
  49. set Status = STATUS_FAILED
  50. set OemOptionList = {}
  51. set FromNetwork = $($2)
  52. set AllChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789."
  53. set Numerals = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" }
  54. set Abb = #(Options, $($1), 1)
  55. read-syms OemOptionFiles
  56. detect OemOptionFiles
  57. ifcontains(i) "oemnadzz.inf" in $(OemFiles)
  58. ;
  59. ; Put oemnadzz.inf at the beginning
  60. ;
  61. set newList = {"oemnadzz.inf"}
  62. ForListDo $(OemFiles)
  63. ifstr(i) $($) != "oemnadzz.inf"
  64. set newList = >($(newList),$($))
  65. endif
  66. EndForListDo
  67. ;set newList = >($(newList),"oemnadzz.inf")
  68. set OemFiles = $(newList)
  69. endif
  70. debug-output $(OemFiles)
  71. set TotalOptions = {}
  72. ForListDo $(OemFiles)
  73. set fExclude = ""
  74. Split-String $($) $(AllChars) InfNameChars
  75. ifcontains(i) *($(InfNameChars), 7) in $(Numerals)
  76. ; exclude if from network and a numerical item (thus a real net Oem)
  77. ;
  78. set fExclude = $(FromNetwork)
  79. endif
  80. ifstr(i) $(fExclude) == ""
  81. set OemFileName = $(!STF_WINDOWSSYSPATH)"\"$($)
  82. ifstr(i) $(FromNetwork) == ""
  83. shell "", GetOptionsFromINF $($0) $($1) $(OemFileName)
  84. else
  85. shell "", GetNetworkOptionsFromINF $($0) $($1) $(OemFileName)
  86. endif
  87. set CurrentInf = $($)
  88. ifstr(i) $($R0) == STATUS_SUCCESSFUL
  89. set Index = 0
  90. set ReturnOption = $($R1)
  91. set ReturnOptionText = $($R2)
  92. ForListDo $(ReturnOption)
  93. set-add Index = $(Index), 1
  94. ifcontains(i) $($) not-in $(TotalOptions)
  95. set OemOptionList = >($(OemOptionList), {$(CurrentInf), $($), *($(ReturnOptionText),$(Index))})
  96. set TotalOptions = >($(TotalOptions), $($))
  97. endif
  98. EndForListDo
  99. endif
  100. endif
  101. EndForListDo
  102. set Status = STATUS_SUCCESSFUL
  103. finish_GetCurrentOemOptions = +
  104. Return $(Status) $(OemOptionList)
  105. ;-----------------------------------------------------------------------
  106. ;
  107. ; ROUTINE: GetNetworkOptionsFromINF
  108. ;
  109. ; DESCRIPTION: This routine checks to see if the specified file exists
  110. ; and if it is of the right type and gets option info from
  111. ; the INF. It is called for network option only.
  112. ;
  113. ; The different between this function and GetOptionsFromINF
  114. ; is that it will elminiate the dupliication of the same
  115. ; option.
  116. ;
  117. ; INPUTS: $0: Language To use
  118. ; $1: OptionType
  119. ; $2: OptionFileName
  120. ;
  121. ; OUTPUTS: $R0: STATUS: STATUS_SUCCESSFUL |
  122. ; STATUS_INFNOTFOUND |
  123. ; STATUS_FAILED
  124. ;
  125. ; $R1: OptionList
  126. ; $R2: OPtionTextList
  127. ;
  128. ;------------------------------------------------------------------------
  129. [GetNetworkOptionsFromINF]
  130. ;
  131. ; Initialize
  132. ;
  133. set Status = STATUS_FAILED
  134. set OptionList = {}
  135. set OptionTextList = {}
  136. set FileToCheck = $($2)
  137. install Install-SeeIfFileIsPresent
  138. ifstr(i) $(STATUS) != "YES"
  139. set Status = STATUS_INFNOTFOUND
  140. goto finish_GetNetworkOptionsFromINF
  141. endif
  142. ;
  143. ; See if we have cached this information into the Registry.
  144. ;
  145. Shell "" GetOptionsFromRegistry $($1) $($2)
  146. ifstr(i) $($R0) == "STATUS_SUCCESSFUL"
  147. set OptionList = $($R1)
  148. set OptionTextList = $($R2)
  149. set Status = STATUS_SUCCESSFUL
  150. goto finish_GetNetworkOptionsFromINF
  151. endif
  152. ;
  153. ; Check that the INF represents the option we are looking for
  154. ;
  155. shell $($2) Identify
  156. ifstr(i) $($R0) == "STATUS_SUCCESSFUL"
  157. ifstr(i) $($R1) == $($1)
  158. set OptionList = {}
  159. set OptionTextList = {}
  160. forlistdo $(!STF_BUSTYPELIST)
  161. shell $($2) ReturnOptions $($0) $($)
  162. ifstr(i) $($R0) == STATUS_SUCCESSFUL
  163. set Index = 0
  164. set ReturnOption = $($R1)
  165. set ReturnOptionText = $($R2)
  166. ForListDo $(ReturnOption)
  167. set-add Index = $(Index), 1
  168. ifstr(i) $(OptionList) == {}
  169. set OptionList = {$($)}
  170. set OptionTextList = {*($(ReturnOptionText),$(Index))}
  171. else
  172. ifcontains(i) $($) not-in $(OptionList)
  173. set OptionList = >($(OptionList),$($))
  174. set OptionTextList = >($(OptionTextList),*($(ReturnOptionText),$(Index)))
  175. endif
  176. endif
  177. EndForListDo
  178. set Status = STATUS_SUCCESSFUL
  179. endif
  180. endforlistdo
  181. ifstr(i) $(OptionList) != ""
  182. Shell "" SetOptionsIntoRegistry $($1) $($2) $(OptionList) $(OptionTextList)
  183. endif
  184. endif
  185. endif
  186. finish_GetNetworkOptionsFromINF = +
  187. Return $(Status) $(OptionList) $(OptionTextList)
  188. ;-----------------------------------------------------------------------
  189. ;
  190. ; ROUTINE: GetOptionsFromINF
  191. ;
  192. ; DESCRIPTION: This routine checks to see if the specified file exists
  193. ; and if it is of the right type and gets option info from
  194. ; the INF.
  195. ;
  196. ; INPUTS: $0: Language To use
  197. ; $1: OptionType
  198. ; $2: OptionFileName
  199. ;
  200. ; OUTPUTS: $R0: STATUS: STATUS_SUCCESSFUL |
  201. ; STATUS_INFNOTFOUND |
  202. ; STATUS_FAILED
  203. ;
  204. ; $R1: OptionList
  205. ; $R2: OPtionTextList
  206. ;
  207. ;------------------------------------------------------------------------
  208. [GetOptionsFromINF]
  209. ;
  210. ; Initialize
  211. ;
  212. set Status = STATUS_FAILED
  213. set OptionList = {}
  214. set OptionTextList = {}
  215. set FileToCheck = $($2)
  216. install Install-SeeIfFileIsPresent
  217. ifstr(i) $(STATUS) != "YES"
  218. set Status = STATUS_INFNOTFOUND
  219. goto finish_GetOptionsFromINF
  220. endif
  221. ;
  222. ; See if we have cached this information into the Registry.
  223. ;
  224. Shell "" GetOptionsFromRegistry $($1) $($2)
  225. ifstr(i) $($R0) == "STATUS_SUCCESSFUL"
  226. set OptionList = $($R1)
  227. set OptionTextList = $($R2)
  228. set Status = STATUS_SUCCESSFUL
  229. goto finish_GetOptionsFromINF
  230. endif
  231. ;
  232. ; Check that the INF represents the option we are looking for
  233. ;
  234. shell $($2) Identify
  235. ifstr(i) $($R0) == "STATUS_SUCCESSFUL"
  236. ifstr(i) $($R1) == $($1)
  237. set OptionList = ""
  238. shell $($2) ReturnOptions $($0) $($)
  239. ifstr(i) $($R0) == STATUS_SUCCESSFUL
  240. set OptionList = $($R1)
  241. set OptionTextList = $($R2)
  242. set Status = STATUS_SUCCESSFUL
  243. endif
  244. ifstr(i) $(OptionList) != ""
  245. Shell "" SetOptionsIntoRegistry $($1) $($2) $(OptionList) $(OptionTextList)
  246. endif
  247. endif
  248. endif
  249. finish_GetOptionsFromINF = +
  250. Return $(Status) $(OptionList) $(OptionTextList)
  251. ;-----------------------------------------------------------------------
  252. ;
  253. ; ROUTINE: GetNewOEMOption
  254. ;
  255. ; DESCRIPTION: This routine prompts the user for a new OEM file, presents
  256. ; the options supported and if the user chooses one of these
  257. ; copies over the INF to the windows system directory.
  258. ;
  259. ; INPUTS: $0: Language to use
  260. ; $1: OemOptionList
  261. ; $2: OptionType
  262. ; $3: OptDisketteSource
  263. ; $4: Optional Dialog Text
  264. ;
  265. ; OUTPUTS: $R0: STATUS: STATUS_SUCCESSFUL |
  266. ; STATUS_USERCANCEL |
  267. ; STATUS_FAILED |
  268. ;
  269. ; $R1: NewOemOptionList
  270. ; $R2: OemOptionChosen
  271. ; $R3: OemOptionChosenText
  272. ; $R4: OEMINFSource
  273. ;
  274. ;------------------------------------------------------------------------
  275. [GetNewOEMOption]
  276. ;
  277. set Status = STATUS_FAILED
  278. set Option = $($2)
  279. set OptDisketteSrc = $($3)
  280. set OptionalDlgText = $($4)
  281. set OptDiskette = #(OptionDiskettes$($0), $($2), 1)
  282. set InfName1 = "OEMSETUP.INF"
  283. set InfName2 = "OEMSETNT.INF"
  284. set Abb = #(Options, $(Option), 1)
  285. set NewOemOptionList = $($1)
  286. set OptionChosen = ""
  287. set OptionChosenText = ""
  288. ;
  289. ; Prompt the user for the diskette containing the INF
  290. ;
  291. ask_dodiskette = +
  292. ;
  293. ; Reset the INF name to the standard default
  294. ;
  295. set InfName = $(InfName1)
  296. shell "" DoDiskette $($0) $(OptDiskette) $(OptDisketteSrc)
  297. set Status = STATUS_FAILED
  298. ifstr(i) $($R0) == STATUS_USERCANCEL
  299. set Status = STATUS_USERCANCEL
  300. goto finish_GetOEMOption
  301. else-ifstr(i) $($R0) == STATUS_FAILED
  302. goto finish_GetOEMOption
  303. endif
  304. set OptDisketteSrc = $($R1)
  305. ;
  306. ; Check that the Diskette contains an INF we are looking for
  307. ;
  308. ask_inf_retry = +
  309. FlushInf $(InfName)
  310. LibraryProcedure FileToCheck, $(!LIBHANDLE), AppendBackSlash $(OptDisketteSrc)
  311. set FileToCheck = $(FileToCheck)$(InfName)
  312. install Install-SeeIfFileIsPresent
  313. set OemSetupFilePath = $(FileToCheck)
  314. set NfError = 1
  315. ifstr(i) $(STATUS) == YES
  316. set NfError = 2
  317. ;
  318. ; Check that the INF represents the option we are looking for
  319. ;
  320. shell $(OemSetupFilePath) Identify
  321. ifstr(i) $($R0) == "STATUS_SUCCESSFUL"
  322. ifstr(i) $($R1) == $(Option)
  323. ForListDo $(!STF_BUSTYPELIST)
  324. shell $(OemSetupFilePath) ReturnOptions $($0) $($)
  325. ifstr(i) $($R0) == STATUS_SUCCESSFUL
  326. set OemList = $($R1)
  327. set OemTextList = $($R2)
  328. goto asksingleselection
  329. endif
  330. EndForListDo
  331. endif
  332. endif
  333. endif
  334. ;
  335. ; The file isn't in NT format; try the alternate name.
  336. ;
  337. ifstr(i) $(InfName) == $(InfName1)
  338. Set InfName = $(InfName2)
  339. goto ask_inf_retry
  340. endif
  341. read-syms NonFatalError$(NfError)$($0)
  342. shell "subroutn.inf" SetupMessage $($0) "NONFATAL" $(NonFatal)
  343. goto ask_dodiskette
  344. ;
  345. ; Present the OEM options to the user. Let the user select. If
  346. ; the user selects to cancel, don't change anything, just return
  347. ;
  348. asksingleselection = +
  349. shell "" DoSingleOption $(OemList) $(OemTextList) $(OptDiskette) $(OptionalDlgText)
  350. ifstr(i) $($R0) == STATUS_FAILED
  351. set Status = STATUS_FAILED
  352. goto finish_GetOEMOption
  353. else-ifstr(i) $($R0) == STATUS_USERCANCEL
  354. set Status = STATUS_USERCANCEL
  355. goto finish_GetOEMOption
  356. endif
  357. set OptionChosen = $($R1)
  358. set OptionChosenText = $($R2)
  359. ;
  360. ; Determine the file name to use to copy over. First see if the INF
  361. ; is a duplicate
  362. ;
  363. set Duplicate = FALSE
  364. ForListDo $($1)
  365. ifstr(i) *($($), 2) == $(OemList)
  366. set OemFileName = *($($), 1)
  367. set Duplicate = TRUE
  368. FlushInf $(OemFileName)
  369. goto copyinf
  370. endif
  371. EndForListDo
  372. ;
  373. ; Not a duplicate, we need to copy it under a unique name.
  374. ;
  375. set Num = 0
  376. nextinf = +
  377. ifint $(Num) < 99
  378. set OemFileName = "oem"$(Abb)$(Num)".inf"
  379. set FileToCheck = $(!STF_WINDOWSSYSPATH)"\"$(OemFileName)
  380. install Install-SeeIfFileIsPresent
  381. ifstr(i) $(STATUS) == "YES"
  382. set-add Num = $(Num) 1
  383. goto nextinf
  384. else
  385. goto copyinf
  386. endif
  387. endif
  388. goto finish_GetOEMOption
  389. copyinf = +
  390. ;
  391. ; copy the INF over to the windows system directory
  392. ;
  393. set OemSrc = $(OemSetupFilePath)
  394. set OemDst = $(!STF_WINDOWSSYSPATH)"\"$(OemFileName)
  395. install Install-OemINF
  396. ;
  397. ; form the new oem option list
  398. ;
  399. ifstr(i) $(Duplicate) == TRUE
  400. else
  401. set NewOemOptionList = >($(NewOemOptionList), {$(OemFileName), $(OemList), $(OemTextList)})
  402. endif
  403. set Status = STATUS_SUCCESSFUL
  404. finish_GetOEMOption = +
  405. FlushInf $(InfName)
  406. Return $(Status) $(NewOemOptionList) $(OptionChosen) $(OptionChosenText) $(OptDisketteSrc)
  407. ;-----------------------------------------------------------------------
  408. ;
  409. ; ROUTINE: GetNewOEMMultiOption
  410. ;
  411. ; DESCRIPTION: This routine prompts the user for a new OEM file, presents
  412. ; the options supported and if the user chooses one of these
  413. ; copies over the INF to the windows system directory.
  414. ;
  415. ; INPUTS: $0: Language to use
  416. ; $1: OemOptionList
  417. ; $2: OptionTypeList; e.g., { NetService, NetTransport }
  418. ; $3: OptDisketteSource
  419. ; $4: (Optional) Dialog Text
  420. ;
  421. ; OUTPUTS: $R0: STATUS: STATUS_SUCCESSFUL |
  422. ; STATUS_USERCANCEL |
  423. ; STATUS_FAILED |
  424. ;
  425. ; $R1: NewOemOptionList
  426. ; $R2: OemOptionChosen
  427. ; $R3: OemOptionChosenText
  428. ; $R4: OEMINFSource
  429. ;
  430. ;------------------------------------------------------------------------
  431. [GetNewOEMMultiOption]
  432. Debug-Output $(STF_CONTEXTINFNAME)": GetNewOEMMultiOption called"
  433. set Status = STATUS_FAILED
  434. set OptionType = ""
  435. set OptionTypeList = $($2)
  436. set OptDisketteSrc = $($3)
  437. set OptionalDlgText = $($4)
  438. set InfName1 = "OEMSETUP.INF"
  439. set InfName2 = "OEMSETNT.INF"
  440. read-syms OptionDisketteMulti$($0)
  441. Set TypeNames = ^(Options,0)
  442. Set TypeAbbs = ^(Options,1)
  443. set NewOemOptionList = $($1)
  444. set OptionChosen = ""
  445. set OptionChosenText = ""
  446. ;
  447. ; Prompt the user for the diskette containing the INF
  448. ;
  449. m_ask_dodiskette = +
  450. Debug-Output $(STF_CONTEXTINFNAME)": GetNewOEMMultiOption shelling DoDiskette"
  451. ;
  452. ; Reset the INF name to the standard default
  453. ;
  454. set InfName = $(InfName1)
  455. shell "" DoDiskette $($0) $(OptDiskette) $(OptDisketteSrc)
  456. set Status = STATUS_FAILED
  457. ifstr(i) $($R0) == STATUS_USERCANCEL
  458. set Status = STATUS_USERCANCEL
  459. goto m_finish_GetOEMOption
  460. else-ifstr(i) $($R0) == STATUS_FAILED
  461. goto m_finish_GetOEMOption
  462. endif
  463. set OptDisketteSrc = $($R1)
  464. ;
  465. ; Check that the Diskette contains an INF we are looking for
  466. ;
  467. m_ask_inf_retry = +
  468. FlushInf $(InfName)
  469. LibraryProcedure FileToCheck, $(!LIBHANDLE), AppendBackSlash $(OptDisketteSrc)
  470. set FileToCheck = $(FileToCheck)$(InfName)
  471. install Install-SeeIfFileIsPresent
  472. set OemSetupFilePath = $(FileToCheck)
  473. set NfError = 1
  474. ifstr(i) $(STATUS) == YES
  475. set NfError = 2
  476. ;
  477. ; Check that the INF represents the option we are looking for
  478. ;
  479. shell $(OemSetupFilePath) Identify
  480. ifstr(i) $($R0) == "STATUS_SUCCESSFUL"
  481. ifcontains(i) $($R1) in $(OptionTypeList)
  482. Set OptionType = $($R1)
  483. ForListDo $(!STF_BUSTYPELIST)
  484. shell $(OemSetupFilePath) ReturnOptions $($0) $($)
  485. ifstr(i) $($R0) == STATUS_SUCCESSFUL
  486. set OemList = $($R1)
  487. set OemTextList = $($R2)
  488. goto m_asksingleselection
  489. endif
  490. EndForListDo
  491. endif
  492. endif
  493. endif
  494. ;
  495. ; The file wasn't found or isn't in NT format; try the alternate name.
  496. ;
  497. ifstr(i) $(InfName) == $(InfName1)
  498. Set InfName = $(InfName2)
  499. goto m_ask_inf_retry
  500. endif
  501. read-syms NonFatalError$(NfError)$($0)
  502. shell "subroutn.inf" SetupMessage $($0) "NONFATAL" $(NonFatal)
  503. goto m_ask_dodiskette
  504. ;
  505. ; Present the OEM options to the user. Let the user select. If
  506. ; the user selects to cancel, don't change anything, just return
  507. ;
  508. m_asksingleselection = +
  509. shell "" DoSingleOption $(OemList) $(OemTextList) $(OptDiskette) $(OptionalDlgText)
  510. ifstr(i) $($R0) == STATUS_FAILED
  511. set Status = STATUS_FAILED
  512. goto m_finish_GetOEMOption
  513. else-ifstr(i) $($R0) == STATUS_USERCANCEL
  514. set Status = STATUS_USERCANCEL
  515. goto m_finish_GetOEMOption
  516. endif
  517. set OptionChosen = $($R1)
  518. set OptionChosenText = $($R2)
  519. ;
  520. ; Determine the file name to use to copy over. First see if the INF
  521. ; is a duplicate
  522. ;
  523. set Duplicate = FALSE
  524. ForListDo $($1)
  525. ifstr(i) *($($), 2) == $(OemList)
  526. set OemFileName = *($($), 1)
  527. set Duplicate = TRUE
  528. FlushInf $(OemFileName)
  529. goto m_copyinf
  530. endif
  531. EndForListDo
  532. ;
  533. ; Not a duplicate, we need to copy it under a unique name.
  534. ;
  535. set Num = 0
  536. Set Abb = *($(TypeAbbs),~($(TypeNames),$(OptionType)))
  537. m_nextinf = +
  538. ifint $(Num) < 99
  539. set OemFileName = "oem"$(Abb)$(Num)".inf"
  540. Debug-Output "OTHER.INF: Checking winsyspath for "$(OemFileName)
  541. set FileToCheck = $(!STF_WINDOWSSYSPATH)"\"$(OemFileName)
  542. install Install-SeeIfFileIsPresent
  543. ifstr(i) $(STATUS) == "YES"
  544. set-add Num = $(Num) 1
  545. goto m_nextinf
  546. else
  547. goto m_copyinf
  548. endif
  549. endif
  550. goto m_finish_GetOEMOption
  551. m_copyinf = +
  552. ;
  553. ; copy the INF over to the windows system directory
  554. ;
  555. set OemSrc = $(OemSetupFilePath)
  556. set OemDst = $(!STF_WINDOWSSYSPATH)"\"$(OemFileName)
  557. install Install-OemINF
  558. ;
  559. ; form the new oem option list
  560. ;
  561. ifstr(i) $(Duplicate) == TRUE
  562. else
  563. set NewOemOptionList = >($(NewOemOptionList), {$(OemFileName), $(OemList), $(OemTextList)})
  564. endif
  565. set Status = STATUS_SUCCESSFUL
  566. m_finish_GetOEMOption = +
  567. FlushInf $(InfName)
  568. Return $(Status) $(NewOemOptionList) $(OptionChosen) $(OptionChosenText) $(OptDisketteSrc)
  569. ;-----------------------------------------------------------------------
  570. ;
  571. ; ROUTINE: DoDiskette
  572. ;
  573. ; DESCRIPTION: This routine prompts the OEM for the source of the OEM
  574. ; Diskette
  575. ;
  576. ; INPUTS: $0: Language
  577. ; $1: OemDiskette
  578. ; $2: OemDisketteSrc
  579. ;
  580. ; OUTPUTS: $R0: STATUS: STATUS_SUCCESSFUL |
  581. ; STATUS_USERCANCEL |
  582. ; STATUS_FAILED
  583. ;
  584. ; $R1: Diskette Src
  585. ;
  586. ;------------------------------------------------------------------------
  587. [DoDiskette]
  588. ;
  589. ;
  590. set Status = STATUS_FAILED
  591. set OemDiskette = $($1)
  592. set OemDisketteSrc = $($2)
  593. Debug-Output $(STF_CONTEXTINFNAME)": DoDiskette called"
  594. read-syms DisketteDlg$($0)
  595. ui start "Diskette"
  596. ifstr(i) $(DLGEVENT) == "CONTINUE"
  597. set OemDisketteSrc = $(EditTextOut)
  598. ui pop 1
  599. set Status = STATUS_SUCCESSFUL
  600. goto finish_dodiskette
  601. else-ifstr(i) $(DLGEVENT) == "BACK"
  602. ui pop 1
  603. set Status = STATUS_USERCANCEL
  604. goto finish_dodiskette
  605. else
  606. ui pop 1
  607. goto finish_dodiskette
  608. endif
  609. finish_dodiskette = +
  610. Return $(Status) $(OemDisketteSrc)
  611. ;-----------------------------------------------------------------------
  612. ;
  613. ; ROUTINE: DoSingleOption
  614. ;
  615. ; DESCRIPTION: This routine presents the OEM Options to the user to
  616. ; get a selectiom
  617. ;
  618. ; INPUTS: $0: OptionList
  619. ; $1: OptionTextList
  620. ; $2: OptionTypeText
  621. ; $3: (Optional) dialog text
  622. ;
  623. ; OUTPUTS: $R0: STATUS: STATUS_SUCCESSFUL |
  624. ; STATUS_USERCANCEL |
  625. ; STATUS_FAILED
  626. ;
  627. ; $R1: OptionChosen
  628. ; $R2: OptionChosenText
  629. ;
  630. ;------------------------------------------------------------------------
  631. [DoSingleOption]
  632. set Status = STATUS_FAILED
  633. set OemOptionChosen = ""
  634. set OemOptionChosenText = ""
  635. set OemOptionList = $($0)
  636. set OemOptionTextList = $($1)
  637. set OemOptionTypeText = $($2)
  638. read-syms OemSingleOptionDlg$(!STF_LANGUAGE)
  639. ifstr(i) $($3) != ""
  640. set DlgText = $($3)
  641. endif
  642. ui start "Diskette"
  643. ifstr(i) $(DLGEVENT) == "CONTINUE"
  644. ui pop 1
  645. ifstr(i) $(ListItemsOut) == ""
  646. set Status = STATUS_USERCANCEL
  647. else
  648. set OemOptionChosenText = $(ListItemsOut)
  649. set OemOptionChosen = *($($0), ~($(ListItemsIn), $(ListItemsOut)))
  650. set Status = STATUS_SUCCESSFUL
  651. endif
  652. goto finish_dosingleoption
  653. else-ifstr(i) $(DLGEVENT) == "BACK"
  654. ui pop 1
  655. set Status = STATUS_USERCANCEL
  656. goto finish_dosingleoption
  657. else
  658. ui pop 1
  659. set Status = STATUS_FAILED
  660. goto finish_dosingleoption
  661. endif
  662. finish_dosingleoption = +
  663. Return $(Status) $(OemOptionChosen) $(OemOptionChosenText)
  664. ;-----------------------------------------------------------------------
  665. ;
  666. ; ROUTINE: GetOptionsFromRegistry
  667. ;
  668. ; DESCRIPTION: Extract previously cached INF file option information
  669. ; from the Registry.
  670. ;
  671. ;
  672. ; INPUTS: $0: OptionType
  673. ; $1: OptionFileName
  674. ;
  675. ; OUTPUTS: $R0: STATUS: STATUS_SUCCESSFUL |
  676. ; STATUS_FAILED
  677. ;
  678. ; $R1: OptionList
  679. ; $R2: OptionTextList
  680. ;
  681. ; COMMENTARY:
  682. ; The Registry information was stored like this:
  683. ;
  684. ; HKEY_LOCAL_MACHINE\System\Setup\InfOptions\<filename>
  685. ;
  686. ; The Registry information is stored like this:
  687. ;
  688. ; HKEY_LOCAL_MACHINE\Software\Microsoft\Ncpa\InfOptions\<filename>
  689. ;
  690. ; DateLow = REG_DWORD <lsw of numeric timestamp of file>
  691. ;
  692. ; # Keys named <optionType>.<bus ID>
  693. ;
  694. ; NetDriver.ISA
  695. ; OptionList = REG_MULTI_SZ <list of options>
  696. ; OptionTextList = REG_MULTI_SZ <list of text options>
  697. ;
  698. ;------------------------------------------------------------------------
  699. [GetOptionsFromRegistry]
  700. Set InfType = $($0)
  701. Set InfFullName = $($1)
  702. Set Status = STATUS_FAILED
  703. Set OptionList = {}
  704. Set OptionTextList = {}
  705. Set KeyInf = ""
  706. Set KeyType = ""
  707. Set RegLastError = $(!REG_ERROR_SUCCESS)
  708. ;
  709. ; See if there's a bus type defined. If not,don't even try.
  710. ;
  711. Ifstr(i) $(!STF_BUSTYPE) == ""
  712. goto finish_getregoptions
  713. Endif
  714. ;
  715. ; Extract the file name from the tail of the full path\name
  716. ;
  717. Split-String $(InfFullName) "\" NameInfo
  718. QueryListSize NameInfoListSize $(NameInfo)
  719. Set InfName = *($(NameInfo),$(NameInfoListSize))
  720. Set KeyName = "Software\Microsoft\Ncpa\InfOptions\"$(InfName)
  721. OpenRegKey $(!REG_H_LOCAL) "" $(KeyName) $(!REG_KEY_READ) KeyInf
  722. Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  723. goto finish_getregoptions
  724. Endif
  725. ;
  726. ; Key exists. Validate the file date/time stamp.
  727. ;
  728. Set FileDateTimeName = $(InfName)
  729. Detect DetectFileTime
  730. Set TimeLow = *($(FileDateTime),1)
  731. Ifint $(TimeLow) == 0
  732. goto finish_getregoptions
  733. Endif
  734. GetRegValue $(KeyInf) DateLow ValueRegTimeLow
  735. Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  736. goto finish_getregoptions
  737. Endif
  738. Set RegTimeLow = *($(ValueRegTimeLow),4)
  739. Ifint $(TimeLow) != $(RegTimeLow)
  740. goto finish_getregoptions
  741. Endif
  742. ;
  743. ; Date time stamp matches. See if there's info
  744. ; for the given option type on the current bus
  745. ;
  746. ForListDo $(!STF_BUSTYPELIST)
  747. Set TypeKeyName = $(InfType)"."$($)
  748. OpenRegKey $(KeyInf) "" $(TypeKeyName) $(!REG_KEY_READ) KeyType
  749. ifint $(RegLastError) == $(!REG_ERROR_SUCCESS )
  750. goto findit
  751. endif
  752. EndForListDo
  753. Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  754. ;
  755. ; No option data for this type.
  756. ; Not supported by this INF.
  757. ;
  758. Set Status = STATUS_SUCCESSFUL
  759. goto finish_getregoptions
  760. Endif
  761. findit = +
  762. ;
  763. ; Fetch the option list and the option text list.
  764. ;
  765. GetRegValue $(KeyType) OptionList ValueOptionList
  766. Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  767. goto finish_getregoptions
  768. Endif
  769. Set OptionList = *($(ValueOptionList),4)
  770. GetRegValue $(KeyType) OptionTextList ValueOptionTextList
  771. Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  772. goto finish_getregoptions
  773. Endif
  774. Set OptionTextList = *($(ValueOptionTextList),4)
  775. Set Status = STATUS_SUCCESSFUL
  776. finish_getregoptions =+
  777. Ifstr(i) $(Status) != STATUS_SUCCESSFUL
  778. Set OptionList = {}
  779. Set OptionTextList = {}
  780. Endif
  781. Ifstr(i) $(KeyType) != ""
  782. CloseRegKey $(KeyType)
  783. Endif
  784. Ifstr(i) $(KeyInf) != ""
  785. CloseRegKey $(KeyInf)
  786. Endif
  787. return $(Status) $(OptionList) $(OptionTextList)
  788. ;-----------------------------------------------------------------------
  789. ;
  790. ; ROUTINE: SetOptionsIntoRegistry
  791. ;
  792. ; DESCRIPTION: Update cached INF file option information into
  793. ; the Registry.
  794. ;
  795. ;
  796. ; INPUTS: $0: OptionType
  797. ; $1: OptionFileName
  798. ; $2: OptionList
  799. ; $3: OptionTextList
  800. ;
  801. ; OUTPUTS: $R0: STATUS: STATUS_SUCCESSFUL |
  802. ; STATUS_USERCANCEL |
  803. ; STATUS_FAILED
  804. ;
  805. ;
  806. ;------------------------------------------------------------------------
  807. [SetOptionsIntoRegistry]
  808. Debug-Output "OTHER.INF: SetOptionsIntoRegistry - Entry "$($0)", "$($1)", "$($2)", "$($3)
  809. Set OptionType = $($0)
  810. Set InfFullName = $($1)
  811. Set OptionList = $($2)
  812. Set OptionTextList = $($3)
  813. Set MaskAllAccess = 33554432
  814. Set NoTitle = 0
  815. Set RegLastError = $(!REG_ERROR_SUCCESS)
  816. Set Status = STATUS_FAILED
  817. Set KeyInf = ""
  818. ;
  819. ; See if there's a bus type defined. If not,don't even try.
  820. ;
  821. Ifstr(i) $(!STF_BUSTYPE) == ""
  822. goto finish_setregoptions
  823. Endif
  824. ;
  825. ; Extract the file name from the tail of the full path\name
  826. ;
  827. Split-String $(InfFullName) "\" NameInfo
  828. QueryListSize NameInfoListSize $(NameInfo)
  829. Set InfName = *($(NameInfo),$(NameInfoListSize))
  830. Set KeyInfName = "SOFTWARE\Microsoft\Ncpa\InfOptions\"$(InfName)
  831. Set KeyOptName = $(OptionType)"."$(!STF_BUSTYPE)
  832. ;
  833. ; Get the time stamp for this file; check for failure.
  834. ;
  835. Set FileDateTimeName = $(InfName)
  836. Detect DetectFileTime
  837. Set TimeLsw = *($(FileDateTime),1)
  838. Ifint $(TimeLsw) == 0
  839. goto finish_setregoptions
  840. Endif
  841. ;
  842. ; Create or open the key for this INF.
  843. ;
  844. Set KeyInfo = {$(KeyInfName),$(NoTitle),""}
  845. OpenRegKey $(!REG_H_LOCAL) "" $(KeyInfName) $(MaskAllAccess) KeyInf
  846. ifstr(i) $(KeyInf) == ""
  847. CreateRegKey $(!REG_H_LOCAL) $(KeyInfo) "" $(MaskAllAccess) "" KeyInf
  848. Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  849. Debug-Output "OTHER.INF: SetOptionsIntoRegistry - Reg Error"$(KeyInfo)
  850. goto finish_setregoptions
  851. Endif
  852. Endif
  853. ;
  854. ; Create or open the key for this type
  855. ;
  856. Set KeyInfo = {$(KeyOptName),$(NoTitle),""}
  857. OpenRegKey $(KeyInf) "" $(KeyOptName) $(MaskAllAccess) KeyType
  858. ifstr(i) $(KeyType) == ""
  859. CreateRegKey $(KeyInf) $(KeyInfo) "" $(MaskAllAccess) "" KeyType
  860. Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  861. Debug-Output "OTHER.INF: SetOptionsIntoRegistry - Reg Error"$(KeyInfo)
  862. goto finish_setregoptions
  863. Endif
  864. Endif
  865. ;
  866. ; Write the values. First the time stamp (under the INF key),
  867. ; then the lists (under the type.bustype sub-key).
  868. ;
  869. Set ValueInfo = {DateLow, $(NoTitle), $(!REG_VT_DWORD), $(TimeLsw)}
  870. SetRegValue $(KeyInf) $(ValueInfo)
  871. Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  872. goto finish_setregoptions
  873. Endif
  874. Set ValueInfo = {OptionList, $(NoTitle), $(!REG_VT_MULTI_SZ), $(OptionList)}
  875. SetRegValue $(KeyType) $(ValueInfo)
  876. Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  877. goto finish_setregoptions
  878. Endif
  879. Set ValueInfo = {OptionTextList, $(NoTitle), $(!REG_VT_MULTI_SZ), $(OptionTextList)}
  880. SetRegValue $(KeyType) $(ValueInfo)
  881. Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  882. goto finish_setregoptions
  883. Endif
  884. Set Status = STATUS_SUCCESSFUL
  885. finish_setregoptions =+
  886. Ifstr(i) $(KeyType) != ""
  887. CloseRegKey $(KeyType)
  888. ;
  889. ; If the update operation failed, nuke the type.bustype key and values
  890. ;
  891. Ifstr(i) $(Status) != STATUS_SUCCESSFUL
  892. DeleteRegTree $(KeyOptName)
  893. Endif
  894. Endif
  895. Ifstr(i) $(KeyInf) != ""
  896. CloseRegKey $(KeyInf)
  897. Endif
  898. Debug-Output "OTHER.INF: SetOptionsIntoRegistry - Exit "$(Status)
  899. return $(Status)
  900. [Install-SeeIfFileIsPresent]
  901. LibraryProcedure STATUS,$(!LIBHANDLE), CheckFileExistance $(FileToCheck)
  902. exit
  903. [Install-OemINF]
  904. LibraryProcedure STATUS,$(!NCPA_HANDLE), CopySingleFile $(!STF_HWND) $(OemSrc) $(OemDst)
  905. exit