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.

1569 lines
50 KiB

  1. ;------------------------------------------------------------------------
  2. ; Copyright(c) 1992-93 Microsoft Corporation
  3. ;
  4. ; Services for Macintosh Admin Tools Kit
  5. ;
  6. ; Author: KrishG
  7. ;
  8. ; Modification History: Adopted from the Resource Kit for Windows NT
  9. ;
  10. ;------------------------------------------------------------------------
  11. [Identification]
  12. OptionType = NetTransport
  13. [Options]
  14. ; we don't want to allow the admin tool option in Windows NT
  15. ; SFMADM
  16. ATALK
  17. [GeneralConstants]
  18. UtilInf = "UTILITY.INF"
  19. SubInf = "SUBROUTN.INF"
  20. !KeyNull = ""
  21. !ACCESS = 33554432
  22. !SERVICE_NO_CHANGE = 4294967295
  23. RegistryErrorIndex = NO_ERROR
  24. KeyProduct = ""
  25. KeyParameters = ""
  26. TRUE = 1
  27. FALSE = 0
  28. NoTitle = 0
  29. ; !DebugOutputControl = 0
  30. ProductInfName = "oemnxpsm.inf"
  31. [FileConstants]
  32. Manufacturer = "Microsoft"
  33. ProductMajorVersion = "4"
  34. ProductMinorVersion = "0"
  35. ProductVersion = $(ProductMajorVersion)"."$(ProductMinorVersion)
  36. SFMKeyName = $(!NTN_SoftwareBase)"\"$(Manufacturer)"\SFM\CurrentVersion"
  37. ATALKKeyName = $(!NTN_SoftwareBase)"\"$(Manufacturer)"\AppleTalk\CurrentVersion"
  38. ProductOpSupport = 134 ; 0x0086 ; Display,Removable,Properties,Not Updatable
  39. ; flag indicates AppleTalk has been installed for the first time.
  40. IsInitialInstall = 0
  41. SFMUnattended = 0
  42. ;------------------------------------------------------------------------
  43. ; Performance data
  44. ;------------------------------------------------------------------------
  45. AtalkPerfLibraryName = "atkctrs.dll"
  46. AtalkPerfOpenFunction = "OpenAtkPerformanceData"
  47. AtalkPerfCloseFunction = "CloseAtkPerformanceData"
  48. AtalkPerfCollectFunction = "CollectAtkPerformanceData"
  49. AtalkCounterFileName = "atkctrs.ini"
  50. AtalkEventLogName = "atkctrs"
  51. !PerfKeyName = "Performance"
  52. ;------------------------------------------------------------------------
  53. ; Dll And File Names
  54. ;---------------------------------------------------------------------
  55. UtilDll = "sfmutil.dll"
  56. ResDll = "sfmres.dll"
  57. NtNetIniFileName = $(!STF_WINDOWSSYSPATH)"\ntnet.ini"
  58. WinFileIniFileName = $(!STF_WINDOWSSYSPATH)"\winfile.ini"
  59. AfpMgrCplFile = "sfmmgr.cpl"
  60. SrvMgrIniSection = "SMAddons"
  61. WinFileIniSection = "Addons"
  62. AtWinSockDll = "sfmwshat.dll"
  63. !EventLogKey = $(!NTN_ServiceBase)"\EventLog\Application"
  64. ;---------------------------------------------------------------------
  65. ; AppleTalk Transport Product Descriptions /Net Rules
  66. ;---------------------------------------------------------------------
  67. ProductATALKName = "AppleTalk"
  68. ProductATALKImagePath = "%SystemRoot%\system32\drivers\sfmatalk.sys"
  69. ProductATALKSvcType = "kernel"
  70. ProductATALKType = "transport"
  71. ProductATALKEventDll = "%SystemRoot%\system32\sfmatmsg.dll"
  72. NetRuleATALKType = "appletalk appletalktransport"
  73. NetRuleATALKUse = $(ProductATALKType)" none none"
  74. NetRuleATALKBindForm = """appletalk"" yes yes container"
  75. NetRuleATALKClass = {"appletalktransport basic "}
  76. NetRuleATALKBindList = {"appletalktransport ndisDriver non non 100", +
  77. "appletalktransport ltkndisDriver non exclusive 100" }
  78. [Identify]
  79. read-syms Identification
  80. set Status = STATUS_SUCCESSFUL
  81. set Identifier = $(OptionType)
  82. set Media = #("Source Media Descriptions", 1, 1)
  83. Return $(Status) $(Identifier) $(Media)
  84. [ReturnOptions]
  85. set Status = STATUS_FAILED
  86. set OptionList = {}
  87. set OptionTextList = {}
  88. set LanguageList = ^(LanguagesSupported, 1)
  89. Ifcontains(i) $($0) in $(LanguageList)
  90. goto returnoptions
  91. else
  92. set Status = STATUS_NOLANGUAGE
  93. goto finish_ReturnOptions
  94. endif
  95. returnoptions = +
  96. set OptionList = ^(Options, 1)
  97. set OptionTextList = ^(OptionsText$($0), 1)
  98. set Status = STATUS_SUCCESSFUL
  99. finish_ReturnOptions = +
  100. Return $(Status) $(OptionList) $(OptionTextList)
  101. [date]
  102. Now = {} ? $(!LIBHANDLE) GetSystemDate
  103. [InstallOption]
  104. set Status = STATUS_FAILED
  105. set Option = $($1)
  106. set SrcDir = $($2)
  107. Set AddCopy = $($3)
  108. Set DoCopy = $($4)
  109. Set DoConfig = $($5)
  110. set LanguageList = ^(LanguagesSupported, 1)
  111. Ifcontains(i) $($0) NOT-IN $(LanguageList)
  112. return STATUS_NOLANGUAGE
  113. EndIf
  114. detect date
  115. set-subst LF = "\n"
  116. set-subst CR = "\r"
  117. read-syms GeneralConstants
  118. read-syms FileConstants
  119. read-syms DialogConstants$(!STF_LANGUAGE)
  120. read-syms FileConstants$(!STF_LANGUAGE)
  121. set-title $(FunctionTitle)
  122. set CommonStatus = STATUS_SUCCESSFUL
  123. Begin = +
  124. IfStr(i) $(!NTN_InstallMode) == deinstall
  125. Set StartLabel = RemoveAdmin
  126. Set REMOVE_SOFTWARE = {}
  127. Set REMOVE_SOFTWARE = >($(REMOVE_SOFTWARE), $(Product$(Option)Name))
  128. else-Ifstr(i) $(!NTN_InstallMode) == Update
  129. set StartLabel = UpgradeAdmin
  130. else-Ifstr(i) $(!NTN_InstallMode) == configure
  131. goto configureadmin
  132. else-Ifstr(i) $(!NTN_InstallMode) == bind
  133. goto BindingsSfm
  134. else-Ifstr(i) $(!NTN_InstallMode) == install
  135. set StartLabel = InstallAdmin
  136. else
  137. Set StartLabel = end
  138. endif
  139. goto $(StartLabel)
  140. ;------------------------------------------------------------------
  141. ; Install the product
  142. ;------------------------------------------------------------------
  143. InstallAdmin = +
  144. StartWait
  145. Set FLibraryErrCtl = 1
  146. ; Detect if SFM is already installed
  147. Set ProductTextName = $(Product$(Option)Name)
  148. OpenRegKey $(!REG_H_LOCAL) "" $(SFMKeyName) $(!ACCESS) KeyProduct
  149. Ifstr $(KeyProduct) != $(!KeyNull)
  150. GetRegValue $(KeyProduct) "MajorVersion" VersionInfo
  151. set VersionMajor = *($(VersionInfo), 4)
  152. GetRegValue $(KeyProduct) "MinorVersion" VersionInfo
  153. set VersionMinor = *($(VersionInfo), 4)
  154. set InstalledVersion = $(VersionMajor)"."$(VersionMinor)
  155. ifstr(i) $(ProductVersion) == $(InstalledVersion)
  156. read-syms SfmAlreadyInstalled$(!STF_LANGUAGE)
  157. Set Text = $(Version)$(ProductVersion)
  158. Shell $(SubInf), SetupMessage $(!STF_LANGUAGE) "NONFATAL" $(Text)$(ErrorString)
  159. goto end
  160. EndIf
  161. EndIf
  162. ; Detect if AppleTalk is already installed. If installed, ask the user to
  163. ; use the update option. Otherwise ask the user to input the
  164. ; location of the SFM files
  165. OpenRegKey $(!REG_H_LOCAL) "" $(ATALKKeyName) $(!ACCESS) KeyProduct
  166. Ifstr $(KeyProduct) != $(!KeyNull)
  167. GetRegValue $(KeyProduct) "MajorVersion" VersionInfo
  168. set VersionMajor = *($(VersionInfo), 4)
  169. GetRegValue $(KeyProduct) "MinorVersion" VersionInfo
  170. set VersionMinor = *($(VersionInfo), 4)
  171. set InstalledVersion = $(VersionMajor)"."$(VersionMinor)
  172. ifstr(i) $(ProductVersion) == $(InstalledVersion)
  173. read-syms MiscErrorString1$(!STF_LANGUAGE)
  174. Set Text = $(Version)$(ProductVersion)$(OF)$(ProductTextName)
  175. Shell $(SubInf), SetupMessage $(!STF_LANGUAGE) "NONFATAL" $(Text)$(ErrorString)
  176. goto end
  177. EndIf
  178. EndIf
  179. ifstr(i) $(!NTN_InstallMode) == "install"
  180. Ifstr(i) $(!DoCopy) == "YES"
  181. Shell $(UtilInf), DoAskSource, $(!STF_CWDDIR), $(SrcDir) YES
  182. Ifint $($ShellCode) != $(!SHELL_CODE_OK)
  183. Goto ShellCodeError
  184. Else-Ifstr(i) $($R0) == STATUS_FAILED
  185. Shell $(UtilInf) RegistryErrorString "ASK_SOURCE_FAIL"
  186. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  187. goto ShellCodeError
  188. endif
  189. set Error = $($R0)
  190. Goto end
  191. Else-Ifstr(i) $($R0) == STATUS_USERCANCEL
  192. Goto end
  193. Endif
  194. Set SrcDir = $($R1)
  195. Endif
  196. Endif
  197. CopyAdminFiles = +
  198. install "Install-Initial"
  199. ifstr(i) $(STF_INSTALL_OUTCOME) != STF_SUCCESS
  200. Shell "" RemoveAdminFiles "INSTALL"
  201. goto usercancel
  202. endif
  203. StartInstall = +
  204. Set REMOVE_FLAG = TRUE
  205. Set REMOVE_SOFTWARE = {}
  206. Ifstr(i) $(Option) == "SFMADM"
  207. Set REMOVE_SOFTWARE = >($(REMOVE_SOFTWARE),$(Product$(Option)Name))
  208. Shell $(UtilInf), InstallSoftwareProduct, $(Manufacturer),$(Product$(Option)Name), $(ProductInfName)
  209. ifint $(ShellCode) != 0
  210. goto ShellCodeError
  211. endif
  212. set RegistryErrorIndex = $($R0)
  213. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  214. CloseRegKey $($R1)
  215. CloseRegKey $($R2)
  216. goto fatalregistry
  217. Endif
  218. Set AdminProductKey = $($R1)
  219. Set AdminNetRuleKey = $($R2)
  220. ; set product key information in the registry
  221. set NewValueList = +
  222. {{Infname,0,$(!REG_VT_SZ),$(ProductInfName)},+
  223. {Title,0,$(!REG_VT_SZ), $(Product$(Option)Title)},+
  224. {Description,$(NoTitle),$(!REG_VT_SZ),$(Product$(Option)Description)},+
  225. {OperationsSupport,$(NoTitle),$(!REG_VT_DWORD),$(ProductOpSupport)},+
  226. {MajorVersion,0,$(!REG_VT_DWORD),$(ProductMajorVersion)},+
  227. {MinorVersion,0,$(!REG_VT_DWORD),$(ProductMinorVersion)},+
  228. {InstallDate,0,$(!REG_VT_DWORD),*($(Now),1)}}
  229. Shell $(UtilInf), AddValueList, $(AdminProductKey), $(NewValueList)
  230. ifint $(ShellCode) != 0
  231. goto ShellCodeError
  232. endif
  233. set RegistryErrorIndex = $($R0)
  234. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  235. CloseRegKey $(AdminProductKey)
  236. CloseRegKey $(AdminNetRuleKey)
  237. goto fatalregistry
  238. endif
  239. Set NewValueList = {{InfOption,$(NoTitle),$(!REG_VT_SZ),$(Option)}, +
  240. {Infname,$(NoTitle),$(!REG_VT_SZ),$(ProductInfName)}}
  241. Shell $(UtilInf), AddValueList, $(AdminNetRuleKey), $(NewValueList)
  242. ifint $(ShellCode) != 0
  243. goto ShellCodeError
  244. endif
  245. set RegistryErrorIndex = $($R0)
  246. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  247. CloseRegKey $(AdminProductKey)
  248. CloseRegKey $(AdminNetRuleKey)
  249. goto fatalregistry
  250. Endif
  251. CloseRegKey $(AdminProductKey)
  252. CloseRegKey $(AdminRuleKey)
  253. LoadLibrary "x" $(!STF_CWDDIR)sfmutil.dll !UTILHANDLE
  254. Debug-Output "Load Util Library"
  255. ; WRITE Private Profile String in NTNET.INI
  256. Set IniFile = $(NtNetIniFileName)
  257. Set IniString = $(AfpMgrCplFile)
  258. Set IniSection = $(SrvMgrIniSection)
  259. Debug-Output "Ini File = "$(IniFile)
  260. Debug-Output "Ini String = "$(IniString)
  261. Debug-Output "Ini Section = "$(IniSection)
  262. Set FLibraryErrCtl = 1
  263. LibraryProcedure IniStatus $(!UTILHANDLE) WriteAfpMgrIniStrings, $(IniSection), $(IniString), $(IniFile)
  264. Set FLibraryErrCtl = 0
  265. ifstr(i) $(IniStatus) == "FAILED"
  266. read-syms AFPString3$(!STF_LANGUAGE)
  267. shell $(SubInf) SetupMessage $(!STF_LANGUAGE) "NONFATAL" $(ErrorString)
  268. EndIf
  269. ; Do the same thing for File Manager
  270. Set IniFile = $(WinFileIniFileName)
  271. Set IniString = $(AfpMgrCplFile)
  272. Set IniSection = $(WinFileIniSection)
  273. Set FLibraryErrCtl = 1
  274. LibraryProcedure IniStatus $(!UTILHANDLE) WriteAfpMgrIniStrings, $(IniSection), $(IniString), $(IniFile)
  275. Set FLibraryErrCtl = 0
  276. ifstr(i) $(IniStatus) == "FAILED"
  277. read-syms AFPString2$(!STF_LANGUAGE)
  278. shell $(SubInf) SetupMessage $(!STF_LANGUAGE) "NONFATAL" $(ErrorString)
  279. EndIf
  280. FreeLibrary $(!UTILHANDLE)
  281. EndIf
  282. Ifstr(i) $(Option) == "ATALK"
  283. Set ThisOption = ATALK
  284. Set REMOVE_SOFTWARE = >($(REMOVE_SOFTWARE), $(Product$(ThisOption)Name))
  285. LoadLibrary "x" $(!STF_CWDDIR)sfmutil.dll !UTILHANDLE
  286. Set Atalk_DependList = {""}
  287. Set FLibraryErrCtl = 1
  288. Shell $(UtilInf), AddSoftwareComponent,+
  289. $(Manufacturer), +
  290. $(Product$(ThisOption)Name),+
  291. $(Product$(ThisOption)Name), +
  292. $(Product$(ThisOption)DisplayName), +
  293. $(ProductInfName),+
  294. $(Product$(ThisOption)ImagePath),+
  295. "kernelautostart", "PNP_TDI",+
  296. $(Atalk_DependList), "",+
  297. $(Product$(ThisOption)EventDll)
  298. Set FLibraryErrCtl = 0
  299. Set RegistryErrorIndex = $($R0)
  300. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  301. CloseRegKey $($R1)
  302. CloseRegKey $($R2)
  303. CloseRegKey $($R3)
  304. CloseRegKey $($R4)
  305. CloseRegKey $($R5)
  306. goto fatalregistry
  307. EndIf
  308. ; At this point:
  309. ; $R1 contains the product version key handle;
  310. ; $R2 contains the NetRules subkey handle;
  311. ; $R3 contains the new Services key handle; and
  312. ; $R4 contains the Parameters key
  313. ; $R5 contains the Linkage Key
  314. ;
  315. Set AtkVersKey = $($R1)
  316. Set AtkNetRuleKey = $($R2)
  317. Set AtkSvcKey = $($R3)
  318. Set AtalkParameters = $($R4)
  319. Set AtkLinkageKey = $($R5)
  320. set NewValueList = +
  321. {{SoftwareType,0,$(!REG_VT_SZ),$(Product$(ThisOption)Type)},+
  322. {Title,0,$(!REG_VT_SZ),$(Product$(ThisOption)Title)},+
  323. {Description,0,$(!REG_VT_SZ),$(Product$(ThisOption)Description)},+
  324. {OperationsSupport,$(NoTitle),$(!REG_VT_DWORD),$(ProductOpSupport)},+
  325. {PathName,0,$(!REG_VT_SZ),$(!STF_WINDOWSSYSPATH)},+
  326. {ServiceName,0,$(!REG_VT_SZ),$(Product$(ThisOption)Name)},+
  327. {MajorVersion, 0, $(!REG_VT_DWORD),$(ProductMajorVersion)},+
  328. {MinorVersion, 0, $(!REG_VT_DWORD),$(ProductMinorVersion)},+
  329. {Review,0,$(!REG_VT_DWORD),1},+
  330. {InstallDate,0,$(!REG_VT_DWORD),*($(Now),1)}}
  331. Shell $(UtilInf), AddValueList, $(AtkVersKey), $(NewValueList)
  332. set RegistryErrorIndex = $($R0)
  333. Ifstr $(RegistryErrorIndex) != NO_ERROR
  334. CloseRegKey $(AtkVersKey)
  335. CloseRegKey $(AtkNetRuleKey)
  336. CloseRegKey $(AtkSvcKey)
  337. CloseRegKey $(AtkLinkageKey)
  338. CloseRegKey $(AtalkParameters)
  339. goto fatalregistry
  340. EndIf
  341. set NewValueList = +
  342. {{type,0,$(!REG_VT_SZ),$(NetRule$(ThisOption)Type)}, +
  343. {use,0,$(!REG_VT_SZ),$(NetRule$(ThisOption)Use)}, +
  344. {bindform,0,$(!REG_VT_SZ),$(NetRule$(ThisOption)BindForm)}, +
  345. {class,0, $(!REG_VT_MULTI_SZ),$(NetRule$(ThisOption)Class)}, +
  346. {bindable,0, $(!REG_VT_MULTI_SZ), $(NetRule$(ThisOption)BindList)},+
  347. {InfOption,0,$(!REG_VT_SZ),$(Option)}, +
  348. {Infname,0,$(!REG_VT_SZ),$(ProductInfName)} }
  349. Shell $(UtilInf), AddValueList, $(AtkNetRuleKey), $(NewValueList)
  350. set RegistryErrorIndex = $($R0)
  351. Ifstr $(RegistryErrorIndex) != NO_ERROR
  352. CloseRegKey $(AtkVersKey)
  353. CloseRegKey $(AtkNetRuleKey)
  354. CloseRegKey $(AtkSvcKey)
  355. CloseRegKey $(AtkLinkageKey)
  356. CloseRegKey $(AtalkParameters)
  357. goto fatalregistry
  358. EndIf
  359. ;
  360. ; Create the Adapters Key
  361. ; CODEWORK - Localize ?
  362. ;
  363. CreateRegKey $(AtkSvcKey), {"Adapters",0,GenericClass},+
  364. "", $(!ACCESS), "" , KeyAdapters
  365. ; write global parameters
  366. Set DesiredZone = ""
  367. Set UnattendInstallMode = 0
  368. Ifstr(i) $(!STF_UNATTENDED) == YES
  369. set UnattendInstallMode = 1
  370. Debug-Output "ATSETUP: UnattendInstallMode(1) = "$(UnattendInstallMode)
  371. endif
  372. Ifstr(i) $(!STF_GUI_UNATTENDED) == YES
  373. set UnattendInstallMode = 1
  374. Debug-Output "ATSETUP: UnattendInstallMode(2) = "$(UnattendInstallMode)
  375. endif
  376. set NewValueList = +
  377. {{EnableRouter,0,$(!REG_VT_DWORD),0},+
  378. {InitialInstall,0, $(!REG_VT_DWORD),1},+
  379. {Unattended,0, $(!REG_VT_DWORD),$(UnattendInstallMode)},+
  380. {DesiredZone,0,$(!REG_VT_SZ),$(DesiredZone)}}
  381. Shell $(UtilInf), AddValueList, $(AtalkParameters), $(NewValueList)
  382. set RegistryErrorIndex = $($R0)
  383. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  384. CloseRegKey $(KeyAdapters)
  385. goto fatalregistry
  386. EndIf
  387. ; Add WinSock Support to AppleTalk
  388. Set WinAtalkDll = "%SystemRoot%\System32\"$(AtWinSockDll)
  389. Set MaxSockAddrLen = 8
  390. Set MinSockAddrLen = 6
  391. Shell $(UtilInf) AddWinsockInfo $(Product$(ThisOption)Name), +
  392. $(WinAtalkDll), +
  393. $(MaxSockAddrLen),+
  394. $(MinSockAddrLen)
  395. ifstr(i) $($R0) != NO_ERROR
  396. read-syms AtalkString1$(!STF_LANGUAGE)
  397. Shell $(SubInf) SetupMessage $(!STF_LANGUAGE) "NONFATAL" $(ErrorString)
  398. Endif
  399. ; Add the performance data to the AppleTalk\performance service key
  400. Shell "" CreatePerfKey $(AtkSvcKey) $(AtalkPerfLibraryName) +
  401. $(AtalkCounterFileName) $(AtalkPerfOpenFunction) +
  402. $(AtalkPerfCloseFunction) $(AtalkPerfCollectFunction)
  403. Ifstr(i) $($R0) != STATUS_SUCCESSFUL
  404. Set RegistryErrorIndex = $($R1)
  405. goto fatalregistry
  406. EndIf
  407. ; Add the performance dll to the EventLog
  408. Shell "" CreateEventLogKey $(AtalkEventLogName) $(AtalkPerfLibraryName)
  409. Ifstr(i) $($R0) != STATUS_SUCCESSFUL
  410. Set RegistryErrorIndex = $($R1)
  411. goto fatalregistry
  412. EndIf
  413. ; close all open keys
  414. CloseRegKey $(AtkVersKey)
  415. CloseRegKey $(AtkNetRuleKey)
  416. CloseRegKey $(AtkSvcKey)
  417. CloseRegKey $(AtkLinkageKey)
  418. CloseRegKey $(AtalkParameters)
  419. CloseRegKey $(KeyAdapters)
  420. ; Add the AppleTalk print monitor
  421. Shell "" AddPrintMonitor $(!NTN_InstallMode)
  422. Shell "utility.inf" AddRpcProtocol ncacn_at_dsp rpclt1.dll rpclt1.dll
  423. EndIf
  424. goto successful
  425. Bindingssfm = +
  426. Set DefaultPortRemoved = FALSE
  427. ; remove all service dependencies of AppleTalk on Adapters (leaving only
  428. ; the group dependency). This is needed so that if there are two net cards
  429. ; on the system and one fails to load (docking station scenario), then
  430. ; AppleTalk will still be able to start.
  431. Shell "" RemoveAllServiceDependencies "AppleTalk"
  432. OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_ServiceBase)"\AppleTalk\Linkage" $(!ACCESS) LinkageKey
  433. Ifstr(i) $(LinkageKey) == $(!KeyNull)
  434. Set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  435. Goto fatalregistry
  436. Endif
  437. OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_ServiceBase)"\AppleTalk\Parameters" $(!ACCESS) BindParmKey
  438. Ifstr(i) $(BindParmKey) == $(!KeyNull)
  439. Set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  440. Goto fatalregistry
  441. Endif
  442. Set BindList = {}
  443. Set ExportList = {}
  444. Set RouteList = {}
  445. GetRegValue $(LinkageKey) "Bind" BindList
  446. GetRegValue $(LinkageKey) "Export" ExportList
  447. GetRegValue $(LinkageKey) "Route" RouteList
  448. GetRegValue $(LinkageKey) "Exclude" ExcludeList
  449. QueryListSize BindCount $(BindList)
  450. IfInt $(BindCount) == 0
  451. Goto endbinding
  452. Endif
  453. set NewBindList = {}
  454. set NewExportList = {}
  455. set NewRouteList = {}
  456. ForListDo *($(BindList),4)
  457. Split-String $($), "\", BindInfo
  458. set NewBindList = >($(NewBindList), *($(BindInfo),4))
  459. EndForListDo
  460. ForListDo *($(ExportList),4)
  461. set NewExportList = >($(NewExportList), $($))
  462. EndForListDo
  463. ForListDo *($(RouteList),4)
  464. set NewRouteList = >($(NewRouteList), $($))
  465. EndForListDo
  466. ForListDo *($(ExcludeList),4)
  467. set NewExcludeList = >($(NewExcludeList), $($))
  468. EndForListDo
  469. OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_ServiceBase)"\AppleTalk\Adapters" $(!ACCESS) AdapterKey
  470. Ifstr(i) $(AdapterKey) == $(!KeyNull)
  471. Set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  472. Goto fatalregistry
  473. Endif
  474. set AdapterList = ""
  475. EnumRegKey $(AdapterKey) AdapterList
  476. Set AtalkAdapterList = {}
  477. ForListDo $(AdapterList)
  478. Set AtalkAdapterList = >($(AtalkAdapterList), *($($),1))
  479. EndForListDo
  480. QueryListSize AdapterCount $(AtalkAdapterList)
  481. Set fAddingFirstAdapter = FALSE
  482. ifint $(AdapterCount) == 0
  483. Set fAddingFirstAdapter = TRUE
  484. EndIf
  485. Set NewBindings = ""
  486. Set TobeUsedBindList = {}
  487. Set TobeUsedExportList = {}
  488. Set TobeUsedRouteList = {}
  489. ForListDo $(NewBindList)
  490. IfContains(i) $($) not-in $(AtalkAdapterList)
  491. Set NewBindings = TRUE
  492. Set TobeUsedBindList = >($(TobeUsedBindList),"\Device\"$($))
  493. Set TobeUsedExportList = >($(TobeUsedExportList),*($(NewExportList),$(#)))
  494. Set TobeUsedRouteList = >($(TobeUsedRouteList),*($(NewRouteList),$(#)))
  495. Shell "" CreateAtalkConfig $($) $(AdapterKey)
  496. Ifstr(i) $($R0) != STATUS_SUCCESSFUL
  497. CloseRegKey $(AdapterKey)
  498. Set RegistryErrorIndex = $($R1)
  499. goto fatalregistry
  500. EndIf
  501. Else
  502. Set TobeUsedBindList = >($(TobeUsedBindList),"\Device\"$($))
  503. Set TobeUsedExportList = >($(TobeUsedExportList),*($(NewExportList),$(#)))
  504. Set TobeUsedRouteList = >($(TobeUsedRouteList),*($(NewRouteList),$(#)))
  505. Endif
  506. EndForListDo
  507. set NewValueList = {{Bind,0,$(!REG_VT_MULTI_SZ),$(TobeUsedBindList)}, +
  508. {Export,0,$(!REG_VT_MULTI_SZ),$(TobeUsedExportList)}, +
  509. {Route,0,$(!REG_VT_MULTI_SZ),$(TobeUsedRouteList)}}
  510. Ifstr(i) $(NewBindings) == TRUE
  511. Shell $(UtilInf), AddValueList, $(LinkageKey), $(NewValueList)
  512. set RegistryErrorIndex = $($R0)
  513. CloseRegKey $(LinkageKey)
  514. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  515. goto fatalregistry
  516. EndIf
  517. EndIf
  518. ; Add the Default Port
  519. Set DefaultPort = {}
  520. Set MediaTypeList = {}
  521. GetRegValue $(BindParmKey) "DefaultPort" DefaultPort
  522. Ifstr(i) $(DefaultPort) != {}
  523. goto removeadapters
  524. EndIf
  525. finddefaultport = +
  526. ForListDo $(TobeUsedBindList)
  527. Split-String $($) "\" PortName
  528. Shell "" FindMediaType *($(PortName),4)
  529. Ifstr(i) $($R0) == STATUS_SUCCESSFUL
  530. Set MediaTypeList = >($(MediaTypeList), $($R1))
  531. EndIf
  532. EndForListDo
  533. Ifcontains(i) "1" in $(MediaTypeList)
  534. ForListDo $(MediaTypeList)
  535. Ifint $($) == 1
  536. Set DefaultPort = *($(TobeUsedBindList),$(#))
  537. goto defportdone
  538. EndIf
  539. EndForListDo
  540. else-ifcontains(i) "2" in $(MediaTypeList)
  541. ForListDo $(MediaTypeList)
  542. Ifint $($) == 2
  543. Set DefaultPort = *($(TobeUsedBindList),$(#))
  544. goto defportdone
  545. EndIf
  546. EndForListDo
  547. else-ifcontains(i) "3" in $(MediaTypeList)
  548. ForListDo $(MediaTypeList)
  549. Ifint $($) == 3
  550. Set DefaultPort = *($(TobeUsedBindList),$(#))
  551. goto defportdone
  552. EndIf
  553. EndForListDo
  554. else-ifcontains(i) "4" in $(MediaTypeList)
  555. ForListDo $(MediaTypeList)
  556. Ifint $($) == 4
  557. Set DefaultPort = *($(TobeUsedBindList),$(#))
  558. goto defportdone
  559. EndIf
  560. EndForListDo
  561. else-ifcontains(i) "5" in $(MediaTypeList)
  562. Set DefaultPort = *($(TobeUsedBindList),1)
  563. else
  564. read-syms NoAdaptersFound$(!STF_LANGUAGE)
  565. Shell $(SubInf) SetupMessage, $(!STF_LANGUAGE), "FATAL", $(ErrorString)
  566. goto endbinding
  567. Endif
  568. defportdone = +
  569. Set NewValueList = {{DefaultPort,0,$(!REG_VT_SZ),$(DefaultPort)}}
  570. Shell $(UtilInf), AddValueList, $(BindParmKey), $(NewValueList)
  571. set RegistryErrorIndex = $($R0)
  572. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  573. goto fatalregistry
  574. EndIf
  575. goto startconfig
  576. removeadapters = +
  577. Split-String *($(DefaultPort),4) "\" PortName
  578. ForListDo $(AtalkAdapterList)
  579. Ifcontains(i) $($) not-in $(NewBindList)
  580. DeleteRegKey $(AdapterKey) $($)
  581. Ifstr(i) $($) == *($(PortName),4)
  582. read-syms RemoveDefaultPort$(!STF_LANGUAGE)
  583. Shell $(SubInf) SetupMessage $(!STF_LANGUAGE) "FATAL" $(ErrorString)
  584. Set DefaultPortRemoved = TRUE
  585. goto finddefaultport
  586. Endif
  587. EndIf
  588. EndForListDo
  589. ; if this is the first time configuration start appletalk and launch config
  590. ; if the default port has been removed and other adapters are available
  591. ; start appletalk
  592. startconfig = +
  593. Set DoConfig = 0
  594. GetRegValue $(BindParmKey) "InitialInstall" DoConfig
  595. Set IsInitialInstall = *($(DoConfig),4)
  596. Set DoUnattended = 0
  597. GetRegValue $(BindParmKey) "Unattended" DoUnattended
  598. Set SFMUnattended = *($(DoUnattended),4)
  599. Debug-Output "ATSETUP: SFMUnattended(start config)"$(SFMUnattended)
  600. Debug-Output "Config State = "$(DoConfig)
  601. Debug-Output "Unattend State = "$(DoUnattended)
  602. ifint $(IsInitialInstall) == 1
  603. goto startsvc
  604. EndIf
  605. ifstr(i) $(DefaultPortRemoved) == TRUE
  606. goto startsvc
  607. endif
  608. ifstr(i) $(fAddingFirstAdapter) == TRUE
  609. goto startsvc
  610. endif
  611. goto endbinding
  612. startsvc = +
  613. Set FLibraryErrCtl = 1
  614. read-syms StatusStartingAppleTalk$(!STF_LANGUAGE)
  615. Shell $(SubInf) PushBillBoard NETSTATUSDLG $(Status)
  616. StartWait
  617. Set WaitStarted = 1
  618. LibraryProcedure START_RESULT $(!NCPA_HANDLE), CPlSetup $(!STF_HWND), STARTSVC, AppleTalk
  619. Shell $(SubInf) PopBillBoard
  620. Set START_STATUS = *($(START_RESULT),1)
  621. Debug-Output "OEMNXPSM.INF: Start AppleTalk; result was: "$(START_STATUS)
  622. Ifint $(START_STATUS) != 0
  623. EndWait
  624. Set WaitStarted = 0
  625. LibraryProcedure START_RESULT $(!NCPA_HANDLE), CPlSetup $(!STF_HWND), ERRORMSG, $(START_STATUS)
  626. Set ATALK_ERROR_MESSAGE = *($(START_RESULT),2)
  627. read-syms CannotStartAtalk$(!STF_LANGUAGE)
  628. Set ErrorString = $(ATALK_ERROR_MESSAGE)$(ErrorSuffix)
  629. Shell $(SubInf) SetupMessage $(!STF_LANGUAGE) "FATAL" $(ErrorString)
  630. Else
  631. ; start the afd driver
  632. LibraryProcedure START_RESULT $(!NCPA_HANDLE), CPlSetup $(!STF_HWND), STARTSVC, Afd
  633. Set START_STATUS = *($(START_RESULT),1)
  634. Debug-Output "OEMNXPSM.INF: Start Afd result was: "$(START_STATUS)
  635. Ifint $(START_STATUS) != 0
  636. EndWait
  637. Set WaitStarted = 0
  638. LibraryProcedure START_RESULT $(!NCPA_HANDLE), CPlSetup $(!STF_HWND), ERRORMSG, $(START_STATUS)
  639. Set ATALK_ERROR_MESSAGE = *($(START_RESULT),2)
  640. read-syms CannotStartAfd$(!STF_LANGUAGE)
  641. Set ErrorString = $(ATALK_ERROR_MESSAGE)$(ErrorSuffix)
  642. Shell $(SubInf) SetupMessage $(!STF_LANGUAGE) "FATAL" $(ErrorString)
  643. goto endbinding
  644. EndIf
  645. ; Now start the NDIS group.
  646. LibraryProcedure START_RESULT $(!NCPA_HANDLE), CPlSetup $(!STF_HWND), STARTSVC, +NDIS
  647. Set START_STATUS = *($(START_RESULT),1)
  648. Debug-Output "OEMNXPSM.INF: Start +NDIS result was: "$(START_STATUS)
  649. Ifint $(START_STATUS) != 0
  650. EndWait
  651. Set WaitStarted = 0
  652. LibraryProcedure START_RESULT $(!NCPA_HANDLE), CPlSetup $(!STF_HWND), ERRORMSG, $(START_STATUS)
  653. Set ATALK_ERROR_MESSAGE = *($(START_RESULT),2)
  654. read-syms CannotStartAtalk$(!STF_LANGUAGE)
  655. Set ErrorString = $(ATALK_ERROR_MESSAGE)$(ErrorSuffix)
  656. Shell $(SubInf) SetupMessage $(!STF_LANGUAGE) "FATAL" $(ErrorString)
  657. goto endbinding
  658. EndIf
  659. ; Launch the AppleTalk Transport Configuration
  660. LoadLibrary "x" $(!STF_CWDDIR)sfmatcfg.dll ATHANDLE
  661. Set FLibraryErrCtl = 1
  662. Set atcfgresult = ""
  663. Debug-Output "ATSETUP: SFMUnattended(1)"$(SFMUnattended)
  664. LibraryProcedure atcfgresult, $(ATHANDLE),EnterAtalkConfigDLL $(!STF_HWND) $(IsInitialInstall) $(SFMUnattended)
  665. FreeLibrary $(ATHANDLE)
  666. ; reset registry values after initial install
  667. SetRegValue $(BindParmKey) {InitialInstall,0,$(!REG_VT_DWORD),0}
  668. SetRegValue $(BindParmKey) {Unattended,0,$(!REG_VT_DWORD),0}
  669. EndWait
  670. EndIf
  671. endbinding = +
  672. CloseRegKey $(BindParmKey)
  673. goto end
  674. ConfigureAdmin = +
  675. Ifstr(i) $(Option) == "SFMADM"
  676. read-syms CantConfigureADM$(!STF_LANGUAGE)
  677. Shell $(SubInf) SetupMessage, $(!STF_LANGUAGE), "NONFATAL",$(ErrorString)
  678. goto successful
  679. EndIf
  680. OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_ServiceBase)"\AppleTalk\Linkage" $(!ACCESS) LinkageKey
  681. ifstr(i) $(LinkageKey) != $(!KeyNull)
  682. GetRegValue $(LinkageKey) "Bind" BindList
  683. ifstr(i) $(BindList) == ""
  684. read-syms AtalkString3$(!STF_LANGUAGE)
  685. Shell $(SubInf) SetupMessage $(!STF_LANGUAGE) "NONFATAL" $(ErrorString)
  686. goto endconfigui
  687. endif
  688. else
  689. Set RegistryErrorIndex = $($R0)
  690. goto fatalregistry
  691. EndIf
  692. LoadLibrary "x" $(!STF_CWDDIR)sfmatcfg.dll ATHANDLE
  693. Set FLibraryErrCtl = 1
  694. Set atcfgresult = ""
  695. LibraryProcedure atcfgresult, $(ATHANDLE),EnterAtalkConfigDLL $(!STF_HWND) $(IsInitialInstall) $(SFMUnattended)
  696. FreeLibrary $(ATHANDLE)
  697. endconfigui = +
  698. Set CommonStatus = STATUS_USERCANCEL
  699. goto usercancel
  700. RemoveAdmin = +
  701. ; Remove the SMAddons String in regnet.ini. This is done first, because
  702. ; we remove the util dll in "SfmRemoveFiles". If RemoveFiles failed,
  703. ; the SMAddons section will be restored to it's former shape.
  704. Debug-Output "OEMNXPSM.INF: Entering Remove"
  705. ; don't allow AppleTalk to be removed if SFM is installed.
  706. OpenRegKey $(!REG_H_LOCAL) "" $(SFMKeyName) $(!ACCESS) KeyProduct
  707. Ifstr $(KeyProduct) != $(!KeyNull)
  708. read-syms AtalkString7$(!STF_LANGUAGE)
  709. Shell $(SubInf) SetupMessage $(!STF_LANGUAGE) "NONFATAL" $(ErrorString)
  710. Set CommonStatus = STATUS_USERCANCEL
  711. goto end
  712. EndIf
  713. Ifstr(i) $(!NTN_InstallMode) == deinstall
  714. LoadLibrary "x" $(!STF_CWDDIR)sfmutil.dll !UTILHANDLE
  715. EndIf
  716. Ifstr(i) $(Option) == "SFMADM"
  717. Set FLibraryErrCtl = 1
  718. Set IniFile = $(NtNetIniFileName)
  719. Set IniSection = $(SrvMgrIniSection)
  720. Set Result = ""
  721. Set FLibraryErrCtl = 1
  722. LibraryProcedure Result, $(!UTILHANDLE), WriteAfpMgrIniStrings, $(IniSection), NULL, $(IniFile)
  723. Set FLibraryErrCtl = 0
  724. ; Remove the file manager addons also
  725. Set IniFile = $(WinFileIniFileName)
  726. Set IniSection = $(WinFileIniSection)
  727. Set FLibraryErrCtl = 1
  728. LibraryProcedure Result, $(!UTILHANDLE), WriteAfpMgrIniStrings, $(IniSection), NULL, $(IniFile)
  729. Set FLibraryErrCtl = 0
  730. EndIf
  731. Shell "" RemoveAdminFiles "REMOVE"
  732. ForListDo $(REMOVE_SOFTWARE)
  733. debug-output "Removing component: "$($)
  734. Shell $(UtilInf), RemoveSoftwareComponent, $(Manufacturer), $($)
  735. EndForListDo
  736. Shell "" RemovePrintMonitor
  737. Shell $(UtilInf), RemoveWinsockInfo, $(ProductATALKName)
  738. Shell "utility.inf" RemoveRpcProtocol ncacn_at_dsp
  739. FreeLibrary $(!UTILHANDLE)
  740. ; LibraryProcedure Status, $(!LIBHANDLE), DelFile $(!STF_CWDDIR)$(UtilDll)
  741. goto end
  742. UpgradeAdmin = +
  743. OpenRegKey $(!REG_H_LOCAL) "" $(ATALKKeyName) $(!ACCESS) KeyProduct
  744. Ifstr $(KeyProduct) != $(!KeyNull)
  745. GetRegValue $(KeyProduct),"MajorVersion", VersionInfo
  746. set Version = *($(VersionInfo), 4)
  747. Split-String $(!NTN_Infname), "\", FilenameList
  748. QueryListSize ListSize $(FilenameList)
  749. set !UG_Filename = *($(FilenameList), $(ListSize))
  750. ; If SFM is installed on a NT Wksta (this is a hack installation
  751. ; that some of the Microsofties install), then remove SFM before
  752. ; continuing with the upgrade. This is because, SFM doesn't get
  753. ; upgraded on a NT Wksta product and the Appletalk upgrade makes
  754. ; the SFM install invalid, resulting in the client system
  755. ; blue screening.
  756. ifstr(i) $(!STF_PRODUCT) == "WINNT"
  757. OpenRegKey $(!REG_H_LOCAL) "" $(SFMKeyName) $(!ACCESS) KeyProduct
  758. Ifstr $(KeyProduct) != ""
  759. Debug-Output "OEMNXPSM.INF: SFM is installed, so remove SFM"
  760. ifstr(i) $(!STF_UNATTENDED) == NO
  761. read-syms RemovingSFM$(!STF_LANGUAGE)
  762. Shell "subroutn.inf" SetupMessage, $(!STF_LANGUAGE), "STATUS", $(Message)
  763. endif
  764. set SaveNTN_InstallMode = $(!NTN_InstallMode)
  765. set !NTN_InstallMode = deinstall
  766. Shell "oemnsvsm.inf" InstallOption $(!STF_LANGUAGE) "SFM" $(!STF_SRCDIR) "NO" "NO" "NO"
  767. ; restore the environment variables
  768. set !NTN_InstallMode = $(SaveNTN_InstallMode)
  769. goto end
  770. EndIf
  771. endif
  772. LoadLibrary "x" $(!STF_CWDDIR)sfmutil.dll !UTILHANDLE
  773. install Install-Update
  774. ifstr(i) $(STF_INSTALL_OUTCOME) != STF_SUCCESS
  775. goto fatal
  776. endif
  777. ; Add the AppleTalk print monitor
  778. Shell "" AddPrintMonitor $(!NTN_InstallMode)
  779. FreeLibrary $(!UTILHANDLE)
  780. Ifint $($ShellCode) != $(!SHELL_CODE_OK)
  781. Goto ShellCodeError
  782. EndIf
  783. ; Add the performance data to the AppleTalk\performance service key
  784. OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_ServiceBase)"\"$(ProductATALKName) +
  785. $(!ACCESS) AtkSvcKey
  786. Ifstr $(AtkSvcKey) != $(!KeyNull)
  787. Shell "" CreatePerfKey $(AtkSvcKey) $(AtalkPerfLibraryName) +
  788. $(AtalkCounterFileName) $(AtalkPerfOpenFunction) +
  789. $(AtalkPerfCloseFunction) $(AtalkPerfCollectFunction)
  790. Ifstr(i) $($R0) != STATUS_SUCCESSFUL
  791. CloseRegKey $(AtkSvcKey)
  792. Set RegistryErrorIndex = $($R1)
  793. goto fatalregistry
  794. EndIf
  795. ; Make sure AppleTalk is in the PNP_TDI group
  796. SetRegValue $(AtkSvcKey) {Group,$(NoTitle),$(!REG_VT_SZ),"PNP_TDI"}
  797. ; Get rid of the NDIS dependency in OtherDependencies.
  798. OpenRegKey $(AtkSvcKey) "" "Linkage" $(!ACCESS) AtkLinkageKey
  799. Ifstr $(AtkLinkageKey) != $(!KeyNull)
  800. DeleteRegValue $(AtkLinkageKey) "OtherDependencies"
  801. CloseRegKey $(AtkLinkageKey)
  802. Endif
  803. CloseRegKey $(AtkSvcKey)
  804. ; Add the performance dll to the EventLog
  805. Shell "" CreateEventLogKey $(AtalkEventLogName) +
  806. $(AtalkPerfLibraryName)
  807. Ifstr(i) $($R0) != STATUS_SUCCESSFUL
  808. Set RegistryErrorIndex = $($R1)
  809. goto fatalregistry
  810. EndIf
  811. Else
  812. Debug-Output "OEMNXPSM.INF: error opening ATALK service key."
  813. EndIf
  814. SetRegValue $(KeyProduct) {MajorVersion,$(NoTitle),$(!REG_VT_SZ),$(ProductMajorVersion)}
  815. SetRegValue $(KeyProduct) {MinorVersion,$(NoTitle),$(!REG_VT_SZ),$(ProductMinorVersion)}
  816. SetRegValue $(KeyProduct) {Description,$(NoTitle),$(!REG_VT_SZ),$(Product$(Option)Description)}
  817. SetRegValue $(KeyProduct) {OperationsSupport,$(NoTitle),$(!REG_VT_DWORD),$(ProductOpSupport)}
  818. ; Update the NetRules key for PNP
  819. OpenRegKey $(KeyProduct) "" "NetRules" $(!ACCESS) KeyNetRules
  820. Ifstr $(KeyNetRules) != $(!KeyNull)
  821. SetRegValue $(KeyNetRules) {use,0,$(!REG_VT_SZ),$(NetRuleATALKUse)}
  822. CloseRegKey $(KeyNetRules)
  823. Endif
  824. CloseRegKey $(KeyProduct)
  825. Shell "utility.inf" AddRpcProtocol ncacn_at_dsp rpclt1.dll rpclt1.dll
  826. ;
  827. ; Delete cache section for NCPA
  828. ;
  829. Set MaskAllAccess = 33554432
  830. Set NewInfName = "oemnxpsm.inf"
  831. Set CacheKey = "Software\Microsoft\Ncpa\InfOptions"
  832. Set CacheValue = "oemnsvsm.inf"
  833. OpenRegKey $(!REG_H_LOCAL) "" $(CacheKey) $(MaskAllAccess) Cache
  834. Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
  835. DeleteRegTree $(Cache) $(CacheValue)
  836. CloseRegKey $(Cache)
  837. endif
  838. ; Update winsock mappings
  839. Shell $(UtilInf) UpdateWinsockMappings $(ProductATALKName) "%SystemRoot%\System32\"$(AtWinSockDll)
  840. ifstr(i) $($R0) != NO_ERROR
  841. goto fatal
  842. endif
  843. endif
  844. goto end
  845. successful = +
  846. Set Status = STATUS_SUCCESSFUL
  847. goto end
  848. ShellCodeError = +
  849. read-syms ShellingError$(!STF_LANGUAGE)
  850. Shell $(SubInf) SetupMessage $(!STF_LANGUAGE) "FATAL" $(ErrorString)
  851. fatalregistry = +
  852. EndWait
  853. Shell $(UtilInf) RegistryErrorString $(RegistryErrorIndex)
  854. IfInt $(ShellCode) != 0
  855. goto ShellCodeError
  856. Endif
  857. set Error = $($R0)
  858. goto fatal
  859. fatal = +
  860. Ifint $(BillboardVisible) != 0
  861. Shell $(SubInf) PopBillboard
  862. Set BillboardVisible = 0
  863. Endif
  864. read-syms MiscErrorString3$(!STF_LANGUAGE)
  865. Shell $(SubInf) SetupMessage, $(!STF_LANGUAGE), "FATAL",$(ErrorString)$(Error)
  866. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  867. goto ShellCodeError
  868. endif
  869. goto failed
  870. failed = +
  871. set CommonStatus = STATUS_FAILED
  872. ifstr(i) $(REMOVE_FLAG) == TRUE
  873. set REMOVE_FLAG = FALSE
  874. goto RemoveAdmin
  875. endif
  876. goto end
  877. usercancel = +
  878. Set CommonStatus = STATUS_USERCANCEL
  879. end = +
  880. EndWait
  881. Return $(CommonStatus)
  882. ;-------------------------------------------------------------
  883. ; ROUTINE : Find MediaType
  884. ; DESCRIPTION : Gets the media type of the card
  885. ; RETURNS : R0: STATUS_SUCCESSFUL | STATUS_FAILED
  886. ; : R1: RegistryErrorIndex, if error, else media type
  887. ;
  888. ;------------------------------------------------------------
  889. [FindMediaType]
  890. Set Status = STATUS_FAILED
  891. Set CardName = $(!NTN_ServiceBase)"\"$($0)"\Parameters"
  892. OpenRegKey $(!REG_H_LOCAL) "" $(CardName) $(!ACCESS) CardKey
  893. Ifstr(i) $(CardKey) == $(!KeyNull)
  894. Set RegistryErrorIndex = $($R0)
  895. Return $(Status) $(RegistryErrorIndex)
  896. EndIf
  897. GetRegValue $(CardKey) "MediaType" MediaTypeList
  898. Set MediaType = *($(MediaTypeList),4)
  899. Set Status = STATUS_SUCCESSFUL
  900. Return $(Status) $(MediaType)
  901. ;-------------------------------------------------------------
  902. ; ROUTINE : CreateAtalkConfig
  903. ; DESCRIPTION : Creates the registry entries for AppleTalk
  904. ; RETURNS : R0: STATUS_SUCCESSFUL | STATUS_FAILED
  905. ; : R1: RegistryErrorIndex
  906. ;
  907. ;------------------------------------------------------------
  908. [CreateAtalkConfig]
  909. Set AdapterName = $($0)
  910. Set KeyAdapters = $($1)
  911. Set RetStatus = STATUS_SUCCESSFUL
  912. read-syms GeneralConstants
  913. CreateRegKey $(KeyAdapters) {$(AdapterName), 0, GenericClass} "" $(!ACCESS) "", TempKeyAdapters
  914. Shell "" FindMediaType $($0)
  915. Ifstr(i) $($R0) == STATUS_SUCCESSFUL
  916. Set MediaType = $($R1)
  917. else
  918. Set RegistryErrorIndex = $($R1)
  919. Set RetStatus = $($R0)
  920. goto return
  921. EndIf
  922. set PortName = $($0)"@"$(!STF_COMPUTERNAME)
  923. set ZoneList = {""}
  924. set AarpRetries = 10
  925. set DefaultZone = ""
  926. set NewValueList = +
  927. {{"AarpRetries",0,$(!REG_VT_DWORD),$(AarpRetries)}, +
  928. {"DefaultZone", 0,$(!REG_VT_SZ),$(DefaultZone)},+
  929. {"NetworkRangeUpperEnd",0,$(!REG_VT_DWORD),0 },+
  930. {"NetworkRangeLowerEnd",0,$(!REG_VT_DWORD),0 },+
  931. {"ZoneList",0,$(!REG_VT_MULTI_SZ),$(ZoneList)},+
  932. {"SeedingNetwork", 0,$(!REG_VT_DWORD),0},+
  933. {"DdpCheckSums", 0,$(!REG_VT_DWORD),0},+
  934. {"PortName",0,$(!REG_VT_SZ),$(PortName)}}
  935. Shell $(UtilInf),AddValueList, $(TempKeyAdapters), $(NewValueList)
  936. set RegistryErrorIndex = $($R0)
  937. Ifstr $(RegistryErrorIndex) != NO_ERROR
  938. CloseRegKey $(TmpKeyAdapters)
  939. Set RetStatus = STATUS_FAILED
  940. EndIf
  941. return = +
  942. Return $(RetStatus) $(RegistryErrorIndex)
  943. [RemoveAdminFiles]
  944. Set Status = STATUS_SUCCESSFUL
  945. Set RemoveList = {}
  946. Set DelOnRebootList = {}
  947. Set Mode = $($0)
  948. ; Bogus. Option is not local, so is never set. The below code does nothing.
  949. ifstr(i) $(Option) == "SFMADM"
  950. Set RemoveList = >($(RemoveList), #(Files-RemoveList, AFPSVCAPI, 1))
  951. Set RemoveList = >($(RemoveList), #(Files-RemoveList, AFPSVCMGR, 1))
  952. Set RemoveList = >($(RemoveList), #(Files-RemoveList, SFMHELP, 1))
  953. EndIf
  954. ifstr(i) $(Option) == "ATALK"
  955. Set RemoveList = >($(RemoveList), #(Files-RemoveList, ATCONFIG, 1))
  956. Set RemoveList = >($(RemoveList), #(Files-RemoveList, ATMSG, 1))
  957. Set RemoveList = >($(RemoveList), #(Files-RemoveList, ATWSOCK, 1))
  958. Set RemoveList = >($(RemoveList), #(Files-RemoveList, ATDRIVER, 1))
  959. Set RemoveList = >($(RemoveList), #(Files-RemoveList, ATKCTRSDLL, 1))
  960. Set RemoveList = >($(RemoveList), #(Files-RemoveList, ATKCTRNMH, 1))
  961. Set RemoveList = >($(RemoveList), #(Files-RemoveList, ATKCTRSINI, 1))
  962. EndIf
  963. ForListDo $(RemoveList)
  964. Set DelStatus = ""
  965. Debug-Output "Deleting File "$($)
  966. Set FLibraryErrCtl = 1
  967. Ifstr(i) $(Mode) == "REMOVE"
  968. LibraryProcedure DelStatus $(!UTILHANDLE), DelFile $($)
  969. ifstr(i) $(DelStatus) == "FAILED"
  970. Set DelOnRebootList = >($(DelOnRebootList), $($))
  971. EndIf
  972. else
  973. LibraryProcedure DelStatus $(!LIBHANDLE), DelFile $($)
  974. EndIf
  975. Set FLibraryErrCtl = 0
  976. EndForListDo
  977. ForListDo $(DelOnRebootList)
  978. Ifstr(i) $(Mode) == "REMOVE"
  979. Debug-Output "File to remove on reboot = "$($)
  980. AddFileToDeleteList $($)
  981. else
  982. Set FLibraryErrCtl = 1
  983. LibraryProcedure DelStatus $(!LIBHANDLE), DelFile $($)
  984. Set FLibraryErrCtl = 0
  985. EndIf
  986. EndForListDo
  987. Return $(Status)
  988. [Install-Update]
  989. set STF_VITAL = ""
  990. AddSectionFilesToCopyList Files-MISC $(SrcDir) $(!STF_WINDOWSSYSPATH)
  991. Ifstr(i) $(Option) == "ATALK"
  992. AddSectionFilesToCopyList Files-ATALK $(SrcDir) $(!STF_WINDOWSSYSPATH)
  993. AddSectionFilesToCopyList Files-ATALKDRIVER $(SrcDir) $(!STF_WINDOWSSYSPATH)\drivers
  994. EndIf
  995. Ifstr(i) $(Option) == "SFMADM"
  996. AddSectionFilesToCopyList Files-ADMTOOLS $(SrcDir) $(!STF_WINDOWSSYSPATH)
  997. EndIf
  998. CopyFilesInCopyList
  999. Exit
  1000. [Install-Initial]
  1001. set STF_VITAL = ""
  1002. AddSectionFilesToCopyList Files-MISC $(SrcDir) $(!STF_WINDOWSSYSPATH)
  1003. Ifstr(i) $(Option) == "ATALK"
  1004. AddSectionFilesToCopyList Files-ATALK $(SrcDir) $(!STF_WINDOWSSYSPATH)
  1005. AddSectionFilesToCopyList Files-ATALKDRIVER $(SrcDir) $(!STF_WINDOWSSYSPATH)\drivers
  1006. EndIf
  1007. Ifstr(i) $(Option) == "SFMADM"
  1008. AddSectionFilesToCopyList Files-ADMTOOLS $(SrcDir) $(!STF_WINDOWSSYSPATH)
  1009. EndIf
  1010. CopyFilesInCopyList
  1011. Exit
  1012. [AddPrintMonitor]
  1013. ; Add the AppleTalk Print Monitor Stuff
  1014. ; display error popups only on install. On upgrade just ignore
  1015. ; the errors because PrintMon might already be installed
  1016. Set Mode = $($0)
  1017. Set AddMonStatus = ""
  1018. Set FLibraryErrCtl = 1
  1019. LibraryProcedure AddMonStatus $(!UTILHANDLE) SfmAddPrintMonitor $(!AtalkMonName)
  1020. Set FLibraryErrCtl = 0
  1021. ifstr(i) $(AddMonStatus) == "FAILED"
  1022. ifstr(i) $(Mode) == install
  1023. read-syms AtalkString4$(!STF_LANGUAGE)
  1024. Shell "subroutn.inf" SetupMessage $(!STF_LANGUAGE) +
  1025. "NONFATAL" $(ErrorString)
  1026. endif
  1027. return
  1028. EndIf
  1029. ; Set up Event Loggin for the AppleTalk Monitor
  1030. OpenRegKey $(!REG_H_LOCAL) "" $(!EventLogKey) $(!ACCESS) EvntLogKey
  1031. ifstr(i) $(EvntLogKey) != $(!KeyNull)
  1032. CreateRegKey $(EvntLogKey) +
  1033. {$(!AtalkMonEventLogName),0,GenericClass} "" +
  1034. $(!ACCESS) "" AtalkMonKey
  1035. ifstr $(AtalkMonKey) != $(!KeyNull)
  1036. Set EventFile = "%SystemRoot%\system32\sfmmon.dll"
  1037. Set NewValueList = +
  1038. {{CategoryMessageFile,0,$(!REG_VT_EXPAND_SZ),$(EventFile)},+
  1039. {EventMessageFile,0,$(!REG_VT_EXPAND_SZ),$(EventFile)},+
  1040. {CategoryCount,0,$(!REG_VT_DWORD),4},+
  1041. {TypesSupported,0,$(!REG_VT_DWORD),7}}
  1042. Shell "utility.Inf" AddValueList $(AtalkMonKey) $(NewValueList)
  1043. CloseRegKey $(AtalkMonKey)
  1044. else
  1045. ifstr(i) $(Mode) == install
  1046. read-syms AtalkString6$(!STF_LANGUAGE)
  1047. Shell "subroutn.inf" SetupMessage $(!STF_LANGUAGE) +
  1048. "NONFATAL" $(ErrorString)
  1049. endif
  1050. endif
  1051. CloseRegKey $(EvntLogKey)
  1052. Else-ifstr(i) $(Mode) == install
  1053. read-syms AtalkString6$(!STF_LANGUAGE)
  1054. Shell "subroutn.inf" SetupMessage $(!STF_LANGUAGE) +
  1055. "NONFATAL" $(ErrorString)
  1056. EndIf
  1057. return
  1058. [RemovePrintMonitor]
  1059. Set DelMonStatus = ""
  1060. Set FLibraryErrCtl = 1
  1061. LibraryProcedure DelMonStatus $(!UTILHANDLE) SfmDeletePrintMonitor $(!AtalkMonName)
  1062. Set FLibraryErrCtl = 0
  1063. ifstr(i) $(DelMonStatus) == "FAILED"
  1064. read-syms AtalkString5$(!STF_LANGUAGE)
  1065. Shell $(SubInf) SetupMessage $(!STF_LANGUAGE) "NONFATAL" $(ErrorString)
  1066. EndIf
  1067. OpenRegKey $(!REG_H_LOCAL) "" $(!EventLogKey) $(!ACCESS) LogKey
  1068. Ifstr(i) $(LogKey) != $(!KeyNull)
  1069. Set AtalkMonKey = $(!AtalkMonEventLogName)
  1070. DeleteRegTree $(LogKey) $(AtalkMonKey)
  1071. CloseRegKey $(LogKey)
  1072. endif
  1073. return
  1074. ;-------------------------------------------------------------
  1075. ; ROUTINE : CreatePerfKey
  1076. ; DESCRIPTION : Creates the perf key for the service named &
  1077. ; : loads the counters to the registry.
  1078. ; ARGUMENTS : $0: ServiceKey
  1079. ; : $1: perf counters dll name
  1080. ; : $2: perf counters file name
  1081. ; : $3: open routine name
  1082. ; : $4: close routine name
  1083. ; : $5: collect routine name
  1084. ;
  1085. ; RETURNS : R0: STATUS_SUCCESSFUL | STATUS_FAILED
  1086. ; : R1: RegistryErrorIndex, if error
  1087. ;
  1088. ;------------------------------------------------------------
  1089. [CreatePerfKey]
  1090. Set Status = STATUS_FAILED
  1091. Set ServiceKey = $($0)
  1092. Set PerfDll = $($1)
  1093. Set PerfCounterFileName = $($2)
  1094. Set PerfOpen = $($3)
  1095. Set PerfClose = $($4)
  1096. Set PerfCollect = $($5)
  1097. set KeyPerformance = $(!KeyNull)
  1098. OpenRegKey $(ServiceKey) "" $(!PerfKeyName) $(!ACCESS) KeyPerformance
  1099. ifstr $(KeyPerformance) == $(!KeyNull)
  1100. CreateRegKey $(ServiceKey) {$(!PerfKeyName),$(NoTitle),GenericClass} +
  1101. "" $(!ACCESS) "" KeyPerformance
  1102. ifstr $(KeyPerformance) == $(!KeyNull)
  1103. Debug-Output "Error creating Performance key"
  1104. Set RegistryErrorIndex = $($R0)
  1105. return $(Status) $(RegistryErrorIndex)
  1106. endif
  1107. endif
  1108. set NewValueList = +
  1109. {{Library ,$(NoTitle),$(!REG_VT_SZ),$(PerfDll)},+
  1110. {Open, $(NoTitle),$(!REG_VT_SZ),$(PerfOpen)},+
  1111. {Close, $(NoTitle),$(!REG_VT_SZ),$(PerfClose)},+
  1112. {Collect, $(NoTitle),$(!REG_VT_SZ),$(PerfCollect)}}
  1113. Shell utility.inf, AddValueList, $(KeyPerformance), $(NewValueList)
  1114. set RegistryErrorIndex = $($R0)
  1115. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  1116. set RegistryErrorIndex = ERROR
  1117. endif
  1118. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  1119. CloseRegKey $(KeyPerformance)
  1120. Debug-Output "OEMNXPSM.INF: error adding perf values"
  1121. return STATUS_FAILED $(RegistryErrorIndex)
  1122. endif
  1123. CloseRegKey $(KeyPerformance)
  1124. Set Status = STATUS_SUCCESSFUL
  1125. return $(Status) $(RegistryErrorIndex)
  1126. ;-------------------------------------------------------------
  1127. ; ROUTINE : CreateEventLogKey
  1128. ; DESCRIPTION : Creates the application event log key
  1129. ; ARGUMENTS : $0: Application name
  1130. ; : $1: perf counters dll name
  1131. ;
  1132. ; RETURNS : R0: STATUS_SUCCESSFUL | STATUS_FAILED
  1133. ; : R1: RegistryErrorIndex, if error
  1134. ;
  1135. ;------------------------------------------------------------
  1136. [CreateEventLogKey]
  1137. Set Status = STATUS_FAILED
  1138. Set Service = $($0)
  1139. Set PerfDll = $($1)
  1140. Set EventLogKeyName = $(!EventLogKey)"\"$(Service)
  1141. OpenRegKey $(!REG_H_LOCAL) "" $(EventLogKeyName) $(!ACCESS) EvntLogKey
  1142. ifstr $(EvntLogKey) == $(!KeyNull)
  1143. OpenRegKey $(!REG_H_LOCAL) "" $(!EventLogKey) $(!ACCESS) EvntKey
  1144. ifstr(i) $(EvntKey) != $(!KeyNull)
  1145. CreateRegKey $(EvntKey) {$(Service),0,GenericClass} +
  1146. "" $(!ACCESS) "" EvntLogKey
  1147. ifstr $(EvntLogKey) == $(!KeyNull)
  1148. Debug-Output "Error creating eventlog key"
  1149. Set RegistryErrorIndex = $($R0)
  1150. CloseRegKey $(EvntKey)
  1151. return $(Status) $(RegistryErrorIndex)
  1152. endif
  1153. endif
  1154. CloseRegKey $(EvntKey)
  1155. endif
  1156. Set NewValueList = +
  1157. {{EventMessageFile,0,$(!REG_VT_EXPAND_SZ),$(PerfDll)}, +
  1158. {TypeSupported,0,$(!REG_VT_DWORD),7}}
  1159. Shell utility.inf, AddValueList, $(EvntLogKey), $(NewValueList)
  1160. set RegistryErrorIndex = $($R0)
  1161. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  1162. set RegistryErrorIndex = ERROR
  1163. endif
  1164. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  1165. CloseRegKey $(EvntLogKey)
  1166. Debug-Output "Error adding values to eventlog key"
  1167. return $(Status) $(RegistryErrorIndex)
  1168. EndIf
  1169. CloseRegKey $(EvntLogKey)
  1170. set Status = STATUS_SUCCESSFUL
  1171. Debug-Output "OEMNXPSM.INF: created the eventlog key"
  1172. return $(Status) $(RegistryErrorIndex)
  1173. ;-------------------------------------------------------------
  1174. ; ROUTINE : RemoveAllServiceDependencies
  1175. ; DESCRIPTION : Removes any service dependencies for
  1176. ; the specified service
  1177. ; ARGUMENTS : $0: Service name
  1178. ;
  1179. ; RETURNS : R0: STATUS_SUCCESSFUL
  1180. ;
  1181. ;------------------------------------------------------------
  1182. [RemoveAllServiceDependencies]
  1183. Debug-Output "RemoveAllServiceDependencies: entry"
  1184. set Status = STATUS_SUCCESSFUL
  1185. Set KeyNull = ""
  1186. set DependentService = $(!NTN_ServiceBase)\$($0)
  1187. set DependentName = $($0)
  1188. set KeyService = $(KeyNull)
  1189. OpenRegKey $(!REG_H_LOCAL) "" $(DependentService) $(!ACCESS) KeyService
  1190. ifstr $(KeyService) != $(KeyNull)
  1191. set newDependList = {}
  1192. GetRegValue $(KeyService) "DeleteFlag" DeleteFlagValue
  1193. ; make sure the service is not marked for deletion
  1194. ifint $(RegLastError) != 0
  1195. GetRegValue $(KeyService) "DependOnService" ServiceList
  1196. ifint $(RegLastError) == 0
  1197. Debug-Output "RemoveAllServiceDependencies: old DependOnService List "*($(ServiceList), 4)
  1198. ; get any existing group dependencies
  1199. GetRegValue $(KeyService) "DependOnGroup" GrpList
  1200. ifint $(RegLastError) == 0
  1201. ForListDo *($(GrpList),4)
  1202. set grp = "+"$($)
  1203. set newDependList = >($(newDependList), $(grp))
  1204. EndForListDo
  1205. endif
  1206. Debug-Output "RemoveAllServiceDependencies: new DependOnService List "$(newDependList)
  1207. ; now set only the group dependency
  1208. LibraryProcedure Result, $(!LIBHANDLE), +
  1209. SetupChangeServiceConfig, $(DependentName) +
  1210. $(!SERVICE_NO_CHANGE), $(!SERVICE_NO_CHANGE), +
  1211. $(!SERVICE_NO_CHANGE), "", "", +
  1212. $(newDependList), "", "", ""
  1213. endif
  1214. endif
  1215. CloseRegKey $(KeyService)
  1216. else
  1217. Debug-Output "RemoveAllServiceDependencies: failed to open service key "$(DependentService)
  1218. endif
  1219. Debug-Output "RemoveAllServiceDependencies: exit"
  1220. return $(Status)
  1221. [Files-RemoveList]
  1222. AFPSVCAPI = $(!STF_WINDOWSSYSPATH)\sfmapi.dll
  1223. AFPSVCMGR = $(!STF_WINDOWSSYSPATH)\sfmmgr.dll
  1224. SFMHELP = $(!STF_WINDOWSSYSPATH)\sfmmgr.hlp
  1225. ATCONFIG = $(!STF_WINDOWSSYSPATH)\sfmatcfg.dll
  1226. ATMSG = $(!STF_WINDOWSSYSPATH)\sfmatmsg.dll
  1227. ATWSOCK = $(!STF_WINDOWSSYSPATH)\sfmwhsat.dll
  1228. ATDRIVER = $(!STF_WINDOWSSYSPATH)\drivers\sfmatalk.sys
  1229. ATKCTRSDLL = $(!STF_WINDOWSSYSPATH)\atlkctrs.dll
  1230. ATKCTRNMH = $(!STF_WINDOWSSYSPATH)\atlkctrnm.h
  1231. ATKCTRSINI = $(!STF_WINDOWSSYSPATH)\atlkctrs.ini