[Identification]
    OptionType = NetService
[Options]
    RelayAgent
[FileConstants]
    Manufacturer                = "Microsoft"
    ProductMajorVersion         = "4"
    ProductMinorVersion         = "0"
    ProductVersion              = $(ProductMajorVersion)"."$(ProductMinorVersion)
    ProductOpSupport            = 132 
    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
            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)
    Install = +
        OpenRegKey $(!REG_H_LOCAL) "" $(TCPIPRegRoot) $(MAXIMUM_ALLOWED) TCPIPRootKey
        ifstr $(TCPIPRootKey) == $(KeyNull)
            set Message = ErrorTCPIPNotInstalled
            goto MessageExit
        endif
        CloseRegKey $(TCPIPRegRoot)
        OpenRegKey $(!REG_H_LOCAL) "" $(ProductKeyName) $(MAXIMUM_ALLOWED) ProductKey
        ifstr $(ProductKey) != $(KeyNull)
            CloseRegKey $(ProductKey)
            Shell $(File_UTILITY_INF), VerExistedDlg, +
                  $(ProductSoftwareTitle), $(ProductVersion)
            goto ScriptExit
        endif
        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 = 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
        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
        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
        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
        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
        set ExitStatus = STATUS_SUCCESSFUL
        goto ScriptExit
    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
        set ExitStatus = STATUS_SUCCESSFUL
        goto ScriptExit
    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)}
            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)
            set ExitStatus = STATUS_SUCCESSFUL
        endif
        goto ScriptExit
    Configure = +
        goto ScriptExit
    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
    RegistryErrorExit = +
        Shell $(File_UTILITY_INF) RegistryErrorString $(RegistryErrorIndex)
        set Message = $($R0)
        set ExitStatus = STATUS_FAILED
        goto MessageExit
    MessageExit = +
        Shell $(File_SUBROUTN_INF) SetupMessage, $(!STF_LANGUAGE), "", $(Message)
        goto ScriptExit
    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
[Source Media Descriptions]
   1 = "Windows NT Server CD-ROM" , TAGFILE = cdrom_s.45
[Signature]
    FileType = MICROSOFT_FILE
[GetSignature]
    read-syms Signature
    return $(FileType)
[ProductType]
STF_PRODUCT  = LanmanNT
STF_PLATFORM = I386
[Files-Inf]
2,	oemsetup.inf,	 SIZE=1000,	RENAME=$(!UG_Filename)
[Files-RelayAgent]
1,IPRIP.DLL , SIZE=999
1,RELAY.DLL , SIZE=999
1,ROUTER.EXE , SIZE=999
1,TRACE.DLL , SIZE=999
[LanguagesSupported]
    ENG
[OptionsTextENG]
    RelayAgent = "DHCP Relay Agent"
[FileConstantsENG]
FunctionTitle                   = "Relay Agent Setup"
ProductSoftwareDescription      = "Enables the Windows NT Server to forward DHCP (Dynamic Host Configuration Protocol) broadcasts across a router to a remote DHCP server."
ProductSoftwareDisplayName      = "DHCP Relay Agent"
ProductSoftwareTitle            = "DHCP Relay Agent"
ErrorTCPIPNotInstalled          = "TCP/IP is not installed. Please install TCP/IP and retry this installation."
ShellCodeErrorTitle             = "Error: "$(FunctionTitle)
ShellCodeErrorText              = "Shell Code Error."
ProCaption   = "Windows NT Setup"
ProCancel    = "Cancel"
ProCancelMsg = "Windows NT Networking is not correctly installed.  "+
               "Are you sure you want to cancel copying files?"
ProCancelCap = "Network Setup Message"
[DefaultsENG]
[DialogConstantsENG]
Help            = "&Help"
Exit            = "Cancel"
OK              = "OK"
HelpContext     = ""
Continue        = "Continue"
Cancel          = "Cancel"
[FileDependentDlgENG]
