[Identification] 
    OptionType = NetAdapter
[PlatformsSupported]
    ISA
		EISA
		PCI
[LanguagesSupported]
    ENG
[Options]
    DigiSyncX25
[FileConstants]
UtilityInf      = "UTILITY.INF"
ParamInf        = "NCPARAM.INF"
subroutineinf   = "SUBROUTN.INF"
SoftwareType    = "driver"
Exit_Code       = 0
SuccessCode     = 0
HandleNull      = ""
NetEventDLL     = "%SystemRoot%\System32\netevent.dll"
IoLogMsgDLL     = "%SystemRoot%\System32\IoLogMsg.dll"
Manufacturer    = "DigiBoard"
ProductMajorVersion  = "3"
ProductMinorVersion  = "51"
ProductVersion  = $(ProductMajorVersion)"."$(ProductMinorVersion)

InfName = ""
ErrorControlValue = 1
ServicesbasedKey   = ""
DigiSpecificString = ""

DigiSupport = "X.25"
DigiNumPorts = 2

; Digi X.25 driver software parameters
X25ProductSoftwareName     = "DigiX25"
X25ProductServiceName     = "DigiX25"
X25ProductSoftwareTitle    = "Digi X.25 Driver"
X25ProductSoftwareDisplayName    = "Digi X.25 Driver"
X25ProductSoftwareDescription    = "Digi X.25 Driver"
X25ProductSoftwareImagePath = "%SystemRoot%\System32\drivers\DigiX25.sys"
X25NetRuleSoftwareType     = "DigiX25Sys DigiX25Driver"
X25NetRuleSoftwareUse      = "driver"
X25NetRuleSoftwareBindForm = """"DigiX25Driver""" yes no container"
X25NetRuleSoftwareClass    = {"DigiX25Driver basic"}
X25NetRuleSoftwareBindable = {"DigiX25Driver DigiX25Adapter non exclusive 100"}
X25SoftwareRefCount     = 0
X25NetRuleInfNameSoftware  =  ""
X25NetRuleInfOption        =  "DigiSyncX25"
X25SoftProductKey	= ""
X25SoftNetRuleKey	= ""
X25SoftServiceKey	= ""
X25SoftParameterKey 	= ""
X25SoftLinkageKey 	= ""
X25TypeSupported        = 7
X25EventFile = $(IoLogMsgDLL)";"$(X25ProductSoftwareImagePath)
X25Group                = "NDIS"
X25NetworkAddress       = "22-33-44-55-66-70"
X25ServiceParametersKey = ""
X25ServiceDigiX25Key    = ""
X25ProductKeyName  = $(!NTN_SoftwareBase)"\"$(Manufacturer)"\"$(X25ProductSoftwareName)"\CurrentVersion"
X25SoftwareHiddenDriver = 1

; Digi Sxb driver Software parameters
SxbProductSoftwareName     = "DigiSxb"
SxbProductServiceName     = "DigiSxb"
SxbProductSoftwareTitle    = "Digi SyncPort SXB Driver"
SxbProductSoftwareDescription    = "Digi SyncPort SXB Driver"
SxbProductSoftwareImagePath = "%SystemRoot%\System32\drivers\DigiSxb.sys"
SxbNetRuleSoftwareType     = "DigiSxbSys DigiSxbDriver"
SxbNetRuleSoftwareUse      = "driver"
SxbNetRuleSoftwareBindForm = """"DigiSxbDriver""" yes no container"
SxbNetRuleSoftwareClass    = {"DigiSxbDriver basic"}
SxbNetRuleSoftwareBindable = {"DigiSxbDriver DigiSxbAdapter non exclusive 100"}
SxbSoftwareRefCount     = 0
SxbNetRuleInfNameSoftware  =  ""
SxbNetRuleInfOption        =  "DigiSyncX25"
SxbSoftProductKey	= ""
SxbSoftNetRuleKey	= ""
SxbSoftServiceKey	= ""
SxbSoftParameterKey 	= ""
SxbSoftLinkageKey 	= ""
SxbTypeSupported        = 7
SxbEventFile = $(IoLogMsgDLL)";"$(SxbProductSoftwareImagePath)
SxbKeyProductHdwDriver  = ""
SxbProductKeyName  = $(!NTN_SoftwareBase)"\"$(Manufacturer)"\"$(SxbProductSoftwareName)"\CurrentVersion"
SxbServiceFacilityKey   = ""
SxbServiceDigiSxbKey    = ""
SxbServiceParametersKey = ""
SxbGroup             = "NDIS"
SxbServiceFacility   = "Facility0"
SxbdevWans           = "/dev/Wans" 
SxbWanS              = "WanS"
SxbNetworkAddress    = "53-52-43-44-47-32"
SxbSoftwareHiddenDriver = 1

; Digi Adapter NT NetCard install
AdapterKeyNetcardsArea = ""
AdapterKeyNetcard   = ""
AdapterCardNumber   = ""
AdapterNetRulesKey  = ""
AdapterKeyParmeters = ""
;;;
AdapterHardwareName = "DigiSxb"
AdapterNumber       = ""
AdapterNameNumber   = ""
AdapterHardwareTitle       = "Digi SyncPort Adapter"
AdapterHardwareDescription = "Digi SyncPort Adapter"
AdapterNetRuleType         = "DigiSxb DigiSxbAdapter"
AdapterNetRuleBindForm     = " yes yes container"
;AdapterNetRuleClass        = {"""DigiSxbAdapter basic"""}
AdapterNetRuleClass        = {"DigiSxbAdapter basic"}
AdapterNetRuleInfName      = ""
AdapterNetRulesInfOption   =  "DigiSyncX25"
AdapterNetworkAddress = "53-52-43-44-47-31"
AdapterBiosImagePathISA  = "SxbBios.bin"
AdapterSxbImagePathISA   = "SxbFep.bin"
AdapterBiosImagePathPCI  = "SxbBios.pci"
AdapterSxbImagePathPCI   = "SxbFep.pci"
AdapterProductName    =  "DigiSxb"
AdapterInterruptNumber = 15
AdapterIOBaseAddress   = 808
AdapterMemoryAddress   = 851968
AdapterWindowSize      = 32768 
AdapterTempServiceBaseKey = ""
AdapterNameNumberBaseKey = ""
AdapterParametersKey     = ""

; Digi X25 virtual adapter params
X25HardwareName = "DigiX25"
X25HardwareTitle       = "Digi X.25 Virtual Adapter"
X25HardwareDescription = "Digi X.25 Virtual Adapter"
X25NetRuleType         = "DigiX25 DigiX25Adapter"
X25NetRuleBindForm     = " yes yes container"
X25NetRuleClass        = {"DigiX25Adapter basic"}
X25NetRulesInfOption   =  "DigiSyncX25"
X25MaxSendWindow	 = 4

; Digi Sxb Hardware parameters
ProductHardwareName     = "DigiSxb"
ProductKeyName  = $(!NTN_SoftwareBase)"\"$(Manufacturer)"\"$(X25ProductSoftwareName)"\CurrentVersion"
ParamKeyName    = $(!NTN_ServiceBase)"\"$(ProductHardwareName)"\Parameters"
KeyProductHdwDriver = ""
ServiceProviderMediaType = ""
ServiceProviderNetCardNumber = ""
ServiceProviderAddress      = {""}
PreviousValueList = {}
ServiceProviderAddressFinal = {}
DigiX25ServiceProviderKey = ""
TapiDevicesKey = ""
DeviceMapKey = ""

ServiceProviderAddress = {}
BuildAddress = ""
BuildDigit2 = 0
BuildDigit3 = 0

tempList = {}
PreviousValueList = {}

[GeneralConstants]
ExitCodeOk     = 0
ExitCodeCancel = 1
ExitCodeFatal  = 2
KeyNull         = ""
MAXIMUM_ALLOWED   = 33554432
RegistryErrorIndex = NO_ERROR
KeyProduct      = ""
KeyParameters   = ""
TRUE            = 1
FALSE           = 0
NoTitle         = 0
OldVersionExisted = $(FALSE)

[UiVars]
    from      = ""
    to        = ""
    !STF_DISPLAYDEBUGOUTPUT = 1
    !STF_NTDRIVE        = ""
    !STF_NTPATH         = ""
    !STF_WINDOWSPATH    = "" ? $(!LIBHANDLE) GetWindowsNtDir
    !STF_WINDOWSSYSPATH = "" ? $(!LIBHANDLE) GetWindowsNtSysDir
    DriverPath      = $(!STF_NTPATH)"\drivers"

[DebugOptions]
    !DebugOutputControl = 1
    TraceConfig = 0
[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]
    read-syms DebugOptions
    Debug-Output "OEMNADDS.INF: In [InstallOption] section"
    Debug-Output "OEMNADDS.INF: TraceConfig = "$(TraceConfig)
    set Status   = STATUS_FAILED
    set Option   = $($1)
    set SrcDir   = $($2)
;    set AddCopy  = $($3)
;    set DoCopy   = $($4)
    set AddCopy  = "YES"
    set DoCopy   = "YES"
    set DoConfig = "YES"
;    set DoConfig = $($5)
    set SourceDir = $($2)
    set LanguageList = ^(LanguagesSupported, 1)
    Ifcontains(i) $($0) NOT-IN $(LanguageList)
        Return STATUS_NOLANGUAGE
    endif
    set OptionList     = ^(Options, 1)
    Ifcontains(i) $(Option) NOT-IN $(OptionList)
			set Error = "The installation option is not supported"
			goto fatal
		endif

    set-subst LF = "\n"
    read-syms GeneralConstants
    read-syms FileConstants
    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 = +
    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 CommonStatus = STATUS_REBOOT
        set StartLabel = configureadapter
        Ifstr(i) $(SxbProductKeyName) == $(!NTN_RegBase)
            Debug-Output "Cannot configure the Digi SyncPort WAN-Link 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
        Ifstr(i) $(X25ProductKeyName) == $(!NTN_RegBase)
            Debug-Output "Cannot configure the X.25 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
    Debug-Output "OEMNADX.INF: =================================================="
    Debug-Output "OEMNADX.INF: STF_CWDDIR is: "$(!STF_CWDDIR)
    Debug-Output "OEMNADX.INF: STF_LANGUAGE is: "$(!STF_LANGUAGE)
    Debug-Output "OEMNADX.INF: Option is: "$(Option)
    Debug-Output "OEMNADX.INF: SrcDir is: "$(SrcDir)
    Debug-Output "OEMNADX.INF: !STF_NCDETECT  is: "$(!STF_NCDETECT)
    Debug-Output "OEMNADX.INF: !STF_NCOPTION  is: "$(!STF_NCOPTION)
    Debug-Output "OEMNADX.INF: !STF_NCDETCARD is: "$(!STF_NCDETCARD)
    Debug-Output "OEMNADX.INF: !STF_NCDETINFO is: "$(!STF_NCDETINFO)
    Debug-Output "OEMNADX.INF: BusTypeNum is: "$(BusTypeNum)
    Debug-Output "OEMNADX.INF: =================================================="

    Goto $(StartLabel)
installadapter = +
; don't install if FR present
		OpenRegKey $(!REG_H_LOCAL) "" "Software\DigiBoard\DigiFr"	$(MAXIMUM_ALLOWED) Key
		ifstr $(Key) != $(KeyNULL)
			set Error = "X.25 services cannot be installed while Frame Relay is installed"
			goto fatal
		endif

	; Check to see if the product is already installed
    OpenRegKey $(!REG_H_LOCAL) "" $(X25ProductKeyName) $(MAXIMUM_ALLOWED) KeyProduct
    Debug-Output "OEMNADX.INF: KeyProduct "$(KeyProduct)
    Ifstr(i) $(KeyProduct) != ""
        CloseRegKey $(KeyProduct)
        ifstr(i) !(NTN_RegBase) == $(X25ProductKeyName)
           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
            OpenRegKey $(!REG_H_LOCAL) "" $(SxbProductKeyName) +
                       $(MAXIMUM_ALLOWED) KeyProductHdwDriver
            Ifstr $(KeyProductHdwDriver) != $(KeyNull)
                CloseRegKey $(KeyProductHdwDriver)
                Shell $(UtilityInf), CardExistedDlg
                ifint $($ShellCode) != $(!SHELL_CODE_OK)
                    Debug-Output "ShellCode error: --One adapter all ready exists, install another-- FAILED."
                    goto ShellCodeError
                endif
                ifstr(i) $($R1) != "OK"
                    goto end
                endif
            EndIf 
            CloseRegKey $(KeyProductHdwDriver)  
            set OldVersionExisted = $(TRUE)
        endif
    endif

; The OldVersionExisted variable is a major control structure mechanism 
; if the OldVersion does exist then skip the creation of registry entries that 
; are only needed once for this type of adapter and then do create the 
; registry entries that are unique for each adapter card installed.

ifint $(OldVersionExisted) == $(FALSE)

; ********************************************************************************
   ; Now create the service for the DigiSxb
; ********************************************************************************
   Shell $(UtilityInf), CreateService $(SxbProductServiceName),$(SxbProductSoftwareTitle), +
	$(SxbProductSoftwareImagePath), +
	"kernelautostart",$(SxbGroup),{},"",$(SxbEventFile),$(SxbTypeSupported),"",$(ErrorControlValue), +
	$(SxbProductServiceName),"",""
    ifint $($ShellCode) != $(!SHELL_CODE_OK)
        Debug-Output "ShellCode error."
        goto ShellCodeError
    endif
    set RegistryErrorIndex = $($R0)
    Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        EndWait
        goto fatalregistry
    endif
   Set SxbSoftServiceKey      = $($R1)
    Set SxbSoftParameterKey    = $($R2)
    Set SxbSoftLinkageKey      = $($R3)

; ********************************************************************************
   ; Now create the service for the DigiX25
; ********************************************************************************
   Shell $(UtilityInf), CreateService $(X25ProductServiceName),$(X25ProductSoftwareDisplayName), +
	$(X25ProductSoftwareImagePath), +
	"kernel",$(X25Group),{"NdisTapi"},"",$(X25EventFile),$(X25TypeSupported),"",$(ErrorControlValue), +
	$(X25ProductServiceName),"",""

    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
        goto fatalregistry
    endif
    Set X25SoftServiceKey      = $($R1)
    Set X25SoftParameterKey    = $($R2)
    Set X25SoftLinkageKey      = $($R3)

    set NewValueList = +
        {{OtherDependencies, $(NoTitle), $(!REG_VT_MULTI_SZ), {"DigiSxb"} }}
    Shell  $(UtilityInf), AddValueList, $(X25SoftLinkageKey), $(NewValueList)

; ****************************************************************
; **** Begin Installing Software Products
;*****************************************************************
    ; Perform software product installation for the hardware portion of the product
    ; The InstallsoftwareProduct shell essentially creates under the HKEY_LOCAL_MACHINE\
    ; SOFTWARE\ key the DigiBoard\DigiSxb\CurrentVersion\NetRules subkeys hierarchy.

    Shell $(UtilityInf), InstallSoftwareProduct $(Manufacturer) $(ProductHardwareName) +
        $(STF_CONTEXTINFNAME)
    ifint $($ShellCode) != $(!SHELL_CODE_OK)
        Debug-Output "ShellCode error."
        goto ShellCodeError
    endif
    set RegistryErrorIndex = $($R0)
    Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        EndWait
        goto fatalregistry
    endif
    Set SxbSoftProductKey      = $($R1)
    Set SxbSoftNetRuleKey      = $($R2)

    ; Perform software product installation for the software portion of the product
    ; The InstallsoftwareProduct shell essentially creates under the HKEY_LOCAL_MACHINE\
    ; SOFTWARE\ key the DigiBoard\DigiX25\CurrentVersion\NetRules subkeys hierarchy.

    Shell $(UtilityInf), InstallSoftwareProduct $(Manufacturer) $(X25ProductSoftwareName) +
        $(STF_CONTEXTINFNAME)
    ifint $($ShellCode) != $(!SHELL_CODE_OK)
        Debug-Output "ShellCode error."
        goto ShellCodeError
    endif
    set RegistryErrorIndex = $($R0)
    Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        EndWait
        goto fatalregistry
    endif
    Set X25SoftProductKey      = $($R1)
    Set X25SoftNetRuleKey      = $($R2)

;*****************************************************************
;Software Registration for DigiX25 Driver.
;*****************************************************************
    set DigiSpecificString = "Software Registration for DigiX25 Driver"
    set NewValueList = +
	{{SoftwareType,$(NoTitle),$(!REG_VT_SZ),$(SoftwareType)},+
        {MajorVersion,$(NoTitle),$(!REG_VT_SZ),$(ProductMajorVersion)},+
        {MinorVersion,$(NoTitle),$(!REG_VT_SZ),$(ProductMinorVersion)},+
        {Title,$(NoTitle),$(!REG_VT_SZ),$(X25ProductSoftwareTitle)},+
        {Description,$(NoTitle),$(!REG_VT_SZ),$(X25ProductSoftwareDescription)},+
        {ServiceName,$(NoTitle),$(!REG_VT_SZ),$(X25ProductServiceName)},+
        {hidden,$(NoTitle),$(!REG_VT_DWORD),$(X25SoftwareHiddenDriver)}, +
        {InstallDate,$(NoTitle),$(!REG_VT_DWORD),*($(Now),1)}, +
	{RefCount,$(NoTitle),$(!REG_VT_DWORD),$(X25SoftwareRefCount)}}
    Shell  $(UtilityInf), AddValueList, $(X25SoftProductKey), $(NewValueList)
    ifint $($ShellCode) != $(!SHELL_CODE_OK)
        Debug-Output "ShellCode error: AddValueList FAILED!  --"$(X25SoftProductKey)
        goto ShellCodeError
    endif
    set RegistryErrorIndex = $($R0)
    Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        EndWait
        Debug-Output "Registry error: add value list."
        CloseRegKey $(X25SoftProductKey)
        CloseRegKey $(X25SoftNetRuleKey)
        CloseRegKey $(X25SoftServiceKey)
        CloseRegKey $(X25SoftParameterKey)
        CloseRegKey $(X25SoftLinkageKey)
        goto fatalregistry
    endif

    set X25NetRuleInfNameSoftware  =  $(STF_CONTEXTINFNAME)

    Shell  $(UtilityInf), ReduceInfPath, $(X25NetRuleInfNameSoftware)
    ifint $($ShellCode) != $(!SHELL_CODE_OK)
        Debug-Output "ShellCode error: ReduceInfPath FAILED  -- "$(X25NetRuleInfNameSoftware)
        goto ShellCodeError
    endif
    set X25NetRuleInfNameSoftware = $($R0)

    set NewValueList = +
	   {{type,$(NoTitle),$(!REG_VT_SZ),$(X25NetRuleSoftwareType)},+
            {use,$(NoTitle),$(!REG_VT_SZ),$(X25NetRuleSoftwareUse)}, +
            {bindform,$(NoTitle),$(!REG_VT_SZ),$(X25NetRuleSoftwareBindForm)}, +
            {class,$(NoTitle),$(!REG_VT_MULTI_SZ),$(X25NetRuleSoftwareClass)}, +
            {bindable,$(NoTitle),$(!REG_VT_MULTI_SZ),$(X25NetRuleSoftwareBindable)}, +
            {InfOption,$(NoTitle),$(!REG_VT_SZ),$(X25NetRuleInfOption)} +
	    {InfName,$(NoTitle),$(!REG_VT_SZ),$(X25NetRuleInfNameSoftware)}}
    Shell  $(UtilityInf), AddValueList, $(X25SoftNetRuleKey), $(NewValueList)
    ifint $($ShellCode) != $(!SHELL_CODE_OK)
        Debug-Output "ShellCode error: AddValueList FAILED! --"$(X25SoftNetRuleKey)
        goto ShellCodeError
    endif
    set RegistryErrorIndex = $($R0)
    FlushRegKey $(X25SoftProductKey)
    FlushRegKey $(X25SoftNetRuleKey)
    FlushRegKey $(X25SoftServiceKey)
    FlushRegKey $(X25SoftParameterKey)
    FlushRegKey $(X25SoftLinkageKey)
    CloseRegKey $(X25SoftProductKey)
    CloseRegKey $(X25SoftNetRuleKey)
    CloseRegKey $(X25SoftServiceKey)
    CloseRegKey $(X25SoftParameterKey)
    CloseRegKey $(X25SoftLinkageKey)
    Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
      EndWait
      Debug-Output "Registry error: add value list."
      goto fatalregistry
    endif

;*******************************************************************
;End Software Registration for DigiX25 Driver.
;*******************************************************************
;
;*******************************************************************
;Begin Software Registration for DigiSxb Driver.
;*******************************************************************
    set DigiSpecificString = "Software Registration for DigiSxb Driver"
    set NewValueList = +
	{{SoftwareType,$(NoTitle),$(!REG_VT_SZ),$(SoftwareType)},+
        {MajorVersion,$(NoTitle),$(!REG_VT_SZ),$(ProductMajorVersion)},+
        {MinorVersion,$(NoTitle),$(!REG_VT_SZ),$(ProductMinorVersion)},+
        {Title,$(NoTitle),$(!REG_VT_SZ),$(SxbProductSoftwareTitle)},+
        {Description,$(NoTitle),$(!REG_VT_SZ),$(SxbProductSoftwareDescription)},+
        {ServiceName,$(NoTitle),$(!REG_VT_SZ),$(SxbProductServiceName)},+
        {hidden,$(NoTitle),$(!REG_VT_DWORD),$(SxbSoftwareHiddenDriver)}, +
        {InstallDate,$(NoTitle),$(!REG_VT_DWORD),*($(Now),1)}, +
	{RefCount,$(NoTitle),$(!REG_VT_DWORD),$(SxbSoftwareRefCount)}}
    Shell  $(UtilityInf), AddValueList, $(SxbSoftProductKey), $(NewValueList)
    ifint $($ShellCode) != $(!SHELL_CODE_OK)
        Debug-Output "ShellCode error: AddValueList FAILED!  --"$(SxbSoftProductKey)
        goto ShellCodeError
    endif
    set RegistryErrorIndex = $($R0)
    Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        EndWait
        Debug-Output "Registry error: add value list."
        CloseRegKey $(SxbSoftProductKey)
        CloseRegKey $(SxbSoftNetRuleKey)
        CloseRegKey $(SxbSoftServiceKey)
        CloseRegKey $(SxbSoftParameterKey)
        CloseRegKey $(SxbSoftLinkageKey)
        goto fatalregistry
    endif

    set SxbNetRuleInfNameSoftware  =  $(STF_CONTEXTINFNAME)

    Shell  $(UtilityInf), ReduceInfPath, $(SxbNetRuleInfNameSoftware)
    ifint $($ShellCode) != $(!SHELL_CODE_OK)
        Debug-Output "ShellCode error: ReduceInfPath FAILED  -- "$(SxbNetRuleInfNameSoftware)
        goto ShellCodeError
    endif
   set SxbNetRuleInfNameSoftware = $($R0)

    set NewValueList = +
	   {{type,$(NoTitle),$(!REG_VT_SZ),$(SxbNetRuleSoftwareType)},+
            {use,$(NoTitle),$(!REG_VT_SZ),$(SxbNetRuleSoftwareUse)}, +
            {bindform,$(NoTitle),$(!REG_VT_SZ),$(SxbNetRuleSoftwareBindForm)}, +
            {class,$(NoTitle),$(!REG_VT_MULTI_SZ),$(SxbNetRuleSoftwareClass)}, +
            {bindable,$(NoTitle),$(!REG_VT_MULTI_SZ),$(SxbNetRuleSoftwareBindable)}, +
            {InfOption,$(NoTitle),$(!REG_VT_SZ),$(SxbNetRuleInfOption)} +
	    {InfName,$(NoTitle),$(!REG_VT_SZ),$(SxbNetRuleInfNameSoftware)}}
    Shell  $(UtilityInf), AddValueList, $(SxbSoftNetRuleKey), $(NewValueList)
    ifint $($ShellCode) != $(!SHELL_CODE_OK)
        Debug-Output "ShellCode error: AddValueList FAILED! --"$(SxbSoftNetRuleKey)
        goto ShellCodeError
    endif
    set RegistryErrorIndex = $($R0)
    FlushRegKey $(SxbSoftProductKey)
    FlushRegKey $(SxbSoftNetRuleKey)
    FlushRegKey $(SxbSoftServiceKey)
    FlushRegKey $(SxbSoftParameterKey)
    FlushRegKey $(SxbSoftLinkageKey)
    CloseRegKey $(SxbSoftProductKey)
    CloseRegKey $(SxbSoftNetRuleKey)
    CloseRegKey $(SxbSoftServiceKey)
    CloseRegKey $(SxbSoftParameterKey)
    CloseRegKey $(SxbSoftLinkageKey)
    Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
      EndWait
      Debug-Output "Registry error: add value list."
      goto fatalregistry
    endif

;**********************************************************
;End Software Registration for DigiSxb Driver.
;**********************************************************

endif
; end if for OldVersionExisted if
; That is do the following every time an adapter is added regardless
; of whether an old Version existed

    ifstr(i) $(!STF_NCDETINFO) == {}
        Shell $(UtilityInf),GetBusTypeDialog,$(ProductHardwareDescription) $(BusInterfaceType) $(BusNumber)
        ifint $($ShellCode) != $(!SHELL_CODE_OK)
            Debug-Output "ShellCode error."
            goto ShellCodeError
        endif
        set BusInterfaceType = $($R1)
        set BusNumber = $($R2)
    else
        set BusInterfaceType = *($(!STF_NCDETINFO),5)
        set BusNumber = *($(!STF_NCDETINFO),6)
    endif

		ifstr $(BusInterfaceType) == 5
			set AdapterBiosImagePath = $(AdapterBiosImagePathPCI)
			set AdapterSxbImagePath  = $(AdapterSxbImagePathPCI)
		else
			set AdapterBiosImagePath = $(AdapterBiosImagePathISA)
			set AdapterSxbImagePath  = $(AdapterSxbImagePathISA)
		endif

;*******************************************************************
;Begin Software Registration for Windows NT Digi X.25 Virtual Adapter.
;*******************************************************************
    Debug-Output "******************Entering addAdapterComponent******************"
    set DigiSpecificString = "Registration for Windows NT Digi X.25 Virtual Adapter"
    Shell $(UtilityInf), AssignAdapterNumber, "", "1000"
	  ifint $($ShellCode) != $(!SHELL_CODE_OK)
	  	Debug-Output "Cannot add hardware component!"
	    goto ShellCodeError
	  endif
		set AdapterNum = $($R1);

    Shell $(UtilityInf), AddHardwareComponent, $(X25HardwareName), $(STF_CONTEXTINFNAME), $(X25ProductKeyName), "", "", $(AdapterNum)
    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"
        Debug-Output $(RegistryErrorIndex)
        CloseRegKey $($R1)
        CloseRegKey $($R2)
        CloseRegKey $($R3)
        goto fatalregistry
    endif
    set AdapterKeyNetcard    = $($R1)
    set AdapterNetRulesKey   = $($R2)
    set VAAdapterKeyParameters = $($R3)

    set AdapterNumber        = $($R4)
		set X25VANum = $(AdapterNumber)

    set AdapterServiceName   = $($R5)
    set X25VANameNumber = $(AdapterServiceName)

    set NewValueList = {{ServiceName,$(NoTitle),$(!REG_VT_SZ),$(AdapterServiceName)},+
		       {Manufacturer,$(NoTitle),$(!REG_VT_SZ),$(Manufacturer)},+
                       {Title,$(NoTitle),$(!REG_VT_SZ),"["$(AdapterNumber)"] "$(X25HardwareTitle)},+
                       {Description,$(NoTitle),$(!REG_VT_SZ),$(X25HardwareDescription)},+
                       {ProductName,$(NoTitle),$(!REG_VT_SZ),$(X25HardwareName)},+
                       {InstallDate,$(NoTitle),$(!REG_VT_DWORD),*($(Now),1)},		 +
                       {Hidden,$(NoTitle),$(!REG_VT_DWORD),$(TRUE)}}
    Shell  $(UtilityInf), AddValueList, $(AdapterKeyNetcard), $(NewValueList)
    ifint $($ShellCode) != $(!SHELL_CODE_OK)
        Debug-Output "ShellCode error: AddValueList FAILED  -- "$(AdapterKeyNetcard)
        goto ShellCodeError
    endif

    set AdapterNetRuleInfName = $(STF_CONTEXTINFNAME)
    Shell  $(UtilityInf), ReduceInfPath, $(AdapterNetRuleInfName)
    ifint $($ShellCode) != $(!SHELL_CODE_OK)
        Debug-Output "ShellCode error: ReduceInfPath FAILED  -- "$(AdapterNetRuleInfName)
        goto ShellCodeError
    endif
    set AdapterNetRuleInfName = $($R0)
    set TempProdName = """"$(X25HardwareName)$(AdapterNumber)""""
    set TempBindForm = $(TempProdName)$(X25NetRuleBindForm)
    set NewValueList = {{InfName,$(NoTitle),$(!REG_VT_SZ),$(AdapterNetRuleInfName)},+
                        {type,$(NoTitle),$(!REG_VT_SZ),$(X25NetRuleType)},+
                        {bindform,$(NoTitle),$(!REG_VT_SZ),$(TempBindForm)}, +
                        {class,$(NoTitle),$(!REG_VT_MULTI_SZ),$(X25NetRuleClass)}, +
                        {InfOption,$(NoTitle),$(!REG_VT_SZ),$(X25NetRulesInfOption)}}
    Shell  $(UtilityInf), AddValueList, $(AdapterNetRulesKey), $(NewValueList)
    ifint $($ShellCode) != $(!SHELL_CODE_OK)
        Debug-Output "ShellCode error."
        goto ShellCodeError
    endif
    set RegistryErrorIndex = $($R0)
    Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        EndWait
        Debug-Output "Resgitry error: add value list."
        CloseRegKey $(AdapterNetRulesKey)
        goto fatalregistry
    endif

    FlushRegKey $(AdapterNetRulesKey)
    CloseRegKey $(AdapterNetRulesKey)

;*****************************************************************
;End Software Registration for Windows NT Digi X.25 Virtual Adapter
;*****************************************************************

;*******************************************************************
;Begin Software Registration for Windows NT Digi X.25 Adapter.
;*******************************************************************
addAdapterComponent = + 
    Debug-Output "******************Entering addAdapterComponent******************"
    set DigiSpecificString = "Registration for Windows NT Digi X.25 Adapter"
    Shell $(UtilityInf), AddHardwareComponent, $(AdapterHardwareName), +
                                    $(STF_CONTEXTINFNAME), $(SxbProductKeyName)
    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"
        Debug-Output $(RegistryErrorIndex)
        CloseRegKey $($R1)
        CloseRegKey $($R2)
        CloseRegKey $($R3)
        goto fatalregistry
    endif
    set AdapterKeyNetcard    = $($R1)
    set AdapterNetRulesKey   = $($R2)
    set AdapterKeyParameters = $($R3)
    set AdapterNumber        = $($R4)
    set AdapterServiceName   = $($R5)
    set AdapterName = $(AdapterServiceName)
    set NewValueList = {{ServiceName,$(NoTitle),$(!REG_VT_SZ),$(AdapterServiceName)},+
		       {Manufacturer,$(NoTitle),$(!REG_VT_SZ),$(Manufacturer)},+
                       {Title,$(NoTitle),$(!REG_VT_SZ),"["$(AdapterNumber)"] "$(AdapterHardwareTitle)},+
                       {Description,$(NoTitle),$(!REG_VT_SZ),$(AdapterHardwareDescription)},+
                       {ProductName,$(NoTitle),$(!REG_VT_SZ),$(AdapterHardwareName)},+
                       {InstallDate,$(NoTitle),$(!REG_VT_DWORD),*($(Now),1)}}
    Shell  $(UtilityInf), AddValueList, $(AdapterKeyNetcard), $(NewValueList)
    ifint $($ShellCode) != $(!SHELL_CODE_OK)
        Debug-Output "ShellCode error: AddValueList FAILED  -- "$(AdapterKeyNetcard)
        goto ShellCodeError
    endif

    set AdapterNameNumber = $(AdapterHardwareName)$(AdapterNumber)
    set AdapterNetRuleInfName = $(STF_CONTEXTINFNAME)
    Shell  $(UtilityInf), ReduceInfPath, $(AdapterNetRuleInfName)
    ifint $($ShellCode) != $(!SHELL_CODE_OK)
        Debug-Output "ShellCode error: ReduceInfPath FAILED  -- "$(AdapterNetRuleInfName)
        goto ShellCodeError
    endif
    set AdapterNetRuleInfName = $($R0)
    set TempProdName = """"$(AdapterHardwareName)$(AdapterNumber)""""
    set TempBindForm = $(TempProdName)$(AdapterNetRuleBindForm)
    set NewValueList = {{InfName,$(NoTitle),$(!REG_VT_SZ),$(AdapterNetRuleInfName)},+
                        {type,$(NoTitle),$(!REG_VT_SZ),$(AdapterNetRuleType)},+
                        {bindform,$(NoTitle),$(!REG_VT_SZ),$(TempBindForm)}, +
                        {class,$(NoTitle),$(!REG_VT_MULTI_SZ),$(AdapterNetRuleClass)}, +
                        {InfOption,$(NoTitle),$(!REG_VT_SZ),$(AdapterNetRulesInfOption)}}
    Shell  $(UtilityInf), AddValueList, $(AdapterNetRulesKey), $(NewValueList)
    ifint $($ShellCode) != $(!SHELL_CODE_OK)
        Debug-Output "ShellCode error."
        goto ShellCodeError
    endif
    set RegistryErrorIndex = $($R0)
    Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        EndWait
        Debug-Output "Resgitry error: add value list."
        CloseRegKey $(AdapterNetRulesKey)
        goto fatalregistry
    endif
    FlushRegKey $(AdapterNetRulesKey)
    CloseRegKey $(AdapterNetRulesKey)

;*****************************************************************
;End Software Registration for Windows NT Digi X.25 Adapter
;*****************************************************************

;*****************************************************************
;Continue Service Registration for SYSTEM\CurrentControlSet\Services\DigiX25# X.25 Virtual Adapter
;*****************************************************************
writeparameters = +
    Debug-Output "******************Entering writeparameters******************"
    set DigiSpecificString = "Service Registration...CurrentControlSet...DigiSxb# X.25 Adapter"
    StartWait

    SetRegValue $(VAAdapterKeyParameters) {SxbDeviceA,$(NoTitle),$(!REG_VT_SZ),"\Device\"$(AdapterNameNumber)"A"}
    SetRegValue $(VAAdapterKeyParameters) {SxbDeviceB,$(NoTitle),$(!REG_VT_SZ),"\Device\"$(AdapterNameNumber)"B"}
    SetRegValue $(VAAdapterKeyParameters) {MaxSendWindow,$(NoTitle),$(!REG_VT_DWORD),$(X25MaxSendWindow)}
    SetRegValue $(VAAdapterKeyParameters) {BusNumber,$(NoTitle),$(!REG_VT_DWORD),$(BusNumber)}
    SetRegValue $(VAAdapterKeyParameters) {BusType,$(NoTitle),$(!REG_VT_DWORD),$(BusInterfaceType)}
    SetRegValue $(VAAdapterKeyParameters) {ServiceName,$(NoTitle),$(!REG_VT_SZ),$(X25VANameNumber)}

    FlushRegKey $(AdapterNameNumberBaseKey)
    FlushRegKey $(AdapterTempServiceBaseKey)
    FlushRegKey $(VAAdapterKeyParameters)
    CloseRegKey $(AdapterTempServiceBaseKey)
    CloseRegKey $(AdapterNameNumberBaseKey)
    CloseRegKey $(VAAdapterKeyParameters)
    EndWait

;***********************************************************************************
;End Service Registration for SYSTEM\CurrentControlSet\Services\DigiX25# X.25 Virtual Adapter
;***********************************************************************************

;*****************************************************************
;Continue Service Registration for SYSTEM\CurrentControlSet\Services\DigiSxb# X.25 Adapter
;*****************************************************************
writeparameters = +
    Debug-Output "******************Entering writeparameters******************"
    set DigiSpecificString = "Service Registration...CurrentControlSet...DigiSxb# X.25 Adapter"
    StartWait

    SetRegValue $(AdapterKeyParameters) {MemoryMappedBaseAddress,$(NoTitle),$(!REG_VT_DWORD),$(AdapterMemoryAddress)}
    SetRegValue $(AdapterKeyParameters) {IOBaseAddress,$(NoTitle),$(!REG_VT_DWORD),$(AdapterIOBaseAddress)}
    SetRegValue $(AdapterKeyParameters) {InterruptNumber,$(NoTitle),$(!REG_VT_DWORD),$(AdapterInterruptNumber)}
    SetRegValue $(AdapterKeyParameters) {HdwDeviceName,$(NoTitle),$(!REG_VT_SZ),$(AdapterProductName)}
    SetRegValue $(AdapterKeyParameters) {SxbImagePath,$(NoTitle),$(!REG_VT_SZ),$(AdapterSxbImagePath)}
    SetRegValue $(AdapterKeyParameters) {BiosImagePath,$(NoTitle),$(!REG_VT_SZ),$(AdapterBiosImagePath)}
    SetRegValue $(AdapterKeyParameters) {NetworkAddress,$(NoTitle),$(!REG_VT_SZ),$(AdapterNetworkAddress)}
    SetRegValue $(AdapterKeyParameters) {WindowSize,$(NoTitle),$(!REG_VT_DWORD),$(AdapterWindowSize)}
    SetRegValue $(AdapterKeyParameters) {BusNumber,$(NoTitle),$(!REG_VT_DWORD),$(BusNumber)}
    SetRegValue $(AdapterKeyParameters) {BusType,$(NoTitle),$(!REG_VT_DWORD),$(BusInterfaceType)}
    SetRegValue $(AdapterKeyParameters) {ServiceName,$(NoTitle),$(!REG_VT_SZ),$(AdapterServiceName)}
    SetRegValue $(AdapterKeyParameters) {VANum,$(NoTitle),$(!REG_VT_DWORD),$(X25VANum)}
    SetRegValue $(AdapterKeyParameters) {DigiSupport,$(NoTitle),$(!REG_VT_SZ),$(DigiSupport)}
		SetRegValue $(AdapterKeyParameters) {DigiNumPorts,$(NoTitle),$(!REG_VT_DWORD),$(DigiNumPorts)}
		
		FlushRegKey $(AdapterNameNumberBaseKey)
    FlushRegKey $(AdapterKeyParameters)
    FlushRegKey $(AdapterTempServiceBaseKey)
    CloseRegKey $(AdapterTempServiceBaseKey)
    CloseRegKey $(AdapterNameNumberBaseKey)
    CloseRegKey $(AdapterKeyParameters)
    EndWait

;***********************************************************************************
;End Service Registration for SYSTEM\CurrentControlSet\Services\DigiSxb# X.25 Adapter
;***********************************************************************************

ifint $(OldVersionExisted) == $(FALSE)

;***********************************************************************************
;Begin to flesh out the System\CurrentControlSet\Services\DigiSxb Registry hierarchy
;***********************************************************************************
    set DigiSpecificString = "Flesh out...\CurrentControlSet\...\DigiSxb Registry hierarchy"
    StartWait
    Shell   $(UtilityInf),BaseServiceKey
    set RegistryErrorIndex = $($R0)
    ifstr(i) $(RegistryErrorIndex) != NO_ERROR
      set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
      goto fatalregistry
    endif
    set ServicesbasedKey = $($R1)
    ifstr(i) $(ServicesbasedKey) == $(KeyNull)
       Debug-Output "Unable to Open ServicesbasedKey"
       set RegistryErrorIndex = UNABLE_ACCESS_SOFTWARE_REG
       goto fatalregistry
    endif
    OpenRegKey $(ServicesbasedKey) "" "DigiSxb" $(MAXIMUM_ALLOWED) SxbServiceDigiSxbKey
    ifstr(i) $(SxbServiceDigiSxbKey) == $(KeyNull)
       Debug-Output "Unable to Open SxbServiceDigiSxbKey" 
       set RegistryErrorIndex = UNABLE_ACCESS_SOFTWARE_REG
       CloseRegKey $(ServicesbasedKey)
       goto fatalregistry
    endif
    OpenRegKey $(SxbServiceDigiSxbKey) "" "Parameters" $(MAXIMUM_ALLOWED) +
	SxbServiceParametersKey
    ifstr(i) $(SxbServiceParametersKey) == $(KeyNull)
       Debug-Output "Unable to Open SxbServiceParametersKey"
       set RegistryErrorIndex = UNABLE_ACCESS_SOFTWARE_REG
       CloseRegKey $(ServicesbasedKey)
       CloseRegKey $(SxbServiceDigiSxbKey)
       goto fatalregistry
    endif

    SetRegValue $(SxbServiceParametersKey) {NetworkAddress,$(NoTitle),$(!REG_VT_SZ),$(SxbNetworkAddress)}

    CreateRegKey $(SxbServiceParametersKey) {$(SxbServiceFacility),$(NoTitle),GenericClass} "" +
		$(MAXIMUM_ALLOWED) "" SxbServiceFacilityKey
    ifstr $(SxbServiceFacilityKey) == $(KeyNull)

       OpenRegKey $(SxbServiceParametersKey) "" $(SxbServiceFacility) $(MAXIMUM_ALLOWED) +
	  SxbServiceFacilityKey
       ifstr(i) $(SxbServiceFacilityKey) == $(KeyNull)
          Debug-Output "Unable to Open SxbServiceParametersKey"
          set RegistryErrorIndex = UNABLE_ACCESS_SOFTWARE_REG
          Debug-Output "Unable to Create or Open SxbServiceFacilityKey"
          CloseRegKey $(ServicesbasedKey)
          CloseRegKey $(SxbServiceDigiSxbKey)
          CloseRegKey $(SxbServiceParametersKey)
          goto fatalregistry
       endif
    endif
    set NewValueList = +
	         {{DevName,$(NoTitle),$(!REG_VT_SZ),$(SxbdevWans)},+
                  {Facility,$(NoTitle),$(!REG_VT_SZ),$(SxbWanS)}}
    Shell  $(UtilityInf), AddValueList, $(SxbServiceFacilityKey),$(NewValueList)
    ifint $($ShellCode) != $(!SHELL_CODE_OK)
        Debug-Output "ShellCode error: AddValueList FAILED! --"$(SxbServiceFacilityKey)
        CloseRegKey $(SxbServiceFacilityKey)
        CloseRegKey $(ServicesbasedKey)
        CloseRegKey $(SxbServiceDigiSxbKey)
        CloseRegKey $(SxbServiceParametersKey)
        goto ShellCodeError
    endif
    set RegistryErrorIndex = $($R0)
    Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        EndWait
        Debug-Output "Registry error: add value list."
        CloseRegKey $(SxbServiceFacilityKey)
        CloseRegKey $(ServicesbasedKey)
        CloseRegKey $(SxbServiceDigiSxbKey)
        CloseRegKey $(SxbServiceParametersKey)
        goto fatalregistry
    endif

    FlushRegKey $(SxbServiceFacilityKey)
    FlushRegKey $(SxbServiceParametersKey)
    FlushRegKey $(SxbServiceDigiSxbKey)
    FlushRegKey $(ServicesbasedKey) 
   
    CloseRegKey $(SxbServiceFacilityKey)
    CloseRegKey $(ServicesbasedKey)
    CloseRegKey $(SxbServiceDigiSxbKey)
    CloseRegKey $(SxbServiceParametersKey)
    EndWait
;***********************************************************************************
;End fleshing out System\CurrentControlSet\Services\DigiSxb Registry hierarchy
;***********************************************************************************

;************************************************************************************
;Begin to flesh out the System\CurrentControlSet\Services\DigiX25 Registry hierarchy
;************************************************************************************
    set DigiSpecificString = "Flesh out...CurrentControlSet...DigiX25 Registry hierarchy"
    Shell   $(UtilityInf),BaseServiceKey
    set RegistryErrorIndex = $($R0)
    ifstr(i) $(RegistryErrorIndex) != NO_ERROR
      set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
      goto fatalregistry
    endif
    set ServicesbasedKey = $($R1)
    ifstr(i) $(ServicesbasedKey) == $(KeyNull)
       Debug-Output "Unable to Open ServicesbasedKey"
       set RegistryErrorIndex = UNABLE_ACCESS_SOFTWARE_REG
       goto fatalregistry
    endif
    OpenRegKey $(ServicesbasedKey) "" "DigiX25" $(MAXIMUM_ALLOWED) +
	X25ServiceDigiX25Key
    ifstr(i) $(X25ServiceDigiX25Key) == $(KeyNull)
       Debug-Output "Unable to Open X25ServiceDigiX25Key" 
       set RegistryErrorIndex = UNABLE_ACCESS_SOFTWARE_REG
       CloseRegKey $(ServicesbasedKey)
       goto fatalregistry
    endif
    OpenRegKey $(X25ServiceDigiX25Key) "" "Parameters" $(MAXIMUM_ALLOWED) +
	X25ServiceParametersKey
    ifstr(i) $(X25ServiceParametersKey) == $(KeyNull)
       Debug-Output "Unable to Open X25ServiceParametersKey"
       set RegistryErrorIndex = UNABLE_ACCESS_SOFTWARE_REG
       CloseRegKey $(ServicesbasedKey)
       CloseRegKey $(X25ServiceDigiX25Key)
       goto fatalregistry
    endif
;    set NewValueList = +
;	      {{Group,$(NoTitle),$(!REG_VT_SZ),$(X25Group)}	+
;	      }
;    Shell  $(UtilityInf), AddValueList, $(X25ServiceDigiX25Key), $(NewValueList)
;    ifint $($ShellCode) != $(!SHELL_CODE_OK)
;        Debug-Output "ShellCode error: AddValueList FAILED!  --"$(X25ServiceDigiX25Key)
;        CloseRegKey $(ServicesbasedKey)
;        CloseRegKey $(X25ServiceDigiX25Key)
;        CloseRegKey $(X25ServiceParametersKey)
;        goto ShellCodeError
;    endif
;    set RegistryErrorIndex = $($R0)
;    Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
;        EndWait
;        Debug-Output "Registry error: add value list."
;        CloseRegKey $(ServicesbasedKey)
;        CloseRegKey $(X25ServiceDigiX25Key)
;        CloseRegKey $(X25ServiceParametersKey)
;        goto fatalregistry
;    endif
    set NewValueList = +
	         {{BusType,$(NoTitle),$(!REG_VT_DWORD),$(BusInterfaceType)},+
            {BusNumber,$(NoTitle),$(!REG_VT_DWORD),$(BusNumber)},+
   		  {NetworkAddress,$(NoTitle),$(!REG_VT_SZ),$(X25NetworkAddress)}}
    Shell  $(UtilityInf), AddValueList, $(X25ServiceParametersKey),$(NewValueList)
    ifint $($ShellCode) != $(!SHELL_CODE_OK)
        Debug-Output "ShellCode error: AddValueList FAILED! --"$(SxbServiceFacilityKey)
        CloseRegKey $(ServicesbasedKey)
        CloseRegKey $(X25ServiceDigiX25Key)
        CloseRegKey $(X25ServiceParametersKey)
        goto ShellCodeError
    endif
    set RegistryErrorIndex = $($R0)
    Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        EndWait
        Debug-Output "Registry error: add value list."
        CloseRegKey $(ServicesbasedKey)
        CloseRegKey $(X25ServiceDigiX25Key)
        CloseRegKey $(X25ServiceParametersKey)
        goto fatalregistry
    endif

    FlushRegKey $(ServicesbasedKey)
    FlushRegKey $(X25ServiceDigiX25Key)
    FlushRegKey $(X25ServiceParametersKey)

    CloseRegKey $(ServicesbasedKey)
    CloseRegKey $(X25ServiceDigiX25Key)
    CloseRegKey $(X25ServiceParametersKey)

;************************************************************************************
;End fleshing out System\CurrentControlSet\Services\DigiX25 Registry hierarchy
;************************************************************************************
;  This is the end of the if for OldVersionExisted  
endif

    goto adapteroptions

configureadapter = +
                Debug-Output "OEMNADX.INF: Configure Adapter"	
    Ifstr $(!NTN_RegBase) != $(KeyNull)
        OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_RegBase) $(MAXIMUM_ALLOWED) SoftwareKey
        Ifstr $(SoftwareKey) == $(KeyNull)
          Debug-Output "Unable to open "$(!NTN_RegBase)" key!!!!"
          goto ShellCodeError
        Else
          GetRegValue $(SoftwareKey), "ServiceName", ServiceNameList
          set AdapterServiceName = *($(ServiceNameList),4)
          set AdapterNameNumber = $(AdapterServiceName)

	    		OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_ServiceBase)"\"$(AdapterServiceName)"\Parameters" +
	    								$(MAXIMUM_ALLOWED) ServiceKey
  	  		Ifstr $(ServiceKey) != $(KeyNull)
    				GetRegValue $(ServiceKey), "VANum", X25VANumList
     				set X25VANum = *($(X25VANumList),4)
      			CloseRegKey $(ServiceKey)
					endif

          CloseRegKey $(SoftwareKey)
        Endif
    Endif

adapteroptions = +
    StartWait
    ifint $(OldVersionExisted) == $(FALSE)
        ifstr(i) $(!NTN_InstallMode) == "install"
           Ifstr(i) $(DoCopy) == "YES"
badpath = +
              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)
                      Debug-Output"Shell code error: DoAskSource"
                      goto ShellCodeError
                  endif
                  set Error = $($R0)
                  Goto fatal
              Else-Ifstr(i) $($R0) == STATUS_USERCANCEL
                  set CommonStatus = STATUS_USERCANCEL
                  Goto abandon
              Endif
              Set SrcDir = $($R1)
					    LibraryProcedure STATUS, $(!LIBHANDLE),CheckFileExistance $(SrcDir)"\DigiWan.dl_"
							ifstr(i) $(STATUS) != YES
								goto badpath
							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
    endif
    LoadLibrary "x" $(!STF_CWDDIR)setupdll.dll !LIBHANDLE
    Debug-Output "OEMNADX.INF: LIBHANDLE is "$(!LIBHANDLE)

    LibraryProcedure STATUS, $(!LIBHANDLE),CheckFileExistance $(!STF_WINDOWSSYSPATH)"\DigiWan.dll"
    ifstr(i) $(STATUS) != YES
      set Error = ""
      goto fatal
		endif

    Debug-Output "OEMNADX.INF: RegBase "$(!NTN_RegBase)
    LoadLibrary "x" $(!STF_CWDDIR)DigiWan.dll DigiHANDLE
    Debug-Output "OEMNADX.INF: DigiHANDLE is "$(DigiHANDLE)
    Shell $(subroutineinf) PopBillboard
    LibraryProcedure Result $(DigiHANDLE) DigiEntry $(AdapterNameNumber) $(!STF_HWND)
    Debug-Output "OEMNADX.INF: Dialog Result is "$(Result)

		FreeLibrary $(DigiHANDLE)

    Ifstr(i) $(Result) == "OK"

;***********************************************************************************
; Begin creating HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\TAPIDEVICES\DigiX25 
; keys and Registry hierarchy
;***********************************************************************************
    StartWait
    set DigiSpecificString = "Flesh out... \HARDWARE\DEVICEMAP\TAPIDEVICES\DigiX25 Registry hierarchy"

;; goto to Sevices\DigiSxb#\Parameters\Port[A|B]\X25 and get the total number of ports needed
    Shell  $(UtilityInf),BaseServiceKey
    set RegistryErrorIndex = $($R0)
    Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
      set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
      goto fatalregistry
    endif
    set base = $($R1)

    set totalPortA = {}
    set X25Portkey = ""
    OpenRegKey $(base) "" $(AdapterNameNumber)"\Parameters\PortA\X25" $(MAXIMUM_ALLOWED) X25Portkey
    ifstr(i) $(X25Portkey) == $(KeyNull)
       Debug-Output $(AdapterNameNumber)"\Parameters\PortA\X25"
       Debug-Output "Unable to Open Parameters\PortA"
       goto fatalregistry
		endif
		GetRegValue $(X25Portkey) "TotalRASPorts"	totalPortA
		CloseRegKey $(X25Portkey)

    set totalPortB = {}
    set X25Portkey = ""
    OpenRegKey $(base) "" $(AdapterNameNumber)"\Parameters\PortB\X25" $(MAXIMUM_ALLOWED) X25Portkey
    ifstr(i) $(X25Portkey) == $(KeyNull)
        Debug-Output "Unable to Open Parameters\PortB\X25"
      	goto fatalregistry
		endif
		GetRegValue $(X25Portkey) "TotalRASPorts"	totalPortB
		CloseRegKey $(X25Portkey)

    OpenRegKey $(base) "" $(AdapterNameNumber)"\Parameters\PortA\Wan" $(MAXIMUM_ALLOWED) X25Wankey
    ifstr(i) $(X25Wankey) == $(KeyNull)
        Debug-Output "Unable to Open Parameters\PortA\Wan"
      	goto fatalregistry
		endif
		GetRegValue $(X25Wankey) "Wan_baud"	BaudList
		ifint *($(BaudList), 4) == 0
			GetRegValue $(X25Wankey) "Ext_baud"	BaudList
		endif
		set LineSpeedA = *($(BaudList), 4)
		CloseRegKey $(X25Wankey)

    OpenRegKey $(base) "" $(AdapterNameNumber)"\Parameters\PortB\Wan" $(MAXIMUM_ALLOWED) X25Wankey
    ifstr(i) $(X25Wankey) == $(KeyNull)
        Debug-Output "Unable to Open Parameters\PortB\Wan"
      	goto fatalregistry
		endif
		GetRegValue $(X25Wankey) "Wan_baud"	BaudList
		ifint *($(BaudList), 4) == 0
			GetRegValue $(X25Wankey) "Ext_baud"	BaudList
		endif
		set LineSpeedB = *($(BaudList), 4)
		CloseRegKey $(X25Wankey)

		set VANameNumber = $(X25HardwareName)$(X25VANum)
    OpenRegKey $(base) "" $(VANameNumber)"\Parameters" $(MAXIMUM_ALLOWED) VAParamkey
		ifstr(i) $(VAParamkey) != $(KeyNull)
	    SetRegValue $(VAParamkey) {LineSpeedA,$(NoTitle),$(!REG_VT_DWORD),$(LineSpeedA)}
	    SetRegValue $(VAParamkey) {LineSpeedB,$(NoTitle),$(!REG_VT_DWORD),$(LineSpeedB)}
	    SetRegValue $(VAParamkey) {NumVCA,$(NoTitle),$(!REG_VT_DWORD),*($(totalPortA),4)}
 	  	SetRegValue $(VAParamkey) {NumVCB,$(NoTitle),$(!REG_VT_DWORD),*($(totalPortB),4)}
			FlushRegKey $(VAParamkey)
			CloseRegKey $(VAParamkey)
		endif

		CloseRegKey $(base)

		;	totalPorts = total number of ports from PortA and PortB
		Debug-Output "PortA --> "$(totalPortA)" Port B -->"$(totalPortB)
		set-add totalPorts = *($(totalPortA), 4), *($(totalPortB), 4)
		Debug-Output "Total Ports --> "$(totalPorts)

    OpenRegKey $(!REG_H_LOCAL) "" "HARDWARE\DEVICEMAP" $(MAXIMUM_ALLOWED) DeviceMapKey
    ifstr(i) $(DeviceMapKey) == $(KeyNull)
    	Debug-Output "Unable to Open DeviceMapKey"
     	set RegistryErrorIndex = UNABLE_ACCESS_DEVICEMAP_REG
     	goto fatalregistry
    endif
    CreateRegKey $(DeviceMapKey) {"TAPI DEVICES",$(NoTitle),GenericClass} "" +
		$(MAXIMUM_ALLOWED) "" TapiDevicesKey
    ifstr $(TapiDevicesKey) == $(KeyNull)
      OpenRegKey $(DeviceMapKey) "" "TAPI DEVICES" $(MAXIMUM_ALLOWED) TapiDevicesKey
      ifstr(i) $(TapiDevicesKey) == $(KeyNull)
        Debug-Output "Unable to open TapiDevicesKey " 
        set RegistryErrorIndex = UNABLE_ACCESS_TAPIDEVICES_REG
        CloseRegKey $(DeviceMapKey)
        goto fatalregistry
      endif
    endif
    CreateRegKey $(TapiDevicesKey) {"DigiX25",$(NoTitle),GenericClass} "" +
									$(MAXIMUM_ALLOWED) "" DigiX25ServiceProviderKey
    ifstr $(DigiX25ServiceProviderKey) == $(KeyNull)
      OpenRegKey $(TapiDevicesKey) "" "DigiX25" $(MAXIMUM_ALLOWED) DigiX25ServiceProviderKey
      ifstr(i) $(DigiX25ServiceProviderKey) == $(KeyNull)
         Debug-Output "Unable to Open X25ServiceProviderKey"
         set RegistryErrorIndex = UNABLE_ACCESS_SOFTWARE_REG
         CloseRegKey $(DeviceMapKey)
         CloseRegKey $(TapiDevicesKey)
         goto fatalregistry
      endif
   	endif

    set ServiceProviderMediaType = "X25"
    set ServiceProviderNetCardNumber = $(X25VANum)
    set ServiceProviderAddress = {}
   	set BuildAddress = ""
    set BuildDigit2 = 0
    set BuildDigit3 = 0

; This loop builds the Tapi Devices Addresses 0 - totalPorts for the designated netcard
	  goto LoopTest
	LoopTop = +
    set BuildAddress = $(ServiceProviderNetCardNumber)"-"$(BuildDigit2)"-"$(BuildDigit3)
    set ServiceProviderAddress = >($(ServiceProviderAddress), $(BuildAddress))
    set-add BuildDigit2 = $(BuildDigit2), 1
	LoopTest = +
		ifint $(BuildDigit2) < $(totalPorts)
			goto LoopTop
		endif
  
    GetRegValue $(DigiX25ServiceProviderKey) "Address" PreviousValueList
    ifstr(i) $(PreviousValueList) != {}
      set PreviousAddress = *($(PreviousValueList), 4)
		endif

; This loop concatenates the new Tapi Devices Addresses onto the existing Tapi Device Addresses

    set ServiceProviderAddressFinal = {}

		ForListDo $(PreviousAddress)
			set address = *($(PreviousAddress), $(#))
			Split-String $(address), "-", addressSplit

			ifstr(i) *($(addressSplit), 1) != $(X25VANum)
	      set ServiceProviderAddressFinal = >($(ServiceProviderAddressFinal), $(address))
			endif
		EndForListDo

	  ForListDo $(ServiceProviderAddress)
      set ServiceProviderAddressFinal = >($(ServiceProviderAddressFinal), *($(ServiceProviderAddress), $(#)))
    EndForListDo

    set NewValueList = +
				{	{"Media Type",$(NoTitle),$(!REG_VT_SZ),$(ServiceProviderMediaType)}, +
       		{Address,$(NoTitle),$(!REG_VT_MULTI_SZ),$(ServiceProviderAddressFinal)} +
       	}
    Shell  $(UtilityInf), AddValueList, $(DigiX25ServiceProviderKey),$(NewValueList)
    ifint $($ShellCode) != $(!SHELL_CODE_OK)
      Debug-Output "ShellCode error: AddValueList FAILED!  --"$(DigiX25ServiceProviderKey)
      CloseRegKey $(DeviceMapKey)
      CloseRegKey $(TapiDevicesKey)
      CloseRegKey $(DigiX25ServiceProviderKey)
      goto ShellCodeError
    endif
    set RegistryErrorIndex = $($R0)
    Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
      EndWait
      Debug-Output "Registry error: add value list."
      CloseRegKey $(DeviceMapKey)
      CloseRegKey $(TapiDevicesKey)
      CloseRegKey $(DigiX25ServiceProviderKey)
      goto fatalregistry
    endif

    FlushRegKey $(DeviceMapKey)
    FlushRegKey $(TapiDevicesKey)
    FlushRegKey $(DigiX25ServiceProviderKey)

    CloseRegKey $(DeviceMapKey)
    CloseRegKey $(TapiDevicesKey)
    CloseRegKey $(DigiX25ServiceProviderKey)
    EndWait

;***********************************************************************************
; End of creating HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\TAPIDEVICES\DigiX25 
; keys and Registry hierarchy
;***********************************************************************************

       ; If we were just configuring, then don't invoke RAS
        Ifstr(i) $(!NTN_InstallMode) == configure
            goto skipRAS
        endif

				read-syms InvokeRasDlg$(!STF_LANGUAGE)
        Shell "oemnsvra.inf" CheckRasInstalled
        ifint $($ShellCode) != $(!SHELL_CODE_OK)
            Debug-Output "OEMNADX.INF: 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 successful
        endif
        
        set RasInstalled = $($R0)
        Debug-Output "OEMNADX.INF: Is RAS Installed? "$(RasInstalled)
        
		    ifstr(i) $(RasInstalled) == FALSE
					Shell "subroutn.inf" SetupMessage, $(!STF_LANGUAGE), "STATUS", $(RemindRasConfigMsg)
					goto successful
        else
					Shell "subroutn.inf" SetupMessage, $(!STF_LANGUAGE), "STATUS", $(InvokeRasConfigMsg)
        endif

 				ifint $($ShellCode) != $(!SHELL_CODE_OK)
					goto successful
				endif
	
	      set AddCopy  = YES
        set DoCopy   = YES
        set DoConfig = YES

        set SaveNTN_InstallMode = $(!NTN_InstallMode)
        set !NTN_InstallMode = configure
        
        Debug-Output "OEMNADDI.INF: after - NTN_InstallMode = "$(!NTN_InstallMode)

        ; We change the following values so the user is prompted to enter
        ; a path for RAS file components if necessary.
        ;
        set SaveSTF_SRCDIR_OVERRIDE = $(!STF_SRCDIR_OVERRIDE)
        set !STF_SRCDIR_OVERRIDE = ""

        Debug-Output "OEMNADDI.INF: Shelling to oemnsvra.inf InstallOption with parameters:"
        Debug-Output "                  STF_LANGUAGE = "$(!STF_LANGUAGE)
        Debug-Output "                  SrcDir = "$(SourceDir)
        Debug-Output "                  AddCopy = "$(AddCopy)
        Debug-Output "                  DoCopy = "$(DoCopy)
        Debug-Output "                  DoConfig = "$(DoConfig)

        ;
				Shell "oemnsvra.inf" InstallOption $(!STF_LANGUAGE) "RAS" $(SourceDir) $(AddCopy) $(DoCopy) $(DoConfig) 

        set !STF_SRCDIR_OVERRIDE = $(SaveSTF_SRCDIR_OVERRIDE)

        ifstr(i) $(RasInstalled) == TRUE
             set !NTN_InstallMode = $(SaveNTN_InstallMode)
        endif
        Ifint $($ShellCode) != $(!SHELL_CODE_OK)
            Debug-Output "OEMNADX.INF: 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 successful
        Endif

skipRAS = +
        goto successful

    else-Ifstr(i) $(Result) == Cancel
			Ifstr(i) $(!NTN_InstallMode) == install
				goto fatal
			else
        goto cancel
			endif
    else-Ifstr(i) $(Result) == Error
        goto fatal
    endif

bindingadapter =+
    Debug-Output "******************Entering bindingadapter******************"
    set Error = "Binding: Sorry, not yet implemented."
    goto fatal

removeadapter = +
    OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_RegBase) $(MAXIMUM_ALLOWED) SoftwareKey
    Ifstr $(SoftwareKey) != $(KeyNull)
      GetRegValue $(SoftwareKey), "ServiceName", ServiceNameList
      set AdapterServiceName = *($(ServiceNameList),4)
	    OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_ServiceBase)"\"$(AdapterServiceName)"\Parameters" $(MAXIMUM_ALLOWED) ServiceKey
  	  Ifstr $(ServiceKey) != $(KeyNull)
    		GetRegValue $(ServiceKey), "VANum", X25VANumList
     		set X25VANum = *($(X25VANumList),4)
     		CloseRegKey $(ServiceKey)
			endif
      CloseRegKey $(SoftwareKey)
    Endif

ContinueOperation = +

    read-syms DebugOptions
    set DigiSpecificString = "RemoveAdapter"
    Debug-Output "******************Entering removeadapter******************"
    Debug-Output "OEMNADX.INF: removeadapter"
    Debug-Output "OEMNADX.INF: Removing Hardware Components"
    Debug-Output "OEMNADX.INF: ProductKeyName = "$(ProductKeyName)
    Debug-Output "OEMNADX.INF: SxbProductSoftwareName = "$(SxbProductSoftwareName)
    Debug-Output "OEMNADX.INF: X25ProductSoftwareName = "$(X25ProductSoftwareName)
    Debug-Output "OEMNADX.INF: NTN_RegBase = "$(!NTN_RegBase)

 		OpenRegKey $(!REG_H_LOCAL) "" "HARDWARE\DEVICEMAP\TAPI DEVICES" $(MAXIMUM_ALLOWED) TapiKey
		ifstr(i) $(TapiKey) != $(KeyNull)
	 		OpenRegKey $(TapiKey) "" "DigiX25" $(MAXIMUM_ALLOWED) DeviceMapKey
			ifstr(i) $(DeviceMapKey) != $(KeyNull)
				GetRegValue $(DeviceMapKey) "Address" AddressList
				set NewAddressList = {}
				ForListDo	*($(AddressList), 4)
					Split-String $($) "-" DeviceSplit
					ifint *($(DeviceSplit), 1) != $(X25VANum)
						set NewAddressList = >($(NewAddressList), $($))
					endif
				EndForListDo
				ifstr $(NewAddressList) == {}
					DeleteRegKey $(TapiKey) "DigiX25"
				else
				 	SetRegValue $(DeviceMapKey) {Address,$(NoTitle),$(!REG_VT_MULTI_SZ),$(NewAddressList)}
					FlushRegKey $(DeviceMapKey)
					CloseRegKey $(DeviceMapKey)
				endif
			endif
			CloseRegKey $(TapiKey)
		endif

		Shell $(UtilityInf), RemoveHardwareComponent, $(Manufacturer), +
        $(X25ProductSoftwareName), $(!NTN_SoftwareBase)"\Microsoft\Windows NT\CurrentVersion\NetworkCards\"$(X25VANum)
    Debug-Output "OEMNADX.INF: RemoveHardwareComponent return value = "$($R0)
    Ifstr(i) $($R0) != NO_ERROR
        Debug-Output "OEMNADX.INF: RemoveHardwareComponent != NO_ERROR"
    Endif
    ifint $($ShellCode) != $(!SHELL_CODE_OK)
        Debug-Output "ShellCode error"
        goto ShellCodeError
    endif
    set RegistryErrorIndex = $($R0)
    Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        Debug-Output "fatal registry error"
        goto fatalregistry
    endif

    Shell $(UtilityInf), RemoveHardwareComponent, $(Manufacturer), +
        $(SxbProductSoftwareName), $(!NTN_RegBase)
    Debug-Output "OEMNADX.INF: RemoveHardwareComponent return value = "$($R0)
    Ifstr(i) $($R0) != NO_ERROR
        Debug-Output "OEMNADX.INF: RemoveHardwareComponent != NO_ERROR"
    Endif
    ifint $($ShellCode) != $(!SHELL_CODE_OK)
        Debug-Output "ShellCode error"
        goto ShellCodeError
    endif
    set RegistryErrorIndex = $($R0)
    Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        Debug-Output "fatal registry error"
        goto fatalregistry
    endif

; if DigiX25 refcount is zero then remove files
    shell $(UtilityInf), IsRefCountEqualZero, $(X25ProductKeyName)
    Ifstr(i) $($R0) != NO_ERROR
        Debug-Output "UTILITY.INF: [RemoveAdapter] IsRefCountEqualZero returned "$($R0)
    endif
    Ifint $($R1) == 0
        set RegistryErrorIndex = REF_COUNT_NOT_ZERO
        goto removeadapterExit
    else
        install RemoveFiles
    endif
 
		goto removeadapterExit

removeadapterExitCancel = +
		set CommonStatus = STATUS_USERCANCEL

removeadapterExit = +
    Debug-Output "OEMNADX.INF: Exiting removeadapter"
    goto end

UpgradeSoftware = +
    goto end

successful = +
    goto end

abandon = +
    set ProductSoftwareName = $(SxbProductSoftwareName) 
    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
        set ProductSoftwareName = $(X25ProductSoftwareName) 
    EndForListDo

 		OpenRegKey $(!REG_H_LOCAL) "" "HARDWARE\DEVICEMAP\TAPI DEVICES" $(MAXIMUM_ALLOWED) TapiKey
		ifstr(i) $(TapiKey) != $(KeyNull)
	 		OpenRegKey $(TapiKey) "" "DigiX25" $(MAXIMUM_ALLOWED) DeviceMapKey
			ifstr(i) $(DeviceMapKey) != $(KeyNull)
				GetRegValue $(DeviceMapKey) "Address" AddressList
				set NewAddressList = {}
				ForListDo	*($(AddressList), 4)
					Split-String $($) "-" DeviceSplit
					ifint *($(DeviceSplit), 1) != $(X25VANum)
						set NewAddressList = >($(NewAddressList), $($))
					endif
				EndForListDo
				ifstr $(NewAddressList) == {}
					DeleteRegKey $(TapiKey) "DigiX25"
				else
				 	SetRegValue $(DeviceMapKey) {Address,$(NoTitle),$(!REG_VT_MULTI_SZ),$(NewAddressList)}
					FlushRegKey $(DeviceMapKey)
					CloseRegKey $(DeviceMapKey)
				endif
			endif
			CloseRegKey $(TapiKey)
		endif

    Ifstr(i) $(OEM_ABANDON_SOFTWARE) == TRUE
        Shell $(UtilityInf), RemoveSoftwareComponent, $(Manufacturer), +
            $(SxbProductSoftwareName), TRUE
        ifint $($ShellCode) != $(!SHELL_CODE_OK)
            Debug-Output "ShellCode error"
            goto ShellCodeError
        endif
        set RegistryErrorIndex = $($R0)
        Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
            goto fatalregistry
        endif

        Shell $(UtilityInf), RemoveSoftwareComponent, $(Manufacturer), +
            $(X25ProductSoftwareName), TRUE
        ifint $($ShellCode) != $(!SHELL_CODE_OK)
            Debug-Output "ShellCode error"
            goto ShellCodeError
        endif
        set RegistryErrorIndex = $($R0)
        Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
            goto fatalregistry
        endif

				install RemoveFiles
    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 = +
    Debug-Output "******************Entering fatalregistry******************"

    Shell $(UtilityInf) RegistryErrorString $(RegistryErrorIndex)
    ifint $($ShellCode) != $(!SHELL_CODE_OK)
       Debug-Output "fatalregistry: shell to find RegistryErrorString failed."
       goto ShellCodeError
    endif
    read-syms AbortMessage$(!STF_LANGUAGE)
    set Error = $($R0)$(!LF)$(!LF)$(AbortText)
    
    goto fatal

fataldetect = +
    Shell $(UtilityInf),RegistryErrorString,CANNOT_DETECT
    ifint $($ShellCode) != $(!SHELL_CODE_OK)
        Debug-Output "ShellCode error: cannot get an error string."
        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

cancel = +
        set CommonStatus = STATUS_USERCANCEL
        goto term

end = +
    Debug-Output "******************Entering end******************"
    goto term

term = +
    ifstr(i) $(!LIBHANDLE) != $(HandleNull)
      FreeLibrary $(!LIBHANDLE)
    endif
    Debug-Output "******************Entering term -- GoodBye!!!******************"
    Return $(CommonStatus)

[RemoveFiles]
   Debug-Output "******************Entering [RemoveFiles]******************"
   set RemoveList = {}
   set RenameList = {}
   OpenRegKey $(!REG_H_LOCAL) "" $(SxbProductKeyName) +
              $(MAXIMUM_ALLOWED) SxbKeyProductHdwDriver
   ifstr $(SxbKeyProductHdwDriver) == $(KeyNull)
      set RenameList = >($(RenameList), $(!STF_WINDOWSSYSPATH)"\drivers\"$(SxbProductServiceName)".sys")
      set RenameList = >($(RenameList), $(!STF_WINDOWSSYSPATH)"\drivers\"$(AdapterSxbImagePathISA))
      set RenameList = >($(RenameList), $(!STF_WINDOWSSYSPATH)"\drivers\"$(AdapterBiosImagePathISA))
      set RenameList = >($(RenameList), $(!STF_WINDOWSSYSPATH)"\drivers\"$(AdapterSxbImagePathPCI))
      set RenameList = >($(RenameList), $(!STF_WINDOWSSYSPATH)"\drivers\"$(AdapterBiosImagePathPCI))
   endif
   CloseRegKey $(SxbKeyProductHdwDriver)

   OpenRegKey $(!REG_H_LOCAL) "" $(X25ProductKeyName) +
              $(MAXIMUM_ALLOWED) KeyProduct
   ifstr $(KeyProduct) == $(KeyNull)
      set RenameList = >($(RenameList), $(!STF_WINDOWSSYSPATH)"\drivers\"$(X25ProductServiceName)".sys")
      set RemoveList = >($(RemoveList), $(!STF_WINDOWSSYSPATH)"\DigiWan.dll")
      set RemoveList = >($(RemoveList), $(!STF_WINDOWSSYSPATH)"\DigiWan.hlp")
      set RemoveList = >($(RemoveList), $(!STF_WINDOWSSYSPATH)"\DigiWan.cnt")
   endif
   CloseRegKey $(KeyProduct)

   Debug-Output "RemoveList = "$(RemoveList)
   Debug-Output "RenameList = "$(RenameList)

   ForListDo $(RemoveList)
       Debug-Output "Removing "$($)
       LibraryProcedure Status , $(!LIBHANDLE), DelFile $($)
       Debug-Output "Status is "$(Status)
   EndForListDo
   ForListDo $(RenameList)
     Debug-Output "RenameList entry = "$($)
     Split-String $($) "\" FilePath
     QueryListSize PathLen $(FilePath)
     Split-String *($(FilePath),$(PathLen)) "." FullFileName
     Set FileName = *($(FullFileName),1)
     Debug-Output "FileName is "$(FileName)
     LibraryProcedure STATUS, $(!LIBHANDLE),CheckFileExistance $(!STF_WINDOWSSYSPATH)"\DRIVERS\"$(FileName)".old"
     Debug-Output "CheckFile Status = "$(STATUS)
     ifstr(i) $(STATUS) == YES
         LibraryProcedure STATUS, $(!LIBHANDLE), DelFile $(!STF_WINDOWSSYSPATH)"\DRIVERS\"$(FileName)".old"
         Debug-Output "Delfile Status = "$(STATUS)
         LibraryProcedure STATUS, $(!LIBHANDLE), DelFile $($)
         Debug-Output "Delfile Status = "$(STATUS)
     endif

     Debug-Output "Renaming from "$($)
     Debug-Output "Renaming to "$(!STF_WINDOWSSYSPATH)"\DRIVERS\"$(FileName)".old"
     LibraryProcedure STATUS, $(!LIBHANDLE),CheckFileExistance $($)
     ifstr(i) $(STATUS) == YES
	     LibraryProcedure Status1 , $(!LIBHANDLE), RenFile $($), $(!STF_WINDOWSSYSPATH)"\DRIVERS\"$(FileName)".old"
     endif
     Debug-Output "Status is "$(Status1)
     AddFileToDeleteList $(!STF_WINDOWSSYSPATH)"\DRIVERS\"$(FileName)".old"
   EndForListDo
   exit

[DebugConfiguration]
    Debug-Output $(STF_CONTEXTINFNAME)" **CONFIGURATION STATE: "$($0)
    return

[Install-Option]
    Debug-Output "********************* Inside Install-Option *************************"
    Debug-Output "   AddCopy = "$(AddCopy)
    Debug-Output "   DoCopy = "$(DoCopy)
    Debug-Output "   DoConfig = "$(DoConfig)
    Debug-Output "   NTN_InstallPhase = "$(!NTN_InstallPhase)
    set STF_VITAL = ""
    ifstr(i) $(AddCopy) == "YES"
        AddSectionFilesToCopyList Files-$(Option) $(SrcDir) $(!STF_WINDOWSSYSPATH)\drivers
        AddSectionFilesToCopyList Files-DigiX25 $(SrcDir) $(!STF_WINDOWSSYSPATH)\drivers
        AddSectionFilesToCopyList Files-Dll $(SrcDir) $(!STF_WINDOWSSYSPATH)

        AddSectionFilesToCopyList Files-$(Option)-images $(SrcDir) $(!STF_WINDOWSSYSPATH)\drivers

    endif

		set STF_DECOMPRESS = 1

    ifstr(i) $(DoCopy) == "YES"
       set !STF_NCPA_FLUSH_COPYLIST = TRUE
       CopyFilesInCopyList
    else-ifstr(i) $(!NTN_InstallPhase) == primary
       set !STF_NCPA_FLUSH_COPYLIST = TRUE
       CopyFilesInCopyList
    endif
    Exit

[Source Media Descriptions]
    1 = "Windows NT CD-ROM" 

[Signature]
    FileType = MICROSOFT_DRVLIB_FILE

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

[ProductType]
    STF_PRODUCT  = Winnt
    STF_PLATFORM = I386

[Files-Inf]
    1, oemsetup.inf, SIZE=74959, RENAME=$(!UG_Filename)
[Files-DigiSyncX25-images]
    1,SxbFep.bin,  SIZE=385024, NODELETESOURCE
    1,SxbBios.bin, SIZE=25088,  NODELETESOURCE
    1,SxbFep.pci,  SIZE=385280, NODELETESOURCE
    1,SxbBios.pci, SIZE=26112,  NODELETESOURCE
[Files-DigiSyncX25]
    1,DigiSxb.sys, SIZE=66800,  NODELETESOURCE
[Files-DigiX25]
    1,DigiX25.sys, SIZE=50032,  NODELETESOURCE
[Files-Dll]
    1,DigiWan.dll, SIZE=324608, NODELETESOURCE
    1,DigiWan.hlp, SIZE=25128,  NODELETESOURCE
    1,DigiWan.cnt, SIZE=865,    NODELETESOURCE

[OptionsTextENG]
    DigiSyncX25 = "Digi SyncPort X.25 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   = "WAN Links Adapter Setup"
    ProductSoftwareDescription      = "Digi SyncPort Driver"
    ProductHardwareDescription      = "Digi SyncPort Adapter"

[InvokeRasDlgENG]
		RemindRasConfigMsg =	"WAN Links setup is complete. "+
													"Please remember to install Remote Access Services (RAS) "+
													"to enable you to use RAS over X.25."
    InvokeRasSetupMsg = "WAN Links setup is complete. "+
                    "Remote Access Services (RAS) will now be installed. "+
                    "Please configure one or more X.25 ports in RAS setup "+
                    "to enable you to use RAS over X.25." 
    InvokeRasConfigMsg = "WAN Links setup is complete. "+
                     "Remote Access Services (RAS) setup will now be invoked. "+
                     "Please configure one or more X.25 ports in RAS setup "+
                     "to enable you to use RAS over X.25." 
    InvokeRasError =  "WAN Links 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."
    InvokeRasRemove = "X.25 RAS ports in use on this adapter must be removed before this adapter can be removed. "+
    		  						"Remote Access Services (RAS) setup will now be invoked."
 

[AbortMessageENG]
    AbortText  =  "Aborting "$(AdapterHardwareTitle)" Setup. Please reboot the system "+
                "to fix the problem."

