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.

4790 lines
152 KiB

  1. ;*************************************************************************
  2. ;
  3. ; UTILITY.INF
  4. ;
  5. ; Network Installation utility functions. Each major piece of
  6. ; functionality is coded as a [Section], and is invoked by name from
  7. ; the outer level INF. See TEMPLATE.INF for example usage.
  8. ;
  9. ; CHANGES:
  10. ; DavidHov 6/11/92 Added Service"Linkage" key return
  11. ; value to [AddSoftwareComponent]
  12. ;
  13. ; DavidHov 8/24/92 Add WinSock support routines for
  14. ; transports
  15. ;
  16. ;
  17. ;
  18. ;*************************************************************************
  19. ;
  20. ;--------------------------------------------------------------------------
  21. ; Header to be used at the front of all externally available INF sections.
  22. ;--------------------------------------------------------------------------
  23. ;
  24. ;*************************************************************************
  25. ;
  26. ; SECTION: sectionname
  27. ;
  28. ; PURPOSE: <describe purpose of section>
  29. ;
  30. ; ARGUMENTS: $0
  31. ; $1
  32. ;
  33. ; RETURNS: $R0
  34. ; $R1
  35. ;
  36. ; REFERENCES: <list of global or parent variables referenced>
  37. ;
  38. ; MODIFIES: <list of global or parent variables modified>
  39. ;
  40. ;
  41. ;*************************************************************************
  42. ;*************************************************************************
  43. ; end of section sectionname
  44. ;*************************************************************************
  45. ;
  46. ; Initialize general constants
  47. ;
  48. [InitBaseVars]
  49. KeyNull = ""
  50. MAXIMUM_ALLOWED = 33554432
  51. KeyInfo = {}
  52. RegistryErrorIndex = NO_ERROR
  53. NoTitle = 0
  54. CurrentControlSet = "SYSTEM\CurrentControlSet"
  55. ServicesBaseName = $(CurrentControlSet)"\Services"
  56. NetworkCardKeyName = $(!NTN_SoftwareBase)"\Microsoft\Windows NT\CurrentVersion\NetworkCards"
  57. !RegLastError = NO_ERROR
  58. [RegistryErrorSetup]
  59. RegistryErrorIndex = ^(RegistryErrors$(!STF_LANGUAGE),1)
  60. RegistryErrorList = ^(RegistryErrors$(!STF_LANGUAGE),2)
  61. ;*************************************************************************
  62. ;
  63. ; SECTION: RegistryErrorString
  64. ;
  65. ; PURPOSE: Translate a numeric registry error code into a string
  66. ;
  67. ; ARGUMENTS: $0 Registry error code
  68. ;
  69. ; RETURNS: $R0 String containing displayable text in language
  70. ;
  71. ; REFERENCES: !STF_LANGUAGE -- global "user's language" variable;
  72. ; see [RegistryErrorSetup]
  73. ;
  74. ; MODIFIES: Nothing
  75. ;
  76. ;
  77. ;*************************************************************************
  78. [RegistryErrorString]
  79. read-syms RegistryErrorSetup
  80. read-syms RegistryErrorUnknown$(!STF_LANGUAGE)
  81. set RE_String = *($(RegistryErrorList),~($(RegistryErrorIndex),$($0)))
  82. Ifstr $(RE_String) == ""
  83. set RE_String = $(Error_Bogus)
  84. endif
  85. return $(RE_String)
  86. ;*************************************************************************
  87. ; end of section RegistryErrorString
  88. ;*************************************************************************
  89. ;*************************************************************************
  90. ;
  91. ; SECTION: BaseServiceKey
  92. ;
  93. ; PURPOSE: Return an open key handle to the top of the services tree
  94. ;
  95. ; ARGUMENTS: none
  96. ;
  97. ; RETURNS: $R0 Registry error code
  98. ; $R1 Registry key variable for SERVICES0
  99. ;
  100. ; REFERENCES: Nothing
  101. ;
  102. ; MODIFIES: Nothing
  103. ;
  104. ;*************************************************************************
  105. [BaseServiceKey]
  106. read-syms InitBaseVars
  107. set BS_KeyServices = ""
  108. OpenRegKey $(!REG_H_LOCAL) "" $(ServicesBaseName) $(MAXIMUM_ALLOWED) BS_KeyServices
  109. Ifstr $(BS_KeyServices) == $(KeyNull)
  110. Debug-Output "UTILITY.INF: could not open Services base key"
  111. set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  112. endif
  113. B_S_Return = +
  114. return $(RegistryErrorIndex), $(BS_KeyServices)
  115. ;*************************************************************************
  116. ;
  117. ; SECTION: ReduceInfPath
  118. ;
  119. ; PURPOSE: Process the path\name string to an INF file. If
  120. ; its path points to STF_WINDOWSSYSPATH, remove the path prefix.
  121. ;
  122. ; ARGUMENTS: $0 Path\name to INF file
  123. ;
  124. ; RETURNS: $R0 Resulting string
  125. ;
  126. ; REFERENCES: Nothing
  127. ;
  128. ; MODIFIES: Nothing
  129. ;
  130. ;*************************************************************************
  131. [ReduceInfPath]
  132. Set RIP_Result = $($0)
  133. Split-String $(RIP_Result) "\" InList
  134. Set BasePath = $(!STF_WINDOWSSYSPATH)"\"
  135. Split-String $(BasePath) "\" BaseList
  136. ;
  137. ; See how many of the path elements match
  138. ;
  139. Set Indx = 0
  140. Set Matched = 0
  141. QueryListSize InListSize, $(InList)
  142. ForListDo $(BaseList)
  143. Set-add Indx = $(Indx),1
  144. Ifint $(Indx) <= $(InListSize)
  145. Set Instr = *($(InList),$(Indx))
  146. Ifstr(i) $($) == $(Instr)
  147. Set-add Matched = $(Matched),1
  148. Endif
  149. Endif
  150. EndForListDo
  151. ;
  152. ; If all the path elements of the input path matched
  153. ; those of STF_WINDOWSSYSPATH, strip them off of the result.
  154. ;
  155. Ifint $(Indx) == $(Matched)
  156. Set RIP_Result = ""
  157. Set Indx2 = 0
  158. ForListDo $(InList)
  159. Set-add Indx2 = $(Indx2),1
  160. Ifint $(Indx2) > $(Indx)
  161. Set RIP_Result = $(RIP_Result)$($)
  162. Endif
  163. EndForListDo
  164. Endif
  165. Return $(RIP_Result)
  166. ;*************************************************************************
  167. ;
  168. ; SECTION: InstallSoftwareProduct
  169. ;
  170. ; PURPOSE: Add a new component into the Registry
  171. ;
  172. ; ARGUMENTS: $0 name of Manufacturer
  173. ; $1 name of Product
  174. ; $2 full INF path and name
  175. ;
  176. ; RETURNS: $R0 error code or zero if no error
  177. ; $R1 Registry key variable for
  178. ; SOFTWARE\Manufacturer\Product\Version key
  179. ; $R2 Registry key variable for
  180. ; ...\NetRules
  181. ;
  182. ; REFERENCES: none
  183. ;
  184. ; MODIFIES: none
  185. ;
  186. ;*************************************************************************
  187. [InstallSoftwareProduct]
  188. read-syms InitBaseVars
  189. set IS_MfgName = $($0)
  190. set IS_ProdName = $($1)
  191. set IS_Infname = $($2)
  192. set IS_KeySoftware = ""
  193. set IS_KeyMfg = ""
  194. set IS_KeyProduct = ""
  195. set IS_KeyVersion = ""
  196. set IS_KeyNetRules = ""
  197. set IS_MfgCreated = 1
  198. set IS_ProductCreated = 1
  199. ;
  200. ; Validate the arguments passed in
  201. ;
  202. set RegistryErrorIndex = INVALID_DATA_PASSED
  203. Ifstr(i) $(IS_MfgName) == ""
  204. goto I_S_Return
  205. endif
  206. Ifstr(i) $(IS_ProdName) == ""
  207. goto I_S_Return
  208. endif
  209. set RegistryErrorIndex = NO_ERROR
  210. ;
  211. ; Open the HKEY_LOCAL_MACHINE\SOFTWARE key
  212. ;
  213. OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_SoftwareBase) $(MAXIMUM_ALLOWED) IS_KeySoftware
  214. Ifstr $(IS_KeySoftware) == $(KeyNull)
  215. set RegistryErrorIndex = UNABLE_ACCESS_SOFTWARE_REG
  216. goto I_S_Return
  217. endif
  218. ;
  219. ; Create the Manufacturer's key if necessary
  220. ;
  221. CreateRegKey $(IS_KeySoftware) {$(IS_MfgName),$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" IS_KeyMfg
  222. Ifstr $(IS_KeyMfg) == $(KeyNull)
  223. set IS_MfgCreated = 0
  224. OpenRegKey $(IS_KeySoftware) "" $(IS_MfgName) $(MAXIMUM_ALLOWED) IS_KeyMfg
  225. Ifstr $(IS_KeyMfg) == $(KeyNull)
  226. set RegistryErrorIndex = UNABLE_OPEN_MICROSOFT_KEY
  227. goto I_S_Return
  228. endif
  229. endif
  230. ;
  231. ; Create the Software Product key if necessary
  232. ;
  233. CreateRegKey $(IS_KeyMfg) {$(IS_ProdName),$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" IS_KeyProduct
  234. Ifstr $(IS_KeyProduct) == $(KeyNull)
  235. set IS_ProductCreated = 0
  236. OpenRegKey $(IS_KeyMfg) "" $(IS_ProdName) $(MAXIMUM_ALLOWED) IS_KeyProduct
  237. Ifstr $(IS_KeyProduct) == $(KeyNull)
  238. set RegistryErrorIndex = UNABLE_CREATE_PRODUCT_KEY
  239. goto I_S_Return
  240. endif
  241. endif
  242. ;
  243. ; Create the software product version key.
  244. ;
  245. CreateRegKey $(IS_KeyProduct) {"CurrentVersion",$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" IS_KeyVersion
  246. Ifstr $(IS_KeyVersion) == $(KeyNull)
  247. OpenRegKey $(IS_KeyProduct) "" "CurrentVersion" $(MAXIMUM_ALLOWED) IS_KeyVersion
  248. Ifstr $(IS_KeyVersion) == $(KeyNull)
  249. set RegistryErrorIndex = UNABLE_CREATE_PRODUCT_VERSION
  250. goto I_S_Return
  251. endif
  252. endif
  253. set RegistryErrorIndex = NO_ERROR
  254. ;
  255. ; Create the NetRules key
  256. ;
  257. CreateRegKey $(IS_KeyVersion) {NetRules,$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" IS_KeyNetRules
  258. Ifstr $(IS_KeyNetRules) == $(KeyNull)
  259. OpenRegKey $(IS_KeyVersion) "" NetRules $(MAXIMUM_ALLOWED) IS_KeyNetRules
  260. Ifstr $(IS_KeyNetRules) == $(KeyNull)
  261. set RegistryErrorIndex = UNABLE_CREATE_NETRULES_KEY
  262. goto I_S_Return
  263. endif
  264. endif
  265. ;
  266. ; Set the "Infname" value if non-null; reduce it if it's in %SystemRoot%
  267. ;
  268. Ifstr $(IS_Infname) != ""
  269. Shell "", ReduceInfPath, $(IS_Infname)
  270. SetRegValue $(IS_KeyNetRules) {InfName,$(NoTitle),$(!REG_VT_SZ),$($R0)}
  271. endif
  272. ;
  273. ; Exit, leaving $(IS_KeyVersion) and $(IS_KeyNetRules) open for the caller...
  274. ;
  275. I_S_Return = +
  276. Ifstr $(IS_KeyProduct) != ""
  277. Ifint $(IS_ProductCreated) == 1
  278. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  279. Debug-Output "UTILITY.INF: DeleteRegTree Product Key"
  280. ;DeleteRegTree $(IS_KeyProduct) ""
  281. set IS_KeyProduct = ""
  282. endif
  283. endif
  284. Ifstr $(IS_KeyProduct) != ""
  285. CloseRegKey $(IS_KeyProduct)
  286. endif
  287. endif
  288. Ifstr $(IS_KeyMfg) != ""
  289. Ifint $(IS_MfgCreated) == 1
  290. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  291. ;DeleteRegTree $(IS_KeyMfg) ""
  292. Debug-Output "UTILITY.INF: DeleteRegTree Manufacturer Key"
  293. set IS_KeyMfg = ""
  294. endif
  295. endif
  296. Ifstr $(IS_KeyMfg) != ""
  297. CloseRegKey $(IS_KeyMfg)
  298. endif
  299. endif
  300. Ifstr $(IS_KeySoftware) != ""
  301. CloseRegKey $(IS_KeySoftware)
  302. endif
  303. return $(RegistryErrorIndex), $(IS_KeyVersion), $(IS_KeyNetRules)
  304. ;*************************************************************************
  305. ; end of section InstallSoftwareProduct
  306. ;*************************************************************************
  307. ;*************************************************************************
  308. ;
  309. ; SECTION: AddValueList
  310. ;
  311. ; PURPOSE: Given a nested list of value items, add each to the given
  312. ; key. Key is left open.
  313. ;
  314. ; ARGUMENTS: $0 Registry key handle
  315. ; $1 List of value items; for example:
  316. ; { {ValueName1,0,$(!REG_VT_SZ),$(ValueData1)}, +
  317. ; {ValueName2,0,$(!REG_VT_SZ),$(ValueData2)} }
  318. ;
  319. ; RETURNS: $R0 Registry error code.
  320. ;
  321. ;
  322. ; REFERENCES: Nothing
  323. ;
  324. ; MODIFIES: Nothing
  325. ;
  326. ;*************************************************************************
  327. [AddValueList]
  328. set RegistryErrorIndex = NO_ERROR
  329. ForListDo $($1)
  330. SetRegValue $($0) $($)
  331. ifint $(RegLastError) != 0
  332. Debug-Output "UTILITY.INF: Value write fail data: "$($)
  333. Debug-Output "UTILITY.INF: Value write fail key: "$($0)
  334. return UNABLE_WRITE_REGISTRY
  335. endif
  336. EndForListDo
  337. return $(RegistryErrorIndex)
  338. ;*************************************************************************
  339. ; end of section AddValueList
  340. ;*************************************************************************
  341. ;*************************************************************************
  342. ;
  343. ; SECTION: DeleteSoftwareProduct
  344. ;
  345. ; PURPOSE: Delete the given product from the Registry entirely
  346. ;
  347. ; ARGUMENTS: $0 Product Key Handle
  348. ;
  349. ; RETURNS: $R0 Registry error code
  350. ; $R1
  351. ;
  352. ; REFERENCES: Nothing
  353. ;
  354. ; MODIFIES: Nothing
  355. ;
  356. ;*************************************************************************
  357. [DeleteSoftwareProduct]
  358. set RegistryErrorIndex = NO_ERROR
  359. Debug-Output "UTILITY.INF: DeleteRegTree Software Product"
  360. DeleteRegTree $($0) ""
  361. return $(RegistryErrorIndex)
  362. ;*************************************************************************
  363. ; end of section DeleteSoftwareProduct
  364. ;*************************************************************************
  365. ;*************************************************************************
  366. ;
  367. ; SECTION: VerExistedDlg
  368. ;
  369. ; PURPOSE: Popup a dialog and tell the user that the same ver of
  370. ; the software already exists in the registery tree.
  371. ; Ask the user whether he want to continue or not
  372. ;
  373. ; ARGUMENTS: $0 Product Name
  374. ; $0 Product version
  375. ;
  376. ; RETURNS: $R0 Registry error code
  377. ; $R1 either "continue" or "exit"
  378. ;
  379. ; REFERENCES: Nothing
  380. ;
  381. ; MODIFIES: Nothing
  382. ;
  383. ;*************************************************************************
  384. [VerExistedDlg]
  385. set RegistryErrorIndex = NO_ERROR
  386. set-subst LF = "\n"
  387. read-syms VerExisted$(!STF_LANGUAGE)
  388. set DlgText = $($0)+
  389. $(ver)+
  390. $($1)+
  391. $(Text)
  392. Shell "Subroutn.Inf" SetupMessage $(!STF_LANGUAGE) "NONFATAL" $(DlgText)
  393. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  394. set RegistryErrorIndex = ERROR
  395. endif
  396. return $(RegistryErrorIndex), $($R1)
  397. ;*************************************************************************
  398. ; end of section VerExistedDialog
  399. ;*************************************************************************
  400. ;*************************************************************************
  401. ;
  402. ; SECTION: CardExistedDlg
  403. ;
  404. ; PURPOSE: Popup a dialog and tell the user that the network card
  405. ; is lready installed and ask them whether theyr want to
  406. ; continue.
  407. ;
  408. ; ARGUMENTS: NONE
  409. ;
  410. ; RETURNS: $R0 Registry error code
  411. ; $R1 either "continue" or "exit"
  412. ;
  413. ; REFERENCES: Nothing
  414. ;
  415. ; MODIFIES: Nothing
  416. ;
  417. ;*************************************************************************
  418. [CardExistedDlg]
  419. set RegistryErrorIndex = NO_ERROR
  420. set ButtonReturn = "OK"
  421. ifstr(i) $(!STF_GUI_UNATTENDED) != "YES"
  422. set-subst LF = "\n"
  423. read-syms CardExisted$(!STF_LANGUAGE)
  424. set DlgText = $(Text)
  425. Shell "Subroutn.Inf" SetupMessage $(!STF_LANGUAGE) "WARNING" $(DlgText)
  426. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  427. set RegistryErrorIndex = ERROR
  428. endif
  429. set ButtonReturn = $($R1)
  430. endif
  431. return $(RegistryErrorIndex), $(ButtonReturn)
  432. ;*************************************************************************
  433. ; end of section CardExistedDialog
  434. ;*************************************************************************
  435. ;*************************************************************************
  436. ;
  437. ; SECTION: CreateService
  438. ;
  439. ; PURPOSE: Create the Services area entry for a new product
  440. ;
  441. ; ARGUMENTS: $0 Name of the service (no imbedded blanks, etc.)
  442. ; $1 Display Name of service
  443. ; $2 image path string
  444. ; $3 type of service:
  445. ; system
  446. ; adapter
  447. ; driver
  448. ; transport
  449. ; service
  450. ; serviceshare
  451. ; $4 group, if any or ""
  452. ; $5 dependency **list**, if any or {}
  453. ; $6 ObjectName, usually ""
  454. ; $7 EventMessageFile [Optional]
  455. ; $8 TypeSupported [Optional]
  456. ; $9 EventLog Location[Optional]
  457. ; $10 Error control value [Optional]
  458. ; $11 Event Source name [Optional]
  459. ; $12 ParameterMessageFile [Optional]
  460. ; $13 Services area key [Optional]
  461. ;
  462. ;
  463. ; RETURNS: $R0 Registry error code
  464. ; $R1 Service area key handle
  465. ; $R2 Parameters key handle
  466. ; $R3 Linkage key handle
  467. ;
  468. ; REFERENCES: <list of global or parent variables referenced>
  469. ;
  470. ; MODIFIES: <list of global or parent variables modified>
  471. ;
  472. ; NOTES: If $(!NTN_ScUseRegistry) is != "", then direct Registry
  473. ; access is used in lieu of the Service Controller API
  474. ; wrapper. The Registry is automatically used if the
  475. ; service type is "adapter".
  476. ;
  477. ; The image path format varies for drivers and other
  478. ; services. For drivers of any kind, it's an NT name space
  479. ; name. For services, it's a REG_EXPAND_SZ format Win32 name.
  480. ;
  481. ;
  482. ; CHANGES: DavidHov: 6/11/92. "Groups" is REG_SZ, not REG_EXPAND_SZ
  483. ; Adapters are type=4, start=4.
  484. ; Only services get "ObjectName" value
  485. ;
  486. ;
  487. ;
  488. ;
  489. ;*************************************************************************
  490. [CreateService]
  491. read-syms InitBaseVars
  492. set CS_NameOfService = $($0)
  493. set CS_DisplayName = $($1)
  494. set CS_ImagePath = $($2)
  495. set CS_TypeOfService = $($3)
  496. set CS_Group = $($4)
  497. set CS_Dependencies = $($5)
  498. set CS_ObjectName = $($6)
  499. set CS_EventFile = $($7)
  500. set CS_TypeSupported = $($8)
  501. ifstr(i) $(CS_TypeSupported) == ""
  502. set CS_TypeSupported = 7
  503. endif
  504. ; Set event log location
  505. set CS_EventLogLocation = $($9)
  506. ifstr(i) $(CS_EventLogLocation) == ""
  507. set CS_EventLogLocation = "System"
  508. endif
  509. set CS_ErrorControl = $($10)
  510. ifstr(i) $(CS_ErrorControl) == ""
  511. set CS_ErrorControl = 1
  512. endif
  513. set CS_EventSourceName = $($11)
  514. ifstr(i) $(CS_EventSourceName) == ""
  515. set CS_EventSourceName = $(CS_NameOfService)
  516. endif
  517. set CS_ParameterMessageFile = $($12)
  518. set CS_KeyServices = $($13)
  519. set CS_KeyTempSvc = ""
  520. set CS_KeySvcManager = ""
  521. set CS_KeyParameters = ""
  522. set CS_KeyLinkage = ""
  523. set CS_UseRegistry = $(!NTN_ScUseRegistry)
  524. Debug-Output "UTILITY.INF: [CreateService] entered for "$(CS_NameOfService)
  525. Ifstr(i) $(CS_UseRegistry) != "YES"
  526. Ifstr(i) $(CS_UseRegistry) != "NO"
  527. Set CS_UseRegistry = "NO"
  528. Endif
  529. Endif
  530. Ifstr(i) $(CS_Dependencies) == ""
  531. Set CS_Dependencies = {}
  532. Endif
  533. ;
  534. ; Get the base key handle for the services area if not passed in
  535. ;
  536. Ifstr(i) $(CS_KeyServices) == ""
  537. Shell "", BaseServiceKey
  538. set RegistryErrorIndex = $($R0)
  539. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  540. set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  541. goto C_S_Return
  542. endif
  543. set CS_KeyServices = $($R1)
  544. set CS_KeyServicesOpened = $($R1)
  545. Endif
  546. ifstr(i) $(CS_TypeOfService) == "system"
  547. set TypeValue = 2
  548. set StartValue = 3
  549. else-ifstr(i) $(CS_TypeOfService) == "systemstart"
  550. set TypeValue = 2
  551. set StartValue = 1
  552. else-ifstr(i) $(CS_TypeOfService) == "systemauto"
  553. set TypeValue = 2
  554. set StartValue = 2
  555. else-ifstr(i) $(CS_TypeOfService) == "adapter"
  556. set TypeValue = 4
  557. set StartValue = 3
  558. Set CS_UseRegistry = "YES"
  559. else-ifstr(i) $(CS_TypeOfService) == "kernelauto"
  560. set TypeValue = 1
  561. set StartValue = 1
  562. else-ifstr(i) $(CS_TypeOfService) == "autoserviceshare"
  563. set TypeValue = 32
  564. set StartValue = 2
  565. else-ifstr(i) $(CS_TypeOfService) == "transport"
  566. set TypeValue = 2
  567. set StartValue = 3
  568. else-ifstr(i) $(CS_TypeOfService) == "kernel"
  569. set TypeValue = 1
  570. set StartValue = 3
  571. else-ifstr(i) $(CS_TypeOfService) == "kernelautostart"
  572. set TypeValue = 1
  573. set StartValue = 2
  574. else-ifstr(i) $(CS_TypeOfService) == "kerneldisable"
  575. set TypeValue = 1
  576. set StartValue = 4
  577. else-ifstr(i) $(CS_TypeOfService) == "service"
  578. set TypeValue = 16
  579. set StartValue = 3
  580. else-ifstr(i) $(CS_TypeOfService) == "serviceauto"
  581. set TypeValue = 16
  582. set StartValue = 2
  583. else-ifstr(i) $(CS_TypeOfService) == "servicedisable"
  584. set TypeValue = 16
  585. set StartValue = 4
  586. else-ifstr(i) $(CS_TypeOfService) == "serviceshare"
  587. set TypeValue = 32
  588. set StartValue = 3
  589. else
  590. Set CS_UseRegistry = "YES"
  591. Debug-Output "UTILITY.INF: [CreateService] Unrecognized TypeOfService parameter"
  592. set TypeValue = 4
  593. set StartValue = 3
  594. endif
  595. Ifint $(TypeValue) > 4
  596. Ifstr(i) $(CS_ObjectName) == ""
  597. set CS_ObjectName = "LocalSystem"
  598. Endif
  599. Endif
  600. OpenRegKey $(CS_KeyServices) "" $(CS_NameOfService) $(MAXIMUM_ALLOWED) +
  601. CS_KeyTempSvc
  602. ifstr $(CS_KeyTempSvc) != $(KeyNull)
  603. ; wait a minute.. somebody already installed the driver
  604. ; go to open other keys
  605. ; check whether it is marked for deletion
  606. GetRegValue $(CS_KeyTempSvc),"DeleteFlag", DeleteFlagInfo
  607. set DeleteFlag = *($(DeleteFlagInfo), 4)
  608. ifint $(DeleteFlag) == 1
  609. Set RegistryErrorIndex = REBOOT_MACHINE_BEFORE_ADD_ADAPTER
  610. goto C_S_Return
  611. endif
  612. ;
  613. ; Device section of the registry already exist.
  614. ; Let the code below to handle it. It will popup a dialog
  615. ; and returns error code.
  616. ;
  617. endif
  618. ifstr(i) $(CS_UseRegistry) == "YES"
  619. ;
  620. Debug-Output "UTILITY.INF: [CreateService] "$(CS_NameOfService)" using Registry"
  621. ;
  622. ; Create our own service
  623. ;
  624. ifstr(i) $(CS_KeyTempSvc) == $(KeyNull)
  625. CreateRegKey $(CS_KeyServices) {$(CS_NameOfService),$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" CS_KeyTempSvc
  626. else
  627. Debug-Output "UTILITY.INF: service key "$(CS_NameOfService)" already existed"
  628. Set RegistryErrorIndex = UNABLE_CREATE_CONFIGURE_SERVICE
  629. CloseRegKey $(CS_KeyTempSvc)
  630. Goto C_S_Return
  631. endif
  632. Ifstr(i) $(CS_KeyTempSvc) == $(KeyNull)
  633. Debug-Output "UTILITY.INF: could not create service key "$(CS_NameOfService)
  634. Set RegistryErrorIndex = UNABLE_CREATE_CONFIGURE_SERVICE
  635. CloseRegKey $(CS_KeyTempSvc)
  636. Goto C_S_Return
  637. else
  638. set NewValueList = {+
  639. {Type,$(NoTitle),$(!REG_VT_DWORD),$(TypeValue)},+
  640. {Start,$(NoTitle),$(!REG_VT_DWORD),$(StartValue)},+
  641. {ErrorControl,$(NoTitle),$(!REG_VT_DWORD),$(CS_ErrorControl)}+
  642. }
  643. Ifint $(TypeValue) > 4
  644. Set NewValueList = >($(NewValueList), +
  645. {ObjectName,$(NoTitle),$(!REG_VT_SZ),$(CS_ObjectName)})
  646. Endif
  647. ifstr(i) $(CS_Group) != ""
  648. set NewValueList = >($(NewValueList), +
  649. {Group,$(NoTitle),$(!REG_VT_SZ),$(CS_Group)})
  650. endif
  651. ifstr(i) $(CS_ImagePath) != ""
  652. set NewValueList = >($(NewValueList), +
  653. {ImagePath,$(NoTitle),$(!REG_VT_EXPAND_SZ),$(CS_ImagePath)})
  654. endif
  655. ifstr(i) $(CS_Dependencies) != ""
  656. ifstr(i) $(CS_Dependencies) != {}
  657. set NewValueList = >($(NewValueList), +
  658. {Dependencies,$(NoTitle),$(!REG_VT_MULTI_SZ),$(CS_Dependencies)})
  659. endif
  660. endif
  661. Shell "", AddValueList, $(CS_KeyTempSvc), $(NewValueList)
  662. set RegistryErrorIndex = $($R0)
  663. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  664. Debug-Output "Registry error: Add value list"
  665. endif
  666. endif
  667. else
  668. Debug-Output "UTILITY.INF: [CreateService] "$(CS_NameOfService)" using CreateService() wrapper"
  669. ;
  670. ; Call NCPA to create service key.
  671. ;
  672. Set FLibraryErrCtl = 1
  673. LibraryProcedure CS_CreateResult $(!NCPA_HANDLE), CPlSetup, $(!STF_HWND), CREATESVC,+
  674. $(CS_NameOfService), $(CS_DisplayName), $(StartValue), $(TypeValue), $(CS_ErrorControl),+
  675. $(CS_ImagePath), $(CS_Group),$(CS_Dependencies),$(CS_ObjectName)
  676. Set FLibraryErrCtl = 0
  677. ;
  678. ; Check the return code
  679. ;
  680. Set CS_CreateError = *($(CS_CreateResult),1)
  681. Ifint $(CS_CreateError) != 0
  682. Debug-Output "UTILITY.INF: CreateService wrapper failed, error: "$(CS_CreateResult)
  683. ;
  684. ; See if the error is special
  685. ;
  686. Ifint $(CS_CreateError) == 1073
  687. Set RegistryErrorIndex = SERVICE_ALREADY_EXISTS
  688. Else-ifint $(CS_CreateError) == 1072
  689. Set RegistryErrorIndex = SERVICE_MARKED_FOR_DELETE
  690. Else
  691. Set RegistryErrorIndex = UNABLE_CREATE_CONFIGURE_SERVICE
  692. Endif
  693. CloseRegKey $(CS_KeyTempSvc)
  694. Goto C_S_Return
  695. Endif
  696. ;
  697. ; Now open the key which should have been created by the service controller
  698. ;
  699. OpenRegKey $(CS_KeyServices) "" $(CS_NameOfService) $(MAXIMUM_ALLOWED) CS_KeyTempSvc
  700. ifstr $(CS_KeyTempSvc) == $(KeyNull)
  701. Debug-Output "UTILITY.INF: unable to open new service key"
  702. set RegistryErrorIndex = UNABLE_CREATE_CONFIGURE_SERVICE
  703. CloseRegKey $(CS_KeyTempSvc)
  704. Goto C_S_Return
  705. endif
  706. endif
  707. ;
  708. ; Open or Create the Parameters subkey
  709. ;
  710. CreateRegKey $(CS_KeyTempSvc) {"Parameters",$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" CS_KeyParameters
  711. ifstr $(CS_KeyParameters) == $(KeyNull)
  712. OpenRegKey $(CS_KeyTempSvc) "" "Parameters" $(MAXIMUM_ALLOWED) +
  713. CS_KeyParameters
  714. endif
  715. Ifstr $(CS_KeyParameters) == $(KeyNull)
  716. set RegistryErrorIndex = UNABLE_CREATE_SERVICE_SUBKEY
  717. CloseRegKey $(CS_KeyTempSvc)
  718. goto C_S_Return
  719. endif
  720. set RegistryErrorIndex = NO_ERROR
  721. ;
  722. ; Open or Create the Linkage subkey
  723. ;
  724. CreateRegKey $(CS_KeyTempSvc) {"Linkage",$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" CS_KeyLinkage
  725. Ifstr $(CS_KeyLinkage) == $(KeyNull)
  726. OpenRegKey $(CS_KeyTempSvc) "" "Linkage" $(MAXIMUM_ALLOWED) CS_KeyLinkage
  727. Endif
  728. Ifstr $(CS_KeyLinkage) == $(KeyNull)
  729. set RegistryErrorIndex = UNABLE_CREATE_SERVICE_SUBKEY
  730. CloseRegKey $(CS_KeyTempSvc)
  731. goto C_S_Return
  732. endif
  733. ;
  734. ; Open or Create the Linkage\Disabled subkey
  735. ;
  736. CreateRegKey $(CS_KeyLinkage) {"Disabled",$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" CS_KeyDisabled
  737. Ifstr $(CS_KeyDisabled) == $(KeyNull)
  738. OpenRegKey $(CS_KeyLinkage) "" "Disabled" $(MAXIMUM_ALLOWED) CS_KeyDisabled
  739. Endif
  740. Ifstr $(CS_KeyDisabled) == $(KeyNull)
  741. set RegistryErrorIndex = UNABLE_CREATE_SERVICE_SUBKEY
  742. CloseRegKey $(CS_KeyTempSvc)
  743. CloseRegKey $(CS_KeyLinkage)
  744. goto C_S_Return
  745. endif
  746. CloseRegKey $(CS_KeyDisabled)
  747. ;
  748. ; Create Eventlog information
  749. ;
  750. ifstr(i) $(CS_EventFile) != ""
  751. OpenRegKey $(!REG_H_LOCAL) "" "SYSTEM\CurrentControlSet\Services\EventLog\"$(CS_EventLogLocation) $(MAXIMUM_ALLOWED) CS_KeyEventLog
  752. Ifstr $(CS_KeyEventLog) == $(KeyNull)
  753. ; cannot open eventlog
  754. debug-output "Cannot open eventlog key"
  755. set RegistryErrorIndex = UNABLE_OPEN_EVENTLOG_SUBKEY
  756. CloseRegKey $(CS_KeyTempSvc)
  757. CloseRegKey $(CS_KeyParameters)
  758. CloseRegKey $(CS_KeyLinkage)
  759. goto C_S_Return
  760. else
  761. ; set up the service key
  762. CreateRegKey $(CS_KeyEventLog) {$(CS_EventSourceName),$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" CS_KeyService
  763. ifstr(i) $(CS_KeyService) == ""
  764. OpenRegKey $(CS_KeyEventLog) "" $(CS_EventSourceName) $(MAXIMUM_ALLOWED) CS_KeyService
  765. endif
  766. Ifstr $(CS_KeyService) != $(KeyNull)
  767. ; create the EventMessageFile and TypeSupported fields
  768. SetRegValue $(CS_KeyService) {EventMessageFile,$(NoTitle),$(!REG_VT_EXPAND_SZ),$(CS_EventFile)}
  769. SetRegValue $(CS_KeyService) {TypesSupported,$(NoTitle),$(!REG_VT_DWORD),$(CS_TypeSupported)}
  770. ifstr(i) $(CS_ParameterMessageFile) != ""
  771. SetRegValue $(CS_KeyService) {ParameterMessageFile,$(NoTitle),$(!REG_VT_EXPAND_SZ),$(CS_ParameterMessageFile)}
  772. endif
  773. CloseRegKey $(CS_KeyService)
  774. endif
  775. Endif
  776. endif
  777. ;
  778. ; Return the keys and error codes
  779. ;
  780. C_S_Return = +
  781. ; Only close the services key if it was opened in this routine.
  782. Ifstr $(CS_KeyServicesOpened) != $(KeyNull)
  783. CloseRegKey $(CS_KeyServices)
  784. endif
  785. return $(RegistryErrorIndex), $(CS_KeyTempSvc), $(CS_KeyParameters), $(CS_KeyLinkage)
  786. ;*************************************************************************
  787. ; end of section CreateService
  788. ;*************************************************************************
  789. ;*************************************************************************
  790. ;
  791. ; SECTION: AssignAdapterNumber
  792. ;
  793. ; PURPOSE: Enumerate the netcards, and return a numeric value which
  794. ; is unused.
  795. ;
  796. ; ARGUMENTS: $0 - Optional - NetworkCardKey - for performance
  797. ; $1 - Optional - AdapterNumber to start with - for performance
  798. ;
  799. ; RETURNS: $R0 Regisitry Error Code
  800. ; $R1 Numeric value to be use for new adapter;
  801. ; (1,2,3..)
  802. ;
  803. ; REFERENCES: Nothing
  804. ;
  805. ; MODIFIES: Nothing
  806. ;
  807. ;
  808. ;*************************************************************************
  809. [AssignAdapterNumber]
  810. read-syms InitBaseVars
  811. set AA_KeyNetcards = $($0)
  812. ifstr $($1) == ""
  813. set AA_AdapterNumber = 1
  814. else
  815. set AA_AdapterNumber = $($1)
  816. endif
  817. set AA_KeyNetcards = ""
  818. set AA_KeyTemp = ""
  819. set RegistryErrorIndex = NO_ERROR
  820. Debug-Output "[AssignAdapterNumber] starting with "$(AA_AdapterNumber)
  821. Ifstr(i) $(AA_KeyNetcards) == $(KeyNull)
  822. OpenRegKey $(!REG_H_LOCAL) "" $(NetworkCardKeyName) $(MAXIMUM_ALLOWED) AA_KeyNetcards
  823. set AA_KeyNetcardsOpened = $(AA_KeyNetcards)
  824. endif
  825. Ifstr $(AA_KeyNetcards) == $(KeyNull)
  826. set RegistryErrorIndex = UNABLE_OPEN_NETWORKCARD_SECTION
  827. goto A_A_Return
  828. endif
  829. ;
  830. ; Loop to find an unused adapter number
  831. ;
  832. A_A_TryAgain = +
  833. ifint $(AA_AdapterNumber) < 10
  834. set Tmp_Zero_AdapterNumber = "0"$(AA_AdapterNumber)
  835. OpenRegKey $(AA_KeyNetcards) "" $(Tmp_Zero_AdapterNumber) $(MAXIMUM_ALLOWED) AA_Zero_KeyTemp
  836. ifstr(i) $(AA_Zero_KeyTemp) != ""
  837. CloseRegKey $(AA_Zero_KeyTemp)
  838. goto Next_Number
  839. endif
  840. endif
  841. set Tmp_AA_AdapterNumber = $(AA_AdapterNumber)
  842. OpenRegKey $(AA_KeyNetcards) "" $(Tmp_AA_AdapterNumber) $(MAXIMUM_ALLOWED) AA_KeyTemp
  843. Ifstr $(AA_KeyTemp) == $(KeyNull)
  844. Goto A_A_Found
  845. Endif
  846. CloseRegKey $(AA_KeyTemp)
  847. Next_Number = +
  848. Set AA_KeyTemp = $(KeyNull)
  849. Set-add AA_AdapterNumber = $(AA_AdapterNumber),1
  850. Goto A_A_TryAgain
  851. A_A_Found =+
  852. CloseRegKey $(AA_KeyNetcardsOpened)
  853. A_A_Return = +
  854. return $(RegistryErrorIndex) $(AA_AdapterNumber)
  855. ;*************************************************************************
  856. ; end of section AssignAdapterNumber
  857. ;*************************************************************************
  858. ;*************************************************************************
  859. ;
  860. ; SECTION: InstallNetcard
  861. ;
  862. ; PURPOSE: Create a new HARDWARE\Netcard\(n) area in the Registry
  863. ;
  864. ; ARGUMENTS: $0 Name if the INF file
  865. ; $1 Optional - Netcards Area key
  866. ; $2 Optional - net card number to start with
  867. ;
  868. ; RETURNS: $R0 Registry error code
  869. ; $R1 Netcard\(n) key handle
  870. ; $R2 numeric index of netcard (n)
  871. ; $R3 NetRules key handle
  872. ;
  873. ; REFERENCES: Nothing
  874. ;
  875. ; MODIFIES: Nothing
  876. ;
  877. ;
  878. ;*************************************************************************
  879. [InstallNetcard]
  880. read-syms InitBaseVars
  881. set IN_Infname = $($0)
  882. set IN_KeyNetcardsArea = $($1)
  883. set IN_CardNumber = $($2)
  884. set IN_KeyNetcard = ""
  885. set IN_KeyNetRules = ""
  886. ;
  887. ; Assign a number to this network card and create its key
  888. ;
  889. Shell "" AssignAdapterNumber $(IN_KeyNetcardsArea) $(IN_CardNumber)
  890. set RegistryErrorIndex = $($R0)
  891. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  892. goto I_N_Return
  893. endif
  894. set IN_CardNumber = $($R1)
  895. CreateRegKey $(!REG_H_LOCAL) {$(NetworkCardKeyName)\$(IN_CardNumber),$(NoTitle),GenericClass} +
  896. "" $(MAXIMUM_ALLOWED) "" IN_KeyNetcard
  897. Ifstr $(IN_KeyNetcard) == $(KeyNull)
  898. set RegistryErrorIndex = UNABLE_CREATE_NETCARD_CONFIGURATION
  899. goto I_N_Return
  900. endif
  901. ;
  902. ; Create the NetRules key
  903. ;
  904. CreateRegKey $(IN_KeyNetcard) {NetRules,$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" IN_KeyNetRules
  905. Ifstr $(IN_KeyNetRules) == $(KeyNull)
  906. set RegistryErrorIndex = UNABLE_CREATE_NETRULES_KEY
  907. goto I_N_Return
  908. endif
  909. ;
  910. ; Set the "Infname" value if non-null; reduce it if it's in %SystemRoot%
  911. ;
  912. Ifstr $(IN_Infname) != ""
  913. Shell "", ReduceInfPath, $(IN_Infname)
  914. SetRegValue $(IN_KeyNetRules) {InfName,$(NoTitle),$(!REG_VT_SZ),$($R0)}
  915. endif
  916. set RegistryErrorIndex = NO_ERROR
  917. I_N_Return = +
  918. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  919. Debug-Output "UTILITY.INF: [InstallNetcard]: "$(RegistryErrorIndex)
  920. Ifstr $(IN_KeyNetRules) != $(KeyNull)
  921. CloseRegKey $(IN_KeyNetRules)
  922. set IN_KeyNetrules = ''
  923. endif
  924. ;BUGBUG DeleteRegTree $(IN_KeyNetcard)
  925. set IN_KeyNetcard = ""
  926. endif
  927. return $(RegistryErrorIndex), $(IN_KeyNetcard), $(IN_CardNumber), $(IN_KeyNetRules)
  928. ;*************************************************************************
  929. ; end of section InstallNetcard
  930. ;*************************************************************************
  931. ;*************************************************************************
  932. ;
  933. ; SECTION: LinkToService
  934. ;
  935. ; PURPOSE: Link a software or hardware component to its
  936. ; corresponding service area entry
  937. ;
  938. ; ARGUMENTS: $0 Registry key handle to primary component key
  939. ; $1 Name of service (no imbedded blanks, etc.)
  940. ;
  941. ; RETURNS: $R0 Registry error code
  942. ;
  943. ; REFERENCES: Nothing
  944. ;
  945. ; MODIFIES: Nothing
  946. ;
  947. ;
  948. ;*************************************************************************
  949. [LinkToService]
  950. read-syms InitBaseVars
  951. SetRegValue $($0) {ServiceName,$(NoTitle),$(!REG_VT_SZ),$($1)}
  952. L_S_Return = +
  953. return $(RegistryErrorIndex)
  954. ;*************************************************************************
  955. ; end of section LinkToService
  956. ;*************************************************************************
  957. ;*************************************************************************
  958. ;
  959. ; SECTION: IncrementRefCount
  960. ;
  961. ; PURPOSE: Increment the reference counter in the registry
  962. ;
  963. ; ARGUMENTS: $0 Registry key name
  964. ;
  965. ; RETURNS: $R0 Registry error code
  966. ;
  967. ; REFERENCES: Nothing
  968. ;
  969. ; MODIFIES: Nothing
  970. ;
  971. ;
  972. ;*************************************************************************
  973. [IncrementRefCount]
  974. read-syms InitBaseVars
  975. OpenRegKey $(!REG_H_LOCAL) "" $($0) $(MAXIMUM_ALLOWED) SoftwareKey
  976. Ifstr $(SoftwareKey) == $(KeyNull)
  977. Debug-Output "UTILITY.INF: could not open Software base key"
  978. set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  979. goto IncrementRefCount_Return
  980. endif
  981. GetRegValue $(SoftwareKey),"RefCount", RefCountInfo
  982. set RefCount = *($(RefCountInfo), 4)
  983. Set-add RefCount = $(RefCount),1
  984. SetRegValue $(SoftwareKey) {RefCount,$(NoTitle),$(!REG_VT_DWORD),$(RefCount)}
  985. CloseRegKey $(SoftwareKey)
  986. IncrementRefCount_Return = +
  987. return $(RegistryErrorIndex)
  988. ;*************************************************************************
  989. ; end of section IncrementRefCount
  990. ;*************************************************************************
  991. ;*************************************************************************
  992. ;
  993. ; SECTION: DecrementRefCount
  994. ;
  995. ; PURPOSE: Decrement the reference counter in the registry
  996. ;
  997. ; ARGUMENTS: $0 Registry key name
  998. ;
  999. ; RETURNS: $R0 Registry error code
  1000. ;
  1001. ; REFERENCES: Nothing
  1002. ;
  1003. ; MODIFIES: Nothing
  1004. ;
  1005. ;
  1006. ;*************************************************************************
  1007. [DecrementRefCount]
  1008. read-syms InitBaseVars
  1009. OpenRegKey $(!REG_H_LOCAL) "" $($0) $(MAXIMUM_ALLOWED) SoftwareKey
  1010. Ifstr $(SoftwareKey) == $(KeyNull)
  1011. Debug-Output "UTILITY.INF: could not open Software base key"
  1012. set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  1013. goto DecrementRefCount_Return
  1014. endif
  1015. GetRegValue $(SoftwareKey),"RefCount", RefCountInfo
  1016. set RefCount = *($(RefCountInfo), 4)
  1017. ifint $(RefCount) == 0
  1018. ; something wrong
  1019. goto DecrementRefCount_Return
  1020. endif
  1021. Set-sub RefCount = $(RefCount),1
  1022. SetRegValue $(SoftwareKey) {RefCount,$(NoTitle),$(!REG_VT_DWORD),$(RefCount)}
  1023. CloseRegKey $(SoftwareKey)
  1024. DecrementRefCount_Return = +
  1025. return $(RegistryErrorIndex)
  1026. ;*************************************************************************
  1027. ; end of section DecrementRefCount
  1028. ;*************************************************************************
  1029. ;*************************************************************************
  1030. ;
  1031. ; SECTION: IsRefCountEqual0
  1032. ;
  1033. ; PURPOSE: check the reference counter in the registry is equal to 0 or
  1034. ; not
  1035. ;
  1036. ; ARGUMENTS: $0 Registry key name
  1037. ;
  1038. ; RETURNS: $R0 Registry error code
  1039. ; $R1 0 - if ref count != 0
  1040. ; 1 - if ref count = 0
  1041. ;
  1042. ; REFERENCES: Nothing
  1043. ;
  1044. ; MODIFIES: Nothing
  1045. ;
  1046. ;
  1047. ;*************************************************************************
  1048. [IsRefCountEqualZero]
  1049. read-syms InitBaseVars
  1050. OpenRegKey $(!REG_H_LOCAL) "" $($0) $(MAXIMUM_ALLOWED) SoftwareKey
  1051. Ifstr $(SoftwareKey) == $(KeyNull)
  1052. Debug-Output "UTILITY.INF: could not open Software base key"
  1053. set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  1054. set RefCountEqualZero = 1
  1055. goto IsRefCountEqualZero_Return
  1056. endif
  1057. GetRegValue $(SoftwareKey),"RefCount", RefCountInfo
  1058. Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  1059. set RefCount = 0
  1060. else
  1061. set RefCount = *($(RefCountInfo), 4)
  1062. endif
  1063. Ifint $(RefCount) == 0
  1064. set RefCountEqualZero = 1
  1065. else
  1066. set RefCountEqualZero = 0
  1067. endif
  1068. CloseRegKey $(SoftwareKey)
  1069. IsRefCountEqualZero_Return = +
  1070. return $(RegistryErrorIndex) $(RefCountEqualZero)
  1071. ;*************************************************************************
  1072. ;
  1073. ; SECTION: FindService
  1074. ;
  1075. ; PURPOSE: Given a hardware or software component key handle,
  1076. ; return a key handle to the corresponding Service entry
  1077. ;
  1078. ; ARGUMENTS: $0 Registry key handle to primary component
  1079. ; $1 type of component (adapter, etc.)
  1080. ;
  1081. ; RETURNS: $R0 Registry error code
  1082. ; $R1 Registry key handle for Service area
  1083. ; $R2 Registry key handle for Parameters subkey
  1084. ;
  1085. ; REFERENCES: Nothing
  1086. ;
  1087. ; MODIFIES: Nothing
  1088. ;
  1089. ;
  1090. ;*************************************************************************
  1091. [FindService]
  1092. read-syms InitBaseVars
  1093. set FS_KeyThisService = ""
  1094. set FS_KeyParameters = ""
  1095. set FS_KeyComponent = $($0)
  1096. set FS_TypeComponent = $($1)
  1097. Shell "", BaseServiceKey
  1098. set FS_KeyServices = $($R1)
  1099. set RegistryErrorIndex = $($R0)
  1100. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  1101. goto F_S_Return
  1102. endif
  1103. ;
  1104. ; Obtain the all the values for the component key.
  1105. ;
  1106. EnumRegValue $(FS_KeyComponent) FS_ValueList
  1107. ; BUGBUG: Check RegLastError
  1108. set FS_SvcName = ""
  1109. ForListDo $(FS_ValueList)
  1110. set FS_ValueName = *($($),1)
  1111. Ifstr(i) $(FS_ValueName) == ServiceName
  1112. set FS_SvcName = *($($),4)
  1113. goto F_S_Break1
  1114. endif
  1115. EndForListDo
  1116. F_S_Break1 = +
  1117. Ifstr $(FS_SvcName) == $(KeyNull)
  1118. set RegistryErrorIndex = CANNOT_FIND_COMPONENT_SERVICE
  1119. goto F_S_Return
  1120. endif
  1121. OpenRegKey $(FS_KeyServices) "" $(FS_SvcName) $(MAXIMUM_ALLOWED) FS_KeyThisService
  1122. Ifstr $(FS_KeyThisService) == $(KeyNull)
  1123. set RegistryErrorIndex = CANNOT_FIND_COMPONENT_SERVICE
  1124. goto F_S_Return
  1125. endif
  1126. OpenRegKey $(FS_KeyThisService) "" "Parameters" $(MAXIMUM_ALLOWED) FS_KeyParameters
  1127. Ifstr $(FS_KeyParameters) == $(KeyNull)
  1128. set RegistryErrorIndex = CANNOT_FIND_COMPONENT_SERVICE
  1129. goto F_S_Return
  1130. endif
  1131. F_S_Return = +
  1132. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  1133. Ifstr $(FS_KeyParameters) != $(KeyNull)
  1134. CloseRegKey $(FS_KeyParameters)
  1135. endif
  1136. Ifstr $(FS_KeyThisService) != $(KeyNull)
  1137. CloseRegKey $(FS_KeyThisService)
  1138. endif
  1139. endif
  1140. return $(RegistryErrorIndex), $(FS_KeyThisService) $(FS_KeyParameters)
  1141. ;*************************************************************************
  1142. ; end of section FindService
  1143. ;*************************************************************************
  1144. ;*************************************************************************
  1145. ;
  1146. ; SECTION: GetServiceParameters
  1147. ;
  1148. ; PURPOSE: Given a component key and type, return a list of
  1149. ; all its current parameters
  1150. ;
  1151. ; ARGUMENTS: $0 Registry key handle to primary component
  1152. ; $1 type of component (adapter, etc.)
  1153. ;
  1154. ; RETURNS: $R0 Registry error code
  1155. ; $R1 Registry key handle for Service area
  1156. ; $R2 Registry key handle for Parameters subkey
  1157. ; $R3 Value list of all values under Parameters subkey
  1158. ;
  1159. ; REFERENCES: Nothing
  1160. ;
  1161. ; MODIFIES: Nothing
  1162. ;
  1163. ;*************************************************************************
  1164. [GetServiceParameters]
  1165. read-syms InitBaseVars
  1166. set GP_KeyComponent = $($0)
  1167. set GP_KeyService = ""
  1168. set GP_KeyParameters = ""
  1169. set GP_ValueList = {}
  1170. FindService $(GP_KeyComponent) $($1)
  1171. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  1172. goto G_P_Return
  1173. endif
  1174. set GP_KeyService = $($R1)
  1175. set GP_KeyParameters = $($R2)
  1176. EnumRegValue $(GP_KeyParameters) GP_ValueList
  1177. G_P_Return = +
  1178. return $(RegistryErrorIndex) $(GP_KeyService) $(GP_KeyParameters) $(GP_ValueList)
  1179. ;*************************************************************************
  1180. ; end of section sectionname
  1181. ;*************************************************************************
  1182. ;*************************************************************************
  1183. ;
  1184. ; SECTION: AddSoftwareComponent
  1185. ;
  1186. ; PURPOSE: Adds all the Registry information necessary for
  1187. ; a new software component. This involves creating
  1188. ; the SOFTWARE area and the SERVICE area.
  1189. ;
  1190. ; ARGUMENTS: $0 name of Manufacturer
  1191. ; $1 name of Product
  1192. ; $2 service name to use (no imbedded blanks, etc.)
  1193. ; $3 Display Name for service
  1194. ; $4 full path name to the INF file for configuration
  1195. ; $5 ImagePath
  1196. ; $6 type of the software,
  1197. ; see [CreateService] for complete list
  1198. ; $7 service order group, if any or ""
  1199. ; $8 dependency **list**, if any or {}
  1200. ; $9 ObjectName. if "", it will set to "LocalSystem"
  1201. ; $10 EventMessageFile [optional]
  1202. ; $11 TypeSupported [optional]
  1203. ; $12 event log location [optional]
  1204. ; $13 error control value [optional]
  1205. ; $14 event log source [optional]
  1206. ; $15 ParameterMessageFile[optional]
  1207. ;
  1208. ; RETURNS: $R0 error code or zero if no error
  1209. ; $R1 Registry key variable for
  1210. ; SOFTWARE\Manufacturer\Product\Version key
  1211. ; $R2 Registry key variable for
  1212. ; SOFTWARE\...\NetRules
  1213. ; $R3 Registry key handle for Services key
  1214. ; $R4 "Parameters" key handle for Services area
  1215. ; $R5 "Linkage" key handle for Services area
  1216. ;
  1217. ; REFERENCES: Nothing
  1218. ;
  1219. ; MODIFIES: Nothing
  1220. ;
  1221. ;*************************************************************************
  1222. [AddSoftwareComponent]
  1223. read-syms InitBaseVars
  1224. set AS_MfgName = $($0)
  1225. set AS_ProdName = $($1)
  1226. set AS_SvcName = $($2)
  1227. set AS_DisplayName = $($3)
  1228. set AS_Infname = $($4)
  1229. set AS_ImagePath = $($5)
  1230. set AS_ServiceType = $($6)
  1231. set AS_Group = $($7)
  1232. set AS_Dependencies = $($8)
  1233. set AS_ObjectName = $($9)
  1234. set AS_EventFile = $($10)
  1235. set AS_TypeSupported = $($11)
  1236. set AS_EventLocation = $($12)
  1237. set AS_ErrorCtlValue = $($13)
  1238. set AS_EventSource = $($14)
  1239. set AS_ParameterMessageFile = $($15)
  1240. set AS_KeyServicesArea = $($16)
  1241. set AS_KeyVersion = ""
  1242. set AS_KeyNetRules = ""
  1243. set AS_KeyService = ""
  1244. set AS_KeyParameters = ""
  1245. set AS_KeyLinkage = ""
  1246. ;
  1247. ; Create the Service entry for this product
  1248. ;
  1249. Shell "", CreateService,$(AS_SvcName),$(AS_DisplayName),$(AS_ImagePath),+
  1250. $(AS_ServiceType),$(AS_Group),$(AS_Dependencies),$(AS_ObjectName),+
  1251. $(AS_EventFile),$(AS_TypeSupported),$(AS_EventLocation),+
  1252. $(AS_ErrorCtlValue),$(AS_EventSource),$(AS_ParameterMessageFile),+
  1253. $(AS_KeyServicesArea)
  1254. set RegistryErrorIndex = $($R0)
  1255. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  1256. goto A_S_Return
  1257. endif
  1258. set AS_KeyService = $($R1)
  1259. set AS_KeyParameters = $($R2)
  1260. set AS_KeyLinkage = $($R3)
  1261. ;
  1262. ; Service area is created. Create the software area and link them
  1263. ;
  1264. Shell "", InstallSoftwareProduct, $(AS_MfgName), $(AS_ProdName), $(AS_Infname)
  1265. set RegistryErrorIndex = $($R0)
  1266. Ifstr(i) $(RegistryErrorIndex) == NO_ERROR
  1267. set AS_KeyVersion = $($R1)
  1268. set AS_KeyNetRules = $($R2)
  1269. Shell "", LinkToService, $(AS_KeyVersion), $(AS_SvcName), service
  1270. set RegistryErrorIndex = $($R0)
  1271. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  1272. goto A_S_Return
  1273. endif
  1274. ;
  1275. ; Add Reference Counter
  1276. ;
  1277. GetRegValue $(AS_KeyVersion),"RefCount", RefCountInfo
  1278. Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  1279. ; no RefCount variable
  1280. SetRegValue $(AS_KeyVersion) {RefCount,$(NoTitle),$(!REG_VT_DWORD),0}
  1281. endif
  1282. endif
  1283. A_S_Return = +
  1284. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  1285. Ifstr $(AS_KeyNetRules) != $(KeyNull)
  1286. CloseRegKey $(AS_KeyNetRules)
  1287. endif
  1288. Ifstr $(AS_KeyParameters) != $(KeyNull)
  1289. CloseRegKey $(AS_KeyParameters)
  1290. endif
  1291. Ifstr $(AS_KeyLinkage) != $(KeyNull)
  1292. CloseRegKey $(AS_KeyLinkage)
  1293. endif
  1294. Ifstr $(AS_KeyVersion) != $(KeyNull)
  1295. CloseRegKey $(AS_KeyVersion)
  1296. Set AS_ProdKeyName = $(!NTN_SoftwareBase)"\"$(AS_MfgName)"\"$(AS_ProdName)
  1297. OpenRegKey $(!REG_H_LOCAL) "" $(AS_ProdKeyName) $(MAXIMUM_ALLOWED) AS_KeyProduct
  1298. Ifstr(i) $(AS_KeyProduct) != $(KeyNull)
  1299. DeleteRegKey $(AS_KeyProduct) "CurrentVersion"
  1300. CloseRegKey $(AS_KeyProduct)
  1301. Endif
  1302. Endif
  1303. Ifstr $(AS_KeyService) != $(KeyNull)
  1304. Debug-Output "UTILITY.INF: DeleteRegTree Service Key"
  1305. ;DeleteRegTree $(AS_KeyService) ""
  1306. endif
  1307. set AS_KeyVersion = ""
  1308. set AS_KeyNetRules = ""
  1309. set AS_KeyService = ""
  1310. set AS_KeyParameters = ""
  1311. set AS_KeyLinkage = ""
  1312. endif
  1313. return $(RegistryErrorIndex), $(AS_KeyVersion), $(AS_KeyNetRules), $(AS_KeyService),+
  1314. $(AS_KeyParameters), $(AS_KeyLinkage)
  1315. ;*************************************************************************
  1316. ; end of section AddSoftwareComponent
  1317. ;*************************************************************************
  1318. ;*************************************************************************
  1319. ;
  1320. ; SECTION: AddHardwareComponent
  1321. ;
  1322. ; PURPOSE: Adds all the Registry information necessary for
  1323. ; a new network adapater card
  1324. ;
  1325. ; ARGUMENTS: $0 service name to use (no imbedded blanks, etc.).
  1326. ; This name will have the numeric value from
  1327. ; InstallNetCard appended to it for uniqueness.
  1328. ; $1 INF name for this adapter
  1329. ; $2 Driver name in software section
  1330. ; $3 Optional - Services area Key (for performance if an
  1331. ; INF will be calling this routine many times)
  1332. ; $4 Optional - Netcards area Key (for performance if an
  1333. ; INF will be calling this routine many times)
  1334. ; $5 Optional - number of netcard to start with when looking
  1335. ; for the next empty slot. For performance, and INF which
  1336. ; is adding many adapters can pass in the value returned
  1337. ; for adapter number from the last AddHardwareComponent
  1338. ; call
  1339. ;
  1340. ;
  1341. ; RETURNS: $R0 Registry error code or zero if no error
  1342. ; $R1 Registry key variable for HARDWARE\Netcard\(n)
  1343. ; $R2 Registry key variable for HARDWARE\Netcard\(n)\\NetRules
  1344. ; $R3 Registry key handle for <service>\Parameters key
  1345. ; $R4 Adapter number assigned to adapter
  1346. ; $R5 Service name generated by combining svc name with
  1347. ; adapter number
  1348. ;
  1349. ;
  1350. ; REFERENCES: Nothing
  1351. ;
  1352. ; MODIFIES: Nothing
  1353. ;
  1354. ;*************************************************************************
  1355. [AddHardwareComponent]
  1356. read-syms InitBaseVars
  1357. set AH_SvcName = $($0)
  1358. set AH_Infname = $($1)
  1359. set AH_SoftwareName = $($2)
  1360. set AH_KeyServicesArea = $($3)
  1361. set AH_KeyNetcardsArea = $($4)
  1362. set AH_AdapNum = $($5)
  1363. set AH_KeyNetcard = ""
  1364. set AH_KeyNetRules = ""
  1365. set AH_KeyService = ""
  1366. set AH_KeyParameters = ""
  1367. ;
  1368. ; Create the HARDWARE\Netcard entry for this adapter
  1369. ;
  1370. Shell "", InstallNetcard, $(AH_Infname) $(AH_KeyNetcardsArea) $(AH_AdapNum)
  1371. set RegistryErrorIndex = $($R0)
  1372. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  1373. Debug-Output "UTILITY.INF: [AddHardwareComponent] InstallNetcard returned: "$(RegistryErrorIndex)
  1374. goto A_H_Return
  1375. endif
  1376. set AH_KeyNetcard = $($R1)
  1377. set AH_AdapNum = $($R2)
  1378. set AH_SvcName = $(AH_SvcName)$(AH_AdapNum)
  1379. set AH_KeyNetRules = $($R3)
  1380. ;
  1381. ; Create the SERVICES entry for this adapter; no binary path, no group,
  1382. ; no dependencies.
  1383. ;
  1384. Shell "", CreateService, $(AH_SvcName), "", "", "adapter","",{},"","","","","","","", $(AH_KeyServicesArea)
  1385. set RegistryErrorIndex = $($R0)
  1386. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  1387. Debug-Output "UTILITY.INF: CreateService returned "$(RegistryErrorIndex)
  1388. goto A_H_Return
  1389. endif
  1390. CloseRegKey $($R1)
  1391. set AH_KeyParameters = $($R2)
  1392. CloseRegKey $($R3)
  1393. ;
  1394. ; Link the Netcard entry to the Service created
  1395. ;
  1396. Shell "", LinkToService, $(AH_KeyNetcard), $(AH_SvcName)
  1397. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  1398. Debug-Output "UTILITY.INF: [AddHardwareComponent] LinkToService returned "$(RegistryErrorIndex)
  1399. goto A_H_Return
  1400. endif
  1401. ;
  1402. ; Add the reference counter in the driver section
  1403. ;
  1404. Shell "", IncrementRefCount, $(AH_SoftwareName)
  1405. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  1406. Debug-Output "UTILITY.INF: [AddHardwareComponent] IncrementRefCount returned "$(RegistryErrorIndex)
  1407. goto A_H_Return
  1408. endif
  1409. A_H_Return = +
  1410. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  1411. Debug-Output "UTILITY.INF: [AddHardwareComponent] returning error: "$(RegistryErrorIndex)
  1412. Ifstr(i) $(AH_KeyNetRules) != $(KeyNull)
  1413. CloseRegKey $(AH_KeyNetRules)
  1414. Endif
  1415. Ifstr(i) $(AH_KeyNetcard) != $(KeyNull)
  1416. ; Let the RemoveHardware handle it
  1417. ;DeleteRegTree $(AH_KeyNetcard) ""
  1418. Endif
  1419. set AH_KeyNetRules = ""
  1420. set AH_KeyNetcard = ""
  1421. endif
  1422. return $(RegistryErrorIndex), $(AH_KeyNetcard), $(AH_KeyNetRules), $(AH_KeyParameters),+
  1423. $(AH_AdapNum), $(AH_SvcName)
  1424. ;*************************************************************************
  1425. ; end of section AddHardwareComponent
  1426. ;*************************************************************************
  1427. ;*************************************************************************
  1428. ;
  1429. ; SECTION: MCAFindBus
  1430. ;
  1431. ; PURPOSE: Find adpater(s) location
  1432. ;
  1433. ; ARGUMENTS: $0 The least signifiance byte of the device ID
  1434. ; $1 The most signifiance byte of the device ID
  1435. ;
  1436. ;
  1437. ; RETURNS: $R0 Registry error code or zero if no error
  1438. ; $R1 The list of adapter location
  1439. ; {{bus0,slot0},{bus1,slot1},{bus2,slot2}...{busk,slotk}}
  1440. ;
  1441. ; REFERENCES: Nothing
  1442. ;
  1443. ; MODIFIES: Nothing
  1444. ;
  1445. ;*************************************************************************
  1446. [MCAFindBus]
  1447. read-syms InitBaseVars
  1448. set RegistryErrorIndex = NO_ERROR
  1449. set MultifunctionAdapter = "HARDWARE\Description\System\MultifunctionAdapter"
  1450. set InfoList = {}
  1451. OpenRegKey $(!REG_H_LOCAL) "" $(MultifunctionAdapter) $(MAXIMUM_ALLOWED) KeyMultiAdapter
  1452. Ifstr $(KeyMultiAdapter) == $(KeyNull)
  1453. goto MCAFindBus_return
  1454. endif
  1455. EnumRegKey $(KeyMultiAdapter) BusList
  1456. Debug-Output "Buslist"
  1457. Debug-Output $(BusList)
  1458. ForListDo $(BusList)
  1459. set BusNum = *($($),1)
  1460. set RegName = $(MultifunctionAdapter)"\"$(BusNum)
  1461. Debug-Output "BusNum"
  1462. Debug-Output $(BusNum)
  1463. OpenRegKey $(!REG_H_LOCAL) "" $(RegName) $(MAXIMUM_ALLOWED) KeyBus
  1464. ifstr $(KeyBus) != $(KeyNull)
  1465. GetRegValue $(KeyBus),"Configuration Data",ConfigData
  1466. ifstr $(ConfigData) != $(KeyNull)
  1467. set CardInfo = *($(ConfigData), 4 )
  1468. ;
  1469. ; Skip the header and jump to data position 33
  1470. ;
  1471. set Position = 33
  1472. set SlotNum = 1
  1473. QueryListSize ListSize $(CardInfo)
  1474. Loop1 =+
  1475. ifint $(Position) < $(ListSize)
  1476. set-add NextByte = $(Position), 1
  1477. ifint *($(CardInfo), $(Position)) == $($0)
  1478. ifint *($(CardInfo), $(NextByte)) == $($1)
  1479. ;
  1480. ; Set up the hardware
  1481. ;
  1482. LibraryProcedure RealBusNum, $(!LIBHANDLE), GetMCABusInformation, $(KeyBus), "Configuration Data", $(BusNum)
  1483. Debug-Output $(RealBusNum)
  1484. set BusNum = *($(RealBusNum),1)
  1485. Debug-Output $(SlotNum)
  1486. set-mul mcaid = $($1), 256
  1487. set-add mcaid = $(mcaid), $($0)
  1488. set InfoList = >($(InfoList),{$(BusNum),$(SlotNum),$(mcaid)})
  1489. endif
  1490. endif
  1491. set-add Position = $(Position), 6
  1492. set-add SlotNum = $(SlotNum), 1
  1493. goto Loop1
  1494. endif
  1495. endif
  1496. CloseRegKey $(KeyBus)
  1497. endif
  1498. EndForListDo
  1499. CloseRegKey $(KeyMultiAdapter)
  1500. MCAFindBus_return = +
  1501. return $(RegistryErrorIndex) $(InfoList)
  1502. ;*************************************************************************
  1503. ; end of section MCAFindBus
  1504. ;*************************************************************************
  1505. ;*************************************************************************
  1506. ;
  1507. ; SECTION: EISAFindBus
  1508. ;
  1509. ; PURPOSE: Find adpater(s) location
  1510. ;
  1511. ; ARGUMENTS: $0 The compress ID of the EISA card
  1512. ; $1 EISA Compressed ID mask
  1513. ;
  1514. ;
  1515. ; RETURNS: $R0 Registry error code or zero if no error
  1516. ; $R1 The list of adapter location
  1517. ; {{bus0,slot0},{bus1,slot1},{bus2,slot2}...{busk,slotk}}
  1518. ;
  1519. ; REFERENCES: Nothing
  1520. ;
  1521. ; MODIFIES: Nothing
  1522. ;
  1523. ;*************************************************************************
  1524. [EISAFindBus]
  1525. read-syms InitBaseVars
  1526. set MaskNum = $($1)
  1527. ifstr(i) $($1) == ""
  1528. set MaskNum = 16777215 ; 0xffffff
  1529. endif
  1530. set RegistryErrorIndex = NO_ERROR
  1531. set EISAAdapter = "HARDWARE\Description\System\EISAAdapter"
  1532. set InfoList = {}
  1533. OpenRegKey $(!REG_H_LOCAL) "" $(EISAAdapter) $(MAXIMUM_ALLOWED) KeyEISAAdapter
  1534. Ifstr $(KeyEISAAdapter) == $(KeyNull)
  1535. goto EISAFindBus_return
  1536. endif
  1537. EnumRegKey $(KeyEISAAdapter) BusList
  1538. Debug-Output "Buslist"
  1539. Debug-Output $(BusList)
  1540. ForListDo $(BusList)
  1541. set BusNum = *($($),1)
  1542. OpenRegKey $(!REG_H_LOCAL) "" $(EISAAdapter)"\"$(BusNum) $(MAXIMUM_ALLOWED) KeyEISAAdapterBus
  1543. LibraryProcedure SlotList, $(!LIBHANDLE), GetEisaSlotInformation, $(KeyEISAAdapterBus), "Configuration Data", $($0), $(MaskNum)
  1544. ifstr(i) $(SlotList) != {}
  1545. ForListDo $(SlotList)
  1546. set SlotNum = $($)
  1547. ifstr(i) $(SlotNum) != "ERROR"
  1548. Debug-Output $(BusNum)
  1549. Debug-Output $(SlotNum)
  1550. set InfoList = >($(InfoList),{$(BusNum),$(SlotNum),$($0)})
  1551. endif
  1552. EndForListDo
  1553. endif
  1554. EndForListDo
  1555. CloseRegKey $(KeyEISAAdapter)
  1556. EISAFindBus_return = +
  1557. return $(RegistryErrorIndex) $(InfoList)
  1558. ;*************************************************************************
  1559. ; end of section EISAFindBus
  1560. ;*************************************************************************
  1561. ;*************************************************************************
  1562. ;
  1563. ; SECTION: GetPCIInformation
  1564. ;
  1565. ; PURPOSE: Get PCI vendor and device information
  1566. ;
  1567. ; ARGUMENTS: $0 Vendor ID
  1568. ; $1 Device ID
  1569. ;
  1570. ;
  1571. ; RETURNS: $R0 List of bus and slot information
  1572. ; {{bus0,slot0},{bus1,slot1},{bus2,slot2}...{busk,slotk}}
  1573. ;
  1574. ; REFERENCES: Nothing
  1575. ;
  1576. ; MODIFIES: Nothing
  1577. ;
  1578. ;*************************************************************************
  1579. [GetPCIInformation]
  1580. read-syms InitBaseVars
  1581. set VendorID = $($0)
  1582. set DeviceID = $($1)
  1583. set MultiAdapter = "HARDWARE\Description\System\MultifunctionAdapter"
  1584. set InfoList = {}
  1585. OpenRegKey $(!REG_H_LOCAL) "" $(MultiAdapter) $(MAXIMUM_ALLOWED) KeyMultiAdapter
  1586. Ifstr $(KeyMultiAdapter) == $(KeyNull)
  1587. goto GetPCIInformation_return
  1588. endif
  1589. EnumRegKey $(KeyMultiAdapter) BusList
  1590. Debug-Output "Buslist"
  1591. Debug-Output $(BusList)
  1592. set BusNum = 0
  1593. set index = 0
  1594. ForListDo $(BusList)
  1595. OpenRegKey $(!REG_H_LOCAL) "" $(MultiAdapter)"\"$(index) $(MAXIMUM_ALLOWED) KeyMultiAdapterBus
  1596. GetRegValue $(KeyMultiAdapterBus) "Identifier" IdentifierInfo
  1597. ifstr(i) *($(IdentifierInfo),4) == "PCI"
  1598. ;
  1599. ; Only check for PCI bus
  1600. ;
  1601. set device = 0
  1602. next_device = +
  1603. ifint $(device) < 32
  1604. set function = 0
  1605. next_function = +
  1606. ifint $(function) < 8
  1607. LibraryProcedure Result, $(!LIBHANDLE), GetPciInformation, $(BusNum), $(device), $(function)
  1608. debug-output $(BusNum)".."$(device)".."$(function)".."$(Result)
  1609. ifint *($(Result),1) == 65535
  1610. Set-add device = $(device),1
  1611. goto next_device
  1612. endif
  1613. ifint *($(Result),1) == $(VendorID)
  1614. ifint *($(Result),2) == $(DeviceID)
  1615. set InfoList = >($(InfoList),{$(BusNum),$(device),$(function)})
  1616. endif
  1617. endif
  1618. set-add function = $(function), 1
  1619. goto next_function
  1620. endif
  1621. Set-add device = $(device),1
  1622. goto next_device
  1623. endif
  1624. finish_bus = +
  1625. set-add BusNum = $(BusNum),1
  1626. endif
  1627. set-add index = $(index),1
  1628. EndForListDo
  1629. CloseRegKey $(KeyMultiAdapter)
  1630. GetPCIInformation_return = +
  1631. return $(InfoList)
  1632. ;*************************************************************************
  1633. ;
  1634. ; SECTION: AddNetworkProvider
  1635. ;
  1636. ; PURPOSE: Add a network provider entry into the registry
  1637. ;
  1638. ; ARGUMENTS: $0 network provider id. i.e., lanmanredirector
  1639. ; $1 network provder location. i.e, c:\nt\windows\system\ntlanman.dll
  1640. ; $2 English name of the provider. i.e, NT Lan Manager
  1641. ; $3 network provider device name, if different from network
  1642. ; provider
  1643. ;
  1644. ;
  1645. ; RETURNS: $R0 Registry error code or zero if no error
  1646. ;
  1647. ; REFERENCES: Nothing
  1648. ;
  1649. ; MODIFIES: Nothing
  1650. ;
  1651. ;*************************************************************************
  1652. [AddNetworkProvider]
  1653. read-syms InitBaseVars
  1654. set RegistryErrorIndex = NO_ERROR
  1655. set ProviderDeviceName = $($3)
  1656. ifstr(i) $(ProviderDeviceName) == ""
  1657. set ProviderDeviceName = $($0)
  1658. endif
  1659. ; OpenRegKey $(!REG_H_LOCAL) "" $(CurrentControlSet)"\control\NetworkProvider\Active\"$($0) $(MAXIMUM_ALLOWED) ActiveKey
  1660. ; ifstr(i) $(OrderKey) == $(KeyNull)
  1661. ; CreateRegKey $(!REG_H_LOCAL) {$(CurrentControlSet)"\control\NetworkProvider\Active\"$($0),$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" ActiveKey
  1662. ; endif
  1663. OpenRegKey $(!REG_H_LOCAL) "" $(CurrentControlSet)"\control\NetworkProvider\order" $(MAXIMUM_ALLOWED) OrderKey
  1664. ifstr(i) $(OrderKey) == $(KeyNull)
  1665. CreateRegKey $(!REG_H_LOCAL) {$(CurrentControlSet)"\control\NetworkProvider\order",$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" OrderKey
  1666. endif
  1667. GetRegValue $(OrderKey) "ProviderOrder" OrderValue
  1668. set Order = *($(OrderValue), 4 )
  1669. ifstr(i) $(OrderValue) == $(KeyNull)
  1670. goto AddFirstProvider
  1671. else-ifstr(i) $(Order) == $(KeyNull)
  1672. goto AddFirstProvider
  1673. else
  1674. goto AddProvider
  1675. endif
  1676. AddFirstProvider = +
  1677. SetRegValue $(OrderKey) {ProviderOrder,$(NoTitle),$(!REG_VT_SZ),$($0)}
  1678. goto WriteProviderInfo
  1679. AddProvider = +
  1680. Split-String $(Order) "," OrderList
  1681. ifContains(i) $($0) in $(OrderList)
  1682. ; Enable if we cannot have the same provider
  1683. ;
  1684. ;set RegistryErrorIndex = PROVIDER_ALREADY_EXISTED
  1685. ;goto AddnetworkProvider_return
  1686. else
  1687. set Order = $(Order)","$($0)
  1688. SetRegValue $(OrderKey) {ProviderOrder,$(NoTitle),$(!REG_VT_SZ),$(Order)}
  1689. endif
  1690. goto WriteProviderInfo
  1691. WriteProviderInfo = +
  1692. CloseRegKey $(OrderKey)
  1693. OpenRegKey $(!REG_H_LOCAL) "" $(ServicesBaseName)"\"$($0)"\networkprovider" $(MAXIMUM_ALLOWED) ProviderKey
  1694. Ifstr(i) $(ProviderKey) == $(KeyNull)
  1695. CreateRegKey $(!REG_H_LOCAL) {$(ServicesBaseName)"\"$($0)"\networkprovider",$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" ProviderKey
  1696. endif
  1697. set NewValueList = {{Devicename,$(NoTitle),$(!REG_VT_SZ),"\Device\"$(ProviderDeviceName)},+
  1698. {ProviderPath, $(NoTitle), $(!REG_VT_EXPAND_SZ), $($1)},+
  1699. {Name, $(NoTitle), $(!REG_VT_SZ), $($2)}}
  1700. Shell "" AddValueList $(ProviderKey) $(NewValueList)
  1701. CloseRegKey $(ProviderKey)
  1702. AddNetworkProvider_return = +
  1703. return $(RegistryErrorIndex)
  1704. ;*************************************************************************
  1705. ; end of section AddNetworkProvider
  1706. ;*************************************************************************
  1707. ;*************************************************************************
  1708. ;
  1709. ; SECTION: AddServiceProvider
  1710. ;
  1711. ; PURPOSE: Add a Service provider entry into the registry
  1712. ;
  1713. ; ARGUMENTS: $0 Service provider id. i.e., tcpip
  1714. ; $1 Service provder location. i.e, c:\nt\windows\system\ntlanman.dll
  1715. ; $2 English name of the provider. i.e, NT Lan Manager
  1716. ; $3 Class number
  1717. ;
  1718. ;
  1719. ; RETURNS: $R0 Registry error code or zero if no error
  1720. ;
  1721. ; REFERENCES: Nothing
  1722. ;
  1723. ; MODIFIES: Nothing
  1724. ;
  1725. ;*************************************************************************
  1726. [AddServiceProvider]
  1727. read-syms InitBaseVars
  1728. set RegistryErrorIndex = NO_ERROR
  1729. set ClassNum = $($3)
  1730. ifstr(i) $(ClassNum) == ""
  1731. set ClassNum = 8
  1732. endif
  1733. OpenRegKey $(!REG_H_LOCAL) "" $(CurrentControlSet)"\control\ServiceProvider\order" $(MAXIMUM_ALLOWED) OrderKey
  1734. ifstr(i) $(OrderKey) == $(KeyNull)
  1735. CreateRegKey $(!REG_H_LOCAL) {$(CurrentControlSet)"\control\ServiceProvider\Order",$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" OrderKey
  1736. SetRegValue $(OrderKey) {ExcludedProviders,$(NoTitle),$(!REG_VT_MULTI_SZ),{}}
  1737. endif
  1738. GetRegValue $(OrderKey) "ProviderOrder" OrderValue
  1739. set Order = *($(OrderValue), 4 )
  1740. ifstr(i) $(OrderValue) == $(KeyNull)
  1741. goto AddFirstProvider
  1742. else-ifstr(i) $(Order) == $(KeyNull)
  1743. goto AddFirstProvider
  1744. else
  1745. goto AddProvider
  1746. endif
  1747. AddFirstProvider = +
  1748. SetRegValue $(OrderKey) {ProviderOrder,$(NoTitle),$(!REG_VT_MULTI_SZ),{$($0)}}
  1749. goto WriteProviderInfo
  1750. AddProvider = +
  1751. ifContains(i) $($0) in $(Order)
  1752. ; Enable if we cannot have the same provider
  1753. ;
  1754. ;set RegistryErrorIndex = PROVIDER_ALREADY_EXISTED
  1755. ;goto AddProvider_return
  1756. else
  1757. set Order = >($(Order),$($0))
  1758. SetRegValue $(OrderKey) {ProviderOrder,$(NoTitle),$(!REG_VT_MULTI_SZ),$(Order)}
  1759. endif
  1760. goto WriteProviderInfo
  1761. WriteProviderInfo = +
  1762. CloseRegKey $(OrderKey)
  1763. OpenRegKey $(!REG_H_LOCAL) "" $(ServicesBaseName)"\"$($0)"\Serviceprovider" $(MAXIMUM_ALLOWED) ProviderKey
  1764. Ifstr(i) $(ProviderKey) == $(KeyNull)
  1765. CreateRegKey $(!REG_H_LOCAL) {$(ServicesBaseName)"\"$($0)"\Serviceprovider",$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" ProviderKey
  1766. endif
  1767. set NewValueList = {{Class,$(NoTitle),$(!REG_VT_DWORD),$(ClassNum)},+
  1768. {ProviderPath, $(NoTitle), $(!REG_VT_EXPAND_SZ), $($1)},+
  1769. {Name, $(NoTitle), $(!REG_VT_SZ), $($2)}}
  1770. Shell "" AddValueList $(ProviderKey) $(NewValueList)
  1771. CloseRegKey $(ProviderKey)
  1772. AddProvider_return = +
  1773. return $(RegistryErrorIndex)
  1774. ;*************************************************************************
  1775. ; end of section AddServiceProvider
  1776. ;*************************************************************************
  1777. ;*************************************************************************
  1778. ;
  1779. ; SECTION: RemoveServiceProvider
  1780. ;
  1781. ; PURPOSE: Remove Service provider entry
  1782. ;
  1783. ; ARGUMENTS: $0 provider name
  1784. ;
  1785. ; RETURNS: $R0 Registry error code or zero if no error
  1786. ;
  1787. ; REFERENCES: Nothing
  1788. ;
  1789. ; MODIFIES: Nothing
  1790. ;
  1791. ;*************************************************************************
  1792. [RemoveServiceProvider]
  1793. read-syms InitBaseVars
  1794. set RegistryErrorIndex = NO_ERROR
  1795. OpenRegKey $(!REG_H_LOCAL) "" $(CurrentControlSet)"\control\ServiceProvider\order" $(MAXIMUM_ALLOWED) OrderKey
  1796. ifstr(i) $(OrderKey) == $(KeyNull)
  1797. set RegistryErrorIndex = PROVIDER_ORDER_DOES_NOT_EXIST
  1798. goto RemoveProvider_return
  1799. endif
  1800. GetRegValue $(OrderKey) "ProviderOrder" OrderValue
  1801. set Order = *($(OrderValue), 4 )
  1802. set NewOrderList = {}
  1803. set FirstTime = TRUE
  1804. set Found = FALSE
  1805. ForListDo $(Order)
  1806. ifstr(i) $($) != $($0)
  1807. ifstr(i) $(FirstTime) == TRUE
  1808. set FirstTime = FALSE
  1809. set NewOrderList = {$($)}
  1810. else
  1811. set NewOrderList = >($(NewOrderList),$($))
  1812. endif
  1813. else
  1814. set Found = TRUE
  1815. endif
  1816. EndForListDo
  1817. ifstr(i) $(Found) == FALSE
  1818. ; set RegistryErrorIndex = PROVIDER_ORDER_DOES_NOT_EXIST
  1819. ; goto RemoveProvider_return
  1820. else
  1821. ifstr(i) $(NewOrderList) == {}
  1822. set NewOrderList = ""
  1823. endif
  1824. SetRegValue $(OrderKey) {ProviderOrder,$(NoTitle),$(!REG_VT_MULTI_SZ),$(NewOrderList)}
  1825. endif
  1826. OpenRegKey $(!REG_H_LOCAL) "" $(ServicesBaseName)\$($0) $(MAXIMUM_ALLOWED) ProviderKey
  1827. ifstr $(ProviderKey) != $(KeyNull)
  1828. DeleteRegTree $(ProviderKey) "ServiceProvider"
  1829. endif
  1830. RemoveProvider_return = +
  1831. return $(RegistryErrorIndex)
  1832. ;*************************************************************************
  1833. ;
  1834. ; SECTION: RemoveNetworkProvider
  1835. ;
  1836. ; PURPOSE: Remove network provider entry
  1837. ;
  1838. ; ARGUMENTS: $0 provider name
  1839. ;
  1840. ; RETURNS: $R0 Registry error code or zero if no error
  1841. ;
  1842. ; REFERENCES: Nothing
  1843. ;
  1844. ; MODIFIES: Nothing
  1845. ;
  1846. ;*************************************************************************
  1847. [RemoveNetworkProvider]
  1848. read-syms InitBaseVars
  1849. set RegistryErrorIndex = NO_ERROR
  1850. OpenRegKey $(!REG_H_LOCAL) "" $(CurrentControlSet)"\control\NetworkProvider\order" $(MAXIMUM_ALLOWED) OrderKey
  1851. ifstr(i) $(OrderKey) == $(KeyNull)
  1852. set RegistryErrorIndex = PROVIDER_ORDER_DOES_NOT_EXIST
  1853. goto RemoveNetworkProvider_return
  1854. endif
  1855. GetRegValue $(OrderKey) "ProviderOrder" OrderValue
  1856. set Order = *($(OrderValue), 4 )
  1857. Split-String $(Order) "," OrderList
  1858. set NewOrderList = {}
  1859. set FirstTime = TRUE
  1860. set Found = FALSE
  1861. ForListDo $(OrderList)
  1862. ifstr(i) $($) != ","
  1863. ifstr(i) $($) != $($0)
  1864. ifstr(i) $(FirstTime) == TRUE
  1865. set FirstTime = FALSE
  1866. set NewOrderList = $($)
  1867. else
  1868. set NewOrderList = $(NewOrderList)","$($)
  1869. endif
  1870. else
  1871. set Found = TRUE
  1872. endif
  1873. endif
  1874. EndForListDo
  1875. ifstr(i) $(Found) == FALSE
  1876. ; set RegistryErrorIndex = PROVIDER_ORDER_DOES_NOT_EXIST
  1877. ; goto RemoveNetworkProvider_return
  1878. else
  1879. ifstr(i) $(NewOrderList) == {}
  1880. set NewOrderList = ""
  1881. endif
  1882. SetRegValue $(OrderKey) {ProviderOrder,$(NoTitle),$(!REG_VT_SZ),$(NewOrderList)}
  1883. endif
  1884. OpenRegKey $(!REG_H_LOCAL) "" $(ServicesBaseName)\$($0) $(MAXIMUM_ALLOWED) ProviderKey
  1885. ifstr $(ProviderKey) != $(KeyNull)
  1886. DeleteRegTree $(ProviderKey) "NetworkProvider"
  1887. endif
  1888. RemoveNetworkProvider_return = +
  1889. return $(RegistryErrorIndex)
  1890. ;*************************************************************************
  1891. ;
  1892. ; SECTION: AddNameSpaceProvider
  1893. ;
  1894. ; PURPOSE: Add a NameSpace provider entry into the registry
  1895. ;
  1896. ; ARGUMENTS: $0 (STRING) Name Space Provider Display Name
  1897. ; $1 (STRING) Name Space Provider DLL (full path)
  1898. ; $2 (INT) Name Space support, see Winsock2.h or NSPApi.h in sdk\inc
  1899. ; $3 (BOOL) Schema Support (TRUE | FALSE)
  1900. ; $4 (STRING - GUID) Name Space Provider ID {46cd93d0-7e92-11cf-ae5a-00aa00a7112b}
  1901. ;
  1902. ;
  1903. ; RETURNS: $R0 Registry error code or zero if no error
  1904. ;
  1905. ; REFERENCES: Nothing
  1906. ;
  1907. ; MODIFIES: Nothing
  1908. ;
  1909. ;*************************************************************************
  1910. [AddNameSpaceProvider]
  1911. read-syms InitBaseVars
  1912. set RegistryErrorIndex = NO_ERROR
  1913. Set FLibraryErrCtl = 1
  1914. LibraryProcedure Result, $(!NCPA_HANDLE), AddNameSpaceProvider, $($0), $($1), $($2), $($3), $($4)
  1915. Set FLibraryErrCtl = 0
  1916. Set ResultError = *($(Result),1)
  1917. Ifint $(ResultError) != 0
  1918. Debug-Output "UTILITY.INF: AddNameSpaceProvider wrapper failed, error: "$(Result)
  1919. Set RegistryErrorIndex = UNABLE_ADD_NAMESPACE_PROVIDER
  1920. Goto AddNameSpaceProvider_return
  1921. Endif
  1922. AddNameSpaceProvider_return = +
  1923. return $(RegistryErrorIndex)
  1924. ;*************************************************************************
  1925. ;
  1926. ; SECTION: RemoveNameSpaceProvider
  1927. ;
  1928. ; PURPOSE: Remove namespace provider entry
  1929. ;
  1930. ; ARGUMENTS: $0 (STRING, GUID) Name Space Provider ID {46cd93d0-7e92-11cf-ae5a-00aa00a7112b}
  1931. ;
  1932. ; RETURNS: $R0 Registry error code or zero if no error
  1933. ;
  1934. ; REFERENCES: Nothing
  1935. ;
  1936. ; MODIFIES: Nothing
  1937. ;
  1938. ;*************************************************************************
  1939. [RemoveNameSpaceProvider]
  1940. read-syms InitBaseVars
  1941. set RegistryErrorIndex = NO_ERROR
  1942. Set FLibraryErrCtl = 1
  1943. LibraryProcedure Result, $(!NCPA_HANDLE), RemoveNameSpaceProvider, $($0)
  1944. Set FLibraryErrCtl = 0
  1945. Set ResultError = *($(Result),1)
  1946. Ifint $(ResultError) != 0
  1947. Debug-Output "UTILITY.INF: RemoveNameSpaceProvider wrapper failed, error: "$(Result)
  1948. Set RegistryErrorIndex = UNABLE_REMOVE_NAMESPACE_PROVIDER
  1949. Goto RemoveNameSpaceProvider_return
  1950. Endif
  1951. RemoveNameSpaceProvider_return = +
  1952. return $(RegistryErrorIndex)
  1953. ;*************************************************************************
  1954. ;
  1955. ; SECTION: PrepareToCopy
  1956. ;
  1957. ; PURPOSE: Establish the variables required to perform
  1958. ; "CopyFilesInCopyList"
  1959. ;
  1960. ; ARGUMENTS: none
  1961. ;
  1962. ; RETURNS: $R0 STATUS_SUCCESSFUL
  1963. ;
  1964. ; REFERENCES: nothing
  1965. ;
  1966. ; MODIFIES: see [ProgressCopyEng] above for list of variables
  1967. ; modified/created in parent context.
  1968. ;
  1969. ; NOTES: Read NOTES commentary for section [DoAskSource]
  1970. ;
  1971. ;*************************************************************************
  1972. [PrepareToCopy]
  1973. ;
  1974. ; Read the progress copy symbols.
  1975. ;
  1976. Read-syms ProgressCopy$(!STF_LANGUAGE)
  1977. Return STATUS_SUCCESSFUL
  1978. ;*************************************************************************
  1979. ; end of section PrepareToCopy
  1980. ;*************************************************************************
  1981. ;*************************************************************************
  1982. ;
  1983. ; SECTION: DoAskSource
  1984. ;
  1985. ; PURPOSE: Determine or ask to location of the network binaries
  1986. ;
  1987. ; ARGUMENTS: $0 current value of STF_CWDDIR
  1988. ; $1 current value of STF_SRCDIR
  1989. ; $2 "YES" if part of NT base product (i.e., not OEM)
  1990. ; "NO" otherwise.
  1991. ;
  1992. ; RETURNS: $R0: STATUS: STATUS_SUCCESSFUL |
  1993. ; STATUS_USERCANCEL |
  1994. ; STATUS_FAILED
  1995. ; $R1 path to sources
  1996. ;
  1997. ; REFERENCES: Nothing
  1998. ;
  1999. ; MODIFIES: !STF_SRCDIR_USED changed to point to the user's
  2000. ; keyed location
  2001. ; !STF_SRCDIR_KEYED
  2002. ;
  2003. ; NOTES: The SETUP copy operations read the symbol table the old way;
  2004. ; this means that they will only utilize local symbols for
  2005. ; the necessary progress variables. This section/function assumes
  2006. ; that it's being called by an INF at THE EXACT SAME CONTEXT LEVEL
  2007. ; AT WHICH THE INSTALL FUNCTION WILL BE INVOKED! It stores the
  2008. ; values specifically into the parent context so the progress dialog
  2009. ; function can see them.
  2010. ;
  2011. ;*************************************************************************
  2012. [DoAskSource]
  2013. Set DAS_CWDDIR = $($0)
  2014. Set DAS_SRCDIR = $($1)
  2015. Set DAS_BUILTIN = $($2)
  2016. Set DAS_Result = STATUS_FAILED
  2017. ;
  2018. ; If !STF_SRCDIR_OVERRIDE is not empty, use it instead.
  2019. ;
  2020. Ifstr(i) $(!STF_SRCDIR_OVERRIDE) != ""
  2021. Set DAS_SRCDIR = $(!STF_SRCDIR_OVERRIDE)
  2022. Set DAS_Result = STATUS_SUCCESSFUL
  2023. Goto DAS_exit
  2024. Endif
  2025. ;
  2026. ; If this is a built-in component during primary installation,
  2027. ; use the given source path automatically unless !SFT_SRCDIR_WINNT
  2028. ; is set. This is for the WINNT case, where Setup's SourcePath lies.
  2029. ;
  2030. Ifstr(i) $(DAS_BUILTIN) == YES
  2031. Ifstr(i) $(!NTN_InstallPhase) == primary
  2032. Ifstr(i) $(!STF_SRCDIR_WINNT) != ""
  2033. Set DAS_SRCDIR = $(!STF_SRCDIR_WINNT)
  2034. Endif
  2035. Set DAS_Result = STATUS_SUCCESSFUL
  2036. Goto DAS_exit
  2037. Endif
  2038. Else
  2039. Ifstr(i) $(!NTN_InstallPhase) == primary
  2040. ; during primary install, always use the passed value
  2041. Set DAS_Result = STATUS_SUCCESSFUL
  2042. Goto DAS_exit
  2043. Else
  2044. ; not a shipped item, so force to use A rather than saved location
  2045. Set DAS_SRCDIR = ""
  2046. EndIf
  2047. Endif
  2048. Debug-Output "UTILITY.INF: [DoAskSource] STF_CWDDIR = "$(DAS_CWDDIR)" STF_SRCDIR = "$(DAS_SRCDIR)
  2049. ;
  2050. ; Set default to drive A: if necessary
  2051. ;
  2052. Ifstr(i) $(DAS_SRCDIR) == ""
  2053. Set DAS_SRCDIR = "A:\"
  2054. Endif
  2055. ;
  2056. ; If this is the same SRCDIR as last time, replace it with the string
  2057. ; actually keyed by the user. This causes UNC names to reappear in their
  2058. ; original form; the name of the automatically "used" remote drive should
  2059. ; never be shown.
  2060. ;
  2061. Ifstr(i) $(DAS_SRCDIR) == $(!STF_SRCDIR_USED)
  2062. Set DAS_SRCDIR = $(!STF_SRCDIR_KEYED)
  2063. Endif
  2064. ;
  2065. ; Ask for the setup sources
  2066. ;
  2067. Shell "subroutn.inf" DoAskSource $(DAS_SRCDIR)
  2068. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  2069. Debug-Output "UTILITY.INF: shelling SUBROUTN.INF [DoAskSource] failed"
  2070. goto DAS_exit
  2071. endif
  2072. Set DAS_Result = $($R0)
  2073. Ifstr(i) $(DAS_Result) == STATUS_USERCANCEL
  2074. ;
  2075. ; BUGBUG: All the INFs should change to handle this correctly.
  2076. ;
  2077. Set !p:CommonStatus = STATUS_USERCANCEL
  2078. goto DAS_exit
  2079. Endif
  2080. Set DAS_SRCDIR = $($R1)
  2081. ;
  2082. ; Save the actual and converted SRCDIRs
  2083. ;
  2084. Set !STF_SRCDIR_USED = $($R1)
  2085. Set !STF_SRCDIR_KEYED = $($R3)
  2086. ;
  2087. ; Store the new location if this is a request for NT source in the registry.
  2088. ;
  2089. Ifstr(i) $(DAS_BUILTIN) == YES
  2090. OpenRegKey $(!REG_H_LOCAL) "" "SOFTWARE\Microsoft\Windows Nt\CurrentVersion" $(!REG_KEY_WRITE) KeyNt
  2091. Ifstr(i) $(KeyNt) != ""
  2092. SetRegValue $(KeyNt) {SourcePath,$(NoTitle),$(!REG_VT_SZ),$(!STF_SRCDIR_USED)}
  2093. Debug-Output "UTILITY.INF: SourcePath stored is "$(!STF_SRCDIR_USED)
  2094. CloseRegKey $(KeyNt)
  2095. Endif
  2096. Endif
  2097. DAS_exit =+
  2098. ;
  2099. ; Read the progress copy symbols.
  2100. ;
  2101. Read-syms ProgressCopy$(!STF_LANGUAGE)
  2102. Return $(DAS_Result) $(DAS_SRCDIR)
  2103. ;*************************************************************************
  2104. ; end of section DoAskSource
  2105. ;*************************************************************************
  2106. ;*************************************************************************
  2107. ;
  2108. ; SECTION: RemoveSoftwareComponent
  2109. ;
  2110. ; PURPOSE: Remove the specified software component from the
  2111. ; registry. It will remove the entry in the software
  2112. ; section of the registry first. Then it will remove
  2113. ; the entry in the service section of the registry.
  2114. ;
  2115. ; ARGUMENTS: $0 Manufacturer Name
  2116. ; $1 Product Name
  2117. ; $2 Boolean flag for zero reference count checking
  2118. ; ( optional. If it is defined, skip checking )
  2119. ;
  2120. ;
  2121. ; RETURNS: $R0 Registry error code or zero if no error
  2122. ;
  2123. ; REFERENCES: Nothing
  2124. ;
  2125. ; MODIFIES: Nothing
  2126. ;
  2127. ;*************************************************************************
  2128. [RemoveSoftwareComponent]
  2129. Debug-Output "Remove Software Component..."
  2130. read-syms InitBaseVars
  2131. set RS_Manufacturer = $($0)
  2132. set RS_ProductName = $($1)
  2133. set RS_CheckRefCount = $($2)
  2134. set RS_VersionNum = "CurrentVersion"
  2135. set RS_ManufacturerKey = $(!NTN_SoftwareBase)"\"$(RS_Manufacturer)
  2136. set RS_ProductKey = $(!NTN_SoftwareBase)"\"$(RS_Manufacturer)"\"$(RS_ProductName)
  2137. set RS_ProductVerKey = $(!NTN_SoftwareBase)"\"$(RS_Manufacturer)"\"$(RS_ProductName)"\"$(RS_VersionNum)
  2138. set RegistryErrorIndex = NO_ERROR
  2139. ;
  2140. ; Check the reference counter first
  2141. ;
  2142. ifstr(i) $(RS_CheckRefCount) != FALSE
  2143. Shell "", IsRefCountEqualZero, $(RS_ProductVerKey)
  2144. Ifstr(i) $($R0) != NO_ERROR
  2145. Debug-Output "UTILITY.INF: [RemoveSoftwareComponent] IsRefCountEqualZero returned "$($R0)
  2146. goto RemoveSoftwareComponent_Return
  2147. endif
  2148. Ifint $($R1) == 0
  2149. set RegistryErrorIndex = REF_COUNT_NOT_ZERO
  2150. goto RemoveSoftwareComponent_Return
  2151. endif
  2152. endif
  2153. ;
  2154. ; Remove the software first
  2155. ;
  2156. OpenRegKey $(!REG_H_LOCAL) "" $(RS_ManufacturerKey) $(MAXIMUM_ALLOWED) ProductKey
  2157. Ifstr $(ProductKey) == $(KeyNull)
  2158. Debug-Output "UTILITY.INF: could not open Software product key"
  2159. set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  2160. goto RemoveSoftwareComponent_Return
  2161. endif
  2162. DeleteRegTree $(ProductKey) $(RS_ProductName)
  2163. CloseRegKey $(ProductKey)
  2164. ;
  2165. ; Remove the service
  2166. ;
  2167. Shell "" RemoveService, $(RS_ProductName), "YES"
  2168. Set RS_RemoveError = $($R0)
  2169. Ifint $(RS_RemoveError) != 0
  2170. Debug-Output "UTILITY.INF: RemoveService wrapper failed, error: "$(RS_RemoveResult)
  2171. Set RegistryErrorIndex = UNABLE_REMOVE_CONFIGURE_SERVICE
  2172. Goto RemoveSoftwareComponent_Return
  2173. Endif
  2174. RemoveSoftwareComponent_Return = +
  2175. Return $(RegistryErrorIndex)
  2176. ;*************************************************************************
  2177. ; end of section RemoveSoftwareComponent
  2178. ;*************************************************************************
  2179. ;*************************************************************************
  2180. ;
  2181. ; SECTION: RemoveHardwareComponent
  2182. ;
  2183. ; PURPOSE: Remove the adapter entry from the registry. First
  2184. ; remove the adapter entry under Networkcards. Then it
  2185. ; will remove the service entry under SYSTEM.
  2186. ;
  2187. ; ARGUMENTS: $0 Manufacturer Name (i.e., 3Com)
  2188. ; $1 Product Name (i.e., Elnk)
  2189. ; $2 Net Card Name (i.e., Elnkii05)
  2190. ;
  2191. ;
  2192. ; RETURNS: $R0 Registry error code or zero if no error
  2193. ;
  2194. ; REFERENCES: Nothing
  2195. ;
  2196. ; MODIFIES: Nothing
  2197. ;
  2198. ;*************************************************************************
  2199. [RemoveHardwareComponent]
  2200. Debug-Output "Remove Hardware Component..."
  2201. read-syms InitBaseVars
  2202. set RH_Manufacturer = $($0)
  2203. set RH_ProductName = $($1)
  2204. set RH_VersionNum = "CurrentVersion"
  2205. set RH_ProductKey = $(!NTN_SoftwareBase)"\"$($0)"\"$($1)"\"$(RH_VersionNum)
  2206. set RH_NetCardName = $($2)
  2207. Split-String $(RH_NetCardName), "\", CardInfo
  2208. set RH_NetCardNum = *($(CardInfo),11)
  2209. set RH_NetCardBase = *($(CardInfo),1)*($(CardInfo),2)*($(CardInfo),3)*($(CardInfo),4)*($(CardInfo),5)*($(CardInfo),6)*($(CardInfo),7)*($(CardInfo),8)*($(CardInfo),9)
  2210. set RegistryErrorIndex = NO_ERROR
  2211. ;
  2212. ; decrement the reference counter first
  2213. ;
  2214. Shell "", DecrementRefCount, $(RH_ProductKey)
  2215. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  2216. Debug-Output "UTILITY.INF: [AddHardwareComponent] IncrementRefCount returned "$(RegistryErrorIndex)
  2217. goto RemoveHardwareComponent_Return
  2218. endif
  2219. ;
  2220. ; Remove the Net card first
  2221. ;
  2222. OpenRegKey $(!REG_H_LOCAL) "" $(RH_NetCardBase) $(MAXIMUM_ALLOWED) NetCardKey
  2223. Ifstr $(NetCardKey) == $(KeyNull)
  2224. Debug-Output "UTILITY.INF: could not open NetworkCards key"
  2225. set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  2226. goto RemoveHardwareComponent_Return
  2227. endif
  2228. OpenRegKey $(NetCardKey) "" $(RH_NetCardNum) $(MAXIMUM_ALLOWED) NetCardNumKey
  2229. Ifstr $(NetCardNumKey) == $(KeyNull)
  2230. Debug-Output "UTILITY.INF: could not open NetworkCards Number key"
  2231. set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  2232. goto RemoveHardwareComponent_Return
  2233. endif
  2234. GetRegValue $(NetCardNumKey),"ServiceName", RH_ServiceNameInfo
  2235. set RH_ServiceName = *($(RH_ServiceNameInfo), 4)
  2236. ifstr(i) $(RH_ServiceName) == ""
  2237. ; if we cannot get the service name, make a guess
  2238. set RH_ServiceName = $(RH_ProductName)$(RH_NetCardNum)
  2239. endif
  2240. CloseRegKey $(NetCardNumKey)
  2241. DeleteRegTree $(NetCardKey) $(RH_NetCardNum)
  2242. CloseRegKey $(NetCardKey)
  2243. Shell "", RemoveService, $(RH_ServiceName), "NO"
  2244. Set RS_RemoveError = $($R0)
  2245. Ifint $(RS_RemoveError) != 0
  2246. Debug-Output "UTILITY.INF: RemoveService wrapper failed, error: "$(RS_RemoveResult)
  2247. Set RegistryErrorIndex = UNABLE_REMOVE_CONFIGURE_SERVICE
  2248. Goto RemoveHardwareComponent_Return
  2249. Endif
  2250. ;
  2251. ; If driver reference count is equal to 0, remove it.
  2252. ;
  2253. Shell "", IsRefCountEqualZero, $(RH_ProductKey)
  2254. Ifstr(i) $($R0) != NO_ERROR
  2255. Debug-Output "UTILITY.INF: [RemoveHardwareComponent] IsRefCountEqualZero returned "$($R0)
  2256. goto RemoveHardwareComponent_Return
  2257. endif
  2258. Ifint $($R1) == 1
  2259. Debug-Output "Remove software component..."
  2260. Shell "" RemoveSoftwareComponent, $(RH_Manufacturer), $(RH_ProductName)
  2261. set RegistryErrorIndex = $($R0)
  2262. endif
  2263. debug-output "remove netbios information..."
  2264. LibraryProcedure Result, $(!NCPA_HANDLE), RemoveRouteFromNETBIOS, $(RH_ServiceName)
  2265. RemoveHardwareComponent_Return = +
  2266. Return $(RegistryErrorIndex)
  2267. ;*************************************************************************
  2268. ; end of section RemoveHardwareComponent
  2269. ;*************************************************************************
  2270. ;*************************************************************************
  2271. ;
  2272. ; SECTION: RemoveService
  2273. ;
  2274. ; PURPOSE: Remove a specified service from the registry. It is
  2275. ; called by RemoveSoftwareComponent and
  2276. ; RemoveHardwareComponent. Or, if the service is
  2277. ; created by calling "CreateService", we will
  2278. ; need to use this subroutine to remove it.
  2279. ;
  2280. ; ARGUMENTS: $0 Service Name
  2281. ; $1 "YES" - we use DeleteService to remove the service
  2282. ; "NO" - we use DeleteRegTree to remove the
  2283. ; registry tree
  2284. ;
  2285. ; RETURNS: $R0 Registry error code or zero if no error
  2286. ;
  2287. ; REFERENCES: Nothing
  2288. ;
  2289. ; MODIFIES: Nothing
  2290. ;
  2291. ;*************************************************************************
  2292. [RemoveService]
  2293. read-syms InitBaseVars
  2294. Set RS_SvcName = $($0)
  2295. Set RS_UseDelSvc = $($1)
  2296. ; Make sure the service key exists first.
  2297. OpenRegKey $(!REG_H_LOCAL) "" "SYSTEM\CurrentControlSet\Services\"$(RS_SvcName) +
  2298. $(MAXIMUM_ALLOWED) ServiceKey
  2299. Ifstr $(ServiceKey) == $(KeyNull)
  2300. Debug-Output "UTILITY.INF: could not open SYSTEM Service key "$(RS_SvcName)
  2301. goto RemoveService_Return
  2302. endif
  2303. ; Remove the NbProvider value if it exists
  2304. OpenRegKey $(ServiceKey) "" "Parameters" $(MAXIMUM_ALLOWED) ParameterKey
  2305. Ifstr $(ParameterKey) != $(KeyNull)
  2306. DeleteRegValue $(ParameterKey) "NbProvider"
  2307. CloseRegKey $(ParameterKey)
  2308. Endif
  2309. CloseRegKey $(ServiceKey)
  2310. ifstr(i) $(RS_UseDelSvc) == "YES"
  2311. ; Remove the service
  2312. Set FLibraryErrCtl = 1
  2313. LibraryProcedure RS_RemoveResult $(!NCPA_HANDLE), CPlSetup, +
  2314. $(!STF_HWND), DELETESVC, $(RS_SvcName)
  2315. Set FLibraryErrCtl = 0
  2316. ; Check the return code
  2317. Set RS_RemoveError = *($(RS_RemoveResult),1)
  2318. Ifint $(RS_RemoveError) != 0
  2319. Debug-Output "UTILITY.INF: RemoveService wrapper failed, error: "$(RS_RemoveResult)
  2320. Set RegistryErrorIndex = UNABLE_REMOVE_CONFIGURE_SERVICE
  2321. Goto RemoveService_Return
  2322. Endif
  2323. else
  2324. OpenRegKey $(!REG_H_LOCAL) "" "SYSTEM\CurrentControlSet\Services" +
  2325. $(MAXIMUM_ALLOWED) ServiceKey
  2326. Ifstr $(ServiceKey) == $(KeyNull)
  2327. Debug-Output "UTILITY.INF: could not open SYSTEM Service key "$(RS_SvcName)
  2328. set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  2329. goto RemoveService_Return
  2330. endif
  2331. DeleteRegTree $(ServiceKey) $(RS_SvcName)
  2332. CloseRegKey $(ServiceKey)
  2333. endif
  2334. RemoveService_Return = +
  2335. return $(RegistryErrorIndex)
  2336. ;*************************************************************************
  2337. ; end of section RemoveService
  2338. ;*************************************************************************
  2339. ;*************************************************************************
  2340. ;
  2341. ; SECTION: IsNetCardAlreadyInstalled
  2342. ;
  2343. ; PURPOSE: This subroutine is called by EISA and MCA net card
  2344. ; setup. Given the bus number and slot number, it will
  2345. ; return a boolean to idicate whether the card is
  2346. ; already installed or not.
  2347. ;
  2348. ; ARGUMENTS: $0 Bus Number
  2349. ; $1 Slot Number
  2350. ; $2 Product Description
  2351. ; $3 Product Name
  2352. ; $4 Skip description and name checking
  2353. ;
  2354. ; RETURNS: $R0 Registry error code or zero if no error
  2355. ; $R1 "YES" - if the net card already installed
  2356. ; "NO" - if the net card is not in the registry
  2357. ;
  2358. ; REFERENCES: Nothing
  2359. ;
  2360. ; MODIFIES: Nothing
  2361. ;
  2362. ;*************************************************************************
  2363. [IsNetCardAlreadyInstalled]
  2364. read-syms InitBaseVars
  2365. set AlreadyExisted = "NO"
  2366. set BusNum = $($0)
  2367. set SlotNum = $($1)
  2368. set Description = $($2)
  2369. set Product = $($3)
  2370. set SkipDescriptionCheck = $($4)
  2371. ifstr(i) $(SkipDescriptionCheck) == ""
  2372. set SkipDescriptionCheck = "NO"
  2373. endif
  2374. OpenRegKey $(!REG_H_LOCAL) "" $(NetworkCardKeyName) $(MAXIMUM_ALLOWED) IE_KeyNetcards
  2375. Ifstr $(IE_KeyNetcards) == $(KeyNull)
  2376. set RegistryErrorIndex = UNABLE_OPEN_NETWORKCARD_SECTION
  2377. goto IE_Return
  2378. endif
  2379. EnumRegKey $(IE_KeyNetcards) IE_KeyNameList
  2380. ;
  2381. ; Compare all the NetworkCards entry and see whether they have the
  2382. ; same title and productname.
  2383. ;
  2384. ForListDo $(IE_KeyNameList)
  2385. set IE_KeyName = *($($),1)
  2386. OpenRegKey $(IE_KeyNetcards) "" $(IE_KeyName) $(MAXIMUM_ALLOWED) IE_Card
  2387. Ifstr $(IE_Card) == $(KeyNull)
  2388. set RegistryErrorIndex = UNABLE_OPEN_NETWORKCARD_SECTION
  2389. goto IE_Return
  2390. endif
  2391. GetRegValue $(IE_Card),"Description", DescriptionInfo
  2392. GetRegValue $(IE_Card),"ProductName", ProductNameInfo
  2393. set CardDescription = *($(DescriptionInfo), 4)
  2394. set CardProductName = *($(ProductNameInfo), 4)
  2395. ifstr(i) $(SkipDescriptionCheck) == "YES"
  2396. set CardDescription = $(Description)
  2397. set CardProductName = $(Product)
  2398. endif
  2399. ifstr(i) $(CardDescription) == $(Description)
  2400. ifstr(i) $(CardProductName) == $(Product)
  2401. ;
  2402. ; We find the same product type. make sure that it
  2403. ; does not have the same bus number and slot number
  2404. ;
  2405. GetRegValue $(IE_Card), "ServiceName", ServiceNameInfo
  2406. set ServiceName = *($(ServiceNameInfo), 4)
  2407. OpenRegKey $(!REG_H_LOCAL) "" +
  2408. $(ServicesBaseName)"\"$(ServiceName)"\Parameters" +
  2409. $(MAXIMUM_ALLOWED) IE_KeyService
  2410. Ifstr $(IE_KeyService) == $(KeyNull)
  2411. set RegistryErrorIndex = UNABLE_OPEN_NETWORKCARD_SECTION
  2412. goto IE_Return
  2413. endif
  2414. GetRegValue $(IE_KeyService), "BusNumber", BusInfo
  2415. GetRegValue $(IE_KeyService), "SlotNumber", SlotInfo
  2416. set CardBusNum = *($(BusInfo), 4)
  2417. set CardSlotNum = *($(SlotInfo), 4)
  2418. ifint $(CardBusNum) == $(BusNum)
  2419. ifint $(CardSlotNum) == $(SlotNum)
  2420. ;
  2421. ; Don't install this card. It is already installed
  2422. ;
  2423. set AlreadyExisted = "YES"
  2424. endif
  2425. endif
  2426. endif
  2427. endif
  2428. EndForListDo
  2429. IE_Return = +
  2430. return $(RegistryErrorIndex) $(AlreadyExisted)
  2431. ;*************************************************************************
  2432. ; end of section IsNetCardAlreadyInstalled
  2433. ;*************************************************************************
  2434. ;*************************************************************************
  2435. ;
  2436. ; SECTION: CopyRegTreeAs
  2437. ;
  2438. ; PURPOSE:
  2439. ;
  2440. ;
  2441. ; ARGUMENTS: $0 Handle to the source reg key
  2442. ; $1 Handle to the destination reg key
  2443. ; $2 (optional) Name of the destination key to place the entries in
  2444. ; $3 (optional) (TRUE|FALSE) Make destination volatile
  2445. ;
  2446. ; RETURNS: $R0 Registry error code or zero if no error
  2447. ; $R1 Handle to destination key (if $2 is "" then returns $1)
  2448. ;
  2449. ; REFERENCES: none
  2450. ;
  2451. ; MODIFIES: none
  2452. ;
  2453. ;
  2454. ;*************************************************************************
  2455. [CopyRegTreeAs]
  2456. read-syms InitBaseVars
  2457. Set RegistryErrorIndex = NO_ERROR
  2458. set CRTA_SrcKey = $($0)
  2459. set CRTA_BaseDestKey = $($1)
  2460. set CRTA_DestName = $($2)
  2461. set CRTA_DestKey = $($1)
  2462. ifstr(i) $(CRTA_DestName) != ""
  2463. ;
  2464. ; create the destination key
  2465. ;
  2466. CreateRegKey $(CRTA_BaseDestKey) {$(CRTA_DestName),$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" CRTA_DestKey
  2467. Ifstr(i) $(CRTA_DestKey) == $(KeyNull)
  2468. Set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  2469. Goto CRTA_Return
  2470. Endif
  2471. endif
  2472. ;
  2473. ; call into the ncpa to copy the reg tree
  2474. ;
  2475. Set FLibraryErrCtl = 1
  2476. LibraryProcedure CRTA_CopyResult $(!NCPA_HANDLE), RegCopyTree, $(CRTA_SrcKey), $(CRTA_DestKey)
  2477. Set FLibraryErrCtl = 0
  2478. Set CRTA_CopyError = *($(CRTA_CopyResult),1)
  2479. Ifint $(CRTA_CopyError) != 0
  2480. Debug-Output "UTILITY.INF: [CopyRegTreeAs] RegCopyTree returned "$(CRTA_CopyError)
  2481. Set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  2482. Goto CRTA_Return
  2483. Endif
  2484. CRTA_Return = +
  2485. return $(RegistryErrorIndex) $(CRTA_DestKey)
  2486. ;*************************************************************************
  2487. ;
  2488. ; SECTION: UpdateWinsockService
  2489. ;
  2490. ; PURPOSE: This section creates, if necessary, the WinSock
  2491. ; service data object. This Registry key is a placeholder
  2492. ; for all WinSock mapping information. In particular,
  2493. ; it contains a value called Transports, which contains
  2494. ; a REG_MULTI_SZ listing the names of all transports
  2495. ; which export a sockets interface (through a DLL).
  2496. ;
  2497. ; Then, we either add or remove the name of this transport
  2498. ; from the list.
  2499. ;
  2500. ; ARGUMENTS: $0 Name of Transport Service supporting WinSock
  2501. ; $1 TRUE if adding data; FALSE if removing data
  2502. ;
  2503. ; RETURNS: $R0 Registry error code or zero if no error
  2504. ;
  2505. ; REFERENCES: none
  2506. ;
  2507. ; MODIFIES: none
  2508. ;
  2509. ;
  2510. ;*************************************************************************
  2511. [UpdateWinsockService]
  2512. read-syms InitBaseVars
  2513. ;
  2514. ; Get the base key handle for the services area
  2515. ;
  2516. Set UW_NameOfService = $($0)
  2517. Set UW_Adding = $($1)
  2518. Set UW_KeyServices = $(KeyNull)
  2519. Set UW_KeyParameters = $(KeyNull)
  2520. Shell "", BaseServiceKey
  2521. Set RegistryErrorIndex = $($R0)
  2522. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  2523. Set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  2524. Goto U_W_Return
  2525. endif
  2526. Set UW_KeyServices = $($R1)
  2527. OpenRegKey $(UW_KeyServices) "" "WinSock\Parameters" $(MAXIMUM_ALLOWED) UW_KeyParameters
  2528. Ifstr(i) $(UW_KeyParameters) == $(KeyNull)
  2529. ;
  2530. ; Service is not correctly installed or not installed
  2531. ;
  2532. set UW_KeyWinSock = $(KeyNull)
  2533. set UW_RestoreKeys = FALSE
  2534. set UW_TempKeyName = ""
  2535. set UW_TempKey = $(KeyNull)
  2536. OpenRegKey $(UW_KeyServices) "" "WinSock" $(MAXIMUM_ALLOWED) UW_KeyWinSock
  2537. Ifstr(i) $(UW_KeyWinSock) != $(KeyNull)
  2538. ;
  2539. ; Service is not correctly installed,
  2540. ; save the everything away and then delete the key
  2541. ; later after it has been installed, reload the saved
  2542. ; child keys and values
  2543. ;
  2544. set UW_RestoreKeys = TRUE
  2545. set UW_TempKeyName = "WinSockMergeVolatile"
  2546. Shell "", CopyRegTreeAs $(UW_KeyWinSock) $(UW_KeyServices) $(UW_TempKeyName)
  2547. set UW_TempKey = $($R1)
  2548. CloseRegKey $(UW_KeyWinSock)
  2549. DeleteRegTree $(UW_KeyServices) "WinSock"
  2550. Endif
  2551. Debug-Output "UTILITY.INF: Create WinSock Service"
  2552. Shell "", CreateService, "WinSock", "", "", "adapter", "", {}
  2553. Set RegistryErrorIndex = $($R0)
  2554. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  2555. Debug-Output "UTILITY.INF: CreateService for WinSock returned "$(RegistryErrorIndex)
  2556. ifstr(i) $(UW_RestoreKeys) == TRUE
  2557. CloseRegKey $(UW_TempKey)
  2558. Endif
  2559. Goto U_W_Return
  2560. Endif
  2561. set UW_KeyWinSock = $($R1)
  2562. Set UW_KeyParameters = $($R2)
  2563. ;
  2564. ; Copy the temp key back into the Winsock key,
  2565. ; then we delete it
  2566. ;
  2567. ifstr(i) $(UW_RestoreKeys) == TRUE
  2568. Shell "", CopyRegTreeAs $(UW_TempKey) $(UW_KeyWinSock) ""
  2569. CloseRegKey $(UW_TempKey)
  2570. DeleteRegTree $(UW_KeyServices) "WinSockMergeVolatile"
  2571. Endif
  2572. CloseRegKey $(UW_KeyWinSock)
  2573. CloseRegKey $($R3)
  2574. Else
  2575. Debug-Output "UTILITY.INF: Open WinSock Service"
  2576. Endif
  2577. Ifstr(i) $(UW_KeyParameters) == $(KeyNull)
  2578. Set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  2579. Goto U_W_Return
  2580. Endif
  2581. ;
  2582. ; Get the old REG_MULTI_SZ containing the list of supported transports;
  2583. ; add the new transport service name to the list or remove it.
  2584. ;
  2585. GetRegValue $(UW_KeyParameters) "Transports" UW_TransportsValue
  2586. Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
  2587. Set UW_TransportsList = *($(UW_TransportsValue), 4)
  2588. Else
  2589. Set UW_TransportsList = {}
  2590. Endif
  2591. Ifstr(i) $(UW_TransportsList) == ""
  2592. Set UW_TransportsList = {}
  2593. Endif
  2594. ;
  2595. ; If we're removing the transport, do so; else, append it to the
  2596. ; end of the list.
  2597. ;
  2598. Ifstr(i) $(UW_Adding) == "TRUE"
  2599. Set UW_TransportsList = >($(UW_TransportsList), $(UW_NameOfService))
  2600. Else
  2601. Set UW_NewList = {}
  2602. ForListDo $(UW_TransportsList)
  2603. Ifstr(i) $($) != $(UW_NameOfService)
  2604. Set UW_NewList = >($(UW_NewList), $($))
  2605. Endif
  2606. EndForListDo
  2607. Set UW_TransportsList = $(UW_NewList)
  2608. Endif
  2609. SetRegValue $(UW_KeyParameters) {Transports, $(NoTitle), $(!REG_VT_MULTI_SZ), $(UW_TransportsList)}
  2610. Debug-Output "UTILITY.INF: WinSock transport info added/deleted for "$(UW_NameOfService)
  2611. U_W_Return = +
  2612. Ifstr $(UW_KeyParameters) != $(KeyNull)
  2613. CloseRegKey $(UW_KeyParameters)
  2614. Endif
  2615. Ifstr $(UW_KeyServices) != $(KeyNull)
  2616. CloseRegKey $(UW_KeyServices)
  2617. Endif
  2618. Return $(RegistryErrorIndex)
  2619. ;*************************************************************************
  2620. ; end of section UpdateWinsockService
  2621. ;*************************************************************************
  2622. ;*************************************************************************
  2623. ;
  2624. ; SECTION: UpdateWinsockMappings
  2625. ;
  2626. ; PURPOSE: This function calls into CPLSetup to get new mapping
  2627. ; information for the protocol
  2628. ;
  2629. ; ARGUMENTS: $0 Service name of transport driver
  2630. ; $1 DLL name for WinSock interface to transport
  2631. ;
  2632. ; RETURNS: $R0 Registry error code or zero if no error
  2633. ; $R1 Key handle to <service>\Parameters\Winsock
  2634. ;
  2635. ; REFERENCES: none
  2636. ;
  2637. ; MODIFIES: none
  2638. ;
  2639. ;*************************************************************************
  2640. [UpdateWinsockMappings]
  2641. read-syms InitBaseVars
  2642. Set AW_NameOfService = $($0)
  2643. Set AW_DLLName = $($1)
  2644. Shell "", BaseServiceKey
  2645. Set RegistryErrorIndex = $($R0)
  2646. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  2647. Set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  2648. Goto M_W_Return
  2649. endif
  2650. OpenRegKey $($R1) "" $(AW_NameOfService)"\Parameters\Winsock" $(MAXIMUM_ALLOWED) KeyWinsock
  2651. Ifstr(i) $(KeyWinsock) == ""
  2652. Set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  2653. Goto M_W_Return
  2654. Endif
  2655. Set FLibraryErrCtl = 1
  2656. LibraryProcedure MW_MapResult $(!NCPA_HANDLE), CPlSetup, $(!STF_HWND), WINSOCKMAP, $(AW_DLLName), $(KeyWinsock)
  2657. Set FLibraryErrCtl = 0
  2658. Set AW_MapError = *($(MW_MapResult),1)
  2659. Ifint $(AW_MapError) != 0
  2660. Debug-Output "UTILITY.INF: [UpdateWinsockMappings] WINSOCKMAP returned "$(AW_MapError)
  2661. Set RegistryErrorIndex = UNABLE_ACCESS_WINSOCK_MAP_INFO
  2662. Goto M_W_Return
  2663. Endif
  2664. M_W_Return = +
  2665. Ifstr $(KeyWinsock) != $(KeyNull)
  2666. CloseRegKey $(KeyWinsock)
  2667. Endif
  2668. Return $(RegistryErrorIndex)
  2669. ;*************************************************************************
  2670. ; end of section AddWinsockInfo
  2671. ;*************************************************************************
  2672. ;*************************************************************************
  2673. ;
  2674. ; SECTION: AddWinsockInfo
  2675. ;
  2676. ; PURPOSE: This function adds WinSock sockets provider info
  2677. ; to a transport.
  2678. ;
  2679. ; ARGUMENTS: $0 Service name of transport driver
  2680. ; $1 DLL name for WinSock interface to transport
  2681. ; $2 integer value for MaxSockAddrLength
  2682. ; $3 integer value for MinSockAddrLength
  2683. ;
  2684. ; RETURNS: $R0 Registry error code or zero if no error
  2685. ; $R1 Key handle to <service>\Parameters\Winsock
  2686. ;
  2687. ; REFERENCES: none
  2688. ;
  2689. ; MODIFIES: none
  2690. ;
  2691. ;
  2692. ; NOTES: This function/section calls the NCPA function CPlSetup
  2693. ; to bind to the DLL in question and add the value of the
  2694. ; export function WSHWinSockMapping() to the Registry under
  2695. ; the "<service>\Parameters\Winsock:Mapping" value. To do
  2696. ; this, the Registry key handle in SETUP form is passed
  2697. ; to the NCPA export.
  2698. ;
  2699. ;
  2700. ;*************************************************************************
  2701. [AddWinsockInfo]
  2702. read-syms InitBaseVars
  2703. ;
  2704. ; Get the base key handle for the services area
  2705. ;
  2706. Set AW_NameOfService = $($0)
  2707. Set AW_DLLName = $($1)
  2708. Set AW_MaxAddrLgt = $($2)
  2709. Set AW_MinAddrLgt = $($3)
  2710. Set AW_KeyServices = $(KeyNull)
  2711. Set AW_KeyParameters = $(KeyNull)
  2712. Set AW_KeySockets = $(KeyNull)
  2713. Shell "", AddAFD
  2714. Set RegistryErrorIndex = $($R0)
  2715. Ifstr(i) $(RegistryErrorIndex) == NO_ERROR
  2716. Shell "", BaseServiceKey
  2717. Set RegistryErrorIndex = $($R0)
  2718. Endif
  2719. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  2720. Set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  2721. Goto A_W_Return
  2722. endif
  2723. Set AW_KeyServices = $($R1)
  2724. OpenRegKey $(AW_KeyServices) "" $(AW_NameOfService)"\Parameters" $(MAXIMUM_ALLOWED) AW_KeyParameters
  2725. Ifstr(i) $(AW_KeyParameters) == $(KeyNull)
  2726. Set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  2727. Goto A_W_Return
  2728. Endif
  2729. OpenRegKey $(AW_KeyParameters) "" "Winsock" $(MAXIMUM_ALLOWED) AW_KeySockets
  2730. Ifstr(i) $(AW_KeySockets) == $(KeyNull)
  2731. CreateRegKey $(AW_KeyParameters) {Winsock,$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" AW_KeySockets
  2732. Endif
  2733. Ifstr(i) $(AW_KeySockets) == $(KeyNull)
  2734. Set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  2735. Goto A_W_Return
  2736. Endif
  2737. Set AW_ValueList = {{HelperDllName ,$(NoTitle),$(!REG_VT_EXPAND_SZ),$(AW_DLLName)},+
  2738. {MaxSockAddrLength,$(NoTitle),$(!REG_VT_DWORD),$(AW_MaxAddrLgt)},+
  2739. {MinSockAddrLength,$(NoTitle),$(!REG_VT_DWORD),$(AW_MinAddrLgt)}}
  2740. Shell "", AddValueList, $(AW_KeySockets), $(AW_ValueList)
  2741. Set RegistryErrorIndex = $($R0)
  2742. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  2743. Debug-Output "UTILITY.INF: [AddWinsockInfo] Registry error: Add value list"
  2744. Endif
  2745. ;
  2746. ; Extract the WinSock mapping information from the DLL
  2747. ;
  2748. Set FLibraryErrCtl = 1
  2749. LibraryProcedure AW_MapResult $(!NCPA_HANDLE), CPlSetup, $(!STF_HWND), WINSOCKMAP, $(AW_DLLName), $(AW_KeySockets)
  2750. Set FLibraryErrCtl = 0
  2751. Set AW_MapError = *($(AW_MapResult),1)
  2752. Ifint $(AW_MapError) != 0
  2753. Debug-Output "UTILITY.INF: [AddWinsockInfo] WINSOCKMAP returned "$(AW_MapError)
  2754. Set RegistryErrorIndex = UNABLE_ACCESS_WINSOCK_MAP_INFO
  2755. Goto A_W_Return
  2756. Endif
  2757. ;
  2758. ; Add this service to the WinSock transports list.
  2759. ;
  2760. Shell "" UpdateWinsockService $(AW_NameOfService) TRUE
  2761. Set RegistryErrorIndex = $($R0)
  2762. A_W_Return = +
  2763. Ifstr $(AW_KeySockets) != $(KeyNull)
  2764. CloseRegKey $(AW_KeySockets)
  2765. Endif
  2766. Ifstr $(AW_KeyParameters) != $(KeyNull)
  2767. CloseRegKey $(AW_KeyParameters)
  2768. Endif
  2769. Ifstr $(AW_KeyServices) != $(KeyNull)
  2770. CloseRegKey $(AW_KeyServices)
  2771. Endif
  2772. Return $(RegistryErrorIndex)
  2773. ;*************************************************************************
  2774. ; end of section AddWinsockInfo
  2775. ;*************************************************************************
  2776. ;*************************************************************************
  2777. ;
  2778. ; SECTION: RemoveWinsockInfo
  2779. ;
  2780. ; PURPOSE: This function removes WinSock sockets provider
  2781. ; information from a transport
  2782. ;
  2783. ; ARGUMENTS: $0 Service name of transport driver
  2784. ;
  2785. ; RETURNS: $R0 Registry error code or zero if no error
  2786. ;
  2787. ; REFERENCES: none
  2788. ;
  2789. ; MODIFIES: none
  2790. ;
  2791. ;
  2792. ;*************************************************************************
  2793. [RemoveWinsockInfo]
  2794. read-syms InitBaseVars
  2795. ;
  2796. ; Get the base key handle for the services area
  2797. ;
  2798. Set RW_NameOfService = $($0)
  2799. Set RW_KeyServices = $(KeyNull)
  2800. Set RW_KeySockets = $(KeyNull)
  2801. Shell "", BaseServiceKey
  2802. Set RegistryErrorIndex = $($R0)
  2803. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  2804. Set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  2805. Goto R_W_Return
  2806. endif
  2807. Set RW_KeyServices = $($R1)
  2808. OpenRegKey $(RW_KeyServices) "" $(RW_NameOfService)"\Parameters" $(MAXIMUM_ALLOWED) RW_KeySockets
  2809. Ifstr(i) $(RW_KeySockets) == $(KeyNull)
  2810. Set RegistryErrorIndex = NO_ERROR
  2811. else
  2812. ;
  2813. ; Delete the \Parameters\Winsock key. Ignore errors, since the service
  2814. ; is almost certainly being deinstalled.
  2815. ;
  2816. DeleteRegTree $(RW_KeySockets) "Winsock"
  2817. Endif
  2818. ;
  2819. ; Remove this service from the WinSock transports list.
  2820. ;
  2821. Shell "" UpdateWinsockService $(RW_NameOfService) FALSE
  2822. Set RegistryErrorIndex = $($R0)
  2823. R_W_Return = +
  2824. Ifstr $(RW_KeySockets) != $(KeyNull)
  2825. CloseRegKey $(RW_KeySockets)
  2826. Endif
  2827. Ifstr $(RW_KeyServices) != $(KeyNull)
  2828. CloseRegKey $(RW_KeyServices)
  2829. Endif
  2830. Return $(RegistryErrorIndex)
  2831. ;*************************************************************************
  2832. ; end of section RemoveWinsockInfo
  2833. ;*************************************************************************
  2834. ;*************************************************************************
  2835. ;
  2836. ; SECTION: GetBindingInfo
  2837. ;
  2838. ; PURPOSE: This function returns the bindable rules for the given
  2839. ; manufacturer.
  2840. ;
  2841. ; ARGUMENTS: $0 manufacturer name
  2842. ;
  2843. ; RETURNS: $R0 Registry error code or zero if no error
  2844. ; $R1 Bindable rule
  2845. ;
  2846. ; REFERENCES: none
  2847. ;
  2848. ; MODIFIES: none
  2849. ;
  2850. ;
  2851. ;*************************************************************************
  2852. [BindingInfo-DEC]
  2853. BindingInfo = {+
  2854. "lanceDriver dec100Adapter non exclusive 100",+
  2855. "lanceDriver dec101Adapter non exclusive 100",+
  2856. "lanceDriver decetherworksturboAdapter non exclusive 100",+
  2857. "lanceDriver dec422Adapter non exclusive 100",+
  2858. "lanceDriver decpcAdapter non exclusive 100",+
  2859. "lanceDriver decstatAdapter non exclusive 100"+
  2860. }
  2861. [BindingInfo-WD]
  2862. BindingInfo = {+
  2863. "smc8000nDriver smcisaAdapter non exclusive 100",+
  2864. "smc8000nDriver wd8003eaAdapter non exclusive 100",+
  2865. "smc8000nDriver wd8003waAdapter non exclusive 100",+
  2866. "smc8000nDriver wd8013epaAdapter non exclusive 100",+
  2867. "smc8000nDriver wd8013wpaAdapter non exclusive 100"+
  2868. }
  2869. [BindingInfo-PROTEON]
  2870. BindingInfo = {+
  2871. "proteonDriver p1990Adapter non exclusive 100",+
  2872. "proteonDriver p1390Adapter non exclusive 100"+
  2873. }
  2874. [BindingInfo-PRONET16]
  2875. BindingInfo = {+
  2876. "pronet16Driver p199XAdapter non exclusive 100",+
  2877. "pronet16Driver p139XAdapter non exclusive 100"+
  2878. }
  2879. [BindingInfo-IBMTOK2E]
  2880. BindingInfo = {+
  2881. "ibmtok2eDriver ibmtok2eAdapter non exclusive 100"+
  2882. }
  2883. [BindingInfo-IBM]
  2884. BindingInfo = {"ibmtokDriver ibmtokAdapter non exclusive 100",+
  2885. "ibmtokDriver ibmtokmcAdapter non exclusive 100"}
  2886. [GetBindingInfo]
  2887. set BindingInfo = {}
  2888. read-syms BindingInfo-$($0)
  2889. return "NO_ERROR", $(BindingInfo)
  2890. ;*************************************************************************
  2891. ; end of section GetBindingInfo
  2892. ;*************************************************************************
  2893. ;*************************************************************************
  2894. ;
  2895. ; SECTION: AddStreams
  2896. ;
  2897. ; PURPOSE: Add Streams component
  2898. ;
  2899. ; ARGUMENTS: nothing
  2900. ;
  2901. ; RETURNS: $R0 error code
  2902. ;
  2903. ; MODIFIES: Nothing
  2904. ;
  2905. ;*************************************************************************
  2906. [AddStreams]
  2907. read-syms InitBaseVars
  2908. OpenRegKey $(!REG_H_LOCAL) "" $(ServicesBaseName)"\streams" $(MAXIMUM_ALLOWED) BS_KeyServices
  2909. Ifstr $(BS_KeyServices) == $(KeyNull)
  2910. set OldOption = $(!NTN_InfOption)
  2911. set !NTN_InfOption = STREAMS
  2912. Shell "oemnxpst.inf" InstallOption $(!STF_LANGUAGE) "STREAMS" $(!STF_SRCDIR) $(!NtLmAddCopy) $(!NtLmDoCopy) $(!NtLmDoConfig)
  2913. set !NTN_InfOption = $(OldOption)
  2914. else
  2915. CloseRegKey $(BS_KeyServices)
  2916. Debug-Output "UTILITY.INF: streams already installed"
  2917. endif
  2918. ;
  2919. ; Increase the reference counter
  2920. ;
  2921. Shell "", IncrementRefCount, "Software\Microsoft\streams\CurrentVersion"
  2922. AddStreamsReturn = +
  2923. return NO_ERROR
  2924. ;*************************************************************************
  2925. ;
  2926. ; SECTION: RemoveStreams
  2927. ;
  2928. ; PURPOSE: Remove Streams component
  2929. ;
  2930. ; ARGUMENTS: nothing
  2931. ;
  2932. ; RETURNS: $R0 error code
  2933. ;
  2934. ; MODIFIES: Nothing
  2935. ;
  2936. ;*************************************************************************
  2937. [RemoveStreams]
  2938. read-syms InitBaseVars
  2939. OpenRegKey $(!REG_H_LOCAL) "" $(ServicesBaseName)"\streams" $(MAXIMUM_ALLOWED) BS_KeyServices
  2940. Ifstr $(BS_KeyServices) != $(KeyNull)
  2941. CloseRegKey $(BS_KeyServices)
  2942. Shell "", DecrementRefCount, "Software\Microsoft\streams\CurrentVersion"
  2943. Shell "", IsRefCountEqualZero, "Software\Microsoft\streams\CurrentVersion"
  2944. Ifstr(i) $($R0) != NO_ERROR
  2945. Debug-Output "UTILITY.INF: [RemoveSoftwareComponent] IsRefCountEqualZero returned "$($R0)
  2946. goto RemoveStreamsReturn
  2947. endif
  2948. Ifint $($R1) != 1
  2949. ; if not zero, remove it next time
  2950. goto RemoveStreamsReturn
  2951. endif
  2952. set OldOption = $(!NTN_InfOption)
  2953. set OldInstallMode = $(!NTN_InstallMode)
  2954. set !NTN_InfOption = STREAMS
  2955. set !NTN_InstallMode = deinstall
  2956. Shell "oemnxpst.inf" InstallOption $(!STF_LANGUAGE) "STREAMS" $(!STF_SRCDIR) $(!NtLmAddCopy) $(!NtLmDoCopy) $(!NtLmDoConfig)
  2957. set !NTN_InfOption = $(OldOption)
  2958. set !NTN_InstallMode = $(OldInstallMode)
  2959. endif
  2960. RemoveStreamsReturn = +
  2961. return NO_ERROR
  2962. ;*************************************************************************
  2963. ;
  2964. ; SECTION: AddAFD
  2965. ;
  2966. ; PURPOSE: Add AFD component
  2967. ;
  2968. ; ARGUMENTS: nothing
  2969. ;
  2970. ; RETURNS: $R0 error code
  2971. ;
  2972. ; MODIFIES: Nothing
  2973. ;
  2974. ;*************************************************************************
  2975. [AddAFD]
  2976. read-syms InitBaseVars
  2977. read-syms AFDVars
  2978. Set Result = NO_ERROR
  2979. OpenRegKey $(!REG_H_LOCAL) "" $(ServicesBaseName)"\AFD" $(MAXIMUM_ALLOWED) BS_KeyServices
  2980. Ifstr $(BS_KeyServices) == $(KeyNull)
  2981. Shell "", CreateService, $(ProductAFDName),+
  2982. $(ProductAFDTitle),+
  2983. $(ProductAFDImagePath),+
  2984. $(ProductAFDSvcType), "TDI", {}, "",+
  2985. "%SystemRoot%\System32\IoLogMsg.dll"
  2986. Set Result = $($R0)
  2987. else
  2988. CloseRegKey $(BS_KeyServices)
  2989. endif
  2990. AddAFDReturn = +
  2991. return $(Result)
  2992. ;*************************************************************************
  2993. ;
  2994. ; SECTION: UpgradeAFD
  2995. ;
  2996. ; PURPOSE: Upgrade the AFD component
  2997. ;
  2998. ; ARGUMENTS: nothing
  2999. ;
  3000. ; RETURNS: $R0 error code
  3001. ;
  3002. ; MODIFIES: Nothing
  3003. ;
  3004. ;*************************************************************************
  3005. [UpgradeAFD]
  3006. read-syms InitBaseVars
  3007. Set Result = NO_ERROR
  3008. OpenRegKey $(!REG_H_LOCAL) "" $(ServicesBaseName)"\AFD" $(MAXIMUM_ALLOWED) BS_KeyServices
  3009. Ifstr $(BS_KeyServices) != $(KeyNull)
  3010. ;
  3011. ; add group value
  3012. ;
  3013. SetRegValue $(BS_KeyServices) {Group,$(NoTitle),$(!REG_VT_SZ),"TDI"}
  3014. CloseRegKey $(BS_KeyServices)
  3015. endif
  3016. return $(Result)
  3017. ;*************************************************************************
  3018. ;
  3019. ; SECTION: GetBusTypeNum
  3020. ;
  3021. ; PURPOSE: return the Bus Type Number
  3022. ;
  3023. ; ARGUMENTS: nothing
  3024. ;
  3025. ; RETURNS: $R0 error code
  3026. ; $R1 bus number
  3027. ;
  3028. ; MODIFIES: Nothing
  3029. ;
  3030. ;*************************************************************************
  3031. [GetBusTypeNum]
  3032. read-syms InitBaseVars
  3033. set DetCard = $(!p:DetectedCard)
  3034. ifstr(i) $(DetCard) == ""
  3035. set DetCard = FALSE
  3036. endif
  3037. ifstr(i) $(DetCard) == FALSE
  3038. ; Assume it is an ISA Bus
  3039. set BusType = 1
  3040. ifstr(i) $(!STF_BUSTYPE) == "ISA"
  3041. set BusType = 1
  3042. else-ifstr(i) $(!STF_BUSTYPE) == "EISA"
  3043. set BusType = 2
  3044. else-ifstr(i) $(!STF_BUSTYPE) == "Jazz-Internal Bus"
  3045. set BusType = 0
  3046. else-ifstr(i) $(!STF_BUSTYPE) == "MCA"
  3047. set BusType = 3
  3048. else-ifstr(i) $(!STF_BUSTYPE) == "TCChannel"
  3049. set BusType = 4
  3050. else-ifstr(i) $(!STF_BUSTYPE) == "PCI"
  3051. set BusType = 5
  3052. else-ifstr(i) $(!STF_BUSTYPE) == "PCMCIA"
  3053. ;
  3054. ; when we have plug and play, we need to change it to 8 (not 1)
  3055. ;
  3056. set BusType = 1
  3057. else
  3058. debug-output "Utility.inf: Unknown bus type"
  3059. endif
  3060. else
  3061. set BusType = *($(!STF_NCDETINFO),5)
  3062. endif
  3063. return NO_ERROR, $(BusType)
  3064. ;*************************************************************************
  3065. ;
  3066. ; SECTION: AddRpcProtocol
  3067. ;
  3068. ; PURPOSE: Update the sections of the SOFTWARE\Microsoft\Rpc keys
  3069. ; to reflect the presenceof a new protocol in the system.
  3070. ;
  3071. ; ARGUMENTS: $0 complete RPC protocol string; e.g., "ncacn_ip_tcp"
  3072. ; $1 name of client DLL (no path); e.g., "rpclt1.dll"
  3073. ; $2 name of server DLL (no path); e.g., "rpclt1.dll"
  3074. ;
  3075. ; RETURNS: $R0 STATUS_SUCCESSFUL if ok; error otherwise.
  3076. ;
  3077. ; REFERENCES: Nothing
  3078. ;
  3079. ; MODIFIES: Nothing
  3080. ;
  3081. ;
  3082. ;*************************************************************************
  3083. [AddRpcProtocol]
  3084. Set ARP_Protocol = $($0)
  3085. Set ARP_ClientDll = $($1)
  3086. Set ARP_ServerDll = $($2)
  3087. read-syms InitBaseVars
  3088. Set ARP_KeyRpc = $(KeyNull)
  3089. Set ARP_KeyRpcServer = $(KeyNull)
  3090. Set ARP_KeyRpcClient = $(KeyNull)
  3091. Set RegistryErrorIndex = UNABLE_ACCESS_SOFTWARE_REG
  3092. OpenRegKey $(!REG_H_LOCAL) "" "SOFTWARE\Microsoft\Rpc" $(MAXIMUM_ALLOWED) ARP_KeyRpc
  3093. Ifstr(i) $(ARP_KeyRpc) == $(KeyNull)
  3094. Goto ARP_Return
  3095. Endif
  3096. OpenRegKey $(ARP_KeyRpc) "" "ClientProtocols" $(MAXIMUM_ALLOWED) ARP_KeyClient
  3097. Ifstr(i) $(ARP_KeyClient) == $(KeyNull)
  3098. Goto ARP_Return
  3099. Endif
  3100. OpenRegKey $(ARP_KeyRpc) "" "ServerProtocols" $(MAXIMUM_ALLOWED) ARP_KeyServer
  3101. Ifstr(i) $(ARP_KeyServer) == $(KeyNull)
  3102. Goto ARP_Return
  3103. Endif
  3104. SetRegValue $(ARP_KeyClient) {$(ARP_Protocol),$(NoTitle),$(!REG_VT_SZ),$(ARP_ClientDll)}
  3105. Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  3106. Goto ARP_Return
  3107. Endif
  3108. SetRegValue $(ARP_KeyServer) {$(ARP_Protocol),$(NoTitle),$(!REG_VT_SZ),$(ARP_ServerDll)}
  3109. Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  3110. Goto ARP_Return
  3111. Endif
  3112. Set RegistryErrorIndex = NO_ERROR
  3113. ARP_Return = +
  3114. Ifstr(i) $(ARP_KeyServer) != $(KeyNull)
  3115. CloseRegKey $(ARP_KeyServer)
  3116. Endif
  3117. Ifstr(i) $(ARP_KeyClient) != $(KeyNull)
  3118. CloseRegKey $(ARP_KeyClient)
  3119. Endif
  3120. Ifstr(i) $(ARP_KeyRpc) != $(KeyNull)
  3121. CloseRegKey $(ARP_KeyRpc)
  3122. Endif
  3123. Return $(RegistryErrorIndex)
  3124. ;*************************************************************************
  3125. ; end of section AddRpcProtocol
  3126. ;*************************************************************************
  3127. [AddClientRpcProtocol]
  3128. Set ARP_Protocol = $($0)
  3129. Set ARP_ClientDll = $($1)
  3130. read-syms InitBaseVars
  3131. Set ARP_KeyRpc = $(KeyNull)
  3132. Set ARP_KeyRpcClient = $(KeyNull)
  3133. Set RegistryErrorIndex = UNABLE_ACCESS_SOFTWARE_REG
  3134. OpenRegKey $(!REG_H_LOCAL) "" "SOFTWARE\Microsoft\Rpc" $(MAXIMUM_ALLOWED) ARP_KeyRpc
  3135. Ifstr(i) $(ARP_KeyRpc) == $(KeyNull)
  3136. Goto ARP_Return
  3137. Endif
  3138. OpenRegKey $(ARP_KeyRpc) "" "ClientProtocols" $(MAXIMUM_ALLOWED) ARP_KeyClient
  3139. Ifstr(i) $(ARP_KeyClient) == $(KeyNull)
  3140. Goto ARP_Return
  3141. Endif
  3142. SetRegValue $(ARP_KeyClient) {$(ARP_Protocol),$(NoTitle),$(!REG_VT_SZ),$(ARP_ClientDll)}
  3143. Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  3144. Goto ARP_Return
  3145. Endif
  3146. Set RegistryErrorIndex = NO_ERROR
  3147. ARP_Return = +
  3148. Ifstr(i) $(ARP_KeyClient) != $(KeyNull)
  3149. CloseRegKey $(ARP_KeyClient)
  3150. Endif
  3151. Ifstr(i) $(ARP_KeyRpc) != $(KeyNull)
  3152. CloseRegKey $(ARP_KeyRpc)
  3153. Endif
  3154. Return $(RegistryErrorIndex)
  3155. [AddServerRpcProtocol]
  3156. Set ARP_Protocol = $($0)
  3157. Set ARP_ServerDll = $($1)
  3158. read-syms InitBaseVars
  3159. Set ARP_KeyRpc = $(KeyNull)
  3160. Set ARP_KeyRpcServer = $(KeyNull)
  3161. Set RegistryErrorIndex = UNABLE_ACCESS_SOFTWARE_REG
  3162. OpenRegKey $(!REG_H_LOCAL) "" "SOFTWARE\Microsoft\Rpc" $(MAXIMUM_ALLOWED) ARP_KeyRpc
  3163. Ifstr(i) $(ARP_KeyRpc) == $(KeyNull)
  3164. Goto ARP_Return
  3165. Endif
  3166. OpenRegKey $(ARP_KeyRpc) "" "ServerProtocols" $(MAXIMUM_ALLOWED) ARP_KeyServer
  3167. Ifstr(i) $(ARP_KeyServer) == $(KeyNull)
  3168. Goto ARP_Return
  3169. Endif
  3170. SetRegValue $(ARP_KeyServer) {$(ARP_Protocol),$(NoTitle),$(!REG_VT_SZ),$(ARP_ServerDll)}
  3171. Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  3172. Goto ARP_Return
  3173. Endif
  3174. Set RegistryErrorIndex = NO_ERROR
  3175. ARP_Return = +
  3176. Ifstr(i) $(ARP_KeyServer) != $(KeyNull)
  3177. CloseRegKey $(ARP_KeyServer)
  3178. Endif
  3179. Ifstr(i) $(ARP_KeyRpc) != $(KeyNull)
  3180. CloseRegKey $(ARP_KeyRpc)
  3181. Endif
  3182. Return $(RegistryErrorIndex)
  3183. ;*************************************************************************
  3184. ;
  3185. ; SECTION: AddMixRpcProtocol
  3186. ;
  3187. ; PURPOSE: Update the sections of the SOFTWARE\Microsoft\Rpc keys
  3188. ; to reflect the presenceof a new protocol in the system.
  3189. ; Update if and only if two services exist
  3190. ;
  3191. ; ARGUMENTS: $0 & $1 The two related services
  3192. ; $2 complete RPC protocol string; e.g., "ncacn_ip_tcp"
  3193. ; $3 name of client DLL (no path); e.g., "rpclt1.dll"
  3194. ; $4 name of server DLL (no path); e.g., "rpclt1.dll"
  3195. ;
  3196. ; RETURNS: $R0 STATUS_SUCCESSFUL if ok; error otherwise.
  3197. ;
  3198. ; REFERENCES: Nothing
  3199. ;
  3200. ; MODIFIES: Nothing
  3201. ;
  3202. ;
  3203. ;*************************************************************************
  3204. ;
  3205. ; WARNING: If you change the lists below, you will need to modify OemNsvRp.INF lists
  3206. ; also. See [UpgradeMapConstants]
  3207. ;
  3208. [UpgradeRPCMapConstants]
  3209. ; must be changed to rpclt1.dll
  3210. DLLClientList = { "rpcltc3.dll", "rpcltc6.dll", "rpcltc5.dll", "rpcltc7.dll", "rpcdgc3.dll", "rpcltccm.dll", "rpcltc1.dll" }
  3211. ; must be changed to rpclt1.dll
  3212. DLLServerList = { "rpclts3.dll", "rpclts6.dll", "rpclts5.dll", "rpclts7.dll", "rpcdgs3.dll", "rpcltscm.dll", "rpclts1.dll" }
  3213. [AddMixRpcProtocol]
  3214. set ServiceA = $($0)
  3215. set ServiceB = $($1)
  3216. Set ARP_Protocol = $($2)
  3217. Set ARP_ClientDll = $($3)
  3218. Set ARP_ServerDll = $($4)
  3219. read-syms InitBaseVars
  3220. read-syms UpgradeRPCMapConstants
  3221. OpenRegKey $(!REG_H_LOCAL) "" "System\CurrentControlSet\Services\"$(ServiceA) $(MAXIMUM_ALLOWED) KeyServiceA
  3222. OpenRegKey $(!REG_H_LOCAL) "" "System\CurrentControlSet\Services\"$(ServiceB) $(MAXIMUM_ALLOWED) KeyServiceB
  3223. ifstr(i) $(KeyServiceA) != $(KeyNull)
  3224. ifstr(i) $(KeyServiceB) != $(KeyNull)
  3225. ;
  3226. ; if the request is add a old name, change it the new version
  3227. ;
  3228. Ifcontains(i) $(ARP_ClientDll) in $(DLLClientList)
  3229. Debug-Output "UTILITY.INF: AddMixRpcProtocol tried to add old "$(ARP_ClientDll)", changed to rpclt1.dll!"
  3230. set ARP_ClientDll = "rpclt1.dll"
  3231. Endif
  3232. Ifcontains(i) $(ARP_ServerDll) in $(DLLServerList)
  3233. Debug-Output "UTILITY.INF: AddMixRpcProtocol tried to add old "$(ARP_ServerDll)", changed to rpclt1.dll!"
  3234. set ARP_ServerDll = "rpclt1.dll"
  3235. Endif
  3236. Shell "" AddRpcProtocol $(ARP_Protocol) $(ARP_ClientDll) $(ARP_ServerDll)
  3237. set ReturnCode = $($R0)
  3238. endif
  3239. endif
  3240. set ReturnCode = NO_ERROR
  3241. return_AddMixRpcProtocl = +
  3242. return $(ReturnCode)
  3243. ;*************************************************************************
  3244. ;
  3245. ; SECTION: RemoveRpcProtocol
  3246. ;
  3247. ; PURPOSE: Remove information about an installed RPC protocol.
  3248. ;
  3249. ; ARGUMENTS: $0 complete RPC protocol string (see [AddRpcProtocol]).
  3250. ;
  3251. ; RETURNS: $R0 STATUS_SUCCESSFUL if ok; error otherwise.
  3252. ;
  3253. ; REFERENCES: Nothing
  3254. ;
  3255. ; MODIFIES: Nothing
  3256. ;
  3257. ;
  3258. ;*************************************************************************
  3259. [RemoveRpcProtocol]
  3260. Set RRP_Protocol = $($0)
  3261. read-syms InitBaseVars
  3262. Set RRP_KeyRpc = $(KeyNull)
  3263. Set RRP_KeyRpcServer = $(KeyNull)
  3264. Set RRP_KeyRpcClient = $(KeyNull)
  3265. Set RegistryErrorIndex = UNABLE_ACCESS_SOFTWARE_REG
  3266. OpenRegKey $(!REG_H_LOCAL) "" "SOFTWARE\Microsoft\Rpc" $(MAXIMUM_ALLOWED) RRP_KeyRpc
  3267. Ifstr(i) $(RRP_KeyRpc) == $(KeyNull)
  3268. Goto RRP_Return
  3269. Endif
  3270. OpenRegKey $(RRP_KeyRpc) "" "ClientProtocols" $(MAXIMUM_ALLOWED) RRP_KeyClient
  3271. Ifstr(i) $(RRP_KeyClient) == $(KeyNull)
  3272. Goto RRP_Return
  3273. Endif
  3274. OpenRegKey $(RRP_KeyRpc) "" "ServerProtocols" $(MAXIMUM_ALLOWED) RRP_KeyServer
  3275. Ifstr(i) $(RRP_KeyServer) == $(KeyNull)
  3276. Goto RRP_Return
  3277. Endif
  3278. DeleteRegValue $(RRP_KeyClient) $(RRP_Protocol)
  3279. Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  3280. Goto RRP_Return
  3281. Endif
  3282. DeleteRegValue $(RRP_KeyServer) $(RRP_Protocol)
  3283. Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  3284. Goto RRP_Return
  3285. Endif
  3286. Set RegistryErrorIndex = NO_ERROR
  3287. RRP_Return = +
  3288. Ifstr(i) $(RRP_KeyServer) != $(KeyNull)
  3289. CloseRegKey $(RRP_KeyServer)
  3290. Endif
  3291. Ifstr(i) $(RRP_KeyClient) != $(KeyNull)
  3292. CloseRegKey $(RRP_KeyClient)
  3293. Endif
  3294. Ifstr(i) $(RRP_KeyRpc) != $(KeyNull)
  3295. CloseRegKey $(RRP_KeyRpc)
  3296. Endif
  3297. Return $(RegistryErrorIndex)
  3298. ;*************************************************************************
  3299. ; end of section RemoveRpcProtocl
  3300. ;*************************************************************************
  3301. [RemoveClientRpcProtocol]
  3302. Set RRP_Protocol = $($0)
  3303. read-syms InitBaseVars
  3304. Set RRP_KeyRpc = $(KeyNull)
  3305. Set RRP_KeyRpcClient = $(KeyNull)
  3306. Set RegistryErrorIndex = UNABLE_ACCESS_SOFTWARE_REG
  3307. OpenRegKey $(!REG_H_LOCAL) "" "SOFTWARE\Microsoft\Rpc" $(MAXIMUM_ALLOWED) RRP_KeyRpc
  3308. Ifstr(i) $(RRP_KeyRpc) == $(KeyNull)
  3309. Goto RRP_Return
  3310. Endif
  3311. OpenRegKey $(RRP_KeyRpc) "" "ClientProtocols" $(MAXIMUM_ALLOWED) RRP_KeyClient
  3312. Ifstr(i) $(RRP_KeyClient) == $(KeyNull)
  3313. Goto RRP_Return
  3314. Endif
  3315. DeleteRegValue $(RRP_KeyClient) $(RRP_Protocol)
  3316. Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  3317. Goto RRP_Return
  3318. Endif
  3319. Set RegistryErrorIndex = NO_ERROR
  3320. RRP_Return = +
  3321. Ifstr(i) $(RRP_KeyClient) != $(KeyNull)
  3322. CloseRegKey $(RRP_KeyClient)
  3323. Endif
  3324. Ifstr(i) $(RRP_KeyRpc) != $(KeyNull)
  3325. CloseRegKey $(RRP_KeyRpc)
  3326. Endif
  3327. Return $(RegistryErrorIndex)
  3328. [RemoveServerRpcProtocol]
  3329. Set RRP_Protocol = $($0)
  3330. read-syms InitBaseVars
  3331. Set RRP_KeyRpc = $(KeyNull)
  3332. Set RRP_KeyRpcServer = $(KeyNull)
  3333. Set RegistryErrorIndex = UNABLE_ACCESS_SOFTWARE_REG
  3334. OpenRegKey $(!REG_H_LOCAL) "" "SOFTWARE\Microsoft\Rpc" $(MAXIMUM_ALLOWED) RRP_KeyRpc
  3335. Ifstr(i) $(RRP_KeyRpc) == $(KeyNull)
  3336. Goto RRP_Return
  3337. Endif
  3338. OpenRegKey $(RRP_KeyRpc) "" "ServerProtocols" $(MAXIMUM_ALLOWED) RRP_KeyServer
  3339. Ifstr(i) $(RRP_KeyServer) == $(KeyNull)
  3340. Goto RRP_Return
  3341. Endif
  3342. DeleteRegValue $(RRP_KeyServer) $(RRP_Protocol)
  3343. Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  3344. Goto RRP_Return
  3345. Endif
  3346. Set RegistryErrorIndex = NO_ERROR
  3347. RRP_Return = +
  3348. Ifstr(i) $(RRP_KeyServer) != $(KeyNull)
  3349. CloseRegKey $(RRP_KeyServer)
  3350. Endif
  3351. Ifstr(i) $(RRP_KeyRpc) != $(KeyNull)
  3352. CloseRegKey $(RRP_KeyRpc)
  3353. Endif
  3354. Return $(RegistryErrorIndex)
  3355. ;*************************************************************************
  3356. ;
  3357. ; SECTION: GetInfFileNameFromRegistry
  3358. ;
  3359. ; PURPOSE: get the inf file name from the product' NetRules section.
  3360. ;
  3361. ; ARGUMENTS: $0 product key handle
  3362. ; (ie, system\software\Microsoft\Lance\CurrentVersion)
  3363. ;
  3364. ; RETURNS: $R0 Inf file name.
  3365. ;
  3366. ; REFERENCES: Nothing
  3367. ;
  3368. ; MODIFIES: Nothing
  3369. ;
  3370. ;
  3371. ;*************************************************************************
  3372. [GetInfFileNameFromRegistry]
  3373. read-syms InitBaseVars
  3374. set KeyProduct = $($0)
  3375. set InfName = ""
  3376. OpenRegKey $(KeyProduct) "" "NetRules" $(!REG_KEY_READ) NetRuleKey
  3377. Ifstr(i) $(NetRuleKey) != $(KeyNull)
  3378. GetRegValue $(NetRuleKey) "InfName" NetRuleInfNameList
  3379. set NetRuleInfName = *($(NetRuleInfNameList), 4)
  3380. Split-String $(NetRuleInfName), "\", FilenameList
  3381. QueryListSize ListSize $(FilenameList)
  3382. set InfName = *($(FilenameList), $(ListSize))
  3383. CloseRegKey $(NetRuleKey)
  3384. endif
  3385. return $(InfName)
  3386. ;*************************************************************************
  3387. ;
  3388. ; SECTION: ToggleBinding
  3389. ;
  3390. ; PURPOSE: Take the named binding from the list of "Disabled"
  3391. ; bindings and merge it with the active bindings.
  3392. ;
  3393. ; ARGUMENTS: $0 name of service
  3394. ; $1 number of binding
  3395. ; $2 "activate" or "disable"
  3396. ;
  3397. ; RETURNS: $R0 NO_ERROR if OK; RegistryError if not.
  3398. ;
  3399. ; REFERENCES: None
  3400. ;
  3401. ; MODIFIES: None
  3402. ;
  3403. ; NOTES: This routine takes either the given inactive binding
  3404. ; and activates it or the given active binding and
  3405. ; deactivates it.
  3406. ;
  3407. ;
  3408. ;*************************************************************************
  3409. [ToggleBinding]
  3410. Set SvcName = $($0)
  3411. Set BindNumber = $($1)
  3412. Set Action = $($2)
  3413. Set Status = UNABLE_ACCESS_CONFIGURE_SERVICE
  3414. Set KeySvc = ""
  3415. Set KeyFrom = ""
  3416. Set KeyTo = ""
  3417. read-syms InitBaseVars
  3418. OpenRegKey $(!REG_H_LOCAL) "" $(ServicesBaseName)"\"$(SvcName) $(MAXIMUM_ALLOWED) KeySvc
  3419. Ifstr(i) $(KeySvc) == $(KeyNull)
  3420. Debug-Output "UTILITY.INF: ToggleBinding: service key open FAILED"
  3421. Goto TB_Return
  3422. Endif
  3423. Ifstr(i) $(Action) == activate
  3424. Set FromKeyName = "Linkage\Disabled"
  3425. Set ToKeyName = "Linkage"
  3426. Else
  3427. Set FromKeyName = "Linkage"
  3428. Set ToKeyName = "Linkage\Disabled"
  3429. Endif
  3430. ; Open the Linkage and Linkage\Disabled subkeys
  3431. OpenRegKey $(KeySvc) "" $(FromKeyName) $(MAXIMUM_ALLOWED) KeyFrom
  3432. Ifstr(i) $(KeyFrom) == $(KeyNull)
  3433. Debug-Output "UTILITY.INF: ToggleBinding: from linkage key open FAILED"
  3434. Goto TB_Return
  3435. Endif
  3436. OpenRegKey $(KeySvc) "" $(ToKeyName) $(MAXIMUM_ALLOWED) KeyTo
  3437. Ifstr(i) $(KeyTo) == $(KeyNull)
  3438. Debug-Output "UTILITY.INF: ToggleBinding: to linkage key open FAILED"
  3439. Goto TB_Return
  3440. Endif
  3441. ; Fetch all their values, allowing for complete absence.
  3442. ; First, from the "From" key
  3443. Set FromBindList = {}
  3444. Set FromExportList = {}
  3445. Set FromRouteList = {}
  3446. Set ToBindList = {}
  3447. Set ToExportList = {}
  3448. Set ToRouteList = {}
  3449. Set ErrorTotal = 0
  3450. Debug-Output "UTILITY.INF: ToggleBinding; fetch all linkage values"
  3451. GetRegValue $(KeyFrom),"Bind",TempValue
  3452. Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
  3453. Set FromBindList = *($(TempValue),4)
  3454. Set-add ErrorTotal = $(ErrorTotal),1
  3455. Endif
  3456. GetRegValue $(KeyFrom),"Export",TempValue
  3457. Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
  3458. Set FromExportList = *($(TempValue),4)
  3459. Set-add ErrorTotal = $(ErrorTotal),1
  3460. Endif
  3461. GetRegValue $(KeyFrom),"Route",TempValue
  3462. Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
  3463. Set FromRouteList = *($(TempValue),4)
  3464. Set-add ErrorTotal = $(ErrorTotal),1
  3465. Endif
  3466. ; Next, from the "To" key
  3467. GetRegValue $(KeyTo),"Bind",TempValue
  3468. Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
  3469. Set ToBindList = *($(TempValue),4)
  3470. Set-add ErrorTotal = $(ErrorTotal),1
  3471. Endif
  3472. GetRegValue $(KeyTo),"Export",TempValue
  3473. Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
  3474. Set ToExportList = *($(TempValue),4)
  3475. Set-add ErrorTotal = $(ErrorTotal),1
  3476. Endif
  3477. GetRegValue $(KeyTo),"Route",TempValue
  3478. Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
  3479. Set ToRouteList = *($(TempValue),4)
  3480. Set-add ErrorTotal = $(ErrorTotal),1
  3481. Endif
  3482. ; We have all the data. Do some sanity checking.
  3483. ; Are the lists the same size?
  3484. Ifint $(ErrorTotal) != 6
  3485. Debug-Output "UTILITY.INF: ToggleBinding; Bind list retreival error, "$(ErrorTotal)
  3486. Endif
  3487. Debug-Output "UTILITY.INF: ToggleBinding; sanity check results"
  3488. QueryListSize sz1 $(FromBindList)
  3489. QueryListSize sz2 $(FromExportList)
  3490. QueryListSize sz3 $(FromRouteList)
  3491. Ifint $(sz1) != $(sz2)
  3492. Goto TB_Return
  3493. Endif
  3494. Ifint $(sz1) != $(sz3)
  3495. Goto TB_Return
  3496. Endif
  3497. QueryListSize sz2 $(ToBindList)
  3498. QueryListSize sz3 $(ToExportList)
  3499. QueryListSize sz4 $(ToRouteList)
  3500. Ifint $(sz2) != $(sz3)
  3501. Goto TB_Return
  3502. Endif
  3503. Ifint $(sz2) != $(sz4)
  3504. Goto TB_Return
  3505. Endif
  3506. ; Does the requested element exist?
  3507. Debug-Output "UTILITY.INF: ToggleBinding; prepare to move binding"
  3508. Ifint $(BindNumber) > $(sz1)
  3509. Debug-Output "UTILITY.INF: ToggleBinding; binding to move was invalid"
  3510. Set Status = INVALID_DATA_PASSED
  3511. Endif
  3512. ; We're ready. Move the data around.
  3513. ; Extract the element from the "From" lists, append it
  3514. ; to the "To" lists...
  3515. Set FromBindItem = *($(FromBindList),$(BindNumber))
  3516. Set FromRouteItem = *($(FromRouteList),$(BindNumber))
  3517. Set FromExportItem = *($(FromExportList),$(BindNumber))
  3518. Set ToBindList = >($(ToBindList),$(FromBindItem))
  3519. Set ToRouteList = >($(ToRouteList),$(FromRouteItem))
  3520. Set ToExportList = >($(ToExportList),$(FromExportItem))
  3521. ; Regenerate the "From" lists by iteration.
  3522. Set NewBind = {}
  3523. Set NewExport = {}
  3524. Set NewRoute = {}
  3525. Set Index = 0
  3526. ForListDo $(FromBindList)
  3527. Set-add Index = $(Index),1
  3528. Ifint $(Index) != $(BindNumber)
  3529. Set NewBind = >($(NewBind),$($))
  3530. Set NewExport = >($(NewExport),*($(FromExportList),$(Index)))
  3531. Set NewRoute = >($(NewRoute),*($(FromRouteList),$(Index)))
  3532. Endif
  3533. EndForListDo
  3534. ; Replace the old values
  3535. Set FromBindList = $(NewBind)
  3536. Set FromExportList = $(NewExport)
  3537. Set FromRouteList = $(NewRoute)
  3538. ; Update the registry.
  3539. Set ErrorTotal = 0
  3540. SetRegValue $(KeyFrom) {Bind,$(NoTitle),$(!REG_VT_MULTI_SZ),$(FromBindList)}
  3541. Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  3542. Set-add ErrorTotal = $(ErrorTotal),1
  3543. Endif
  3544. SetRegValue $(KeyFrom) {Export,$(NoTitle),$(!REG_VT_MULTI_SZ),$(FromExportList)}
  3545. Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  3546. Set-add ErrorTotal = $(ErrorTotal),1
  3547. Endif
  3548. SetRegValue $(KeyFrom) {Route,$(NoTitle),$(!REG_VT_MULTI_SZ),$(FromRouteList)}
  3549. Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  3550. Set-add ErrorTotal = $(ErrorTotal),1
  3551. Endif
  3552. SetRegValue $(KeyTo) {Bind,$(NoTitle),$(!REG_VT_MULTI_SZ),$(ToBindList)}
  3553. Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  3554. Set-add ErrorTotal = $(ErrorTotal),1
  3555. Endif
  3556. SetRegValue $(KeyTo) {Export,$(NoTitle),$(!REG_VT_MULTI_SZ),$(ToExportList)}
  3557. Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  3558. Set-add ErrorTotal = $(ErrorTotal),1
  3559. Endif
  3560. SetRegValue $(KeyTo) {Route,$(NoTitle),$(!REG_VT_MULTI_SZ),$(ToRouteList)}
  3561. Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  3562. Set-add ErrorTotal = $(ErrorTotal),1
  3563. Endif
  3564. Debug-Output "UTILITY.INF: ToggleBinding; Registry update error total = "$(ErrorTotal)
  3565. Ifint $(ErrorTotal) != 0
  3566. Set Status = UNABLE_WRITE_REGISTRY
  3567. Else
  3568. Set Status = NO_ERROR
  3569. Endif
  3570. TB_Return = +
  3571. Ifstr(i) $(KeyFrom) != $(KeyNull)
  3572. CloseRegKey $(KeyFrom)
  3573. Endif
  3574. Ifstr(i) $(KeyTo) != $(KeyNull)
  3575. CloseRegKey $(KeyTo)
  3576. Endif
  3577. Ifstr(i) $(KeySvc) != $(KeyNull)
  3578. CloseRegKey $(KeySvc)
  3579. Endif
  3580. Return $(Status)
  3581. ;*************************************************************************
  3582. ; end of section ToggleBinding
  3583. ;*************************************************************************
  3584. ;-------------------------------------------------------------------------
  3585. ;
  3586. ; ROUTINE: SortListIndex
  3587. ;
  3588. ; DESCRIPTION: Sort a list into sequence, returning an "index" list, which
  3589. ; indicates the sort position of each of the original list
  3590. ; elements.
  3591. ;
  3592. ; INPUTS: $0: List to be sorted
  3593. ; $1: TRUE for ascending sort (FALSE otherwise)
  3594. ; $2: TRUE for case-insensitive sort (FALSE otherwise)
  3595. ;
  3596. ; OUTPUTS: $R0: Index list
  3597. ;
  3598. ; NOTES: Lists of displayable numeric values will automatically
  3599. ; be sorted numerically if they are all decimal or hex
  3600. ; and the sort is case-insensitive (param $2 FALSE).
  3601. ;
  3602. ;----------------------------------------------------------------------------
  3603. [SortListIndex]
  3604. Set List = $($0)
  3605. Set BoolAscend = $($1)
  3606. Set BoolCaseSens = $($2)
  3607. LibraryProcedure IndexList, $(!LIBHANDLE), GenerateSortedIndexList, $(List), $(BoolAscend), $(BoolCaseSens)
  3608. Return $(IndexList)
  3609. ;-------------------------------------------------------------------------
  3610. ;
  3611. ; ROUTINE: SortByIndex
  3612. ;
  3613. ; DESCRIPTION: Sort a list into the sequence given by an "index list".
  3614. ;
  3615. ; INPUTS: $0: List to be sorted
  3616. ; $1: Index list
  3617. ;
  3618. ; OUTPUTS: $R0: Index list
  3619. ;
  3620. ;----------------------------------------------------------------------------
  3621. [SortByIndex]
  3622. Set List = $($0)
  3623. Set IndexList = $($1)
  3624. Set NewList = {}
  3625. ForListDo $(IndexList)
  3626. Set Index = $($)
  3627. Set Item = *($(List),$(Index))
  3628. Set NewList = >($(NewList),$(Item))
  3629. EndForListDo
  3630. Return $(NewList)
  3631. ;-------------------------------------------------------------------------
  3632. ;
  3633. ; ROUTINE: SortList
  3634. ;
  3635. ; DESCRIPTION: Sort a list into sequence, returning a sorted list.
  3636. ;
  3637. ; INPUTS: $0: List to be sorted
  3638. ; $1: TRUE for ascending sort (FALSE otherwise)
  3639. ; $2: TRUE for case-sensitive sort (FALSE for case-ins)
  3640. ;
  3641. ; OUTPUTS: $R0: Sorted list
  3642. ;
  3643. ; NOTES: Lists of displayable numeric values will automatically
  3644. ; be sorted numerically if they are all decimal or hex
  3645. ; and the sort is case-insensitive (param $2 FALSE).
  3646. ;
  3647. ;----------------------------------------------------------------------------
  3648. [SortList]
  3649. Set List = $($0)
  3650. Shell "" SortListIndex $(List) $($1) $($2)
  3651. Set IndexList = $($R0)
  3652. Shell "" SortByIndex $(List) $(IndexList)
  3653. Set ResultList = $($R0)
  3654. return $(ResultList)
  3655. ;*************************************************************************
  3656. ; end of file UTILITY.INF
  3657. ;*************************************************************************
  3658. ;*************************************************************************
  3659. ;
  3660. ; SECTION: UpdateDetectionDllNames
  3661. ;
  3662. ; PURPOSE: Search for files of the name ???NCDET.DLL.
  3663. ; Update the Registry accordingly.
  3664. ;
  3665. ;
  3666. ; ARGUMENTS: None
  3667. ;
  3668. ; RETURNS: $R0 STATUS_SUCCESSFUL if Registry updated
  3669. ; STATUS_USERCANCEL if no update was required
  3670. ; STATUS_FAILED if failed
  3671. ;
  3672. ; NOTES: This routine searches for all DLLs named ???NCDET.DLL
  3673. ; and adds them to a list containing the name of the
  3674. ; "standard" detection DLL, MSNCDET.DLL.
  3675. ;
  3676. ; Netcard detection is stopped and restarted if the
  3677. ; Registry is updated.
  3678. ;
  3679. ; REFERENCES:
  3680. ;
  3681. ; MODIFIES:
  3682. ;
  3683. ;*************************************************************************
  3684. [DetectionDllFiles]
  3685. DetectionDllsFound = {} ? $(!LIBHANDLE) FindFileInstances $(!STF_WINDOWSSYSPATH)"\???ncdet.dll"
  3686. [UpdateDetectionDllNames]
  3687. Set Status = STATUS_FAILED
  3688. read-syms InitBaseVars
  3689. Detect DetectionDllFiles
  3690. Set DllValueName = "NetcardDlls"
  3691. OpenRegKey $(!REG_H_LOCAL) "" "System\Setup" $(MAXIMUM_ALLOWED) KeySetup
  3692. Ifstr(i) $(KeySetup) == $(KeyNull)
  3693. Debug-Output "UTILITY.INF: [UpdateDetectionDllNames] cant open System\Setup key"
  3694. Goto UDDN_Return
  3695. Endif
  3696. ; Prefix the list with MSNCDET.DLL
  3697. Set NewDllList = {"MSNCDET.DLL"}
  3698. ForListDo $(DetectionDllsFound)
  3699. Set NewDllList = >($(NewDllList),$($))
  3700. EndForListDo
  3701. ; Get the old list
  3702. Set UpdateRequired = 1
  3703. GetRegValue $(KeySetup) $(DllValueName) DllNamesValue
  3704. Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
  3705. Set DllNames = *($(DllNamesValue),4)
  3706. Debug-Output "UTILITY.INF: [UpdateDetectionDllNames] DllNames = "$(DllNames)
  3707. Set UpdateRequired = 0
  3708. ; See if all the names are already present
  3709. ForListDo $(NewDllList)
  3710. Set DllIndex = ~($(DllNames),$($))
  3711. Ifint $(DllIndex) == 0
  3712. Set UpdateRequired = 1
  3713. Endif
  3714. EndForListDo
  3715. Endif
  3716. Set Status = STATUS_SUCCESSFUL
  3717. Ifint $(UpdateRequired) == 1
  3718. Debug-Output "UTILITY.INF: [UpdateDetectionDllNames] new DLL names = "$(NewDllList)
  3719. Set ValueInfo = {$(DllValueName), $(NoTitle), $(!REG_VT_MULTI_SZ), $(NewDllList)}
  3720. SetRegValue $(KeySetup) $(ValueInfo)
  3721. Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  3722. Set Status = STATUS_FAILED
  3723. Else
  3724. Shell "NCPARAM.INF" Param_ControlDetection DTEND
  3725. Shell "NCPARAM.INF" Param_ControlDetection DTSTART
  3726. Endif
  3727. Else
  3728. Set Status = STATUS_USERCANCEL
  3729. Endif
  3730. CloseRegKey $(KeySetup)
  3731. UDDN_Return = +
  3732. Return $(Status)
  3733. ;*************************************************************************
  3734. ; end of section UpdateDetectionDllNames
  3735. ;*************************************************************************
  3736. ;*************************************************************************
  3737. ;
  3738. ; SECTION: CheckIfCopyNecessary
  3739. ;
  3740. ; PURPOSE: Check a set of files and see if all are present. Used
  3741. ; to offer the user a "current files" versus "new files"
  3742. ; choice.
  3743. ;
  3744. ; ARGUMENTS: $0 list of path names corresponding to names
  3745. ; given in next parameter
  3746. ; $1 nested list of file names; see NOTES below
  3747. ;
  3748. ; RETURNS: $R0 STATUS_SUCCESSFUL or
  3749. ; STATUS_FAILED
  3750. ;
  3751. ; REFERENCES: nothing
  3752. ;
  3753. ; MODIFIES: nothing
  3754. ;
  3755. ; NOTES: Typical values (taken from OEMNSVWK.INF) might be:
  3756. ;
  3757. ; $0: {$(!STF_WINDOWSSYSPATH),$(!STF_WINDOWSSYSPATH)\drivers}
  3758. ; $1: {{"BOWSVC.DLL","WKSSVC.DLL","LMREPL.EXE"},+
  3759. ; {"SMBTRSUP.SYS","BROWSER.SYS","RDR.SYS"}}
  3760. ;
  3761. ;
  3762. ;*************************************************************************
  3763. [CheckIfCopyNecessary]
  3764. Set Status = STATUS_SUCCESSFUL
  3765. Set PathList = $($0)
  3766. Set NamesList = $($1)
  3767. Set Index = 0
  3768. Set Found = 1
  3769. ForListDo $(PathList)
  3770. Set ThisPath = $($)
  3771. Set-add Index = Index,1
  3772. Set NameList = *($(NamesList),$(Index))
  3773. ForListDo $(NameList)
  3774. Set FileToCheck = $(ThisPath)\$($)
  3775. LibraryProcedure FilePresent,$(!LIBHANDLE), CheckFileExistance $(FileToCheck)
  3776. Ifstr(i) $(FilePresent) != "YES"
  3777. Set Found = 0
  3778. Endif
  3779. EndForListDo
  3780. EndForListDo
  3781. Ifint $(Found) != 1
  3782. Set Status = STATUS_FAILED
  3783. Endif
  3784. Return $(Status)
  3785. ;*************************************************************************
  3786. ; end of section CheckIfCopyNecessary
  3787. ;*************************************************************************
  3788. ;*************************************************************************
  3789. ;
  3790. ; SECTION: GetBusTypeDialog
  3791. ;
  3792. ; PURPOSE: Call the GetBusDialog function in ncpa.cpl and
  3793. ; get the location of the network card.
  3794. ;
  3795. ; ARGUMENTS: $0 Card name description
  3796. ; $1 Default bus type
  3797. ; $2 Default bus number
  3798. ;
  3799. ; RETURNS: $R0 NO_ERROR
  3800. ; $R1 BusType
  3801. ; $R2 BusNumber
  3802. ; $R3 DlgReturn - "OK" | "CANCEL" if $R0 is NO_ERROR otherwise ""
  3803. ;
  3804. ; REFERENCES: nothing
  3805. ;
  3806. ; MODIFIES: nothing
  3807. ;
  3808. ;*************************************************************************
  3809. [GetBusTypeDialog]
  3810. set CardName = $($0)
  3811. set BusInterfaceType = $($1)
  3812. set BusNumber = $($2)
  3813. set DlgReturn = ""
  3814. ifstr(i) $(BusInterfaceType) == ""
  3815. set BusInterfaceType = 1 ; ISA
  3816. endif
  3817. ifstr(i) $(BusNumber) == ""
  3818. set BusNumber = 0 ; Bus 0
  3819. endif
  3820. set FLibraryErrCtl = 1
  3821. LibraryProcedure BusInfo $(!NCPA_HANDLE), GetBusTypeDialog, $(!STF_HWND), $(CardName), $(BusInterfaceType), $(BusNumber)
  3822. set FLibraryErrCtl = 0
  3823. ; return values
  3824. ifint *($(BusInfo),1) == 0
  3825. set ReturnValue = NO_ERROR
  3826. set BusInterfaceType = *($(BusInfo),2)
  3827. set BusNumber = *($(BusInfo),3)
  3828. set DlgReturn = *($(BusInfo),4)
  3829. else
  3830. set ReturnValue = ERROR
  3831. endif
  3832. Return $(ReturnValue), $(BusInterfaceType), $(BusNumber), $(DlgReturn)
  3833. ;*************************************************************************
  3834. ; end of section GetBusTypeDialog
  3835. ;*************************************************************************
  3836. ;*************************************************************************
  3837. ;
  3838. ; SECTION: SetMasterComponent
  3839. ;
  3840. ; PURPOSE: This function is used by components which wish
  3841. ; to be automatically removed when another component is
  3842. ; remove by the user. It will either add (default)
  3843. ; the given component as a dependent or remove it.
  3844. ;
  3845. ; ARGUMENTS: $0: Vendor name of master component
  3846. ; $1: Product name of master component
  3847. ; $2: INF file name of dependent (caller) component
  3848. ; $3: INF option of dependent (caller) component
  3849. ; $4: "ADD" or "" if adding or "REMOVE" if removing
  3850. ;
  3851. ; RETURNS: $R0: STATUS_SUCCESSFUL if ok, or
  3852. ; STATUS_FAILED if failure
  3853. ;
  3854. ; $R1: Registry error code string if failure;
  3855. ; CANNOT_FIND_COMPONENT_SERVICE, etc.
  3856. ;
  3857. ; NOTES: This function and its companion, RemoveDependentComponents,
  3858. ; update and reference values under
  3859. ; <Vendor>\<Product>\CurrentVersion:
  3860. ;
  3861. ; DependentInfNames REG_MULTI_SZ
  3862. ; DependentInfOptions REG_MULTI_SZ
  3863. ;
  3864. ;*************************************************************************
  3865. [SetMasterComponent]
  3866. Read-syms InitBaseVars
  3867. Set Vendor = $($0)
  3868. Set Product = $($1)
  3869. Set InfName = $($2)
  3870. Set InfOption = $($3)
  3871. Set Adding = 1
  3872. Ifstr(i) $($4) == REMOVE
  3873. Set Adding = 0
  3874. Endif
  3875. Set Status = STATUS_FAILED
  3876. Set Error = ""
  3877. Set InfNamesList = {}
  3878. Set InfOptionsList = {}
  3879. Set InfIndex = 0
  3880. Set NameListSize = 0
  3881. Set OptionListSize = 0
  3882. Set UpdateRequired = 0
  3883. Set MasterKey = ""
  3884. OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_SoftwareBase)"\"$(Vendor)"\"$(Product)"\CurrentVersion" +
  3885. $(MAXIMUM_ALLOWED) MasterKey
  3886. Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  3887. Set Error = CANNOT_FIND_COMPONENT_SERVICE
  3888. Debug-Output "UTILITY.INF: Cant open master component key: "$(Product)
  3889. Goto SMC_Return
  3890. Endif
  3891. GetRegValue $(MasterKey) DependentInfNames InfNamesValue
  3892. Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
  3893. Set InfNamesList = *($(InfNamesValue),4)
  3894. Set InfIndex = ~($(InfNamesList),$(InfName))
  3895. QueryListSize NameListSize $(InfNamesList)
  3896. Endif
  3897. GetRegValue $(MasterKey) DependentInfOptions InfOptionsValue
  3898. Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
  3899. Set InfOptionsList = *($(InfOptionsValue),4)
  3900. QueryListSize OptionListSize $(InfOptionsList)
  3901. Endif
  3902. ;
  3903. ; Check that the two lists are in sync. Bag out if not.
  3904. ;
  3905. Ifint $(NameListSize) != $(OptionListSize)
  3906. Set Error = UNABLE_INSTALL
  3907. Debug-Output "UTILITY.INF: Dependent INF list degenerate: "$(Product)
  3908. Goto SMC_Return
  3909. Endif
  3910. ;
  3911. ; If Adding and the INF name is not already present, add it;
  3912. ; else if present, remove the names.
  3913. ;
  3914. Ifint $(Adding) == 1
  3915. Ifint $(InfIndex) == 0
  3916. Set UpdateRequired = 1
  3917. Set InfNamesList = >($(InfNamesList),$(InfName))
  3918. Set InfOptionsList = >($(InfOptionsList),$(InfOption))
  3919. Endif
  3920. Else
  3921. Ifint $(InfIndex) != 0
  3922. Set UpdateRequired = 1
  3923. Set TlistNames = {}
  3924. Set TlistOptions = {}
  3925. Set Tindex = 0
  3926. ForListDo $(InfNamesList)
  3927. Set-add Tindex = $(Tindex), 1
  3928. Ifstr(i) $($) != $(InfName)
  3929. Set TlistNames = >($(TlistNames),$($))
  3930. Set TlistOptions = >($(TlistOptions),*($(InfOptionsList),$(Tindex)))
  3931. Endif
  3932. EndForListDo
  3933. Set InfNamesList = TlistNames
  3934. Set InfOptionsList = TlistOptions
  3935. Endif
  3936. Endif
  3937. Set Status = STATUS_SUCCESSFUL
  3938. Ifint $(UpdateRequired) == 0
  3939. Goto SMC_Return
  3940. Endif
  3941. SetRegValue $(MasterKey) {DependentInfNames,$(NoTitle),$(!REG_VT_MULTI_SZ),$(InfNamesList)}
  3942. Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  3943. Debug-Output "UTILITY.INF: master component value update failed (1)"
  3944. Set Status = UNABLE_WRITE_REGISTRY
  3945. Endif
  3946. SetRegValue $(MasterKey) {DependentInfOptions,$(NoTitle),$(!REG_VT_MULTI_SZ),$(InfOptionsList)}
  3947. Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  3948. Debug-Output "UTILITY.INF: master component value update failed (2)"
  3949. Set Status = UNABLE_WRITE_REGISTRY
  3950. Endif
  3951. SMC_Return =+
  3952. Ifstr(i) $(MasterKey) != $(KeyNull)
  3953. CloseRegKey $(MasterKey)
  3954. Endif
  3955. Return $(Status) $(Error)
  3956. ;*************************************************************************
  3957. ; end of section SetMasterComponent
  3958. ;*************************************************************************
  3959. ;*************************************************************************
  3960. ;
  3961. ; SECTION: RemoveDependentComponents
  3962. ;
  3963. ; PURPOSE: Remove components which are entirely dependent upon
  3964. ; the named master component
  3965. ;
  3966. ; ARGUMENTS: $0: Vendor name of master component
  3967. ; $1: Product name of master component
  3968. ;
  3969. ; RETURNS: $R0: STATUS_SUCCESSFUL if ok, or
  3970. ; STATUS_FAILED if failure
  3971. ;
  3972. ; $R1: Registry error code string if failure;
  3973. ; CANNOT_FIND_COMPONENT_SERVICE, etc.
  3974. ;
  3975. ; MODIFIES: Nothing
  3976. ;
  3977. ;*************************************************************************
  3978. [RemoveDependentComponents]
  3979. Read-syms InitBaseVars
  3980. Set Vendor = $($0)
  3981. Set Product = $($1)
  3982. Set Status = STATUS_FAILED
  3983. Set Error = ""
  3984. Set InfNamesList = {}
  3985. Set InfOptionsList = {}
  3986. Set InfIndex = 0
  3987. Set NameListSize = 0
  3988. Set OptionListSize = 0
  3989. Set UpdateRequired = 0
  3990. Set MasterKey = ""
  3991. OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_SoftwareBase)"\"$(Vendor)"\"$(Product)"\CurrentVersion" +
  3992. $(MAXIMUM_ALLOWED) MasterKey
  3993. Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  3994. Debug-Output "UTILITY.INF: Cant open master component key: "$(Product)
  3995. Set Error = CANNOT_FIND_COMPONENT_SERVICE
  3996. Goto RDC_Return
  3997. Endif
  3998. GetRegValue $(MasterKey) DependentInfNames InfNamesValue
  3999. Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
  4000. Set InfNamesList = *($(InfNamesValue),4)
  4001. Set InfIndex = ~($(InfNamesList),$(InfName))
  4002. QueryListSize NameListSize $(InfNamesList)
  4003. Endif
  4004. GetRegValue $(MasterKey) DependentInfOptions InfOptionsValue
  4005. Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
  4006. Set InfOptionsList = *($(InfOptionsValue),4)
  4007. QueryListSize OptionListSize $(InfOptionsList)
  4008. Endif
  4009. ;
  4010. ; Check that the two lists are in sync. Bag out if not.
  4011. ;
  4012. Ifint $(NameListSize) != $(OptionListSize)
  4013. Set Error = UNABLE_INSTALL
  4014. Debug-Output "UTILITY.INF: Dependent INF list degenerate: "$(Product)
  4015. Goto RDC_Return
  4016. Endif
  4017. ;
  4018. ; If the list is empty, bag out.
  4019. ;
  4020. Ifint $(NameListSize) == 0
  4021. Set Status = STATUS_SUCCESSFUL
  4022. Goto RDC_Return
  4023. Endif
  4024. ;
  4025. ; "push" the current global variable values
  4026. ;
  4027. Set OldOption = $(!NTN_InfOption)
  4028. Set OldMode = $(!NTN_InstallMode)
  4029. Set OldInf = $(!NTN_Infname)
  4030. Set !NTN_InstallMode = deinstall
  4031. ;
  4032. ; Iterate the list, removing each INF and option pair.
  4033. ;
  4034. Set Tindex = 0
  4035. ForListDo $(InfNamesList)
  4036. Set-add Tindex = $(Tindex), 1
  4037. Set !NTN_InfOption = *($(InfOptionsList),$(Tindex))
  4038. Set !NTN_Infname = $($)
  4039. Debug-Output "UTILITY.INF: Removing "$(Product)" dependent: "$(InfName)":"$(InfOption)
  4040. Shell $(!NTN_Infname) InstallOption $(!STF_LANGUAGE) $(!NTN_InfOption) $(!STF_SRCDIR) +
  4041. $(!NtLmAddCopy) $(!NtLmDoCopy) $(!NtLmDoConfig)
  4042. EndForListDo
  4043. ;
  4044. ; "pop" the saved global variable values
  4045. ;
  4046. Set !NTN_InfOption = $(OldOption)
  4047. Set !NTN_InstallMode = $(OldMode)
  4048. Set !NTN_Infname = $(OldInf)
  4049. Set Status = STATUS_SUCCESSFUL
  4050. RDC_Return =+
  4051. Ifstr(i) $(MasterKey) != $(KeyNull)
  4052. CloseRegKey $(MasterKey)
  4053. Endif
  4054. return $(Status) $(Error)
  4055. ;*************************************************************************
  4056. ; end of RemoveDependentComponents
  4057. ;*************************************************************************
  4058. ;*************************************************************************
  4059. ;
  4060. ; SECTION: AddDefaultNetCardParameters
  4061. ;
  4062. ; PURPOSE: Add default parameter to the system
  4063. ;
  4064. ; ARGUMENTS: $0: Service\netcard\parameter key
  4065. ;
  4066. ; MODIFIES: Nothing
  4067. ;
  4068. ;*************************************************************************
  4069. [AddDefaultNetCardParameters]
  4070. set KeyParameter = $($0)
  4071. ForListDo $(!NetCardParameterName)
  4072. set Name = $($)
  4073. set Value = *($(!NetCardParameterValue), $(#))
  4074. ifstr(i) $(Name) == "NetworkAddress"
  4075. set Type = $(!REG_VT_SZ)
  4076. else
  4077. set Type = $(!REG_VT_DWORD)
  4078. endif
  4079. Debug-Output "Name = "$(Name)
  4080. Debug-Output "Value = "$(Value)
  4081. SetRegValue $(KeyParameter) {$(Name),$(NoTitle),$(Type),$(Value)}
  4082. EndForListDo
  4083. return
  4084. ;*************************************************************************
  4085. ;
  4086. ; SECTION: FindNextNetworkCard
  4087. ;
  4088. ; PURPOSE: Find the next network card registry entry
  4089. ;
  4090. ; ARGUMENTS: $0: Network Card ID
  4091. ; $1: Starting Index, 1 to start at top
  4092. ;
  4093. ;
  4094. ; RETURNS: $R0: RegKeyHandle to Netcard location
  4095. ; $R1: Next Index, pass back in to continue search
  4096. ;
  4097. ; MODIFIES: Nothing
  4098. ;
  4099. ;*************************************************************************
  4100. [FindNextNetworkCard]
  4101. read-syms InitBaseVars
  4102. set NetcardName = $($0)
  4103. set iSearch = $($1)
  4104. set KeyNetcard = ""
  4105. Debug-Output "Utility.Inf: FindNextNetworkCard "$(NetcardName)", "$(iSearch)
  4106. checknextnetcard = +
  4107. set KeyName = $(NetworkCardKeyName)"\"$(iSearch)
  4108. Debug-Output "Utility.Inf: FindNextNetworkCard, checking "$(KeyName)
  4109. OpenRegKey $(!REG_H_LOCAL) "" $(KeyName) $(MAXIMUM_ALLOWED) KeyNetcard
  4110. set-add iSearch = $(iSearch), 1
  4111. Ifstr $(KeyNetcard) != $(KeyNull)
  4112. GetRegValue $(KeyNetcard) "ProductName" ValueList
  4113. ifstr(i) $(NetcardName) != *($(ValueList),4)
  4114. CloseRegKey $(KeyNetcard)
  4115. Debug-Output "Utility.Inf: FindNextNetworkCard, its not "*($(ValueList),4)" at "$(iSearch)
  4116. goto checknextnetcard
  4117. endif
  4118. Debug-Output "Utility.Inf: FindNextNetworkCard, Found "*($(ValueList),4)" at "$(iSearch)
  4119. else
  4120. Debug-Output "Utility.Inf: FindNextNetworkCard, Last One "$(iSearch)
  4121. endif
  4122. Debug-Output "Utility.Inf: FindNextNetworkCard returning "$(KeyNetcard)","$(iSearch)
  4123. return $(KeyNetcard) $(iSearch)