[Identification]
    OptionType = NetAdapter
[PlatformsSupported]
    ISA
    EISA
    MCA
    "Jazz-Internal Bus"
[LanguagesSupported]
    ENG
[Options]
    OCTK16
[OptionsTextENG]
    OCTK16     = "Olicom Token-Ring 16/4 Adapter"
[IOBaseAddrChoices]
IOBase_0  = "Auto detect", 0
IOBase_1  = "0A00-0A1F", 2560
IOBase_2  = "0A20-0A3F", 2592
IOBase_3  = "0A40-0A5F", 2624
IOBase_4  = "0A60-0A7F", 2656
IOBase_5  = "0A80-0A9F", 2688
IOBase_6  = "0AA0-0ABF", 2720
IOBase_7  = "0AC0-0ADF", 2752
IOBase_8  = "0AE0-0AFF", 2874
IOBase_9  = "0B00-0B1F", 2816
IOBase_10 = "0B20-0B3F", 2848
IOBase_11 = "0B40-0B5F", 2880
IOBase_12 = "0B60-0B7F", 2912
IOBase_13 = "0B80-0B9F", 2944
IOBase_14 = "0BA0-0BBF", 2976
IOBase_15 = "0BC0-0BDF", 3008
IOBase_16 = "0BE0-0BFF", 3040
IOBase_20 = "0A20-0A23,0A30-0A3F", 2592
IOBase_21 = "0A24-0A27,0A40-0A4F", 2596
IOBase_22 = "0A50-0A53,0A60-0A6F", 2640
IOBase_23 = "0A54-0A57,0A70-0A7F", 2644
[ReceiveBufferCountChoices]
RBC_1 = "32",32
RBC_2 = "31",31
RBC_3 = "30",30
RBC_4 = "29",29
RBC_5 = "28",28
RBC_6 = "27",27
RBC_7 = "26",26
RBC_8 = "25",25
RBC_9 = "24",24
RBC_10 = "23",23
RBC_11 = "22",22
RBC_12 = "21",21
RBC_13 = "20",20
RBC_14 = "19",19
RBC_15 = "18",18
RBC_16 = "17",17
RBC_17 = "16",16
RBC_18 = "15",15
RBC_19 = "14",14
RBC_20 = "13",13
RBC_21 = "12",12
RBC_22 = "11",11
RBC_23 = "10",10
RBC_24 = "9",9
RBC_25 = "8",8
RBC_26 = "7",7
RBC_27 = "6",6
RBC_28 = "5",5
[TransmitBufferCountChoices]
XBC_1 = "32",32
XBC_2 = "31",31
XBC_3 = "30",30
XBC_4 = "29",29
XBC_5 = "28",28
XBC_6 = "27",27
XBC_7 = "26",26
XBC_8 = "25",25
XBC_9 = "24",24
XBC_10 = "23",23
XBC_11 = "22",22
XBC_12 = "21",21
XBC_13 = "20",20
XBC_14 = "19",19
XBC_15 = "18",18
XBC_16 = "17",17
XBC_17 = "16",16
XBC_18 = "15",15
XBC_19 = "14",14
XBC_20 = "13",13
XBC_21 = "12",12
XBC_22 = "11",11
XBC_23 = "10",10
XBC_24 = "9",9
XBC_25 = "8",8
XBC_26 = "7",7
XBC_27 = "6",6
XBC_28 = "5",5
XBC_29 = "4",4
XBC_30 = "3",3
XBC_31 = "2",2
[MaxFrameSizeChoices]
MFS_1 = "8 KBytes",8192
MFS_2 = "6 KBytes",6144
MFS_3 = "4 KBytes",4096
MFS_4 = "2 KBytes",2048
[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
[FileConstants]
UtilityInf      = "UTILITY.INF"
subroutineinf   = "SUBROUTN.INF"
SoftwareType    = "driver"
Exit_Code       = 0
DialogDllName   = "octk16.dll"
NetEventDLL     = "%SystemRoot%\System32\netevent.dll;%SystemRoot%\System32\Drivers\Octk16.sys"
IoLogMsgDLL     = "%SystemRoot%\System32\IoLogMsg.dll"
Manufacturer    = "Olicom"
ProductMajorVersion     = "2"
ProductMinorVersion     = "10"
ProductVersion          = $(ProductMajorVersion)"."$(ProductMinorVersion)
ProductSoftwareName     = "OcTk16"
ProductSoftwareTitle    = "Olicom Token-Ring 16/4 Adapter Driver"
ProductSoftwareImagePath = "\SystemRoot\System32\drivers\octk16.sys"
NetRuleSoftwareType     = "octk16Sys ndisDriver octk16Driver"
NetRuleSoftwareUse      = $(SoftwareType)
NetRuleSoftwareBindForm = """Octk16Sys"" yes no container"
NetRuleSoftwareClass    = {"octk16Driver basic"}
NetRuleSoftwareBindable = {"octk16Driver octk16Adapter non exclusive 100"}
ProductHardwareName     = "OcTk16"
ProductHardwareTitle    = "Olicom Token-Ring 16/4 Adapter"
NetRuleHardwareType     = "octk16 octk16Adapter"
NetRuleHardwareBindForm = " yes yes container"
NetRuleHardwareClass    = {"octk16Adapter 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:"
FunctionTitle   = "Olicom Token-Ring 16/4 Adapter Card Setup"
ProductSoftwareDescription = "Olicom Token-Ring 16/4 Adapter Driver"
ProductHardwareDescription = "Olicom Token-Ring 16/4 Adapter"
IOBaseAddrList = ^(IOBaseAddrChoices, 1)
IOBaseAddrValues = ^(IOBaseAddrChoices, 2)
RcvBufCountList  = ^(ReceiveBufferCountChoices, 1)
RcvBufCountValues = ^(ReceiveBufferCountChoices, 2)
XmitBufCountList = ^(TransmitBufferCountChoices, 1)
XmitBufCountValues = ^(TransmitBufferCountChoices, 2)
FrameSizeList = ^(MaxFrameSizeChoices, 1)
FrameSizeValues = ^(MaxFrameSizeChoices, 2)
BusNoList = ^(BusNumberChoices, 1)
BusNoValues = ^(BusNumberChoices, 2)
[DialogConstantsENG]
Help        = "&Help"
Exit        = "Cancel"
OK          = "OK"
HelpContext = ""
Continue    = "Continue"
Cancel      = "Cancel"
[date]
    Now = {} ? $(!LIBHANDLE) GetSystemDate
[AskSourceDlgText]
    DlgText        = "Please enter the full path of the Olicom 16/4 driver "+
		     "setup files. Then choose Continue."
[FileDependentDlgENG]
DlgType = "RadioCombination"
DlgTemplate = "NETDLG"
Caption = $(FunctionTitle)
DlgText = "Please select values for the following fields:"
Combo1Label = "&I/O Base Address:"
Combo2Label = "&Receive Buffers:"
Combo3Label = "&Transmit Buffers:"
Combo4Label = "&Max Frame Size:"
Combo5Label = "&Bus Number:"
Label1 = "&Early Token Release:"
Radio1 = "Yes"
Radio2 = "No"
Label2 = "&Full Transmit Status:"
Radio3 = "Yes"
Radio4 = "No"
Edit1Label = "&Network Address:"
Combo1List = $(IOBaseAddrList)
Combo1Out  = $(IOBaseAddrValue)
Combo2List = $(RcvBufCountList)
Combo2Out  = $(RcvBufCountValue)
Combo3List = $(XmitBufCountList)
Combo3Out  = $(XmitBufCountValue)
Combo4List = $(FrameSizeList)
Combo4Out  = $(FrameSizeValue)
Combo5List = $(BusNoList)
Combo5Out  = $(BusNoValue)
ComboListItemsIn  = {Combo1List, Combo2List, Combo3List, Combo4List, Combo5List}
ComboListItemsOut = {Combo1Out, Combo2Out, Combo3Out, Combo4Out, Combo5Out}
EditTextLim = 17
EditTextIn = $(NetworkAddress)
RadioOptionGreyed = {}
CBOptionsGreyed = {}
NotifyFields = {NO, NO, NO, NO, NO}
HelpContext = 6000
[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)
[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 "octk16.hlp" 6000 6000
    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 IOBaseAddrValue = *($(IOBaseAddrList), 1)
    set BusNoValue = *($(BusNoList), 1)
    set RcvBufCountValue = *($(RcvBufCountList), 1)
    set XmitBufCountValue = *($(XmitBufCountList), 1)
    set FrameSizeValue = *($(FrameSizeList), 1)
    set NetworkAddress = *($(EditTextOut), 1)
    set RadioIn = { 1, 3 }
    set EarlyRelease = "Yes"
    set FrameStatus = "Yes"
    Shell "" DebugConfiguration "After parameter querying"
    Shell $(UtilityInf), GetBusTypeNum
    set BusTypeNum = $($R1)
    ifint $($ShellCode) != $(!SHELL_CODE_OK)
	Debug-Output "ShellCode error."
	goto ShellCodeError
    endif
    set RcvBufCountValue = *($(RcvBufCountList), ~($(RcvBufCountValues),6))
    set XmitBufCountValue = *($(XmitBufCountList), ~($(XmitBufCountValues),8))
    set FrameSizeValue = *($(FrameSizeList), ~($(FrameSizeValues),4096))
    Set from = $(fatal)
    Set to = $(fatal)
    Goto $(StartLabel)
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
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) == "RecBufCount"
	    set RcvBufCountIndex = $(ValueData)
	else-ifstr(i) $(ValueName) == "IoBase"
	    set IOBaseAddrIndex = $(ValueData)
	else-ifstr(i) $(ValueName) == "TransmitBufferCount"
	    set XmitBufCountIndex = $(ValueData)
	else-ifstr(i) $(ValueName) == "TransmitBufferSize"
	    set FrameSizeIndex = $(ValueData)
	else-ifstr(i) $(ValueName) == "BusNumber"
	    set BusNoIndex = $(ValueData)
	else-ifstr(i) $(ValueName) == "EarlyRelease"
	    set EarlyRelease = $(ValueData)
	else-ifstr(i) $(ValueName) == "FrameStatus"
	    set FrameStatus = $(ValueData)
	else-Ifstr(i) $(ValueName) == "NetworkAddress"
	    set NetworkAddress = $(ValueData)
	endif
    EndForListDo
    set RcvBufCountValue = *($(RcvBufCountList), ~($(RcvBufCountValues),$(RcvBufCountIndex)))
    ifstr(i) $(RcvBufCountValue) == ""
	set RcvBufCountValue = *($(RcvBufCountList), 1)
    endif
    set XmitBufCountValue = *($(XmitBufCountList), ~($(XmitBufCountValues),$(XmitBufCountIndex)))
    ifstr(i) $(XmitBufCountValue) == ""
	set XmitBufCountValue = *($(XmitBufCountList), 1)
    endif
    set FrameSizeValue = *($(FrameSizeList), ~($(FrameSizeValues),$(FrameSizeIndex)))
    ifstr(i) $(FrameSizeValue) == ""
	set FrameSizeValue = *($(FrameSizeList), 1)
    endif
    set IOBaseAddrValue = *($(IOBaseAddrList), ~($(IOBaseAddrValues),$(IOBaseAddrIndex)))
    ifstr(i) $(IOBaseAddrValue) == ""
	set IOBaseAddrValue = *($(IOBaseAddrList), 1)
    endif
    set BusNoValue = *($(BusNoList), ~($(BusNoValues),$(BusNoIndex)))
    ifstr(i) $(BusNoValue) == ""
	set BusNoValue = *($(BusNoList), 1)
    endif
    Ifstr(i) $(EarlyRelease) == "Yes"
	set Rad1 = 1
    else
	set Rad1 = 2
    endif
    Ifstr(i) $(FrameStatus) == "Yes"
	set Rad2 = 3
    else
	set Rad2 = 4
    endif
    set RadioIn = {$(Rad1), $(Rad2) }
adapteroptions = +
    Set from = adapteroptions
    set OldNetAddress = $(NetworkAddress)
    read-syms FileDependentDlg$(!STF_LANGUAGE)
    LoadLibrary "OC-3804 Driver Disk" $(DialogDllName) DialogHandle
    ui start "InputDlg"  $(DialogHandle)
    ifstr(i) $(DLGEVENT) == "CONTINUE"
	set IOBaseAddrIndex = $(Combo1Out)
	set RcvBufCountIndex = $(Combo2Out)
	set XmitBufCountIndex = $(Combo3Out)
	set FrameSizeIndex = $(Combo4Out)
	set BusNoIndex = $(Combo5Out)
	IfContains "1" IN $(RadioOut)
	    set EarlyRelease = "Yes"
	else-IfContains "2" IN $(RadioOut)
	    set EarlyRelease = "No"
	endif
	IfContains "3" IN $(RadioOut)
	    set FrameStatus = "Yes"
	else-IfContains "4" IN $(RadioOut)
	    set FrameStatus = "No"
	endif
	set NetworkAddress = *($(EditTextOut),1)
	ui pop 1
	goto nextstep
    else-ifstr(i) $(DLGEVENT) == "EXIT"
	set CommonStatus = STATUS_USERCANCEL
	Debug-Output "Action: exit. Bye."
	ui pop 1
	FreeLibrary $(DialogHandle)
	goto end
    else
	ui pop 1
	Debug-Output "Action: unknown: "$(DLGEVENT)
	FreeLibrary $(DialogHandle)
	goto end
    endif
nextstep =+
    ifstr $(NetworkAddress) != ""
	set FLibraryErrCtl = 1
	LibraryProcedure DlgResult $(DialogHandle) VerifyAddress $(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
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)"] "$(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, $(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
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
    set IOBaseAddrValue = *($(IOBaseAddrValues), ~($(IOBaseAddrList),$(IOBaseAddrIndex)))
    set BusNoValue = *($(BusNoValues), ~($(BusNoList),$(BusNoIndex)))
    set RcvBufCountValue = *($(RcvBufCountValues), ~($(RcvBufCountList),$(RcvBufCountIndex)))
    set XmitBufCountValue = *($(XmitBufCountValues), ~($(XmitBufCountList),$(XmitBufCountIndex)))
    set FrameSizeValue = *($(FrameSizeValues), ~($(FrameSizeList),$(FrameSizeIndex)))
    Set NewValueList = {{IoBase,$(NoTitle),$(!REG_VT_DWORD),$(IOBaseAddrValue)},+
			{MediaType,$(NoTitle),$(!REG_VT_DWORD),2},+
			{BusType,$(NoTitle),$(!REG_VT_DWORD),$(BusTypeNum)},+
			{BusNumber,$(NoTitle),$(!REG_VT_DWORD),$(BusNoValue)},+
			{RecBufCount,$(NoTitle),$(!REG_VT_DWORD),$(RcvBufCountValue)},+
			{TransmitBufferCount,$(NoTitle),$(!REG_VT_DWORD),$(XmitBufCountValue)},+
			{TransmitBufferSize,$(NoTitle),$(!REG_VT_DWORD),$(FrameSizeValue)},+
			{EarlyRelease,$(NoTitle),$(!REG_VT_SZ),$(EarlyRelease)},+
			{FrameStatus,$(NoTitle),$(!REG_VT_SZ),$(FrameStatus)}}
    ifstr $(NetworkAddress) != ""
       set NewValueList = >($(NewValueList),{NetworkAddress,$(NoTitle),$(!REG_VT_SZ),$(NetworkAddress)})
    endif
    Shell  $(UtilityInf), AddValueList, $(KeyParameters), $(NewValueList)
    ifstr $(OldNetAddress) != ""
       ifstr $(NetworkAddress) == ""
	  DeleteRegValue $(KeyParameters) NetworkAddress
       endif
    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
    EndWait
    goto successful
bindingadapter =+
    set Error = "Binding: Sorry, not yet implemented."
    goto fatal
removeadapter = +
    Ifstr(i) $(ProductKeyName) == $(!NTN_RegBase)
	Shell $(UtilityInf), RemoveSoftwareComponent, $(Manufacturer), +
	    $(ProductSoftwareName)
	ifint $($ShellCode) != $(!SHELL_CODE_OK)
	    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
    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 $(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
	AddSectionFilesToCopyList Files-Stat $(SrcDir) $(!STF_WINDOWSSYSPATH)
    endif
    Debug-Output "OEMSETUP.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)
   AddSectionFilesToCopyList Files-Stat $(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  = "OC-3804 Driver Disk"
    99  = "LMHOST disk"
[ProductType]
STF_PRODUCT  = Winnt
STF_PLATFORM = I386
[Files-Inf]
1,      oemsetup.inf,   SIZE=999,       RENAME=$(!UG_Filename)
[Files-OcTk16]
1,      octk16.sys,     SIZE=999
[Files-Dll]
1,      octk16.dll,     SIZE=999
1,      octk16.hlp,     SIZE=999
[Files-Stat]
1,      octkstat.exe,   SIZE=999
[Files-dummy]

