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.

1113 lines
34 KiB

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