;==================================================================== ; Copyright (c) 1995, Microsoft Corp. ; ; File: OEMNSVBR.INF ; ; History: ; t-abolag 05/15/95 Created. ; ; Installation script for the BOOTP Relay Agent service ;==================================================================== ;----------------------------------------------------------------------- ; OptionType ; Types specific to networking: ; ; NetAdapter, a netcard / adapter combination or just a netcard ; NetDriver, just a netcard driver ; NetTransport, a complete NDIS-compliant TDI transport stack ; NetService, an NT networking service ; NetWork, a complete network ensemble. ; NetProvider a complete network which supports NT MPR protocol ;----------------------------------------------------------------------- [Identification] OptionType = NetService ;----------------------------------------------------------------------- ; Options ; This section lists the OEM Option key names. These keys are locale- ; independent and used to represent the option in a locale-independent ; manner. ;----------------------------------------------------------------------- [Options] RelayAgent ;----------------------------------------------------------------------- ; CONSTANTS FOR USING DIALOGS ;----------------------------------------------------------------------- [FileConstants] Manufacturer = "Microsoft" ProductMajorVersion = "4" ProductMinorVersion = "0" ProductVersion = $(ProductMajorVersion)"."$(ProductMinorVersion) ProductOpSupport = 132 ; 0x0084 ; Display,Removable,NOT Properties,Not Updatable ProductSoftwareName = "RelayAgent" ProductSoftwareImagePath = "%SystemRoot%\System32\router.exe" ProductEventFile = "%SystemRoot%\System32\relay.dll" ProductSoftwareType = "autoserviceshare" ProductKeyName = $(!NTN_SoftwareBase)"\"$(Manufacturer)"\CurrentVersion" ProductRegRoot = $(!NTN_ServiceBase)"\"$(ProductSoftwareName) ProductRegParams = $(ProductRegRoot)"\Parameters" TCPIPRegRoot = $(!NTN_ServiceBase)"\Tcpip" NetRuleType = "relayAgent relayAgentClass" NetRuleUse = "service yes yes" NetRuleBindable = {"relayAgentClass ndisDriver non non 100"} NetRuleBindForm = """RelayAgent"" yes yes simple" NetRuleClass = {"relayAgentClass basic"} SoftwareType = "service" [GeneralConstants] File_UTILITY_INF = "UTILITY.INF" File_SUBROUTN_INF = "SUBROUTN.INF" Exit_Code = 0 ExitCodeOK = 0 ExitCodeCancel = 1 ExitCodeFatal = 2 KeyNull = "" MAXIMUM_ALLOWED = 33554432 SERVICE_NO_CHANGE = 4294967295 RegistryErrorIndex = NO_ERROR KeyProduct = "" KeyParameters = "" TRUE = 1 FALSE = 0 NoTitle = 0 to = "" from = "" ExitState = "Active" OldVersionExisted = $(FALSE) [date] Now = {} ? $(!LIBHANDLE) GetSystemDate [Identify] read-syms Identification set Status = STATUS_SUCCESSFUL set Identifier = $(OptionType) set Media = #("Source Media Descriptions", 1, 1) Return $(Status) $(Identifier) $(Media) [ReturnOptions] set Status = STATUS_FAILED set OptionList = {} set OptionTextList = {} set LanguageList = ^(LanguagesSupported, 1) ifcontains(i) $($0) in $(LanguageList) goto returnOptions else set Status = STATUS_NOLANGUAGE goto finish_ReturnOptions endif returnOptions = + set OptionList = ^(Options, 1) set OptionTextList = ^(OptionsText$($0), 1) set Status = STATUS_SUCCESSFUL finish_ReturnOptions = + Return $(Status) $(OptionList) $(OptionTextList) [InstallOption] set Status = STATUS_FAILED set Option = $($1) set SrcDir = $($2) set AddCopy = $($3) set DoCopy = $($4) set DoConfig = $($5) set LanguageList = ^(LanguagesSupported, 1) ifcontains(i) $($0) NOT-IN $(LanguageList) return STATUS_NOLANGUAGE endif StartWait read-syms GeneralConstants read-syms FileConstants read-syms FileConstants$(!STF_LANGUAGE) read-syms DialogConstants$(!STF_LANGUAGE) ifstr(i) $(!NTN_Origination) == "NCPA" set continue = $(OK) endif detect date set to = Begin set from = Begin set ExitStatus = STATUS_SUCCESSFUL EndWait Begin = + ifstr(i) $(!NTN_InstallMode) == deinstall set startLabel = Deinstall else-ifstr(i) $(!NTN_InstallMode) == update set startLabel = Update else-ifstr(i) $(!NTN_InstallMode) == bind set startLabel = ScriptExit else-ifstr(i) $(!NTN_InstallMode) == configure ;set startLabel = Configure Debug-Output "Cannot configure the software." Shell $(File_UTILITY_INF), RegistryErrorString, + CANNOT_CONFIGURE_SOFTWARE ifint $($ShellCode) != $(!SHELL_CODE_OK) Debug-Output "ShellCode error: cannot get an error string." goto ShellErrorExit endif set ErrorMsg = $($R0) set Severity = STATUS set ExitStatus = STATUS_USERCANCEL Shell $(File_SUBROUTN_INF) SetupMessage, $(!STF_LANGUAGE), + $(Severity), $(ErrorMsg) goto ScriptExit else set startLabel = Install endif set from = $(ScriptExit) set to = $(ScriptExit) goto $(startLabel) ;----------------------------- ; Entry point for installation ;----------------------------- Install = + ; make certain TCP/IP is installed OpenRegKey $(!REG_H_LOCAL) "" $(TCPIPRegRoot) $(MAXIMUM_ALLOWED) TCPIPRootKey ifstr $(TCPIPRootKey) == $(KeyNull) set Message = ErrorTCPIPNotInstalled goto MessageExit endif CloseRegKey $(TCPIPRegRoot) ; check to see if a previous version is installed OpenRegKey $(!REG_H_LOCAL) "" $(ProductKeyName) $(MAXIMUM_ALLOWED) ProductKey ifstr $(ProductKey) != $(KeyNull) CloseRegKey $(ProductKey) Shell $(File_UTILITY_INF), VerExistedDlg, + $(ProductSoftwareTitle), $(ProductVersion) goto ScriptExit endif ; Save Unattended flag for oemnxptc.inf (TCP/IP). This inf checks the config of DHCP relay ; and presents a message box to the user if the config is wrong. ; NOTE: The !STF_UNATTEND flag is not remembered during a binding review. This is why it's saved OpenRegKey $(!REG_H_LOCAL) "" "System\Setup" $(MAXIMUM_ALLOWED) KeySetup ifstr(i) $(KeySetup) != "" DeleteRegTree $(KeySetup) "DHCPRelay" CreateRegKey $(KeySetup) {"DHCPRelay",$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" KeyDHCP ifstr(i) $(KeyDHCP) != "" SetRegValue $(KeyDHCP) {"Unattended",$(NoTitle),$(!REG_VT_SZ),$(!STF_UNATTENDED)} CloseRegKey $(KeyDHCP) endif endif Ifstr(i) $(!NTN_InstallMode) == "install" Ifstr(i) $(DoCopy) == "YES" Shell $(File_UTILITY_INF), DoAskSource, $(!STF_CWDDIR), $(SrcDir) YES Ifint $($ShellCode) != $(!SHELL_CODE_OK) Goto ShellErrorExit Else-Ifstr(i) $($R0) == STATUS_FAILED Shell $(File_UTILITY_INF) RegistryErrorString "ASK_SOURCE_FAIL" ifint $($ShellCode) != $(!SHELL_CODE_OK) goto ShellErrorExit endif set Error = $($R0) Goto ScriptExit Else-Ifstr(i) $($R0) == STATUS_USERCANCEL ; Set ExitStatus so NCPA won't change cancel to close set ExitStatus = STATUS_USERCANCEL Goto ScriptExit Endif Set SrcDir = $($R1) Endif install "Install-Option" ifstr(i) $(STF_INSTALL_OUTCOME) != STF_SUCCESS Shell $(UtilityInf) RegistryErrorString "UNABLE_COPY_FILE" ifint $($ShellCode) != $(!SHELL_CODE_OK) set ExitStatus = STATUS_USERCANCEL goto ScriptExit endif set Error = $($R0) goto ScriptExit endif endif StartWait ; update the software registry key Shell $(File_UTILITY_INF), AddSoftwareComponent, $(Manufacturer), + $(ProductSoftwareName), $(ProductSoftwareName), + $(ProductSoftwareDisplayName), $(STF_CONTEXTINFNAME), + $(ProductSoftwareImagePath), $(ProductSoftwareType), "", + { "Tcpip", "EventLog" }, "", $(ProductEventFile) set SoftwareProductKey = $($R1) set SoftwareNetRuleKey = $($R2) set SoftwareServiceKey = $($R3) set ParamsKey = $($R4) set SoftLinkageKey = $($R5) ifint $($ShellCode) != $(!SHELL_CODE_OK) EndWait Debug-Output "ShellCode error: AddSoftwareComponent" goto ShellErrorExit endif set RegistryErrorIndex = $($R0) ifstr(i) $(RegistryErrorIndex) != NO_ERROR EndWait Debug-Output "Registry error: AddSoftwareComponent" CloseRegKey $(SoftwareProductKey) CloseRegKey $(SoftwareNetRuleKey) CloseRegKey $(SoftwareServiceKey) CloseRegKey $(KeyParameters) CloseRegKey $(SoftLinkageKey) goto RegistryErrorExit endif ; fill in the RelayAgent\Parameters key set HopsThreshold = 4 set SecsThreshold = 4 set LogMessages = 0 set EnableTracing = 0 set DHCPServers = "" set NewValueList = {{HopsThreshold,$(NoTitle),$(!REG_VT_DWORD),$(HopsThreshold)},+ {SecsThreshold,$(NoTitle),$(!REG_VT_DWORD),$(SecsThreshold)},+ {LogMessages,$(NoTitle),$(!REG_VT_DWORD),$(LogMessages)},+ {EnableTracing,$(NoTitle),$(!REG_VT_DWORD),$(EnableTracing)},+ {DHCPServers,$(NoTitle),$(!REG_VT_MULTI_SZ),$(DHCPServers)}} Shell $(File_UTILITY_INF), AddValueList, $(ParamsKey), $(NewValueList) ifint $($ShellCode) != $(!SHELL_CODE_OK) EndWait Debug-Output "ShellCode error." goto ShellErrorExit endif set RegistryErrorIndex = $($R0) ifstr(i) $(RegistryErrorIndex) != NO_ERROR EndWait Debug-Output "Registry error: AddValueList" CloseRegKey $(SoftwareProductKey) CloseRegKey $(SoftwareNetRuleKey) CloseRegKey $(SoftwareServiceKey) CloseRegKey $(SoftLinkageKey) CloseRegKey $(KeyParameters) goto RegistryErrorExit endif ; fill in the Software\CurrentVersion key set NewValueList = {{SoftwareType,$(NoTitle),$(!REG_VT_SZ),$(SoftwareType)},+ {MajorVersion,$(NoTitle),$(!REG_VT_DWORD),$(ProductMajorVersion)},+ {MinorVersion,$(NoTitle),$(!REG_VT_DWORD),$(ProductMinorVersion)},+ {Title,$(NoTitle),$(!REG_VT_SZ),$(ProductSoftwareTitle)},+ {Description,$(NoTitle),$(!REG_VT_SZ),$(ProductSoftwareDescription)},+ {ServiceName,$(NoTitle),$(!REG_VT_SZ),$(ProductSoftwareName)},+ {OperationsSupport,$(NoTitle),$(!REG_VT_DWORD),$(ProductOpSupport)}, + {InstallDate,$(NoTitle),$(!REG_VT_DWORD),*($(Now),1)}} Shell $(File_UTILITY_INF), AddValueList, $(SoftwareProductKey), $(NewValueList) ifint $($ShellCode) != $(!SHELL_CODE_OK) EndWait Debug-Output "ShellCode error." goto ShellErrorExit endif set RegistryErrorIndex = $($R0) ifstr(i) $(RegistryErrorIndex) != NO_ERROR EndWait Debug-Output "Registry error: AddValueList." CloseRegKey $(SoftwareProductKey) CloseRegKey $(SoftwareNetRuleKey) CloseRegKey $(SoftwareServiceKey) CloseRegKey $(SoftLinkageKey) CloseRegKey $(KeyParameters) goto RegistryErrorExit endif ; fill in the Software\CurrentVersion\NetRules key set NewValueList = + {{InfOption,$(NoTitle),$(!REG_VT_SZ),RelayAgent},+ {class,$(NoTitle),$(!REG_VT_MULTI_SZ),$(NetRuleClass)},+ {type,$(NoTitle),$(!REG_VT_SZ),$(NetRuleType)},+ {use,$(NoTitle),$(!REG_VT_SZ),$(NetRuleUse)},+ {bindform,$(NoTitle),$(!REG_VT_SZ),$(NetRuleBindForm)},+ {bindable,$(NoTitle),$(!REG_VT_MULTI_SZ),$(NetRuleBindable)}} Shell $(File_UTILITY_INF), AddValueList, $(SoftwareNetRuleKey), $(NewValueList) ifint $($ShellCode) != $(!SHELL_CODE_OK) EndWait Debug-Output "ShellCode error." goto ShellErrorExit endif set RegistryErrorIndex = $($R0) ifstr(i) $(RegistryErrorIndex) != NO_ERROR EndWait Debug-Output "Registry error: AddValueList." CloseRegKey $(SoftwareProductKey) CloseRegKey $(SoftwareNetRuleKey) CloseRegKey $(SoftwareServiceKey) CloseRegKey $(KeyParameters) CloseRegKey $(SoftLinkageKey) goto RegistryErrorExit endif CloseRegKey $(SoftwareProductKey) CloseRegKey $(SoftwareNetRuleKey) CloseRegKey $(SoftLinkageKey) CloseRegKey $(KeyParameters) CloseRegKey $(SoftwareServiceKey) EndWait ; the tcp configuration will either be up or will get invoke when ncpa is ; closed, it can get configured at that time. set ExitStatus = STATUS_SUCCESSFUL goto ScriptExit ;--------------------------------- ; Entry point for deinstallation ;--------------------------------- Deinstall = + Shell $(File_UTILITY_INF), RemoveSoftwareComponent, $(Manufacturer), + $(ProductSoftwareName) ifint $($ShellCode) != $(!SHELL_CODE_OK) Debug-Output "ShellCode error: RemoveSoftwareComponent" goto ShellErrorExit endif set RegistryErrorIndex = $($R0) ifstr(i) $(RegistryErrorIndex) != NO_ERROR goto RegistryErrorExit endif ; don't want to reboot, but no way around it set ExitStatus = STATUS_SUCCESSFUL goto ScriptExit ;--------------------------- ; Entry point for upgrades ;--------------------------- Update = + OpenRegKey $(!REG_H_LOCAL) "" "SOFTWARE\Microsoft\RelayAgent\CurrentVersion" $(MAXIMUM_ALLOWED) ProductKey ifstr $(ProductKey) != "" SetRegValue $(ProductKey) {Description,$(NoTitle),$(!REG_VT_SZ), + $(ProductSoftwareDescription)} SetRegValue $(ProductKey) {Title,$(NoTitle),$(!REG_VT_SZ), + $(ProductSoftwareTitle)} OpenRegKey $(!REG_H_LOCAL) "" "SOFTWARE\Microsoft\Ncpa\InfOptions" $(MAXIMUM_ALLOWED) NcpaKey ifstr(i) $(NcpaKey) != "" DeleteRegTree $(NcpaKey) "oemnsvbr.inf" endif CloseRegKey $(NcpaKey) OpenRegKey $(!REG_H_LOCAL) "" $(ProductRegRoot) $(MAXIMUM_ALLOWED) svcKey ifstr(i) $(svcKey) != $(KeyNull) SetRegValue $(svcKey) {DisplayName,$(NoTitle),$(!REG_VT_SZ), + $(ProductSoftwareDisplayName)} endif CloseRegKey $(svcKey) install "Install-Update" ifstr(i) $(STF_INSTALL_OUTCOME) != STF_SUCCESS EndWait Shell $(File_UTILITY_INF) RegistryErrorString "UNABLE_COPY_FILE" set Message = $($R0) goto MessageExit endif SetRegValue $(ProductKey) {MajorVersion,$(NoTitle),$(!REG_VT_SZ), + $(ProductMajorVersion)} SetRegValue $(ProductKey) {MinorVersion,$(NoTitle),$(!REG_VT_SZ), + $(ProductMinorVersion)} ; ; Update op support ; SetRegValue $(KeyProduct) {OperationsSupport,$(NoTitle),$(!REG_VT_DWORD),$(ProductOpSupport)} LibraryProcedure Result, $(!LIBHANDLE), SetupChangeServiceConfig, + $(ProductSoftwareName), $(SERVICE_NO_CHANGE), + $(SERVICE_NO_CHANGE), $(SERVICE_NO_CHANGE), + $(ProductSoftwareImagePath), "", "", "", "", "" CloseRegKey $(ProductKey) ; don't want to reboot, but no way to avoid set ExitStatus = STATUS_SUCCESSFUL endif goto ScriptExit ;-------------------------------- ; Entry point for configuration ;-------------------------------- Configure = + goto ScriptExit ;-------------------------------- ; Exit point from a shell error ;-------------------------------- ShellErrorExit = + set DlgType = "MessageBox" set STF_MB_TITLE = $(ShellCodeErrorTitle) set STF_MB_TEXT = $(ShellCodeErrorText) set STF_MB_TYPE = 1 set STF_MB_ICON = 3 set STF_MB_DEF = 1 ui start "Error Message" set ExitStatus = STATUS_FAILED goto ScriptExit ;----------------------------------- ; Exit point from a registry error ;----------------------------------- RegistryErrorExit = + Shell $(File_UTILITY_INF) RegistryErrorString $(RegistryErrorIndex) set Message = $($R0) set ExitStatus = STATUS_FAILED goto MessageExit ;---------------------------- ; Exit point with a message ;---------------------------- MessageExit = + Shell $(File_SUBROUTN_INF) SetupMessage, $(!STF_LANGUAGE), "", $(Message) goto ScriptExit ;--------------------- ; Exit point for all ;--------------------- ScriptExit = + return $(ExitStatus) [GetFilesSize] set FileSizeList = ^(Files-RelayAgent, 3) set TotalSize = 0 ForListDo $(FileSizeList) Split-String $($) "=" SplitString set Size = *($(SplitString),3) set-add TotalSize = $(TotalSize) $(Size) EndForListDo set-div SizeInKB = $(TotalSize) 1024 return $(SizeInKB) [Install-Option] set STF_VITAL = "" ifstr(i) $(AddCopy) == "YES" AddSectionFilesToCopyList Files-RelayAgent $(SrcDir) $(!STF_WINDOWSSYSPATH) endif ifstr(i) $(DoCopy) == "YES" set !STF_NCPA_FLUSH_COPYLIST = TRUE CopyFilesInCopyList endif ifstr(i) $(DoConfig) == "YES" endif exit [Install-Update] set STF_VITAL = NO set STF_OVERWRITE = "VERIFYSOURCEOLDER" AddSectionFilesToCopyList Files-RelayAgent $(SrcDir) $(!STF_WINDOWSSYSPATH) exit