[Identification]
	OptionType = NetAdapter

[PlatformsSupported]
	EISA
	"Jazz-Internal Bus"

[FileConstants]
	UtilityInf      		= "UTILITY.INF"
	SubRoutineInf   		= "SUBROUTN.INF"
	ParamInf        		= "NCPARAM.INF"
	SoftwareType    		= "driver"
	Exit_Code       		= 0
	NetEventDLL     		= "%SystemRoot%\System32\netevent.dll"
	IoLogMsgDLL     		= "%SystemRoot%\System32\IoLogMsg.dll"
	Manufacturer    		= "TriplePoint"
	ProductMajorVersion     = "3"
	ProductMinorVersion     = "1"
	ProductVersion  		= $(ProductMajorVersion)"."$(ProductMinorVersion)
	ProductSoftwareName     = "FddiLink1"
	ProductSoftwareTitle    = "FddiLink Adapter Driver 1"
	ProductSoftwarePath		= "\SystemRoot\System32\drivers\flnk1.sys"
	NetRuleSoftwareType     = "FddiLinkSys1 ndisDriver FddiLinkDriver1"
	NetRuleSoftwareUse      = $(SoftwareType)
	NetRuleSoftwareBindForm = """FddiLinkSys1"" yes no container"
	NetRuleSoftwareClass    = {"FddiLinkDriver1 basic"}
	NetRuleSoftwareBindable = {"FddiLinkDriver1 FddiLinkAdapter1 non exclusive 100"}
	ProductHardwareName     = "FDDILINK1"
	ProductHardwareTitle    = "FddiLink 3C770 Adapter"
	NetRuleHardwareType     = "FddiLink1 FddiLinkAdapter1"
	NetRuleHardwareBindForm = " yes yes container"
	NetRuleHardwareClass    = {"FddiLinkAdapter1 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

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

[Identify]
	Read-Syms Identification
	Set Status     			= STATUS_SUCCESSFUL
	Set Identifier 			= $(OptionType)
	Set Media      			= #("Source Media Descriptions", 1, 1)
	Return $(Status) $(Identifier) $(Media)

[ReturnOptions]
	Set Status         		= STATUS_FAILED
	Set OptionList     		= {}
	Set OptionTextList 		= {}
	Set LanguageList 		= ^(LanguagesSupported, 1)
	IfContains(i) $($0) in $(LanguageList)
		IfStr(i) $($1) == ""
			Goto returnOptions
		EndIf
		Set PlatformList	= ^(PlatformsSupported, 1)
		IfContains(i) $($1) in $(PlatformList)
			Goto returnOptions
		Else
			Set Status = STATUS_NOTSUPPORTED
			Goto finish_ReturnOptions
		EndIf
	Else
		Set Status = STATUS_NOLANGUAGE
		Goto finish_ReturnOptions
	EndIf
returnOptions = +
	Set OptionList     		= ^(Options, 1)
	Set OptionTextList 		= ^(OptionsText$($0), 1)
	Set Status         		= STATUS_SUCCESSFUL
finish_ReturnOptions = +
	Return $(Status) $(OptionList) $(OptionTextList)

[InstallOption]
	Set Option   			= $($1)
	Set SrcDir   			= $($2)
	Set AddCopy  			= $($3)
	Set DoCopy   			= $($4)
	Set DoConfig 			= $($5)
	Set LanguageList		= ^(LanguagesSupported, 1)
	IfContains(i) $($0) NOT-IN $(LanguageList)
		Return STATUS_NOLANGUAGE
	EndIf
; FIXME
	Set !DebugOutputControl	= 1
	Debug-Output "FddiLink: STF_CWDIR    = "$(!STF_CWDIR)
	Debug-Output "FddiLink: STF_LANGUAGE = "$(!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
	EndWait
Begin = +
	Set ActivateDetection = FALSE
	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
;		Set ActivateDetection = TRUE
		IfStr(i) $(ProductKeyName) == $(!NTN_RegBase)
			Debug-Output "FddiLink: ProductKeyName="$(ProductKeyName)
			Shell $(UtilityInf),RegistryErrorString,CANNOT_CONFIGURE_SOFTWARE
			IfInt $($ShellCode) != $(!SHELL_CODE_OK)
				Debug-Output "FddiLink:ShellCode: RegistryErrorString: "$($ShellCode)
				Goto ShellCodeError
			EndIf
			Set Error = $($R0)
			Set from = end
			Set to = end
			Goto nonFatalInfo
		EndIf
	Else
;		Set ActivateDetection = TRUE
		Set StartLabel = InstallAdapter
		Set OEM_ABANDON_OPTIONS = {}
		Set OEM_ABANDON_SOFTWARE = FALSE
		Set OEM_ABANDON_ON = TRUE
	EndIf
	Debug-Output "FddiLink: =================================================="
	Debug-Output "FddiLink: Option        = "$(Option)
	Debug-Output "FddiLink: STF_CWDIR     = "$(!STF_CWDIR)
	Debug-Output "FddiLink: STF_LANGUAGE  = "$(!STF_LANGUAGE)
	Debug-Output "FddiLink: STF_NCDETECT  = "$(!STF_NCDETECT)
	Debug-Output "FddiLink: STF_NCOPTION  = "$(!STF_NCOPTION)
	Debug-Output "FddiLink: STF_NCDETCARD = "$(!STF_NCDETCARD)
	Debug-Output "FddiLink: STF_NCDETINFO = "$(!STF_NCDETINFO)
	Debug-Output "FddiLink: =================================================="
; FIXME
	Set DebugFlags						= 1
	Set MaxTransmits					= 1
	IfStr(i) $(Option) == FDDILINK_EISA_1
		Set BoardType					= 1
	Else
		Set BoardType					= 3
	EndIf
	Set DetectedCard					= FALSE
	Set ActivateDetection				= FALSE
	IfStr(i) $(ActivateDetection) != TRUE
		IfInt $(BoardType) == 1
;;;			FDDILINK_EISA_1
			Debug-Output "FddiLink: ISA"
			Set IOAddrList				= {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}
			Set IOAddrValue				= 1
			Set	Combo1Label 			= "&Slot Number:"
			
			Shell $(ParamInf) HexListFromDecList $(IOAddrList)
			Set IOAddrHexList			= $($R0)
		Else
;;;			FDDILINK_MCA
			Debug-Output "FddiLink: MCA"
			Set IOAddrList				= {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}
			Set IOAddrValue				= 1
			Set	Combo1Label 			= "MCA &Slot:"
			Shell $(ParamInf) HexListFromDecList $(IOAddrList)
			Set IOAddrHexList			= $($R0)
		EndIf
		Goto $(StartLabel)
	EndIf
	Set TypeList = {{IOADDR, IOAddrList, IOAddrValue}}
	Debug-Output "FddiLink: Calling Param_BuildTypeLists"
	Shell $(ParamInf) Param_BuildTypeLists $(Option) $(TypeList)
	IfInt $($ShellCode) != $(!SHELL_CODE_OK)
		Debug-Output "FddiLink: Cannot run Param_BuildTypeLists"
		Goto ShellCodeError
	EndIf
	Set Status = $($R0)
	IfStr(i) $(Status) != STATUS_SUCCESSFUL
		Debug-Output "FddiLink: Param_BuildTypeLists ERROR="$(Status)
		Goto fatalDetect
	EndIf
	Debug-Output "FddiLink: Calling Param_SetDefaults"
	Shell $(ParamInf) Param_SetDefaults {}
	Shell $(ParamInf) HexListFromDecList $(IOAddrList)
	Set IOAddrHexList = $($R0)
	IfStr(i) $(!STF_NCDETECT) == YES
		IfStr(i) $(!STF_NCOPTION) == $(Option)
			Set DetectedCard = TRUE
			Debug-Output "FddiLink: Setting DetectedCard = TRUE"
		EndIf
	EndIf
	Shell "" DebugConfiguration "After Parameter Query"
	Set from = $(fatal)
	Set to = $(fatal)
	Goto $(StartLabel)
InstallAdapter = +
	Debug-Output "FddiLink: 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 "FddiLink: Cannot run VerExistedDlg"
				Goto ShellCodeError
			EndIf
			Debug-Output "FddiLink: Adapter already installed"
			Goto end
		Else
			Shell $(UtilityInf), CardExistedDlg
			IfInt $($ShellCode) != $(!SHELL_CODE_OK)
				Debug-Output "FddiLink: Cannot run CardExistedDlg"
				Goto ShellCodeError
			EndIf
			IfStr(i) $($R1) != "OK"
				Goto end
			EndIf
			Set OldVersionExisted = $(TRUE)
		EndIf
	EndIf
	IfStr(i) $(DetectedCard) != TRUE
		Goto adapterSetup
	EndIf
	StartWait
	Shell $(ParamInf) Param_QueryCard $(!STF_NCDETCARD)
	EndWait
	IfStr(i) $($R0) != STATUS_SUCCESSFUL
		Goto adapterSetup
	EndIf
	Set DetectedParams = $($R1)
	Debug-Output "FddiLink: Calling Param_SetDefaults to merge detected params"
	Shell $(ParamInf) Param_SetDefaults $(DetectedParams)
	Goto adapterSetup
ConfigureAdapter = +
	Debug-Output "FddiLink: ConfigureAdapter"
;	IfInt $(BoardType) == 3
;		Set Error =  "FddiLink: ISA adapter cannot be configured."
;		Debug-Output $(Error)
;		Goto successful
;	EndIf
	IfStr $(KeyProduct) == $(KeyNull)
		OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_RegBase) $(MAXIMUM_ALLOWED) KeyProduct
		IfStr $(KeyProduct) == $(KeyNull)
			Set RegistryErrorIndex = CANNOT_FIND_COMPONENT_SERVICE
			Debug-Output "FddiLink: Cannot find component product key."
			Goto fatalRegistry
		EndIf
	EndIf
	Debug-Output "FddiLink: Calling FindService"
	Shell $(UtilityInf) FindService, $(KeyProduct)
	IfInt $($ShellCode) != $(!SHELL_CODE_OK)
		Debug-Output "FddiLink: Cannot run FindService"
		Goto ShellCodeError
	EndIf
	IfStr(i) $($R0) != NO_ERROR
		Debug-Output "FddiLink: FindService ERROR="$($R0)
		Goto fatalRegistry
	EndIf
	Set KeyParameters = $($R2)
	CloseRegKey $($R1)
	IfStr $(KeyParameters) == $(KeyNull)
		Set RegistryErrorIndex = CANNOT_FIND_COMPONENT_SERVICE
		Debug-Output "FddiLink: 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) == "IOAddr"
			Set IOAddrValue = $(ValueData)
		EndIf
	EndForListDo
adapterSetup = +
	Debug-Output "FddiLink: adapterSetup"
;	IfInt $(BoardType) == 3
;		Goto skipOptions
;	EndIf
	Shell "" DebugConfiguration "Before Dialog"
	Set from = adapterOptions
	Set IOAddrHexValue = *($(IOAddrHexList), ~($(IOAddrList),$(IOAddrValue)))
	Shell $(ParamInf) Param_ParameterConfidence
	IfStr(i) $($R0) != STATUS_SUCCESSFUL
		Debug-Output "FddiLink: Parameter confidence too low to bypass configuration"
		Goto adapterOptions
	EndIf
	IfStr(i) $(DetectedCard) == TRUE
		IfStr(i) $(!STF_INSTALL_MODE) != CUSTOM
			Goto adapterVerify
		EndIf
	EndIf
adapterOptions = +
	Debug-Output "FddiLink: adapterOptions"
	Set from = adapterOptions
	Read-Syms FileDependentDlg$(!STF_LANGUAGE)
	UI Start "InputDlg"
	IfStr(i) $(DLGEVENT) == "CONTINUE"
		Set IOAddrHexValue = $(Combo1Out)
		Set IOAddrValue = *($(IOAddrList), ~($(IOAddrHexList),$(IOAddrHexValue)))
		UI Pop 1
	Else-IfStr(i) $(DLGEVENT) == "BACK"
		Set CommonStatus = STATUS_USERCANCEL
		Debug-Output "FddiLink: Action CANCEL"
		UI Pop 1
		Goto end
	Else
		UI Pop 1
		Debug-Output "FddiLink: Action UNKNOWN"
		Goto end
	EndIf
adapterVerify = +
	Shell "" DebugConfiguration "After Dialog"
	IfStr(i) $(DetectedCard) != TRUE
		Goto skipOptions
	EndIf
	Debug-Output "FddiLink: Calling Param_VerifyCard"
	Shell $(ParamInf) Param_VerifyCard $(!STF_NCDETCARD)
	IfStr(i) $($R0) == STATUS_SUCCESSFUL
		Debug-Output "FddiLink: Param_VerifyCard succeeded"
		Goto skipOptions
	EndIf
	Set from = adapterOptions
	Set to = skipOptions
	Shell $(UtilityInf),RegistryErrorString,VERIFY_WARNING
	IfInt $($ShellCode) != $(!SHELL_CODE_OK)
		Debug-Output "FddiLink: Cannot run RegistryErrorString"
		Goto ShellCodeError
	EndIf
	Set Error = $($R0)
	Goto Warning
skipOptions = +
	Debug-Output "FddiLink: skipOptions"
	IfInt $(OldVersionExisted) == $(TRUE)
		IfStr(i) $(!NTN_InstallMode) == configure
			Goto writeParameters
		EndIf
	EndIf
	StartWait
	IfInt $(OldVersionExisted) == $(FALSE)
		IfStr(i) $(!NTN_InstallMode) == "install"
			IfStr(i) $(DoCopy) == "YES"
				Shell $(UtilityInf), DoAskSource, $(!STF_CWDDIR), $(SrcDir) YES
				IfInt $($ShellCode) != $(!SHELL_CODE_OK)
					Goto ShellCodeError
				Else-IfStr(i) $($R0) == STATUS_FAILED
					Shell $(UtilityInf) RegistryErrorString "ASK_SOURCE_FAIL"
					IfInt $($ShellCode) != $(!SHELL_CODE_OK)
						Goto ShellCodeError
					EndIf
					Set Error = $($R0)
					Goto fatal
				Else-IfStr(i) $($R0) == STATUS_USERCANCEL
					Goto successful
				EndIf
				Set SrcDir = $($R1)
			EndIf
			install "Install-Option"
			IfStr(i) $(STF_INSTALL_OUTCOME) != STF_SUCCESS
				Shell $(UtilityInf) RegistryErrorString "UNABLE_COPY_FILE"
				IfInt $($ShellCode) != $(!SHELL_CODE_OK)
					Goto ShellCodeError
				EndIf
				Set Error = $($R0)
				Goto fatal
			EndIf
		EndIf
		Shell $(UtilityInf), AddSoftwareComponent, $(Manufacturer), +
			$(ProductSoftwareName), +
			$(ProductSoftwareName), +
			$(ProductSoftwareTitle), $(STF_CONTEXTINFNAME), +
			$(ProductSoftwarePath), "kernel", "NDIS", {}, "",+
			$(NetEventDLL)
		Set OEM_ABANDON_SOFTWARE = TRUE
		IfInt $($ShellCode) != $(!SHELL_CODE_OK)
			Debug-Output "FddiLink: Cannot run AddSoftwareComponent"
			Goto ShellCodeError
		EndIf
		Set RegistryErrorIndex = $($R0)
		IfStr(i) $(RegistryErrorIndex) != NO_ERROR
			EndWait
			Debug-Output "FddiLink: AddSoftwareComponent ERROR="$(RegistryErrorIndex)
			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 "FddiLink: Cannot run AddValueList: SoftProductKey"
			Goto ShellCodeError
		EndIf
		Set RegistryErrorIndex = $($R0)
		IfStr(i) $(RegistryErrorIndex) != NO_ERROR
			EndWait
			Debug-Output "FddiLink: AddValueList ERROR="$(RegistryErrorIndex)
			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 "FddiLink: Cannot run AddValueList: SoftNetRuleKey"
			Goto ShellCodeError
		EndIf
		Set RegistryErrorIndex = $($R0)
		CloseRegKey $(SoftProductKey)
		CloseRegKey $(SoftNetRuleKey)
		CloseRegKey $(SoftServiceKey)
		CloseRegKey $(SoftParameterKey)
		CloseRegKey $(SoftLinkageKey)
		IfStr(i) $(RegistryErrorIndex) != NO_ERROR
			EndWait
			Debug-Output "FddiLink: AddValueList ERROR="$(RegistryErrorIndex)
			Goto fatalRegistry
		EndIf
	EndIf
doEachAdapter = +
	IfInt $(BoardType) == 3
		ForListDo $(AdapterList)
			Set BusNum = *($($),1)
			Set SlotNum = *($($),2)
			Debug-Output "FddiLink: doEachAdapter - BusNum="$(BusNum)" SlotNum="$(SlotNum)
			Shell $(UtilityInf), IsNetCardAlreadyInstalled, $(BusNum), +
    			$(SlotNum), $(ProductHardwareDescription), $(ProductHardwareName)
			IfInt $($ShellCode) != $(!SHELL_CODE_OK)
				Debug-Output "FddiLink: Cannot run IsNetCardAlreadyInstalled"
    			Goto ShellCodeError
			EndIf
			IfStr $($R0) != "NO_ERROR"
				Debug-Output "FddiLink: IsNetCardAlreadyInstalled ERROR="$($R0)
    			Set Error = $($R0)
    			Goto fatal
			EndIf
			IfStr(i) $($R1) != "YES"
				Debug-Output "FddiLink: Calling doOneAdapter."
				goto doOneAdapter
doNextAdapter = +
				Debug-Output "FddiLink: Return from doOneAdapter."
			EndIf
		EndForListDo
		Goto successful
	EndIf
doOneAdapter = +
	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 "FddiLink:Cannot run AddHardwareComponent"
		Goto ShellCodeError
	EndIf
	Set RegistryErrorIndex = $($R0)
	IfStr(i) $(RegistryErrorIndex) != NO_ERROR
		EndWait
		Debug-Output "FddiLink: AddHardwareComponent ERROR="$($R0)
		CloseRegKey $($R1)
		CloseRegKey $($R2)
		CloseRegKey $($R3)
		Goto fatalRegistry
	EndIf
	Set HardNetCardKey	= $($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, $(HardNetCardKey), $(NewValueList)
	IfInt $($ShellCode) != $(!SHELL_CODE_OK)
		Debug-Output "FddiLink: Cannot run AddValueList: HardNetCardKey"
		Goto ShellCodeError
	EndIf
	Shell $(UtilityInf), GetBusTypeNum
	Set BusTypeNum = $($R1)
	IfInt $($ShellCode) != $(!SHELL_CODE_OK)
		Debug-Output "FddiLink: Cannot run GetBusTypeNum"
		Goto ShellCodeError
	EndIf
	Set TempProdName = """"$(ProductHardwareName)$(AdapterNumber)""""
	Set TempBindForm = $(TempProdName)$(NetRuleHardwareBindForm)
	Set NewValueList = {{type,$(NoTitle),$(!REG_VT_SZ),$(NetRuleHardwareType)},+
						{bindform,$(NoTitle),$(!REG_VT_SZ),$(TempBindForm)}, +
						{class,$(NoTitle),$(!REG_VT_MULTI_SZ),$(NetRuleHardwareClass)}, +
						{InfOption,$(NoTitle),$(!REG_VT_SZ),$(Option)}}
	Shell  $(UtilityInf), AddValueList, $(KeyAdapterRules), $(NewValueList)
	IfInt $($ShellCode) != $(!SHELL_CODE_OK)
		Debug-Output "FddiLink: Cannot run AddValueList: KeyAdapterRules"
		Goto ShellCodeError
	EndIf
	Set RegistryErrorIndex = $($R0)
	IfStr(i) $(RegistryErrorIndex) != NO_ERROR
		EndWait
		Debug-Output "FddiLink: AddValueList: KeyAdapterRules ERROR="$(RegistryErrorIndex)
		CloseRegKey $(KeyParameters)
		CloseRegKey $(KeyAdapterRules)
		Goto fatalRegistry
	EndIf
	CloseRegKey $(HardNetCardKey)
	CloseRegKey $(KeyAdapterRules)
	Goto writeParameters
writeParameters = +
	IfInt $(BoardType) == 1
; EISA
		Set NewValueList = {{BusType,$(NoTitle),$(!REG_VT_DWORD),2},+
                       {BusNumber,$(NoTitle),$(!REG_VT_DWORD),$(BusNum)},+
               	       {MediaType,$(NoTitle),$(!REG_VT_DWORD),1},+
		       {SlotNumber,$(NoTitle),$(!REG_VT_DWORD),$(IOAddrValue)},+
                       {DebugFlags,$(NoTitle),$(!REG_VT_DWORD),34820},+
                       {RcvBuffSize,$(NoTitle),$(!REG_VT_DWORD),1024},+
                       {NumRcvDesc,$(NoTitle),$(!REG_VT_DWORD),128},+
                       {NumXmitDesc,$(NoTitle),$(!REG_VT_DWORD),128},+
                       {NumXmitFsiDesc,$(NoTitle),$(!REG_VT_DWORD),1024},+
                       {RxIndicateLimit,$(NoTitle),$(!REG_VT_DWORD),10},+
                       {TxCompleteLimit,$(NoTitle),$(!REG_VT_DWORD),10},+
                       {InterruptsSerialized,$(NoTitle),$(!REG_VT_DWORD),1},+
                       {treq,$(NoTitle),$(!REG_VT_DWORD),4000},+
                       {tmax,$(NoTitle),$(!REG_VT_DWORD),165000},+
                       {tvx,$(NoTitle),$(!REG_VT_DWORD),2500},+
                       {mode,$(NoTitle),$(!REG_VT_DWORD),0}}
	EndIf
	Shell  $(UtilityInf), AddValueList, $(KeyParameters), $(NewValueList)\
	CloseRegKey $(KeyParameters)
	IfInt $($ShellCode) != $(!SHELL_CODE_OK)
		Debug-Output "FddiLink: Cannot run AddValueList: KeyParameters"
		Goto ShellCodeError
	EndIf
	Set RegistryErrorIndex = $($R0)
	IfStr(i) $(RegistryErrorIndex) != NO_ERROR
		Debug-Output "FddiLink: AddValueList: KeyParameters ERROR="$(RegistryErrorIndex)
		Goto fatalRegistry
	EndIf
	EndWait
	IfInt $(BoardType) == 3
		Goto doNextAdapter
	EndIf
	Goto successful
BindingAdapter =+
	Set Error =  "FddiLink: Setup does not support binding."
	Debug-Output $(Error)
	Goto fatal
RemoveAdapter = +
	Debug-Output "FddiLink: RemoveAdapter"
	IfStr(i) $(ProductKeyName) == $(!NTN_RegBase)
		Debug-Output "FddiLink: Calling RemoveSoftwareComponent"
		Shell $(UtilityInf), RemoveSoftwareComponent, $(Manufacturer), +
			$(ProductSoftwareName)
		IfInt $($ShellCode) != $(!SHELL_CODE_OK)
			Debug-Output "FddiLink: Cannot run RemoveSoftwareComponent"
			Goto ShellCodeError
		EndIf
		Set RegistryErrorIndex = $($R0)
		IfStr(i) $(RegistryErrorIndex) != NO_ERROR
			Debug-Output "FddiLink: RemoveSoftwareComponent ERROR="$($R0)
			Goto fatalRegistry
		EndIf
	Else
		Debug-Output "FddiLink: Calling RemoveHardwareComponent"
		Shell $(UtilityInf), RemoveHardwareComponent, $(Manufacturer), +
			$(ProductHardwareName), $(!NTN_RegBase)
		IfInt $($ShellCode) != $(!SHELL_CODE_OK)
			Debug-Output "FddiLink: Cannot run RemoveHardwareComponent"
			Goto ShellCodeError
		EndIf
		Set RegistryErrorIndex = $($R0)
		IfStr(i) $(RegistryErrorIndex) != NO_ERROR
			Debug-Output "FddiLink: RemoveHardwareComponent ERROR="$($R0)
			Goto fatalRegistry
		EndIf
	EndIf
	Goto end
UpgradeSoftware = +
	Debug-Output "FddiLink: 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 "FddiLink: Cannot run GetInfFileNameFromRegistry"
				Goto ShellCodeError
			EndIf
			Set !UG_Filename = $($R0)
			IfStr(i) $(!UG_Filename) != ""
				install "Install-Update"
				IfStr(i) $(STF_INSTALL_OUTCOME) != STF_SUCCESS
					Debug-Output "FddiLink: Install ERROR="$(STF_INSTALL_OUTCOME)
					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
			Debug-Output "FddiLink: KeyProduct ERROR="$(KeyProduct)
			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
				Debug-Output "FddiLink: NetKeyRule ERROR="$(NetKeyRule)
				Goto fatalRegistry
			EndIf
			CloseRegKey $(NetRules)
			CloseRegKey $(NetworkCardKey)
		Else
			Debug-Output "FddiLink: NetworkCardKey ERROR="$(NetworkCardKey)
			Goto fatalRegistry
		EndIf
		OpenRegKey $(!REG_H_LOCAL) "" +
				$(!NTN_ServiceBase)"\"$(ServiceName) +
				$(MAXIMUM_ALLOWED) ServiceKey
		IfStr(i) $(ServiceKey) != $(KeyNull)
			CloseRegKey $(ServiceKey)
		Else
			Debug-Output "FddiLink: ServiceKey ERROR="$(ServiceKey)
			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 "FddiLink: Cannot run RemoveHardwareComponent"
			Goto ShellCodeError
		EndIf
		Set RegistryErrorIndex = $($R0)
		IfStr(i) $(RegistryErrorIndex) != NO_ERROR
			Debug-Output "FddiLink: RemoveHardwareComponent ERROR="$(RegistryErrorIndex)
			Goto fatalRegistry
		EndIf
	EndForListDo
	IfStr(i) $(OEM_ABANDON_SOFTWARE) == TRUE
		Shell $(UtilityInf), RemoveSoftwareComponent, $(Manufacturer), +
			$(ProductSoftwareName), FALSE
		IfInt $($ShellCode) != $(!SHELL_CODE_OK)
			Debug-Output "FddiLink: Cannot run RemoveSoftwareComponent"
			Goto ShellCodeError
		EndIf
		Set RegistryErrorIndex = $($R0)
		IfStr(i) $(RegistryErrorIndex) != NO_ERROR
			Debug-Output "FddiLink: RemoveSoftwareComponent ERROR="$(RegistryErrorIndex)
			Goto fatalRegistry
		EndIf
	EndIf
	Goto end
warning = +
	Shell $(SubRoutineInf) SetupMessage, $(!STF_LANGUAGE), "WARNING", $(Error)
	IfInt $($ShellCode) != $(!SHELL_CODE_OK)
		Debug-Output "FddiLink: Cannot run SetupMessage"
		Goto ShellCodeError
	EndIf
	IfStr(i) $($R1) == "OK"
		Debug-Output "FddiLink: WARNING goto "$(to)
		Goto $(to)
	Else-IfStr(i) $($R1) == "CANCEL"
		Debug-Output "FddiLink: WARNING goto "$(from)
		Goto $(from)
	Else
		Debug-Output "FddiLink: WARNING goto end"
		Goto end
	EndIf
nonFatalInfo = +
	Set CommonStatus = STATUS_USERCANCEL
	Set Severity = STATUS
	Goto nonFatalMsg
nonFatal = +
	Set Severity = nonFatal
	Goto nonFatalMsg
nonFatalMsg = +
	IfStr(i) $(Error) == ""
		Set Severity = nonFatal
		Shell $(UtilityInf) RegistryErrorString "SETUP_FAIL"
		IfInt $($ShellCode) != $(!SHELL_CODE_OK)
			Debug-Output "FddiLink: Cannot run RegistryErrorString"
			Goto ShellCodeError
		EndIf
		Set Error = $($R0)
	EndIf
	Shell $(SubRoutineInf) SetupMessage, $(!STF_LANGUAGE), $(Severity), $(Error)
	IfInt $($ShellCode) != $(!SHELL_CODE_OK)
		Debug-Output "FddiLink: Cannot run SetupMessage"
		Goto ShellCodeError
	EndIf
	IfStr(i) $($R1) == "OK"
		Debug-Output "FddiLink: NONFATAL goto "$(from)
		Goto $(from)
	Else
		Debug-Output "FddiLink: NONFATAL goto end"
		Goto end
	EndIf
fatalRegistry = +
	Shell $(UtilityInf) RegistryErrorString $(RegistryErrorIndex)
	IfInt $($ShellCode) != $(!SHELL_CODE_OK)
		Debug-Output "FddiLink: Cannot run RegistryErrorString"
		Goto ShellCodeError
	EndIf
	Set Error = $($R0)
	Goto fatal
fatalDetect = +
	Shell $(UtilityInf),RegistryErrorString,CANNOT_DETECT
	IfInt $($ShellCode) != $(!SHELL_CODE_OK)
		Debug-Output "FddiLink: Cannot run RegistryErrorString"
		Goto ShellCodeError
	EndIf
	Set Error = $($R0)
	Goto fatal
fatal = +
	IfStr(i) $(Error) == ""
		Shell $(UtilityInf) RegistryErrorString "SETUP_FAIL"
		IfInt $($ShellCode) != $(!SHELL_CODE_OK)
			Debug-Output "FddiLink: Cannot run RegistryErrorString"
			Goto ShellCodeError
		EndIf
		Set Error = $($R0)
	EndIf
	Shell $(SubRoutineInf) SetupMessage, $(!STF_LANGUAGE), "FATAL", $(Error)
	IfInt $($ShellCode) != $(!SHELL_CODE_OK)
		Debug-Output "FddiLink: Cannot run SetupMessage"
		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 = +
	Set !DebugOutputControl	= 0
	Return $(CommonStatus)

[DebugConfiguration]
	Debug-Output "FddiLink: CONFIGURATION:     "$($0)
	Debug-Output "FddiLink: IOAddrValue        "$(!p:IOAddrValue)
	Return

[Install-Option]
	Set STF_VITAL = ""
	IfStr(i) $(AddCopy) == "YES"
		AddSectionFilesToCopyList Files-$(Option) $(SrcDir) $(!STF_WINDOWSSYSPATH)\drivers
	EndIf
	IfStr(i) $(DoCopy) == "YES"
		Set !STF_NCPA_FLUSH_COPYLIST = TRUE
		CopyFilesInCopyList
	EndIf
	IfStr(i) $(DoConfig) == "YES"
	EndIf
	Exit

[Install-Update]
	Set STF_VITAL        = ""
	Set STF_OVERWRITE    = "VERIFYSOURCEOLDER"
	AddSectionFilesToCopyList Files-$(Option) $(SrcDir) $(!STF_WINDOWSSYSPATH)\drivers
	AddSectionFilesToCopyList Files-Inf $(SrcDir) $(!STF_WINDOWSSYSPATH)
	Set !STF_NCPA_FLUSH_COPYLIST = TRUE
	CopyFilesInCopyList
	exit

[Source Media Descriptions]
	1 = "FddiLink Setup Disk"

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

[Files-FDDILINK_EISA_1]
	1, flnk1.sys , SIZE=65536

[ProductType]
	STF_PRODUCT					= winNT
	STF_PLATFORM				= i386

[Options]
	FDDILINK_EISA_1

[LanguagesSupported]
	ENG

[OptionsTextENG]
	FDDILINK_EISA_1					= "3COM FDDI 3C770 EISA Bus Adapter 1"

[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   			= "FddiLink Adapter 1 Setup"
	ProductSoftwareDescription  = "FddiLink Adapter 1 Driver"
	ProductHardwareDescription  = "FddiLink "$(Option)

[DialogConstantsENG]
	Help        				= "&Help"
	Exit        				= "Cancel"
	OK          				= "OK"
	HelpContext 				= ""
	Continue    				= "Continue"
	Cancel      				= "Cancel"

[FileDependentDlgENG]
	DlgTemplate 				= "SINGLE_COMBO"
	DlgType 					= "RadioCombination"
	Caption 					= $(FunctionTitle)
;	Combo1Label 				= "I/O &Port Address:"
	Label1 						= $(Combo1Label)
	Combo1List 					= $(IOAddrHexList)
	Combo1Out  					= $(IOAddrHexValue)
	ComboListItemsIn  			= {Combo1List}
	ComboListItemsOut 			= {Combo1Out}
	EditTextIn 					= ""
	EditTextLim 				= ""
	CBOptionsGreyed 			= {}
	NotifyFields				= {NO, NO, NO, NO}
	HelpContext					= $(!IDH_DB_OEMSETUP_INS)
