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.

876 lines
26 KiB

  1. [Identification]
  2. OptionType = NetAdapter
  3. [PlatformsSupported]
  4. PCI
  5. [Options]
  6. DEFPA
  7. [FileConstants]
  8. UtilityInf = "UTILITY.INF"
  9. ParamInf = "NCPARAM.INF"
  10. subroutineinf = "SUBROUTN.INF"
  11. SoftwareType = "driver"
  12. Exit_Code = 0
  13. NetEventDLL = "%SystemRoot%\System32\netevent.dll"
  14. IoLogMsgDLL = "%SystemRoot%\System32\IoLogMsg.dll"
  15. Manufacturer = "DigitalEquipment"
  16. ProductMajorVersion = "4"
  17. ProductMinorVersion = "0"
  18. ProductVersion = $(ProductMajorVersion)"."$(ProductMinorVersion)
  19. ProductSoftwareName = "Defpa"
  20. ProductSoftwareTitle = "DEC FDDIcontroller/PCI Driver"
  21. ProductSoftwareImagePath = "\SystemRoot\System32\drivers\defpa.sys"
  22. NetRuleSoftwareType = "defpaSys ndisDriver defpaDriver"
  23. NetRuleSoftwareUse = $(SoftwareType)
  24. NetRuleSoftwareBindForm = """DefpaSys"" yes no container"
  25. NetRuleSoftwareClass = {"defpaDriver basic"}
  26. NetRuleSoftwareBindable = {"defpaDriver defpaAdapter non exclusive 100"}
  27. ProductHardwareName = "Defpa"
  28. ProductHardwareTitle = "DEC FDDIcontroller/PCI Adapter"
  29. NetRuleHardwareType = "defpa defpaAdapter"
  30. NetRuleHardwareBindForm = " yes yes container"
  31. NetRuleHardwareClass = {"defpaAdapter basic"}
  32. ProductOpSupport = 134 ; 0x0086 ; Display,Removable,Properties,Not Updatable
  33. ProductKeyName = $(!NTN_SoftwareBase)"\"$(Manufacturer)"\"$(ProductSoftwareName)"\CurrentVersion"
  34. ParamKeyName = $(!NTN_ServiceBase)"\"$(ProductHardwareName)"\Parameters"
  35. [GeneralConstants]
  36. from = ""
  37. to = ""
  38. ExitCodeOk = 0
  39. ExitCodeCancel = 1
  40. ExitCodeFatal = 2
  41. KeyNull = ""
  42. MAXIMUM_ALLOWED = 33554432
  43. RegistryErrorIndex = NO_ERROR
  44. KeyProduct = ""
  45. KeyParameters = ""
  46. TRUE = 1
  47. FALSE = 0
  48. NoTitle = 0
  49. ExitState = "Active"
  50. OldVersionExisted = $(FALSE)
  51. DriverPath = $(!STF_NTPATH)\drivers
  52. Successful_Install = 0
  53. [date]
  54. Now = {} ? $(!LIBHANDLE) GetSystemDate
  55. [processor]
  56. PROC_TYPE = "" ? $(LIBHANDLE) GetProcessor
  57. [Identify]
  58. read-syms Identification
  59. set Status = STATUS_SUCCESSFUL
  60. set Identifier = $(OptionType)
  61. set Media = #("Source Media Descriptions", 1, 1)
  62. Return $(Status) $(Identifier) $(Media)
  63. [ReturnOptions]
  64. set Status = STATUS_FAILED
  65. set OptionList = {}
  66. set OptionTextList = {}
  67. set LanguageList = ^(LanguagesSupported, 1)
  68. Ifcontains(i) $($0) in $(LanguageList)
  69. ifstr(i) $($1) == ""
  70. goto returnoptions
  71. endif
  72. set PlatformList = ^(PlatformsSupported, 1)
  73. Ifcontains(i) $($1) in $(PlatformList)
  74. goto returnoptions
  75. else
  76. set Status = STATUS_NOTSUPPORTED
  77. goto finish_ReturnOptions
  78. endif
  79. else
  80. set Status = STATUS_NOLANGUAGE
  81. goto finish_ReturnOptions
  82. endif
  83. returnoptions = +
  84. set OptionList = ^(Options, 1)
  85. set OptionTextList = ^(OptionsText$($0), 1)
  86. set Status = STATUS_SUCCESSFUL
  87. finish_ReturnOptions = +
  88. Return $(Status) $(OptionList) $(OptionTextList)
  89. [InstallOption]
  90. ; set !DebugOutputControl = 1
  91. set Status = STATUS_FAILED
  92. set Option = $($1)
  93. set SrcDir = $($2)
  94. set AddCopy = $($3)
  95. set DoCopy = $($4)
  96. set DoConfig = $($5)
  97. set LanguageList = ^(LanguagesSupported, 1)
  98. Ifcontains(i) $($0) NOT-IN $(LanguageList)
  99. Return STATUS_NOLANGUAGE
  100. endif
  101. Debug-Output "OEMNAD??.INF: STF_CWDIR is: "$(!STF_CWDIR)
  102. Debug-Output "OEMNAD??.INF: STF_LANGUAGE is: "$(!STF_LANGUAGE)
  103. set-subst LF = "\n"
  104. SetHelpFile "defddi.hlp" 1 600
  105. read-syms GeneralConstants
  106. read-syms FileConstants
  107. read-syms DialogConstants$(!STF_LANGUAGE)
  108. ifstr(i) $(!NTN_Origination) == "NCPA"
  109. set Continue = "OK"
  110. endif
  111. read-syms FileConstants$(!STF_LANGUAGE)
  112. detect date
  113. set-title $(FunctionTitle)
  114. set to = Begin
  115. set from = Begin
  116. set CommonStatus = STATUS_SUCCESSFUL
  117. EndWait
  118. Begin = +
  119. ; set !DebugOutputControl = 1
  120. Ifstr(i) $(!NTN_InstallMode) == deinstall
  121. set StartLabel = removeadapter
  122. else-Ifstr(i) $(!NTN_InstallMode) == Update
  123. set StartLabel = UpgradeSoftware
  124. else-Ifstr(i) $(!NTN_InstallMode) == bind
  125. set StartLabel = bindingadapter
  126. else-Ifstr(i) $(!NTN_InstallMode) == configure
  127. set CommonStatus = STATUS_REBOOT
  128. set StartLabel = configureadapter
  129. Ifstr(i) $(ProductKeyName) == $(!NTN_RegBase)
  130. Debug-Output "Cannot configure the DEC FDDIcontroller/PCI driver software."
  131. Shell $(UtilityInf),RegistryErrorString,CANNOT_CONFIGURE_SOFTWARE
  132. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  133. Debug-Output "ShellCode error: cannot get an error string."
  134. goto ShellCodeError
  135. endif
  136. set Error = $($R0)
  137. set from = end
  138. set to = end
  139. goto nonfatalinfo
  140. endif
  141. else
  142. set StartLabel = installadapter
  143. set OEM_ABANDON_OPTIONS = {}
  144. set OEM_ABANDON_SOFTWARE = FALSE
  145. set OEM_ABANDON_ON = TRUE
  146. endif
  147. ;************ Detect Processor Type *****************
  148. ; LoadLibrary "" $(!STF_CWDDIR)setupdll.dll LIBHANDLE
  149. ; detect processor
  150. ; FreeLibrary $(LIBHANDLE)
  151. ; ifstr(i) $(PROC_TYPE) == Alpha_AXP
  152. ; set SourceDir = $(SrcDir)WINNT\ALPHA\
  153. ; else-ifstr(i) $(PROC_TYPE) == R4000
  154. ; set SourceDir = $(SrcDir)WINNT\MIPS\
  155. ; else
  156. ; set SourceDir = $(SrcDir)WINNT\INTEL\
  157. ; endif
  158. endif
  159. Debug-Output "NTN_Origination"$(!NTN_Origination)
  160. set from = $(fatal)
  161. set to = $(fatal)
  162. goto $(StartLabel)
  163. installadapter = +
  164. OpenRegKey $(!REG_H_LOCAL) "" $(ProductKeyName) $(MAXIMUM_ALLOWED) KeyProduct
  165. Ifstr $(KeyProduct) != $(KeyNull)
  166. CloseRegKey $(KeyProduct)
  167. ifstr(i) !(NTN_RegBase) == $(ProductKeyName)
  168. Shell $(UtilityInf), VerExistedDlg, $(ProductSoftwareTitle),+
  169. $(ProductVersion)
  170. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  171. Debug-Output "ShellCode error: cannot get an error string."
  172. goto ShellCodeError
  173. endif
  174. goto end
  175. else
  176. Shell $(UtilityInf), CardExistedDlg
  177. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  178. Debug-Output "ShellCode error: cannot get an error string."
  179. goto ShellCodeError
  180. endif
  181. ifstr(i) $($R1) != "OK"
  182. set CommonStatus = STATUS_USERCANCEL
  183. goto end
  184. endif
  185. set OldVersionExisted = $(TRUE)
  186. endif
  187. Endif
  188. Shell $(UtilityInf), DoAskSource, $(!STF_CWDDIR), $(SrcDir) YES
  189. Ifint $($ShellCode) != $(!SHELL_CODE_OK)
  190. Goto ShellCodeError
  191. Else-Ifstr(i) $($R0) == STATUS_FAILED
  192. Shell $(UtilityInf) RegistryErrorString "ASK_SOURCE_FAIL"
  193. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  194. goto ShellCodeError
  195. endif
  196. set Error = $($R0)
  197. Goto fatal
  198. Else-Ifstr(i) $($R0) == STATUS_USERCANCEL
  199. Goto successful
  200. Endif
  201. Set SrcDir = $($R1)
  202. install "Install-Option"
  203. Goto adapteroptions
  204. configureadapter = +
  205. Ifstr $(KeyProduct) == $(KeyNull)
  206. OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_RegBase) $(MAXIMUM_ALLOWED) KeyProduct
  207. Ifstr $(KeyProduct) == $(KeyNull)
  208. set RegistryErrorIndex = CANNOT_FIND_COMPONENT_SERVICE
  209. Debug-Output "Cannot find component product key"
  210. goto fatalregistry
  211. Endif
  212. Endif
  213. Debug-Output "INF: Shelling to FindService"
  214. Shell $(UtilityInf) FindService, $(KeyProduct)
  215. Ifint $($ShellCode) != $(!SHELL_CODE_OK)
  216. Debug-Output "INF: FindService shell failure"
  217. Goto ShellCodeError
  218. Endif
  219. Ifstr(i) $($R0) != NO_ERROR
  220. Debug-Output "INF: FindService Shell error: "$($R0)
  221. Goto fatalregistry
  222. endif
  223. Set KeyParameters = $($R2)
  224. CloseRegKey $($R1)
  225. Ifstr $(KeyParameters) == $(KeyNull)
  226. set RegistryErrorIndex = CANNOT_FIND_COMPONENT_SERVICE
  227. Debug-Output "Cannot find component service"
  228. goto fatalregistry
  229. endif
  230. set OldVersionExisted = $(TRUE)
  231. set ValueName = ""
  232. set ValueData = ""
  233. set ValueStr = ""
  234. set ValueList = {}
  235. EnumRegValue $(KeyParameters) ValueList
  236. ;***************** Read Registry Info for Defaults *****************
  237. ForListDo $(ValueList)
  238. set ValueItem = $($)
  239. set ValueName = *($(ValueItem),1)
  240. set ValueData = *($(ValueItem),4)
  241. ifstr(i) $(ValueName) == "BurstSize"
  242. set BurstSizeIndex = $(ValueData)
  243. else-ifstr(i) $(ValueName) == "BusNumber"
  244. set BusNumber = $(ValueData)
  245. else-ifstr(i) $(ValueName) == "CardInstance"
  246. set CardInstanceIndex = $(ValueData)
  247. else-ifstr(i) $(ValueName) == "FullDuplexEnable"
  248. set FullDuplexEnableIndex = $(ValueData)
  249. else-ifstr(i) $(ValueName) == "RcvBuffCnt"
  250. set RcvBuffCntIndex = $(ValueData)
  251. else-ifstr(i) $(ValueName) == "XmtBuffCnt"
  252. set XmtBuffCntIndex = $(ValueData)
  253. else-ifstr(i) $(ValueName) == "RequestedTTRT"
  254. set RequestedTTRTIndex = $(ValueData)
  255. endif
  256. EndForListDo
  257. ;***************** Set Values for User Display in Dialog Box *****************
  258. Set Caption = $(FunctionTitle)
  259. ifstr(i) $(FullDuplexEnableIndex) == 1
  260. set RadioIn = {1}
  261. else
  262. set RadioIn = {2}
  263. endif
  264. ifstr(i) $(RequestedTTRTIndex) == ""
  265. set EditText1 = 8
  266. else
  267. set EditText1 = $(RequestedTTRTIndex)
  268. endif
  269. ifstr(i) $(BusNumber) == ""
  270. set EditText2 = 0
  271. else
  272. set EditText2 = $(BusNumber)
  273. endif
  274. ifstr(i) $(CardInstanceIndex) == ""
  275. set EditText3 = 1
  276. else
  277. set EditText3 = $(CardInstanceIndex)
  278. endif
  279. set ReceiveBuffValue = *($(ReceiveBuffList), ~($(ReceiveBuffValues),$(RcvBuffCntIndex)))
  280. ifstr(i) $(ReceiveBuffValue) == ""
  281. set ReceiveBuffValue = 4
  282. endif
  283. set TransmitBuffValue = *($(TransmitBuffList), ~($(TransmitBuffValues),$(XmtBuffCntIndex)))
  284. ifstr(i) $(TransmitBuffValue) == ""
  285. set TransmitBuffValue = 32
  286. endif
  287. set BurstSizeValue = *($(BurstSizeList), ~($(BurstSizeValues),$(BurstSizeIndex)))
  288. ifstr(i) $(BurstSizeValue) == ""
  289. set BurstSizeValue = 16
  290. endif
  291. set RequestedTTRTValue = RequestedTTRTIndex
  292. ifstr(i) $(RequestedTTRTValue) == ""
  293. set RequestedTTRTValue = 8
  294. endif
  295. set CardInstanceValue = CardInstanceIndex
  296. ifstr(i) $(CardInstanceValue) == ""
  297. set CardInstanceValue = 1
  298. endif
  299. set BusNumberValue = BusNumber
  300. ifstr(i) $(BusNumberValue) == ""
  301. set BusNumberValue = 0
  302. endif
  303. ;***************** Display the Dialog ******************************
  304. displaydialog = +
  305. set ExitButton = ""
  306. LoadLibrary "x" $(!STF_WINDOWSSYSPATH)\$(DialogDllName) hLib
  307. read-syms FileDependentDlg$(!STF_LANGUAGE)
  308. restart = +
  309. set NotifyFields = {NO,NO,NO}
  310. ui start "InputDlg" $(hLib)
  311. set ExitButton = $(DLGEVENT)
  312. ifstr(i) $(DLGEVENT) == "CONTINUE"
  313. ifint *($(EditTextOut),1) < 4
  314. shell $(subroutineinf) SetupMessage ENG NONFATAL "Requested TTRT must be between 4 and 165 ms"
  315. goto restart
  316. else-ifint *($(EditTextOut),1) > 165
  317. shell $(subroutineinf) SetupMessage ENG NONFATAL "Requested TTRT must be between 4 and 165 ms"
  318. goto restart
  319. endif
  320. set RequestedTTRTIndex = *($(EditTextOut),1)
  321. set BusNumber = *($(EditTextOut),2)
  322. set CardInstanceIndex = *($(EditTextOut),3)
  323. set RcvBuffCntIndex = *($(ReceiveBuffValues), ~($(ReceiveBuffList),$(Combo1Out)))
  324. set XmtBuffCntIndex = *($(TransmitBuffValues), ~($(TransmitBuffList),$(Combo2Out)))
  325. set BurstSizeIndex = *($(BurstSizeValues), ~($(BurstSizeList),$(Combo3Out)))
  326. ifstr(i) *($(RadioOut),1) == 1
  327. Set FullDuplexEnableIndex = 1
  328. else
  329. Set FullDuplexEnableIndex = 2
  330. endif
  331. FreeLibrary $(hLib)
  332. ui pop 1
  333. ifstr(i) $(StartLabel) == installadapter
  334. Set Successful_Install = 1
  335. goto returnpoint
  336. endif
  337. else-ifstr(i) $(DLGEVENT) == "BACK"
  338. FreeLibrary $(hLib)
  339. ui pop 1
  340. ifstr(i) $(StartLabel) == installadapter
  341. goto returnpoint
  342. else
  343. CloseRegKey $(KeyParameters)
  344. set CommonStatus = STATUS_USERCANCEL
  345. Debug-Output "Action: exit. Bye."
  346. goto end
  347. endif
  348. else
  349. FreeLibrary $(hLib)
  350. ui pop 1
  351. Debug-Output "Action: unknown. Bye."
  352. goto end
  353. endif
  354. set NewValueList = {{RcvBuffCnt,$(NoTitle),$(!REG_VT_DWORD),$(RcvBuffCntIndex)},+
  355. {BurstSize,$(NoTitle),$(!REG_VT_DWORD),$(BurstSizeIndex)},+
  356. {XmtBuffCnt,$(NoTitle),$(!REG_VT_DWORD),$(XmtBuffCntIndex)},+
  357. {FullDuplexEnable,$(NoTitle),$(!REG_VT_DWORD),$(FullDuplexEnableIndex)},+
  358. {RequestedTTRT,$(NoTitle),$(!REG_VT_DWORD),$(RequestedTTRTIndex)}}
  359. Shell $(UtilityInf), AddValueList, $(KeyParameters), $(NewValueList)
  360. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  361. goto ShellCodeError
  362. endif
  363. CloseRegKey $(KeyParameters)
  364. goto successful
  365. adapteroptions = +
  366. StartWait
  367. installproduct = +
  368. ;**************** Install Hardware Component For Each***********************
  369. ;**************** Card and Store Params. In a List *************************
  370. Set BusNumber = 0
  371. Set CardInstance = 1
  372. Set ReceiveBuffValue = 4
  373. Set TransmitBuffValue = 32
  374. Set BurstSizeValue = 16
  375. Set EditText1 = 8
  376. Set EditText2 = 0
  377. Set EditText3 = 1
  378. Set RadioIn = {2}
  379. Set Caption = $(FunctionTitle)
  380. Set ExitButton = ""
  381. ;*********** Add Hardware Component For Each Card **********************
  382. set Vendor = 4113
  383. set CFID = 15
  384. Shell $(UtilityInf), GetPCIInformation, $(Vendor) $(CFID)
  385. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  386. goto ShellCodeError
  387. endif
  388. ifstr(i) $($R0) == {}
  389. set Error = $(CANNOT_FIND_ANY_CARD)
  390. set CommonStatus = USER_CANCEL
  391. set from = end
  392. goto nonfatal
  393. endif
  394. set AdapterList = $($R0)
  395. ;*************** Install Software Component If Needed*******************
  396. ifint $(OldVersionExisted) == $(FALSE)
  397. ifstr(i) $(!NTN_InstallMode) == "install"
  398. Shell $(UtilityInf), AddSoftwareComponent, $(Manufacturer), +
  399. $(ProductSoftwareName), +
  400. $(ProductSoftwareName), +
  401. $(ProductSoftwareTitle), $(STF_CONTEXTINFNAME), +
  402. $(ProductSoftwareImagePath), "kernel", "NDIS", {}, "",+
  403. $(NetEventDLL)
  404. Set OEM_ABANDON_SOFTWARE = TRUE
  405. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  406. Debug-Output "ShellCode error"
  407. goto ShellCodeError
  408. endif
  409. ; At this point:
  410. ; $R1 contains the product version key handle;
  411. ; $R2 contains the NetRules subkey handle;
  412. ; $R3 contains the new Services key handle; and
  413. ; $R4 contains the Parameters key
  414. ; $R5 contains the Linkage Key
  415. ;
  416. set RegistryErrorIndex = $($R0)
  417. set KeyProduct = $($R1)
  418. Set SoftNetRulesKey = $($R2)
  419. CloseRegKey $($R3)
  420. CloseRegKey $($R4)
  421. CloseRegKey $($R5)
  422. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  423. EndWait
  424. Debug-Output "Registry error: add software components"
  425. CloseRegKey $(KeyProduct)
  426. CloseRegKey $(SoftNetRulesKey)
  427. goto fatalregistry
  428. endif
  429. set NewValueList = {{SoftwareType,$(NoTitle),$(!REG_VT_SZ),$(SoftwareType)},+
  430. {MajorVersion,$(NoTitle),$(!REG_VT_DWORD),$(ProductMajorVersion)},+
  431. {MinorVersion,$(NoTitle),$(!REG_VT_DWORD),$(ProductMinorVersion)},+
  432. {Title,$(NoTitle),$(!REG_VT_SZ),$(ProductSoftwareTitle)},+
  433. {Description,$(NoTitle),$(!REG_VT_SZ),$(ProductSoftwareDescription)},+
  434. {ServiceName,$(NoTitle),$(!REG_VT_SZ),$(ProductSoftwareName)},+
  435. {InstallDate,$(NoTitle),$(!REG_VT_DWORD),*($(Now),1)}}
  436. Shell $(UtilityInf), AddValueList, $(KeyProduct), $(NewValueList)
  437. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  438. Debug-Output "ShellCode error."
  439. goto ShellCodeError
  440. endif
  441. set RegistryErrorIndex = $($R0)
  442. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  443. EndWait
  444. Debug-Output "Registry error: add value list."
  445. CloseRegKey $(KeyProduct)
  446. CloseRegKey $(SoftNetRulesKey)
  447. goto fatalregistry
  448. endif
  449. set NewValueList = {{type,$(NoTitle),$(!REG_VT_SZ),$(NetRuleSoftwareType)},+
  450. {use,$(NoTitle),$(!REG_VT_SZ),$(NetRuleSoftwareUse)}, +
  451. {bindform,$(NoTitle),$(!REG_VT_SZ),$(NetRuleSoftwareBindForm)}, +
  452. {class,$(NoTitle),$(!REG_VT_MULTI_SZ),$(NetRuleSoftwareClass)}, +
  453. {bindable,$(NoTitle),$(!REG_VT_MULTI_SZ),$(NetRuleSoftwareBindable)}, +
  454. {InfOption,$(NoTitle),$(!REG_VT_SZ),$(Option)}}
  455. Shell $(UtilityInf), AddValueList, $(SoftNetRulesKey), $(NewValueList)
  456. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  457. Debug-Output "ShellCode error."
  458. goto ShellCodeError
  459. endif
  460. set RegistryErrorIndex = $($R0)
  461. CloseRegKey $(KeyProduct)
  462. CloseRegKey $(SoftNetRulesKey)
  463. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  464. EndWait
  465. Debug-Output "Registry error: add value list."
  466. goto fatalregistry
  467. endif
  468. endif
  469. endif
  470. ForListDo $(AdapterList)
  471. set BusNum = *($($),1)
  472. set DeviceNum = *($($),2)
  473. set FunctionNum = *($($),3)
  474. Shell $(UtilityInf), AddHardwareComponent, $(ProductHardwareName),$(STF_CONTEXTINFNAME),$(ProductKeyName)
  475. ifint $($R4) != -1
  476. Set OEM_ABANDON_OPTIONS = >($(OEM_ABANDON_OPTIONS), $(!NTN_SoftwareBase)"\Microsoft\Windows NT\CurrentVersion\NetworkCards\"$($R4))
  477. endif
  478. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  479. Debug-Output "Cannot add hardware component"
  480. goto ShellCodeError
  481. endif
  482. set RegistryErrorIndex = $($R0)
  483. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  484. EndWait
  485. Debug-Output "Registry error: add hardware component"
  486. CloseRegKey $($R1)
  487. CloseRegKey $($R2)
  488. CloseRegKey $($R3)
  489. goto fatalregistry
  490. endif
  491. ;
  492. ; At this point:
  493. ; $R1 Registry key variable for HARDWARE\Netcard\(n)
  494. ; $R2 Registry key variable for HARDWARE\Netcard\(n)\\NetRules
  495. ; $R3 Registry key handle for <service>\Parameters key
  496. ; $R4 Adapter number assigned to adapter
  497. ; $R5 Service name generated by combining svc name with adapter number
  498. ;
  499. set KeyParameters = $($R3)
  500. set KeyAdapterRules = $($R2)
  501. set AdapterNumber = $($R4)
  502. set NewValueList = {{Manufacturer,$(NoTitle),$(!REG_VT_SZ),$(Manufacturer)},+
  503. {Title,$(NoTitle),$(!REG_VT_SZ),"["$($R4)"] "$(ProductHardwareTitle)},+
  504. {Description,$(NoTitle),$(!REG_VT_SZ),$(ProductHardwareDescription)},+
  505. {ProductName,$(NoTitle),$(!REG_VT_SZ),$(ProductHardwareName)},+
  506. {ServiceName,$(NoTitle),$(!REG_VT_SZ),$($R5)},+
  507. {OperationsSupport,$(NoTitle),$(!REG_VT_DWORD),$(ProductOpSupport)},+
  508. {InstallDate,$(NoTitle),$(!REG_VT_DWORD),*($(Now),1)}}
  509. Shell $(UtilityInf), AddValueList, $($R1), $(NewValueList)
  510. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  511. Debug-Output "ShellCode error"
  512. goto ShellCodeError
  513. endif
  514. CloseRegKey $($R1)
  515. set TempProdName = """"$(ProductHardwareName)$(AdapterNumber)""""
  516. set TempBindForm = $(TempProdName)$(NetRuleHardwareBindForm)
  517. set NewValueList = {{type,$(NoTitle),$(!REG_VT_SZ),$(NetRuleHardwareType)},+
  518. {bindform,$(NoTitle),$(!REG_VT_SZ),$(TempBindForm)}, +
  519. {class,$(NoTitle),$(!REG_VT_MULTI_SZ),$(NetRuleHardwareClass)}, +
  520. {InfOption,$(NoTitle),$(!REG_VT_SZ),$(Option)}}
  521. Shell $(UtilityInf), AddValueList, $(KeyAdapterRules), $(NewValueList)
  522. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  523. Debug-Output "ShellCode error."
  524. goto ShellCodeError
  525. endif
  526. set RegistryErrorIndex = $($R0)
  527. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  528. EndWait
  529. Debug-Output "Registry error: add value list."
  530. CloseRegKey $(KeyParameters)
  531. CloseRegKey $(KeyAdapterRules)
  532. goto fatalregistry
  533. endif
  534. CloseRegKey $(KeyAdapterRules)
  535. goto displaydialog
  536. returnpoint = +
  537. goto writeparameters
  538. ;
  539. ; REQUIRED: $(KeyParameters) contains service Parameters key handle
  540. ;
  541. writeparameters = +
  542. ;
  543. ; Add the rest of the parameters to the Services area
  544. ;
  545. set NewValueList = {{CardType,$(NoTitle),$(!REG_VT_DWORD),5},+
  546. {BusType,$(NoTitle),$(!REG_VT_DWORD),5},+
  547. {MediaType,$(NoTitle),$(!REG_VT_DWORD),3},+
  548. {BusNumber,$(NoTitle),$(!REG_VT_DWORD),$(BusNum)},+
  549. {AdapterCFID,$(NoTitle),$(!REG_VT_DWORD),987153},+
  550. {SlotNumber,$(NoTitle),$(!REG_VT_DWORD),$(DeviceNum)},+
  551. {FunctionNumber,$(NoTitle),$(!REG_VT_DWORD),$(FunctionNumber)},+
  552. {CardInstance,$(NoTitle),$(!REG_VT_DWORD),$(CardInstanceIndex)},+
  553. {RcvBuffCnt,$(NoTitle),$(!REG_VT_DWORD),$(RcvBuffCntIndex)},+
  554. {BurstSize,$(NoTitle),$(!REG_VT_DWORD),$(BurstSizeIndex)},+
  555. {XmtBuffCnt,$(NoTitle),$(!REG_VT_DWORD),$(XmtBuffCntIndex)},+
  556. {FullDuplexEnable,$(NoTitle),$(!REG_VT_DWORD),$(FullDuplexEnableIndex)},+
  557. {RequestedTTRT,$(NoTitle),$(!REG_VT_DWORD),$(RequestedTTRTIndex)}}
  558. Shell $(UtilityInf), AddValueList, $(KeyParameters), $(NewValueList)
  559. ifstr(i) $(!STF_GUI_UNATTENDED) == "YES"
  560. Shell $(UtilityInf),AddDefaultNetCardParameters,$(KeyParameters)
  561. endif
  562. CloseRegKey $(KeyParameters)
  563. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  564. Debug-Output "ShellCode error. (Add Value List)"
  565. goto ShellCodeError
  566. endif
  567. set RegistryErrorIndex = $($R0)
  568. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  569. Debug-Output "Registry error: Add value list"
  570. goto fatalregistry
  571. endif
  572. EndForListDo
  573. EndWait
  574. goto successful
  575. ;-----------------------------------------------
  576. ; Binding section
  577. ;-----------------------------------------------
  578. bindingadapter =+
  579. set Error = "Binding: Sorry, not yet implemented."
  580. goto fatal
  581. ;-----------------------------------------------
  582. ; Removeadapter section
  583. ;-----------------------------------------------
  584. removeadapter = +
  585. Ifstr(i) $(ProductKeyName) == $(!NTN_RegBase)
  586. Shell $(UtilityInf), RemoveSoftwareComponent, $(Manufacturer), +
  587. $(ProductSoftwareName)
  588. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  589. Debug-Output "ShellCode error"
  590. goto ShellCodeError
  591. endif
  592. set RegistryErrorIndex = $($R0)
  593. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  594. goto fatalregistry
  595. endif
  596. else
  597. Shell $(UtilityInf), RemoveHardwareComponent, $(Manufacturer), +
  598. $(ProductSoftwareName), $(!NTN_RegBase)
  599. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  600. Debug-Output "ShellCode error"
  601. goto ShellCodeError
  602. endif
  603. set RegistryErrorIndex = $($R0)
  604. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  605. goto fatalregistry
  606. endif
  607. endif
  608. goto end
  609. ;-----------------------------------------------
  610. ; Upgrade Software section
  611. ;-----------------------------------------------
  612. UpgradeSoftware = +
  613. OpenRegKey $(!REG_H_LOCAL) "" $(ProductKeyName) $(MAXIMUM_ALLOWED) KeyProduct
  614. Ifstr $(KeyProduct) != $(KeyNull)
  615. Shell $(UtilityInf), GetInfFileNameFromRegistry, $(KeyProduct)
  616. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  617. Debug-Output "ShellCode error"
  618. goto ShellCodeError
  619. endif
  620. set !UG_Filename = $($R0)
  621. install "Install-Update"
  622. ifstr(i) $(STF_INSTALL_OUTCOME) != STF_SUCCESS
  623. goto fatal
  624. endif
  625. ; Upgrade the version number
  626. ;
  627. SetRegValue $(KeyProduct) {MajorVersion,$(NoTitle),$(!REG_VT_SZ),$(ProductMajorVersion)}
  628. SetRegValue $(KeyProduct) {MinorVersion,$(NoTitle),$(!REG_VT_SZ),$(ProductMinorVersion)}
  629. CloseRegKey $(KeyProduct)
  630. ;
  631. ; Upgrade MediaType to correct value (3 instead of 4).
  632. OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_ServiceBase)"\"$(ProductHardwareName)"\Linkage" $(MAXIMUM_ALLOWED) LinkageKey
  633. ifstr(i) $(LinkageKey) != ""
  634. GetRegValue $(LinkageKey) Bind BindInfo
  635. ForListDo *($(BindInfo),4)
  636. Split-String $($) "\" CardInfo
  637. QueryListSize CardPos $(CardInfo)
  638. OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_ServiceBase)"\"*($(CardInfo),$(CardPos))"\Parameters" $(MAXIMUM_ALLOWED) ParamKey
  639. ifstr $(ParamKey) != ""
  640. SetRegValue $(ParamKey) {MediaType,$(NoTitle),$(!REG_VT_DWORD),3}
  641. CloseRegKey $(ParamKey)
  642. endif
  643. EndForListDo
  644. CloseRegKey $(LinkageKey)
  645. endif
  646. else
  647. ;
  648. ; Cannot Open software key, goto ERROR
  649. ;
  650. goto fatalregistry
  651. endif
  652. ;
  653. ; Enumerate all netcards installed of this type and update them
  654. ;
  655. set iSearch = 1
  656. nextnetcard = +
  657. Shell $(UtilityInf), FindNextNetworkCard, $(ProductHardwareName), $(iSearch)
  658. set KeyNetcard = $($R0)
  659. set iSearch = $($R1)
  660. Debug-Output "OemNadEp.Inf: FindNextNetworkCard "$(KeyNetcard)","$(iSearch)
  661. Ifstr $(KeyNetcard) != $(KeyNull)
  662. Debug-Output "OemNadEp.Inf: Setting OperationsSupport value"
  663. SetRegValue $(KeyNetcard) {OperationsSupport,$(NoTitle),$(!REG_VT_DWORD),$(ProductOpSupport)}
  664. CloseRegKey $(KeyNetcard)
  665. goto nextnetcard
  666. Endif
  667. goto end
  668. successful = +
  669. goto end
  670. abandon = +
  671. ForListDo $(OEM_ABANDON_OPTIONS)
  672. Shell $(UtilityInf), RemoveHardwareComponent, $(Manufacturer), +
  673. $(ProductSoftwareName), $($)
  674. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  675. Debug-Output "ShellCode error"
  676. goto ShellCodeError
  677. endif
  678. set RegistryErrorIndex = $($R0)
  679. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  680. goto fatalregistry
  681. endif
  682. EndForListDo
  683. Ifstr(i) $(OEM_ABANDON_SOFTWARE) == TRUE
  684. Shell $(UtilityInf), RemoveSoftwareComponent, $(Manufacturer), +
  685. $(ProductSoftwareName), FALSE
  686. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  687. Debug-Output "ShellCode error"
  688. goto ShellCodeError
  689. endif
  690. set RegistryErrorIndex = $($R0)
  691. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  692. goto fatalregistry
  693. endif
  694. endif
  695. goto end
  696. ;
  697. ; warning display
  698. ;
  699. warning = +
  700. Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), "WARNING", $(Error)
  701. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  702. goto ShellCodeError
  703. endif
  704. ifstr(i) $($R1) == "OK"
  705. goto $(to)
  706. else-ifstr(i) $($R1) == "CANCEL"
  707. goto $(from)
  708. else
  709. goto "end"
  710. endif
  711. ;
  712. ; non fatal error display
  713. ;
  714. nonfatalinfo = +
  715. Set Severity = STATUS
  716. Set CommonStatus = STATUS_USERCANCEL
  717. goto nonfatalmsg
  718. nonfatal = +
  719. Set Severity = NONFATAL
  720. goto nonfatalmsg
  721. nonfatalmsg = +
  722. ifstr(i) $(Error) == ""
  723. Set Severity = NONFATAL
  724. Shell $(UtilityInf) RegistryErrorString "SETUP_FAIL"
  725. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  726. goto ShellCodeError
  727. endif
  728. set Error = $($R0)
  729. endif
  730. Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), $(Severity), $(Error)
  731. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  732. goto ShellCodeError
  733. endif
  734. ifstr(i) $($R1) == "OK"
  735. goto $(from)
  736. else
  737. goto "end"
  738. endif
  739. ;
  740. ; Registry is broken
  741. ;
  742. fatalregistry = +
  743. Shell $(UtilityInf) RegistryErrorString $(RegistryErrorIndex)
  744. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  745. goto ShellCodeError
  746. endif
  747. set Error = $($R0)
  748. goto fatal
  749. ;
  750. ; fatal error display
  751. ;
  752. fatal = +
  753. ifstr(i) $(Error) == ""
  754. Shell $(UtilityInf) RegistryErrorString "SETUP_FAIL"
  755. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  756. goto ShellCodeError
  757. endif
  758. set Error = $($R0)
  759. endif
  760. Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), "FATAL", $(Error)
  761. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  762. goto ShellCodeError
  763. endif
  764. goto setfailed
  765. ;
  766. ; Shelling error
  767. ;
  768. ShellCodeError = +
  769. set DlgType = "MessageBox"
  770. set STF_MB_TITLE = $(ShellCodeErrorTitle)
  771. set STF_MB_TEXT = $(ShellCodeErrorText)
  772. set STF_MB_TYPE = 1
  773. set STF_MB_ICON = 3
  774. set STF_MB_DEF = 1
  775. ui start "Error Message"
  776. goto setfailed
  777. setfailed = +
  778. set CommonStatus = STATUS_FAILED
  779. ifstr(i) $(OEM_ABANDON_ON) == TRUE
  780. set OEM_ABANDON_ON = FALSE
  781. goto abandon
  782. endif
  783. goto end
  784. end = +
  785. goto term
  786. term = +
  787. Return $(CommonStatus)
  788. [Install-Option]
  789. set STF_VITAL = ""
  790. ifstr(i) $(AddCopy) == "YES"
  791. AddSectionFilesToCopyList Files-$(Option) $(SrcDir) $(!STF_WINDOWSSYSPATH)\drivers
  792. endif
  793. ifstr(i) $(DoCopy) == "YES"
  794. set !STF_NCPA_FLUSH_COPYLIST = TRUE
  795. CopyFilesInCopyList
  796. endif
  797. Exit
  798. [Install-Update]
  799. set STF_VITAL = ""
  800. set STF_OVERWRITE = "VERIFYSOURCEOLDER"
  801. AddSectionFilesToCopyList Files-$(Option) $(SrcDir) $(!STF_WINDOWSSYSPATH)\drivers
  802. AddSectionFilesToCopyList Files-Inf $(SrcDir) $(!STF_WINDOWSSYSPATH)
  803. set !STF_NCPA_FLUSH_COPYLIST = TRUE
  804. CopyFilesInCopyList
  805. exit