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.

507 lines
19 KiB

  1. ;====================================================================
  2. ; Copyright (c) 1995, Microsoft Corp.
  3. ;
  4. ; File: OEMNSVBR.INF
  5. ;
  6. ; History:
  7. ; t-abolag 05/15/95 Created.
  8. ;
  9. ; Installation script for the BOOTP Relay Agent service
  10. ;====================================================================
  11. ;-----------------------------------------------------------------------
  12. ; OptionType
  13. ; Types specific to networking:
  14. ;
  15. ; NetAdapter, a netcard / adapter combination or just a netcard
  16. ; NetDriver, just a netcard driver
  17. ; NetTransport, a complete NDIS-compliant TDI transport stack
  18. ; NetService, an NT networking service
  19. ; NetWork, a complete network ensemble.
  20. ; NetProvider a complete network which supports NT MPR protocol
  21. ;-----------------------------------------------------------------------
  22. [Identification]
  23. OptionType = NetService
  24. ;-----------------------------------------------------------------------
  25. ; Options
  26. ; This section lists the OEM Option key names. These keys are locale-
  27. ; independent and used to represent the option in a locale-independent
  28. ; manner.
  29. ;-----------------------------------------------------------------------
  30. [Options]
  31. RelayAgent
  32. ;-----------------------------------------------------------------------
  33. ; CONSTANTS FOR USING DIALOGS
  34. ;-----------------------------------------------------------------------
  35. [FileConstants]
  36. Manufacturer = "Microsoft"
  37. ProductMajorVersion = "4"
  38. ProductMinorVersion = "0"
  39. ProductVersion = $(ProductMajorVersion)"."$(ProductMinorVersion)
  40. ProductOpSupport = 132 ; 0x0084 ; Display,Removable,NOT Properties,Not Updatable
  41. ProductSoftwareName = "RelayAgent"
  42. ProductSoftwareImagePath = "%SystemRoot%\System32\router.exe"
  43. ProductEventFile = "%SystemRoot%\System32\relay.dll"
  44. ProductSoftwareType = "autoserviceshare"
  45. ProductKeyName = $(!NTN_SoftwareBase)"\"$(Manufacturer)"\CurrentVersion"
  46. ProductRegRoot = $(!NTN_ServiceBase)"\"$(ProductSoftwareName)
  47. ProductRegParams = $(ProductRegRoot)"\Parameters"
  48. TCPIPRegRoot = $(!NTN_ServiceBase)"\Tcpip"
  49. NetRuleType = "relayAgent relayAgentClass"
  50. NetRuleUse = "service yes yes"
  51. NetRuleBindable = {"relayAgentClass ndisDriver non non 100"}
  52. NetRuleBindForm = """RelayAgent"" yes yes simple"
  53. NetRuleClass = {"relayAgentClass basic"}
  54. SoftwareType = "service"
  55. [GeneralConstants]
  56. File_UTILITY_INF = "UTILITY.INF"
  57. File_SUBROUTN_INF = "SUBROUTN.INF"
  58. Exit_Code = 0
  59. ExitCodeOK = 0
  60. ExitCodeCancel = 1
  61. ExitCodeFatal = 2
  62. KeyNull = ""
  63. MAXIMUM_ALLOWED = 33554432
  64. SERVICE_NO_CHANGE = 4294967295
  65. RegistryErrorIndex = NO_ERROR
  66. KeyProduct = ""
  67. KeyParameters = ""
  68. TRUE = 1
  69. FALSE = 0
  70. NoTitle = 0
  71. to = ""
  72. from = ""
  73. ExitState = "Active"
  74. OldVersionExisted = $(FALSE)
  75. [date]
  76. Now = {} ? $(!LIBHANDLE) GetSystemDate
  77. [Identify]
  78. read-syms Identification
  79. set Status = STATUS_SUCCESSFUL
  80. set Identifier = $(OptionType)
  81. set Media = #("Source Media Descriptions", 1, 1)
  82. Return $(Status) $(Identifier) $(Media)
  83. [ReturnOptions]
  84. set Status = STATUS_FAILED
  85. set OptionList = {}
  86. set OptionTextList = {}
  87. set LanguageList = ^(LanguagesSupported, 1)
  88. ifcontains(i) $($0) in $(LanguageList)
  89. goto returnOptions
  90. else
  91. set Status = STATUS_NOLANGUAGE
  92. goto finish_ReturnOptions
  93. endif
  94. returnOptions = +
  95. set OptionList = ^(Options, 1)
  96. set OptionTextList = ^(OptionsText$($0), 1)
  97. set Status = STATUS_SUCCESSFUL
  98. finish_ReturnOptions = +
  99. Return $(Status) $(OptionList) $(OptionTextList)
  100. [InstallOption]
  101. set Status = STATUS_FAILED
  102. set Option = $($1)
  103. set SrcDir = $($2)
  104. set AddCopy = $($3)
  105. set DoCopy = $($4)
  106. set DoConfig = $($5)
  107. set LanguageList = ^(LanguagesSupported, 1)
  108. ifcontains(i) $($0) NOT-IN $(LanguageList)
  109. return STATUS_NOLANGUAGE
  110. endif
  111. StartWait
  112. read-syms GeneralConstants
  113. read-syms FileConstants
  114. read-syms FileConstants$(!STF_LANGUAGE)
  115. read-syms DialogConstants$(!STF_LANGUAGE)
  116. ifstr(i) $(!NTN_Origination) == "NCPA"
  117. set continue = $(OK)
  118. endif
  119. detect date
  120. set to = Begin
  121. set from = Begin
  122. set ExitStatus = STATUS_SUCCESSFUL
  123. EndWait
  124. Begin = +
  125. ifstr(i) $(!NTN_InstallMode) == deinstall
  126. set startLabel = Deinstall
  127. else-ifstr(i) $(!NTN_InstallMode) == update
  128. set startLabel = Update
  129. else-ifstr(i) $(!NTN_InstallMode) == bind
  130. set startLabel = ScriptExit
  131. else-ifstr(i) $(!NTN_InstallMode) == configure
  132. ;set startLabel = Configure
  133. Debug-Output "Cannot configure the software."
  134. Shell $(File_UTILITY_INF), RegistryErrorString, +
  135. CANNOT_CONFIGURE_SOFTWARE
  136. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  137. Debug-Output "ShellCode error: cannot get an error string."
  138. goto ShellErrorExit
  139. endif
  140. set ErrorMsg = $($R0)
  141. set Severity = STATUS
  142. set ExitStatus = STATUS_USERCANCEL
  143. Shell $(File_SUBROUTN_INF) SetupMessage, $(!STF_LANGUAGE), +
  144. $(Severity), $(ErrorMsg)
  145. goto ScriptExit
  146. else
  147. set startLabel = Install
  148. endif
  149. set from = $(ScriptExit)
  150. set to = $(ScriptExit)
  151. goto $(startLabel)
  152. ;-----------------------------
  153. ; Entry point for installation
  154. ;-----------------------------
  155. Install = +
  156. ; make certain TCP/IP is installed
  157. OpenRegKey $(!REG_H_LOCAL) "" $(TCPIPRegRoot) $(MAXIMUM_ALLOWED) TCPIPRootKey
  158. ifstr $(TCPIPRootKey) == $(KeyNull)
  159. set Message = ErrorTCPIPNotInstalled
  160. goto MessageExit
  161. endif
  162. CloseRegKey $(TCPIPRegRoot)
  163. ; check to see if a previous version is installed
  164. OpenRegKey $(!REG_H_LOCAL) "" $(ProductKeyName) $(MAXIMUM_ALLOWED) ProductKey
  165. ifstr $(ProductKey) != $(KeyNull)
  166. CloseRegKey $(ProductKey)
  167. Shell $(File_UTILITY_INF), VerExistedDlg, +
  168. $(ProductSoftwareTitle), $(ProductVersion)
  169. goto ScriptExit
  170. endif
  171. ; Save Unattended flag for oemnxptc.inf (TCP/IP). This inf checks the config of DHCP relay
  172. ; and presents a message box to the user if the config is wrong.
  173. ; NOTE: The !STF_UNATTEND flag is not remembered during a binding review. This is why it's saved
  174. OpenRegKey $(!REG_H_LOCAL) "" "System\Setup" $(MAXIMUM_ALLOWED) KeySetup
  175. ifstr(i) $(KeySetup) != ""
  176. DeleteRegTree $(KeySetup) "DHCPRelay"
  177. CreateRegKey $(KeySetup) {"DHCPRelay",$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" KeyDHCP
  178. ifstr(i) $(KeyDHCP) != ""
  179. SetRegValue $(KeyDHCP) {"Unattended",$(NoTitle),$(!REG_VT_SZ),$(!STF_UNATTENDED)}
  180. CloseRegKey $(KeyDHCP)
  181. endif
  182. endif
  183. Ifstr(i) $(!NTN_InstallMode) == "install"
  184. Ifstr(i) $(DoCopy) == "YES"
  185. Shell $(File_UTILITY_INF), DoAskSource, $(!STF_CWDDIR), $(SrcDir) YES
  186. Ifint $($ShellCode) != $(!SHELL_CODE_OK)
  187. Goto ShellErrorExit
  188. Else-Ifstr(i) $($R0) == STATUS_FAILED
  189. Shell $(File_UTILITY_INF) RegistryErrorString "ASK_SOURCE_FAIL"
  190. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  191. goto ShellErrorExit
  192. endif
  193. set Error = $($R0)
  194. Goto ScriptExit
  195. Else-Ifstr(i) $($R0) == STATUS_USERCANCEL
  196. ; Set ExitStatus so NCPA won't change cancel to close
  197. set ExitStatus = STATUS_USERCANCEL
  198. Goto ScriptExit
  199. Endif
  200. Set SrcDir = $($R1)
  201. Endif
  202. install "Install-Option"
  203. ifstr(i) $(STF_INSTALL_OUTCOME) != STF_SUCCESS
  204. Shell $(UtilityInf) RegistryErrorString "UNABLE_COPY_FILE"
  205. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  206. set ExitStatus = STATUS_USERCANCEL
  207. goto ScriptExit
  208. endif
  209. set Error = $($R0)
  210. goto ScriptExit
  211. endif
  212. endif
  213. StartWait
  214. ; update the software registry key
  215. Shell $(File_UTILITY_INF), AddSoftwareComponent, $(Manufacturer), +
  216. $(ProductSoftwareName), $(ProductSoftwareName), +
  217. $(ProductSoftwareDisplayName), $(STF_CONTEXTINFNAME), +
  218. $(ProductSoftwareImagePath), $(ProductSoftwareType), "", +
  219. { "Tcpip", "EventLog" }, "", $(ProductEventFile)
  220. set SoftwareProductKey = $($R1)
  221. set SoftwareNetRuleKey = $($R2)
  222. set SoftwareServiceKey = $($R3)
  223. set ParamsKey = $($R4)
  224. set SoftLinkageKey = $($R5)
  225. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  226. EndWait
  227. Debug-Output "ShellCode error: AddSoftwareComponent"
  228. goto ShellErrorExit
  229. endif
  230. set RegistryErrorIndex = $($R0)
  231. ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  232. EndWait
  233. Debug-Output "Registry error: AddSoftwareComponent"
  234. CloseRegKey $(SoftwareProductKey)
  235. CloseRegKey $(SoftwareNetRuleKey)
  236. CloseRegKey $(SoftwareServiceKey)
  237. CloseRegKey $(KeyParameters)
  238. CloseRegKey $(SoftLinkageKey)
  239. goto RegistryErrorExit
  240. endif
  241. ; fill in the RelayAgent\Parameters key
  242. set HopsThreshold = 4
  243. set SecsThreshold = 4
  244. set LogMessages = 0
  245. set EnableTracing = 0
  246. set DHCPServers = ""
  247. set NewValueList = {{HopsThreshold,$(NoTitle),$(!REG_VT_DWORD),$(HopsThreshold)},+
  248. {SecsThreshold,$(NoTitle),$(!REG_VT_DWORD),$(SecsThreshold)},+
  249. {LogMessages,$(NoTitle),$(!REG_VT_DWORD),$(LogMessages)},+
  250. {EnableTracing,$(NoTitle),$(!REG_VT_DWORD),$(EnableTracing)},+
  251. {DHCPServers,$(NoTitle),$(!REG_VT_MULTI_SZ),$(DHCPServers)}}
  252. Shell $(File_UTILITY_INF), AddValueList, $(ParamsKey), $(NewValueList)
  253. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  254. EndWait
  255. Debug-Output "ShellCode error."
  256. goto ShellErrorExit
  257. endif
  258. set RegistryErrorIndex = $($R0)
  259. ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  260. EndWait
  261. Debug-Output "Registry error: AddValueList"
  262. CloseRegKey $(SoftwareProductKey)
  263. CloseRegKey $(SoftwareNetRuleKey)
  264. CloseRegKey $(SoftwareServiceKey)
  265. CloseRegKey $(SoftLinkageKey)
  266. CloseRegKey $(KeyParameters)
  267. goto RegistryErrorExit
  268. endif
  269. ; fill in the Software\CurrentVersion key
  270. set NewValueList = {{SoftwareType,$(NoTitle),$(!REG_VT_SZ),$(SoftwareType)},+
  271. {MajorVersion,$(NoTitle),$(!REG_VT_DWORD),$(ProductMajorVersion)},+
  272. {MinorVersion,$(NoTitle),$(!REG_VT_DWORD),$(ProductMinorVersion)},+
  273. {Title,$(NoTitle),$(!REG_VT_SZ),$(ProductSoftwareTitle)},+
  274. {Description,$(NoTitle),$(!REG_VT_SZ),$(ProductSoftwareDescription)},+
  275. {ServiceName,$(NoTitle),$(!REG_VT_SZ),$(ProductSoftwareName)},+
  276. {OperationsSupport,$(NoTitle),$(!REG_VT_DWORD),$(ProductOpSupport)}, +
  277. {InstallDate,$(NoTitle),$(!REG_VT_DWORD),*($(Now),1)}}
  278. Shell $(File_UTILITY_INF), AddValueList, $(SoftwareProductKey), $(NewValueList)
  279. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  280. EndWait
  281. Debug-Output "ShellCode error."
  282. goto ShellErrorExit
  283. endif
  284. set RegistryErrorIndex = $($R0)
  285. ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  286. EndWait
  287. Debug-Output "Registry error: AddValueList."
  288. CloseRegKey $(SoftwareProductKey)
  289. CloseRegKey $(SoftwareNetRuleKey)
  290. CloseRegKey $(SoftwareServiceKey)
  291. CloseRegKey $(SoftLinkageKey)
  292. CloseRegKey $(KeyParameters)
  293. goto RegistryErrorExit
  294. endif
  295. ; fill in the Software\CurrentVersion\NetRules key
  296. set NewValueList = +
  297. {{InfOption,$(NoTitle),$(!REG_VT_SZ),RelayAgent},+
  298. {class,$(NoTitle),$(!REG_VT_MULTI_SZ),$(NetRuleClass)},+
  299. {type,$(NoTitle),$(!REG_VT_SZ),$(NetRuleType)},+
  300. {use,$(NoTitle),$(!REG_VT_SZ),$(NetRuleUse)},+
  301. {bindform,$(NoTitle),$(!REG_VT_SZ),$(NetRuleBindForm)},+
  302. {bindable,$(NoTitle),$(!REG_VT_MULTI_SZ),$(NetRuleBindable)}}
  303. Shell $(File_UTILITY_INF), AddValueList, $(SoftwareNetRuleKey), $(NewValueList)
  304. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  305. EndWait
  306. Debug-Output "ShellCode error."
  307. goto ShellErrorExit
  308. endif
  309. set RegistryErrorIndex = $($R0)
  310. ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  311. EndWait
  312. Debug-Output "Registry error: AddValueList."
  313. CloseRegKey $(SoftwareProductKey)
  314. CloseRegKey $(SoftwareNetRuleKey)
  315. CloseRegKey $(SoftwareServiceKey)
  316. CloseRegKey $(KeyParameters)
  317. CloseRegKey $(SoftLinkageKey)
  318. goto RegistryErrorExit
  319. endif
  320. CloseRegKey $(SoftwareProductKey)
  321. CloseRegKey $(SoftwareNetRuleKey)
  322. CloseRegKey $(SoftLinkageKey)
  323. CloseRegKey $(KeyParameters)
  324. CloseRegKey $(SoftwareServiceKey)
  325. EndWait
  326. ; the tcp configuration will either be up or will get invoke when ncpa is
  327. ; closed, it can get configured at that time.
  328. set ExitStatus = STATUS_SUCCESSFUL
  329. goto ScriptExit
  330. ;---------------------------------
  331. ; Entry point for deinstallation
  332. ;---------------------------------
  333. Deinstall = +
  334. Shell $(File_UTILITY_INF), RemoveSoftwareComponent, $(Manufacturer), +
  335. $(ProductSoftwareName)
  336. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  337. Debug-Output "ShellCode error: RemoveSoftwareComponent"
  338. goto ShellErrorExit
  339. endif
  340. set RegistryErrorIndex = $($R0)
  341. ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  342. goto RegistryErrorExit
  343. endif
  344. ; don't want to reboot, but no way around it
  345. set ExitStatus = STATUS_SUCCESSFUL
  346. goto ScriptExit
  347. ;---------------------------
  348. ; Entry point for upgrades
  349. ;---------------------------
  350. Update = +
  351. OpenRegKey $(!REG_H_LOCAL) "" "SOFTWARE\Microsoft\RelayAgent\CurrentVersion" $(MAXIMUM_ALLOWED) ProductKey
  352. ifstr $(ProductKey) != ""
  353. SetRegValue $(ProductKey) {Description,$(NoTitle),$(!REG_VT_SZ), +
  354. $(ProductSoftwareDescription)}
  355. SetRegValue $(ProductKey) {Title,$(NoTitle),$(!REG_VT_SZ), +
  356. $(ProductSoftwareTitle)}
  357. OpenRegKey $(!REG_H_LOCAL) "" "SOFTWARE\Microsoft\Ncpa\InfOptions" $(MAXIMUM_ALLOWED) NcpaKey
  358. ifstr(i) $(NcpaKey) != ""
  359. DeleteRegTree $(NcpaKey) "oemnsvbr.inf"
  360. endif
  361. CloseRegKey $(NcpaKey)
  362. OpenRegKey $(!REG_H_LOCAL) "" $(ProductRegRoot) $(MAXIMUM_ALLOWED) svcKey
  363. ifstr(i) $(svcKey) != $(KeyNull)
  364. SetRegValue $(svcKey) {DisplayName,$(NoTitle),$(!REG_VT_SZ), +
  365. $(ProductSoftwareDisplayName)}
  366. endif
  367. CloseRegKey $(svcKey)
  368. install "Install-Update"
  369. ifstr(i) $(STF_INSTALL_OUTCOME) != STF_SUCCESS
  370. EndWait
  371. Shell $(File_UTILITY_INF) RegistryErrorString "UNABLE_COPY_FILE"
  372. set Message = $($R0)
  373. goto MessageExit
  374. endif
  375. SetRegValue $(ProductKey) {MajorVersion,$(NoTitle),$(!REG_VT_SZ), +
  376. $(ProductMajorVersion)}
  377. SetRegValue $(ProductKey) {MinorVersion,$(NoTitle),$(!REG_VT_SZ), +
  378. $(ProductMinorVersion)}
  379. ;
  380. ; Update op support
  381. ;
  382. SetRegValue $(KeyProduct) {OperationsSupport,$(NoTitle),$(!REG_VT_DWORD),$(ProductOpSupport)}
  383. LibraryProcedure Result, $(!LIBHANDLE), SetupChangeServiceConfig, +
  384. $(ProductSoftwareName), $(SERVICE_NO_CHANGE), +
  385. $(SERVICE_NO_CHANGE), $(SERVICE_NO_CHANGE), +
  386. $(ProductSoftwareImagePath), "", "", "", "", ""
  387. CloseRegKey $(ProductKey)
  388. ; don't want to reboot, but no way to avoid
  389. set ExitStatus = STATUS_SUCCESSFUL
  390. endif
  391. goto ScriptExit
  392. ;--------------------------------
  393. ; Entry point for configuration
  394. ;--------------------------------
  395. Configure = +
  396. goto ScriptExit
  397. ;--------------------------------
  398. ; Exit point from a shell error
  399. ;--------------------------------
  400. ShellErrorExit = +
  401. set DlgType = "MessageBox"
  402. set STF_MB_TITLE = $(ShellCodeErrorTitle)
  403. set STF_MB_TEXT = $(ShellCodeErrorText)
  404. set STF_MB_TYPE = 1
  405. set STF_MB_ICON = 3
  406. set STF_MB_DEF = 1
  407. ui start "Error Message"
  408. set ExitStatus = STATUS_FAILED
  409. goto ScriptExit
  410. ;-----------------------------------
  411. ; Exit point from a registry error
  412. ;-----------------------------------
  413. RegistryErrorExit = +
  414. Shell $(File_UTILITY_INF) RegistryErrorString $(RegistryErrorIndex)
  415. set Message = $($R0)
  416. set ExitStatus = STATUS_FAILED
  417. goto MessageExit
  418. ;----------------------------
  419. ; Exit point with a message
  420. ;----------------------------
  421. MessageExit = +
  422. Shell $(File_SUBROUTN_INF) SetupMessage, $(!STF_LANGUAGE), "", $(Message)
  423. goto ScriptExit
  424. ;---------------------
  425. ; Exit point for all
  426. ;---------------------
  427. ScriptExit = +
  428. return $(ExitStatus)
  429. [GetFilesSize]
  430. set FileSizeList = ^(Files-RelayAgent, 3)
  431. set TotalSize = 0
  432. ForListDo $(FileSizeList)
  433. Split-String $($) "=" SplitString
  434. set Size = *($(SplitString),3)
  435. set-add TotalSize = $(TotalSize) $(Size)
  436. EndForListDo
  437. set-div SizeInKB = $(TotalSize) 1024
  438. return $(SizeInKB)
  439. [Install-Option]
  440. set STF_VITAL = ""
  441. ifstr(i) $(AddCopy) == "YES"
  442. AddSectionFilesToCopyList Files-RelayAgent $(SrcDir) $(!STF_WINDOWSSYSPATH)
  443. endif
  444. ifstr(i) $(DoCopy) == "YES"
  445. set !STF_NCPA_FLUSH_COPYLIST = TRUE
  446. CopyFilesInCopyList
  447. endif
  448. ifstr(i) $(DoConfig) == "YES"
  449. endif
  450. exit
  451. [Install-Update]
  452. set STF_VITAL = NO
  453. set STF_OVERWRITE = "VERIFYSOURCEOLDER"
  454. AddSectionFilesToCopyList Files-RelayAgent $(SrcDir) $(!STF_WINDOWSSYSPATH)
  455. exit