;***********************************************************************
;
; OEMSETNT.INF
;
;       Olicom network card and driver SETUP INF file.
;
;***********************************************************************

;-----------------------------------------------------------------------
; OPTION TYPE
; -----------
; This identifies the Option type we are dealing with.  The different
; possible types are:
;
; COMPUTER, DISPLAY, MOUSE, KEYBOARD, LAYOUT, SCSI, PRINTER, ...
;
;  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 = NetAdapter

;-----------------------------------------------------------------------
; PlatformsSupported
; ------------------
; This identifies the platforms supported by the adapter card.
; Possible types are:
;
; ISA and EISA
;-----------------------------------------------------------------------

[PlatformsSupported]
    ISA
    EISA
    MCA
    PCMCIA

[LanguagesSupported]
    ENG

;-----------------------------------------------------------------------
; OPTION LIST
; -----------
; 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]
    OCE2XM
    GOCARD
    GOCARDMF

[OptionsTextENG]
    OCE2XM    = "Olicom Ethernet ISA/IV Adapter"
    GOCARD    = "Olicom Ethernet GoCard"
    GOCARDMF  = "Olicom GoCard ET/Modem 288"

[IOBaseAddrChoices]
IOBase_1  = "Auto detect",0
IOBase_2  = "200h",512
IOBase_3  = "210h",528
IOBase_4  = "220h",544
IOBase_5  = "230h",560
IOBase_6  = "240h",576
IOBase_7  = "250h",592
IOBase_8  = "260h",608
IOBase_9  = "270h",624
IOBase_10 = "280h",640
IOBase_11 = "290h",656
IOBase_12 = "2A0h",672
IOBase_13 = "2B0h",698
IOBase_14 = "2C0h",714
IOBase_15 = "2D0h",730
IOBase_16 = "2E0h",746
IOBase_17 = "2F0h",752
IOBase_18 = "300h",768
IOBase_19 = "310h",784
IOBase_20 = "320h",800
IOBase_21 = "330h",816
IOBase_22 = "340h",832
IOBase_23 = "350h",848
IOBase_24 = "360h",864
IOBase_25 = "370h",880
IOBase_26 = "380h",896
IOBase_27 = "390h",912
IOBase_28 = "3A0h",928
IOBase_29 = "3B0h",944
IOBase_30 = "3C0h",960
IOBase_31 = "3D0h",976
IOBase_30 = "3E0h",992


[BusNumberChoices]
BusNo_1 = "0",0
BusNo_2 = "1",1
BusNo_3 = "2",2
BusNo_4 = "3",3
BusNo_5 = "4",4
BusNo_6 = "5",5
BusNo_7 = "6",6
BusNo_8 = "7",7

[IOBasePCMCIAChoices]
; 3E0h is where PCIC is (normally) located
; 240h is where TCIC is (normally) located
; therefore user cannot select these for locating the adapter
IOBase_1  = "200h",512
IOBase_2  = "220h",544
;IOBase_3  = "240h",576
IOBase_4  = "260h",608
IOBase_5  = "280h",640
IOBase_6  = "2A0h",672
IOBase_7  = "2C0h",714
IOBase_8  = "2E0h",746
IOBase_9  = "300h",768
IOBase_10 = "320h",800
IOBase_11 = "340h",832
IOBase_12 = "360h",864
IOBase_13 = "380h",896
IOBase_14 = "3A0h",928
IOBase_15 = "3C0h",960

[MemWinChoices]
MemWin_1  = "A0000h", 655360
MemWin_2  = "A1000h", 659456
MemWin_3  = "A2000h", 663552
MemWin_4  = "A3000h", 667648
MemWin_5  = "A4000h", 671744
MemWin_6  = "A5000h", 675840
MemWin_7  = "A6000h", 679936
MemWin_8  = "A7000h", 684032
MemWin_9  = "A8000h", 688128
MemWin_10 = "A9000h", 692224
MemWin_11 = "AA000h", 696320
MemWin_12 = "AB000h", 700416
MemWin_13 = "AC000h", 704512
MemWin_14 = "AD000h", 708608
MemWin_15 = "AE000h", 712704
MemWin_16 = "AF000h", 716800
MemWin_17 = "B0000h", 720896
MemWin_18 = "B1000h", 724992
MemWin_19 = "B2000h", 729088
MemWin_20 = "B3000h", 733184
MemWin_21 = "B4000h", 737280
MemWin_22 = "B5000h", 741376
MemWin_23 = "B6000h", 745472
MemWin_24 = "B7000h", 749568
MemWin_25 = "B8000h", 753664
MemWin_26 = "B9000h", 757760
MemWin_27 = "BA000h", 761856
MemWin_28 = "BB000h", 765952
MemWin_29 = "BC000h", 770048
MemWin_30 = "BD000h", 774144
MemWin_31 = "BE000h", 778240
MemWin_32 = "BF000h", 782336
MemWin_33 = "C0000h", 786432
MemWin_34 = "C1000h", 790528
MemWin_35 = "C2000h", 794624
MemWin_36 = "C3000h", 798720
MemWin_37 = "C4000h", 802816
MemWin_38 = "C5000h", 806912
MemWin_39 = "C6000h", 811008
MemWin_40 = "C7000h", 815104
MemWin_41 = "C8000h", 819200
MemWin_42 = "C9000h", 823296
MemWin_43 = "CA000h", 827392
MemWin_44 = "CB000h", 831488
MemWin_45 = "CC000h", 835584
MemWin_46 = "CD000h", 839680
MemWin_47 = "CE000h", 843776
MemWin_48 = "CF000h", 847872
MemWin_49 = "D0000h", 851968
MemWin_50 = "D1000h", 856064
MemWin_51 = "D2000h", 860160
MemWin_52 = "D3000h", 864256
MemWin_53 = "D4000h", 868352
MemWin_54 = "D5000h", 872448
MemWin_55 = "D6000h", 876544
MemWin_56 = "D7000h", 880640
MemWin_57 = "D8000h", 884736
MemWin_58 = "D9000h", 888832
MemWin_59 = "DA000h", 892928
MemWin_60 = "DB000h", 897024
MemWin_61 = "DC000h", 901120
MemWin_62 = "DD000h", 905216
MemWin_63 = "DE000h", 909312
MemWin_64 = "DF000h", 913408
MemWin_65 = "E0000h", 917504
MemWin_66 = "E1000h", 921600
MemWin_67 = "E2000h", 925696
MemWin_68 = "E3000h", 929792
MemWin_69 = "E4000h", 933888
MemWin_70 = "E5000h", 937984
MemWin_71 = "E6000h", 942080
MemWin_72 = "E7000h", 946176
MemWin_73 = "E8000h", 950272
MemWin_74 = "E9000h", 954368
MemWin_75 = "EA000h", 958464
MemWin_76 = "EB000h", 962560
MemWin_77 = "EC000h", 966656
MemWin_78 = "ED000h", 970752
MemWin_79 = "EE000h", 974848
MemWin_80 = "EF000h", 978944
MemWin_81 = "F0000h", 983040
MemWin_82 = "F1000h", 987136
MemWin_83 = "F2000h", 991232
MemWin_84 = "F3000h", 995328
MemWin_85 = "F4000h", 999424
MemWin_86 = "F5000h", 1003520
MemWin_87 = "F6000h", 1007616
MemWin_88 = "F7000h", 1011712
MemWin_89 = "F8000h", 1015808
MemWin_90 = "F9000h", 1019904
MemWin_91 = "FA000h", 1024000
MemWin_92 = "FB000h", 1028096
MemWin_93 = "FC000h", 1032192
MemWin_94 = "FD000h", 1036288
MemWin_95 = "FE000h", 1040384
MemWin_96 = "FF000h", 1044480

[InterruptChoices]
Interrupt_1  = "3", 3
Interrupt_2  = "4", 4
Interrupt_3  = "5", 5
Interrupt_4  = "7", 7
Interrupt_5  = "9", 9
Interrupt_6  = "10",10
Interrupt_7  = "11",11
Interrupt_8  = "12",12
Interrupt_9  = "14",14
Interrupt_10 = "15",15

[ComPortChoices]
Com_1 = "COM1", 1016
Com_2 = "COM2", 760
Com_3 = "COM3", 1000
Com_4 = "COM4", 744
Com_5 = "COM5", 24
Com_6 = "Disabled", 0

[IOBasePCMCIAControllerChoices]
IOBase_1  = "Default",992
IOBase_2  = "3E2h",994
IOBase_3  = "Disable PCMCIA",0

[WaitstateChoices]
Waitstate_1  = "0", 0
Waitstate_2  = "1", 1
Waitstate_3  = "2", 2
Waitstate_4  = "3", 3
Waitstate_5  = "4", 4
Waitstate_6  = "5", 5
Waitstate_7  = "6", 6
Waitstate_8  = "7", 7
Waitstate_9  = "8", 8
Waitstate_10 = "9", 9
Waitstate_11 = "10",10
Waitstate_12 = "11",11
Waitstate_13 = "12",12
Waitstate_14 = "13",13
Waitstate_15 = "14",14
Waitstate_16 = "15",15

[DatasizeChoices]
Datasize_1 = 1,1,"&16 Bit"
Datasize_2 = 2,0,"&8 Bit"

;-----------------------------------------------------------------------
; Constants for use with dialogs
;-----------------------------------------------------------------------

[FileConstants]
UtilityInf      = "UTILITY.INF"
subroutineinf   = "SUBROUTN.INF"
SoftwareType    = "driver"
Exit_Code       = 0
DialogDllName	= "oce2xm.dll"
HelpfileName	= "oce2xm.hlp"
NetEventDLL     = "%SystemRoot%\System32\netevent.dll;%SystemRoot%\System32\Drivers\Oc2xem.sys"
IoLogMsgDLL     = "%SystemRoot%\System32\IoLogMsg.dll"
Manufacturer    = "Olicom"
ProductMajorVersion 	= "3"
ProductMinorVersion     = "0"
ProductVersion          = $(ProductMajorVersion)"."$(ProductMinorVersion)
ProductSoftwareName 	= "OCE2XM"
ProductSoftwareTitle	= "Olicom Ethernet Adapter Driver"
ProductSoftwareImagePath = "\SystemRoot\System32\drivers\oce2xm.sys"
NetRuleSoftwareType 	= "oce2xmSys ndisDriver oce2xmDriver"
NetRuleSoftwareUse      = $(SoftwareType)
NetRuleSoftwareBindForm = """Oce1xMPSys"" yes no container"
NetRuleSoftwareClass	= {"oce2xmDriver basic"}
NetRuleSoftwareBindable = {"oce2xmDriver oce2xmAdapter non exclusive 100"}
ProductHardwareName 	= "OCE2XM"
ProductHardwareTitle	= "Olicom Ethernet Adapter"
ProductHardwareOCE2XMTitle    = "Olicom Ethernet ISA/IV Adapter"
ProductHardwareGOCARDTitle    = "Olicom GoCard Ethernet"
ProductHardwareGOCARDMFTitle  = "Olicom GoCard ET/Modem 288"
NetRuleHardwareType     = "oce2xm oce2xmAdapter"
NetRuleHardwareBindForm = " yes yes container"
NetRuleHardwareClass	= {"oce2xmAdapter basic"}
ProductKeyName  = $(!NTN_SoftwareBase)"\"$(Manufacturer)"\"$(ProductSoftwareName)"\CurrentVersion"
ParamKeyName    = $(!NTN_ServiceBase)"\"$(ProductHardwareName)"\Parameters"

[GeneralConstants]
from      = ""
to        = ""
ExitCodeOk     = 0
ExitCodeCancel = 1
ExitCodeFatal  = 2
KeyNull         = ""
MAXIMUM_ALLOWED   = 33554432
RegistryErrorIndex = NO_ERROR
KeyProduct      = ""
KeyParameters   = ""
TRUE            = 1
FALSE           = 0
NoTitle         = 0
ExitState       = "Active"
OldVersionExisted = $(FALSE)
DriverPath      = $(!STF_NTPATH)\drivers
[FileConstantsENG]
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"
ProText1     = "Copying:"
ProText2     = "To:"
OCE2XMFunctionTitle    = "Olicom Ethernet ISA/IV Adapter Setup"
GOCARDFunctionTitle    = "Olicom GoCard Ethernet Setup"
GOCARDMFFunctionTitle  = "Olicom GoCard ET/Modem 288 Setup"
ProductHardwareOCE2XMDescription    = "Olicom Ethernet ISA/IV Adapter"
ProductHardwareGOCARDDescription    = "Olicom GoCard Ethernet"
ProductHardwareGOCARDMFDescription  = "Olicom GoCard ET/Modem 288"
ProductSoftwareDescription	    = "Olicom Ethernet Adapter Driver"
FunctionTitle   = $($(Option)FunctionTitle)

IOBaseAddrList = ^(IOBaseAddrChoices, 1)
IOBaseAddrValues = ^(IOBaseAddrChoices, 2)
BusNoList = ^(BusNumberChoices, 1)
BusNoValues = ^(BusNumberChoices, 2)
IOBasePCMCIAList = ^(IOBasePCMCIAChoices, 1)
IOBasePCMCIAValues = ^(IOBasePCMCIAChoices, 2)
MemWinList = ^(MemWinChoices, 1)
MemWinValues = ^(MemWinChoices, 2)
InterruptList = ^(InterruptChoices, 1)
InterruptValues = ^(InterruptChoices, 2)
ComPortList = ^(ComPortChoices, 1)
ComPortValues = ^(ComPortChoices, 2)
IOBasePCMCIAControllerList = ^(IOBasePCMCIAControllerChoices, 1)
IOBasePCMCIAControllerValues = ^(IOBasePCMCIAControllerChoices, 2)
WaitstateList = ^(WaitstateChoices, 1)
WaitstateValues = ^(WaitstateChoices, 2)
DatasizeList = ^(DatasizeChoices, 1)
DatasizeValues = ^(DatasizeChoices, 2)
DatasizeLabels = ^(DatasizeChoices, 3)

IOBaseDefault	    = 1
BusNoDefault	    = 1
IOBasePCMCIADefault = 8
MemWinDefault	    = 49
ComPortDefault	    = 3
InterruptDefault    = 3

[DialogConstantsENG]
Help	    = "&Help"
Exit        = "Cancel"
OK          = "OK"
HelpContext = ""
Continue    = "Continue"
Cancel      = "Cancel"
ContextMinimumID	= 6000
ContextContentsID	= 6000
ContextPCMCIASetupID	= 6000
ContextPCMCIAAdvancedID = 6020
ContextMaximumID	= 6020

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

[AskSourceDlgText]
    DlgText	   = "Please enter the full path of the Olicom Ethernet Adapter "+
		     "driver setup files. Then choose Continue."

;-----------------------------------------------------------------------
; ADAPTER PARAMETER DIALOG
; ------------------------
; This section sets up the adapter parameter dialog. All textstrings
; presented in this dialog are defined here.
;
;-----------------------------------------------------------------------

[AdapterParameterDlgENG]
DlgType = "RadioCombination"
DlgTemplate = "OCE2DLG"
Caption = $(FunctionTitle)
DlgText = "Please select values for the following fields:"
Free	    = "&PCMCIA..."
Combo1Label = "I/O &Base Address:"
Combo2Label = "&Bus Number:"
Edit1Label = "&Network Address:"
Combo1List = $(IOBaseAddrList)
Combo1Out  = $(IOBaseAddrIndex)
Combo2List = $(BusNoList)
Combo2Out  = $(BusNoIndex)
ComboListItemsIn  = {Combo1List, Combo2List}
ComboListItemsOut = {Combo1Out, Combo2Out}
EditTextLim = 17
EditTextIn = $(NetworkAddress)
RadioOptionGreyed = {}
CBOptionsGreyed = {}
NotifyFields = {NO, NO, NO, NO, NO}
HelpContext = $(ContextContentsID)

;-----------------------------------------------------------------------
; PCMCIA PARAMETER DIALOG
; -----------------------
; This section sets up the PCMCIA parameter dialog. All textstrings
; presented in this dialog are defined here.
;
;-----------------------------------------------------------------------

[PCMCIAParameterDlgENG]
DlgType = "RadioCombination"
DlgTemplate = "OCE2DLGP"
Caption = $(FunctionTitle)
DlgText = "Please select values for the following fields:"
Free	    = "&Advanced..."
Combo1Label = "I/O &Base Address:"
Combo2Label = "&Memory Window:"
Combo3Label = "&Interrupt:"
Combo4Label = "&Bus Number:"
Combo5Label = "&COM Port:"
Edit1Label  = "&Network Address:"
Combo1List = $(IOBasePCMCIAList)
Combo1Out  = $(IOBasePCMCIAIndex)
Combo2List = $(MemWinList)
Combo2Out  = $(MemWinIndex)
Combo3List = $(InterruptList)
Combo3Out  = $(InterruptIndex)
Combo4List = $(BusNoList)
Combo4Out  = $(BusNoIndex)
Combo5List = $(ComPortList)
Combo5Out  = $(ComPortIndex)
ComboListItemsIn  = {Combo1List, Combo2List, Combo3List, Combo4List, Combo5List}
ComboListItemsOut = {Combo1Out, Combo2Out, Combo3Out, Combo4Out, Combo5Out}
EditTextLim = 15
EditTextIn = $(NetworkAddress)
RadioOptionGreyed = {}
CBOptionsGreyed = {}
NotifyFields = {NO, NO, NO, NO, NO}
HelpContext = $(ContextPCMCIASetupID)

;-----------------------------------------------------------------------
; PCMCIA ADVANCED SETTINGS DIALOG
; -------------------------------
; This section sets up the PCMCIA adavanced settings dialog. All
; textstrings presented in this dialog are defined here.
;
;-----------------------------------------------------------------------

[PCMCIAAdvancedDlgENG]
DlgType = "RadioCombination"
DlgTemplate = "OCE2DLGPA"
Caption = "PCMCIA Advanced Settings"
DlgText = "Please select values for the following fields:"
Combo1Label = "&Controller I/O Base:"
Combo2Label = "&Additional Waitstates:"
Radio1Label = "&Datasize:"
Radio1Button1 = *($(DatasizeLabels),1)
Radio1Button2 = *($(DatasizeLabels),2)
Combo1List = $(IOBasePCMCIAControllerList)
Combo1Out  = $(IOBasePCMCIAControllerIndex)
Combo2List = $(WaitstateList)
Combo2Out  = $(WaitstateIndex)
ComboListItemsIn  = {Combo1List, Combo2List}
ComboListItemsOut = {Combo1Out, Combo2Out}
RadioIn = { $(DatasizeIndex) }
RadioOptionGreyed = {}
CBOptionsGreyed = {}
NotifyFields = {NO, NO, NO, NO, NO}
HelpContext = $(ContextPCMCIAAdvancedID)

;---------------------------------------------------------------------------
; 1. Identify
;
; DESCRIPTION:   To verify that this INF deals with the same type of options
;                as we are choosing currently.
;
; INPUT:         None
;
; OUTPUT:        $($R0): STATUS: STATUS_SUCCESSFUL
;                $($R1): Option Type (COMPUTER ...)
;                $($R2): Diskette description
;---------------------------------------------------------------------------

[Identify]
    read-syms Identification
    set Status     = STATUS_SUCCESSFUL
    set Identifier = $(OptionType)
    set Media      = #("Source Media Descriptions", 1, 1)
    Return $(Status) $(Identifier) $(Media)

;------------------------------------------------------------------------
; 2. ReturnOptions:
;
; DESCRIPTION:   To return the option list supported by this INF and the
;                localised text list representing the options.
;
;
; INPUT:         $($0):  Language used. ( ENG | FRN | ... )
;
; OUTPUT:        $($R0): STATUS: STATUS_SUCCESSFUL |
;                                STATUS_NOLANGUAGE
;                                STATUS_FAILED
;                                STATUS_NOTSUPPORTED
;
;                $($R1): Option List
;                $($R2): Option Text List
;------------------------------------------------------------------------

[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)

;------------------------------------------------------------------------
;
; InstallOption:
;
;      This section is shelled to by main installation processing
;      or by NCPASHEL.INF during reconfig, removal, update, etc.
;
;
; FUNCTION:  To copy files representing Options
;            To configure the installed option
;            To update 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: STATUS_SUCCESSFUL |
;                            STATUS_NOLANGUAGE |
;                            STATUS_USERCANCEL |
;                            STATUS_FAILED
;
;------------------------------------------------------------------------

[InstallOption]
    StartWait
    set SrcDir   = ""
    set Option   = $($1)
    set SrcDir   = $($2)
    set AddCopy  = $($3)
    set DoCopy	 = $($4)
    set DoConfig = $($5)
    ;ifstr(i) $(SrcDir) == ""
    ;   Set SrcDir = "A:\"
    ;Endif
    set LanguageList = ^(LanguagesSupported, 1)
    Ifcontains(i) $($0) NOT-IN $(LanguageList)
        Return STATUS_NOLANGUAGE
    endif
    Debug-Output "STF_CWDDIR is: "$(!STF_CWDDIR)
    Debug-Output "STF_LANGUAGE is: "$(!STF_LANGUAGE)
    set-subst LF = "\n"
    read-syms GeneralConstants
    read-syms FileConstants
    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
	SetHelpFile $(HelpfileName) $(ContextMinimumID) $(ContextMaximumID)
    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 = configureadapter
        Ifstr(i) $(ProductKeyName) == $(!NTN_RegBase)
            Debug-Output "Cannot configure the driver software."
			Shell $(UtilityInf),RegistryErrorString,CANNOT_CONFIGURE_SOFTWARE
            ifint $($ShellCode) != $(!SHELL_CODE_OK)
                Debug-Output "ShellCode error: cannot get an error string."
                goto ShellCodeError
            endif
            set Error = $($R0)
            set from = end
            set to = end
            goto nonfatalinfo
        endif
    else
        set StartLabel = installadapter
        set OEM_ABANDON_OPTIONS = {}
        set OEM_ABANDON_SOFTWARE = FALSE
        set OEM_ABANDON_ON = TRUE
    endif
    set IOBaseAddrIndex = *($(IOBaseAddrList), $(IOBaseDefault))
    set BusNoIndex = *($(BusNoList), $(BusNoDefault))
    set NetworkAddress = *($(EditTextOut), 1)
    set IOBasePCMCIAIndex = *($(IOBasePCMCIAList), $(IOBasePCMCIADefault))
    set MemWinIndex = *($(MemWinList), $(MemWinDefault))
    set ComPortIndex = *($(ComPortList), $(ComPortDefault))
    set InterruptIndex = *($(InterruptList), $(InterruptDefault))
    set IOBasePCMCIAControllerIndex = *($(IOBasePCMCIAControllerList), 1)
    set WaitstateIndex = *($(WaitstateList), 1)
    set DatasizeIndex = 1
    Shell "" DebugConfiguration "After parameter querying"
    Shell $(UtilityInf), GetBusTypeNum
    set BusTypeNum = $($R1)
    ifint $($ShellCode) != $(!SHELL_CODE_OK)
        Debug-Output "ShellCode error."
        goto ShellCodeError
    endif
    Set from = $(fatal)
    Set to = $(fatal)
    Goto $(StartLabel)

;-----------------------------------------------
; Installation Section
;-----------------------------------------------
;
;   Get the current values of all the parameters
;
installadapter = +
    OpenRegKey $(!REG_H_LOCAL) "" $(ProductKeyName) $(MAXIMUM_ALLOWED) KeyProduct
    Ifstr $(KeyProduct) != $(KeyNull)
        CloseRegKey $(KeyProduct)
        ifstr(i) !(NTN_RegBase) == $(ProductKeyName)
           Shell $(UtilityInf), VerExistedDlg, $(ProductSoftwareTitle),+
               $(ProductVersion)
           ifint $($ShellCode) != $(!SHELL_CODE_OK)
               Debug-Output "ShellCode error: cannot get an error string."
               goto ShellCodeError
           endif
           goto end
        else
           Shell $(UtilityInf), CardExistedDlg
           ifint $($ShellCode) != $(!SHELL_CODE_OK)
               Debug-Output "ShellCode error: cannot get an error string."
               goto ShellCodeError
           endif
           ifstr(i) $($R1) != "OK"
               goto end
           endif
           set OldVersionExisted = $(TRUE)
        endif
    endif
    ifint $(OldVersionExisted) == $(FALSE)
	Ifstr(i) $(SrcDir) == ""
           read-syms AskSourceDlgText
           Shell $(subroutineinf) DoAskSourceEx $(SrcDir) $(DlgText)
           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-Dll"
        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
    Goto adapteroptions

;-----------------------------------------------
; Configuration Section
;-----------------------------------------------
;
;   Get the current values of all the parameters
;
configureadapter = +
    Ifstr(i) $(KeyProduct) == $(KeyNull)
        OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_RegBase) $(MAXIMUM_ALLOWED) KeyProduct
        Ifstr $(KeyProduct) == $(KeyNull)
	    set RegistryErrorIndex = CANNOT_FIND_COMPONENT_SERVICE
            Debug-Output "Cannot find component product key"
	    goto fatalregistry
        Endif
    Endif
    Debug-Output "INF: Shelling to FindService"
    Shell $(UtilityInf) FindService, $(KeyProduct)
    Ifint $($ShellCode) != $(!SHELL_CODE_OK)
        Debug-Output "INF: FindService shell failure"
        Goto ShellCodeError
    Endif
    Ifstr(i) $($R0) != NO_ERROR
        Debug-Output "INF: FindService Shell error: "$($R0)
        Goto fatalregistry
    endif
    Set KeyParameters = $($R2)
    CloseRegKey $($R1)
    Ifstr $(KeyParameters) == $(KeyNull)
	set RegistryErrorIndex = CANNOT_FIND_COMPONENT_SERVICE
        Debug-Output "Cannot find component service"
        goto fatalregistry
    endif
    set OldVersionExisted = $(TRUE)
    set ValueName = ""
    set ValueData = ""
    set ValueStr  = ""
    set ValueList = {}
    EnumRegValue $(KeyParameters) ValueList
    ForListDo $(ValueList)
        set ValueItem = $($)
        set ValueName = *($(ValueItem),1)
        set ValueData = *($(ValueItem),4)
	ifstr(i) $(ValueName) == "IoBase"
	    set IOBaseAddrValue = $(ValueData)
	else-ifstr(i) $(ValueName) == "BusNumber"
	    set BusNoValue = $(ValueData)
	else-ifstr(i) $(ValueName) == "NetworkAddress"
	    set NetworkAddress = $(ValueData)
	else-ifstr(i) $(ValueName) == "IoBaseAddress"
	    set IOBasePCMCIAValue = $(ValueData)
	else-ifstr(i) $(ValueName) == "PCCARDAttributeMemoryAddress"
	    set MemWinValue = $(ValueData)
	else-ifstr(i) $(ValueName) == "InterruptNumber"
	    set InterruptValue = $(ValueData)
	else-ifstr(i) $(ValueName) == "ComPortBase"
	    set ComPortValue = $(ValueData)
	else-ifstr(i) $(ValueName) == "PcmciaCtrlBase"
	    set IOBasePCMCIAControllerValue = $(ValueData)
	else-ifstr(i) $(ValueName) == "WaitStates"
            set WaitstateValue = $(ValueData)
	else-ifstr(i) $(ValueName) == "DataSize"
	    set DatasizeValue = $(ValueData)
        endif
    EndForListDo
    ;
    ; Combo-lists and radio-buttons use a special list of parameter-names
    ; when dialogs are executed. The following section converts the actual
    ; values into the corresponding names (indexes). If a value is undefined,
    ; the first entry in the index-list is used.
    ;
    set IOBaseAddrIndex = *($(IOBaseAddrList), ~($(IOBaseAddrValues),$(IOBaseAddrValue)))
    ifstr(i) $(IOBaseAddrIndex) == ""
	set IOBaseAddrIndex = *($(IOBaseAddrList), 1)
    endif
    set BusNoIndex = *($(BusNoList), ~($(BusNoValues),$(BusNoValue)))
    ifstr(i) $(BusNoIndex) == ""
	set BusNoIndex = *($(BusNoList), 1)
    endif
    set IOBasePCMCIAIndex = *($(IOBasePCMCIAList), ~($(IOBasePCMCIAValues),$(IOBasePCMCIAValue)))
    ifstr(i) $(IOBasePCMCIAIndex) == ""
	set IOBasePCMCIAIndex = *($(IOBasePCMCIAList), $(IOBasePCMCIADefault))
    endif
    set MemWinIndex = *($(MemWinList), ~($(MemWinValues),$(MemWinValue)))
    ifstr(i) $(MemWinIndex) == ""
	set MemWinIndex = *($(MemWinList), $(MemWinDefault))
    endif
    set InterruptIndex = *($(InterruptList), ~($(InterruptValues),$(InterruptValue)))
    ifstr(i) $(InterruptIndex) == ""
	set InterruptIndex = *($(InterruptList), $(InterruptDefault))
    endif
    set ComPortIndex = *($(ComPortList), ~($(ComPortValues),$(ComPortValue)))
    ifstr(i) $(ComPortIndex) == ""
	set ComPortIndex = *($(ComPortList), $(ComPortDefault))
    endif
    set IOBasePCMCIAControllerIndex = *($(IOBasePCMCIAControllerList), ~($(IOBasePCMCIAControllerValues),$(IOBasePCMCIAControllerValue)))
    ifstr(i) $(IOBasePCMCIAControllerIndex) == ""
	set IOBasePCMCIAControllerIndex = *($(IOBasePCMCIAControllerList), 1)
    endif
    set WaitstateIndex = *($(WaitstateList), ~($(WaitstateValues),$(WaitstateValue)))
    ifstr(i) $(WaitstateIndex) == ""
	set WaitstateIndex = *($(WaitstateList), 1)
    endif
    set DatasizeIndex = *($(DatasizeList), ~($(DatasizeValues),$(DatasizeValue)))
    ifstr(i) $(DatasizeIndex) == ""
	set DatasizeIndex = *($(DatasizeList), 1)
    endif
    ;
    ; This section runs the dialogs. From the main dialog (adapter parameter
    ; setup) it is possible to enter the PCMCIA dialog if requested. When
    ; exiting the PCMCIA dialog the user is returned to the main dialog.
    ;
adapteroptions = +
    set from = adapteroptions
    set OldNetAddress = $(NetworkAddress)
    ;
    ; Load DLL containing dialogs and verification routines
    ;
    LoadLibrary "Olicom Ethernet Driver Disk" $(DialogDllName) DialogHandle
adapteroptions1 = +
    ;
    ; Read main dialog setup and show dialog
    ;
    ifstr(i) $(Option) == "OCE2XM"
	read-syms AdapterParameterDlg$(!STF_LANGUAGE)
    else
	read-syms PCMCIAParameterDlg$(!STF_LANGUAGE)
        ifstr(i) $(Option) == "GOCARD"
	    set DlgTemplate = "OCE2DLGP"
	else
	    set DlgTemplate = "OCE2DLGPC"
	endif
    endif
    ui start "InputDlg"  $(DialogHandle)
    ui pop 1
    ;
    ; Save new settings because this dialog might be called again.
    ; If CANCEL was pressed these values will not be used
    ;
    ifstr(i) $(Option) == "OCE2XM"
	set IOBaseAddrIndex = $(Combo1Out)
	set BusNoIndex = $(Combo2Out)
	set NetworkAddress = *($(EditTextOut),1)
    else
	set IOBasePCMCIAIndex = $(Combo1Out)
	set MemWinIndex = $(Combo2Out)
	set InterruptIndex = $(Combo3Out)
	set BusNoIndex = $(Combo4Out)
	set ComPortIndex = $(Combo5Out)
	set NetworkAddress = *($(EditTextOut),1)
    endif
    ifstr(i) $(DLGEVENT) == "CONTINUE"
	;
	; parameters have already been stored at this stage
	;
	goto nextstep
    else-ifstr(i) $(DLGEVENT) == "EXIT"
        set CommonStatus = STATUS_USERCANCEL
        Debug-Output "Action: exit. Bye."
	FreeLibrary $(DialogHandle)
        goto end
    else-ifstr(i) $(DLGEVENT) == "FREEBUTTON1"
	;
	; Read PCMCIA Advanced dialog setup and show dialog
	;
	read-syms PCMCIAAdvancedDlg$(!STF_LANGUAGE)
	ui start "InputDlg"  $(DialogHandle)
	ui pop 1
	;
	; Save new settings because this dialog might be called again.
	; If CANCEL was pressed these values will not be used
	;
	set IOBasePCMCIAControllerIndex = $(Combo1Out)
	set WaitstateIndex = $(Combo2Out)
	set DatasizeIndex = *($(RadioOut),1)
	goto adapteroptions1
    else
        Debug-Output "Action: unknown: "$(DLGEVENT)
	FreeLibrary $(DialogHandle)
	goto end
    endif

nextstep =+
    ifstr $(NetworkAddress) != ""
	;
	; If network address has been entered then verify that it is a
	; valid address (not a multicast or broadcast address)
	;
	set FLibraryErrCtl = 1
	LibraryProcedure DlgResult $(DialogHandle) VerifyEthAddress $(NetworkAddress)
	set FLibraryErrCtl = 0
	ifstr $(DlgResult) != "STATUS_SUCCESS"
	    FreeLibrary $(DialogHandle)
	    set Error = $(DlgResult)
	    goto nonfatal
	endif
    endif
    FreeLibrary $(DialogHandle)
    ifint $(OldVersionExisted) == $(TRUE)
        ifstr(i) $(!NTN_InstallMode) == configure
            goto writeparameters
        endif
    endif
    StartWait
    Ifint $(OldVersionExisted) != $(FALSE)
	Goto installhardware
    Endif
    ifstr(i) $(!NTN_InstallMode) == "install"
       Ifstr(i) $(DoCopy) == "YES"
	  Ifstr(i) $(SrcDir) == ""
             read-syms AskSourceDlgText
             Shell $(subroutineinf) DoAskSourceEx $(SrcDir) $(DlgText)
             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
       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
    Shell $(UtilityInf), AddSoftwareComponent, $(Manufacturer), +
        $(ProductSoftwareName), +
        $(ProductSoftwareName), +
        $(ProductSoftwareTitle), $(STF_CONTEXTINFNAME), +
		$(ProductSoftwareImagePath), "kernel", "NDIS", {}, "",+
        $(NetEventDLL), ""
    Set OEM_ABANDON_SOFTWARE = TRUE
    ifint $($ShellCode) != $(!SHELL_CODE_OK)
        Debug-Output "ShellCode error"
        goto ShellCodeError
    endif
    set RegistryErrorIndex = $($R0)
    Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        EndWait
        Debug-Output "OEMNADUB.INF: Registry error: add software components"
        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)
        Debug-Output "ShellCode error."
        goto ShellCodeError
    endif
    set RegistryErrorIndex = $($R0)
    Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        EndWait
        Debug-Output "Registry error: add value list."
        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)
        Debug-Output "ShellCode error."
        goto ShellCodeError
    endif
    set RegistryErrorIndex = $($R0)
    CloseRegKey $(SoftProductKey)
    CloseRegKey $(SoftNetRuleKey)
    CloseRegKey $(SoftServiceKey)
    CloseRegKey $(SoftParameterKey)
    CloseRegKey $(SoftLinkageKey)
    Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        EndWait
        Debug-Output "Registry error: add value list."
        goto fatalregistry
    endif
;
;   Insert hardware component in registry
;
installhardware =+
    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)
        Debug-Output "Cannot add hardware component"
        goto ShellCodeError
    endif
    set RegistryErrorIndex = $($R0)
    Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        EndWait
        Debug-Output "Registry error: add hardware component"
        CloseRegKey $($R1)
        CloseRegKey $($R2)
        CloseRegKey $($R3)
        goto fatalregistry
    endif
    set KeyProduct = $($R1)
    set KeyAdapterRules = $($R2)
    set KeyParameters = $($R3)
    set AdapterNumber = $($R4)
    set NewValueList = {{Manufacturer,$(NoTitle),$(!REG_VT_SZ),$(Manufacturer)},+
		       {Title,$(NoTitle),$(!REG_VT_SZ),"["$($R4)"] "$(ProductHardware$(Option)Title)},+
		       {Description,$(NoTitle),$(!REG_VT_SZ),$(ProductHardware$(Option)Description)},+
                       {ProductName,$(NoTitle),$(!REG_VT_SZ),$(ProductHardwareName)},+
                       {ServiceName,$(NoTitle),$(!REG_VT_SZ),$($R5)},+
                       {InstallDate,$(NoTitle),$(!REG_VT_DWORD),*($(Now),1)}}
    Shell  $(UtilityInf), AddValueList, $(KeyProduct), $(NewValueList)
    ifint $($ShellCode) != $(!SHELL_CODE_OK)
        Debug-Output "ShellCode error"
        goto ShellCodeError
    endif
    CloseRegKey $(KeyProduct)
    Set KeyProduct = ""
    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)
        Debug-Output "ShellCode error."
        goto ShellCodeError
    endif
    CloseRegKey $(KeyAdapterRules)
    set RegistryErrorIndex = $($R0)
    Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        EndWait
        Debug-Output "Registry error: add value list."
        CloseRegKey $(KeyParameters)
        goto fatalregistry
    endif
;
; Write Adapter Parameters to registry
;
writeparameters = +
    Shell $(UtilityInf), GetBusTypeNum
    set BusTypeNum = $($R1)
    ifint $($ShellCode) != $(!SHELL_CODE_OK)
        Debug-Output "ShellCode error."
        goto ShellCodeError
    endif
    Ifstr(i) $(KeyParameters) == $(KeyNull)
        Debug-Output "*** KeyParameters is NULL at writeparameters"
    Endif
    ;
    ; Convert selections from combo-lists and radio-buttons into actual
    ; parameter values
    ;
    set IOBaseAddrValue = *($(IOBaseAddrValues), ~($(IOBaseAddrList),$(IOBaseAddrIndex)))
    set BusNoValue = *($(BusNoValues), ~($(BusNoList),$(BusNoIndex)))
    set IOBasePCMCIAValue = *($(IOBasePCMCIAValues), ~($(IOBasePCMCIAList),$(IOBasePCMCIAIndex)))
    set MemWinValue = *($(MemWinValues), ~($(MemWinList),$(MemWinIndex)))
    set InterruptValue = *($(InterruptValues), ~($(InterruptList),$(InterruptIndex)))
    set ComPortValue = *($(ComPortValues), ~($(ComPortList),$(ComPortIndex)))
    set IOBasePCMCIAControllerValue = *($(IOBasePCMCIAControllerValues), ~($(IOBasePCMCIAControllerList),$(IOBasePCMCIAControllerIndex)))
    set WaitstateValue = *($(WaitstateValues), ~($(WaitstateList),$(WaitstateIndex)))
    set DatasizeValue = *($(DatasizeValues), ~($(DatasizeList),$(DatasizeIndex)))

    ifstr(i) $(Option) == "GOCARDMF"
	;
	; If we're installing a ComboCard, update settings for Serial\parameters\serialoctk16 as well
	; SERIALCOMM will be created automatically by serial.sys
	;
	ifint $(ComPortValue) != 0
	    OpenRegKey $(!REG_H_LOCAL) "" "SYSTEM\CurrentControlSet\Services\Serial\Parameters\SerialOce2xm" $(MAXIMUM_ALLOWED) SerialHandle
	    Ifstr $(SerialHandle) == $(KeyNull)
		OpenRegKey $(!REG_H_LOCAL) "" "SYSTEM\CurrentControlSet\Services\Serial\Parameters" $(MAXIMUM_ALLOWED) SerialKey
		CreateRegKey $(SerialKey) {"SerialOce2xm",0,GenericClass} "" $(MAXIMUM_ALLOWED) "" SerialHandle
		CloseRegKey $(SerialKey)
	    endif
	    ifint $(ComPortValue) != 24
		set NewValueList = {{DosDevices,       $(NoTitle),$(!REG_VT_SZ),      $(ComPortIndex)},+
				    {ForceFifoEnable,  $(NoTitle),$(!REG_VT_DWORD),   0},+
				    {ForceShare,       $(NoTitle),$(!REG_VT_DWORD),   1},+
				    {Interrupt,        $(NoTitle),$(!REG_VT_DWORD),   $(InterruptValue)},+
				    {PortAddress,      $(NoTitle),$(!REG_VT_DWORD),   $(ComPortValue)}}
	    Else
		set-add ComportBaseAddress = $(ComPortValue), $(IOBasePCMCIAValue)
		set NewValueList = {{DosDevices,       $(NoTitle),$(!REG_VT_SZ),      $(ComPortIndex)},+
				    {ForceFifoEnable,  $(NoTitle),$(!REG_VT_DWORD),   0},+
				    {ForceShare,       $(NoTitle),$(!REG_VT_DWORD),   1},+
				    {Interrupt,        $(NoTitle),$(!REG_VT_DWORD),   $(InterruptValue)},+
				    {PortAddress,      $(NoTitle),$(!REG_VT_DWORD),   $(ComportBaseAddress)}}
	    Endif
	    Shell  $(UtilityInf), AddValueList, $(SerialHandle), $(NewValueList)
	    CloseRegKey $(SerialHandle)
	    ;
	    ; Update settings comm port in SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ports section
	    ;
	    OpenRegKey $(!REG_H_LOCAL) "" "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ports" $(MAXIMUM_ALLOWED) SerialHandle
	    Ifstr $(SerialHandle) == $(KeyNull)
		    OpenRegKey $(!REG_H_LOCAL) "" "SOFTWARE\Microsoft\Windows NT\CurrentVersion" $(MAXIMUM_ALLOWED) SerialKey
		    CreateRegKey $(SerialKey) {"Ports",0,GenericClass} "" $(MAXIMUM_ALLOWED) "" SerialHandle
		    CloseRegKey $(SerialKey)
	    endif
	    SetRegValue $(SerialHandle) {$(ComPortIndex)":",$(NoTitle),$(!REG_VT_SZ), "9600,n,8,1"}
	    CloseRegKey $(SerialHandle)
	Else
	    ;
	    ; Be nice and delete the COM stuff if user really wants so
	    ; SERIALCOMM will be deleted automatically
	    ;
	    OpenRegKey $(!REG_H_LOCAL) "" "SYSTEM\CurrentControlSet\Services\Serial\Parameters" $(MAXIMUM_ALLOWED) SerialHandle
	    DeleteRegTree $(SerialHandle) "SerialOce2xm"
	    CloseRegKey $(SerialHandle)
	Endif
    Endif
    ;
    ; Set up parameter list for AddValueList routine
    ;
    set NewValueList = {{IoBase,$(NoTitle),$(!REG_VT_DWORD),$(IOBaseAddrValue)},+
			{MediaType,$(NoTitle),$(!REG_VT_DWORD),1},+
                        {BusType,$(NoTitle),$(!REG_VT_DWORD),$(BusTypeNum)},+
			{BusNumber,$(NoTitle),$(!REG_VT_DWORD),$(BusNoValue)},+
			{IoBaseAddress,$(NoTitle),$(!REG_VT_DWORD),$(IOBasePCMCIAValue)},+
			{IoLength,$(NoTitle),$(!REG_VT_DWORD),31},+
			{PCCARDAttributeMemoryAddress,$(NoTitle),$(!REG_VT_DWORD),$(MemWinValue)},+
			{PCCARDAttributeMemorySize, $(NoTitle),$(!REG_VT_DWORD),4096},+
			{PCCARDAttributeMemoryOffset, $(NoTitle),$(!REG_VT_DWORD),0},+
			{InterruptNumber,$(NoTitle),$(!REG_VT_DWORD),$(InterruptValue)},+
			{ComPortBase,$(NoTitle),$(!REG_VT_DWORD),$(ComPortValue)},+
			{PcmciaCtrlBase,$(NoTitle),$(!REG_VT_DWORD),$(IOBasePCMCIAControllerValue)},+
			{Pcmcia,$(NoTitle),$(!REG_VT_DWORD),1},+
                        {WaitStates,$(NoTitle),$(!REG_VT_DWORD),$(WaitstateValue)},+
			{DataSize,$(NoTitle),$(!REG_VT_DWORD),$(DatasizeValue)}}
    ifstr $(NetworkAddress) != ""
       set NewValueList = >($(NewValueList),{NetworkAddress,$(NoTitle),$(!REG_VT_SZ),$(NetworkAddress)})
    endif
    ;
    ; Now update registry
    ;
    Shell  $(UtilityInf), AddValueList, $(KeyParameters), $(NewValueList)
    ;
    ; If the network address has been deleted then also delete it from
    ; the registry.
    ;
    ifstr $(OldNetAddress) != ""
       ifstr $(NetworkAddress) == ""
          DeleteRegValue $(KeyParameters) NetworkAddress
       endif
    endif
    ;
    ; If we're not installing a PCMCIA Card, remove PCMCIA specific settings
    ;
    ifstr(i) $(Option) == "OCE2XM"
        DeleteRegValue $(KeyParameters) IoBaseAddress
	DeleteRegValue $(KeyParameters) IoLength
        DeleteRegValue $(KeyParameters) PCCARDAttributeMemoryAddress
        DeleteRegValue $(KeyParameters) PCCARDAttributeMemorySize
        DeleteRegValue $(KeyParameters) PCCARDAttributeMemoryOffset
        DeleteRegValue $(KeyParameters) InterruptNumber
        DeleteRegValue $(KeyParameters) ComPortBase
        DeleteRegValue $(KeyParameters) PcmciaCtrlBase
        DeleteRegValue $(KeyParameters) Pcmcia
	DeleteRegValue $(KeyParameters) WaitStates
        DeleteRegValue $(KeyParameters) DataSize
    Endif
    ifstr(i) $(Option) == "GOCARD"
        DeleteRegValue $(KeyParameters) ComPortBase
    Endif

    CloseRegKey $(KeyParameters)
    ifint $($ShellCode) != $(!SHELL_CODE_OK)
        Debug-Output "ShellCode error."
        goto ShellCodeError
    endif
    set RegistryErrorIndex = $($R0)
    Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        Debug-Output "Registry error: Add value list"
        goto fatalregistry
    endif
;
; Add some keywords to the PCMCIA database in the registry
;
    ifstr(i) $(Option) == "GOCARD"
	set PCMCIADatabaseKeyName = $(!NTN_ServiceBase)"\Pcmcia\DataBase"
	OpenRegKey $(!REG_H_LOCAL) "" $(PCMCIADatabaseKeyName) $(MAXIMUM_ALLOWED) PCMCIADatabaseKey
	ifstr $(PCMCIADatabaseKey) != $(NULL)
    ;	    OpenRegKey $(!REG_H_LOCAL) "" $(PCMCIADatabaseKeyName) $(MAXIMUM_ALLOWED) PCMCIADatabaseOlicomKey
    ;	    ifstr $(PCMCIADatabaseOlicomKey) != $(NULL) ; open succeeded, so delete it
    ;		CloseRegKey $(PCMCIADatabaseOlicomKey)
    ;		DeleteRegTree $(PCMCIADatabaseKey) "Olicom"
    ;	    endif
	    CreateRegKey $(PCMCIADatabaseKey) {"Olicom", 0, 0} "" $(MAXIMUM_ALLOWED) "" PCMCIADatabaseOlicomKey
	    CreateRegKey $(PCMCIADatabaseOlicomKey) {"Ethercom", 0, 0} "" $(MAXIMUM_ALLOWED) 0 PCMCIADatabaseOlicom2220Key
	    SetRegValue $(PCMCIADatabaseOlicom2220Key) {Driver, 0, $(!REG_VT_SZ),"oce2xm"}
	    CloseRegKey $(PCMCIADatabaseOlicom2220Key)
	    CreateRegKey $(PCMCIADatabaseOlicomKey) {"Ethernet", 0, 0} "" $(MAXIMUM_ALLOWED) 0 PCMCIADatabaseOlicom2220Key
	    SetRegValue $(PCMCIADatabaseOlicom2220Key) {Driver, 0, $(!REG_VT_SZ),"oce2xm"}
	    CloseRegKey $(PCMCIADatabaseOlicom2220Key)
    ;
    ;	    When NT 3.51 sees our Combo cards, it enables a COM port only.
    ;	    We therefore rely on our own enabling mechanism in these cases.
    ;
    ;	    CreateRegKey $(PCMCIADatabaseOlicomKey) {"GoCard Ethernet+Modem 14400", 0, 0} "" $(MAXIMUM_ALLOWED) 0 PCMCIADatabaseOlicom2230Key
    ;	    SetRegValue $(PCMCIADatabaseOlicom2230Key) {Driver, 0, $(!REG_VT_SZ),"oce2xm"}
    ;	    CloseRegKey $(PCMCIADatabaseOlicom2230Key)
    ;	    CreateRegKey $(PCMCIADatabaseOlicomKey) {"GoCard Ethernet+Modem 28800", 0, 0} "" $(MAXIMUM_ALLOWED) 0 PCMCIADatabaseOlicom2231Key
    ;	    SetRegValue $(PCMCIADatabaseOlicom2231Key) {Driver, 0, $(!REG_VT_SZ),"oce2xm"}
    ;	    CloseRegKey $(PCMCIADatabaseOlicom2231Key)

    ;	    CloseRegKey $(PCMCIADatabaseOlicomKey)
	Endif
    Endif
    EndWait
    goto successful

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

;-----------------------------------------------
; Remove Adapter Section
;-----------------------------------------------
;
;   Remove all adapter information from the registry
;
removeadapter = +
    Ifstr(i) $(ProductKeyName) == $(!NTN_RegBase)
        Shell $(UtilityInf), RemoveSoftwareComponent, $(Manufacturer), +
            $(ProductSoftwareName)
        ifint $($ShellCode) != $(!SHELL_CODE_OK)
            Debug-Output "ShellCode error"
            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)
            Debug-Output "ShellCode error"
            goto ShellCodeError
        endif
	set RegistryErrorIndex = $($R0)
	Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
            goto fatalregistry
        endif
	;
	; Remove associated Com port
	;
	ifstr(i) $(Option) == "GOCARDMF"
	    OpenRegKey $(!REG_H_LOCAL) "" "SYSTEM\CurrentControlSet\Services\Serial\Parameters" $(MAXIMUM_ALLOWED) SerialHandle
	    DeleteRegTree $(SerialHandle) "SerialOce2xm"
	    CloseRegKey $(SerialHandle)
	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)
                Debug-Output "ShellCode error"
                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
                CloseRegKey $(NetworkCardKey)
                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)
            Debug-Output "ShellCode error"
            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)
            Debug-Output "ShellCode error"
            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 Severity = STATUS
    Set CommonStatus = STATUS_USERCANCEL
    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 "subroutn.inf" SetupMessage $(!STF_LANGUAGE) WARNING "Fatal Error"
    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 = "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) $(OEM_ABANDON_ON) == TRUE
        set OEM_ABANDON_ON = FALSE
        goto abandon
    endif
    goto end
end = +
    goto term
term = +
    Return $(CommonStatus)

[Install-Option]
    set STF_VITAL = ""
    ifstr(i) $(AddCopy) == "YES"
        AddSectionFilesToCopyList Files-$(Option) $(SrcDir) $(!STF_WINDOWSSYSPATH)\drivers
    endif
    Debug-Output "OEMSETNT.INF: [Install-Option] DoCopy = "$(DoCopy)
    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)
   AddSectionFilesToCopyList Files-Dll $(SrcDir) $(!STF_WINDOWSSYSPATH)
   set !STF_NCPA_FLUSH_COPYLIST = TRUE
   CopyFilesInCopyList
   exit

[Install-Dll]
   set STF_VITAL 	= ""
   ifstr(i) $(AddCopy) == "YES"
      AddSectionFilesToCopyList Files-Dll $(SrcDir) $(!STF_WINDOWSSYSPATH)
   endif
   ifstr(i) $(DoCopy) == "YES"
      set !STF_NCPA_FLUSH_COPYLIST = TRUE
      CopyFilesInCopyList
   endif
   exit

[Source Media Descriptions]
;   1  = "Olicom Ethernet Driver Disk"
    1  = "Windows NT DRVLIB"

[Signature]
    FileType = MICROSOFT_DRVLIB_FILE
[GetSignature]
    read-syms Signature
    return $(FileType)

[ProductType]
STF_PRODUCT  = Winnt
STF_PLATFORM = I386

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

[Files-OCE2XM]
1, OCE2XM.SYS,	 SIZE=999

[Files-GOCARD]
1, OCE2XM.SYS,	 SIZE=999

[Files-GOCARDMF]
1, OCE2XM.SYS,	 SIZE=999
1, serial.sys,	 SIZE=999

[Files-Dll]
1, oce2xm.dll,	 SIZE=999
1, oce2xm.hlp,	 SIZE=999

[Files-dummy]

