[SystemInformationClasses]
    Language
[InitialHardwareInstall]
    StartWait
    set Status = STATUS_FAILED
    set !STF_LANGUAGE_HACK = NO
    set ConfigureOptions = {}
    read-syms OemOptionDiskettes$(!STF_LANGUAGE)
    read-syms Strings$(!STF_LANGUAGE)
    shell "subroutn.inf" PushBillboard STATUSDLG $(Error6)
    set OptionTypeList = {Language}
    ForListDo $(OptionTypeList)
        read-syms $($)Vars
        detect    $($)Vars
    EndForListDo
    ForListDo $(OptionTypeList)
        shell "" InitOptionVars $(!STF_LANGUAGE) $($) $($($)HardwareDetected) $($($)SystemSet) $($($)Default)
        ifstr(i) $($R0) == "STATUS_SUCCESSFUL"
            set $($)OurINFOptions = $($R1)
            set $($)OemINFOptions = $($R2)
            set $($)MergedOptions = $($R3)
            set $($)SpecialOption = $($R4)
            set $($)CurrentOption = $($R5)
            set $($)Option        = *($($R5), 1)
        else
            shell "subroutn.inf" PopBillboard
            EndWait
            shell "subroutn.inf" SetupMessage $(!STF_LANGUAGE) "FATAL" $(Error1)
            StartWait
            goto finish_system
        endif
    EndForListDo
    ForListDo $(OptionTypeList)
        shell "" InitListBoxVars $(!STF_LANGUAGE) $($($)MergedOptions) $($($)SpecialOption) $(Other)
        ifstr(i) $($R0) == "STATUS_SUCCESSFUL"
            set $($)OptionList     = $($R1)
            set $($)OptionTextList = $($R2)
        else
            shell "subroutn.inf" PopBillboard
            EndWait
            shell "subroutn.inf" SetupMessage $(!STF_LANGUAGE) "FATAL" $(Error2)
            StartWait
            goto  finish_system
        endif
    EndForListDo
    shell "subroutn.inf" PopBillboard
system = +
    read-syms SystemDlg$(!STF_LANGUAGE)
    EndWait
    ui start "System"
    ifstr(i) $(DLGEVENT) == "CONTINUE"
        ForListDo $(OptionTypeList)
            set $($)Option = *($($($)OptionList), ~($(Combo$(#)List), $(Combo$(#)Out)))
        EndForListDo
        ui pop 1
        goto install_system
    else-ifstr(i) $(DLGEVENT) == "NOTIFY"
        set OptionNum = $(ButtonChecked)
        set Option    = *($(OptionTypeList), $(ButtonChecked))
        set ReInit    = YES
        ifstr(i) $(Combo$(OptionNum)Out) != $(Other)
            set $(Option)Option = *($($(Option)OptionList), ~($(Combo$(OptionNum)List), $(Combo$(OptionNum)Out)))
            set ReInit = NO
        else
            shell "other.inf" GetNewOEMOption $(!STF_LANGUAGE) $($(Option)OemINFOptions) $(Option) $($(Option)DisketteSrc)
            ifstr(i) $($R0) == STATUS_SUCCESSFUL
                set $(Option)OemINFOptions  = $($R1)
                set $(Option)Option         = $($R2)
                set $(Option)DisketteSrc    = $($R4)
                shell "" MergeOptions $($(Option)OurINFOptions) $($(Option)OemINFOptions)
                ifstr(i) $($R0) == STATUS_SUCCESSFUL
                    set $(Option)MergedOptions = {$($R1), $($R2)}
                else
                    shell "subroutn.inf" SetupMessage $(!STF_LANGUAGE) "FATAL" $(Error4)
                    ui pop 1
                    StartWait
                    goto finish_system
                endif
                shell "" InitListBoxVars $(!STF_LANGUAGE) $($(Option)MergedOptions) $($(Option)SpecialOption) $(Other)
                ifstr(i) $($R0) == "STATUS_SUCCESSFUL"
                    set $(Option)OptionList     = $($R1)
                    set $(Option)OptionTextList = $($R2)
                else
                    shell "subroutn.inf" SetupMessage $(!STF_LANGUAGE) "FATAL" $(Error2)
                    ui pop 1
                    StartWait
                    goto  finish_system
                endif
                set ReInit = YES
                goto system
            else-ifstr(i) $($R0) == "STATUS_USERCANCEL"
                set ReInit = YES
                goto system
            else
                shell "subroutn.inf" SetupMessage $(!STF_LANGUAGE) "NONFATAL" $(Error3)
                set ReInit = YES
                goto system
            endif
        endif
        goto system
    else-ifstr(i) $(DLGEVENT) == "EXIT"
        shell "subroutn.inf" QueryUserQuit $(!STF_LANGUAGE)
        ifstr(i) $($R1) == "OK"
            set Status = STATUS_USERQUIT
            ui pop 1
            StartWait
            goto finish_system
        else
            set  ReInit = NO
            goto system
        endif
    else
        ui pop 1
        StartWait
        goto finish_system
    endif
install_system = +
    StartWait
    ForListDo $(OptionTypeList)
        set Changed = YES
        ifstr(i) $($($)Option) == $($($)SystemSet)
            set Changed = NO
        endif
        ifstr(i) $(Changed) == "NO"
            ifstr(i) $(!STF_INSTALL_TYPE) == "SETUPBOOTED"
                set $($)Install = "NO"
                goto skip_setinstall
            endif
        endif
        set $($)Install = "YES"
        ifstr(i) $($($)SpecialOption) != {}
            ifstr(i) $($($)Option) == *($($($)SpecialOption), 1)
                goto skip_setinstall
            endif
        endif
        shell "" GetOptionFile $($($)Option) $($($)OemINFOptions)
        ifstr(i) $($R0) == "STATUS_SUCCESSFUL"
            set $($)INF = $(!STF_WINDOWSSYSPATH)"\"$($R1)
            set $($)SrcDir = $($($)DisketteSrc)
            goto skip_setinstall
        endif
        shell "" GetOptionFile $($($)Option) $($($)OurINFOptions)
        ifstr(i) $($R0) == "STATUS_SUCCESSFUL"
            set $($)INF = $($R1)
            set $($)SrcDir = $(!STF_SRCDIR)
            goto skip_setinstall
        endif
skip_setinstall = +
    EndForListDo
    ForListDo $(OptionTypeList)
        ifstr(i) $($($)Install) == "YES"
            ifstr(i)  $($($)INF) != ""
                shell $($($)INF) InstallOption $(!STF_LANGUAGE) $($($)Option) $($($)SrcDir) "YES" "NO" "NO"
                set ConfigureOptions = >($(ConfigureOptions), {$($), $($($)INF), $($($)Option), $($($)SrcDir)})
            endif
        endif
    EndForListDo
    ifstr(i) $(LanguageInstall) != "YES"
        set !STF_LANGUAGE_HACK = YES
        shell "language.inf" InstallOption $(!STF_LANGUAGE) $(LanguageOption) $(!STF_SRCDIR) "YES" "NO" "NO"
    endif
    set Status = STATUS_SUCCESSFUL
finish_system = +
    Return $(Status) $(ConfigureOptions)
[ConfigureHardwareOptions]
    set Status = STATUS_SUCCESSFUL
    shell "registry.inf" MakeSetupKey
    ifint $($ShellCode) != $(!SHELL_CODE_OK)
        Debug-Output "Shell to MakeSetupKey failed"
        set Status = STATUS_FAILED
        goto finish_ConfigureHardware
    endif
    ifstr(i) $($R0) != STATUS_SUCCESSFUL
        Debug-Output "MakeSetupKey failed"
        set Status = STATUS_FAILED
        goto finish_ConfigureHardware
    endif
    ForListDo $($0)
        shell *($($), 2) InstallOption $(!STF_LANGUAGE) *($($), 3) *($($), 4) "NO" "NO" "YES"
        ifint $($ShellCode) != $(!SHELL_CODE_OK)
            Debug-Output "Shell to Configure Hardware Option Type "*($($), 3)" failed"
            set Status = STATUS_FAILED
        else-ifstr(i) $($R0) != STATUS_SUCCESSFUL
            Debug-Output "Configure Hardware Option Type "*($($), 3)" failed"
            set Status = STATUS_FAILED
        else
            shell "registry.inf" MakeSetupOptionEntry *($($), 1) *($($), 3)
            ifint $($ShellCode) != $(!SHELL_CODE_OK)
                Debug-Output "shelling MakeSetupOptionEntry failed"
                set Status = STATUS_FAILED
            endif
            ifstr(i) $($R0) != STATUS_SUCCESSFUL
                Debug-Output "Making setup entry for "*($($), 1)" = "*($($), 3)" failed."
                set Status = STATUS_FAILED
            endif
        endif
    EndForListDo
    ifstr(i) $(!STF_LANGUAGE_HACK) == "YES"
        read-syms LanguageVars
        LibraryProcedure STATUS, $(!LIBHANDLE), SetCurrentLocale $(LanguageSystemSet) "YES"
        ifstr(i) $(STATUS) != "SUCCESS"
            set Status = STATUS_FAILED
            Debug-Output "REGISTRY.INF: Failed in SetCurrentLocale function"
            goto finish_ConfigureHardware
        endif
    endif
finish_ConfigureHardware = +
    Return $(Status)
[InitOptionVars]
    set Status           = STATUS_FAILED
    set OurINFOptions    = {}
    set OemINFOptions    = {}
    set MergedINFOptions = {}
    set SpecialOption    = {}
    set CurrentOption    = {}
    set OurINFFile = $($1)".inf"
    shell "other.inf", GetOptionsFromINF $($0) $($1) $(OurINFFile)
    ifstr(i) $($R0) == STATUS_SUCCESSFUL
        set OurINFOptions = {{$(OurINFFile), $($R1), $($R2)}}
    else
        EndWait
        read-syms Strings$(!STF_LANGUAGE)
        shell "subroutn.inf" SetupMessage $(!STF_LANGUAGE) "FATAL" $(Error7)
        StartWait
        goto finish_InitOptionVars
    endif
    shell "other.inf" ReturnOemOptions $($0) $($1)
    ifstr(i) $($R0) == "STATUS_SUCCESSFUL"
        set OemINFOptions = $($R1)
    endif
    shell "" MergeOptions $(OurINFOptions) $(OemINFOptions)
    ifstr(i) $($R0) == STATUS_SUCCESSFUL
        set MergedINFOptionList     = $($R1)
        set MergedINFOptionTextList = $($R2)
        set MergedINFOptions        = {$($R1), $($R2)}
    else
        goto finish_InitOptionVars
    endif
    set SubOptionList = {Video}
    set Detected      = $($2)
    ifcontains(i) $($1) in $(SubOptionList)
        ifcontains(i) $(Detected) in $(MergedINFOptionList)
        else
            shell $(OurINFFile) MapToSupportedOption $(Detected)
            ifint $($ShellCode) != $(!SHELL_CODE_OK)
                Debug-Output "Shelling MapToSupportedOption in "$(OurINFFile)" failed"
            else-ifstr(i) $($R0) == STATUS_SUCCESSFUL
                set Detected = $($R1)
            endif
        endif
    endif
    ifstr(i) $(!STF_UPGRADE) == "YES"
        set Option = ""
        ifstr(i) $($3) != ""
            set Option = $($3)
        else
            ifstr(i) $(Detected) != ""
                set Option = $(Detected)
            else
                set Option = $($4)
            endif
        endif
    else
        set Option = ""
        ifstr(i) $(Detected) != ""
            set Option = $(Detected)
        else-ifstr(i) $($3) != ""
            set Option = $($3)
        else
            set Option = $($4)
        endif
    endif
    ifcontains(i) $(Option) in $(MergedINFOptionList)
        set OptionText = *($(MergedINFOptionTextList), ~($(MergedINFOptionList), $(Option)))
    else
        set OptionText    = "Oem Installed Option"
        set Option        = $(Option)
        set SpecialOption = {$(Option), $(OptionText)}
    endif
    set CurrentOption = {$(Option), $(OptionText)}
    set Status = STATUS_SUCCESSFUL
finish_InitOptionVars = +
    Return $(Status) $(OurINFOptions) $(OemINFOptions) $(MergedINFOptions) $(SpecialOption) $(CurrentOption)
[InitListBoxVars]
    set Status         = STATUS_FAILED
    set OptionList     = {}
    set OptionTextList = {}
    ifstr(i) $($1) != {}
        set OptionList     = *($($1), 1)
        set OptionTextList = *($($1), 2)
    endif
    ifstr(i) $($2) != {}
        set OptionList     = >($(OptionList),     *($($2), 1))
        set OptionTextList = >($(OptionTextList), *($($2), 2))
    endif
    set OptionTextList = >($(OptionTextList), $($3))
    set Status = STATUS_SUCCESSFUL
    Return $(Status) $(OptionList) $(OptionTextList)
[MergeOptions]
    set Status               = STATUS_FAILED
    set MergedOptionList     = {}
    set MergedOptionTextList = {}
    ForListDo $($0)
        set OptionList     = *($($), 2)
        set OptionTextList = *($($), 3)
        ForListDo $(OptionList)
            Ifcontains $($) in $(MergedOptionList)
            else
                set MergedOptionList     = >($(MergedOptionList), $($))
                set MergedOptionTextList = >($(MergedOptionTextList), *($(OptionTextList), $(#)))
            endif
        EndForListDo
    EndForListDo
    ForListDo $($1)
        set OptionList     = *($($), 2)
        set OptionTextList = *($($), 3)
        ForListDo $(OptionList)
            Ifcontains $($) in $(MergedOptionList)
            else
                set MergedOptionList     = >($(MergedOptionList), $($))
                set MergedOptionTextList = >($(MergedOptionTextList), *($(OptionTextList), $(#)))
            endif
        EndForListDo
    EndForListDo
    set Status = STATUS_SUCCESSFUL
    Return $(Status) $(MergedOptionList) $(MergedOptionTextList)
[GetOptionFile]
    set Status      = STATUS_FILENOTFOUND
    set FileName = ""
    ForListDo $($1)
        set OptionFile = *($($), 1)
        set OptionList = *($($), 2)
        ForListDo $(OptionList)
            ifstr(i) $($) == $($0)
                set Status = STATUS_SUCCESSFUL
                set FileName = $(OptionFile)
            endif
        EndForListDo
    EndForListDo
finish_GetOptionFile = +
    Return $(Status) $(FileName)
[LanguageVars]
    LanguageHardwareDetected    = ""
    LanguageSystemSet           = "00000409"
    LanguageDefault             = "00000409"
    LanguageOurINFOptions       = {}
    LanguageOemINFOptions       = {}
    LanguageMergedOptions       = {}
    LanguageSpecialOption       = {}
    LanguageCurrentOption       = {}
    LanguageOptionList          = {}
    LanguageOptionTextList      = {}
    LanguageOption              = {}
    LanguageINF                 = ""
    LanguageInstall             = "NO"
    LanguageSrcDir              = ""
    LanguageDstDir              = ""
[OemOptionDiskettesENG]
    VideoDisketteSrc    = "A:\"
    LayoutDisketteSrc   = "A:\"
    LanguageDisketteSrc = "A:\"
[StringsENG]
    Other  = "Other (Requires a disk from a hardware manufacturer)"
    Error1 = "Failed to initialize hardware options."
    Error2 = "Failed to initialize hardware option variables."
    Error3 = "Failed to obtain new options.  Ignoring the error."
    Error4 = "Internal Setup error: failed to merge Microsoft options with the OEM options."
    Error5 = ""
    Error6 = "Please wait while Setup examines your hardware configuration..."
    Error7 = "Setup was unable to locate or load an INF file."
[SystemDlgENG]
    Caption     = "Language (Locale)"
    DlgText     = "Setup will install the language (locale) listed below."+
                  " The language (locale) determines how date, currency,"+
                  " and time values are displayed, and controls other"+
                  " international settings.  Click on the down arrow for"+
                  " other choices.  When the language (locale) is correct,"+
                  " choose continue or press ENTER."
    Continue    = "Continue"
    ComboHeader = ""
    Combo1Label = "&Language:"
    Combo1Footer = "(Locale)"
    DlgType     = "MultiCombo"
    DlgTemplate = "SYSTEM"
    Help        = "&Help"
    Exit        = "E&xit Setup"
    HelpContext = $(!IDH_DB_SYSTEM_INS)
    Combo1List  = $(LanguageOptionTextList)
    Combo1Out   = *($(Combo1List), ~($(LanguageOptionList), $(LanguageOption)))
    ComboListItemsIn  = { Combo1List }
    ComboListItemsOut = { Combo1Out }
    NotifyFields      = {YES}
