OEMSETNT.INF Driver File Contents (isihp30_108.exe)

;***********************************************************************
; Multi-Tech Systems WAN WindowsNT Setup File.
; Version 0.9.0.0 January 18, 2000
;***********************************************************************
[Identification]
	OptionType = NetAdapter

[DebugVars]
	STF_DISPLAYDEBUGCONTROL = 0

;***********************************************************************
; c:\p\nt\pri\deliverables\test
;***********************************************************************
[PlatformsSupported]
	PCI

;***********************************************************************
;
;***********************************************************************
[Options]
	MTSWAN

;***********************************************************************
;
;***********************************************************************
[FileConstants]
	InfName						= "MTSWAN.INF"
	UtilityInf					= "UTILITY.INF"
;	UtilityInf					= $(SrcDir)"FakeUTIL.INF"
	ParamInf						= "NCPARAM.INF"
	subroutineinf				= "SUBROUTN.INF"
	SoftwareType				= "driver"
	Exit_Code					= 0
	NetEventDLL					= "%SystemRoot%\System32\netevent.dll"
	IoLogMsgDLL					= "%SystemRoot%\System32\IoLogMsg.dll"
	Manufacturer				= "Multi-Tech Systems"
	ProductMajorVersion		= "4"
	ProductMinorVersion		= "0"
	ProductVersion				= $(ProductMajorVersion)"."$(ProductMinorVersion)
	ProductSoftwareName		= "MTSWAN"
	ProductSoftwareImagePath = "\SystemRoot\System32\drivers\MTSWAN.sys"
	NetRuleSoftwareType		= "MTSWANSys MTSWANDriver"
	NetRuleSoftwareUse		= $(SoftwareType)
	NetRuleSoftwareBindForm = """MTSWANSys"" yes no container"
	NetRuleSoftwareClass		= {"MTSWANDriver basic"}
	NetRuleSoftwareBindable = {"MTSWANDriver MTSWANAdapter non exclusive 100"}
	ProductHardwareName		= "MTSWAN"
	NetRuleHardwareBindForm = " yes yes container"
	NetRuleHardwareType 		= "MTSWAN MTSWANAdapter"
	NetRuleHardwareClass 	= {"MTSWANAdapter basic"}
	BindableTxt					= {"MTSWANDriver MTSWANAdapter non exclusive 100"}
	DeviceMap					= "HARDWARE\DEVICEMAP"
	TapiDevices					= "TAPI DEVICES"
	TapiDeviceKey				= $(ProductHardwareName)
	TapiMediaType				= "ISDN"
	ProductKeyName				= $(!NTN_SoftwareBase)"\"$(Manufacturer)"\"+
										$(ProductSoftwareName)"\CurrentVersion"
	ParamKeyName				= $(!NTN_ServiceBase)"\"$(ProductHardwareName)+
										"\Parameters"
	MySetupPath					= $(!STF_WINDOWSSYSPATH)"\hpsetup.dll"										
	HpSetupDisk					= $(MySetupPath)

;***********************************************************************
;
;***********************************************************************
[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 SetOptions
		EndIf
		Set PlatformList = ^(PlatformsSupported, 1)
		IfContains(i) $($1) in $(PlatformList)
			GoTo SetOptions
		Else
			Set Status = STATUS_NOTSUPPORTED
			GoTo ExitReturnOptions
		EndIf
	Else
		Set Status = STATUS_NOLANGUAGE
		GoTo ExitReturnOptions
	EndIf

SetOptions = +
	Set OptionList	= ^(Options, 1)
	Set OptionTextList = ^(OptionsText$($0), 1)
	Set Status			= STATUS_SUCCESSFUL

ExitReturnOptions = +
	Return $(Status) $(OptionList) $(OptionTextList)

;***********************************************************************
;
;***********************************************************************
; 		Add a device options 
;	Set Option	= $($1)	MTSWAN
;	Set SrcDir	= $($2)  inf source directory
;	Set RasDir	= $($2)
;	Set AddCopy  = $($3)	YES
;	Set DoCopy	= $($4)	YES
;	Set DoConfig = $($5)  YES
;	Set LanguageList = ^(LanguagesSupported, 1)



[InstallOption]
	Debug-Output "InstallOption"
	Set Status	= STATUS_FAILED
	Set Option	= $($1)
	Set SrcDir	= $($2)
	Set RasDir	= $($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 - make sure this flag is disabled before shipping
	;
	Set OldDebugControl = $(!DebugOutputControl)
	; Set !DebugOutputControl = 1

	Debug-Output "Start of InstallOption."
	Debug-Output "Option  $(Option) SrcDir $(SrcDir)" 
	Debug-Output "AddCopy = $(AddCopy)"
	Debug-Output "DoCopy = $(DoCopy) DoConfig = $(DoConfig)"

	;Shell "" DebugConfiguration "after running dialog"

	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 = +

	Debug-Output "Start of OEMSETUP (Begin) "$(!NTN_InstallMode)
	Debug-Output "ProductKey="$(ProductKeyName)
	Debug-Output "Base="$(!NTN_RegBase)
	Debug-Output "SoftwareBase="$(!NTN_SoftwareBase)
	Debug-Output "ServiceBase="$(!NTN_ServiceBase)
	Debug-Output "NTN_Origination="$(!NTN_Origination)
	
	Debug-Output "ParamKey="$(ParamKeyName)

	;Shell "" TestHere "Begin MySetupPath "$(MySetupPath)

	Set ActivateDetection = FALSE

	IfStr(i) $(!NTN_InstallMode) == deinstall
		Set StartLabel = RemoveAdapter
	Else-IfStr(i) $(!NTN_InstallMode) == Update
		Set StartLabel = UpgradeSoftware
		; I don't know what to set it to? Update wants (C:\i386\oemsetup.inf NOT oemsetnt.inf)
	Else-IfStr(i) $(!NTN_InstallMode) == bind
		Set StartLabel = BindingAdapter
	Else-IfStr(i) $(!NTN_InstallMode) == configure
		Set StartLabel = ConfigureAdapter

		Set ActivateDetection = TRUE
		Set CommonStatus = STATUS_REBOOT
		IfStr(i) $(ProductKeyName) == $(!NTN_RegBase)
			Debug-Output $(InfName)": Cannot configure the EtherWORKS 3 driver software."
			Shell $(UtilityInf) RegistryErrorString CANNOT_CONFIGURE_SOFTWARE
			IfInt $($ShellCode) != $(!SHELL_CODE_OK)
				Debug-Output $(InfName)": ShellCode error: cannot get an error string."
				GoTo ShellCodeError
			EndIf
			Set Error = $($R0)
			Set from = end
			Set to = end
			GoTo NonFatalInfo
		EndIf
	Else
		Debug-Output "Assume Install "$(!NTN_InstallMode)
		Set HpSetupDisk = $(SrcDir)"hpsetup.dll"	
		Set StartLabel = InstallAdapter
		Set ActivateDetection = TRUE
		Set OEM_ABANDON_OPTIONS = {}
		Set OEM_ABANDON_SOFTWARE = FALSE
		Set OEM_ABANDON_ON = TRUE
	EndIf

	Debug-Output $(InfName)": =================================================="
	Debug-Output $(InfName)": STF_CWDIR is: "$(!STF_CWDIR)
	Debug-Output $(InfName)": STF_LANGUAGE is: "$(!STF_LANGUAGE)
	Debug-Output $(InfName)": Option is: "$(Option)
	Debug-Output $(InfName)": !STF_NCDETECT  is: "$(!STF_NCDETECT)
	Debug-Output $(InfName)": !STF_NCOPTION  is: "$(!STF_NCOPTION)
	Debug-Output $(InfName)": !STF_NCDETCARD is: "$(!STF_NCDETCARD)
	Debug-Output $(InfName)": !STF_NCDETINFO is: "$(!STF_NCDETINFO)
	Debug-Output $(InfName)": =================================================="


	Set DetectedCard = FALSE

	IfStr(i) $(ActivateDetection) != TRUE
		GoTo $(StartLabel)
	EndIf
	
	IfStr(i) $(!STF_NCDETECT) == YES
		IfStr(i) $(!STF_NCOPTION) == $(Option)
			Set DetectedCard = TRUE
			Debug-Output $(InfName)": Setting DetectedCard to TRUE"
		EndIf
	EndIf

; (THD) 12.9.
;	Shell "" DebugConfiguration "After parameter querying"

	Set from = FatalError
	Set to = FatalError
	GoTo $(StartLabel)

;***********************************************************************
;
;***********************************************************************
InstallAdapter = +
	Debug-Output "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 $(InfName)": ShellCode error: cannot get an error string."
				GoTo ShellCodeError
			EndIf
			GoTo end
		Else
			Shell $(UtilityInf), CardExistedDlg
			IfInt $($ShellCode) != $(!SHELL_CODE_OK)
				Debug-Output $(InfName)": ShellCode error: cannot get an error string."
				GoTo ShellCodeError
			EndIf

			IfStr(i) $($R1) != "OK"
				Set CommonStatus = STATUS_USERCANCEL
				GoTo end
			EndIf
			Set OldVersionExisted = $(TRUE)
		EndIf
	EndIf

	Set CurrParamSettings = {}
	IfStr(i) $(DetectedCard) != TRUE
		GoTo AdapterSetup
	EndIf

	Debug-Output $(InfName)": Calling Param_QueryCard "$(!STF_NCDETCARD)
	StartWait
		Shell $(ParamInf) Param_QueryCard $(!STF_NCDETCARD)
	EndWait

	IfStr(i) $($R0) != STATUS_SUCCESSFUL
		GoTo AdapterSetup
	EndIf

	Set DetectedParams = $($R1)
	Debug-Output $(InfName)": Calling Param_SetDefaults to merge detected params "$(DetectedParams)

	Shell $(ParamInf) Param_SetDefaults $(DetectedParams)
	GoTo AdapterSetup

;***********************************************************************
;
;***********************************************************************
ConfigureAdapter = +
	Debug-Output "ConfigureAdapter"

	IfStr $(KeyProduct) == $(KeyNull)
		OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_RegBase) $(MAXIMUM_ALLOWED) KeyProduct
		IfStr $(KeyProduct) == $(KeyNull)
			Set RegistryErrorIndex = CANNOT_FIND_COMPONENT_SERVICE
			Debug-Output $(InfName)": Cannot find component product key"
			GoTo FatalRegistry
		EndIf
	EndIf

	Debug-Output $(InfName)": Shelling to FindService"

	Shell $(UtilityInf) FindService, $(KeyProduct)
	IfInt $($ShellCode) != $(!SHELL_CODE_OK)
		Debug-Output $(InfName)": FindService shell failure"
		GoTo ShellCodeError
	EndIf
	IfStr(i) $($R0) != NO_ERROR
		Debug-Output $(InfName)": FindService Shell error: "$($R0)
		GoTo FatalRegistry
	EndIf

	Debug-Output "$R0"$($R0)
	Debug-Output "$R1Registry key handle Service area"$($R1)
	Debug-Output "$R1Registry key handleParameters subkey"$($R2)

	GetRegValue $(KeyProduct),"ServiceName", ServiceNameInfo
	Set ServiceName = *($(ServiceNameInfo), 4)
	Debug-Output "	ServiceName"$(ServiceName)
	Debug-Output "	ServiceNameInfo"$(ServiceNameInfo)
	Debug-Output "	$(KeyProduct) = "$(KeyProduct)

	Set KeyParameters = $($R2)
	Debug-Output "	$(KeyParameters) = "$(KeyParameters)
	CloseRegKey $($R1)

	IfStr $(KeyParameters) == $(KeyNull)
		Set RegistryErrorIndex = CANNOT_FIND_COMPONENT_SERVICE
		Debug-Output $(InfName)": 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)
		Debug-Output $(InfName)": "$(ValueName)"="$(ValueData)
		; (THD)
		IfStr(i) $(ValueName) == "BusNumber"
			set BusNumber = $(ValueData)
		Else-IfStr(i) $(ValueName) == "BusType"
			set BusType = $(ValueData)
		Else-IfStr(i) $(ValueName) == "AddressList"
			set TapiAddressList = $(ValueData)
		EndIf
	EndForListDo

	Shell $(ParamInf) Param_SaveValues
	Set CurrParamSettings = $($R0)

;***********************************************************************
;
;***********************************************************************
AdapterSetup = +
; (THD) 12.9.
;	Shell "" DebugConfiguration "before displaying dialog"
	Set from = AdapterOptions

	Debug-Output "AdapterSetup"
	
	Shell $(ParamInf) Param_ParameterConfidence
	IfStr(i) $($R0) != STATUS_SUCCESSFUL
		Debug-Output $(InfName)": parameter confidence too low to bypass configuration"
		GoTo AdapterOptions
	EndIf
	IfStr(i) $(DetectedCard) == TRUE
		IfStr(i) $(!STF_INSTALL_MODE) != CUSTOM
			GoTo AdapterVerify
		EndIf
	EndIf

	; Fall into AdapterOptions
	
;***********************************************************************
;
;***********************************************************************
AdapterOptions = +

	Debug-Output "AdapterOptions"

	IfStr(i) $(!STF_NCDETINFO) == {}
	;
	;	D.S. June 30,1998	
	;	A ? seems to put up PCI in the bus type selection

		Set BusType = "5"

;		Shell $(UtilityInf),GetBusTypeDialog,$(Manufacturer) "?" $(BusNumber)
;		Debug-Output "return "$($R0)"BusType "$($R1)"BusNumber"$($R3)

;		ifInt $($ShellCode) != $(!SHELL_CODE_OK)
;			Debug-Output $(InfName)": ShellCode error."
;			GoTo ShellCodeError
;		EndIf
;
;		Set BusType = $($R1)
;		Set BusNumber = $($R2)

;		Shell "" TestHere "GetBusNumber "$(BusType)$(BusNumber)

;     Execute hpsetup.dll from the disk, because it hasn't been copied to the Drive yet!

;		LoadLibrary "Setup Disk 1" D:\p\nt\pri\mysetup\debug\hpsetup.dll hMySetup
		LoadLibrary "Setup Disk 1" $(HpSetupDisk) hMySetup
		Debug-Output $(SrcDir)

		; Set FLibraryErrCtl = 1 If there is an error it is put in the result string
		; Set FLibraryErrCtl = 0 If there is an error Windows puts up a dialog with the error 
		;								 and "ERROR" is returned.	
	   Set FLibraryErrCtl = 1
		LibraryProcedure Result, $(hMySetup), GetBusNumber, $(ServiceName), $(!STF_HWND), $(BusNumber)
		Set FLibraryErrCtl = 0

		Set BusNumber = $(Result)
;		Shell "" TestHere "GetBusNumber Result"$(Result)
	Else
		Set BusType = *($(!STF_NCDETINFO),5)
		Set BusNumber = *($(!STF_NCDETINFO),6)
	EndIf

;	Shell "" TestHere "AdapterOptions "$(BusType)$(BusNumber)

;***********************************************************************
;
;***********************************************************************
AdapterVerify = +
; (THD) 12.9.
;	Shell "" DebugConfiguration "after running dialog"
	Debug-Output "AdapterVerify"

	IfStr(i) $(DetectedCard) != TRUE
	Shell $(ParamInf) Param_SaveValues
	Set NewParamSettings = $($R0)
	IfStr(i) $(CurrParamSettings) == {}
		Set DiffParamSettings = $(NewParamSettings)
	Else
		Shell $(ParamInf) Param_DiffValues $(CurrParamSettings)
		Set DiffParamSettings = $($R0)
	EndIf
	Debug-Output $(InfName)": Calling Param_VerifyResources"
	Shell $(ParamInf) Param_VerifyResources $(DiffParamSettings)
	IfStr(i) $($R0) == STATUS_SUCCESSFUL
		Debug-Output $(InfName)": Param_VerifyResources succeeded"
		GoTo SkipOptions
	EndIf
	Else
	Set CardVerifyIndex = $(!STF_NCDETCARD)
	Debug-Output $(InfName)": Calling Param_VerifyCard"
	Shell $(ParamInf) Param_VerifyCard $(!STF_NCDETCARD)
	IfStr(i) $($R0) == STATUS_SUCCESSFUL
		Debug-Output $(InfName)": Param_VerifyCard succeeded"
		GoTo SkipOptions
	EndIf
	EndIf

	Set from = AdapterOptions
	Set to = SkipOptions
	Shell $(UtilityInf) RegistryErrorString VERIFY_WARNING
	IfInt $($ShellCode) != $(!SHELL_CODE_OK)
	Debug-Output $(InfName)": ShellCode error: cannot get an error string."
	GoTo ShellCodeError
	EndIf
	Set Error = $($R0)
	GoTo WarningMsg

;***********************************************************************
;
;***********************************************************************
SkipOptions =+
	Debug-Output "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 FatalError
			Else-IfStr(i) $($R0) == STATUS_USERCANCEL
		GoTo SuccessfulOption
			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 FatalError
		EndIf
	EndIf

	Shell $(UtilityInf), AddSoftwareComponent, $(Manufacturer), +
		$(ProductSoftwareName), +
		$(ProductSoftwareName), +
		$(ProductSoftwareTitle), $(STF_CONTEXTINFNAME), +
		$(ProductSoftwareImagePath), "kernelautostart", "NDIS", {}, "",+
		$(NetEventDLL)
	Set OEM_ABANDON_SOFTWARE = TRUE
	IfInt $($ShellCode) != $(!SHELL_CODE_OK)
		Debug-Output $(InfName)": ShellCode error"
		GoTo ShellCodeError
	EndIf
	Set RegistryErrorIndex = $($R0)
	Set KeyProduct		= $($R1)
	Set SoftNetRulesKey = $($R2)
	CloseRegKey $($R3)
	CloseRegKey $($R4)
	CloseRegKey $($R5)

	IfStr(i) $(RegistryErrorIndex) != NO_ERROR
		EndWait
		Debug-Output $(InfName)": Registry error: add software components"
		CloseRegKey $(KeyProduct)
		CloseRegKey $(SoftNetRulesKey)
		GoTo FatalRegistry
	EndIf

	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, $(KeyProduct), $(NewValueList)
	IfInt $($ShellCode) != $(!SHELL_CODE_OK)
		Debug-Output $(InfName)": ShellCode error."
		GoTo ShellCodeError
	EndIf
	Set RegistryErrorIndex = $($R0)
	IfStr(i) $(RegistryErrorIndex) != NO_ERROR
		EndWait
		Debug-Output $(InfName)": Registry error: add value list."
		CloseRegKey $(KeyProduct)
		CloseRegKey $(SoftNetRulesKey)
		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),$(BindableTxt)}, +
				{InfOption,$(NoTitle),$(!REG_VT_SZ),$(Option)}}
	Shell  $(UtilityInf), AddValueList, $(SoftNetRulesKey), $(NewValueList)
	IfInt $($ShellCode) != $(!SHELL_CODE_OK)
		Debug-Output $(InfName)": ShellCode error."
		GoTo ShellCodeError
	EndIf
	Set RegistryErrorIndex = $($R0)
	CloseRegKey $(KeyProduct)
	CloseRegKey $(SoftNetRulesKey)
	IfStr(i) $(RegistryErrorIndex) != NO_ERROR
		EndWait
		Debug-Output $(InfName)": Resgitry error: add value list."
		GoTo FatalRegistry
	EndIf
	EndIf

	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 $(InfName)": Cannot add hardware component"
	GoTo ShellCodeError
	EndIf
	Set RegistryErrorIndex = $($R0)
	IfStr(i) $(RegistryErrorIndex) != NO_ERROR
	EndWait
	Debug-Output $(InfName)": Registry error: add hardware component"
	CloseRegKey $($R1)
	CloseRegKey $($R2)
	CloseRegKey $($R3)
	GoTo FatalRegistry
	EndIf

	Set KeyParameters = $($R3)
	Set KeyAdapterRules = $($R2)
	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, $($R1), $(NewValueList)
	IfInt $($ShellCode) != $(!SHELL_CODE_OK)
	Debug-Output $(InfName)": ShellCode error"
	GoTo ShellCodeError
	EndIf
	CloseRegKey $($R1)

	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 $(InfName)": ShellCode error."
	GoTo ShellCodeError
	EndIf
	Set RegistryErrorIndex = $($R0)
	IfStr(i) $(RegistryErrorIndex) != NO_ERROR
	EndWait
	Debug-Output $(InfName)": Resgitry error: add value list."
	CloseRegKey $(KeyParameters)
	CloseRegKey $(KeyAdapterRules)
	GoTo FatalRegistry
	EndIf
	CloseRegKey $(KeyAdapterRules)

	GoTo WriteParameters

;***********************************************************************
;
;***********************************************************************
WriteParameters = +
	Debug-Output "WriteParameters"
	IfStr $(AdapterNumber) != ""
		;		Use this line for install two TAPI lines
		;		Set TapiAddressList = {$(AdapterNumber)" 0 0" $(AdapterNumber)" 1 0"}
		;
		;		Use this line to add the third V34 TAPI line for RSS DRV 
		;		Set TapiAddressList = {$(AdapterNumber)" 0 0" $(AdapterNumber)" 1 0" $(
		;		AdapterNumber)" 2 0" }
		;
		;		Use the following for 63 TAPI lines

		Set TapiAddressList = {$(AdapterNumber)" 0 0" $(AdapterNumber)" 1 0" $(AdapterNumber)" 2 0" +
		$(AdapterNumber)" 3 0" $(AdapterNumber)" 4 0" $(AdapterNumber)" 5 0" +
		$(AdapterNumber)" 6 0" $(AdapterNumber)" 7 0" $(AdapterNumber)" 8 0" +
		$(AdapterNumber)" 9 0" $(AdapterNumber)" 10 0" $(AdapterNumber)" 11 0" +
		$(AdapterNumber)" 12 0" $(AdapterNumber)" 13 0" $(AdapterNumber)" 14 0" +
		$(AdapterNumber)" 15 0" $(AdapterNumber)" 16 0" $(AdapterNumber)" 17 0" +
		$(AdapterNumber)" 18 0" $(AdapterNumber)" 19 0" $(AdapterNumber)" 20 0" +
		$(AdapterNumber)" 21 0" $(AdapterNumber)" 22 0" $(AdapterNumber)" 23 0" +
		$(AdapterNumber)" 24 0" $(AdapterNumber)" 25 0" $(AdapterNumber)" 26 0" +
		$(AdapterNumber)" 27 0" $(AdapterNumber)" 28 0" $(AdapterNumber)" 29 0"}
		
;		$(AdapterNumber)" 30 0" $(AdapterNumber)" 31 0" $(AdapterNumber)" 32 0" +
;		$(AdapterNumber)" 33 0" $(AdapterNumber)" 34 0" $(AdapterNumber)" 35 0" +
;		$(AdapterNumber)" 36 0" $(AdapterNumber)" 37 0" $(AdapterNumber)" 38 0" +
;		$(AdapterNumber)" 39 0" $(AdapterNumber)" 40 0" $(AdapterNumber)" 41 0" +
;		$(AdapterNumber)" 42 0" $(AdapterNumber)" 43 0" $(AdapterNumber)" 44 0" +
;		$(AdapterNumber)" 45 0" $(AdapterNumber)" 46 0" $(AdapterNumber)" 47 0" +
;		$(AdapterNumber)" 48 0" $(AdapterNumber)" 49 0" $(AdapterNumber)" 50 0" +
;		$(AdapterNumber)" 51 0" $(AdapterNumber)" 52 0" $(AdapterNumber)" 53 0" +
;		$(AdapterNumber)" 54 0" $(AdapterNumber)" 55 0" $(AdapterNumber)" 56 0" +
;		$(AdapterNumber)" 57 0" $(AdapterNumber)" 58 0" $(AdapterNumber)" 59 0" +
;		$(AdapterNumber)" 60 0" $(AdapterNumber)" 61 0" $(AdapterNumber)" 62 0" }
	EndIf
 
	Set NewValueList = {+
				{AddressList,$(NoTitle),$(!REG_VT_MULTI_SZ),$(TapiAddressList)},+
				{BusNumber,$(NoTitle),$(!REG_VT_DWORD),$(BusNumber)},+
				{BusType,$(NoTitle),$(!REG_VT_DWORD),$(BusType)},+
				{DeviceName,$(NoTitle),$(!REG_VT_SZ),$(ProductHardwareName)},+
				{BoardName,$(NoTitle),$(!REG_VT_SZ),$(ProductHardwareName)},+
				{MediaType,$(NoTitle),$(!REG_VT_SZ),$(TapiMediaType)},+
				}
	Shell  $(UtilityInf), AddValueList, $(KeyParameters), $(NewValueList)
	CloseRegKey $(KeyParameters)
	IfInt $($ShellCode) != $(!SHELL_CODE_OK)
	Debug-Output $(InfName)": ShellCode error."
	GoTo ShellCodeError
	EndIf
	Set RegistryErrorIndex = $($R0)
	IfStr(i) $(RegistryErrorIndex) != NO_ERROR
	Debug-Output $(InfName)": Registry error: Add value list"
	GoTo FatalRegistry
	EndIf
	; 
	IfStr(i) $(!NTN_InstallMode) == configure
		; ServiceName is already Set!
	Else
		Set ServiceName = $(ProductSoftwareName)$(AdapterNumber) 
	EndIf
;***********************************************************************
;	Configure the Card.  We need to do this AFTER we find out where the parameters are!
;***********************************************************************
	;
	Debug-Output "Configure the Card"
	Debug-Output " AdapterNumber="$(AdapterNumber)
	Debug-Output "	ServiceName"$(ServiceName)
	Debug-Output "	ServiceNameInfo"$(ServiceNameInfo)
	Debug-output "	Stf_HWND="$(!STF_HWND)

	; Shell "" TestHere "Configure the Card "$(AdapterNumber)$(ServiceName)
	
	;   LoadLibrary "Setup Disk 1" C:\p\nt\pri\mysetup\debug\hpsetup.dll hMySetup
   LoadLibrary "Setup Disk 1" $(MySetupPath) hMySetup
	Debug-Output $(hMySetup)

	; Set FLibraryErrCtl = 1 If there is an error it is put in the result string
	; Set FLibraryErrCtl = 0 If there is an error Windows puts up a dialog with the error 
	;								 and "ERROR" is returned.	
   Set FLibraryErrCtl = 1
	LibraryProcedure Result, $(hMySetup), ConfigPriCard, $(ServiceName), $(!STF_HWND), "Parm2"
   Set FLibraryErrCtl = 0

	Split-String $(Result) "," RetList
	QueryListSize RetListSize, $(RetList)
	Debug-Output "Size="$(RetListSize)

	; This is the only way I figurted out how to get parameter returns.  Return a String, and
	; Parse it! Odd Items are the parameters, Even are delimiters
	;
	Debug-Output "RetList1="*($(RetList),1)
	Debug-Output "RetList2="*($(RetList),2)
	Debug-Output "RetList3="*($(RetList),3)
	Debug-Output "RetList4="*($(RetList),4)
	Debug-Output "RetList5="*($(RetList),5)
	Debug-Output "RetList7="*($(RetList),7)

	Set ResultStr = *($(RetList),1)

	IfStr(i) $(ResultStr) == "OK"
   	Debug-Output "Success "*($(Result),1)
		; Shell "" TestHere "Success "*($(Result),1)
	Else
   	Debug-Output "Faila "*($(Result),1)
		; Shell "" TestHere "Fail "$(ResultStr)
	Endif

	FreeLibrary $(hMySetup)

;***********************************************************************
; Skip TAPI/RAS setup if already installed.
;***********************************************************************
	IfStr(i) $(!NTN_InstallMode) == configure
	GoTo SuccessfulOption
	EndIf

;***********************************************************************
; Create the HARDWARE\DEVICEMAP\TAPI DEVICES\MTSWAN key
;***********************************************************************
	Debug-Output "TAPI Parameters Adapter="$(AdapterNumber)
	OpenRegKey $(!REG_H_LOCAL) "" "HARDWARE\DEVICEMAP" $(MAXIMUM_ALLOWED) BaseKey
	shell "" HtCreateRegKey $(BaseKey) "TAPI DEVICES\MTSWAN"
	IfStr(i) $($R0) != NO_ERROR
		Debug-Output $(InfName)": Error creating registry key!"
		GoTo FatalRegistry
	EndIf
	Set TapiDeviceKey = $($R1)
	Debug-Output "TapiDeviceKey="$(TapiDeviceKey)
	Set NewValueList = {+
				{Address,$(NoTitle),$(!REG_VT_MULTI_SZ),$(TapiAddressList)},+
				{"Media Type",$(NoTitle),$(!REG_VT_SZ),$(TapiMediaType)}}
	Shell  $(UtilityInf), AddValueList, $(TapiDeviceKey), $(NewValueList)
	IfInt $($ShellCode) != $(!SHELL_CODE_OK)
		Debug-Output $(InfName)": ShellCode error."
		GoTo ShellCodeError
	EndIf
	Set RegistryErrorIndex = $($R0)
	IfStr(i) $(RegistryErrorIndex) != NO_ERROR
		Debug-Output $(InfName)": Registry error: Add value list"
		GoTo FatalRegistry
	EndIf
	CloseRegKey $(TapiDeviceKey)
	CloseRegKey $(BaseKey)
	;
	;
;***********************************************************************
; if RAS is not installed, then shell ras setup INF file to install RAS
; else invoke RAS to allow user to configure RAS for MTSWAN. 
;***********************************************************************
	Read-Syms InvokeRasDlg$(!STF_LANGUAGE)
	Shell "oemnsvra.inf" CheckRasInstalled
	IfInt $($ShellCode) != $(!SHELL_CODE_OK)
		Debug-Output $(InfName)": Error Shelling the RAS INF file oemnsvra.inf" 
		Shell "subroutn.inf" SetupMessage, $(!STF_LANGUAGE),  +
			"STATUS", $(InvokeRasError)
		IfInt $($ShellCode) != $(!SHELL_CODE_OK)
			GoTo ShellCodeError
		EndIf
		GoTo SuccessfulOption
	EndIf

	Set RasInstalled = $($R0)

	Debug-Output $(InfName)": Is RAS Installed? "$(RasInstalled)
	;
	; display a message to the user that RAS setup will now be invoked
	;
	IfStr(i) $(RasInstalled) == FALSE
		Shell "subroutn.inf" SetupMessage, $(!STF_LANGUAGE), "STATUS", +
			$(InvokeRasSetupMsg)
		IfInt $($ShellCode) != $(!SHELL_CODE_OK)
			GoTo SuccessfulOption
		EndIf
	Else
		Shell "subroutn.inf" SetupMessage, $(!STF_LANGUAGE), "STATUS", +
			$(InvokeRasConfigMsg)
		IfInt $($ShellCode) != $(!SHELL_CODE_OK)
			GoTo SuccessfulOption
		EndIf
	EndIf
	;
	; FIXME - RAS INF will not locate the files if it is spawned here.
	;
	EndWait
	GoTo SuccessfulOption

	;
	; Set the flags based on whether this is an IDW installation
	;
	IfStr(i) $(!STF_IDW) == TRUE
		Set AddCopy  = NO
		Set DoCopy	= NO
		Set DoConfig = NO
	Else
		Set AddCopy  = YES
		Set DoCopy	= YES
		Set DoConfig = YES
	EndIf
	;
	; change the global install mode flag to configure if RAS is already installed
	;
	IfStr(i) $(RasInstalled) == TRUE
		Set SaveNTN_InstallMode = $(!NTN_InstallMode)
		Set !NTN_InstallMode = configure
	EndIf
	;
	; now invoke RAS setup to do the right thing
	;
	Debug-Output "Invoke RAS Setup"

	Shell "oemnsvra.inf" InstallOption $(!STF_LANGUAGE) "RAS" $(RasDir) $(AddCopy) $(DoCopy) $(DoConfig)
	;
	; restore the global instal mode flag if it was changed
	;
	IfStr(i) $(RasInstalled) == TRUE
		Set !NTN_InstallMode = $(SaveNTN_InstallMode)
	EndIf
	IfInt $($ShellCode) != $(!SHELL_CODE_OK)
		Debug-Output $(InfName)": Error Shelling the RAS INF file oemnsvra.inf" 
		Shell "subroutn.inf" SetupMessage, $(!STF_LANGUAGE), "STATUS",  +
			$(InvokeRasError)
		IfInt $($ShellCode) != $(!SHELL_CODE_OK)
			GoTo ShellCodeError
		EndIf
		GoTo SuccessfulOption
	EndIf

	EndWait
	GoTo SuccessfulOption

;***********************************************************************
;
;***********************************************************************
BindingAdapter =+
	Set Error = "Binding: Sorry, not yet implemented."
	GoTo FatalError

;***********************************************************************
;
;***********************************************************************
RemoveAdapter = +
	Debug-Output "RemoveAdaptera"
	Debug-Output $(!STF_WINDOWSSYSPATH)"\drivers\MTSWAN.SYS"
	Debug-Output $(!STF_WINDOWSSYSPATH)"\drivers\ARMCSM"
	Debug-Output $(!STF_WINDOWSSYSPATH)"\MTSWANAP.CPL"
	Debug-Output "ProductKey="$(ProductKeyName)
	Debug-Output "NTN_RegBase="$(!NTN_RegBase)

	; Need to find the inffile name (UG_, and Remove it from system32
	; IncrementRefCount? ; DecrementRefCount?

	Shell $(UtilityInf), IsRefCountEqualZero, $(ProductKeyName)
	Set ret = $($R0)
	Debug-Output "RemoveAdapter IsRefCountEqualZero R0 "$(ret)
	Set ret = $($R1)
	Debug-Output "RemoveAdapter IsRefCountEqualZero R1 "$(ret)
	
	Ifstr(i) $($R0) != NO_ERROR
		Debug-Output "RemoveAdapter Error "$($R0)
	;	goto RemoveSoftwareComponent_Return
	endif
	Ifint $($R1) == 1
		Debug-Output "We can delete the files! R1 == 1 "$($R1)
	;	set RegistryErrorIndex = REF_COUNT_NOT_ZERO
	;	goto RemoveSoftwareComponent_Return
	Endif


; This code doesn't work yet!

	OpenRegKey $(!REG_H_LOCAL) "" $(ProductKeyName) $(MAXIMUM_ALLOWED) KeyProduct
	IfStr $(KeyProduct) != $(KeyNull)
		Shell $(UtilityInf), GetInfFileNameFromRegistry, $(KeyProduct)
		IfInt $($ShellCode) != $(!SHELL_CODE_OK)
			Debug-Output $(InfName)": ShellCode error"
			GoTo ShellCodeError
		EndIf
		Set !UG_Filename = $($R0)
		Debug-Output $(InfName)" $(!UG_Filename) = "$(!UG_Filename)
;		Shell "" TestHere "AddfileToDeleteList"$(!UG_Filename)
		CloseRegKey $(KeyProduct)
		IfStr(i) $(!UG_Filename) != ""
			Debug-Output $(InfName)"We could AddfileToDeleteList "$(!STF_WINDOWSSYSPATH)"\drivers\"$(!UG_Filename)
;			AddfileToDeleteList	$(!STF_WINDOWSSYSPATH)"\drivers\"$(!UG_Filename)	
		Endif
	Endif

	Shell "", IsRefCountEqualZero, $(RH_ProductKey)

;	Shell "" TestHere "Last Chance to Cancel"$(!STF_WINDOWSSYSPATH)"\drivers\"$(!UG_Filename)

; This code doesn't work yet! (Because product Key Name don't equal RegBase)
;  We need to delete the files ONLY when there are no more cards left!
	
	IfStr(i) $(ProductKeyName) == $(!NTN_RegBase)
		Debug-Output "Add Files To Delete List "
		; Files-MTSWAN 
		AddfileToDeleteList	$(!STF_WINDOWSSYSPATH)\drivers\MTSWAN.SYS
		AddfileToDeleteList	$(!STF_WINDOWSSYSPATH)\drivers\ARMCSM
		; Files-Cpl 
		AddfileToDeleteList	$(!STF_WINDOWSSYSPATH)\MTSWANAP.CPL

; This function don't exist?
;		AddSectionFilesToDeleteList Files-$(Option) $(SrcDir) $(!STF_WINDOWSSYSPATH)\drivers
;		AddSectionFilesToDeleteList Files-Cpl $(SrcDir) $(!STF_WINDOWSSYSPATH)

		Shell $(UtilityInf), RemoveSoftwareComponent, $(Manufacturer), +
			$(ProductSoftwareName)
		IfInt $($ShellCode) != $(!SHELL_CODE_OK)
			Debug-Output $(InfName)": ShellCode error"
			GoTo ShellCodeError
		EndIf
		Set RegistryErrorIndex = $($R0)
		IfStr(i) $(RegistryErrorIndex) != NO_ERROR
			GoTo FatalRegistry
		EndIf
	Else
		Debug-Output "Remove Hardware"$(ProductSoftwareName)
		Shell $(UtilityInf), RemoveHardwareComponent, $(Manufacturer), +
			$(ProductSoftwareName), $(!NTN_RegBase)
		IfInt $($ShellCode) != $(!SHELL_CODE_OK)
			Debug-Output $(InfName)": ShellCode error"
			GoTo ShellCodeError
		EndIf
		Set RegistryErrorIndex = $($R0)
		IfStr(i) $(RegistryErrorIndex) != NO_ERROR
			GoTo FatalRegistry
		EndIf
	EndIf
	GoTo end

;***********************************************************************
;    set RH_VersionNum   = "CurrentVersion"
;    set RH_ProductKey   = $(!NTN_SoftwareBase)"\"$($0)"\"$($1)"\"$(RH_VersionNum)
;ProductKeyName
;***********************************************************************
UpgradeSoftware = +
	Debug-Output "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 $(InfName)": ShellCode error"
				GoTo ShellCodeError
			EndIf
			Set !UG_Filename = $($R0)
			IfStr(i) $(!UG_Filename) != ""
				install "Install-Update"
				IfStr(i) $(STF_INSTALL_OUTCOME) != STF_SUCCESS
					GoTo FatalError
				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
				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

;***********************************************************************
;
;***********************************************************************
SuccessfulOption = +
	Debug-Output "SuccessfulOption"
	GoTo end

;***********************************************************************
;
;***********************************************************************
Abandon = +
	Debug-Output "Abandon"
	ForListDo $(OEM_ABANDON_OPTIONS)
		Shell $(UtilityInf), RemoveHardwareComponent, $(Manufacturer), +
			$(ProductSoftwareName), $($)
		IfInt $($ShellCode) != $(!SHELL_CODE_OK)
			Debug-Output $(InfName)": 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 $(InfName)": ShellCode error"
			GoTo ShellCodeError
		EndIf
		Set RegistryErrorIndex = $($R0)
		IfStr(i) $(RegistryErrorIndex) != NO_ERROR
			GoTo FatalRegistry
		EndIf
	EndIf
	GoTo end

;***********************************************************************
;
;***********************************************************************
WarningMsg = +
	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)
	EndIf
	GoTo end

;***********************************************************************
;
;***********************************************************************
NonFatalInfo = +
	Set Severity = STATUS
	Set CommonStatus = STATUS_USERCANCEL
	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)
	EndIf
	GoTo end

;***********************************************************************
;
;***********************************************************************
FatalRegistry = +
	Shell $(UtilityInf) RegistryErrorString $(RegistryErrorIndex)
	IfInt $($ShellCode) != $(!SHELL_CODE_OK)
		GoTo ShellCodeError
	EndIf
	Set Error = $($R0)
	GoTo FatalError

;***********************************************************************
;
;***********************************************************************
FatalDetect = +
	Shell $(UtilityInf) RegistryErrorString CANNOT_DETECT
	IfInt $($ShellCode) != $(!SHELL_CODE_OK)
		Debug-Output $(InfName)": ShellCode error: cannot get an error string."
	GoTo ShellCodeError
	EndIf
	Set Error = $($R0)
	GoTo FatalError

;***********************************************************************
;
;***********************************************************************
FatalError = +
	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 = $(ShellCodeErrorTitle)
	Set STF_MB_TEXT  = $(ShellCodeErrorText)
	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 = +
	Set !DebugOutputControl = $(OldDebugControl)
	Return $(CommonStatus)

;***********************************************************************
;
;***********************************************************************
[HtCreateRegKey]
	Debug-Output $(InfName)": Entering [HtCreateRegKey]"
	Set ECR_Result			= NO_ERROR
	Set ECR_BaseKeyHandle	= $($0)
	Set ECR_NewPath			= $($1)
	Set KeyNull				= ""
	Set MAXIMUM_ALLOWED	= 33554432

	Debug-Output $(InfName)": HtCreateRegKey - ECR_BaseKeyHandle = "$(ECR_BaseKeyHandle)
	Debug-Output $(InfName)":						ECR_NewPath		= "$(ECR_NewPath)
	Debug-Output $(InfName)":						MAXIMUM_ALLOWED	= "$(MAXIMUM_ALLOWED)
	Debug-Output $(InfName)":						KeyNull			= "$(KeyNull)

	OpenRegKey $(ECR_BaseKeyHandle) "" $(ECR_NewPath) $(MAXIMUM_ALLOWED) +
			ECR_BaseKey
	Debug-Output $(InfName)": ECR_BaseKey = "$(ECR_BaseKey)
	Debug-Output $(InfName)":	OpenRegKey returned "$($R0)
	IfStr $(ECR_BaseKey) == $(KeyNull)
		Debug-Output $(InfName)": ECR_BaseKey == KeyNull"
	Else
		Debug-Output $(InfName)": ECR_BaseKey != KeyNull"
		Set ECR_KeyHandle = $(ECR_BaseKey)
		GoTo  ECR_Return
	EndIf

	Set ECR_TmpPath = ""
	Split-String $(ECR_NewPath) "\" ECR_PList
	Debug-Output $(InfName)": ECR_PList = "$(ECR_PList)
	ForListDo $(ECR_PList)
		IfStr(i) $($) != "\"
			IfInt $(#) == 1
				Set ECR_TmpPath = $($)
			Else
				Set ECR_TmpPath = $(ECR_TmpPath)"\"$($)
			EndIf
			Debug-Output $(InfName)": Determining if "$(ECR_TmpPath)" exists"
			OpenRegKey $(ECR_BaseKeyHandle) "" $(ECR_TmpPath) $(MAXIMUM_ALLOWED) ECR_BaseKey
			IfStr $(ECR_BaseKey) == $(KeyNull)
				Debug-Output $(InfName)": Creating "$(ECR_TmpPath)
				CreateRegKey $(ECR_BaseKeyHandle)  {$(ECR_TmpPath),0,GenericClass} "" $(MAXIMUM_ALLOWED) "" ECR_KeyHandle
				IfStr(i) $(ECR_KeyHandle) == $(KeyNull)
					Set ECR_Result = $($R0)
					GoTo ECR_Return
				EndIf
			EndIf
		EndIf
	EndForListDo
ECR_Return = +
	Return $(ECR_Result) $(ECR_KeyHandle)

;***********************************************************************
;
;***********************************************************************
[DebugConfiguration]
	Debug-Output $(!p:InfName)": **CONFIGURATION STATE: "$($0)
	Debug-Output $(!p:InfName)": InterruptNumber is "$(!p:InterruptNumber)
	Debug-Output $(!p:InfName)": RamBaseAddress  is "$(!p:RamBaseAddress)
	Return

;***********************************************************************
;
;***********************************************************************
[Install-Option]
	Set STF_VITAL = ""

	
	IfStr(i) $(AddCopy) == "YES"
		AddSectionFilesToCopyList Files-$(Option) $(SrcDir) $(!STF_WINDOWSSYSPATH)\drivers
		AddSectionFilesToCopyList Files-Cpl $(SrcDir) $(!STF_WINDOWSSYSPATH)
	EndIf
	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-Cpl $(SrcDir) $(!STF_WINDOWSSYSPATH)
	AddSectionFilesToCopyList Files-Inf $(SrcDir) $(!STF_WINDOWSSYSPATH)
	Set !STF_NCPA_FLUSH_COPYLIST = TRUE
	CopyFilesInCopyList
	Exit

;***********************************************************************
; Test Code (Bring up a Dialog allowing you to check softice, OR EXIT
;***********************************************************************

[TestHere]
;	Read-Syms GeneralConstants
;	Read-Syms FileConstants
;	Read-Syms DialogConstants$(!STF_LANGUAGE)

;	Set PP1 = $($0)
;	Set PP2 = $($1)

	Debug-Output "TestHere $($0) $($1)"
	
	set Error = $($0)" "$($1) 
	Shell "SUBROUTN.INF" SetupMessage $(!STF_LANGUAGE), "WARNING", $(Error)

	Debug-Output "TestHere $($R0) $($R1)"
	
	ifstr(i) $($R1) == "CANCEL"
		; This causes a shell error, but I want to Quite anyway!
		; GoTo end (end doesn't exist if I shell to it!)
		Exit
	endif
	return

;***********************************************************************
; Example Code
;***********************************************************************
	; This is how a Library DLL is loaded and called
	; I never figured out how to make my own DLL procedure that would return parameters
	; In a list such as this one.  We return a String and parse it with Split-String
	
	LoadLibrary "y" $(!STF_CWDDIR)ncpa.cpl HHANDLE

    set FLibraryErrCtl = 1
    LibraryProcedure BusInfo $(HHANDLE), GetBusTypeDialog, $(!STF_HWND), $(CardName), $(BusInterfaceType), $(BusNumber)
    set FLibraryErrCtl = 0

    ; return values

    set Zeroo 			= *($(BusInfo),0)
    set ReturnValue 	= *($(BusInfo),1)
    ifint *($(BusInfo),1) == 0
        set ReturnValue = NO_ERROR
        set BusInterfaceType = *($(BusInfo),2)
        set BusNumber = *($(BusInfo),3)
        set DlgReturn = *($(BusInfo),4)
 	endif

	debug-output "0="$(Zeroo)		
	debug-output "1="$(ReturnValue)		
	debug-output "2="$(BusInterfaceType)		
	debug-output "3="$(BusNumber)		
	debug-output "4="$(DlgReturn)		

	FreeLibrary $(HHANDLE)


;***********************************************************************
; Disk descriptions 
; TAGFILE is the file that tells NT the correct disk has been inserted
;***********************************************************************
[Source Media Descriptions]
;	1  = "Windows NT Setup Disk #1" , TAGFILE = HTDSU41.SYS
	1  = "Multi-Tech Wan Setup Disk #1" , TAGFILE = MTSWAN.SY_
;	2  = "Multi-Tech Wan Setup Disk #2" , TAGFILE = MTSWANAP.CPL

;***********************************************************************
;
;***********************************************************************
[ProductType]
	STF_PRODUCT			= Winnt
	STF_PLATFORM		= I386

;***********************************************************************
;
;***********************************************************************
[Files-Inf]
	1, oemsetnt.inf, SIZE=1000, RENAME=$(!UG_Filename)

;***********************************************************************
;
;***********************************************************************
[Files-MTSWAN]
	1, MTSWAN.SY_, SIZE=65536, DECOMPRESS, OVERWRITE=ALWAYS, RENAME=MTSWAN.SYS 
	1, ARMCS_, DECOMPRESS, OVERWRITE=ALWAYS, RENAME=ARMCSM

;***********************************************************************
;
;***********************************************************************
[Files-Cpl]
	1, hpsetup.dll, OVERWRITE=ALWAYS 
	1, MTSWANAP.CP_, DECOMPRESS, OVERWRITE=ALWAYS, RENAME=MTSWANAP.cpl
	;2, MTSWANAP.CPL, DECOMPRESS, RENAME=MTSWANAP.cpl, OVERWRITE=ALWAYS

;***********************************************************************
;
;***********************************************************************
[LanguagesSupported]
	ENG

;***********************************************************************
;
;***********************************************************************
[OptionsTextENG]
	MTSWAN				= "Multi-Tech Systems WAN Adapter"

;***********************************************************************
;
;***********************************************************************
[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					= "Multi-Tech Systems WAN Card Setup"
	ProductSoftwareDescription	= "Multi-Tech Systems WAN Driver"
	ProductHardwareDescription	= "Multi-Tech Systems WAN Miniport Driver"
	ProductSoftwareTitle			= "Multi-Tech Systems WAN Driver"
	ProductHardwareTitle			= "Multi-Tech Systems WAN Adapter"

	ShellCodeErrorTitle					= "Error: "$(FunctionTitle))
	ShellCodeErrorText						= "Shell Code Error."

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

;***********************************************************************
;
;***********************************************************************
[InvokeRasDlgENG]
	InvokeRasSetupMsg	= "Multi-Tech Systems WAN setup is complete. "+
			"If ISDN ports are to be used, Remote Access Services (RAS) must be installed. "+
			"Please configure the MTSWAN ISDN ports in RAS "+
			"setup to enable you to use RAS over the MTSWAN."+
			"Use of Asynchronous ports, does not require RAS."
	InvokeRasConfigMsg  = "Multi-Tech Systems WAN setup is complete. "+
			"If ISDN ports are to be used, Remote Access Services (RAS) must be invoked. "+
			"Please configure the MTSWAN ISDN ports in RAS "+
			"setup to enable you to use RAS over the MTSWAN."+
			"Use of Asynchronous ports, does not require RAS."
	InvokeRasError		= "Multi-Tech Systems WAN setup encountered an error "+
			"while invoking the RAS setup INF file (OEMNSVRA.INF). "+
			"Please make sure that the file is present in the "+
			"System32 directory and is the proper file." 
Download Driver Pack

How To Update Drivers Manually

After your driver has been downloaded, follow these simple steps to install it.

  • Expand the archive file (if the download file is in zip or rar format).

  • If the expanded file has an .exe extension, double click it and follow the installation instructions.

  • Otherwise, open Device Manager by right-clicking the Start menu and selecting Device Manager.

  • Find the device and model you want to update in the device list.

  • Double-click on it to open the Properties dialog box.

  • From the Properties dialog box, select the Driver tab.

  • Click the Update Driver button, then follow the instructions.

Very important: You must reboot your system to ensure that any driver updates have taken effect.

For more help, visit our Driver Support section for step-by-step videos on how to install drivers for every file type.

server: web3, load: 0.72