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.

1059 lines
31 KiB

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