[Identification]
   OptionType = NetAdapter

[Options]
   IsdnWan

[LocalConstants]
   MajorVer                 = "1"
   MinorVer                 = "05"
   Manufacturer             = "ELSA"
   Description              = "ELSA COMCAPI (NDISWAN MiniPort)"
   TapiLineName             = "ELSA COMCAPI - Line "
   DiskName                 = "ELSA MicroLink ISDN Office Software CD"
   DriverName               = "isdnwan.sys"
   SetupDLL                 = "isdncfg.dll"

[FileConstants]
   ProductVersion           = $(MajorVer)"."$(MinorVer)
   ProductSoftwareName      = $(Description)
   ProductHardwareName      = $(Description)
   ProductSoftwareImagePath = $(!STF_WINDOWSSYSPATH)"\drivers\"$(DriverName)
   ProductKeyName           = $(!NTN_SoftwareBase)"\"$(Manufacturer)"\"$(Description)"\CurrentVersion"
   ParamKeyName             = $(!NTN_ServiceBase)"\"$(Description)"\Parameters"


   InfName                  = "OEMSETNT.INF"
   UtilityInf               = "UTILITY.INF"
   ParamInf                 = "NCPARAM.INF"
   subroutineinf            = "SUBROUTN.INF"
   SoftwareType             = "driver"
   Exit_Code                = 0
   NetEventDLL              = $(!STF_WINDOWSSYSPATH)"\netevent.dll"
   IoLogMsgDLL              = $(!STF_WINDOWSSYSPATH)"\IoLogMsg.dll"
   DLLDirectory             = $(!STF_WINDOWSSYSPATH)"\drivers\"

   NetRuleSoftwareType      = "isdnwanSys isdnwanDriver"
   NetRuleSoftwareUse       = $(SoftwareType)
   NetRuleSoftwareBindForm  = """isdnwanSys"" yes no container"
   NetRuleSoftwareClass     = {"isdnwanDriver basic"}
   NetRuleSoftwareBindable  = {"isdnwanDriver isdnwanAdapter non exclusive 100"}
   NetRuleHardwareType      = "isdnwan isdnwanAdapter"
   NetRuleHardwareBindForm  = " yes yes container"
   NetRuleHardwareClass     = {"isdnwanAdapter basic"}

   DeviceMap                = "Hardware\DEVICEMAP"
   TapiDevices              = "TAPI DEVICES"
   TapiDeviceKey            = $(ProductHardwareName)
   TapiMediaType            = "ISDN"
   TapiLines                = "2"

   TapiAddressList          = {}
   ParameterList            = {}

   ProCaption               = "Windows NT Setup"
   ProCancel                = "Abbruch"
   ProCancelMsg             = "Das Windows NT Netzwerk ist nicht korrekt installiert.  "+
                              "Wollen Sie den Kopiervorgang wirklich abbrechen?"
   ProCancelCap             = "Netzwerk Setup Meldung"
   ProText1                 = "Kopiere:"
   ProText2                 = "Nach:"

   ShellCodeErrorTitle      = "Fehler: "$(Description)" Setup"
   ShellCodeErrorText       = "Shell Code Error."

[DialogConstants]
   Help                     = "&Hilfe"
   Exit                     = "Abbruch"
   OK                       = "OK"
   HelpContext              = ""
   Continue                 = "Weiter"
   Cancel                   = "Abbruch"

[InvokeRasDlg]
   InvokeRasSetupMsg        = $(Description)" Installation beendet. "+
                              "Setup installiert jetzt die Remote Access Services "+
                              "(RAS). Konfigurieren Sie dann die ISDN WAN Ports in RAS."
   InvokeRasConfigMsg       = $(Description)" Installation beendet. "+
                              "Setup startet jetzt die Konfiguration der Remote Access Services "+
                              "(RAS). Konfigurieren Sie die ISDN WAN Ports in RAS."
   InvokeRasError           = "Installationsfehler beim Aufruf der RAS Setup INF-Datei "+
                              "OEMNSVRA.INF."

[OptionsText]
   IsdnWan                  = $(Description)

;***********************************************************************
;
;***********************************************************************
[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_WINDOWSSYSPATH)\drivers

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

;***********************************************************************
;
;***********************************************************************
[Identify]
   Read-Syms Identification
   Set Status      = STATUS_SUCCESSFUL
   Set Identifier  = $(OptionType)
   Set Media       = $(Description)
   Return $(Status) $(Identifier) $(Media)

;***********************************************************************
;
;***********************************************************************
[ReturnOptions]
   Read-Syms LocalConstants
   Set OptionList     = ^(Options, 1)
   Set OptionTextList = ^(OptionsText, 1)
   Set Status         = STATUS_SUCCESSFUL

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

;***********************************************************************
;
;***********************************************************************
[InstallOption]
   Set Status   = STATUS_FAILED
   Set Option   = $($1)
   Set SrcDir   = $($2)
   Set AddCopy  = $($3)
   Set DoCopy   = $($4)
   Set DoConfig = $($5)

   ;
   ; FIXME - make sure this flag is disabled before shipping
   ;
   Set OldDebugControl = $(!DebugOutputControl)
   Set !DebugOutputControl = 1

   Set-Subst LF = "\n"

   Read-Syms GeneralConstants
   Read-Syms LocalConstants
   Read-Syms FileConstants
   Read-Syms DialogConstants

   IfStr(i) $(!NTN_Origination) == "NCPA"
      Set Continue = $(OK)
   EndIf

   Detect Date
   Set-Title $(Description)" Setup"

   Set to   = Begin
   Set from = Begin
   Set CommonStatus = STATUS_SUCCESSFUL

   EndWait

;***********************************************************************
;
;***********************************************************************
Begin = +
   Set ActivateDetection = FALSE
   IfStr(i) $(!NTN_InstallMode) == deinstall
      Set StartLabel = RemoveAdapter
   Else-IfStr(i) $(!NTN_InstallMode) == Update
      Set StartLabel = UpgradeSoftware
   Else-IfStr(i) $(!NTN_InstallMode) == bind
      Set StartLabel = BindingAdapter
   Else-IfStr(i) $(!NTN_InstallMode) == configure
      Set StartLabel        = ConfigureAdapter
      Set ActivateDetection = TRUE
      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
      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

   Debug-Output $(MYINF)": Calling Param_SetDefaults"
   Shell $(ParamInf) Param_SetDefaults {}

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

   Shell "" DebugConfiguration "After parameter querying"
   Set from = FatalError
   Set to   = FatalError
   GoTo $(StartLabel)

;***********************************************************************
;
;***********************************************************************
InstallAdapter = +
   OpenRegKey $(!REG_H_LOCAL) "" $(ProductKeyName) $(MAXIMUM_ALLOWED) KeyProduct
   IfStr $(KeyProduct) != $(KeyNull)
      CloseRegKey $(KeyProduct)
      IfStr(i) !(NTN_RegBase) == $(ProductKeyName)
         Shell $(UtilityInf), VerExistedDlg, $(Description), $(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

   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"
   Shell $(ParamInf) Param_SetDefaults $(DetectedParams)
   GoTo AdapterSetup

;***********************************************************************
;
;***********************************************************************
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

   Set KeyParameters = $($R2)
   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)

      IfStr(i) $(ValueName) == "AdapterNum"
         Set AdapterNumber = $(ValueData)

      Else-IfStr(i) $(ValueName) == "Line0.Channel0.Phone"
         Set ParameterList = >($(ParameterList),$(ValueName))
         Set ParameterList = >($(ParameterList),$(ValueData))

      Else-IfStr(i) $(ValueName) == "Line0.Channel0.SPID"
         Set ParameterList = >($(ParameterList),$(ValueName))
         Set ParameterList = >($(ParameterList),$(ValueData))

      Else-IfStr(i) $(ValueName) == "Line0.Channel1.Phone"
         Set ParameterList = >($(ParameterList),$(ValueName))
         Set ParameterList = >($(ParameterList),$(ValueData))

      Else-IfStr(i) $(ValueName) == "Line0.Channel1.SPID"
         Set ParameterList = >($(ParameterList),$(ValueName))
         Set ParameterList = >($(ParameterList),$(ValueData))

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

;***********************************************************************
;
;***********************************************************************
AdapterSetup = +
   Shell "" DebugConfiguration "before displaying dialog"
   Set from = AdapterOptions

   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

;***********************************************************************
;
;***********************************************************************
AdapterOptions = +
   Shell "" DebugConfiguration "in AdapterOptions"

;***********************************************************************
;
;***********************************************************************
AdapterVerify = +
   Shell "" DebugConfiguration "after running dialog"
   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 =+
   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),+
            $(Description), $(STF_CONTEXTINFNAME),+
            $(ProductSoftwareImagePath), "kernelautostart", "NDIS", {"NdisTapi"}, "",+
            $(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), $(MajorVer)},+
                          {MinorVersion, $(NoTitle), $(!REG_VT_DWORD), $(MinorVer)},+
                          {Title,        $(NoTitle), $(!REG_VT_SZ),    $(Description)},+
                          {Description,  $(NoTitle), $(!REG_VT_SZ),    $(Description)},+
                          {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), $(NetRuleSoftwareBindable)}, +
                          {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)": Registry 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)"] "$(Description)},+
                       {Description,  $(NoTitle), $(!REG_VT_SZ),    $(Description)},+
                       {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)": Registry error: add value list."
      CloseRegKey $(KeyParameters)
      CloseRegKey $(KeyAdapterRules)
      GoTo FatalRegistry
   EndIf
   CloseRegKey $(KeyAdapterRules)

   Shell "" GetData $(ParamKeyName) "AdapterList" {}
   Set AdapterList = $($R1)

   Shell "" ConcatList $(AdapterList) {$(AdapterNumber)}
   Set AdapterList = $($R1)

   Shell "" SetData $(ParamKeyName) "AdapterList" $(!REG_VT_MULTI_SZ) $(AdapterList)
   IfStr(i) $($R0) != NO_ERROR
      EndWait
      Debug-Output $(InfName)": SetData fail AdapterList"
      GoTo FatalRegistry
   EndIf

   GoTo WriteParameters

;***********************************************************************
;
;***********************************************************************
WriteParameters = +
   Shell "" DebugConfiguration "before LoadLibrary ("$(DLLDirectory)")"
   LoadLibrary "x" $(DLLDirectory)$(SetupDLL) CfgHandle
   Set ResultList = {}
   LibraryProcedure ResultList, $(CfgHandle), _ConfigFunction@12, $(KeyParameters) $(ParameterList)
   FreeLibrary $(CfgHandle)

   ForListDo $(ResultList)
      ForListDo $($)
         Debug-Output $(InfName)" Res="$($)
      EndForListDo
   EndForListDo

   Set Return = *($(ResultList),1)
   IfStr(i) *($(Return),2) == "TRUE"
      Set ParameterList = *($(ResultList),2)
   Else
      Set CommonStatus = STATUS_USERCANCEL
      Debug-Output $(InfName)": Action: exit. Bye."
      GoTo end
   EndIf

   Set TapiAddressList = {$(AdapterNumber)" 1 0"}
   Set TapiAddressList = >($(TapiAddressList),$(AdapterNumber)" 2 0")

   Set NewValueList = {{AddressList,         $(NoTitle), $(!REG_VT_MULTI_SZ), $(TapiAddressList)},+
                       {DeviceName,          $(NoTitle), $(!REG_VT_SZ),       $(ProductHardwareName)},+
                       {Lines,               $(NoTitle), $(!REG_VT_SZ),       $(TapiLines)},+
                       {MediaType,           $(NoTitle), $(!REG_VT_SZ),       $(TapiMediaType)},+
                       {AdapterNum,          $(NoTitle), $(!REG_VT_SZ),       $(AdapterNumber)},+
                       {Line0.Channel0.Name, $(NoTitle), $(!REG_VT_SZ),       $(TapiLineName)"1"},+
                       {Line0.Channel1.Name, $(NoTitle), $(!REG_VT_SZ),       $(TapiLineName)"2"}}

   Set tmp_cnt = "0"
   ForListDo $(ParameterList)
      IfInt $(tmp_cnt) == "0"
         set tmp1_val_list = {}
         set tmp1_val_list = >($(tmp1_val_list), $($))
         set tmp_cnt       = "1"
      Else
         set tmp1_val_list = >($(tmp1_val_list), $($))
         set tmp_val_item  = { *($(tmp1_val_list),1), $(NoTitle), $(!REG_VT_SZ), *($(tmp1_val_list),2) }
         set NewValueList  = >($(NewValueList), $(tmp_val_item))
         set tmp_cnt       = "0"
      Endif
   EndForListDo

   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

   Shell "", TapiConf
   IfStr(i) $($R0) != NO_ERROR
      Debug-Output $(InfName)"> TA fail"
      GoTo FatalRegistry
   EndIf

   ;
   ; Create the HARDWARE\DEVICEMAP\TAPI DEVICES\IsdnWan key
   ;
   OpenRegKey $(!REG_H_LOCAL) "" $(DeviceMap) $(MAXIMUM_ALLOWED) BaseKey
   Shell "" HtCreateRegKey $(BaseKey) $(TapiDevices)"\"$(Description)
   IfStr(i) $($R0) != NO_ERROR
      Debug-Output $(InfName)": Error creating registry key!"
      GoTo FatalRegistry
   EndIf
   Set TapiDeviceKey = $($R1)
   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 ISDN.
   ;
   Read-Syms InvokeRasDlg
   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

   ;
   ; 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
   ;
   set SaveNTN_InstallMode     = $(!NTN_InstallMode)
   set SaveSTF_SRCDIR_OVERRIDE = $(!STF_SRCDIR_OVERRIDE)
   set !STF_SRCDIR_OVERRIDE    = ""
   IfStr(i) $(RasInstalled) == TRUE
      Set !NTN_InstallMode = configure
   EndIf

   ;
   ; now invoke RAS setup to do the right thing
   ;
   Shell "oemnsvra.inf" InstallOption $(!STF_LANGUAGE) "RAS" "" $(AddCopy) $(DoCopy) $(DoConfig)

   ;
   ; restore the global install mode flag
   ;
   set !NTN_InstallMode     = $(SaveNTN_InstallMode)
   set !STF_SRCDIR_OVERRIDE = $(SaveSTF_SRCDIR_OVERRIDE)

   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
   EndIf
   GoTo SuccessfulOption

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

;***********************************************************************
;
;***********************************************************************
RemoveAdapter = +
   IfStr(i) $(ProductKeyName) == $(!NTN_RegBase)
      Debug-Output $(InfName)": RemoveSoftwareComponent "$(Description)

      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
      GoTo end
   Endif

   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="$(KeyProduct)

   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

   Set KeyParameters = $($R2)
   CloseRegKey $($R1)
   IfStr $(KeyParameters) == $(KeyNull)
      Set RegistryErrorIndex = CANNOT_FIND_COMPONENT_SERVICE
      Debug-Output $(InfName)": Cannot find component service"
      GoTo FatalRegistry
   EndIf

   Set ValueName = ""
   Set ValueData = ""
   Set ValueStr  = ""
   Set ValueList = {}

   EnumRegValue $(KeyParameters) ValueList

   ForListDo $(ValueList)
      Set ValueItem = $($)
      Set ValueName = *($(ValueItem),1)
      Set ValueData = *($(ValueItem),4)

      IfStr(i) $(ValueName) == "AdapterNum"
         Set AdapterNumber = $(ValueData)
      EndIf
   EndForListDo

   CloseRegKey $(KeyParameters)
   CloseRegKey $(KeyProduct)

   Shell $(UtilityInf), RemoveHardwareComponent, $(Manufacturer), $(ProductHardwareName), $(!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

   Shell $(UtilityInf), IsRefCountEqualZero, $(ProductKeyName)

   Ifint $($R1) != 1
      Shell "" GetData $(ParamKeyName) "AdapterList" {}
      Set AdapterList = $($R1)
      Shell "" RemoveList $(AdapterList) {$(ADAPTER_NUM)}
      Set AdapterList = $($R1)
      Shell "" SetData $(ParamKeyName) "AdapterList" $(!REG_VT_MULTI_SZ) $(AdapterList)
      IfStr(i) $($R0) != NO_ERROR
         Debug-Output $(InfName)": RMA SetData fail AdapterList"
         GoTo FatalRegistry
      EndIf
   Endif

   Shell "", TapiConf

   IfStr(i) $($R0) != NO_ERROR
      Debug-Output $(InfName)"> TA fail"
      GoTo FatalRegistry
   EndIf

   EndWait
   GoTo SuccessfulOption

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

;***********************************************************************
;
;***********************************************************************
Abandon = +
   ForListDo $(OEM_ABANDON_OPTIONS)
      Shell $(UtilityInf), RemoveHardwareComponent, $(Manufacturer), $(ProductHardwareName), $($)
      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)

;***********************************************************************
;
;***********************************************************************
[TapiConf]
   Read-Syms GeneralConstants
   Read-Syms LocalConstants
   Read-Syms FileConstants

   Set TCReturn  = NO_ERROR
   Set TCBaseKey = ""

   Debug-Output $(InfName)"> [ TapiConf ]"

   OpenRegKey $(!REG_H_LOCAL) "" $(DeviceMap) $(MAXIMUM_ALLOWED) TCBaseKey
   Shell "" HtCreateRegKey $(TCBaseKey) $(TapiDevices)"\"$(Description)
   IfStr(i) $($R0) != NO_ERROR
      Debug-Output $(InfName)"> TC CreateRegKey failed"
      Set TCReturn = ERROR
      Goto tc_return
   EndIf
   Set TCTapiKey = $($R1)

   Shell $(UtilityInf), IsRefCountEqualZero, $(ProductKeyName)
   IfInt $($R1) == 1
      CloseRegKey $(TCTapiKey)
      DeleteRegKey $(TCBaseKey) $(TapiDevices)"\"$(Description)
      CloseRegKey $(TCBaseKey)
      Goto tc_return
   Endif

   Shell "" GetData $(ParamKeyName) "AdapterList" {}
   Set TCAdapterList = $($R1)
   Debug-Output $(InfName)"> AdapterList = "$(TCAdapterList)

   Set TCTapiList = {}
   ForListDo $(TCAdapterList)
      Set TCDescription = $(Description)$($)
      Set TCDriverPath  = $(!NTN_ServiceBase)"\"$(TCDescription)"\Parameters"

      Shell "" GetData $(TCDriverPath) "AddressList" {}
      Set TCAddressList = $($R1)

      Shell "" ConcatList $(TCTapiList) $(TCAddressList)
      Set TCTapiList = $($R1)
   EndForListDo

   Set TCValueList = {{Address,      $(NoTitle), $(!REG_VT_MULTI_SZ), $(TCTapiList)},+
                      {"Media Type", $(NoTitle), $(!REG_VT_SZ),       $(TapiMediaType)}}
   Shell $(UtilityInf), AddValueList, $(TCTapiKey), $(TCValueList)

   CloseRegKey $(TCTapiKey)
   CloseRegKey $(TCBaseKey)

   IfInt $($ShellCode) != $(!SHELL_CODE_OK)
      Debug-Output $(InfName)"> TC Sh AddValList fail"
      Set TCReturn = ERROR
      Goto tc_return
   EndIf
   Set TCReturn = $($R0)
   IfStr(i) $(TCReturn) != NO_ERROR
      Debug-Output $(InfName)"> TC AddValList fail"
      Set TCReturn = ERROR
      Goto tc_return
   EndIf
tc_return =+
   Return $(TCReturn)

;***********************************************************************
;
;***********************************************************************
[SetData]
   Read-Syms GeneralConstants

   Set SDPath   = $($0)
   Set SDName   = $($1)
   Set SDType   = $($2)
   Set SDData   = $($3)
   Set SDKey    = $(KeyNull)
   Set SDReturn = ERROR
   Set SDList   = {{$(SDName), $(NoTitle), $(SDType), $(SDData)}}

   Debug-Output $(InfName)"> [ SetData ]"
   Debug-Output $(InfName)"> Path = "$(SDPath)
   Debug-Output $(InfName)"> Name = "$(SDName)
   Debug-Output $(InfName)"> Type = "$(SDType)
   Debug-Output $(InfName)"> Data = "$(SDData)

   OpenRegKey $(!REG_H_LOCAL) "" $(SDPath) $(MAXIMUM_ALLOWED) SDKey
   IfStr(i) $(SDKey) == $(KeyNull)
      Debug-Output $(InfName)": SD Open fail "$(SDPath)
      goto sd_return
   Endif

;   Shell $(UtilityInf), AddValueList, $(SDKey), $(SDList)
   SetRegValue $(SDKey) {$(SDName), $(NoTitle), $(SDType), $(SDData)}
   CloseRegKey $(SDKey)
;   IfInt $($ShellCode) != $(!SHELL_CODE_OK)
;      Debug-Output $(InfName)"> SD Sh AddValueList fail "$(SDList)
;      GoTo sd_return
;   EndIf
;   Set SDReturn = $($R0)
;   IfStr(i) $(SDReturn) != NO_ERROR
;      Debug-Output $(InfName)"> GD AddValueList fail "$(SDList)
;      GoTo sd_return
;   EndIf
   Set SDReturn = NO_ERROR
sd_return =+
   Return $(SDReturn)

;***********************************************************************
;
;***********************************************************************
[GetData]
   Read-Syms GeneralConstants

   Set GDPath    = $($0)
   Set GDName    = $($1)
   Set GDDefault = $($2)
   Set GDKey     = $(KeyNull)
   Set GDReturn  = NO_ERROR
   Set GDData    = $(GDDefault)

   Debug-Output $(InfName)"> [ GetData ]"
   Debug-Output $(InfName)"> Path = "$(GDPath)
   Debug-Output $(InfName)"> Name = "$(GDName)
   Debug-Output $(InfName)"> Noth = "$(GDDefault)

   OpenRegKey $(!REG_H_LOCAL) "" $(GDPath) $(MAXIMUM_ALLOWED) GDKey
   IfStr(i) $(GDKey) == $(KeyNull)
      Debug-Output $(InfName)": GD Open fail "$(GDPath)
      Set GDReturn = ERROR
      goto gd_return
   Endif
   GetRegValue $(GDKey), $(GDName), GDData
   CloseRegKey $(GDKey)

   ifStr(i) $(GDData) != {}
      Set GDData = *($(GDData),4)
   Else
      Set GDData = $(GDDefault)
   Endif
   Debug-Output $(InfName)"> Data = "$(GDData)
gd_return =+
   Return $(GDReturn) $(GDData)

;***********************************************************************
;
;***********************************************************************
[ConcatList]
   Read-Syms GeneralConstants

   Set CLList1  = $($0)
   Set CLList2  = $($1)
   Set CLReturn = ERROR

   Debug-Output $(InfName)"> [ ConcatList ]"
   Debug-Output $(InfName)"> List1 = "$(CLList1)
   Debug-Output $(InfName)"> List2 = "$(CLList2)

   ForListDo $(CLList2)
      Set CLList1 = >($(CLList1),$($))
   EndForListDo

   Set CLReturn = NO_ERROR
   Debug-Output $(InfName)"> NewList = "$(CLList1)
   Return $(CLReturn) $(CLList1)

;***********************************************************************
;
;***********************************************************************
[RemoveList]
   Read-Syms GeneralConstants

   Set RLOrgList  = $($0)
   Set RLRmList   = $($1)
   Set RLReturn   = ERROR
   Set RLNewList  = {}

   Debug-Output $(InfName)"> [ RemoveList ]"
   Debug-Output $(InfName)"> OrgList = "$(RLOrgList)
   Debug-Output $(InfName)"> RmList  = "$(RLRmList)

   ForListDo $(RLOrgList)
      IfContains(i) $($) not-in $(RLRmList)
         Set RLNewList = >($(RLNewList),$($))
      Endif
   EndForListDo
   Set RLReturn = NO_ERROR
   Debug-Output $(InfName)"> NewList = "$(RLNewList)
   Return $(RLReturn) $(RLNewList)

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

;***********************************************************************
;
;***********************************************************************
[Install-Option]
   Set STF_VITAL = ""
   IfStr(i) $(AddCopy) == "YES"
      AddSectionFilesToCopyList Files-$(Option)       $(SrcDir) $(DLLDirectory)
      AddSectionFilesToCopyList Files-$(Option)-DRV   $(SrcDir) $(!STF_WINDOWSSYSPATH)"\drivers"
   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) $(DLLDirectory)
   AddSectionFilesToCopyList Files-Inf             $(SrcDir) $(!STF_WINDOWSSYSPATH)
   AddSectionFilesToCopyList Files-$(Option)-DRV   $(SrcDir) $(!STF_WINDOWSSYSPATH)"\drivers"
   Set !STF_NCPA_FLUSH_COPYLIST = TRUE
   CopyFilesInCopyList
   Exit

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

[Source Media Descriptions]
   1  = "ISDN WAN Miniport", TAGFILE = driver\driver\winnt\isdnwan\isdnwan.sy_

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

[Files-IsdnWan]
   1, isdncfg.dll

[Files-IsdnWan-DRV]
   1, isdnwan.sys

