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.

617 lines
16 KiB

  1. ;***********************************************************************
  2. ;
  3. ; OEMNSVCU.INF
  4. ;
  5. ; TCPIP Connectivity Utilities
  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 = NetTcpip
  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. TCPIPCU
  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. ;================================================================
  52. ; TCP/IP: Service and Driver
  53. ;
  54. ;================================================================
  55. ; TCP Software data: this is the WIN32 Service. It
  56. ; automatically loads the TCPIP.SYS driver.
  57. ;
  58. ProductTCPIPCUName = "TcpipCU"
  59. ;
  60. ; Registry Key Names
  61. ;
  62. ProductKeyName = $(!NTN_SoftwareBase)"\"$(Manufacturer)"\"$(Product$(Option)Name)"\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. ;
  194. ; Check if the language requested is supported
  195. ;
  196. set LanguageList = ^(LanguagesSupported, 1)
  197. Ifcontains(i) $($0) NOT-IN $(LanguageList)
  198. Return STATUS_NOLANGUAGE
  199. endif
  200. Debug-Output "OEMNSVCU.INF: STF_CWDIR is: "$(!STF_CWDIR)
  201. Debug-Output "OEMNSVCU.INF: STF_LANGUAGE is: "$(!STF_LANGUAGE)
  202. ; define all the constants
  203. set-subst LF = "\n"
  204. read-syms GeneralConstants
  205. read-syms FileConstants
  206. read-syms DialogConstants$(!STF_LANGUAGE)
  207. ifstr(i) $(!NTN_Origination) == "NCPA"
  208. set Continue = $(OK)
  209. endif
  210. read-syms FileConstants$(!STF_LANGUAGE)
  211. detect date
  212. set-title $(FunctionTitle)
  213. set to = Begin
  214. set from = Begin
  215. ;
  216. ; Assume all is well.
  217. ;
  218. set CommonStatus = STATUS_SUCCESSFUL
  219. EndWait
  220. ;
  221. ; Set up the operation-mode-based variables and gaily welcome
  222. ; the user. If the "install mode" variable is improperly set,
  223. ; assume this is a new installation.
  224. ;
  225. Begin = +
  226. Ifstr(i) $(!NTN_InstallMode) == deinstall
  227. set StartLabel = removeadapter
  228. else-Ifstr(i) $(!NTN_InstallMode) == Update
  229. set StartLabel = UpgradeSoftware
  230. else-Ifstr(i) $(!NTN_InstallMode) == configure
  231. set StartLabel = configureadapter
  232. ;
  233. ; You cannot config the software component
  234. ;
  235. Ifstr(i) $(ProductKeyName) == $(!NTN_RegBase)
  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. endif
  247. else-Ifstr(i) $(!NTN_InstallMode) == bind
  248. set StartLabel = bindingadapter
  249. else
  250. set StartLabel = installadapter
  251. set OEM_ABANDON_SOFTWARE = {}
  252. set OEM_ABANDON_OPTIONS = {}
  253. endif
  254. set from = $(fatal)
  255. set to = $(fatal)
  256. goto $(StartLabel)
  257. ;-----------------------------------------------
  258. ; Installation Section
  259. ;-----------------------------------------------
  260. installadapter = +
  261. ifstr(i) $(!NTN_InstallMode) == "install"
  262. Debug-Output "OEMNSVCU.INF: installadapter: installing [Install-Option]"
  263. install "Install-Option"
  264. ifstr(i) $(STF_INSTALL_OUTCOME) != STF_SUCCESS
  265. Shell $(UtilityInf) RegistryErrorString "UNABLE_COPY_FILE"
  266. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  267. goto ShellCodeError
  268. endif
  269. set Error = $($R0)
  270. goto fatal
  271. endif
  272. endif
  273. set OEM_ABANDON_ON = TRUE
  274. StartWait
  275. Shell $(UtilityInf) InstallSoftwareProduct $(Manufacturer) $(ProductTCPIPCUName) $(STF_CONTEXTINFNAME)
  276. set VerKey = $($R1)
  277. set NetRuleKey = $($R2)
  278. Shell $(UtilityInf), AddValueList, $(VerKey), {{Hidden,0,$(!REG_VT_DWORD),1}}
  279. Shell $(UtilityInf), AddValueList, $(VerKey), {{SoftwareType,0,$(!REG_VT_SZ),$(SoftwareType)}}
  280. Shell $(UtilityInf), AddValueList, $(VerKey), {{Title,0,$(!REG_VT_SZ),$(ProductTCPIPCUTitle)}}
  281. Shell $(UtilityInf), AddValueList, $(NetRuleKey), {{InfOption,0,$(!REG_VT_SZ),"TCPIPCU"}}
  282. CloseRegKey $(VerKey)
  283. CloseRegKey $(NetRuleKey)
  284. ifstr(i) $(!STF_INSTALL_TYPE) != "SETUPBOOTED"
  285. Shell "" AddTelnet
  286. endif
  287. EndWait
  288. goto successful
  289. ;-----------------------------------------------
  290. ; Configuration Section
  291. ;-----------------------------------------------
  292. configureadapter = +
  293. goto end
  294. ;-----------------------------------------------
  295. ; Binding section
  296. ;-----------------------------------------------
  297. bindingadapter =+
  298. goto end
  299. ;-----------------------------------------------
  300. ; Removeadapter section
  301. ;
  302. ;
  303. ; Removal errors are ignored, since we want to
  304. ; try to remove as much as possible.
  305. ;-----------------------------------------------
  306. removeadapter = +
  307. OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_SoftwareBase)"\"$(Manufacturer) $(MAXIMUM_ALLOWED) ProductKey
  308. ifstr(i) $(ProductKey) != ""
  309. DeleteRegTree $(ProductKey) $(ProductTCPIPCUName)
  310. endif
  311. goto end
  312. ;-----------------------------------------------
  313. ; Upgrade Software section
  314. ;-----------------------------------------------
  315. UpgradeSoftware = +
  316. ; Upgrade software component
  317. ;
  318. OpenRegKey $(!REG_H_LOCAL) "" $(ProductKeyName) $(MAXIMUM_ALLOWED) KeyProduct
  319. Ifstr $(KeyProduct) != $(KeyNull)
  320. install "Install-Update"
  321. ifstr(i) $(STF_INSTALL_OUTCOME) != STF_SUCCESS
  322. goto fatal
  323. endif
  324. ;
  325. ; makesure a software type is defined
  326. ;
  327. SetRegValue $(KeyProduct) {SoftwareType,$(NoTitle),$(!REG_VT_SZ),$(SoftwareType)}
  328. ;
  329. ; makesure a Title is defined
  330. ;
  331. SetRegValue $(KeyProduct) {Title,$(NoTitle),$(!REG_VT_SZ),$(ProductTCPIPCUTitle)}
  332. ; Upgrade the version number
  333. ;
  334. SetRegValue $(KeyProduct) {MajorVersion,$(NoTitle),$(!REG_VT_SZ),$(ProductMajorVersion)}
  335. SetRegValue $(KeyProduct) {MinorVersion,$(NoTitle),$(!REG_VT_SZ),$(ProductMinorVersion)}
  336. ;
  337. ; do nothing for update
  338. ;
  339. CloseRegKey $(KeyProduct)
  340. else
  341. ;
  342. ; Cannot Open software key, goto ERROR
  343. ;
  344. goto fatalregistry
  345. endif
  346. goto end
  347. ;
  348. ; End of Upgrade Software
  349. ;
  350. ;
  351. ; Escape hatches
  352. ;
  353. successful = +
  354. goto end
  355. ;
  356. ; info display
  357. ;
  358. infomsg =+
  359. read-syms InfoDlg
  360. ui start "Warning"
  361. set CommonStatus = STATUS_USERCANCEL
  362. goto end
  363. ;
  364. ; warning display
  365. ;
  366. warning = +
  367. Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), "WARNING", $(Error)
  368. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  369. goto ShellCodeError
  370. endif
  371. ifstr(i) $($R1) == "OK"
  372. goto $(to)
  373. else-ifstr(i) $($R1) == "CANCEL"
  374. goto $(from)
  375. else
  376. ; Debug-Msg "Error Error Bad DLGEVENT"
  377. goto "end"
  378. endif
  379. ;
  380. ; non fatal error display
  381. ;
  382. nonfatalinfo = +
  383. Set CommonStatus = STATUS_USERCANCEL
  384. Set Severity = STATUS
  385. goto nonfatalmsg
  386. nonfatal = +
  387. Set Severity = NONFATAL
  388. goto nonfatalmsg
  389. nonfatalmsg = +
  390. ifstr(i) $(Error) == ""
  391. Set Severity = NONFATAL
  392. Shell $(UtilityInf) RegistryErrorString "SETUP_FAIL"
  393. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  394. goto ShellCodeError
  395. endif
  396. set Error = $($R0)
  397. endif
  398. Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), $(Severity), $(Error)
  399. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  400. goto ShellCodeError
  401. endif
  402. ifstr(i) $($R1) == "OK"
  403. goto $(from)
  404. else
  405. goto "end"
  406. endif
  407. ;
  408. ; Registry is broken
  409. ;
  410. fatalregistry = +
  411. Shell $(UtilityInf) RegistryErrorString $(RegistryErrorIndex)
  412. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  413. goto ShellCodeError
  414. endif
  415. set Error = $($R0)
  416. goto fatal
  417. ;
  418. ; fatal error display
  419. ;
  420. fatal = +
  421. ifstr(i) $(Error) == ""
  422. Shell $(UtilityInf) RegistryErrorString "SETUP_FAIL"
  423. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  424. goto ShellCodeError
  425. endif
  426. set Error = $($R0)
  427. endif
  428. Ifint $(BillboardVisible) != 0
  429. Shell "subroutn.inf" PopBillboard
  430. Set BillboardVisible = 0
  431. Endif
  432. Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), "FATAL", $(Error)
  433. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  434. goto ShellCodeError
  435. endif
  436. goto setfailed
  437. ;
  438. ; Shelling error
  439. ;
  440. ShellCodeError = +
  441. set DlgType = "MessageBox"
  442. set STF_MB_TITLE = $(ShellCodeErrorTitle)
  443. set STF_MB_TEXT = $(ShellCodeErrorText)
  444. set STF_MB_TYPE = 1
  445. set STF_MB_ICON = 3
  446. set STF_MB_DEF = 1
  447. ui start "Error Message"
  448. goto setfailed
  449. setfailed = +
  450. set CommonStatus = STATUS_FAILED
  451. ;
  452. ; If OEM_ABANDON_ON, we need to clean up the registry
  453. ;
  454. ifstr(i) $(OEM_ABANDON_ON) == TRUE
  455. set OEM_ABANDON_ON = FALSE
  456. goto removeadapter
  457. endif
  458. goto end
  459. end = +
  460. goto term
  461. term = +
  462. Return $(CommonStatus)
  463. ;***************************************************************
  464. ; Get File Size SECTIONS
  465. ;***************************************************************
  466. [GetFilesSize]
  467. set FileSizeList = ^(Files-TCPIPEXE,3)
  468. set TotalSize = 0
  469. ForListDo $(FileSizeList)
  470. Split-String $($) "=" SplitString
  471. set Size = *($(SplitString),3)
  472. set-add TotalSize = $(TotalSize) $(Size)
  473. EndForListDo
  474. set-div SizeInK = $(TotalSize) 1024
  475. return $(SizeInK)
  476. ;***************************************************************
  477. ; INSTALL SECTIONS
  478. ;***************************************************************
  479. [Install-Option]
  480. set STF_VITAL = ""
  481. ; required file for adding startmenu items during install
  482. Debug-Output "OEMNSVCU.INF: Copy Single File "$(SrcDir)\telnet.exe" to "$(!STF_WINDOWSSYSPATH)\telnet.exe
  483. LibraryProcedure STATUS,$(!NCPA_HANDLE), CopySingleFile $(!STF_HWND) $(SrcDir)\telnet.exe $(!STF_WINDOWSSYSPATH)\telnet.exe
  484. ifstr(i) $(AddCopy) == "YES"
  485. ;
  486. ; Add the files to the copy list
  487. ;
  488. AddSectionFilesToCopyList Files-TCPIPEXE $(SrcDir) $(!STF_WINDOWSSYSPATH)
  489. endif
  490. ifstr(i) $(DoCopy) == "YES"
  491. ;
  492. ; Copy files in the copy list
  493. ;
  494. set !STF_NCPA_FLUSH_COPYLIST = TRUE
  495. Debug-Output "OEMNSVCU.INF: *** CopyFilesInCopyList [2]"
  496. CopyFilesInCopyList
  497. endif
  498. ifstr(i) $(DoConfig) == "YES"
  499. ;
  500. ; Add product to registry
  501. ;
  502. ;
  503. ; Finish up
  504. endif
  505. Exit
  506. [Install-Update]
  507. set STF_VITAL = ""
  508. set STF_OVERWRITE = "VERIFYSOURCEOLDER"
  509. ;set STF_VERSION = "YES"
  510. AddSectionFilesToCopyList Files-TCPIPEXE $(SrcDir) $(!STF_WINDOWSSYSPATH)
  511. Debug-Output "OEMNSVCU.INF: *** CopyFilesInCopyList [3]"
  512. Exit
  513. [AddTelnet]
  514. read-syms FileConstants$(!STF_LANGUAGE)
  515. read-syms GeneralConstants
  516. OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_SoftwareBase)"\Microsoft\TcpipCU" $(MAXIMUM_ALLOWED) ProductKey
  517. ifstr(i) $(ProductKey) != ""
  518. install "Install-Telnet"
  519. CloseRegKey $(ProductKey)
  520. endif
  521. return
  522. [Install-Telnet]
  523. CreateProgManGroup $(GroupName), ""
  524. RemoveProgManItem $(GroupName), $(IconName)
  525. CreateProgManItem $(GroupName), $(IconName), telnet.exe, telnet.exe, ""
  526. ShowProgManGroup $(GroupName), 6
  527. exit