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.

833 lines
24 KiB

  1. ;***********************************************************************
  2. ;
  3. ; OEMNSVSA.INF
  4. ;
  5. ; NW SAP Agent
  6. ;
  7. ; History:
  8. ; terryk 10-10-1993 Created
  9. ;***********************************************************************
  10. ;-----------------------------------------------------------------------
  11. ; OPTION TYPE
  12. ; -----------
  13. ; This identifies the Option type we are dealing with. The different
  14. ; possible types are:
  15. ;
  16. ; COMPUTER, DISPLAY, MOUSE, KEYBOARD, LAYOUT, SCSI, PRINTER, ...
  17. ;
  18. ; Types specific to networking:
  19. ;
  20. ; NetAdapter, a netcard / adapter combination or just a netcard
  21. ; NetDriver, just a netcard driver
  22. ; NetTransport, a complete NDIS-compliant TDI transport stack
  23. ; NetService, an NT networking service
  24. ; NetWork, a complete network ensemble.
  25. ; NetProvider a complete network which supports NT MPR protocol
  26. ;-----------------------------------------------------------------------
  27. [Identification]
  28. OptionType = NetService
  29. ;-----------------------------------------------------------------------
  30. ; OPTION LIST
  31. ; -----------
  32. ; This section lists the OEM Option key names. These keys are locale
  33. ; independent and used to represent the option in a locale independent
  34. ; manner.
  35. ;
  36. ;-----------------------------------------------------------------------
  37. [Options]
  38. SAP
  39. ;***********************************************************************
  40. ; CONSTANTS FOR USING DIALOGS
  41. ;***********************************************************************
  42. [FileConstants]
  43. ;
  44. ; Product Info
  45. ;
  46. Manufacturer = "Microsoft"
  47. ProductMajorVersion = "4"
  48. ProductMinorVersion = "0"
  49. SoftwareType = "service"
  50. ProductVersion = $(ProductMajorVersion)"."$(ProductMinorVersion)
  51. ProductOpSupport = 132 ; 0x0084 ; Display,Removable,NOT Properties,Not Updatable
  52. ;================================================================
  53. ; Service Information
  54. ;
  55. ;================================================================
  56. ;
  57. ProductSAPName = "NwSapAgent"
  58. ProductSAPImagePath = "%SystemRoot%\system32\services.exe"
  59. ;
  60. ; Registry Key Names
  61. ;
  62. ProductKeyName = $(!NTN_SoftwareBase)"\"$(Manufacturer)"\NwSapAgent\CurrentVersion"
  63. [GeneralConstants]
  64. ;
  65. ; File names, etc.
  66. ;
  67. UtilityInf = "UTILITY.INF"
  68. subroutineinf = "SUBROUTN.INF"
  69. Exit_Code = 0
  70. ;ShellCode = 0
  71. BillboardVisible = 0
  72. ;
  73. ; Program flow control variables.
  74. ;
  75. from = ""
  76. to = ""
  77. ;
  78. ; Return codes; Exit_Code is set to one of these
  79. ;
  80. ExitCodeOk = 0
  81. ExitCodeCancel = 1
  82. ExitCodeFatal = 2
  83. KeyNull = ""
  84. MAXIMUM_ALLOWED = 33554432
  85. SERVICE_NO_CHANGE = 4294967295
  86. RegistryErrorIndex = NO_ERROR
  87. KeyProduct = ""
  88. KeyParameters = ""
  89. TRUE = 1
  90. FALSE = 0
  91. NoTitle = 0
  92. ExitState = "Active"
  93. OldVersionExisted = $(FALSE)
  94. [date]
  95. ; Now is a list which contains { Sec from 1-1-1970, Year, Month, Day, Hour,
  96. ; Minute, Second }
  97. Now = {} ? $(!LIBHANDLE) GetSystemDate
  98. ;---------------------------------------------------------------------------
  99. ; 1. Identify
  100. ;
  101. ; DESCRIPTION: To verify that this INF deals with the same type of options
  102. ; as we are choosing currently.
  103. ;
  104. ; INPUT: None
  105. ;
  106. ; OUTPUT: $($R0): STATUS: STATUS_SUCCESSFUL
  107. ; $($R1): Option Type (COMPUTER ...)
  108. ; $($R2): Diskette description
  109. ;---------------------------------------------------------------------------
  110. [Identify]
  111. ;
  112. ;
  113. read-syms Identification
  114. set Status = STATUS_SUCCESSFUL
  115. set Identifier = $(OptionType)
  116. set Media = #("Source Media Descriptions", 1, 1)
  117. Return $(Status) $(Identifier) $(Media)
  118. ;------------------------------------------------------------------------
  119. ; 2. ReturnOptions:
  120. ;
  121. ; DESCRIPTION: To return the option list supported by this INF and the
  122. ; localised text list representing the options.
  123. ;
  124. ;
  125. ; INPUT: $($0): Language used. ( ENG | FRN | ... )
  126. ;
  127. ; OUTPUT: $($R0): STATUS: STATUS_SUCCESSFUL |
  128. ; STATUS_NOLANGUAGE
  129. ; STATUS_FAILED
  130. ;
  131. ; $($R1): Option List
  132. ; $($R2): Option Text List
  133. ;------------------------------------------------------------------------
  134. [ReturnOptions]
  135. ;
  136. ;
  137. set Status = STATUS_FAILED
  138. set OptionList = {}
  139. set OptionTextList = {}
  140. ;
  141. ; Check if the language requested is supported
  142. ;
  143. set LanguageList = ^(LanguagesSupported, 1)
  144. Ifcontains(i) $($0) in $(LanguageList)
  145. goto returnoptions
  146. else
  147. set Status = STATUS_NOLANGUAGE
  148. goto finish_ReturnOptions
  149. endif
  150. ;
  151. ; form a list of all the options and another of the text representing
  152. ;
  153. returnoptions = +
  154. set OptionList = ^(Options, 1)
  155. set OptionTextList = ^(OptionsText$($0), 1)
  156. set Status = STATUS_SUCCESSFUL
  157. finish_ReturnOptions = +
  158. Return $(Status) $(OptionList) $(OptionTextList)
  159. ;----------InstallOption-------------------------------------------------
  160. ;
  161. ; InstallOption:
  162. ;
  163. ; This section is shelled to by main installation processing
  164. ; or by NCPASHEL.INF during reconfig, removal, update, etc.
  165. ;
  166. ;
  167. ; FUNCTION: To copy files representing Options
  168. ; To configure the installed option
  169. ; To update the registry for the installed option
  170. ;
  171. ; INPUT: $($0): Language to use
  172. ; $($1): OptionID to install
  173. ; $($2): SourceDirectory
  174. ; $($3): AddCopy (YES | NO)
  175. ; $($4): DoCopy (YES | NO)
  176. ; $($5): DoConfig (YES | NO)
  177. ;
  178. ; OUTPUT: $($R0): STATUS: STATUS_SUCCESSFUL |
  179. ; STATUS_NOLANGUAGE |
  180. ; STATUS_USERCANCEL |
  181. ; STATUS_FAILED
  182. ;
  183. ;------------------------------------------------------------------------
  184. [InstallOption]
  185. ;
  186. ; extract parameters
  187. ;
  188. set Option = $($1)
  189. set SrcDir = $($2)
  190. set AddCopy = $($3)
  191. set DoCopy = $($4)
  192. set DoConfig = $($5)
  193. set InstallFrom = $($6)
  194. ifstr(i) $(InstallFrom) == ""
  195. set InstallFrom = "SAP"
  196. endif
  197. ;
  198. ; Check if the language requested is supported
  199. ;
  200. set LanguageList = ^(LanguagesSupported, 1)
  201. Ifcontains(i) $($0) NOT-IN $(LanguageList)
  202. Return STATUS_NOLANGUAGE
  203. endif
  204. ; define all the constants
  205. set-subst LF = "\n"
  206. read-syms GeneralConstants
  207. read-syms FileConstants
  208. read-syms DialogConstants$(!STF_LANGUAGE)
  209. ifstr(i) $(!NTN_Origination) == "NCPA"
  210. set Continue = $(OK)
  211. endif
  212. read-syms FileConstants$(!STF_LANGUAGE)
  213. detect date
  214. set-title $(FunctionTitle)
  215. set to = Begin
  216. set from = Begin
  217. ;
  218. ; Assume all is well.
  219. ;
  220. set CommonStatus = STATUS_SUCCESSFUL
  221. EndWait
  222. ;
  223. ; Set up the operation-mode-based variables and gaily welcome
  224. ; the user. If the "install mode" variable is improperly set,
  225. ; assume this is a new installation.
  226. ;
  227. Begin = +
  228. Ifstr(i) $(!NTN_InstallMode) == deinstall
  229. set StartLabel = removeadapter
  230. else-Ifstr(i) $(!NTN_InstallMode) == Update
  231. set StartLabel = UpgradeSoftware
  232. else-Ifstr(i) $(!NTN_InstallMode) == configure
  233. ;
  234. ; You cannot config the software component
  235. ;
  236. Debug-Output "Cannot configure the software."
  237. Shell $(UtilityInf),RegistryErrorString,CANNOT_CONFIGURE_SOFTWARE
  238. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  239. Debug-Output "ShellCode error: cannot get an error string."
  240. goto ShellCodeError
  241. endif
  242. set Error = $($R0)
  243. set from = end
  244. set to = end
  245. goto nonfatalinfo
  246. else-Ifstr(i) $(!NTN_InstallMode) == bind
  247. set StartLabel = bindingadapter
  248. else
  249. set StartLabel = installadapter
  250. set OEM_ABANDON_SOFTWARE = {}
  251. set OEM_ABANDON_OPTIONS = {}
  252. endif
  253. set from = $(fatal)
  254. set to = $(fatal)
  255. goto $(StartLabel)
  256. ;-----------------------------------------------
  257. ; Installation Section
  258. ;-----------------------------------------------
  259. installadapter = +
  260. set OEM_ABANDON_ON = TRUE
  261. StartWait
  262. OpenRegKey $(!REG_H_LOCAL) "" $(ProductKeyName) $(MAXIMUM_ALLOWED) KeyService
  263. Ifstr(i) $(KeyService) == $(KeyNull)
  264. ifstr(i) $(!NTN_InstallMode) == "install"
  265. Ifstr(i) $(DoCopy) == "YES"
  266. Debug-Output "SAP.INF: Calling DoAskSource 1"
  267. Shell $(UtilityInf), DoAskSource, $(!STF_CWDDIR), $(SrcDir) YES
  268. Ifint $($ShellCode) != $(!SHELL_CODE_OK)
  269. Goto ShellCodeError
  270. Else-Ifstr(i) $($R0) == STATUS_FAILED
  271. Shell $(UtilityInf) RegistryErrorString "ASK_SOURCE_FAIL"
  272. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  273. goto ShellCodeError
  274. endif
  275. set Error = $($R0)
  276. Goto fatal
  277. Else-Ifstr(i) $($R0) == STATUS_USERCANCEL
  278. Goto successful
  279. Endif
  280. Set SrcDir = $($R1)
  281. Endif
  282. set NwlnkName = "NWLINKIPX"
  283. OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_ServiceBase)"\NWLINKIPX" $(MAXIMUM_ALLOWED) BS_KeyServices
  284. Ifstr $(BS_KeyServices) == $(KeyNull)
  285. ;
  286. ;Check for new NWLNKIPX
  287. ;
  288. set NwlnkName = "NWLNKIPX"
  289. OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_ServiceBase)"\NWLNKIPX" $(MAXIMUM_ALLOWED) BS_KeyServices
  290. Ifstr $(BS_KeyServices) == $(KeyNull)
  291. ;
  292. ; Set up nwlink for the user
  293. ;
  294. Shell "oemnxpip.inf" ReturnOptions $(!STF_LANGUAGE)
  295. ifstr(i) $($R0) == STATUS_SUCCESSFUL
  296. set OldStfSrcDir = $(!STF_SRCDIR_OVERRIDE)
  297. set !STF_SRCDIR_OVERRIDE = ""
  298. set NwlnkName = *($($R1),1)
  299. Shell "oemnxpip.inf" InstallOption $(!STF_LANGUAGE), *($($R1),1),+
  300. $(SrcDir), $(AddCopy), "NO", $(DoConfig)
  301. set !STF_SRCDIR_OVERRIDE = $(OldStfSrcDir)
  302. else
  303. Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), "NONFATAL", $(InstallNWLINKFirst)
  304. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  305. goto ShellCodeError
  306. endif
  307. goto end
  308. endif
  309. else
  310. CloseRegKey $(BS_KeyServices)
  311. endif
  312. else
  313. CloseRegKey $(BS_KeyServices)
  314. endif
  315. Debug-Output "OEMNSVCU.INF: installadapter: installing [Install-Option]"
  316. install "Install-Option"
  317. ifstr(i) $(STF_INSTALL_OUTCOME) != STF_SUCCESS
  318. Shell $(UtilityInf) RegistryErrorString "UNABLE_COPY_FILE"
  319. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  320. goto ShellCodeError
  321. endif
  322. set Error = $($R0)
  323. goto fatal
  324. endif
  325. endif
  326. Shell $(UtilityInf), AddSoftwareComponent, "Microsoft", +
  327. $(ProductSAPName), +
  328. $(ProductSAPName), +
  329. $(ProductSAPDisplayName), +
  330. $(STF_CONTEXTINFNAME),+
  331. $(ProductSAPImagePath), +
  332. "autoserviceshare" , "", {"NWLNKIPX"}, ""
  333. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  334. Debug-Output "OEMNSVRA.INF: InstallRasIsnSapService : ShellCode error"
  335. return STATUS_FAILED
  336. endif
  337. set RegistryErrorIndex = $($R0)
  338. set ProductKey = $($R1)
  339. set RuleKey = $($R2)
  340. CloseRegKey $($R3)
  341. CloseRegKey $($R4)
  342. CloseRegKey $($R5)
  343. set NewValueList = {{SoftwareType,$(NoTitle),$(!REG_VT_SZ),$(SoftwareType)},+
  344. {MajorVersion,$(NoTitle),$(!REG_VT_DWORD),$(ProductMajorVersion)},+
  345. {Title,$(NoTitle),$(!REG_VT_SZ),$(ProductSAPTitle)},+
  346. {Description,$(NoTitle),$(!REG_VT_SZ),$(ProductSAPDescription)},+
  347. {MinorVersion,$(NoTitle),$(!REG_VT_DWORD),$(ProductMinorVersion)},+
  348. {OperationsSupport,$(NoTitle),$(!REG_VT_DWORD),$(ProductOpSupport)}, +
  349. {InstallDate,$(NoTitle),$(!REG_VT_DWORD),*($(Now),1)}}
  350. Shell $(UtilityInf), AddValueList, $(ProductKey), $(NewValueList)
  351. CloseRegKey $(ProductKey)
  352. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  353. Debug-Output "utility.INF: ShellCode error. Cannot added SapAgent"
  354. goto ShellCodeError
  355. endif
  356. set RegistryErrorIndex = $($R0)
  357. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  358. EndWait
  359. Debug-Output "OEMNSVRA.INF: InstallIsnSapService: Registry error: create service"
  360. set Status = STATUS_FAILED
  361. endif
  362. set NewValueList = {{InfOption,$(NoTitle),$(!REG_VT_SZ),"SAP"}}
  363. Shell $(UtilityInf), AddValueList, $(RuleKey), $(NewValueList)
  364. CloseRegKey $(RuleKey)
  365. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  366. Debug-Output "utility.INF: ShellCode error. Cannot added SapAgent"
  367. goto ShellCodeError
  368. endif
  369. set RegistryErrorIndex = $($R0)
  370. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  371. EndWait
  372. Debug-Output "OEMNSVRA.INF: InstallIsnSapService: Registry error: create service"
  373. set Status = STATUS_FAILED
  374. endif
  375. Shell $(UtilityInf) AddServerRpcProtocol "ncadg_ipx" "rpclt1.dll"
  376. Shell $(UtilityInf) AddServerRpcProtocol "ncacn_spx" "rpclt1.dll"
  377. endif
  378. Ifstr(i) $(KeyService) != $(KeyNull)
  379. CloseRegKey $(KeyService)
  380. endif
  381. Shell "" AddSAPUsed $(InstallFrom)
  382. EndWait
  383. goto successful
  384. ;-----------------------------------------------
  385. ; Configuration Section
  386. ;-----------------------------------------------
  387. configureadapter = +
  388. goto end
  389. ;-----------------------------------------------
  390. ; Binding section
  391. ;-----------------------------------------------
  392. bindingadapter =+
  393. goto end
  394. ;-----------------------------------------------
  395. ; Removeadapter section
  396. ;
  397. ;
  398. ; Removal errors are ignored, since we want to
  399. ; try to remove as much as possible.
  400. ;-----------------------------------------------
  401. removeadapter = +
  402. set RasIsnSapKeyName = "System\CurrentControlSet\Services\NwSapAgent"
  403. set ProductRASISNSAPName = "NwSapAgent"
  404. Shell "" RemoveSAPUsed $(InstallFrom)
  405. OpenRegKey $(!REG_H_LOCAL) "" $(RasIsnSapKeyName) $(MAXIMUM_ALLOWED) BS_KeyServices
  406. Ifstr $(BS_KeyServices) != $(KeyNull)
  407. CloseRegKey $(BS_KeyServices)
  408. Shell "" NumOfUsed
  409. set NumOfUsed = $($R0)
  410. ifint $(NumOfUsed) == 0
  411. Shell $(UtilityInf), RemoveSoftwareComponent, $(Manufacturer), $(ProductRASISNSAPName)
  412. ;
  413. ; Remove RPC as well
  414. ;
  415. OpenRegKey $(!REG_H_LOCAL) "" "Software\Microsoft\NWCWorkstation" $(MAXIMUM_ALLOWED) NWCKey
  416. ifstr(i) $(NWCKey) == ""
  417. ; this is done by the oemnsxpip.inf when it is removed
  418. ;
  419. ;Shell $(UtilityInf) RemoveServerRpcProtocol "ncadg_ipx"
  420. ;Shell $(UtilityInf) RemoveServerRpcProtocol "ncacn_spx"
  421. else
  422. ;
  423. ; Let Sap Agent Handle it
  424. ;
  425. CloseRegKey $(NWCKey)
  426. endif
  427. else
  428. ifstr(i) $(InstallFrom) == "SAP"
  429. read-syms InUsed
  430. set from = end
  431. set to = end
  432. goto warning
  433. endif
  434. endif
  435. endif
  436. RemoveSapAgentReturn = +
  437. goto end
  438. ;-----------------------------------------------
  439. ; Upgrade Software section
  440. ;-----------------------------------------------
  441. UpgradeSoftware = +
  442. ; Upgrade software component
  443. ;
  444. OpenRegKey $(!REG_H_LOCAL) "" $(ProductKeyName) $(MAXIMUM_ALLOWED) KeyProduct
  445. Ifstr(i) $(KeyProduct) != $(KeyNull)
  446. install "Install-Update"
  447. ifstr(i) $(STF_INSTALL_OUTCOME) != STF_SUCCESS
  448. goto fatal
  449. endif
  450. ;
  451. ; makesure a software type is defined
  452. ;
  453. SetRegValue $(KeyProduct) {SoftwareType,$(NoTitle),$(!REG_VT_SZ),$(SoftwareType)}
  454. ; Upgrade the version number
  455. ;
  456. SetRegValue $(KeyProduct) {MajorVersion,$(NoTitle),$(!REG_VT_SZ),$(ProductMajorVersion)}
  457. SetRegValue $(KeyProduct) {MinorVersion,$(NoTitle),$(!REG_VT_SZ),$(ProductMinorVersion)}
  458. ;
  459. ;
  460. ; Update description and op support
  461. ;
  462. SetRegValue $(KeyProduct) {Description,$(NoTitle),$(!REG_VT_SZ),$(ProductSAPDescription)}
  463. SetRegValue $(KeyProduct) {OperationsSupport,$(NoTitle),$(!REG_VT_DWORD),$(ProductOpSupport)}
  464. ; do nothing for update
  465. ;
  466. CloseRegKey $(KeyProduct)
  467. Shell $(UtilityInf) AddServerRpcProtocol "ncadg_ipx" "rpclt1.dll"
  468. Shell $(UtilityInf) AddServerRpcProtocol "ncacn_spx" "rpclt1.dll"
  469. endif
  470. goto end
  471. ;
  472. ; End of Upgrade Software
  473. ;
  474. ;
  475. ; Escape hatches
  476. ;
  477. successful = +
  478. goto end
  479. ;
  480. ; info display
  481. ;
  482. infomsg =+
  483. read-syms InfoDlg
  484. ui start "Warning"
  485. set CommonStatus = STATUS_USERCANCEL
  486. goto end
  487. ;
  488. ; warning display
  489. ;
  490. warning = +
  491. Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), "STATUS", $(Error)
  492. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  493. goto ShellCodeError
  494. endif
  495. ifstr(i) $($R1) == "OK"
  496. goto $(to)
  497. else-ifstr(i) $($R1) == "CANCEL"
  498. goto $(from)
  499. else
  500. ; Debug-Msg "Error Error Bad DLGEVENT"
  501. goto "end"
  502. endif
  503. ;
  504. ; non fatal error display
  505. ;
  506. nonfatalinfo = +
  507. Set CommonStatus = STATUS_USERCANCEL
  508. Set Severity = STATUS
  509. goto nonfatalmsg
  510. nonfatal = +
  511. Set Severity = NONFATAL
  512. goto nonfatalmsg
  513. nonfatalmsg = +
  514. ifstr(i) $(Error) == ""
  515. Set Severity = NONFATAL
  516. Shell $(UtilityInf) RegistryErrorString "SETUP_FAIL"
  517. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  518. goto ShellCodeError
  519. endif
  520. set Error = $($R0)
  521. endif
  522. Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), $(Severity), $(Error)
  523. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  524. goto ShellCodeError
  525. endif
  526. ifstr(i) $($R1) == "OK"
  527. goto $(from)
  528. else
  529. goto "end"
  530. endif
  531. ;
  532. ; Registry is broken
  533. ;
  534. fatalregistry = +
  535. Shell $(UtilityInf) RegistryErrorString $(RegistryErrorIndex)
  536. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  537. goto ShellCodeError
  538. endif
  539. set Error = $($R0)
  540. goto fatal
  541. ;
  542. ; fatal error display
  543. ;
  544. fatal = +
  545. ifstr(i) $(Error) == ""
  546. Shell $(UtilityInf) RegistryErrorString "SETUP_FAIL"
  547. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  548. goto ShellCodeError
  549. endif
  550. set Error = $($R0)
  551. endif
  552. Ifint $(BillboardVisible) != 0
  553. Shell "subroutn.inf" PopBillboard
  554. Set BillboardVisible = 0
  555. Endif
  556. Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), "FATAL", $(Error)
  557. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  558. goto ShellCodeError
  559. endif
  560. goto setfailed
  561. ;
  562. ; Shelling error
  563. ;
  564. ShellCodeError = +
  565. set DlgType = "MessageBox"
  566. set STF_MB_TITLE = $(ShellCodeErrorTitle)
  567. set STF_MB_TEXT = $(ShellCodeErrorText)
  568. set STF_MB_TYPE = 1
  569. set STF_MB_ICON = 3
  570. set STF_MB_DEF = 1
  571. ui start "Error Message"
  572. goto setfailed
  573. setfailed = +
  574. set CommonStatus = STATUS_FAILED
  575. ;
  576. ; If OEM_ABANDON_ON, we need to clean up the registry
  577. ;
  578. ifstr(i) $(OEM_ABANDON_ON) == TRUE
  579. set OEM_ABANDON_ON = FALSE
  580. goto removeadapter
  581. endif
  582. goto end
  583. end = +
  584. goto term
  585. term = +
  586. Return $(CommonStatus)
  587. ;***************************************************************
  588. ; INSTALL SECTIONS
  589. ;***************************************************************
  590. [Install-Option]
  591. set STF_VITAL = ""
  592. ifstr(i) $(AddCopy) == "YES"
  593. ;
  594. ; Add the files to the copy list
  595. ;
  596. AddSectionFilesToCopyList Files-SAP $(SrcDir) $(!STF_WINDOWSSYSPATH)
  597. endif
  598. ifstr(i) $(DoCopy) == "YES"
  599. ;
  600. ; Copy files in the copy list
  601. ;
  602. set !STF_NCPA_FLUSH_COPYLIST = TRUE
  603. CopyFilesInCopyList
  604. endif
  605. ifstr(i) $(DoConfig) == "YES"
  606. ;
  607. ; Add product to registry
  608. ;
  609. ;
  610. ; Finish up
  611. endif
  612. Exit
  613. [Install-Update]
  614. set STF_VITAL = ""
  615. set STF_OVERWRITE = "VERIFYSOURCEOLDER"
  616. ;set STF_VERSION = "YES"
  617. AddSectionFilesToCopyList Files-SAP $(SrcDir) $(!STF_WINDOWSSYSPATH)
  618. Exit
  619. [AddSAPUsed]
  620. read-syms GeneralConstants
  621. read-syms FileConstants
  622. read-syms FileConstants$(!STF_LANGUAGE)
  623. set KeyName = $($0)
  624. OpenRegKey $(!REG_H_LOCAL) "" $(ProductKeyName) $(MAXIMUM_ALLOWED) KeyService
  625. ifstr(i) $(KeyService) != ""
  626. OpenRegKey $(!REG_H_LOCAL) "" $(ProductKeyName)"\UseRef" $(MAXIMUM_ALLOWED) KeyUseRef
  627. ifstr(i) $(KeyUseRef) == ""
  628. CreateRegKey $(KeyService) {"UseRef",$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" KeyUseRef
  629. endif
  630. ifstr(i) $(KeyUseRef) != ""
  631. ;
  632. ; Set up the usage reference
  633. ;
  634. SetRegValue $(KeyUseRef) {$(KeyName),$(NoTitle),$(!REG_VT_SZ),"1"}
  635. CloseRegKey $(KeyUseRef)
  636. endif
  637. CloseRegKey $(KeyService)
  638. else
  639. ; debug-output "error: cannot open product key"
  640. endif
  641. return
  642. [RemoveSAPUsed]
  643. read-syms GeneralConstants
  644. read-syms FileConstants
  645. read-syms FileConstants$(!STF_LANGUAGE)
  646. set KeyName = $($0)
  647. OpenRegKey $(!REG_H_LOCAL) "" $(ProductKeyName) $(MAXIMUM_ALLOWED) KeyService
  648. ifstr(i) $(KeyService) != ""
  649. OpenRegKey $(!REG_H_LOCAL) "" $(ProductKeyName)"\UseRef" $(MAXIMUM_ALLOWED) KeyUseRef
  650. ifstr(i) $(KeyUseRef) == ""
  651. CreateRegKey $(KeyService) {"UseRef",$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" KeyUseRef
  652. endif
  653. ifstr(i) $(KeyUseRef) != ""
  654. ;
  655. ; Delete the usage reference
  656. ;
  657. DeleteRegValue $(KeyUseRef) $(KeyName)
  658. CloseRegKey $(KeyUseRef)
  659. endif
  660. CloseRegKey $(KeyService)
  661. else
  662. ; debug-output "error: cannot open product key"
  663. endif
  664. return
  665. [NumOfUsed]
  666. read-syms GeneralConstants
  667. read-syms FileConstants
  668. read-syms FileConstants$(!STF_LANGUAGE)
  669. OpenRegKey $(!REG_H_LOCAL) "" $(ProductKeyName) $(MAXIMUM_ALLOWED) KeyService
  670. ifstr(i) $(KeyService) != ""
  671. OpenRegKey $(!REG_H_LOCAL) "" $(ProductKeyName)"\UseRef" $(MAXIMUM_ALLOWED) KeyUseRef
  672. ifstr(i) $(KeyUseRef) == ""
  673. CreateRegKey $(KeyService) {"UseRef",$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" KeyUseRef
  674. endif
  675. ifstr(i) $(KeyUseRef) != ""
  676. ;
  677. ; enumerate the usage reference
  678. ;
  679. EnumRegValue $(KeyUseRef) UsageList
  680. set Num = 0
  681. ForListDo $(UsageList)
  682. set-add Num = $(Num), 1
  683. EndForListDo
  684. CloseRegKey $(KeyUseRef)
  685. endif
  686. CloseRegKey $(KeyService)
  687. else
  688. ; debug-output "error: cannot open product key"
  689. endif
  690. return $(Num)
  691. [FindUsed]
  692. read-syms GeneralConstants
  693. read-syms FileConstants
  694. read-syms FileConstants$(!STF_LANGUAGE)
  695. set KeyName = $($0)
  696. set Find = FALSE
  697. OpenRegKey $(!REG_H_LOCAL) "" $(ProductKeyName) $(MAXIMUM_ALLOWED) KeyService
  698. ifstr(i) $(KeyService) != ""
  699. OpenRegKey $(!REG_H_LOCAL) "" $(ProductKeyName)"\UseRef" $(MAXIMUM_ALLOWED) KeyUseRef
  700. ifstr(i) $(KeyUseRef) == ""
  701. CreateRegKey $(KeyService) {"UseRef",$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" KeyUseRef
  702. endif
  703. ifstr(i) $(KeyUseRef) != ""
  704. ;
  705. ; Find the vairable
  706. ;
  707. GetRegValue $(KeyUseRef),$(KeyName), KeyInfo
  708. ifstr(i) $(RegLastError) == $(!REG_ERROR_SUCCESS)
  709. set Find = TRUE
  710. endif
  711. CloseRegKey $(KeyUseRef)
  712. endif
  713. CloseRegKey $(KeyService)
  714. else
  715. ; debug-output "error: cannot open product key"
  716. endif
  717. return $(Find)