[Identification]
    OptionType = NetAdapter

[PlatformsSupported]
    PCI
    "Jazz-Internal Bus"

[LanguagesSupported]
    ENG

[Options]
    Smartio/Industio

[AdapterInfo]
    Smartio/Industio  = "Smartio/Industio Family",  Mxserp, Mxserp, 0, mxsicfg.exe, {5760 4160 4416 4417 4896 4128 4161 5761 4897 4928 4162 4480 4129 4130 4481 5762 4164 4163 4992 4224 4418 4929 4419}
;------------------------------------------------------------------------------------1680 1040 1140 1141 1320 1020 1041 1681 1321 1340 1042 1180 1021 1022 1181 1682 1044 1043 1380 1080 1142 1341 1143 
[FileConstants]
    ExitState   = "Active"
    OldVersionExisted = $(FALSE)
    HdwDriverComponentExists = $(FALSE)
    DriverPath  = $(!STF_NTPATH)"\drivers"
    UtilityInf  = "UTILITY.INF"
    subroutninf = "SUBROUTN.INF"
    ParamInf    = "NCPARAM.INF"
    HandleNull  = ""
AdapterList = ^(AdapterInfo,0)
AdapterTitleList = ^(AdapterInfo, 1)
AdapterHardwareNameList = ^(AdapterInfo, 2)
AdapterHardwareDriverList = ^(AdapterInfo, 3)
AdapterHardwareTypeList = ^(AdapterInfo, 4)
AdapterSetupList = ^(AdapterInfo, 5)
AdapterHardwareAdapterIDList = ^(AdapterInfo$(BusType), 6)
AdapterTitle = *($(AdapterTitleList), ~($(AdapterList), $(Option)))
AdapterHardwareName = *($(AdapterHardwareNameList), ~($(AdapterList), $(Option)))
AdapterHardwareDriver = *($(AdapterHardwareDriverList), ~($(AdapterList), $(Option)))
AdapterHardwareType = *($(AdapterHardwareTypeList), ~($(AdapterList), $(Option)))
AdapterSetupName = *($(AdapterSetupList), ~($(AdapterList), $(Option)))
AdapterRule = *($(AdapterHardwareDriverList), ~($(AdapterList), $(Option)))
AdapterHardwareAdapterID = *($(AdapterHardwareAdapterIDList), ~($(AdapterList), $(Option)))
AdapterServiceName = ""
AdapterName = ""    ; Mxserp0, ...
    NetEventDLL     = "%SystemRoot%\System32\netevent.dll"
    IoLogMsgDLL     = "%SystemRoot%\System32\IoLogMsg.dll"
    Manufacturer    = "MOXA"
    SoftwareType    = "driver"
    ProductMajorVersionHdwDriver     = "5"
    ProductMinorVersionHdwDriver     = "12"
    ProductVersionHdwDriver  = $(ProductMajorVersionHdwDriver)"."$(ProductMinorVersionHdwDriver)
    ProductSoftwareNameHdwDriver = $(AdapterHardwareDriver)
    ProductSoftwareImagePathHdwDriver = "%SystemRoot%\System32\drivers\"$(AdapterHardwareDriver)".sys"
    NetRuleSoftwareTypeHdwDriver     = $(AdapterHardwareDriver)"sys "$(AdapterHardwareDriver)"Driver"
    NetRuleSoftwareUseHdwDriver      = $(SoftwareType)
    NetRuleSoftwareBindFormHdwDriver = """"$(AdapterHardwareDriver)"Driver"" yes no container"
    NetRuleSoftwareClassHdwDriver    = {$(AdapterHardwareDriver)"Driver basic"}
    NetRuleSoftwareHiddenHdwDriver   = 1
    NetRuleHardwareType     = $(AdapterRule)" "$(AdapterRule)"Adapter"
    NetRuleHardwareBindForm = " yes yes container"
    NetRuleHardwareClass    = {$(AdapterHardwareDriver)"Adapter basic"}
    ProductHardwareName         = $(AdapterHardwareDriver)
    AdapterParameters = {}
    ProductKeyNameHdwDriver  = $(!NTN_SoftwareBase)"\"$(Manufacturer)"\"$(ProductSoftwareNameHdwDriver)"\CurrentVersion"
    ParamKeyName    = $(!NTN_ServiceBase)"\"$(ProductHardwareName)"\Parameters"

[GeneralConstants]
    NoTitle            = 0
    ExitCodeOk         = 0
    ExitCodeCancel     = 1
    ExitCodeFatal      = 2
    KeyNull            = ""
    MAXIMUM_ALLOWED    = 33554432
    RegistryErrorIndex = NO_ERROR
    KeyProduct         = ""
    KeyParameters      = ""
    TRUE               = 1
    FALSE              = 0
    fRemoveMX          = TRUE
    ProductID          = "0"

;$(StartComNo) $(RxFifoTrig) $(TxFifoSize) 
; is only for unattended install
;
;StartComNo : The start com number
;             ex : If you want to com number is com11,com12,com13....,
;                  you can set --
;                     StartComNo  = {"11"}  
;RxFifoTrig : The receive FIFO trigger size.
;             0 -- 1 byte  
;             1 -- 4 bytes 
;             2 -- 8 bytes 
;             3 -- 14 bytes
;TxFifoSize : The transmit FIFO size.
;             0 -- 1 byte  
;             1 -- 2 bytes 
;             2 -- 3 bytes
;             :     :
;             :     :
;             15 -- 16 bytes
    StartComNo         = {"3"}  ; default com number is com3, com4, com5...
    RxFifoTrig         = {"3"}  ; default 14 bytes
    TxFifoSize         = {"15"} ; default 16 bytes 

[DebugOptions]
    !DebugOutputControl = 0

[UiVars]
    from      = ""
    to        = ""
    !STF_NTDRIVE        = ""
    !STF_NTPATH         = ""
    !STF_WINDOWSPATH    = "" ? $(!LIBHANDLE) GetWindowsNtDir
    !STF_WINDOWSSYSPATH = "" ? $(!LIBHANDLE) GetWindowsNtSysDir
    !STF_FLOPPYLIST     = {} ? $(!LIBHANDLE) GetFloppyDriveLetters
    !STF_UNUSEDDRIVES   = {} ? $(!LIBHANDLE) GetUnusedDrives
    !STF_LANGUAGE       = "ENG"
    VolumeList      = {} ? $(!LIBHANDLE) GetHardDriveLetters
    VolumeFreeList  = {} ? $(!LIBHANDLE) GetHardDriveFreeSpace
    VolumeFSList    = {} ? $(!LIBHANDLE) GetHardDriveFileSystems
    DestVolume      = ""
    MinHelpID   = 25000
    MaxHelpID   = 25999

[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)
        ifstr(i) $($1) == ""
            goto returnoptions
        endif
        set PlatformList = ^(PlatformsSupported, 1)
        Ifcontains(i) $($1) in $(PlatformList)
            goto returnoptions
        else
            set Status = STATUS_NOTSUPPORTED
            goto finish_ReturnOptions
        endif
    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)

[Shell Commands]
    set-title "Serial Setup"
    set-subst LF = "\n"
    set Exit_Code = $(ExitCodeOk)
    ifstr(i) $(!STF_RANFROM) != ""
        ifstr(i) $(!STF_RANFROM) != $(!STF_CWDDIR)"SERIAL\"
           set !STF_SRCDIR = $(!STF_RANFROM)
        endif
    endif
    LoadLibrary "x" $(!STF_CWDDIR)setupdll.dll !LIBHANDLE
    shell "" InstallOption ENG MOXA $(!STF_SRCDIR)
    FreeLibrary $(!LIBHANDLE)
    set Status = $($R0)
    Return $(Status)

[InstallOption]
    read-syms DebugOptions
    set Status = STATUS_FAILED
    set Option    = $($1)
    set SrcDir    = $($2)
    set AddCopy   = $($3)
    set DoCopy    = $($4)
    set DoConfig  = $($5)
    set !SourceDir = $($2)
    read-syms GeneralConstants
    read-syms FileConstants
    set LanguageList = ^(LanguagesSupported, 1)
    Ifcontains(i) $($0) NOT-IN $(LanguageList)
        return STATUS_NOLANGUAGE
    Endif
    set-subst LF = "\n"
    read-syms BindingInfo-$(AdapterHardwareDriver)
    set NetRuleSoftwareBindableHdwDriver = $(BindingInfo)
    read-syms DialogConstants$(!STF_LANGUAGE)
    ifstr(i) $(!NTN_Origination) == "NCPA"
        set Continue = "OK"
    endif
    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 StartLabel = removeAdapter
    else-Ifstr(i) $(!NTN_InstallMode) == update
        set StartLabel = upgradeSoftware
    else-Ifstr(i) $(!NTN_InstallMode) == bind
        set StartLabel = bindingAdapter
    else-Ifstr(i) $(!NTN_InstallMode) == configure
        set StartLabel = getAdapterSettings
        Ifstr(i) $(ProductKeyNameHdwDriver) == $(!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 = end
    else
        set StartLabel = installadapter
        set OEM_ABANDON_OPTIONS = {}
        set OEM_ABANDON_SOFTWARE = FALSE
        set OEM_ABANDON_ON = TRUE
    endif
    set to = $(fatal)
    Goto $(StartLabel)

;-----------------------------------------------------------------------------
installadapter = +
            OpenRegKey $(!REG_H_LOCAL) "" $(ProductKeyNameHdwDriver) +
                       $(MAXIMUM_ALLOWED) KeyProductHdwDriver
            Ifstr $(KeyProductHdwDriver) != $(KeyNull)
                CloseRegKey $(KeyProductHdwDriver)
                Shell $(UtilityInf), CardExistedDlg
                ifint $($ShellCode) != $(!SHELL_CODE_OK)
                    goto ShellCodeError
                endif
                ifstr(i) $($R1) != "OK"
                    goto end
                endif
                set HdwDriverComponentExists = $(TRUE)
                set OldVersionExisted = $(TRUE)
            EndIf
    goto skipoptions

;-----------------------------------------------------------------------------
skipoptions = +
    ifint $(HdwDriverComponentExists) == $(TRUE)
            set from = end
            goto getAdapterSettings
    endif
    StartWait
    ifstr(i) $(!NTN_InstallMode) == "install"
        shell $(UtilityInf) AssignAdapterNumber
        set AdapterName = $(ProductHardwareName)$($R1)
    endif
    ifint $(HdwDriverComponentExists) == $(FALSE)
        ifstr(i) $(!NTN_InstallMode) == "install"
           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
                  set CommonStatus = STATUS_USERCANCEL
                  Goto end
              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
        endif
    endif

;-----------------------------------------------------------------------------
addHdwDriverComponent = +
    set MXSpecificString = $(AdapterHardwareName)
    Ifint $(HdwDriverComponentExists) == $(TRUE)
        goto addAdapterComponent
    Endif
        set TypeofService = "kernelautostart"
        set ServiceOrderGroup = "Extended base"
        set Dependencies = {}
        set ObjectName = ""
        set TypeSupported = "7"
        set EventLogLocation = "System"
        set ErrorControlValue = 1
        Shell $(UtilityInf), AddSoftwareComponent, +
                                    $(Manufacturer), +
                                    $(ProductSoftwareNameHdwDriver), +
                                    $(ProductSoftwareNameHdwDriver), +
                                    $(ProductSoftwareTitleHdwDriver), +
                                    $(STF_CONTEXTINFNAME), +
                                    $(ProductSoftwareImagePathHdwDriver), +
                                    $(TypeofService), +
                                    $(ServiceOrderGroup), +
                                    $(Dependencies), +
                                    $(ObjectName), +
                                    $(IoLogMsgDLL)";"$(ProductSoftwareImagePathHdwDriver), +
                                    $(TypeSupported), +
                                    $(EventLogLocation), +
                                    $(ErrorControlValue)
        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),$(ProductMajorVersionHdwDriver)},+
                           {MinorVersion,$(NoTitle),$(!REG_VT_DWORD),$(ProductMinorVersionHdwDriver)},+
                           {Title,$(NoTitle),$(!REG_VT_SZ),$(ProductSoftwareTitleHdwDriver)},+
                           {Description,$(NoTitle),$(!REG_VT_SZ),$(ProductSoftwareDescriptionHdwDriver)},+
                           {ServiceName,$(NoTitle),$(!REG_VT_SZ),$(ProductSoftwareNameHdwDriver)},+
                           {hidden,$(NoTitle),$(!REG_VT_DWORD),$(NetRuleSoftwareHiddenHdwDriver)}, +
                           {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),$(NetRuleSoftwareTypeHdwDriver)},+
                            {use,$(NoTitle),$(!REG_VT_SZ),$(NetRuleSoftwareUseHdwDriver)}, +
                            {bindform,$(NoTitle),$(!REG_VT_SZ),$(NetRuleSoftwareBindFormHdwDriver)}, +
                            {class,$(NoTitle),$(!REG_VT_MULTI_SZ),$(NetRuleSoftwareClassHdwDriver)}, +
                            {bindable,$(NoTitle),$(!REG_VT_MULTI_SZ),$(NetRuleSoftwareBindableHdwDriver)}, +
                            {InfOption,$(NoTitle),$(!REG_VT_SZ),$(Option)}}
        Shell  $(UtilityInf), AddValueList, $(SoftNetRuleKey), $(NewValueList)
        ifint $($ShellCode) != $(!SHELL_CODE_OK)
            goto ShellCodeError
        endif
        set RegistryErrorIndex = $($R0)
        FlushRegKey $(SoftProductKey)
        FlushRegKey $(SoftNetRuleKey)
        FlushRegKey $(SoftServiceKey)
        FlushRegKey $(SoftParameterKey)
        FlushRegKey $(SoftLinkageKey)
        CloseRegKey $(SoftProductKey)
        CloseRegKey $(SoftNetRuleKey)
        CloseRegKey $(SoftServiceKey)
        CloseRegKey $(SoftParameterKey)
        CloseRegKey $(SoftLinkageKey)
        Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
            EndWait
            goto fatalregistry
        endif

;-----------------------------------------------------------------------------
addAdapterComponent = +
    Shell $(UtilityInf), AddHardwareComponent, $(ProductHardwareName), +
                         $(STF_CONTEXTINFNAME), $(ProductKeyNameHdwDriver)
    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 KeyParameters = $($R3)
    set KeyAdapterRules = $($R2)
    set AdapterNumber = $($R4)
    set AdapterServiceName = $($R5)
    set AdapterName = $(AdapterServiceName)
    set NewValueList = {{Manufacturer,$(NoTitle),$(!REG_VT_SZ),$(Manufacturer)},+
                       {Title,$(NoTitle),$(!REG_VT_SZ),"["$($R4)"] "$(ProductHardwareTitle)},+
                       {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, $($R1), $(NewValueList)
    ifint $($ShellCode) != $(!SHELL_CODE_OK)
        goto ShellCodeError
    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, $(KeyAdapterRules), $(NewValueList)
    ifint $($ShellCode) != $(!SHELL_CODE_OK)
        goto ShellCodeError
    endif
    set RegistryErrorIndex = $($R0)
    Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        EndWait
        CloseRegKey $(KeyParameters)
        CloseRegKey $(KeyAdapterRules)
        goto fatalregistry
    endif
    FlushRegKey $(KeyParameters)
    FlushRegKey $(KeyAdapterRules)
    CloseRegKey $(KeyParameters)
    CloseRegKey $(KeyAdapterRules)

;-----------------------------------------------------------------------------


        Shell $(UtilityInf), BaseServiceKey
        set RegistryErrorIndex = $($R0)
        Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
           goto fatalregistry
        endif
        set KeyServices = $($R1)
        OpenRegKey $(KeyServices) "" $(AdapterHardwareDriver) $(MAXIMUM_ALLOWED) KeyMxcard
        Ifstr $(KeyMxcard) == $(KeyNull)
           set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
           goto fatalregistry
        endif
        SetRegValue $(KeyMxcard) {ProductID,$(NoTitle),$(!REG_VT_DWORD),$(ProductID)}
        CloseRegKey $(KeyMxcard)
;;;;
    set from = end
    goto getAdapterSettings

;-----------------------------------------------------------------------------
getAdapterSettings = +
    set MXsetup = $(!STF_WINDOWSSYSPATH)"\"$(AdapterSetupName)
    set SlotDeviceNumList = {}
    set DeviceIdList = {}
    ForListDo $(AdapterHardwareAdapterID)
        ifint $($) != 0
            set VendorID = 5011
            Shell $(UtilityInf), GetPCIInformation, $(VendorID) $($)
            ifstr(i) $($R0) != {}
                set SlotDeviceNumList = >($(SlotDeviceNumList), $($R0))
                set DeviceIdList = >($(DeviceIdList), $($))
            endif
        endif
    EndForListDo

    ifstr(I) $(!STF_GUI_UNATTENDED) == "YES"
        RunProgram ExitCode "" "" $(MXsetup) $(DeviceIdList) $(SlotDeviceNumList) $(StartComNo) $(RxFifoTrig) $(TxFifoSize) 
    else
        RunProgram ExitCode "" "" $(MXsetup) $(DeviceIdList) $(SlotDeviceNumList) 
    endif
    Ifint $(ExitCode) == 1
        set CommonStatus = STATUS_USERCANCEL
    endif
    goto $(from)

;-----------------------------------------------------------------------------
bindingadapter = +
    set Error = "Binding: Sorry, not yet implemented."
    goto fatal

;-----------------------------------------------------------------------------
removeadapter = +
    set MXSpecificString = $(AdapterHardwareName)
    ifstr(i) $(fRemoveMX) == FALSE
      install RemoveFiles
      goto removeadapterExit
    endif
    Shell $(UtilityInf), RemoveHardwareComponent, $(Manufacturer), +
        $(ProductSoftwareNameHdwDriver), $(!NTN_RegBase)
    ifint $($ShellCode) != $(!SHELL_CODE_OK)
        goto ShellCodeError
    endif
    set RegistryErrorIndex = $($R0)
    Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        goto fatalregistry
    endif
;;;
    install RemoveFiles
removeadapterExit = +
    goto end

;-----------------------------------------------------------------------------
UpgradeSoftware = +
    set Error = "Update not implemented. To update, remove driver and then re-install"
    goto fatal

;-----------------------------------------------------------------------------
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)" - service "$(MXSpecificString)"."
    ifstr(i) $(fRemoveMX) == TRUE
        read-syms AbortMessage$(!STF_LANGUAGE)
        set Error = $(Error)$(!LF)$(!LF)$(AbortText)
    endif
    goto fatal

;-----------------------------------------------------------------------------
fataldetect = +
    Shell $(UtilityInf),RegistryErrorString,CANNOT_DETECT
    ifint $($ShellCode) != $(!SHELL_CODE_OK)
        goto ShellCodeError
    endif
    set Error = $($R0)
    Goto fatal

;-----------------------------------------------------------------------------
fatal = +
    Shell $(subroutninf) SetupMessage, $(!STF_LANGUAGE), "FATAL", $(Error)
    ifint $($ShellCode) != $(!SHELL_CODE_OK)
        goto ShellCodeError
    endif
    goto setfailed

;-----------------------------------------------------------------------------
ShellCodeError = +
    set DlgType      = "MessageBox"
    set STF_MB_TITLE = "Error: "$(FunctionTitle)
    set STF_MB_TEXT  = "Shell Code Error"
    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) $(fRemoveMX) == TRUE
        set fRemoveMX = FALSE
        goto removeadapter
    endif
    goto end

;-----------------------------------------------------------------------------
end = +
    Return $(CommonStatus)

;-----------------------------------------------------------------------------
[RemoveFiles]
   set RemoveList = {}
   set RemoveList = >($(RemoveList), $(!STF_WINDOWSSYSPATH)"\drivers\"$(AdapterHardwareDriver)".sys")
   set RemoveList = >($(RemoveList), $(!STF_WINDOWSSYSPATH)"\"$(AdapterSetupName))
   ForListDo $(RemoveList)
       LibraryProcedure Status , $(!LIBHANDLE), DelFile $($)
   EndForListDo
   exit

[BindingInfo-Mxserp]
BindingInfo     = {+
                  $(AdapterHardwareDriver)"Driver "$(AdapterHardwareDriver)"Adapter non exclusive 100" +
                  }

[Install-Option]
    set STF_VITAL = ""
    ifstr(i) $(AddCopy) == "YES"
        AddSectionFilesToCopyList Files-Resource-$(Option) $(SrcDir) $(!STF_WINDOWSSYSPATH)
        AddSectionFilesToCopyList Files-$(Option) $(SrcDir) $(!STF_WINDOWSSYSPATH)\drivers
    endif
    ifstr(i) $(DoCopy) == "YES"
       set !STF_NCPA_FLUSH_COPYLIST = TRUE
       CopyFilesInCopyList
    endif
    ifstr(i) $(DoConfig) == "YES"
    endif
    Exit

[Source Media Descriptions]
    1  = "Windows NT Setup Disk #1"          , TAGFILE = disk1
    2  = "MOXA Smartio/Industio Family Driver Disk"  , TAGFILE = windows.nt\Mxserp.sys

[Files-Smartio/Industio]
2,Mxserp.sys , SIZE=61408

[Files-Resource-Smartio/Industio]
2,mxsicfg.exe, SIZE=31744
2,mxpci.sys, SIZE=3456
2,sidiag.dll, SIZE=39424
2,mxsicfg.hlp, SIZE=6520    ; Added by Danny Lin. 2004.8.23.

[OptionsTextENG]
    Smartio/Industio   = "MOXA Smartio/Industio Family multiport board"

[FileConstantsENG]
    ProCaption   = $(ApaterHardwareDriver)" Setup"
    ProCancel    = "Cance&l"
    ProCancelMsg = "MOXA multiport board and/or Drivers are not correctly installed. "+
                   "Are you sure you want to cancel copying files?"
    ProCancelCap = $(ApaterHardwareDriver)" Setup Message"
    ProText1     = "Copying:"
    ProText2     = "To:"
    Error         = "Unable to determine proper source disk location; copy cannot be performed."
    FunctionTitle   =$(ApaterHardwareDriver)" Setup"
    ProductSoftwareDescriptionHdwDriver = "MOXA "$(AdapterTitle)" Driver"
    ProductSoftwareTitleHdwDriver = "MOXA "$(AdapterTitle)" Driver"
    ConfigurationTitle = "MOXA "$(AdapterTitle)" Adapter Setup"
    ProductHardwareDescription      = "MOXA "$(AdapterTitle)" Adapter"
    ProductHardwareTitle        = "MOXA "$(AdapterTitle)" Adapter"

[DialogConstantsENG]
    Help        = "&Help"
    Exit        = "E&xit"
    OK          = "OK"
    HelpContext = ""
    Continue    = "C&ontinue"
    Cancel      = "C&ancel"

[UpdatingConfigurationENG]
    UpdatingConfiguration      = "Updating new configuration..."

[AbortMessageENG]
  AbortText  =  "Aborting "$(ApaterHardwareDriver)" Setup. Please reboot the system "+
                "to fix the problem."

