;-------------------------------------------------------------------
;
;   MODULE NAME:        OEMSETUP.INF
;
;   DESCRIPTION:        Installation parameter script for busmaster
;                       network adapter drivers running under
;                       Microsoft Windows NT.
;
;                       This script is interpreted by SETUP.EXE
;                       during driver installation.  It consists
;                       of the following four required sections
;                       and other supporting sections:
;
;                       1.  Identify
;                       2.  ReturnOptions
;                       3.  InstallOption
;                       4.  Source Media Descriptions
;-------------------------------------------------------------------

;-------------------------------------------------------------------
;   SECTION NAME:       Identify
;
;   DESCRIPTION:        This required section verifies that this
;                       script supports the option currently selected.
;
;   INPUT:              None.
;
;   OUTPUT:             $($R0)      Status
;                       $($R1)      Option Type
;                       $($R2)      Diskette Description
;-------------------------------------------------------------------

[Identify]

    set Status      =   STATUS_SUCCESSFUL
    set OptionType  =   NetAdapter
    set Media       =   #("Source Media Descriptions", 1, 1)
    return $(Status) $(OptionType) $(Media)

[Source Media Descriptions]

    1  = "IBM Streamer Installation Disk"
    2  = "Windows NT Setup CD-ROM Disk"


;-------------------------------------------------------------------
;   SECTION NAME:       ReturnOptions
;
;   DESCRIPTION:        This required section returns the list of
;                       options supported by this script and the
;                       text list representing the options.
;
;
;   INPUT:              $($0)       Language code
;
;   OUTPUT:             $($R0)      Status
;                       $($R1)      Option List
;                       $($R2)      Option Text List
;-------------------------------------------------------------------

[ReturnOptions]

    set Status          =   STATUS_FAILED
    set OptionList      =   {}
    set OptionTextList  =   {}
    set LanguageList    =   ^(LanguagesSupported, 1)

    ifcontains(i) $($0) not-in $(LanguageList)
        set Status = STATUS_NOLANGUAGE
        goto End_ReturnOptions
    endif

    ifstr(i) $($1) == ""
        goto OK_ReturnOptions
    endif

    set PlatformList = ^(PlatformsSupported, 1)
    Ifcontains(i) $($1) in $(PlatformList)
        goto OK_ReturnOptions
    else
        set Status = STATUS_NOTSUPPORTED
        goto End_ReturnOptions
    endif

OK_ReturnOptions = +
    set OptionList      = ^(Options, 1)
    set OptionTextList  = ^(OptionsText$($0), 1)
    set Status          = STATUS_SUCCESSFUL

End_ReturnOptions = +
    Return $(Status) $(OptionList) $(OptionTextList)

[LanguagesSupported]

    ENG

[PlatformsSupported]

    MCA
    ISA
    EISA

[Options]

    STREAMER

[OptionsTextENG]

    STREAMER    =   "IBM Streamer Family Adapters"


;-------------------------------------------------------------------
;
;   SECTION NAME:       InstallOption
;
;   DESCRIPTION:        This required section is shelled to by main
;                       installation processing or by NCPASHEL.INF
;                       during reconfiguration, removal, update,
;                       etc.  It performs three main functions:
;
;                       1.  Copies files representing options
;                       2.  Configures the installed option
;                       3.  Updates the registry for the installed
;                           option.
;
; INPUT:                $($0)       Language to use
;                       $($1)       OptionID to install
;                       $($2)       SourceDirectory
;                       $($3)       AddCopy  (YES | NO)
;                       $($4)       DoCopy   (YES | NO)
;                       $($5)       DoConfig (YES | NO)
;
; OUTPUT:               $($R0)      Status
;
;------------------------------------------------------------------------

[InstallOption]

    StartWait

    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

    read-syms GeneralConstants
    read-syms FileConstants
    read-syms FileConstants$(!STF_LANGUAGE)

    detect date

    set-title  $(FunctionTitle)

    set to   = Begin
    set from = Begin

    set CommonStatus = STATUS_SUCCESSFUL

    EndWait

Begin = +

    ifstr(i) $(!NTN_InstallMode) == DeInstall
        set from = fatal
        set to   = fatal
        goto RemoveAdapter
    endif

    ifstr(i) $(!NTN_InstallMode) == Update
        set from = fatal
        set to   = fatal
        goto UpgradeSoftware
    endif

    ifstr(i) $(!NTN_InstallMode) == Bind
        set from = fatal
        set to   = fatal
        goto BindingAdapter
    endif

    ifstr(i) $(!NTN_InstallMode) == Configure
        set CommonStatus = STATUS_REBOOT
        ifstr(i) $(ProductKeyName) == $(!NTN_RegBase)
            Shell $(UtilityInf),RegistryErrorString,CANNOT_CONFIGURE_SOFTWARE
            ifint $($ShellCode) != $(!SHELL_CODE_OK)
                goto ShellCodeError
            endif
            set Error = $($R0)
            set from  = end
            set to    = end
            goto NonFatalInfo
        endif
        set from = fatal
        set to   = fatal
        goto ConfigureAdapter
    endif

    set OEM_ABANDON_OPTIONS = {}
    set OEM_ABANDON_SOFTWARE = FALSE
    set OEM_ABANDON_ON = TRUE
    set from = fatal
    set to = fatal
    goto InstallAdapter

InstallAdapter = +

    OpenRegKey $(!REG_H_LOCAL) "" $(ProductKeyName) $(MAXIMUM_ALLOWED) KeyProduct

    Ifstr $(KeyProduct) == $(KeyNull)
        set OldVersionExisted = $(FALSE)
        goto LoadDLL
    endif

OldInstall = +

    CloseRegKey $(KeyProduct)

    ifstr(i) $(!NTN_RegBase) == $(ProductKeyName)

        Shell $(UtilityInf), VerExistedDlg, $(ProductSoftwareTitle),+
            $(ProductVersion)

        ifint $($ShellCode) != $(!SHELL_CODE_OK)
            goto ShellCodeError
        endif

        goto end

    endif

    Shell $(UtilityInf), CardExistedDlg

    ifint $($ShellCode) != $(!SHELL_CODE_OK)
        goto ShellCodeError
    endif

    ifstr(i) $($R1) != "OK"
        Set CommonStatus = STATUS_USERCANCEL
        goto end
    endif

    set OldVersionExisted = $(TRUE)

LoadDLL = +

    set OldSource = $(!STF_SRCDIR)

    Shell $(UtilityInf), DoAskSource, $(!STF_CWDDIR), $(!STF_SRCDIR)

    Ifint $($ShellCode) != $(!SHELL_CODE_OK)
        goto fatal
    endif
    Ifstr(i) $($R0) == STATUS_FAILED
        goto fatal
    endif
    Ifstr(i) $($R0) == STATUS_USERCANCEL
        goto end
    endif

    set !STF_SRCDIR = $($R1)

    install "Install-Dll"

    set !STF_SRCDIR = $(OldSource)

    StartWait

    Set STREAMER_2BYTE = 143
    Set STREAMER_1BYTE_LIST = {160, 162, 164, 168}
    Set AdapterList = {}

    ForListDo $(STREAMER_1BYTE_LIST)

        Set STREAMER_1BYTE = $($)

        set-mul mcaid = $(STREAMER_2BYTE), 256
        set-add mcaid = $(mcaid), $(STREAMER_1BYTE)
        set-dectohex mcaid_hex = $(mcaid)

        Shell $(UtilityInf), MCAFindBus, $(STREAMER_1BYTE), $(STREAMER_2BYTE)

        ifint $($ShellCode) != $(!SHELL_CODE_OK)
            goto ShellCodeError
        endif

        ifstr $($R0) != "NO_ERROR"
            set Error = $($R0)
            goto fatal
        endif

        ifstr(i) $($R1) != {}

            QueryListSize ListSize $(AdapterList)

            set MCA_List = $($R1)

            ForListDo $(MCA_List)
                set BusSlotMca = $($)
                set AdapterList = >($(AdapterList), $(BusSlotMca))
            EndForListDo

            QueryListSize ListSize $(AdapterList)

        endif

    EndForListDo

    ;   ------------------------------------------------------------
    ;   Prompt for PCI card installation
    ;   ------------------------------------------------------------

    Set DlgType = "MessageBox"
    Set STF_MB_TITLE = "Bus Type Determination"
    Set STF_MB_TEXT  = "Do you wish to configure a PCI network adapter?"
    Set STF_MB_TYPE  = "3" ; YES and NO buttons
    Set STF_MB_ICON  = "1" ; No icon
    Set STF_MB_DEF   = "2" ; Default is NO
    ui start "PCI"
    ifstr(i) $(DLGEVENT) == "YES"
        Set BusSlotID = {0, 0, $(PCI_ADAPTER_ID)}
        Set AdapterList = >($(AdapterList), $(BusSlotID))
    endif

    ;   ------------------------------------------------------------
    ;   End of PCI logic
    ;   ------------------------------------------------------------

    QueryListSize ListSize $(AdapterList)

    ifstr(i) $(AdapterList) == {}
        set Error = $(CANNOT_FIND_ANY_CARD)
        set CommonStatus = STATUS_USERCANCEL
        set from = "end"
        goto nonfatal
    endif

    ifint $(OldVersionExisted) == $(FALSE)
        goto NewDriverInstall
    else
        goto AfterNewDriverInstall
    endif

NewDriverInstall = +

    Ifstr(i) $(DoCopy) == "YES"
       Shell $(UtilityInf), DoAskSource, $(!STF_CWDDIR), $(SrcDir) YES
       Ifint $($ShellCode) != $(!SHELL_CODE_OK)
           Goto ShellCodeError
       Else-Ifstr(i) $($R0) == STATUS_FAILED
           Shell $(UtilityInf) RegistryErrorString "ASK_SOURCE_FAIL"
           ifint $($ShellCode) != $(!SHELL_CODE_OK)
               goto ShellCodeError
           endif
           set Error = $($R0)
           Goto fatal
       Else-Ifstr(i) $($R0) == STATUS_USERCANCEL
           Goto successful
       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)
           goto ShellCodeError
       endif
       set Error = $($R0)
       goto fatal
    endif

    Shell $(UtilityInf), AddSoftwareComponent, $(Manufacturer), +
        $(ProductSoftwareName), +
        $(ProductSoftwareName), +
        $(ProductSoftwareTitle), $(STF_CONTEXTINFNAME), +
        $(ProductSoftwareImagePath), "kernel", "NDIS", {}, "",+
        $(NetEventDLL)

    Set OEM_ABANDON_SOFTWARE = TRUE

    ifint $($ShellCode) != $(!SHELL_CODE_OK)
        goto ShellCodeError
    endif

    set RegistryErrorIndex = $($R0)
    Ifstr(i) $(RegistryErrorIndex) != "NO_ERROR"
        EndWait
        CloseRegKey $($R1)
        CloseRegKey $($R2)
        CloseRegKey $($R3)
        CloseRegKey $($R4)
        CloseRegKey $($R5)
        goto FatalRegistry
    endif

    Set SoftProductKey      = $($R1)
    Set SoftNetRuleKey      = $($R2)
    Set SoftServiceKey      = $($R3)
    Set SoftParameterKey    = $($R4)
    Set SoftLinkageKey      = $($R5)

    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)},+
                       {InstallDate,$(NoTitle),$(!REG_VT_DWORD),*($(Now),1)}}

    Shell  $(UtilityInf), AddValueList, $(SoftProductKey), $(NewValueList)

    ifint $($ShellCode) != $(!SHELL_CODE_OK)
        goto ShellCodeError
    endif

    set RegistryErrorIndex = $($R0)
    Ifstr(i) $(RegistryErrorIndex) != "NO_ERROR"
        EndWait
        CloseRegKey $(SoftProductKey)
        CloseRegKey $(SoftNetRuleKey)
        CloseRegKey $(SoftServiceKey)
        CloseRegKey $(SoftParameterKey)
        CloseRegKey $(SoftLinkageKey)
        goto FatalRegistry
    endif

    set NewValueList = {{type,$(NoTitle),$(!REG_VT_SZ),$(NetRuleSoftwareType)},+
                        {use,$(NoTitle),$(!REG_VT_SZ),$(NetRuleSoftwareUse)}, +
                        {bindform,$(NoTitle),$(!REG_VT_SZ),$(NetRuleSoftwareBindForm)}, +
                        {class,$(NoTitle),$(!REG_VT_MULTI_SZ),$(NetRuleSoftwareClass)}, +
                        {bindable,$(NoTitle),$(!REG_VT_MULTI_SZ),$(NetRuleSoftwareBindable)}, +
                        {InfOption,$(NoTitle),$(!REG_VT_SZ),$(Option)}}

    Shell  $(UtilityInf), AddValueList, $(SoftNetRuleKey), $(NewValueList)

    ifint $($ShellCode) != $(!SHELL_CODE_OK)
        goto ShellCodeError
    endif

    set RegistryErrorIndex = $($R0)
    CloseRegKey $(SoftProductKey)
    CloseRegKey $(SoftNetRuleKey)
    CloseRegKey $(SoftServiceKey)
    CloseRegKey $(SoftParameterKey)
    CloseRegKey $(SoftLinkageKey)
    Ifstr(i) $(RegistryErrorIndex) != "NO_ERROR"
        EndWait
        goto FatalRegistry
    endif

AfterNewDriverInstall = +

    ForListDo $(AdapterList)

        set BusNum = *($($),1)
        set SlotNum = *($($),2)
        set NETCARD_ID = *($($),3)

        Shell $(UtilityInf), IsNetCardAlreadyInstalled, +
            $(BusNum), +
            $(SlotNum), +
            $(ProductHardwareDescription), +
            $(ProductHardwareName)

        ifint $($ShellCode) != $(!SHELL_CODE_OK)
            goto ShellCodeError
        endif
        ifstr $($R0) != "NO_ERROR"
            set Error = $($R0)
            goto fatal
        endif

        ifstr(i) $($R1) == "YES"
            goto NextAdapter
        endif

        Shell $(UtilityInf), AddHardwareComponent, +
            $(ProductHardwareName),+
            $(STF_CONTEXTINFNAME),+
            $(ProductKeyName)

        ifint $($R4) != -1
            Set OEM_ABANDON_OPTIONS = >($(OEM_ABANDON_OPTIONS), $(!NTN_SoftwareBase)"\Microsoft\Windows NT\CurrentVersion\NetworkCards\"$($R4))
        endif

        ifint $($ShellCode) != $(!SHELL_CODE_OK)
            goto ShellCodeError
        endif
        set RegistryErrorIndex = $($R0)
        Ifstr(i) $(RegistryErrorIndex) != "NO_ERROR"
            EndWait
            CloseRegKey $($R1)
            CloseRegKey $($R2)
            CloseRegKey $($R3)
            goto FatalRegistry
        endif

        Set HardNetCardKey      = $($R1)
        Set HardNetRuleKey      = $($R2)
        Set HardParameterKey    = $($R3)
        Set AdapterNumber       = $($R4)
        ifint $(NETCARD_ID) == $(PCI_ADAPTER_ID)
            Set-add SlotNum = $(AdapterNumber), "16"
        endif

        ifint $(NETCARD_ID) == 36768
            set MyTitle = "Slot "$(SlotNum)": IBM LANStreamer MC 32 Adapter"
        else-ifint $(NETCARD_ID) == 36770
            set MyTitle = "Slot "$(SlotNum)": IBM Auto LANStreamer MC 32 Adapter"
        else-ifint $(NETCARD_ID) == 36772
            set MyTitle = "Slot "$(SlotNum)": IBM LANStreamer MC 16 Adapter"
        else-ifint $(NETCARD_ID) == 36776
            set MyTitle = "Slot "$(SlotNum)": IBM EtherStreamer MC 32 Adapter"
        else-ifint $(NETCARD_ID) == $(PCI_ADAPTER_ID)
            set MyTitle = "["$(SlotNum)"] IBM Auto LANStreamer PCI Adapter"
        else
            set MyTitle = "["$($R4)"] "$(ProductHardwareTitle)
        endif

        Set MyService = "Streamer"$(AdapterNumber)

        Set NewValueList = {{Manufacturer,$(NoTitle),$(!REG_VT_SZ),$(Manufacturer)},+
                           {Title,$(NoTitle),$(!REG_VT_SZ),$(MyTitle)},+
                           {Description,$(NoTitle),$(!REG_VT_SZ),$(ProductHardwareDescription)},+
                           {ProductName,$(NoTitle),$(!REG_VT_SZ),$(ProductHardwareName)},+
                           {ServiceName,$(NoTitle),$(!REG_VT_SZ),$($R5)},+
                           {InstallDate,$(NoTitle),$(!REG_VT_DWORD),*($(Now),1)}}

        Shell  $(UtilityInf), AddValueList, $(HardNetCardKey), $(NewValueList)

        ifint $($ShellCode) != $(!SHELL_CODE_OK)
            goto ShellCodeError
        endif

        CloseRegKey $(HardParameterKey)

        RunProgram ExitCode "" "" $(!STF_WINDOWSSYSPATH)"\stsetup.exe" +
            $(MyService) $(SlotNum) $(NETCARD_ID)

        set CFG_ReturnCode = $(DLG_PB_CANCEL)
        ifint $(ExitCode) == 0
            set CFG_ReturnCode = $(DLG_PB_OK)
        endif

        ifint $(CFG_ReturnCode) != $(DLG_PB_OK)
            goto NextAdapter
        endif

        set TempProdName = """"$(ProductHardwareName)$(AdapterNumber)""""
        set TempBindForm = $(TempProdName)$(NetRuleHardwareBindForm)
        set NewValueList = {{type,$(NoTitle),$(!REG_VT_SZ),$(NetRuleHardwareType)},+
                            {bindform,$(NoTitle),$(!REG_VT_SZ),$(TempBindForm)}, +
                            {class,$(NoTitle),$(!REG_VT_MULTI_SZ),$(NetRuleHardwareClass)}, +
                            {InfOption,$(NoTitle),$(!REG_VT_SZ),$(Option)}}

        Shell  $(UtilityInf), AddValueList, $(HardNetRuleKey), $(NewValueList)

        CloseRegKey $(HardNetCardKey)
        CloseRegKey $(HardNetRuleKey)
        CloseRegKey $(HardParameterKey)

        ifint $($ShellCode) != $(!SHELL_CODE_OK)
            goto ShellCodeError
        endif

NextAdapter = +

    EndForListDo

LastAdapter = +

    EndWait

    goto successful

ConfigureAdapter = +

    OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_RegBase) $(MAXIMUM_ALLOWED) NetCardKey
    ifstr(i) $(NetCardKey) == ""
        set CommonStatus = STATUS_USERCANCEL
        goto successful
    endif
    GetRegValue $(NetCardKey) "ServiceName" ServiceInfo
    set ServiceName = *($(ServiceInfo),4)
    CloseRegKey $(NetCardKey)

    OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_ServiceBase)"\"$(ServiceName)"\Parameters" $(MAXIMUM_ALLOWED) ParamKey
    ifstr(i) $(ParamKey) == ""
        goto successful
    endif

    set NETCARD_ID = "?"
    GetRegValue $(ParamKey),"McaPosId", RegList
    ifstr *($(RegList), 4) != ""
        set NETCARD_ID = *($(RegList), 4)
    endif

    set SlotNum = "?"
    GetRegValue $(ParamKey),"SlotNumber", RegList
    ifstr *($(RegList), 4) != ""
        set SlotNum = *($(RegList), 4)
    endif

    CloseRegKey $(ParamKey)

    RunProgram ExitCode "" "" $(!STF_WINDOWSSYSPATH)"\stsetup.exe" +
        $(ServiceName) $(SlotNum) $(NETCARD_ID)

    set CFG_ReturnCode = $(DLG_PB_CANCEL)
    ifint $(ExitCode) == 0
        set CFG_ReturnCode = $(DLG_PB_OK)
    endif

    ifint $(CFG_ReturnCode) != $(DLG_PB_OK)
        set CommonStatus = STATUS_USERCANCEL
    endif

    goto successful

BindingAdapter =+

    set Error = "Binding: Sorry, not yet implemented."
    goto fatal

RemoveAdapter = +


    Ifstr(i) $(ProductKeyName) == $(!NTN_RegBase)

        Shell $(UtilityInf), RemoveSoftwareComponent, +
            $(Manufacturer), +
            $(ProductSoftwareName)

        ifint $($ShellCode) != $(!SHELL_CODE_OK)
            goto ShellCodeError
        endif

        set RegistryErrorIndex = $($R0)

        Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
            goto FatalRegistry
        endif

    else

        Shell $(UtilityInf), RemoveHardwareComponent, +
            $(Manufacturer), +
            $(ProductSoftwareName), +
            $(!NTN_RegBase)

        ifint $($ShellCode) != $(!SHELL_CODE_OK)
            goto ShellCodeError
        endif

        set RegistryErrorIndex = $($R0)

        Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
            goto FatalRegistry
        endif

    endif

    goto end

UpgradeSoftware = +

    ifstr(i) $(ProductKeyName) == $(!NTN_RegBase)

        OpenRegKey $(!REG_H_LOCAL) "" $(ProductKeyName) $(MAXIMUM_ALLOWED) KeyProduct

        Ifstr $(KeyProduct) != $(KeyNull)

            GetRegValue $(KeyProduct),"MajorVersion", VersionInfo
            set Version = *($(VersionInfo), 4)

            Shell $(UtilityInf), GetInfFileNameFromRegistry, $(KeyProduct)

            ifint $($ShellCode) != $(!SHELL_CODE_OK)
                goto ShellCodeError
            endif

            set !UG_Filename = $($R0)

            ifstr(i) $(!UG_Filename) != ""
                install "Install-Update"
                ifstr(i) $(STF_INSTALL_OUTCOME) != STF_SUCCESS
                    goto fatal
                endif
            endif

            SetRegValue $(KeyProduct) {MajorVersion,$(NoTitle),$(!REG_VT_SZ),$(ProductMajorVersion)}
            SetRegValue $(KeyProduct) {MinorVersion,$(NoTitle),$(!REG_VT_SZ),$(ProductMinorVersion)}

            ifint $(Version) != $(ProductVersion)
            endif

            CloseRegKey $(KeyProduct)

        else

            goto FatalRegistry

        endif

    else

        OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_RegBase) +
              $(MAXIMUM_ALLOWED) NetworkCardKey

        Ifstr(i) $(NetworkCardKey) != $(KeyNull)
            GetRegValue $(NetworkCardKey),"ServiceName", ServiceNameInfo
            set ServiceName = *($(ServiceNameInfo), 4)
            OpenRegKey $(NetworkCardKey) "" "NetRules" +
                $(MAXIMUM_ALLOWED) NetRuleKey

            Ifstr(i) $(NetRuleKey) != $(KeyNull)
            else
                goto FatalRegistry
            endif

            CloseRegKey $(NetRules)
            CloseRegKey $(NetworkCardKey)
        else
            goto FatalRegistry
        endif

        OpenRegKey $(!REG_H_LOCAL) "" +
              $(!NTN_ServiceBase)"\"$(ServiceName) +
              $(MAXIMUM_ALLOWED) ServiceKey

        Ifstr(i) $(ServiceKey) != $(KeyNull)
            CloseRegKey $(ServiceKey)
        else
            goto FatalRegistry
        endif
    endif

    goto end

successful = +
    goto end

abandon = +
    ForListDo $(OEM_ABANDON_OPTIONS)
        Shell $(UtilityInf), RemoveHardwareComponent, $(Manufacturer), +
            $(ProductSoftwareName), $($)
        ifint $($ShellCode) != $(!SHELL_CODE_OK)
            goto ShellCodeError
        endif
        set RegistryErrorIndex = $($R0)
        Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
            goto FatalRegistry
        endif
    EndForListDo

    Ifstr(i) $(OEM_ABANDON_SOFTWARE) == TRUE
        Shell $(UtilityInf), RemoveSoftwareComponent, $(Manufacturer), +
            $(ProductSoftwareName), FALSE
        ifint $($ShellCode) != $(!SHELL_CODE_OK)
            goto ShellCodeError
        endif
        set RegistryErrorIndex = $($R0)
        Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
            goto FatalRegistry
        endif
    endif
    goto end

warning = +
    Shell $(SubroutineInf) SetupMessage, $(!STF_LANGUAGE), "WARNING", $(Error)
    ifint $($ShellCode) != $(!SHELL_CODE_OK)
        goto ShellCodeError
    endif
    ifstr(i) $($R1) == "OK"
        goto $(to)
    else-ifstr(i) $($R1) == "CANCEL"
        goto $(from)
    else
        goto "end"
    endif

NonFatalInfo = +
    Set CommonStatus = STATUS_USERCANCEL
    Set Severity = STATUS
    goto NonFatalMsg

nonfatal = +
    Set Severity = NONFATAL
    goto NonFatalMsg

NonFatalMsg = +
    ifstr(i) $(Error) == ""
        Set Severity = NONFATAL
        Shell $(UtilityInf) RegistryErrorString "SETUP_FAIL"
        ifint $($ShellCode) != $(!SHELL_CODE_OK)
            goto ShellCodeError
        endif
        set Error = $($R0)
    endif
    Shell $(SubroutineInf) SetupMessage, $(!STF_LANGUAGE), $(Severity), $(Error)
    ifint $($ShellCode) != $(!SHELL_CODE_OK)
        goto ShellCodeError
    endif
    ifstr(i) $($R1) == "OK"
        goto $(from)
    else
        goto "end"
    endif

FatalRegistry = +
    Shell $(UtilityInf) RegistryErrorString $(RegistryErrorIndex)
    ifint $($ShellCode) != $(!SHELL_CODE_OK)
        goto ShellCodeError
    endif
    set Error = $($R0)
    goto fatal

fatal = +
    ifstr(i) $(Error) == ""
        Shell $(UtilityInf) RegistryErrorString "SETUP_FAIL"
        ifint $($ShellCode) != $(!SHELL_CODE_OK)
            goto ShellCodeError
        endif
        set Error = $($R0)
    endif
    Shell $(SubroutineInf) SetupMessage, $(!STF_LANGUAGE), "FATAL", $(Error)
    ifint $($ShellCode) != $(!SHELL_CODE_OK)
        goto ShellCodeError
    endif
    goto setfailed

ShellCodeError = +
    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"
    goto setfailed

setfailed = +
    set CommonStatus = STATUS_FAILED
    ifstr(i) $(OEM_ABANDON_ON) == TRUE
        set OEM_ABANDON_ON = FALSE
        goto abandon
    endif
    goto end

end = +
    goto term

term = +

    Return $(CommonStatus)

[GeneralConstants]

    from                =   ""
    to                  =   ""
    KeyNull             =   ""
    MAXIMUM_ALLOWED     =   33554432
    RegistryErrorIndex  =   NO_ERROR
    KeyProduct          =   ""
    TRUE                =   1
    FALSE               =   0
    NoTitle             =   0
    OldVersionExisted   =   $(FALSE)


[FileConstants]

    UtilityInf          =   "UTILITY.INF"
    SubroutineInf       =   "SUBROUTN.INF"
    SoftwareType        =   "driver"
    StreamerDLL         =   "callcfg.dll"
    NetEventDLL         =   "%SystemRoot%\System32\netevent.dll"
    DLG_PB_OK           =   1281        ;   User pressed "OK" pushbutton
    DLG_PB_CANCEL       =   1282        ;   User pressed "CANCEL" pushbutton
    PCI_ADAPTER_ID      =   24          ;   0x0018 in decimal
    Manufacturer        =   "Microsoft"
    ProductMajorVersion =   "3"
    ProductMinorVersion =   "1"
    ProductVersion      =   $(ProductMajorVersion)"."$(ProductMinorVersion)
    ProductSoftwareName     = "Streamer"
    ProductSoftwareImagePath = "%SystemRoot%\system32\drivers\streamer.sys"
    NetRuleSoftwareType     = "StreamerSys ndisDriver StreamerDriver"
    NetRuleSoftwareUse      = $(SoftwareType)
    NetRuleSoftwareBindForm = """StreamerSys"" yes no container"
    NetRuleSoftwareClass    = {"streamer basic"}
    NetRuleSoftwareBindable = {"streamerDriver streamerAdapter non exclusive 100"}
    ProductHardwareName     = "Streamer"
    NetRuleHardwareType     = "Streamer streamerAdapter"
    NetRuleHardwareBindForm = " yes yes container"
    NetRuleHardwareClass    = {"streamerAdapter basic"}
    ProductKeyName  = $(!NTN_SoftwareBase)"\"$(Manufacturer)"\"$(ProductSoftwareName)"\CurrentVersion"
    ParamKeyName    = $(!NTN_ServiceBase)"\"$(ProductHardwareName)"\Parameters"

[FileConstantsENG]

    FunctionTitle               = "IBM Streamer Family Adapter Card Setup"
    ProductSoftwareDescription  = "IBM Streamer Family Adapter Driver"
    ProductHardwareDescription  = "IBM Streamer Family Adapter "
    CANNOT_FIND_ANY_CARD        = "Network card is not present in the system"
    ProductSoftwareTitle        = "IBM Streamer Family Adapter Driver"
    ProductHardwareTitle        = "IBM Streamer Family Adapter "
    ShellCodeErrorTitle         = "Error: "$(FunctionTitle)
    ShellCodeErrorText          = "OEMSETUP.INF Shell Code Error."

[date]
    Now = {} ? $(!LIBHANDLE) GetSystemDate

[Files-Dll]
1, stsetup.exe, SIZE=57344
1, callcfg.dll, SIZE=26112
1, cfgedit.exe, SIZE=117760

[Files-Inf]
1, oemsetup.inf, SIZE=28036, RENAME=$(!UG_Filename)

[Files-STREAMER]

1, STREAMER.SYS, SIZE=115200

[Install-Option]

    set STF_VITAL = ""

    ifstr(i) $(AddCopy) == "YES"

        AddSectionFilesToCopyList Files-$(Option) $(SrcDir) $(!STF_WINDOWSSYSPATH)\drivers

    endif

    ifstr(i) $(DoCopy) == "YES"

       set !STF_NCPA_FLUSH_COPYLIST = TRUE
       CopyFilesInCopyList

    endif

    Exit

[Install-Update]
   set STF_VITAL        = ""
   set STF_OVERWRITE    = "VERIFYSOURCEOLDER"

   AddSectionFilesToCopyList Files-$(Option) $(SrcDir) $(!STF_WINDOWSSYSPATH)\drivers
   AddSectionFilesToCopyList Files-Inf $(SrcDir) $(!STF_WINDOWSSYSPATH)

   set !STF_NCPA_FLUSH_COPYLIST = TRUE
   CopyFilesInCopyList
   exit

[Install-Dll]
   set STF_VITAL        = ""
   AddSectionFilesToCopyList Files-Dll $(!STF_SRCDIR) $(!STF_WINDOWSSYSPATH)
   CopyFilesInCopyList
   exit
