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.

1077 lines
31 KiB

  1. ;***********************************************************************
  2. ;
  3. ; OEMNADDP.INF
  4. ;
  5. ; DEC PC and driver SETUP INF file.
  6. ;
  7. ; History:
  8. ; davidhov 00-Feb-1992 Created
  9. ; terryk 27-Feb-1992 Reorganize section location
  10. ; added comment
  11. ; terryk 03-Mar-1992 Changed to DecPC setup
  12. ; terryk 02-Apr-1992 Code review changed
  13. ; davidhov 03-Apr-1992 Enhanced to use new INF section
  14. ; structure from SunilP, et al.
  15. ;
  16. ;***********************************************************************
  17. ;-----------------------------------------------------------------------
  18. ; OPTION TYPE
  19. ; -----------
  20. ; This identifies the Option type we are dealing with. The different
  21. ; possible types are:
  22. ;
  23. ; COMPUTER, DISPLAY, MOUSE, KEYBOARD, LAYOUT, SCSI, PRINTER, ...
  24. ;
  25. ; Types specific to networking:
  26. ;
  27. ; NetAdapter, a netcard / adapter combination or just a netcard
  28. ; NetDriver, just a netcard driver
  29. ; NetTransport, a complete NDIS-compliant TDI transport stack
  30. ; NetService, an NT networking service
  31. ; NetWork, a complete network ensemble.
  32. ; NetProvider a complete network which supports NT MPR protocol
  33. ;-----------------------------------------------------------------------
  34. [Identification]
  35. OptionType = NetAdapter
  36. ;-----------------------------------------------------------------------
  37. ; PlatformsSupported
  38. ; ------------------
  39. ; This identifies the platforms supported by the adapter card.
  40. ; Possible types are:
  41. ;
  42. ; ISA, EISA and MCA
  43. ;-----------------------------------------------------------------------
  44. [PlatformsSupported]
  45. ISA
  46. "Jazz-Internal Bus"
  47. ;-----------------------------------------------------------------------
  48. ; OPTION LIST
  49. ; -----------
  50. ; This section lists the OEM Option key names. These keys are locale
  51. ; independent and used to represent the option in a locale independent
  52. ; manner.
  53. ;
  54. ;-----------------------------------------------------------------------
  55. [Options]
  56. DECPC
  57. ;***********************************************************************
  58. ; CONSTANTS FOR USING DIALOGS
  59. ;***********************************************************************
  60. [FileConstants]
  61. ;
  62. ; File names, etc.
  63. ;
  64. UtilityInf = "UTILITY.INF"
  65. subroutineinf = "SUBROUTN.INF"
  66. SoftwareType = "driver"
  67. Exit_Code = 0
  68. ;ShellCode = 0
  69. ;
  70. ; EventLog Message File
  71. ;
  72. NetEventDLL = "%SystemRoot%\System32\netevent.dll"
  73. IoLogMsgDLL = "%SystemRoot%\System32\IoLogMsg.dll"
  74. ;
  75. ; Product Info
  76. ;
  77. Manufacturer = "Microsoft"
  78. ProductMajorVersion = "4"
  79. ProductMinorVersion = "0"
  80. ProductVersion = $(ProductMajorVersion)"."$(ProductMinorVersion)
  81. ;
  82. ; Software
  83. ;
  84. ProductSoftwareName = "Lance"
  85. ProductSoftwareImagePath = "\SystemRoot\System32\drivers\lance.sys"
  86. NetRuleSoftwareType = "lanceSys ndisDriver lanceDriver"
  87. NetRuleSoftwareUse = $(SoftwareType)
  88. NetRuleSoftwareBindForm = """LanceSys"" yes no container"
  89. NetRuleSoftwareClass = {"lanceDriver basic"}
  90. ;
  91. ; Hardware
  92. ;
  93. ProductHardwareName = "Lance"
  94. NetRuleHardwareType = "decpc decpcAdapter"
  95. NetRuleHardwareBindForm = " yes yes container"
  96. NetRuleHardwareClass = {"decpcAdapter basic"}
  97. ProductOpSupport = 134 ; 0x0086 ; Display,Removable,Properties,Not Updatable
  98. ;
  99. ; Registry Key
  100. ;
  101. ProductKeyName = $(!NTN_SoftwareBase)"\"$(Manufacturer)"\"$(ProductSoftwareName)"\CurrentVersion"
  102. ParamKeyName = $(!NTN_ServiceBase)$(ProductHardwareName)"\Parameters"
  103. [GeneralConstants]
  104. ;
  105. ; Program flow control variables.
  106. ;
  107. from = ""
  108. to = ""
  109. ;
  110. ; Return codes; Exit_Code is set to one of these
  111. ;
  112. ExitCodeOk = 0
  113. ExitCodeCancel = 1
  114. ExitCodeFatal = 2
  115. KeyNull = ""
  116. MAXIMUM_ALLOWED = 33554432
  117. RegistryErrorIndex = NO_ERROR
  118. KeyProduct = ""
  119. KeyParameters = ""
  120. TRUE = 1
  121. FALSE = 0
  122. NoTitle = 0
  123. ExitState = "Active"
  124. OldVersionExisted = $(FALSE)
  125. DriverPath = $(!STF_NTPATH)\drivers
  126. [date]
  127. ; Now is a list which contains { Sec from 1-1-1970, Year, Month, Day, Hour,
  128. ; Minute, Second }
  129. Now = {} ? $(!LIBHANDLE) GetSystemDate
  130. ;-----------------------------------------------
  131. ; Input DIALOGS
  132. ;-----------------------------------------------
  133. ; no UI for DEC PC
  134. ;---------------------------------------------------------------------------
  135. ; 1. Identify
  136. ;
  137. ; DESCRIPTION: To verify that this INF deals with the same type of options
  138. ; as we are choosing currently.
  139. ;
  140. ; INPUT: None
  141. ;
  142. ; OUTPUT: $($R0): STATUS: STATUS_SUCCESSFUL
  143. ; $($R1): Option Type (COMPUTER ...)
  144. ; $($R2): Diskette description
  145. ;---------------------------------------------------------------------------
  146. [Identify]
  147. ;
  148. ;
  149. read-syms Identification
  150. set Status = STATUS_SUCCESSFUL
  151. set Identifier = $(OptionType)
  152. set Media = #("Source Media Descriptions", 1, 1)
  153. Return $(Status) $(Identifier) $(Media)
  154. ;------------------------------------------------------------------------
  155. ; 2. ReturnOptions:
  156. ;
  157. ; DESCRIPTION: To return the option list supported by this INF and the
  158. ; localised text list representing the options.
  159. ;
  160. ;
  161. ; INPUT: $($0): Language used. ( ENG | FRN | ... )
  162. ;
  163. ; OUTPUT: $($R0): STATUS: STATUS_SUCCESSFUL |
  164. ; STATUS_NOLANGUAGE
  165. ; STATUS_FAILED
  166. ; STATUS_NOTSUPPORTED
  167. ;
  168. ; $($R1): Option List
  169. ; $($R2): Option Text List
  170. ;------------------------------------------------------------------------
  171. [ReturnOptions]
  172. ;
  173. ;
  174. set Status = STATUS_FAILED
  175. set OptionList = {}
  176. set OptionTextList = {}
  177. ;
  178. ; Check if the language requested is supported
  179. ;
  180. set LanguageList = ^(LanguagesSupported, 1)
  181. Ifcontains(i) $($0) in $(LanguageList)
  182. ;
  183. ; Check if the platforms requested is supported
  184. ;
  185. ifstr(i) $($1) == ""
  186. goto returnoptions
  187. endif
  188. set PlatformList = ^(PlatformsSupported, 1)
  189. Ifcontains(i) $($1) in $(PlatformList)
  190. goto returnoptions
  191. else
  192. set Status = STATUS_NOTSUPPORTED
  193. goto finish_ReturnOptions
  194. endif
  195. else
  196. set Status = STATUS_NOLANGUAGE
  197. goto finish_ReturnOptions
  198. endif
  199. ;
  200. ; form a list of all the options and another of the text representing
  201. ;
  202. returnoptions = +
  203. set OptionList = ^(Options, 1)
  204. set OptionTextList = ^(OptionsText$($0), 1)
  205. set Status = STATUS_SUCCESSFUL
  206. finish_ReturnOptions = +
  207. Return $(Status) $(OptionList) $(OptionTextList)
  208. ;----------InstallOption-------------------------------------------------
  209. ;
  210. ; InstallOption:
  211. ;
  212. ; This section is shelled to by main installation processing
  213. ; or by NCPASHEL.INF during reconfig, removal, update, etc.
  214. ;
  215. ;
  216. ; FUNCTION: To copy files representing Options
  217. ; To configure the installed option
  218. ; To update the registry for the installed option
  219. ;
  220. ; INPUT: $($0): Language to use
  221. ; $($1): OptionID to install
  222. ; $($2): SourceDirectory
  223. ; $($3): AddCopy (YES | NO)
  224. ; $($4): DoCopy (YES | NO)
  225. ; $($5): DoConfig (YES | NO)
  226. ;
  227. ; OUTPUT: $($R0): STATUS: STATUS_SUCCESSFUL |
  228. ; STATUS_NOLANGUAGE |
  229. ; STATUS_USERCANCEL |
  230. ; STATUS_FAILED
  231. ;
  232. ;------------------------------------------------------------------------
  233. [InstallOption]
  234. ;
  235. ; extract parameters
  236. ;
  237. set Option = $($1)
  238. set SrcDir = $($2)
  239. set AddCopy = $($3)
  240. set DoCopy = $($4)
  241. set DoConfig = $($5)
  242. ;
  243. ; Check if the language requested is supported
  244. ;
  245. set LanguageList = ^(LanguagesSupported, 1)
  246. Ifcontains(i) $($0) NOT-IN $(LanguageList)
  247. Return STATUS_NOLANGUAGE
  248. endif
  249. Debug-Output "OEMNADDP.INF: STF_CWDIR is: "$(!STF_CWDIR)
  250. Debug-Output "OEMNADDP.INF: STF_LANGUAGE is: "$(!STF_LANGUAGE)
  251. ; define all the constants
  252. set-subst LF = "\n"
  253. read-syms GeneralConstants
  254. read-syms FileConstants
  255. Shell $(UtilityInf), GetBindingInfo, "DEC"
  256. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  257. Debug-Output "ShellCode error: cannot get an error string."
  258. goto ShellCodeError
  259. endif
  260. set NetRuleSoftwareBindable = $($R1)
  261. read-syms DialogConstants$(!STF_LANGUAGE)
  262. ifstr(i) $(!NTN_Origination) == "NCPA"
  263. set Continue = $(OK)
  264. endif
  265. read-syms FileConstants$(!STF_LANGUAGE)
  266. detect date
  267. set-title $(FunctionTitle)
  268. set to = Begin
  269. set from = Begin
  270. ;
  271. ; Assume all is well.
  272. ;
  273. set CommonStatus = STATUS_SUCCESSFUL
  274. EndWait
  275. ;
  276. ; Set up the operation-mode-based variables and gaily welcome
  277. ; the user. If the "install mode" variable is improperly set,
  278. ; assume this is a new installation.
  279. ;
  280. Begin = +
  281. Ifstr(i) $(!NTN_InstallMode) == deinstall
  282. set StartLabel = removeadapter
  283. else-Ifstr(i) $(!NTN_InstallMode) == bind
  284. set StartLabel = bindingadapter
  285. else-Ifstr(i) $(!NTN_InstallMode) == Update
  286. set StartLabel = UpgradeSoftware
  287. else-Ifstr(i) $(!NTN_InstallMode) == configure
  288. set CommonStatus = STATUS_REBOOT
  289. set StartLabel = configureadapter
  290. ;
  291. ; You cannot config the software component
  292. ;
  293. Ifstr(i) $(ProductKeyName) == $(!NTN_RegBase)
  294. Debug-Output "Cannot configure the DEC PC driver software."
  295. Shell $(UtilityInf),RegistryErrorString,CANNOT_CONFIGURE_SOFTWARE
  296. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  297. Debug-Output "ShellCode error: cannot get an error string."
  298. goto ShellCodeError
  299. endif
  300. set Error = $($R0)
  301. set from = end
  302. set to = end
  303. goto nonfatalinfo
  304. endif
  305. else
  306. set StartLabel = installadapter
  307. set OEM_ABANDON_OPTIONS = {}
  308. set OEM_ABANDON_SOFTWARE = FALSE
  309. set OEM_ABANDON_ON = TRUE
  310. endif
  311. set from = $(fatal)
  312. set to = $(fatal)
  313. goto $(StartLabel)
  314. ;-----------------------------------------------
  315. ; Installation Section
  316. ;-----------------------------------------------
  317. installadapter = +
  318. ;
  319. ; First, check whether the same version of the software exists
  320. ;
  321. OpenRegKey $(!REG_H_LOCAL) "" $(ProductKeyName) $(MAXIMUM_ALLOWED) KeyProduct
  322. Ifstr $(KeyProduct) != $(KeyNull)
  323. ;
  324. ; Same version already existed in the local machine
  325. ; Popup the dialog and ask the user whether he wants to continue
  326. ;
  327. CloseRegKey $(KeyProduct)
  328. ifstr(i) !(NTN_RegBase) == $(ProductKeyName)
  329. ;
  330. ; Cannot Install the same software again
  331. ;
  332. Shell $(UtilityInf), VerExistedDlg, $(ProductSoftwareTitle),+
  333. $(ProductVersion)
  334. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  335. Debug-Output "ShellCode error: cannot get an error string."
  336. goto ShellCodeError
  337. endif
  338. goto end
  339. else
  340. ;
  341. ; Add a new adapter card?
  342. ;
  343. Shell $(UtilityInf), CardExistedDlg
  344. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  345. Debug-Output "ShellCode error: cannot get an error string."
  346. goto ShellCodeError
  347. endif
  348. ifstr(i) $($R1) != "OK"
  349. set CommonStatus = STATUS_USERCANCEL
  350. goto end
  351. endif
  352. set OldVersionExisted = $(TRUE)
  353. endif
  354. endif
  355. goto adapteroptions
  356. ;-----------------------------------------------
  357. ; Configuration Section
  358. ;-----------------------------------------------
  359. ;
  360. ; Get the current values of all the parameters
  361. ;
  362. configureadapter = +
  363. Ifstr $(KeyProduct) == $(KeyNull)
  364. OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_RegBase) $(MAXIMUM_ALLOWED) KeyProduct
  365. Ifstr $(KeyProduct) == $(KeyNull)
  366. set RegistryErrorIndex = CANNOT_FIND_COMPONENT_SERVICE
  367. Debug-Output "Cannot find component product key"
  368. goto fatalregistry
  369. Endif
  370. Endif
  371. ;
  372. ; Get the other parameters; they're attached to the service parameters key
  373. ;
  374. Debug-Output "INF: Shelling to FindService"
  375. Shell $(UtilityInf) FindService, $(KeyProduct)
  376. Ifint $($ShellCode) != $(!SHELL_CODE_OK)
  377. Debug-Output "INF: FindService shell failure"
  378. Goto ShellCodeError
  379. Endif
  380. Ifstr(i) $($R0) != NO_ERROR
  381. Debug-Output "INF: FindService Shell error: "$($R0)
  382. Goto fatalregistry
  383. endif
  384. set KeyParameters = $($R2)
  385. ;
  386. ; We don't need the services key, so close it.
  387. ;
  388. CloseRegKey $($R1)
  389. Ifstr $(KeyParameters) == $(KeyNull)
  390. set RegistryErrorIndex = CANNOT_FIND_COMPONENT_SERVICE
  391. Debug-Output "Cannot find component service"
  392. goto fatalregistry
  393. endif
  394. set OldVersionExisted = $(TRUE )
  395. set ValueName = ""
  396. set ValueData = ""
  397. set ValueStr = ""
  398. set ValueList = {}
  399. ;
  400. ; Get the old values
  401. ;
  402. EnumRegValue $(KeyParameters) ValueList
  403. ForListDo $(ValueList)
  404. set ValueItem = $($)
  405. set ValueName = *($(ValueItem),1)
  406. set ValueData = *($(ValueItem),4)
  407. Ifstr(i) $(ValueName) == "BusType"
  408. set BusInterfaceType = $(ValueData)
  409. else-ifstr(i) $(ValueName) == "BusNumber"
  410. set BusNumber = $(ValueData)
  411. endif
  412. EndForListDo
  413. goto adapteroptions
  414. ;
  415. ; Let the user bang on the options until satisfied.
  416. ;
  417. adapteroptions = +
  418. set from = adapteroptions
  419. ifstr(i) $(!STF_GUI_UNATTENDED) == "YES"
  420. ifstr(i) $(!AutoNetInterfaceType) != ""
  421. set BusInterfaceType = $(!AutoNetInterfaceType)
  422. else
  423. set BusInterfaceType = 1 ;ISA
  424. endif
  425. ifstr(i) $(!AutoNetBusNumber) != ""
  426. set BusNumber = $(!AutoNetBusNumber)
  427. else
  428. set BusNumber = 0
  429. endif
  430. goto nextstep
  431. endif
  432. ;
  433. ; If installing, go create the necessary keys;
  434. ; if configuring, they're already open.
  435. ;
  436. ifstr(i) $(!STF_NCDETINFO) == {}
  437. ; not detect. popup dialog.
  438. Shell $(UtilityInf),GetBusTypeDialog,$(ProductHardwareDescription) $(BusInterfaceType) $(BusNumber)
  439. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  440. Debug-Output "ShellCode error."
  441. goto ShellCodeError
  442. endif
  443. set BusInterfaceType = $($R1)
  444. set BusNumber = $($R2)
  445. else
  446. ; use the STF_NCDETINFO information
  447. set BusInterfaceType = *($(!STF_NCDETINFO),5)
  448. set BusNumber = *($(!STF_NCDETINFO),6)
  449. endif
  450. nextstep = +
  451. ifint $(OldVersionExisted) == $(TRUE)
  452. ifstr(i) $(!NTN_InstallMode) == configure
  453. goto writeparameters
  454. endif
  455. endif
  456. StartWait
  457. ;
  458. ; Install Software Component
  459. ;
  460. ifint $(OldVersionExisted) == $(FALSE)
  461. Ifstr(i) $(DoCopy) == "YES"
  462. Shell $(UtilityInf), DoAskSource, $(!STF_CWDDIR), $(SrcDir) YES
  463. Ifint $($ShellCode) != $(!SHELL_CODE_OK)
  464. Goto ShellCodeError
  465. Else-Ifstr(i) $($R0) == STATUS_FAILED
  466. Shell $(UtilityInf) RegistryErrorString "ASK_SOURCE_FAIL"
  467. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  468. goto ShellCodeError
  469. endif
  470. set Error = $($R0)
  471. Goto fatal
  472. Else-Ifstr(i) $($R0) == STATUS_USERCANCEL
  473. Goto successful
  474. Endif
  475. Set SrcDir = $($R1)
  476. Endif
  477. install "Install-Option"
  478. ifstr(i) $(STF_INSTALL_OUTCOME) != STF_SUCCESS
  479. Shell $(UtilityInf) RegistryErrorString "UNABLE_COPY_FILE"
  480. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  481. goto ShellCodeError
  482. endif
  483. set Error = $($R0)
  484. goto fatal
  485. endif
  486. Shell $(UtilityInf), AddSoftwareComponent, $(Manufacturer), +
  487. $(ProductSoftwareName), +
  488. $(ProductSoftwareName), +
  489. $(ProductSoftwareTitle), $(STF_CONTEXTINFNAME), +
  490. $(ProductSoftwareImagePath), "kernel", "NDIS", {}, "",+
  491. $(NetEventDLL)
  492. Set OEM_ABANDON_SOFTWARE = TRUE
  493. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  494. Debug-Output "ShellCode error"
  495. goto ShellCodeError
  496. endif
  497. set RegistryErrorIndex = $($R0)
  498. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  499. EndWait
  500. Debug-Output "Registry error: add software components"
  501. CloseRegKey $($R1)
  502. CloseRegKey $($R2)
  503. CloseRegKey $($R3)
  504. CloseRegKey $($R4)
  505. CloseRegKey $($R5)
  506. goto fatalregistry
  507. endif
  508. ;
  509. ; At this point:
  510. ; $R1 contains the product version key handle;
  511. ; $R2 contains the NetRules subkey handle;
  512. ; $R3 contains the new Services key handle; and
  513. ; $R4 contains the Parameters key
  514. ; $R5 contains the Linkage Key
  515. ;
  516. set SoftProductKey = $($R1)
  517. Set SoftNetRuleKey = $($R2)
  518. Set SoftServiceKey = $($R3)
  519. Set SoftParameterKey = $($R4)
  520. Set SoftLinkageKey = $($R5)
  521. set NewValueList = {{SoftwareType,$(NoTitle),$(!REG_VT_SZ),$(SoftwareType)},+
  522. {MajorVersion,$(NoTitle),$(!REG_VT_DWORD),$(ProductMajorVersion)},+
  523. {MinorVersion,$(NoTitle),$(!REG_VT_DWORD),$(ProductMinorVersion)},+
  524. {Title,$(NoTitle),$(!REG_VT_SZ),$(ProductSoftwareTitle)},+
  525. {Description,$(NoTitle),$(!REG_VT_SZ),$(ProductSoftwareDescription)},+
  526. {ServiceName,$(NoTitle),$(!REG_VT_SZ),$(ProductSoftwareName)},+
  527. {InstallDate,$(NoTitle),$(!REG_VT_DWORD),*($(Now),1)}}
  528. Shell $(UtilityInf), AddValueList, $(SoftProductKey), $(NewValueList)
  529. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  530. Debug-Output "ShellCode error."
  531. goto ShellCodeError
  532. endif
  533. set RegistryErrorIndex = $($R0)
  534. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  535. EndWait
  536. Debug-Output "Resgitry error: add value list."
  537. CloseRegKey $(SoftProductKey)
  538. CloseRegKey $(SoftNetRuleKey)
  539. CloseRegKey $(SoftServiceKey)
  540. CloseRegKey $(SoftParameterKey)
  541. CloseRegKey $(SoftLinkageKey)
  542. goto fatalregistry
  543. endif
  544. set NewValueList = {{type,$(NoTitle),$(!REG_VT_SZ),$(NetRuleSoftwareType)},+
  545. {use,$(NoTitle),$(!REG_VT_SZ),$(NetRuleSoftwareUse)}, +
  546. {bindform,$(NoTitle),$(!REG_VT_SZ),$(NetRuleSoftwareBindForm)}, +
  547. {class,$(NoTitle),$(!REG_VT_MULTI_SZ),$(NetRuleSoftwareClass)}, +
  548. {bindable,$(NoTitle),$(!REG_VT_MULTI_SZ),$(NetRuleSoftwareBindable)}, +
  549. {InfOption,$(NoTitle),$(!REG_VT_SZ),$(Option)}}
  550. Shell $(UtilityInf), AddValueList, $(SoftNetRuleKey), $(NewValueList)
  551. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  552. Debug-Output "ShellCode error."
  553. goto ShellCodeError
  554. endif
  555. set RegistryErrorIndex = $($R0)
  556. CloseRegKey $(SoftProductKey)
  557. CloseRegKey $(SoftNetRuleKey)
  558. CloseRegKey $(SoftServiceKey)
  559. CloseRegKey $(SoftParameterKey)
  560. CloseRegKey $(SoftLinkageKey)
  561. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  562. EndWait
  563. Debug-Output "Resgitry error: add value list."
  564. goto fatalregistry
  565. endif
  566. endif
  567. ;
  568. ; Create the HARDWARE\Netcard region and its corresponding service
  569. ;
  570. Shell $(UtilityInf), AddHardwareComponent,$(ProductHardwareName),$(STF_CONTEXTINFNAME),$(ProductKeyName)
  571. ifint $($R4) != -1
  572. Set OEM_ABANDON_OPTIONS = >($(OEM_ABANDON_OPTIONS), $(!NTN_SoftwareBase)"\Microsoft\Windows NT\CurrentVersion\NetworkCards\"$($R4))
  573. endif
  574. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  575. Debug-Output "Cannot add hardware component"
  576. goto ShellCodeError
  577. endif
  578. set RegistryErrorIndex = $($R0)
  579. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  580. EndWait
  581. Debug-Output "Registry error: add hardware component"
  582. Debug-Output $(RegistryErrorIndex)
  583. CloseRegKey $($R1)
  584. CloseRegKey $($R2)
  585. CloseRegKey $($R3)
  586. goto fatalregistry
  587. endif
  588. ;
  589. ; At this point:
  590. ; $R1 Registry key variable for HARDWARE\Netcard\(n)
  591. ; $R2 Registry key variable for HARDWARE\Netcard\(n)\\NetRules
  592. ; $R3 Registry key handle for <service>\Parameters key
  593. ; $R4 Adapter number assigned to adapter
  594. ; $R5 Service name generated by combining svc name with adapter number
  595. ;
  596. set KeyParameters = $($R3)
  597. set KeyAdapterRules = $($R2)
  598. set AdapterNumber = $($R4)
  599. set NewValueList = {{Manufacturer,$(NoTitle),$(!REG_VT_SZ),$(Manufacturer)},+
  600. {Title,$(NoTitle),$(!REG_VT_SZ),"["$($R4)"] "$(ProductHardwareTitle)},+
  601. {Description,$(NoTitle),$(!REG_VT_SZ),$(ProductHardwareDescription)},+
  602. {ProductName,$(NoTitle),$(!REG_VT_SZ),$(ProductHardwareName)},+
  603. {ServiceName,$(NoTitle),$(!REG_VT_SZ),$($R5)},+
  604. {OperationsSupport,$(NoTitle),$(!REG_VT_DWORD),$(ProductOpSupport)},+
  605. {InstallDate,$(NoTitle),$(!REG_VT_DWORD),*($(Now),1)}}
  606. Shell $(UtilityInf), AddValueList, $($R1), $(NewValueList)
  607. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  608. Debug-Output "ShellCode error"
  609. goto ShellCodeError
  610. endif
  611. CloseRegKey $($R1)
  612. set TempProdName = """"$(ProductHardwareName)$(AdapterNumber)""""
  613. set TempBindForm = $(TempProdName)$(NetRuleHardwareBindForm)
  614. set NewValueList = {{type,$(NoTitle),$(!REG_VT_SZ),$(NetRuleHardwareType)},+
  615. {bindform,$(NoTitle),$(!REG_VT_SZ),$(TempBindForm)}, +
  616. {class,$(NoTitle),$(!REG_VT_MULTI_SZ),$(NetRuleHardwareClass)}, +
  617. {InfOption,$(NoTitle),$(!REG_VT_SZ),$(Option)}}
  618. Shell $(UtilityInf), AddValueList, $(KeyAdapterRules), $(NewValueList)
  619. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  620. Debug-Output "ShellCode error."
  621. goto ShellCodeError
  622. endif
  623. set RegistryErrorIndex = $($R0)
  624. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  625. EndWait
  626. Debug-Output "Resgitry error: add value list."
  627. CloseRegKey $(KeyParameters)
  628. CloseRegKey $(KeyAdapterRules)
  629. goto fatalregistry
  630. endif
  631. CloseRegKey $(KeyAdapterRules)
  632. ;
  633. ; Increase the driver reference count #
  634. ;
  635. OpenRegKey $(!REG_H_LOCAL) "" $(ProductKeyName) $(MAXIMUM_ALLOWED) KeyProduct
  636. Ifstr $(KeyProduct) == $(KeyNull)
  637. set RegistryErrorIndex = CANNOT_FIND_COMPONENT_SERVICE
  638. Debug-Output "Cannot find component product key"
  639. goto fatalregistry
  640. Endif
  641. CloseRegKey $(KeyProduct)
  642. goto writeparameters
  643. ;
  644. ; REQUIRED: $(KeyParameters) contains service Parameters key handle
  645. ;
  646. writeparameters = +
  647. ;
  648. ; Add the rest of the parameters to the Services area
  649. ;
  650. ; set CardTypeValue = DecPC
  651. set CardTypeValue = 3
  652. set NewValueList = {+
  653. {MediaType,$(NoTitle),$(!REG_VT_DWORD),1},+
  654. {BusType,$(NoTitle),$(!REG_VT_DWORD),$(BusInterfaceType)},+
  655. {BusNumber,$(NoTitle),$(!REG_VT_DWORD),$(BusNumber)},+
  656. {CardType,$(NoTitle),$(!REG_VT_DWORD),$(CardTypeValue)}+
  657. }
  658. Shell $(UtilityInf), AddValueList, $(KeyParameters), $(NewValueList)
  659. CloseRegKey $(KeyParameters)
  660. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  661. Debug-Output "ShellCode error."
  662. goto ShellCodeError
  663. endif
  664. set RegistryErrorIndex = $($R0)
  665. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  666. Debug-Output "Registry error: Add value list"
  667. goto fatalregistry
  668. endif
  669. EndWait
  670. goto successful
  671. ;-----------------------------------------------
  672. ; Binding section
  673. ;-----------------------------------------------
  674. bindingadapter =+
  675. set Error = "Binding: Sorry, not yet implemented."
  676. goto fatal
  677. ;-----------------------------------------------
  678. ; Removeadapter section
  679. ;-----------------------------------------------
  680. removeadapter = +
  681. Ifstr(i) $(ProductKeyName) == $(!NTN_RegBase)
  682. ; Remove Software Component
  683. Shell $(UtilityInf), RemoveSoftwareComponent, $(Manufacturer), +
  684. $(ProductSoftwareName)
  685. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  686. Debug-Output "ShellCode error"
  687. goto ShellCodeError
  688. endif
  689. set RegistryErrorIndex = $($R0)
  690. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  691. goto fatalregistry
  692. endif
  693. else
  694. Shell $(UtilityInf), RemoveHardwareComponent, $(Manufacturer), +
  695. $(ProductSoftwareName), $(!NTN_RegBase)
  696. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  697. Debug-Output "ShellCode error"
  698. goto ShellCodeError
  699. endif
  700. set RegistryErrorIndex = $($R0)
  701. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  702. goto fatalregistry
  703. endif
  704. endif
  705. goto end
  706. ;-----------------------------------------------
  707. ; Upgrade Software section
  708. ;-----------------------------------------------
  709. UpgradeSoftware = +
  710. ; Upgrade software component
  711. ;
  712. OpenRegKey $(!REG_H_LOCAL) "" $(ProductKeyName) $(MAXIMUM_ALLOWED) KeyProduct
  713. Ifstr $(KeyProduct) != $(KeyNull)
  714. install "Install-Update"
  715. ifstr(i) $(STF_INSTALL_OUTCOME) != STF_SUCCESS
  716. goto fatal
  717. endif
  718. ; Upgrade the version number
  719. ;
  720. SetRegValue $(KeyProduct) {MajorVersion,$(NoTitle),$(!REG_VT_SZ),$(ProductMajorVersion)}
  721. SetRegValue $(KeyProduct) {MinorVersion,$(NoTitle),$(!REG_VT_SZ),$(ProductMinorVersion)}
  722. ;
  723. ; do nothing for update
  724. ;
  725. CloseRegKey $(KeyProduct)
  726. else
  727. ;
  728. ; Cannot Open software key, goto ERROR
  729. ;
  730. goto fatalregistry
  731. endif
  732. ;
  733. ; Enumerate all netcards installed of this type and update them
  734. ;
  735. set iSearch = 1
  736. nextnetcard = +
  737. Shell $(UtilityInf), FindNextNetworkCard, $(ProductHardwareName), $(iSearch)
  738. set KeyNetcard = $($R0)
  739. set iSearch = $($R1)
  740. Debug-Output "OemNadEp.Inf: FindNextNetworkCard "$(KeyNetcard)","$(iSearch)
  741. Ifstr $(KeyNetcard) != $(KeyNull)
  742. Debug-Output "OemNadEp.Inf: Setting OperationsSupport value"
  743. SetRegValue $(KeyNetcard) {OperationsSupport,$(NoTitle),$(!REG_VT_DWORD),$(ProductOpSupport)}
  744. CloseRegKey $(KeyNetcard)
  745. goto nextnetcard
  746. Endif
  747. goto end
  748. ;
  749. ; End of Upgrade Software
  750. ;
  751. ;
  752. ; Escape hatches
  753. ;
  754. successful = +
  755. goto end
  756. abandon = +
  757. ForListDo $(OEM_ABANDON_OPTIONS)
  758. Shell $(UtilityInf), RemoveHardwareComponent, $(Manufacturer), +
  759. $(ProductSoftwareName), $($)
  760. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  761. Debug-Output "ShellCode error"
  762. goto ShellCodeError
  763. endif
  764. set RegistryErrorIndex = $($R0)
  765. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  766. goto fatalregistry
  767. endif
  768. EndForListDo
  769. Ifstr(i) $(OEM_ABANDON_SOFTWARE) == TRUE
  770. ; Remove Software Component
  771. Shell $(UtilityInf), RemoveSoftwareComponent, $(Manufacturer), +
  772. $(ProductSoftwareName), FALSE
  773. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  774. Debug-Output "ShellCode error"
  775. goto ShellCodeError
  776. endif
  777. set RegistryErrorIndex = $($R0)
  778. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  779. goto fatalregistry
  780. endif
  781. endif
  782. goto end
  783. ;
  784. ; warning display
  785. ;
  786. warning = +
  787. Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), "WARNING", $(Error)
  788. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  789. goto ShellCodeError
  790. endif
  791. ifstr(i) $($R1) == "OK"
  792. goto $(to)
  793. else-ifstr(i) $($R1) == "CANCEL"
  794. goto $(from)
  795. else
  796. ; Debug-Msg "Error Error Bad DLGEVENT"
  797. goto "end"
  798. endif
  799. ;
  800. ; non fatal error display
  801. ;
  802. nonfatalinfo = +
  803. Set CommonStatus = STATUS_USERCANCEL
  804. Set Severity = STATUS
  805. goto nonfatalmsg
  806. nonfatal = +
  807. Set Severity = NONFATAL
  808. goto nonfatalmsg
  809. nonfatalmsg = +
  810. ifstr(i) $(Error) == ""
  811. Set Severity = NONFATAL
  812. Shell $(UtilityInf) RegistryErrorString "SETUP_FAIL"
  813. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  814. goto ShellCodeError
  815. endif
  816. set Error = $($R0)
  817. endif
  818. Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), $(Severity), $(Error)
  819. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  820. goto ShellCodeError
  821. endif
  822. ifstr(i) $($R1) == "OK"
  823. goto $(from)
  824. else
  825. goto "end"
  826. endif
  827. ;
  828. ; Registry is broken
  829. ;
  830. fatalregistry = +
  831. Shell $(UtilityInf) RegistryErrorString $(RegistryErrorIndex)
  832. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  833. goto ShellCodeError
  834. endif
  835. set Error = $($R0)
  836. goto fatal
  837. ;
  838. ; fatal error display
  839. ;
  840. fatal = +
  841. ifstr(i) $(Error) == ""
  842. Shell $(UtilityInf) RegistryErrorString "SETUP_FAIL"
  843. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  844. goto ShellCodeError
  845. endif
  846. set Error = $($R0)
  847. endif
  848. Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), "FATAL", $(Error)
  849. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  850. goto ShellCodeError
  851. endif
  852. goto setfailed
  853. ;
  854. ; Shelling error
  855. ;
  856. ShellCodeError = +
  857. set DlgType = "MessageBox"
  858. set STF_MB_TITLE = $(ShellCodeErrorTitle)
  859. set STF_MB_TEXT = $(ShellCodeErrorText)
  860. set STF_MB_TYPE = 1
  861. set STF_MB_ICON = 3
  862. set STF_MB_DEF = 1
  863. ui start "Error Message"
  864. goto setfailed
  865. setfailed = +
  866. set CommonStatus = STATUS_FAILED
  867. ;
  868. ; if OEM_ABANDON_ON == TRUE, then remove the registry entries
  869. ;
  870. ifstr(i) $(OEM_ABANDON_ON) == TRUE
  871. set OEM_ABANDON_ON = FALSE
  872. goto abandon
  873. endif
  874. goto end
  875. end = +
  876. goto term
  877. term = +
  878. Return $(CommonStatus)
  879. ;***************************************************************
  880. ; INSTALL SECTIONS
  881. ;***************************************************************
  882. [Install-Option]
  883. set STF_VITAL = ""
  884. ifstr(i) $(AddCopy) == "YES"
  885. ;
  886. ; Add the files to the copy list
  887. ;
  888. ; BUGBUG: eliminate the "nt2" in the next line when Sunil fixes
  889. ; the other INF files
  890. ;
  891. AddSectionFilesToCopyList Files-$(Option) $(SrcDir) $(!STF_WINDOWSSYSPATH)\drivers
  892. endif
  893. ifstr(i) $(DoCopy) == "YES"
  894. ;
  895. ; Copy files in the copy list
  896. ;
  897. set !STF_NCPA_FLUSH_COPYLIST = TRUE
  898. CopyFilesInCopyList
  899. endif
  900. ifstr(i) $(DoConfig) == "YES"
  901. ;
  902. ; Add product to registry
  903. ;
  904. ;
  905. ; Finish up
  906. endif
  907. Exit
  908. [Install-Update]
  909. set STF_VITAL = ""
  910. set STF_OVERWRITE = "VERIFYSOURCEOLDER"
  911. ;set STF_VERSION = "YES"
  912. AddSectionFilesToCopyList Files-$(Option) $(SrcDir) $(!STF_WINDOWSSYSPATH)\drivers
  913. exit
  914.