home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / d / d423_liu / 7.ddi / UTILITY.IN_ / UTILITY.IN
Encoding:
INI File  |  1993-07-24  |  73.6 KB  |  1,836 lines

  1. [InitBaseVars]
  2. KeyNull            = ""
  3. MAXIMUM_ALLOWED    = 33554432
  4. KeyInfo            = {}
  5. RegistryErrorIndex = NO_ERROR
  6. NoTitle            = 0
  7. CurrentControlSet  = "SYSTEM\CurrentControlSet"
  8. ServicesBaseName   = $(CurrentControlSet)"\Services"
  9. NetworkCardKeyName = $(!NTN_SoftwareBase)"\Microsoft\Windows NT\CurrentVersion\NetworkCards"
  10. !RegLastError      = NO_ERROR
  11. [RegistryErrorSetup]
  12. RegistryErrorIndex = ^(RegistryErrors$(!STF_LANGUAGE),1)
  13. RegistryErrorList = ^(RegistryErrors$(!STF_LANGUAGE),2)
  14. [RegistryErrorString]
  15.      read-syms RegistryErrorSetup
  16.      read-syms RegistryErrorUnknown$(!STF_LANGUAGE)
  17.      set RE_String = *($(RegistryErrorList),~($(RegistryErrorIndex),$($0)))
  18.      Ifstr $(RE_String) == ""
  19.         set RE_String = $(Error_Bogus)
  20.      endif
  21.      return $(RE_String)
  22. [BaseServiceKey]
  23.     read-syms InitBaseVars
  24.     set BS_KeyServices = ""
  25.     OpenRegKey $(!REG_H_LOCAL) "" $(ServicesBaseName) $(MAXIMUM_ALLOWED) BS_KeyServices
  26.     Ifstr $(BS_KeyServices) == $(KeyNull)
  27.        Debug-Output "UTILITY.INF: could not open Services base key"
  28.        set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  29.     endif
  30. B_S_Return = +
  31.     return $(RegistryErrorIndex), $(BS_KeyServices)
  32. [ReduceInfPath]
  33.     Set RIP_Result = $($0)
  34.     Split-String $(RIP_Result) "\" InList
  35.     Set BasePath = $(!STF_WINDOWSSYSPATH)"\"
  36.     Split-String $(BasePath) "\" BaseList
  37.     Set Indx = 0
  38.     Set Matched = 0
  39.     QueryListSize InListSize, $(InList)
  40.     ForListDo $(BaseList)
  41.         Set-add Indx = $(Indx),1
  42.         Ifint $(Indx) <= $(InListSize)
  43.             Set Instr = *($(InList),$(Indx))
  44.             Ifstr(i) $($) == $(Instr)
  45.                 Set-add Matched = $(Matched),1
  46.             Endif
  47.         Endif
  48.     EndForListDo
  49.     Ifint $(Indx) == $(Matched)
  50.         Set RIP_Result = ""
  51.         Set Indx2 = 0
  52.         ForListDo $(InList)
  53.             Set-add Indx2 = $(Indx2),1
  54.             Ifint $(Indx2) > $(Indx)
  55.                 Set RIP_Result = $(RIP_Result)$($)
  56.             Endif
  57.         EndForListDo
  58.     Endif
  59.     Return $(RIP_Result)
  60. [InstallSoftwareProduct]
  61.     read-syms InitBaseVars
  62.     set IS_MfgName  = $($0)
  63.     set IS_ProdName = $($1)
  64.     set IS_Infname  = $($2)
  65.     set IS_KeySoftware = ""
  66.     set IS_KeyMfg = ""
  67.     set IS_KeyProduct = ""
  68.     set IS_KeyVersion = ""
  69.     set IS_KeyNetRules = ""
  70.     set IS_MfgCreated = 1
  71.     set IS_ProductCreated = 1
  72.     set RegistryErrorIndex = INVALID_DATA_PASSED
  73.     Ifstr(i) $(IS_MfgName) == ""
  74.        goto I_S_Return
  75.     endif
  76.     Ifstr(i) $(IS_ProdName) == ""
  77.        goto I_S_Return
  78.     endif
  79.     set RegistryErrorIndex = NO_ERROR
  80.     OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_SoftwareBase) $(MAXIMUM_ALLOWED) IS_KeySoftware
  81.     Ifstr $(IS_KeySoftware) == $(KeyNull)
  82.        set RegistryErrorIndex = UNABLE_ACCESS_SOFTWARE_REG
  83.        goto I_S_Return
  84.     endif
  85.     CreateRegKey $(IS_KeySoftware) {$(IS_MfgName),$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" IS_KeyMfg
  86.     Ifstr $(IS_KeyMfg) == $(KeyNull)
  87.        set IS_MfgCreated = 0
  88.        OpenRegKey $(IS_KeySoftware) "" $(IS_MfgName) $(MAXIMUM_ALLOWED) IS_KeyMfg
  89.        Ifstr $(IS_KeyMfg) == $(KeyNull)
  90.           set RegistryErrorIndex = UNABLE_OPEN_MICROSOFT_KEY
  91.           goto I_S_Return
  92.        endif
  93.     endif
  94.     CreateRegKey $(IS_KeyMfg) {$(IS_ProdName),$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" IS_KeyProduct
  95.     Ifstr $(IS_KeyProduct) == $(KeyNull)
  96.        set IS_ProductCreated = 0
  97.        OpenRegKey $(IS_KeyMfg) "" $(IS_ProdName) $(MAXIMUM_ALLOWED) IS_KeyProduct
  98.        Ifstr $(IS_KeyProduct) == $(KeyNull)
  99.           set RegistryErrorIndex = UNABLE_CREATE_PRODUCT_KEY
  100.           goto I_S_Return
  101.        endif
  102.     endif
  103.     CreateRegKey $(IS_KeyProduct) {"CurrentVersion",$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" IS_KeyVersion
  104.     Ifstr $(IS_KeyVersion) == $(KeyNull)
  105.        OpenRegKey $(IS_KeyProduct) "" "CurrentVersion" $(MAXIMUM_ALLOWED) IS_KeyVersion
  106.        Ifstr $(IS_KeyVersion) == $(KeyNull)
  107.           set RegistryErrorIndex = UNABLE_CREATE_PRODUCT_VERSION
  108.           goto I_S_Return
  109.        endif
  110.     endif
  111.     set RegistryErrorIndex = NO_ERROR
  112.     CreateRegKey $(IS_KeyVersion) {NetRules,$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" IS_KeyNetRules
  113.     Ifstr $(IS_KeyNetRules) == $(KeyNull)
  114.        OpenRegKey $(IS_KeyVersion) "" NetRules $(MAXIMUM_ALLOWED) IS_KeyNetRules
  115.        Ifstr $(IS_KeyNetRules) == $(KeyNull)
  116.           set RegistryErrorIndex = UNABLE_CREATE_NETRULES_KEY
  117.           goto I_S_Return
  118.        endif
  119.     endif
  120.     Ifstr $(IS_Infname) != ""
  121.        Shell "", ReduceInfPath, $(IS_Infname)
  122.        SetRegValue $(IS_KeyNetRules) {InfName,$(NoTitle),$(!REG_VT_SZ),$($R0)}
  123.     endif
  124. I_S_Return = +
  125.     Ifstr $(IS_KeyProduct) != ""
  126.         Ifint $(IS_ProductCreated) == 1
  127.            Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  128.               Debug-Output "UTILITY.INF: DeleteRegTree Product Key"
  129.               set IS_KeyProduct = ""
  130.            endif
  131.         endif
  132.         Ifstr $(IS_KeyProduct) != ""
  133.            CloseRegKey $(IS_KeyProduct)
  134.         endif
  135.     endif
  136.     Ifstr $(IS_KeyMfg) != ""
  137.         Ifint $(IS_MfgCreated) == 1
  138.            Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  139.               Debug-Output "UTILITY.INF: DeleteRegTree Manufacturer Key"
  140.               set IS_KeyMfg = ""
  141.            endif
  142.         endif
  143.         Ifstr $(IS_KeyMfg) != ""
  144.            CloseRegKey $(IS_KeyMfg)
  145.         endif
  146.     endif
  147.     Ifstr $(IS_KeySoftware) != ""
  148.         CloseRegKey $(IS_KeySoftware)
  149.     endif
  150.     return $(RegistryErrorIndex), $(IS_KeyVersion), $(IS_KeyNetRules)
  151. [AddValueList]
  152.    set RegistryErrorIndex = NO_ERROR
  153.    ForListDo $($1)
  154.        SetRegValue $($0) $($)
  155.        ifint $(RegLastError) != 0
  156.           Debug-Output "UTILITY.INF: Value write fail data: "$($)
  157.           Debug-Output "UTILITY.INF: Value write fail key: "$($0)
  158.           return UNABLE_WRITE_REGISTRY
  159.        endif
  160.    EndForListDo
  161.    return $(RegistryErrorIndex)
  162. [DeleteSoftwareProduct]
  163.    set RegistryErrorIndex = NO_ERROR
  164.    Debug-Output "UTILITY.INF: DeleteRegTree Software Product"
  165.    DeleteRegTree $($0) ""
  166.    return $(RegistryErrorIndex)
  167. [VerExistedDlg]
  168.    set RegistryErrorIndex = NO_ERROR
  169.    set-subst LF = "\n"
  170.    read-syms VerExisted$(!STF_LANGUAGE)
  171.    set DlgText = $($0)+
  172.              $(ver)+
  173.              $($1)+
  174.              $(Text)
  175.    Shell "Subroutn.Inf" SetupMessage $(!STF_LANGUAGE) "NONFATAL" $(DlgText)
  176.    ifint $($ShellCode) != $(!SHELL_CODE_OK)
  177.         set RegistryErrorIndex = ERROR
  178.    endif
  179.    return $(RegistryErrorIndex), $($R1)
  180. [CardExistedDlg]
  181.    set RegistryErrorIndex = NO_ERROR
  182.    set-subst LF = "\n"
  183.    read-syms CardExisted$(!STF_LANGUAGE)
  184.    set DlgText = $(Text)
  185.    Shell "Subroutn.Inf" SetupMessage $(!STF_LANGUAGE) "WARNING" $(DlgText)
  186.    ifint $($ShellCode) != $(!SHELL_CODE_OK)
  187.         set RegistryErrorIndex = ERROR
  188.    endif
  189.    return $(RegistryErrorIndex), $($R1)
  190. [CreateService]
  191.     read-syms InitBaseVars
  192.     set CS_NameOfService = $($0)
  193.     set CS_DisplayName   = $($1)
  194.     set CS_ImagePath     = $($2)
  195.     set CS_TypeOfService = $($3)
  196.     set CS_Group         = $($4)
  197.     set CS_Dependencies  = $($5)
  198.     set CS_ObjectName    = $($6)
  199.     set CS_EventFile     = $($7)
  200.     set CS_TypeSupported = $($8)
  201.     ifstr(i) $(CS_TypeSupported) == ""
  202.         set CS_TypeSupported = 7
  203.     endif
  204.     set CS_EventLogLocation = $($9)
  205.     ifstr(i) $(CS_EventLogLocation) == ""
  206.         set CS_EventLogLocation = "System"
  207.     endif
  208.     set CS_ErrorControl = $($10)
  209.     ifstr(i) $(CS_ErrorControl) == ""
  210.         set CS_ErrorControl = 1
  211.     endif
  212.     set CS_EventSourceName = $($11)
  213.     ifstr(i) $(CS_EventSourceName) == ""
  214.         set CS_EventSourceName = $(CS_NameOfService)
  215.     endif
  216.     set CS_KeyServices   = ""
  217.     set CS_KeyTempSvc    = ""
  218.     set CS_KeySvcManager = ""
  219.     set CS_KeyParameters = ""
  220.     set CS_KeyLinkage    = ""
  221.     set CS_UseRegistry   = $(!NTN_ScUseRegistry)
  222.     Debug-Output "UTILITY.INF: [CreateService] entered for "$(CS_NameOfService)
  223.     Ifstr(i) $(CS_UseRegistry) != "YES"
  224.         Ifstr(i) $(CS_UseRegistry) != "NO"
  225.             Set CS_UseRegistry = "NO"
  226.         Endif
  227.     Endif
  228.     Ifstr(i) $(CS_Dependencies) == ""
  229.         Set CS_Dependencies = {}
  230.     Endif
  231.     Shell "", BaseServiceKey
  232.     set RegistryErrorIndex = $($R0)
  233.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  234.        set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  235.        goto C_S_Return
  236.     endif
  237.     set CS_KeyServices = $($R1)
  238.     ifstr(i) $(CS_TypeOfService) == "system"
  239.         set TypeValue = 2
  240.         set StartValue = 3
  241.     else-ifstr(i) $(CS_TypeOfService) == "systemstart"
  242.         set TypeValue = 2
  243.         set StartValue = 1
  244.     else-ifstr(i) $(CS_TypeOfService) == "systemauto"
  245.         set TypeValue = 2
  246.         set StartValue = 2
  247.     else-ifstr(i) $(CS_TypeOfService) == "adapter"
  248.         set TypeValue = 4
  249.         set StartValue = 3
  250.         Set CS_UseRegistry = "YES"
  251.     else-ifstr(i) $(CS_TypeOfService) == "kernelauto"
  252.         set TypeValue = 1
  253.         set StartValue = 1
  254.     else-ifstr(i) $(CS_TypeOfService) == "autoserviceshare"
  255.         set TypeValue = 32
  256.         set StartValue = 2
  257.     else-ifstr(i) $(CS_TypeOfService) == "transport"
  258.         set TypeValue = 2
  259.         set StartValue = 3
  260.     else-ifstr(i) $(CS_TypeOfService) == "kernel"
  261.         set TypeValue = 1
  262.         set StartValue = 3
  263.     else-ifstr(i) $(CS_TypeOfService) == "kernelautostart"
  264.         set TypeValue = 1
  265.         set StartValue = 2
  266.     else-ifstr(i) $(CS_TypeOfService) == "kerneldisable"
  267.         set TypeValue = 1
  268.         set StartValue = 4
  269.     else-ifstr(i) $(CS_TypeOfService) == "service"
  270.         set TypeValue = 16
  271.         set StartValue = 3
  272.     else-ifstr(i) $(CS_TypeOfService) == "serviceauto"
  273.         set TypeValue = 16
  274.         set StartValue = 2
  275.     else-ifstr(i) $(CS_TypeOfService) == "serviceshare"
  276.         set TypeValue = 32
  277.         set StartValue = 3
  278.     else
  279.         Set CS_UseRegistry = "YES"
  280.         Debug-Output "UTILITY.INF: [CreateService] Unrecognized TypeOfService parameter"
  281.         set TypeValue = 4
  282.         set StartValue = 3
  283.     endif
  284.     Ifint $(TypeValue) > 4
  285.         Ifstr(i) $(CS_ObjectName) == ""
  286.             set CS_ObjectName = "LocalSystem"
  287.         Endif
  288.     Endif
  289.     OpenRegKey $(CS_KeyServices) "" $(CS_NameOfService) $(MAXIMUM_ALLOWED) +
  290.         CS_KeyTempSvc
  291.     ifstr $(CS_KeyTempSvc) != $(KeyNull)
  292.         GetRegValue $(CS_KeyTempSvc),"DeleteFlag", DeleteFlagInfo
  293.         set DeleteFlag = *($(DeleteFlagInfo), 4)
  294.         ifint $(DeleteFlag) == 1
  295.             Set RegistryErrorIndex = REBOOT_MACHINE_BEFORE_ADD_ADAPTER
  296.             goto C_S_Return
  297.         endif
  298.     endif
  299.     ifstr(i) $(CS_UseRegistry) == "YES"
  300.         Debug-Output "UTILITY.INF: [CreateService] "$(CS_NameOfService)" using Registry"
  301.         OpenRegKey $(CS_KeyServices) "" $(CS_NameOfService) $(MAXIMUM_ALLOWED) +
  302.         CS_KeyTempSvc
  303.         ifstr $(CS_KeyTempSvc) == $(KeyNull)
  304.            CreateRegKey $(CS_KeyServices) {$(CS_NameOfService),$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" CS_KeyTempSvc
  305.         else
  306.            Debug-Output "UTILITY.INF: service key "$(CS_NameOfService)" already existed"
  307.            Set RegistryErrorIndex = UNABLE_CREATE_CONFIGURE_SERVICE
  308.            CloseRegKey $(CS_KeyTempSvc)
  309.            CloseRegKey $(CS_KeyServices)
  310.            Goto C_S_Return
  311.         endif
  312.         Ifstr(i) $(CS_KeyTempSvc) == $(KeyNull)
  313.            Debug-Output "UTILITY.INF: could not create service key "$(CS_NameOfService)
  314.            Set RegistryErrorIndex = UNABLE_CREATE_CONFIGURE_SERVICE
  315.            CloseRegKey $(CS_KeyTempSvc)
  316.            CloseRegKey $(CS_KeyServices)
  317.            Goto C_S_Return
  318.         else
  319.             set NewValueList = {+
  320.                                {Type,$(NoTitle),$(!REG_VT_DWORD),$(TypeValue)},+
  321.                                {Start,$(NoTitle),$(!REG_VT_DWORD),$(StartValue)},+
  322.                                {ErrorControl,$(NoTitle),$(!REG_VT_DWORD),$(CS_ErrorControl)}+
  323.                                }
  324.             Ifint $(TypeValue) > 4
  325.                 Set NewValueList = >($(NewValueList), +
  326.                         {ObjectName,$(NoTitle),$(!REG_VT_SZ),$(CS_ObjectName)})
  327.             Endif
  328.             ifstr(i) $(CS_Group) != ""
  329.                 set NewValueList = >($(NewValueList), +
  330.                         {Group,$(NoTitle),$(!REG_VT_SZ),$(CS_Group)})
  331.             endif
  332.             ifstr(i) $(CS_ImagePath) != ""
  333.                 set NewValueList = >($(NewValueList), +
  334.                         {ImagePath,$(NoTitle),$(!REG_VT_EXPAND_SZ),$(CS_ImagePath)})
  335.             endif
  336.             ifstr(i) $(CS_Dependencies) != ""
  337.                 ifstr(i) $(CS_Dependencies) != {}
  338.                     set NewValueList = >($(NewValueList), +
  339.                         {Dependencies,$(NoTitle),$(!REG_VT_MULTI_SZ),$(CS_Dependencies)})
  340.                 endif
  341.             endif
  342.             Shell "", AddValueList, $(CS_KeyTempSvc), $(NewValueList)
  343.             set RegistryErrorIndex = $($R0)
  344.             Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  345.                     Debug-Output "Registry error: Add value list"
  346.             endif
  347.         endif
  348.     else
  349.         Debug-Output "UTILITY.INF: [CreateService] "$(CS_NameOfService)" using CreateService() wrapper"
  350.         Set FLibraryErrCtl = 1
  351.         LibraryProcedure CS_CreateResult $(!NCPA_HANDLE), CPlSetup, $(!STF_HWND), CREATESVC,+
  352.             $(CS_NameOfService), $(CS_DisplayName), $(StartValue), $(TypeValue), $(CS_ErrorControl),+
  353.             $(CS_ImagePath), $(CS_Group),$(CS_Dependencies),$(CS_ObjectName)
  354.         Set FLibraryErrCtl = 0
  355.         Set CS_CreateError = *($(CS_CreateResult),1)
  356.         Ifint $(CS_CreateError) != 0
  357.              Debug-Output "UTILITY.INF: CreateService wrapper failed, error: "$(CS_CreateResult)
  358.              Ifint $(CS_CreateResult) == 1073
  359.                  Set RegistryErrorIndex = SERVICE_ALREADY_EXISTS
  360.              Else-ifint $(CS_CreateResult) == 1072
  361.                  Set RegistryErrorIndex = SERVICE_MARKED_FOR_DELETE
  362.              Else
  363.                  Set RegistryErrorIndex = UNABLE_CREATE_CONFIGURE_SERVICE
  364.              Endif
  365.              CloseRegKey $(CS_KeyTempSvc)
  366.              CloseRegKey $(CS_KeyServices)
  367.              Goto C_S_Return
  368.         Endif
  369.         OpenRegKey $(CS_KeyServices) "" $(CS_NameOfService) $(MAXIMUM_ALLOWED) CS_KeyTempSvc
  370.         ifstr $(CS_KeyTempSvc) == $(KeyNull)
  371.              Debug-Output "UTILITY.INF: unable to open new service key"
  372.              set RegistryErrorIndex = UNABLE_CREATE_CONFIGURE_SERVICE
  373.              CloseRegKey $(CS_KeyTempSvc)
  374.              CloseRegKey $(CS_KeyServices)
  375.              Goto C_S_Return
  376.         endif
  377.     endif
  378.     OpenRegKey $(CS_KeyTempSvc) "" "Parameters" $(MAXIMUM_ALLOWED) +
  379.         CS_KeyParameters
  380.     ifstr $(CS_KeyParameters) == $(KeyNull)
  381.         CreateRegKey $(CS_KeyTempSvc) {"Parameters",$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" CS_KeyParameters
  382.     endif
  383.     Ifstr $(CS_KeyParameters) == $(KeyNull)
  384.        set RegistryErrorIndex = UNABLE_CREATE_SERVICE_SUBKEY
  385.        CloseRegKey $(CS_KeyTempSvc)
  386.        CloseRegKey $(CS_KeyServices)
  387.        goto C_S_Return
  388.     endif
  389.     set RegistryErrorIndex = NO_ERROR
  390.     OpenRegKey $(CS_KeyTempSvc) "" "Linkage" $(MAXIMUM_ALLOWED) CS_KeyLinkage
  391.     Ifstr $(CS_KeyLinkage) == $(KeyNull)
  392.         CreateRegKey $(CS_KeyTempSvc) {"Linkage",$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" CS_KeyLinkage
  393.     Endif
  394.     Ifstr $(CS_KeyLinkage) == $(KeyNull)
  395.        set RegistryErrorIndex = UNABLE_CREATE_SERVICE_SUBKEY
  396.        CloseRegKey $(CS_KeyTempSvc)
  397.        CloseRegKey $(CS_KeyServices)
  398.        goto C_S_Return
  399.     endif
  400.     OpenRegKey $(CS_KeyLinkage) "" "Disabled" $(MAXIMUM_ALLOWED) CS_KeyDisabled
  401.     Ifstr $(CS_KeyDisabled) == $(KeyNull)
  402.         CreateRegKey $(CS_KeyLinkage) {"Disabled",$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" CS_KeyDisabled
  403.     Endif
  404.     Ifstr $(CS_KeyDisabled) == $(KeyNull)
  405.        set RegistryErrorIndex = UNABLE_CREATE_SERVICE_SUBKEY
  406.        CloseRegKey $(CS_KeyTempSvc)
  407.        CloseRegKey $(CS_KeyServices)
  408.        CloseRegKey $(CS_KeyLinkage)
  409.        goto C_S_Return
  410.     endif
  411.     CloseRegKey $(CS_KeyDisabled)
  412.     ifstr(i) $(CS_EventFile) != ""
  413.         OpenRegKey $(!REG_H_LOCAL) "" "SYSTEM\CurrentControlSet\Services\EventLog\"$(CS_EventLogLocation) $(MAXIMUM_ALLOWED) CS_KeyEventLog
  414.         Ifstr $(CS_KeyEventLog) == $(KeyNull)
  415.            debug-output "Cannot open eventlog key"
  416.            set RegistryErrorIndex = UNABLE_OPEN_EVENTLOG_SUBKEY
  417.            CloseRegKey $(CS_KeyTempSvc)
  418.            CloseRegKey $(CS_KeyServices)
  419.            CloseRegKey $(CS_KeyParameters)
  420.            CloseRegKey $(CS_KeyLinkage)
  421.            goto C_S_Return
  422.         else
  423.            OpenRegKey $(CS_KeyEventLog) "" $(CS_EventSourceName) $(MAXIMUM_ALLOWED) CS_KeyService
  424.            ifstr(i) $(CS_KeyService) == ""
  425.                CreateRegKey $(CS_KeyEventLog) {$(CS_EventSourceName),$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" CS_KeyService
  426.            endif
  427.            Ifstr $(CS_KeyService) != $(KeyNull)
  428.                SetRegValue $(CS_KeyService) {EventMessageFile,$(NoTitle),$(!REG_VT_EXPAND_SZ),$(CS_EventFile)}
  429.                SetRegValue $(CS_KeyService) {TypesSupported,$(NoTitle),$(!REG_VT_DWORD),$(CS_TypeSupported)}
  430.                CloseRegKey $(CS_KeyService)
  431.            endif
  432.         Endif
  433.     endif
  434. C_S_Return = +
  435.     Ifstr $(CS_KeyServices) != $(KeyNull)
  436.         CloseRegKey $(CS_KeyServices)
  437.     endif
  438.     return $(RegistryErrorIndex), $(CS_KeyTempSvc), $(CS_KeyParameters), $(CS_KeyLinkage)
  439. [AssignAdapterNumber]
  440.     read-syms InitBaseVars
  441.     set AA_AdapterNumber = 1
  442.     set AA_KeyNetcards = ""
  443.     set AA_KeyTemp = ""
  444.     set RegistryErrorIndex = NO_ERROR
  445.     OpenRegKey $(!REG_H_LOCAL) "" $(NetworkCardKeyName) $(MAXIMUM_ALLOWED) AA_KeyNetcards
  446.     Ifstr $(AA_KeyNetcards) == $(KeyNull)
  447.        set RegistryErrorIndex = UNABLE_OPEN_NETWORKCARD_SECTION
  448.        goto A_A_Return
  449.     endif
  450. A_A_TryAgain = +
  451.     Ifint $(AA_AdapterNumber) > 100
  452.         Set AA_AdapterNumber = 0
  453.         Set RegistryErrorIndex = UNABLE_OPEN_NETWORKCARD_SECTION
  454.         Goto A_A_Found
  455.     Endif
  456.     ifint $(AA_AdapterNumber) < 10
  457.         set Tmp_AA_AdapterNumber = "0"$(AA_AdapterNumber)
  458.     else
  459.         set Tmp_AA_AdapterNumber = $(AA_AdapterNumber)
  460.     endif
  461.     OpenRegKey $(AA_KeyNetcards) "" $(Tmp_AA_AdapterNumber) $(MAXIMUM_ALLOWED) AA_KeyTemp
  462.     Ifstr $(AA_KeyTemp) == $(KeyNull)
  463.         Goto A_A_Found
  464.     Endif
  465.     CloseRegKey $(AA_KeyTemp)
  466.     Set AA_KeyTemp = $(KeyNull)
  467.     Set-add AA_AdapterNumber = $(AA_AdapterNumber),1
  468.     Goto A_A_TryAgain
  469. A_A_Found =+
  470.     IfInt $(AA_AdapterNumber) <= 9
  471.         set AA_AdapterNumber = "0"$(AA_AdapterNumber)
  472.     endif
  473.     CloseRegKey $(AA_KeyNetcards)
  474. A_A_Return = +
  475.     return $(RegistryErrorIndex) $(AA_AdapterNumber)
  476. [InstallNetcard]
  477.    read-syms InitBaseVars
  478.    set IN_Infname     = $($0)
  479.    set IN_CardNumber  = 0
  480.    set IN_KeyNetcard  = ""
  481.    set IN_KeyNetRules = ""
  482.     Shell "" AssignAdapterNumber
  483.     set RegistryErrorIndex = $($R0)
  484.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  485.         goto I_N_Return
  486.     endif
  487.     set IN_CardNumber = $($R1)
  488.     CreateRegKey $(!REG_H_LOCAL) {$(NetworkCardKeyName)\$(IN_CardNumber),$(NoTitle),GenericClass} +
  489.                   "" $(MAXIMUM_ALLOWED) "" IN_KeyNetcard
  490.     Ifstr $(IN_KeyNetcard) == $(KeyNull)
  491.        set RegistryErrorIndex = UNABLE_CREATE_NETCARD_CONFIGURATION
  492.        goto I_N_Return
  493.     endif
  494.     CreateRegKey $(IN_KeyNetcard) {NetRules,$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" IN_KeyNetRules
  495.     Ifstr $(IN_KeyNetRules) == $(KeyNull)
  496.        set RegistryErrorIndex = UNABLE_CREATE_NETRULES_KEY
  497.        goto I_N_Return
  498.     endif
  499.     Ifstr $(IN_Infname) != ""
  500.        Shell "", ReduceInfPath, $(IN_Infname)
  501.        SetRegValue $(IN_KeyNetRules) {InfName,$(NoTitle),$(!REG_VT_SZ),$($R0)}
  502.     endif
  503.     set RegistryErrorIndex = NO_ERROR
  504. I_N_Return = +
  505.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  506.         Debug-Output "UTILITY.INF: [InstallNetcard]: "$(RegistryErrorIndex)
  507.         Ifstr $(IN_KeyNetRules) != $(KeyNull)
  508.             CloseRegKey $(IN_KeyNetRules)
  509.             set IN_KeyNetrules = ''
  510.         endif
  511.         set IN_KeyNetcard = ""
  512.     endif
  513.     return $(RegistryErrorIndex), $(IN_KeyNetcard), $(IN_CardNumber), $(IN_KeyNetRules)
  514. [LinkToService]
  515.     read-syms InitBaseVars
  516.     SetRegValue $($0) {ServiceName,$(NoTitle),$(!REG_VT_SZ),$($1)}
  517. L_S_Return = +
  518.     return $(RegistryErrorIndex)
  519. [IncrementRefCount]
  520.     read-syms InitBaseVars
  521.     OpenRegKey $(!REG_H_LOCAL) "" $($0) $(MAXIMUM_ALLOWED) SoftwareKey
  522.     Ifstr $(SoftwareKey) == $(KeyNull)
  523.        Debug-Output "UTILITY.INF: could not open Software base key"
  524.        set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  525.        goto IncrementRefCount_Return
  526.     endif
  527.     GetRegValue $(SoftwareKey),"RefCount", RefCountInfo
  528.     set RefCount = *($(RefCountInfo), 4)
  529.     Set-add RefCount = $(RefCount),1
  530.     SetRegValue $(SoftwareKey) {RefCount,$(NoTitle),$(!REG_VT_DWORD),$(RefCount)}
  531.     CloseRegKey $(SoftwareKey)
  532. IncrementRefCount_Return = +
  533.     return $(RegistryErrorIndex)
  534. [DecrementRefCount]
  535.     read-syms InitBaseVars
  536.     OpenRegKey $(!REG_H_LOCAL) "" $($0) $(MAXIMUM_ALLOWED) SoftwareKey
  537.     Ifstr $(SoftwareKey) == $(KeyNull)
  538.        Debug-Output "UTILITY.INF: could not open Software base key"
  539.        set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  540.        goto DecrementRefCount_Return
  541.     endif
  542.     GetRegValue $(SoftwareKey),"RefCount", RefCountInfo
  543.     set RefCount = *($(RefCountInfo), 4)
  544.     ifint $(RefCount) == 0
  545.         goto DecrementRefCount_Return
  546.     endif
  547.     Set-sub RefCount = $(RefCount),1
  548.     SetRegValue $(SoftwareKey) {RefCount,$(NoTitle),$(!REG_VT_DWORD),$(RefCount)}
  549.     CloseRegKey $(SoftwareKey)
  550. DecrementRefCount_Return = +
  551.     return $(RegistryErrorIndex)
  552. [IsRefCountEqualZero]
  553.     read-syms InitBaseVars
  554.     OpenRegKey $(!REG_H_LOCAL) "" $($0) $(MAXIMUM_ALLOWED) SoftwareKey
  555.     Ifstr $(SoftwareKey) == $(KeyNull)
  556.        Debug-Output "UTILITY.INF: could not open Software base key"
  557.        set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  558.        goto IsRefCountEqualZero_Return
  559.     endif
  560.     GetRegValue $(SoftwareKey),"RefCount", RefCountInfo
  561.     set RefCount = *($(RefCountInfo), 4)
  562.     Ifint $(RefCount) == 0
  563.         set RefCountEqualZero = 1
  564.     else
  565.         set RefCountEqualZero = 0
  566.     endif
  567.     CloseRegKey $(SoftwareKey)
  568. IsRefCountEqualZero_Return = +
  569.     return $(RegistryErrorIndex) $(RefCountEqualZero)
  570. [FindService]
  571.     read-syms InitBaseVars
  572.     set FS_KeyThisService = ""
  573.     set FS_KeyParameters  = ""
  574.     set FS_KeyComponent   = $($0)
  575.     set FS_TypeComponent  = $($1)
  576.     Shell "", BaseServiceKey
  577.     set FS_KeyServices = $($R1)
  578.     set RegistryErrorIndex = $($R0)
  579.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  580.        goto F_S_Return
  581.     endif
  582.     EnumRegValue $(FS_KeyComponent) FS_ValueList
  583.     set FS_SvcName = ""
  584.     ForListDo $(FS_ValueList)
  585.         set FS_ValueName = *($($),1)
  586.         Ifstr(i) $(FS_ValueName) == ServiceName
  587.             set FS_SvcName = *($($),4)
  588.             goto F_S_Break1
  589.         endif
  590.     EndForListDo
  591. F_S_Break1 = +
  592.     Ifstr $(FS_SvcName) == $(KeyNull)
  593.        set RegistryErrorIndex = CANNOT_FIND_COMPONENT_SERVICE
  594.        goto F_S_Return
  595.     endif
  596.     OpenRegKey $(FS_KeyServices) "" $(FS_SvcName) $(MAXIMUM_ALLOWED) FS_KeyThisService
  597.     Ifstr $(FS_KeyThisService) == $(KeyNull)
  598.        set RegistryErrorIndex = CANNOT_FIND_COMPONENT_SERVICE
  599.        goto F_S_Return
  600.     endif
  601.     OpenRegKey $(FS_KeyThisService) "" "Parameters" $(MAXIMUM_ALLOWED) FS_KeyParameters
  602.     Ifstr $(FS_KeyParameters) == $(KeyNull)
  603.        set RegistryErrorIndex = CANNOT_FIND_COMPONENT_SERVICE
  604.        goto F_S_Return
  605.     endif
  606. F_S_Return = +
  607.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  608.         Ifstr $(FS_KeyParameters) != $(KeyNull)
  609.             CloseRegKey $(FS_KeyParameters)
  610.         endif
  611.         Ifstr $(FS_KeyThisService) != $(KeyNull)
  612.            CloseRegKey $(FS_KeyThisService)
  613.         endif
  614.     endif
  615.     return $(RegistryErrorIndex), $(FS_KeyThisService) $(FS_KeyParameters)
  616. [GetServiceParameters]
  617.     read-syms InitBaseVars
  618.     set GP_KeyComponent = $($0)
  619.     set GP_KeyService = ""
  620.     set GP_KeyParameters = ""
  621.     set GP_ValueList  = {}
  622.     FindService $(GP_KeyComponent) $($1)
  623.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  624.         goto G_P_Return
  625.     endif
  626.     set GP_KeyService = $($R1)
  627.     set GP_KeyParameters = $($R2)
  628.     EnumRegValue $(GP_KeyParameters) GP_ValueList
  629. G_P_Return = +
  630.     return $(RegistryErrorIndex) $(GP_KeyService) $(GP_KeyParameters) $(GP_ValueList)
  631. [AddSoftwareComponent]
  632.     read-syms InitBaseVars
  633.     set AS_MfgName       = $($0)
  634.     set AS_ProdName      = $($1)
  635.     set AS_SvcName       = $($2)
  636.     set AS_DisplayName   = $($3)
  637.     set AS_Infname       = $($4)
  638.     set AS_ImagePath     = $($5)
  639.     set AS_ServiceType   = $($6)
  640.     set AS_Group         = $($7)
  641.     set AS_Dependencies  = $($8)
  642.     set AS_ObjectName    = $($9)
  643.     set AS_EventFile     = $($10)
  644.     set AS_TypeSupported = $($11)
  645.     set AS_EventLocation = $($12)
  646.     set AS_ErrorCtlValue = $($13)
  647.     set AS_EventSource   = $($14)
  648.     set AS_KeyVersion    = ""
  649.     set AS_KeyNetRules   = ""
  650.     set AS_KeyService    = ""
  651.     set AS_KeyParameters = ""
  652.     set AS_KeyLinkage    = ""
  653.     Shell "", CreateService,$(AS_SvcName),$(AS_DisplayName),$(AS_ImagePath),+
  654.           $(AS_ServiceType),$(AS_Group),$(AS_Dependencies),$(AS_ObjectName),+
  655.           $(AS_EventFile),$(AS_TypeSupported),+
  656.           $(AS_EventLocation),$(AS_ErrorCtlValue),$(AS_EventSource)
  657.     set RegistryErrorIndex = $($R0)
  658.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  659.        goto A_S_Return
  660.     endif
  661.     set AS_KeyService    = $($R1)
  662.     set AS_KeyParameters = $($R2)
  663.     set AS_KeyLinkage    = $($R3)
  664.     Shell "", InstallSoftwareProduct, $(AS_MfgName), $(AS_ProdName), $(AS_Infname)
  665.     set RegistryErrorIndex = $($R0)
  666.     Ifstr(i) $(RegistryErrorIndex) == NO_ERROR
  667.         set AS_KeyVersion  = $($R1)
  668.         set AS_KeyNetRules = $($R2)
  669.         Shell "", LinkToService, $(AS_KeyVersion), $(AS_SvcName), service
  670.         set RegistryErrorIndex = $($R0)
  671.         Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  672.             goto A_S_Return
  673.         endif
  674.         GetRegValue $(AS_KeyVersion),"RefCount", RefCountInfo
  675.         Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  676.             SetRegValue $(AS_KeyVersion) {RefCount,$(NoTitle),$(!REG_VT_DWORD),0}
  677.         endif
  678.     endif
  679. A_S_Return = +
  680.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  681.        Ifstr $(AS_KeyNetRules) != $(KeyNull)
  682.           CloseRegKey $(AS_KeyNetRules)
  683.        endif
  684.        Ifstr $(AS_KeyParameters) != $(KeyNull)
  685.           CloseRegKey $(AS_KeyParameters)
  686.        endif
  687.        Ifstr $(AS_KeyLinkage) != $(KeyNull)
  688.           CloseRegKey $(AS_KeyLinkage)
  689.        endif
  690.        Ifstr $(AS_KeyVersion) != $(KeyNull)
  691.           CloseRegKey $(AS_KeyVersion)
  692.           Set AS_ProdKeyName = $(!NTN_SoftwareBase)"\"$(AS_MfgName)"\"$(AS_ProdName)
  693.           OpenRegKey $(!REG_H_LOCAL) "" $(AS_ProdKeyName) $(MAXIMUM_ALLOWED) AS_KeyProduct
  694.           Ifstr(i) $(AS_KeyProduct) != $(KeyNull)
  695.               DeleteRegKey $(AS_KeyProduct) "CurrentVersion"
  696.               CloseRegKey $(AS_KeyProduct)
  697.           Endif
  698.        Endif
  699.        Ifstr $(AS_KeyService) != $(KeyNull)
  700.           Debug-Output "UTILITY.INF: DeleteRegTree Service Key"
  701.        endif
  702.        set AS_KeyVersion = ""
  703.        set AS_KeyNetRules = ""
  704.        set AS_KeyService = ""
  705.        set AS_KeyParameters = ""
  706.        set AS_KeyLinkage = ""
  707.     endif
  708.     return $(RegistryErrorIndex), $(AS_KeyVersion), $(AS_KeyNetRules), $(AS_KeyService),+
  709.            $(AS_KeyParameters), $(AS_KeyLinkage)
  710. [AddHardwareComponent]
  711.     read-syms InitBaseVars
  712.     set AH_SvcName       = $($0)
  713.     set AH_Infname       = $($1)
  714.     set AH_SoftwareName  = $($2)
  715.     set AH_KeyNetcard    = ""
  716.     set AH_KeyNetRules   = ""
  717.     set AH_KeyService    = ""
  718.     set AH_KeyParameters = ""
  719.     set AH_AdapNum       = -1
  720.     Shell "", InstallNetcard, $(AH_Infname)
  721.     set RegistryErrorIndex = $($R0)
  722.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  723.         Debug-Output "UTILITY.INF: [AddHardwareComponent] InstallNetcard returned: "$(RegistryErrorIndex)
  724.         goto A_H_Return
  725.     endif
  726.     set AH_KeyNetcard  = $($R1)
  727.     set AH_AdapNum     = $($R2)
  728.     set AH_SvcName     = $(AH_SvcName)$(AH_AdapNum)
  729.     set AH_KeyNetRules = $($R3)
  730.     Shell "", CreateService, $(AH_SvcName), "", "", "adapter","",{}
  731.     set RegistryErrorIndex = $($R0)
  732.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  733.         Debug-Output "UTILITY.INF: CreateService returned "$(RegistryErrorIndex)
  734.         goto A_H_Return
  735.     endif
  736.     CloseRegKey $($R1)
  737.     set AH_KeyParameters = $($R2)
  738.     CloseRegKey $($R3)
  739.     Ifstr $(AH_KeyParameters) != ""
  740.        SetRegValue $(AH_KeyParameters) {BusNumber,$(NoTitle),$(!REG_VT_DWORD),0}
  741.     endif
  742.     Shell "", LinkToService, $(AH_KeyNetcard), $(AH_SvcName)
  743.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  744.         Debug-Output "UTILITY.INF: [AddHardwareComponent] LinkToService returned "$(RegistryErrorIndex)
  745.         goto A_H_Return
  746.     endif
  747.     Shell "", IncrementRefCount, $(AH_SoftwareName)
  748.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  749.         Debug-Output "UTILITY.INF: [AddHardwareComponent] IncrementRefCount returned "$(RegistryErrorIndex)
  750.         goto A_H_Return
  751.     endif
  752. A_H_Return = +
  753.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  754.         Debug-Output "UTILITY.INF: [AddHardwareComponent] returning error: "$(RegistryErrorIndex)
  755.         Ifstr(i) $(AH_KeyNetRules) != $(KeyNull)
  756.            CloseRegKey $(AH_KeyNetRules)
  757.         Endif
  758.         Ifstr(i) $(AH_KeyNetcard) != $(KeyNull)
  759.         Endif
  760.         set AH_KeyNetRules = ""
  761.         set AH_KeyNetcard = ""
  762.     endif
  763.     return $(RegistryErrorIndex), $(AH_KeyNetcard), $(AH_KeyNetRules), $(AH_KeyParameters),+
  764.            $(AH_AdapNum), $(AH_SvcName)
  765. [MCAFindBus]
  766.     read-syms InitBaseVars
  767.     set RegistryErrorIndex = NO_ERROR
  768.     set MultifunctionAdapter = "HARDWARE\Description\System\MultifunctionAdapter"
  769.     set InfoList = {}
  770.     OpenRegKey $(!REG_H_LOCAL) "" $(MultifunctionAdapter) $(MAXIMUM_ALLOWED) KeyMultiAdapter
  771.     Ifstr $(KeyMultiAdapter) == $(KeyNull)
  772.         goto MCAFindBus_return
  773.     endif
  774.     EnumRegKey $(KeyMultiAdapter) BusList
  775.     Debug-Output "Buslist"
  776.     Debug-Output $(BusList)
  777.     ForListDo $(BusList)
  778.         set BusNum = *($($),1)
  779.         set RegName = $(MultifunctionAdapter)"\"$(BusNum)
  780.         Debug-Output "BusNum"
  781.         Debug-Output $(BusNum)
  782.         OpenRegKey $(!REG_H_LOCAL) "" $(RegName) $(MAXIMUM_ALLOWED) KeyBus
  783.         ifstr $(KeyBus) != $(KeyNull)
  784.             GetRegValue $(KeyBus),"Configuration Data",ConfigData
  785.             ifstr $(ConfigData) != $(KeyNull)
  786.                 set CardInfo = *($(ConfigData), 4 )
  787.                 set Position = 33
  788.                 set SlotNum = 1
  789.                 QueryListSize ListSize $(CardInfo)
  790. Loop1 =+
  791.                 ifint $(Position) < $(ListSize)
  792.                     set-add NextByte = $(Position), 1
  793.                     ifint *($(CardInfo), $(Position)) == $($0)
  794.                         ifint *($(CardInfo), $(NextByte)) == $($1)
  795.                             Debug-Output $(BusNum)
  796.                             Debug-Output $(SlotNum)
  797.                             set-mul mcaid = $($1), 256
  798.                             set-add mcaid = $(mcaid), $($0)
  799.                             set InfoList = >($(InfoList),{$(BusNum),$(SlotNum),$(mcaid)})
  800.                         endif
  801.                     endif
  802.                     set-add Position = $(Position), 6
  803.                     set-add SlotNum = $(SlotNum), 1
  804.                     goto Loop1
  805.                 endif
  806.             endif
  807.             CloseRegKey $(KeyBus)
  808.         endif
  809.     EndForListDo
  810.     CloseRegKey $(KeyMultiAdapter)
  811. MCAFindBus_return = +
  812.     return $(RegistryErrorIndex) $(InfoList)
  813. [EISAFindBus]
  814.     read-syms InitBaseVars
  815.     set MaskNum = $($1)
  816.     ifstr(i) $($1) == ""
  817.         set MaskNum = 16777215  
  818.     endif
  819.     set RegistryErrorIndex = NO_ERROR
  820.     set EISAAdapter = "HARDWARE\Description\System\EISAAdapter"
  821.     set InfoList = {}
  822.     OpenRegKey $(!REG_H_LOCAL) "" $(EISAAdapter) $(MAXIMUM_ALLOWED) KeyEISAAdapter
  823.     Ifstr $(KeyEISAAdapter) == $(KeyNull)
  824.         goto EISAFindBus_return
  825.     endif
  826.     EnumRegKey $(KeyEISAAdapter) BusList
  827.     Debug-Output "Buslist"
  828.     Debug-Output $(BusList)
  829.     ForListDo $(BusList)
  830.         set BusNum = *($($),1)
  831.         OpenRegKey $(!REG_H_LOCAL) "" $(EISAAdapter)"\"$(BusNum) $(MAXIMUM_ALLOWED) KeyEISAAdapterBus
  832.         LibraryProcedure SlotList, $(!LIBHANDLE), GetEisaSlotInformation, $(KeyEISAAdapterBus), "Configuration Data", $($0), $(MaskNum)
  833.         ifstr(i) $(SlotList) != {}
  834.             ForListDo $(SlotList)
  835.                 set SlotNum = $($)
  836.                 ifstr(i) $(SlotNum) != "ERROR"
  837.                     Debug-Output $(BusNum)
  838.                     Debug-Output $(SlotNum)
  839.                     set InfoList = >($(InfoList),{$(BusNum),$(SlotNum),$($0)})
  840.                 endif
  841.             EndForListDo
  842.         endif
  843.     EndForListDo
  844.     CloseRegKey $(KeyEISAAdapter)
  845. EISAFindBus_return = +
  846.     return $(RegistryErrorIndex) $(InfoList)
  847. [AddNetworkProvider]
  848.     read-syms InitBaseVars
  849.     set RegistryErrorIndex = NO_ERROR
  850.     set ProviderDeviceName = $($3)
  851.     ifstr(i) $(ProviderDeviceName) == ""
  852.         set ProviderDeviceName = $($0)
  853.     endif
  854.     OpenRegKey $(!REG_H_LOCAL) "" $(CurrentControlSet)"\control\NetworkProvider\order" $(MAXIMUM_ALLOWED) OrderKey
  855.     ifstr(i) $(OrderKey) == $(KeyNull)
  856.                   CreateRegKey $(!REG_H_LOCAL) {$(CurrentControlSet)"\control\NetworkProvider\order",$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" OrderKey
  857.     endif
  858.     GetRegValue $(OrderKey) "ProviderOrder" OrderValue
  859.     set Order = *($(OrderValue), 4 )
  860.     ifstr(i) $(OrderValue) == $(KeyNull)
  861.                 goto AddFirstProvider
  862.     else-ifstr(i) $(Order) == $(KeyNull)
  863.                 goto AddFirstProvider
  864.     else
  865.                 goto AddProvider
  866.     endif
  867. AddFirstProvider = +
  868.     SetRegValue $(OrderKey) {ProviderOrder,$(NoTitle),$(!REG_VT_SZ),$($0)}
  869.     goto WriteProviderInfo
  870. AddProvider = +
  871.     Split-String $(Order) "," OrderList
  872.     ifContains(i) $($0) in $(OrderList)
  873.     else
  874.         set Order = $(Order)","$($0)
  875.         SetRegValue $(OrderKey) {ProviderOrder,$(NoTitle),$(!REG_VT_SZ),$(Order)}
  876.     endif
  877.     goto WriteProviderInfo
  878. WriteProviderInfo = +
  879.     CloseRegKey $(OrderKey)
  880.     OpenRegKey $(!REG_H_LOCAL) "" $(ServicesBaseName)"\"$($0)"\networkprovider" $(MAXIMUM_ALLOWED) ProviderKey
  881.     Ifstr(i) $(ProviderKey) == $(KeyNull)
  882.         CreateRegKey $(!REG_H_LOCAL) {$(ServicesBaseName)"\"$($0)"\networkprovider",$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" ProviderKey
  883.     endif
  884.     set NewValueList = {{Devicename,$(NoTitle),$(!REG_VT_SZ),"\device\"$(ProviderDeviceName)},+
  885.                         {ProviderPath, $(NoTitle), $(!REG_VT_EXPAND_SZ), $($1)},+
  886.                         {Name, $(NoTitle), $(!REG_VT_SZ), $($2)}}
  887.     Shell "" AddValueList $(ProviderKey) $(NewValueList)
  888.     CloseRegKey $(ProviderKey)
  889. AddNetworkProvider_return = +
  890.     return $(RegistryErrorIndex)
  891. [RemoveNetworkProvider]
  892.     read-syms InitBaseVars
  893.     set RegistryErrorIndex = NO_ERROR
  894.     OpenRegKey $(!REG_H_LOCAL) "" $(CurrentControlSet)"\control\NetworkProvider\order" $(MAXIMUM_ALLOWED) OrderKey
  895.     ifstr(i) $(OrderKey) == $(KeyNull)
  896.         set RegistryErrorIndex = PROVIDER_ORDER_DOES_NOT_EXIST
  897.         goto RemoveNetworkProvider_return
  898.     endif
  899.     GetRegValue $(OrderKey) "ProviderOrder" OrderValue
  900.     set Order = *($(OrderValue), 4 )
  901.     Split-String $(Order) "," OrderList
  902.     set NewOrderList = {}
  903.     set FirstTime = TRUE
  904.     set Found = FALSE
  905.     ForListDo $(OrderList)
  906.         ifstr(i) $($) != ","
  907.             ifstr(i) $($) != $($0)
  908.                 ifstr(i) $(FirstTime) == TRUE
  909.                     set FirstTime = FALSE
  910.                     set NewOrderList = $($)
  911.                 else
  912.                     set NewOrderList = $(NewOrderList)","$($)
  913.                 endif
  914.             else
  915.                 set Found = TRUE
  916.             endif
  917.         endif
  918.     EndForListDo
  919.     ifstr(i) $(Found) == FALSE
  920.         set RegistryErrorIndex = PROVIDER_ORDER_DOES_NOT_EXIST
  921.         goto RemoveNetworkProvider_return
  922.     else
  923.         ifstr(i) $(NewOrderList) == {}
  924.             set NewOrderList = ""
  925.         endif
  926.         SetRegValue $(OrderKey) {ProviderOrder,$(NoTitle),$(!REG_VT_SZ),$(NewOrderList)}
  927.     endif
  928.     OpenRegKey $(!REG_H_LOCAL) "" $(ServicesBaseName) $(MAXIMUM_ALLOWED) ProviderKey
  929.     ifstr $(ProviderKey) != $(KeyNull)
  930.         DeleteRegTree $(ProviderKey) $($0)
  931.     endif
  932. RemoveNetworkProvider_return = +
  933.     return $(RegistryErrorIndex)
  934. [PrepareToCopy]
  935.     Read-syms ProgressCopy$(!STF_LANGUAGE)
  936.     Return STATUS_SUCCESSFUL
  937. [DoAskSource]
  938.     Set DAS_CWDDIR  = $($0)
  939.     Set DAS_SRCDIR  = $($1)
  940.     Set DAS_BUILTIN = $($2)
  941.     Set DAS_Result  = STATUS_FAILED
  942.     Ifstr(i) $(!STF_SRCDIR_OVERRIDE) != ""
  943.         Set DAS_SRCDIR = $(!STF_SRCDIR_OVERRIDE)
  944.         Set DAS_Result = STATUS_SUCCESSFUL
  945.         Goto DAS_exit
  946.     Endif
  947.     Ifstr(i) $(DAS_BUILTIN) == YES
  948.         Ifstr(i) $(!NTN_InstallPhase) == primary
  949.             Ifstr(i) $(!STF_SRCDIR_WINNT) != ""
  950.                 Set DAS_SRCDIR = $(!STF_SRCDIR_WINNT)
  951.             Endif
  952.             Set DAS_Result = STATUS_SUCCESSFUL
  953.             Goto DAS_exit
  954.         Endif
  955.     Endif
  956.     Debug-Output "UTILITY.INF: [DoAskSource] STF_CWDDIR = "$(DAS_CWDDIR)" STF_SRCDIR = "$(DAS_SRCDIR)
  957.     Ifstr(i) $(DAS_SRCDIR) == ""
  958.         Set DAS_SRCDIR = "A:\"
  959.     Endif
  960.     Ifstr(i) $(DAS_SRCDIR) == $(!STF_SRCDIR_USED)
  961.         Set DAS_SRCDIR = $(!STF_SRCDIR_KEYED)
  962.     Endif
  963.     Shell "subroutn.inf" DoAskSource $(DAS_SRCDIR)
  964.     ifint $($ShellCode) != $(!SHELL_CODE_OK)
  965.         Debug-Output "UTILITY.INF: shelling SUBROUTN.INF [DoAskSource] failed"
  966.         goto DAS_exit
  967.     endif
  968.     Set DAS_Result = $($R0)
  969.     Ifstr(i) $(DAS_Result) == STATUS_USERCANCEL
  970.         Set !p:CommonStatus = STATUS_USERCANCEL
  971.         goto DAS_exit
  972.     Endif
  973.     Set DAS_SRCDIR = $($R1)
  974.     Set !STF_SRCDIR_USED = $($R1)
  975.     Set !STF_SRCDIR_KEYED = $($R3)
  976. DAS_exit =+
  977.     Read-syms ProgressCopy$(!STF_LANGUAGE)
  978.     Return $(DAS_Result) $(DAS_SRCDIR)
  979. [RemoveSoftwareComponent]
  980.     Debug-Output "Remove Software Component..."
  981.     read-syms InitBaseVars
  982.     set RS_Manufacturer = $($0)
  983.     set RS_ProductName  = $($1)
  984.     set RS_CheckRefCount = $($2)
  985.     set RS_VersionNum   = "CurrentVersion"
  986.     set RS_ManufacturerKey = $(!NTN_SoftwareBase)"\"$(RS_Manufacturer)
  987.     set RS_ProductKey   = $(!NTN_SoftwareBase)"\"$(RS_Manufacturer)"\"$(RS_ProductName)
  988.     set RS_ProductVerKey        = $(!NTN_SoftwareBase)"\"$(RS_Manufacturer)"\"$(RS_ProductName)"\"$(RS_VersionNum)
  989.     set RegistryErrorIndex      = NO_ERROR
  990.     ifstr(i) $(RS_CheckRefCount) != FALSE
  991.         Shell "", IsRefCountEqualZero, $(RS_ProductVerKey)
  992.         Ifstr(i) $($R0) != NO_ERROR
  993.             Debug-Output "UTILITY.INF: [RemoveSoftwareComponent] IsRefCountEqualZero returned "$($R0)
  994.             goto RemoveSoftwareComponent_Return
  995.         endif
  996.         Ifint $($R1) == 0
  997.             set RegistryErrorIndex = REF_COUNT_NOT_ZERO
  998.             goto RemoveSoftwareComponent_Return
  999.         endif
  1000.     endif
  1001.     OpenRegKey $(!REG_H_LOCAL) "" $(RS_ManufacturerKey) $(MAXIMUM_ALLOWED) ProductKey
  1002.     Ifstr $(ProductKey) == $(KeyNull)
  1003.        Debug-Output "UTILITY.INF: could not open Software product key"
  1004.        set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  1005.        goto RemoveSoftwareComponent_Return
  1006.     endif
  1007.     DeleteRegTree $(ProductKey) $(RS_ProductName)
  1008.     CloseRegKey $(ProductKey)
  1009.     Shell "" RemoveService, $(RS_ProductName), "YES"
  1010.     Set RS_RemoveError = $($R0)
  1011.     Ifint $(RS_RemoveError) != 0
  1012.          Debug-Output "UTILITY.INF: RemoveService wrapper failed, error: "$(RS_RemoveResult)
  1013.          Set RegistryErrorIndex = UNABLE_REMOVE_CONFIGURE_SERVICE
  1014.          Goto RemoveSoftwareComponent_Return
  1015.     Endif
  1016. RemoveSoftwareComponent_Return = +
  1017.     Return $(RegistryErrorIndex)
  1018. [RemoveHardwareComponent]
  1019.     Debug-Output "Remove Hardware Component..."
  1020.     read-syms InitBaseVars
  1021.     set RH_Manufacturer = $($0)
  1022.     set RH_ProductName  = $($1)
  1023.     set RH_VersionNum   = "CurrentVersion"
  1024.     set RH_ProductKey   = $(!NTN_SoftwareBase)"\"$($0)"\"$($1)"\"$(RH_VersionNum)
  1025.     set RH_NetCardName  = $($2)
  1026.     Split-String $(RH_NetCardName), "\", CardInfo
  1027.     set RH_NetCardNum   = *($(CardInfo),11)
  1028.     set RH_NetCardBase  = *($(CardInfo),1)*($(CardInfo),2)*($(CardInfo),3)*($(CardInfo),4)*($(CardInfo),5)*($(CardInfo),6)*($(CardInfo),7)*($(CardInfo),8)*($(CardInfo),9)
  1029.     set RegistryErrorIndex      = NO_ERROR
  1030.     Shell "", DecrementRefCount, $(RH_ProductKey)
  1031.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  1032.         Debug-Output "UTILITY.INF: [AddHardwareComponent] IncrementRefCount returned "$(RegistryErrorIndex)
  1033.         goto RemoveHardwareComponent_Return
  1034.     endif
  1035.     OpenRegKey $(!REG_H_LOCAL) "" $(RH_NetCardBase) $(MAXIMUM_ALLOWED) NetCardKey
  1036.     Ifstr $(NetCardKey) == $(KeyNull)
  1037.        Debug-Output "UTILITY.INF: could not open NetworkCards key"
  1038.        set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  1039.        goto RemoveHardwareComponent_Return
  1040.     endif
  1041.     OpenRegKey $(NetCardKey) "" $(RH_NetCardNum) $(MAXIMUM_ALLOWED) NetCardNumKey
  1042.     Ifstr $(NetCardNumKey) == $(KeyNull)
  1043.        Debug-Output "UTILITY.INF: could not open NetworkCards Number key"
  1044.        set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  1045.        goto RemoveHardwareComponent_Return
  1046.     endif
  1047.     GetRegValue $(NetCardNumKey),"ServiceName", RH_ServiceNameInfo
  1048.     set RH_ServiceName = *($(RH_ServiceNameInfo), 4)
  1049.     ifstr(i) $(RH_ServiceName) == ""
  1050.         set RH_ServiceName = $(RH_ProductName)$(RH_NetCardNum)
  1051.     endif
  1052.     CloseRegKey $(NetCardNumKey)
  1053.     DeleteRegTree $(NetCardKey) $(RH_NetCardNum)
  1054.     CloseRegKey $(NetCardKey)
  1055.     Shell "", RemoveService, $(RH_ServiceName), "NO"
  1056.     Set RS_RemoveError = $($R0)
  1057.     Ifint $(RS_RemoveError) != 0
  1058.          Debug-Output "UTILITY.INF: RemoveService wrapper failed, error: "$(RS_RemoveResult)
  1059.          Set RegistryErrorIndex = UNABLE_REMOVE_CONFIGURE_SERVICE
  1060.          Goto RemoveHardwareComponent_Return
  1061.     Endif
  1062.     Shell "", IsRefCountEqualZero, $(RH_ProductKey)
  1063.     Ifstr(i) $($R0) != NO_ERROR
  1064.         Debug-Output "UTILITY.INF: [RemoveHardwareComponent] IsRefCountEqualZero returned "$($R0)
  1065.         goto RemoveHardwareComponent_Return
  1066.     endif
  1067.     Ifint $($R1) == 1
  1068.         Debug-Output "Remove software component..."
  1069.         Shell "" RemoveSoftwareComponent, $(RH_Manufacturer), $(RH_ProductName)
  1070.         set RegistryErrorIndex = $($R0)
  1071.     endif
  1072.     debug-output "remove netbios information..."
  1073.     LibraryProcedure Result, $(!NCPA_HANDLE), RemoveRouteFromNETBIOS, $(RH_ServiceName)
  1074. RemoveHardwareComponent_Return = +
  1075.     Return $(RegistryErrorIndex)
  1076. [RemoveService]
  1077.     read-syms InitBaseVars
  1078.     Set RS_SvcName = $($0)
  1079.     Set RS_UseDelSvc = $($1)
  1080.     OpenRegKey $(!REG_H_LOCAL) "" "SYSTEM\CurrentControlSet\Services\"$(RS_SvcName) +
  1081.         $(MAXIMUM_ALLOWED) ServiceKey
  1082.     Ifstr $(ServiceKey) == $(KeyNull)
  1083.         Debug-Output "UTILITY.INF: could not open SYSTEM Service key "$(RS_SvcName)
  1084.         goto RemoveService_Return
  1085.     endif
  1086.     OpenRegKey $(ServiceKey) "" "Parameters" $(MAXIMUM_ALLOWED) ParameterKey
  1087.     Ifstr $(ParameterKey) != $(KeyNull)
  1088.          DeleteRegValue $(ParameterKey) "NbProvider"
  1089.          CloseRegKey $(ParameterKey)
  1090.     Endif
  1091.     CloseRegKey $(ServiceKey)
  1092.     ifstr(i) $(RS_UseDelSvc) == "YES"
  1093.         Set FLibraryErrCtl = 1
  1094.         LibraryProcedure RS_RemoveResult $(!NCPA_HANDLE), CPlSetup, +
  1095.           $(!STF_HWND), DELETESVC, $(RS_SvcName)
  1096.         Set FLibraryErrCtl = 0
  1097.         Set RS_RemoveError = *($(RS_RemoveResult),1)
  1098.         Ifint $(RS_RemoveError) != 0
  1099.              Debug-Output "UTILITY.INF: RemoveService wrapper failed, error: "$(RS_RemoveResult)
  1100.              Set RegistryErrorIndex = UNABLE_REMOVE_CONFIGURE_SERVICE
  1101.              Goto RemoveService_Return
  1102.         Endif
  1103.     else
  1104.         OpenRegKey $(!REG_H_LOCAL) "" "SYSTEM\CurrentControlSet\Services" +
  1105.         $(MAXIMUM_ALLOWED) ServiceKey
  1106.         Ifstr $(ServiceKey) == $(KeyNull)
  1107.            Debug-Output "UTILITY.INF: could not open SYSTEM Service key "$(RS_SvcName)
  1108.            set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  1109.            goto RemoveService_Return
  1110.         endif
  1111.         DeleteRegTree $(ServiceKey) $(RS_SvcName)
  1112.         CloseRegKey $(ServiceKey)
  1113.     endif
  1114. RemoveService_Return = +
  1115.     return $(RegistryErrorIndex)
  1116. [IsNetCardAlreadyInstalled]
  1117.     read-syms InitBaseVars
  1118.     set AlreadyExisted  = "NO"
  1119.     set BusNum  = $($0)
  1120.     set SlotNum = $($1)
  1121.     set Description = $($2)
  1122.     set Product = $($3)
  1123.     OpenRegKey $(!REG_H_LOCAL) "" $(NetworkCardKeyName) $(MAXIMUM_ALLOWED) IE_KeyNetcards
  1124.     Ifstr $(IE_KeyNetcards) == $(KeyNull)
  1125.        set RegistryErrorIndex = UNABLE_OPEN_NETWORKCARD_SECTION
  1126.        goto IE_Return
  1127.     endif
  1128.     EnumRegKey $(IE_KeyNetcards) IE_KeyNameList
  1129.     ForListDo  $(IE_KeyNameList)
  1130.         set IE_KeyName = *($($),1)
  1131.         OpenRegKey $(IE_KeyNetcards) "" $(IE_KeyName) $(MAXIMUM_ALLOWED) IE_Card
  1132.         Ifstr $(IE_Card) == $(KeyNull)
  1133.            set RegistryErrorIndex = UNABLE_OPEN_NETWORKCARD_SECTION
  1134.            goto IE_Return
  1135.         endif
  1136.         GetRegValue $(IE_Card),"Description", DescriptionInfo
  1137.         GetRegValue $(IE_Card),"ProductName", ProductNameInfo
  1138.         set CardDescription     = *($(DescriptionInfo), 4)
  1139.         set CardProductName     = *($(ProductNameInfo), 4)
  1140.         ifstr(i) $(CardDescription) == $(Description)
  1141.             ifstr(i) $(CardProductName) == $(Product)
  1142.                 GetRegValue $(IE_Card), "ServiceName", ServiceNameInfo
  1143.                 set ServiceName = *($(ServiceNameInfo), 4)
  1144.                 OpenRegKey $(!REG_H_LOCAL) "" +
  1145.                    $(ServicesBaseName)"\"$(ServiceName)"\Parameters" +
  1146.                    $(MAXIMUM_ALLOWED) IE_KeyService
  1147.                 Ifstr $(IE_KeyService) == $(KeyNull)
  1148.                    set RegistryErrorIndex = UNABLE_OPEN_NETWORKCARD_SECTION
  1149.                    goto IE_Return
  1150.                 endif
  1151.                 GetRegValue $(IE_KeyService), "BusNumber", BusInfo
  1152.                 GetRegValue $(IE_KeyService), "SlotNumber", SlotInfo
  1153.                 set CardBusNum = *($(BusInfo), 4)
  1154.                 set CardSlotNum = *($(SlotInfo), 4)
  1155.                 ifint $(CardBusNum) == $(BusNum)
  1156.                     ifint $(CardSlotNum) == $(SlotNum)
  1157.                         set AlreadyExisted = "YES"
  1158.                     endif
  1159.                 endif
  1160.             endif
  1161.         endif
  1162.     EndForListDo
  1163. IE_Return = +
  1164.     return $(RegistryErrorIndex) $(AlreadyExisted)
  1165. [UpdateWinsockService]
  1166.     read-syms InitBaseVars
  1167.     Set UW_NameOfService = $($0)
  1168.     Set UW_Adding        = $($1)
  1169.     Set UW_KeyServices   = $(KeyNull)
  1170.     Set UW_KeyParameters = $(KeyNull)
  1171.     Shell "", BaseServiceKey
  1172.     Set RegistryErrorIndex = $($R0)
  1173.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  1174.        Set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  1175.        Goto U_W_Return
  1176.     endif
  1177.     Set UW_KeyServices = $($R1)
  1178.     OpenRegKey $(UW_KeyServices) "" "WinSock\Parameters" $(MAXIMUM_ALLOWED) UW_KeyParameters
  1179.     Ifstr(i) $(UW_KeyParameters) == $(KeyNull)
  1180.         Debug-Output "UTILITY.INF:  Create WinSock Service"
  1181.         Shell "", CreateService, "WinSock", "", "", "adapter", "", {}
  1182.         Set RegistryErrorIndex = $($R0)
  1183.         Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  1184.             Debug-Output "UTILITY.INF: CreateService for WinSock returned "$(RegistryErrorIndex)
  1185.             Goto U_W_Return
  1186.         Endif
  1187.         CloseRegKey $($R1)
  1188.         Set UW_KeyParameters = $($R2)
  1189.         CloseRegKey $($R3)
  1190.     Else
  1191.         Debug-Output "UTILITY.INF:  Open WinSock Service"
  1192.     Endif
  1193.     Ifstr(i) $(UW_KeyParameters) == $(KeyNull)
  1194.         Set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  1195.         Goto U_W_Return
  1196.     Endif
  1197.     GetRegValue $(UW_KeyParameters) "Transports" UW_TransportsValue
  1198.     Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
  1199.         Set UW_TransportsList = *($(UW_TransportsValue), 4)
  1200.     Else
  1201.         Set UW_TransportsList = {}
  1202.     Endif
  1203.     Ifstr(i) $(UW_TransportsList) == ""
  1204.         Set UW_TransportsList = {}
  1205.     Endif
  1206.     Ifstr(i) $(UW_Adding) == "TRUE"
  1207.         Set UW_TransportsList = >($(UW_TransportsList), $(UW_NameOfService))
  1208.     Else
  1209.         Set UW_NewList = {}
  1210.         ForListDo $(UW_TransportsList)
  1211.             Ifstr(i) $($) != $(UW_NameOfService)
  1212.                 Set UW_NewList = >($(UW_NewList), $($))
  1213.             Endif
  1214.         EndForListDo
  1215.         Set UW_TransportsList = $(UW_NewList)
  1216.     Endif
  1217.     SetRegValue $(UW_KeyParameters) {Transports, $(NoTitle), $(!REG_VT_MULTI_SZ), $(UW_TransportsList)}
  1218.     Debug-Output "UTILITY.INF:  WinSock transport info added/deleted for "$(UW_NameOfService)
  1219. U_W_Return = +
  1220.     Ifstr $(UW_KeyParameters) != $(KeyNull)
  1221.         CloseRegKey $(UW_KeyParameters)
  1222.     Endif
  1223.     Ifstr $(UW_KeyServices) != $(KeyNull)
  1224.         CloseRegKey $(UW_KeyServices)
  1225.     Endif
  1226.     Return $(RegistryErrorIndex)
  1227. [AddWinsockInfo]
  1228.     read-syms InitBaseVars
  1229.     Set AW_NameOfService = $($0)
  1230.     Set AW_DLLName       = $($1)
  1231.     Set AW_MaxAddrLgt    = $($2)
  1232.     Set AW_MinAddrLgt    = $($3)
  1233.     Set AW_KeyServices   = $(KeyNull)
  1234.     Set AW_KeyParameters = $(KeyNull)
  1235.     Set AW_KeySockets    = $(KeyNull)
  1236.     Shell "", AddAFD
  1237.     Set RegistryErrorIndex = $($R0)
  1238.     Ifstr(i) $(RegistryErrorIndex) == NO_ERROR
  1239.         Shell "", BaseServiceKey
  1240.         Set RegistryErrorIndex = $($R0)
  1241.     Endif
  1242.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  1243.        Set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  1244.        Goto A_W_Return
  1245.     endif
  1246.     Set AW_KeyServices = $($R1)
  1247.     OpenRegKey $(AW_KeyServices) "" $(AW_NameOfService)"\Parameters" $(MAXIMUM_ALLOWED) AW_KeyParameters
  1248.     Ifstr(i) $(AW_KeyParameters) == $(KeyNull)
  1249.        Set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  1250.        Goto A_W_Return
  1251.     Endif
  1252.     OpenRegKey $(AW_KeyParameters) "" "Winsock" $(MAXIMUM_ALLOWED) AW_KeySockets
  1253.     Ifstr(i) $(AW_KeySockets) == $(KeyNull)
  1254.         CreateRegKey $(AW_KeyParameters) {Winsock,$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" AW_KeySockets
  1255.     Endif
  1256.     Ifstr(i) $(AW_KeySockets) == $(KeyNull)
  1257.        Set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  1258.        Goto A_W_Return
  1259.     Endif
  1260.     Set AW_ValueList = {{HelperDllName    ,$(NoTitle),$(!REG_VT_EXPAND_SZ),$(AW_DLLName)},+
  1261.                         {MaxSockAddrLength,$(NoTitle),$(!REG_VT_DWORD),$(AW_MaxAddrLgt)},+
  1262.                         {MinSockAddrLength,$(NoTitle),$(!REG_VT_DWORD),$(AW_MinAddrLgt)}}
  1263.     Shell "", AddValueList, $(AW_KeySockets), $(AW_ValueList)
  1264.     Set RegistryErrorIndex = $($R0)
  1265.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  1266.         Debug-Output "UTILITY.INF: [AddWinsockInfo] Registry error: Add value list"
  1267.     Endif
  1268.     Set FLibraryErrCtl = 1
  1269.     LibraryProcedure AW_MapResult $(!NCPA_HANDLE), CPlSetup, $(!STF_HWND), WINSOCKMAP, $(AW_DLLName), $(AW_KeySockets)
  1270.     Set FLibraryErrCtl = 0
  1271.     Set AW_MapError = *($(AW_MapResult),1)
  1272.     Ifint $(AW_MapError) != 0
  1273.         Debug-Output "UTILITY.INF: [AddWinsockInfo] WINSOCKMAP returned "$(AW_MapError)
  1274.         Set RegistryErrorIndex = UNABLE_ACCESS_WINSOCK_MAP_INFO
  1275.         Goto A_W_Return
  1276.     Endif
  1277.     Shell "" UpdateWinsockService $(AW_NameOfService) TRUE
  1278.     Set RegistryErrorIndex = $($R0)
  1279. A_W_Return = +
  1280.     Ifstr $(AW_KeySockets) != $(KeyNull)
  1281.         CloseRegKey $(AW_KeySockets)
  1282.     Endif
  1283.     Ifstr $(AW_KeyParameters) != $(KeyNull)
  1284.         CloseRegKey $(AW_KeyParameters)
  1285.     Endif
  1286.     Ifstr $(AW_KeyServices) != $(KeyNull)
  1287.         CloseRegKey $(AW_KeyServices)
  1288.     Endif
  1289.     Return $(RegistryErrorIndex)
  1290. [RemoveWinsockInfo]
  1291.     read-syms InitBaseVars
  1292.     Set RW_NameOfService = $($0)
  1293.     Set RW_KeyServices   = $(KeyNull)
  1294.     Set RW_KeySockets    = $(KeyNull)
  1295.     Shell "", BaseServiceKey
  1296.     Set RegistryErrorIndex = $($R0)
  1297.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  1298.        Set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  1299.        Goto R_W_Return
  1300.     endif
  1301.     Set RW_KeyServices = $($R1)
  1302.     OpenRegKey $(RW_KeyServices) "" $(RW_NameOfService)"\Parameters" $(MAXIMUM_ALLOWED) RW_KeySockets
  1303.     Ifstr(i) $(RW_KeySockets) == $(KeyNull)
  1304.        Set RegistryErrorIndex = NO_ERROR
  1305.        Goto R_W_Return
  1306.     Endif
  1307.     DeleteRegTree $(RW_KeySockets) "Winsock"
  1308.     Shell "" UpdateWinsockService $(RW_NameOfService) FALSE
  1309.     Set RegistryErrorIndex = $($R0)
  1310. R_W_Return = +
  1311.     Ifstr $(RW_KeySockets) != $(KeyNull)
  1312.         CloseRegKey $(RW_KeySockets)
  1313.     Endif
  1314.     Ifstr $(RW_KeyServices) != $(KeyNull)
  1315.         CloseRegKey $(RW_KeyServices)
  1316.     Endif
  1317.     Return $(RegistryErrorIndex)
  1318. [BindingInfo-DEC]
  1319. BindingInfo     = {+
  1320.                   "lanceDriver dec100Adapter non exclusive 100",+
  1321.                   "lanceDriver dec101Adapter non exclusive 100",+
  1322.                   "lanceDriver decetherworksturboAdapter non exclusive 100",+
  1323.                   "lanceDriver dec422Adapter non exclusive 100",+
  1324.                   "lanceDriver decpcAdapter non exclusive 100",+
  1325.                   "lanceDriver decstatAdapter non exclusive 100"+
  1326.                   }
  1327. [BindingInfo-WD]
  1328. BindingInfo     = {+
  1329.                           "smc8000nDriver smcisaAdapter non exclusive 100",+
  1330.                           "smc8000nDriver wd8003eaAdapter non exclusive 100",+
  1331.                           "smc8000nDriver wd8003waAdapter non exclusive 100",+
  1332.                           "smc8000nDriver wd8013epaAdapter non exclusive 100",+
  1333.                           "smc8000nDriver wd8013wpaAdapter non exclusive 100"+
  1334.                           }
  1335. [BindingInfo-PROTEON]
  1336. BindingInfo     = {+
  1337.                            "proteonDriver p1990Adapter non exclusive 100",+
  1338.                            "proteonDriver p1390Adapter non exclusive 100"+
  1339.                           }
  1340. [BindingInfo-IBM]
  1341. BindingInfo     = {"ibmtokDriver ibmtokAdapter non exclusive 100",+
  1342.                    "ibmtokDriver ibmtokmcAdapter non exclusive 100"}
  1343. [GetBindingInfo]
  1344.     set BindingInfo = {}
  1345.     read-syms BindingInfo-$($0)
  1346.     return "NO_ERROR", $(BindingInfo)
  1347. [AddStreams]
  1348.     read-syms InitBaseVars
  1349.     OpenRegKey $(!REG_H_LOCAL) "" $(ServicesBaseName)"\streams" $(MAXIMUM_ALLOWED) BS_KeyServices
  1350.     Ifstr $(BS_KeyServices) == $(KeyNull)
  1351.         set OldOption = $(!NTN_InfOption)
  1352.         set !NTN_InfOption = STREAMS
  1353.         Shell "oemnxpst.inf" InstallOption $(!STF_LANGUAGE) "STREAMS" $(!STF_SRCDIR) $(!NtLmAddCopy) $(!NtLmDoCopy) $(!NtLmDoConfig)
  1354.         set !NTN_InfOption = $(OldOption)
  1355.     else
  1356.         CloseRegKey $(BS_KeyServices)
  1357.         Debug-Output "UTILITY.INF: streams already installed"
  1358.     endif
  1359.     Shell "", IncrementRefCount, "Software\Microsoft\streams\CurrentVersion"
  1360. AddStreamsReturn = +
  1361.     return NO_ERROR
  1362. [RemoveStreams]
  1363.     read-syms InitBaseVars
  1364.     OpenRegKey $(!REG_H_LOCAL) "" $(ServicesBaseName)"\streams" $(MAXIMUM_ALLOWED) BS_KeyServices
  1365.     Ifstr $(BS_KeyServices) != $(KeyNull)
  1366.         CloseRegKey $(BS_KeyServices)
  1367.         Shell "", DecrementRefCount, "Software\Microsoft\streams\CurrentVersion"
  1368.         Shell "", IsRefCountEqualZero, "Software\Microsoft\streams\CurrentVersion"
  1369.         Ifstr(i) $($R0) != NO_ERROR
  1370.             Debug-Output "UTILITY.INF: [RemoveSoftwareComponent] IsRefCountEqualZero returned "$($R0)
  1371.             goto RemoveStreamsReturn
  1372.         endif
  1373.         Ifint $($R1) != 1
  1374.             goto RemoveStreamsReturn
  1375.         endif
  1376.         set OldOption = $(!NTN_InfOption)
  1377.         set OldInstallMode = $(!NTN_InstallMode)
  1378.         set !NTN_InfOption = STREAMS
  1379.         set !NTN_InstallMode = deinstall
  1380.         Shell "oemnxpst.inf" InstallOption $(!STF_LANGUAGE) "STREAMS" $(!STF_SRCDIR) $(!NtLmAddCopy) $(!NtLmDoCopy) $(!NtLmDoConfig)
  1381.         set !NTN_InfOption = $(OldOption)
  1382.         set !NTN_InstallMode = $(OldInstallMode)
  1383.     endif
  1384. RemoveStreamsReturn = +
  1385.     return NO_ERROR
  1386. [AFDVars]
  1387. ProductAFDName          = "Afd"
  1388. ProductAFDTitle         = "AFD Networking Support Environment"
  1389. ProductAFDImagePath     = "\SystemRoot\System32\drivers\afd.sys"
  1390. ProductAFDSvcType       = "kernelautostart"
  1391. [AddAFD]
  1392.     read-syms InitBaseVars
  1393.     read-syms AFDVars
  1394.     Set Result = NO_ERROR
  1395.     OpenRegKey $(!REG_H_LOCAL) "" $(ServicesBaseName)"\AFD" $(MAXIMUM_ALLOWED) BS_KeyServices
  1396.     Ifstr $(BS_KeyServices) == $(KeyNull)
  1397.         Shell "", CreateService, $(ProductAFDName),+
  1398.             $(ProductAFDTitle),+
  1399.             $(ProductAFDImagePath),+
  1400.             $(ProductAFDSvcType), "", {"+TDI"}, "",+
  1401.             "%SystemRoot%\System32\IoLogMsg.dll"
  1402.         Set Result = $($R0)
  1403.     else
  1404.         CloseRegKey $(BS_KeyServices)
  1405.     endif
  1406. AddAFDReturn = +
  1407.     return $(Result)
  1408. [GetBusTypeNum]
  1409.     read-syms InitBaseVars
  1410.     set DetCard = $(!p:DetectedCard)
  1411.     ifstr(i) $(DetCard) == ""
  1412.         set DetCard = FALSE
  1413.     endif
  1414.     ifstr(i) $(DetCard) == FALSE
  1415.         set BusType = 1
  1416.         ifstr(i) $(!STF_BUSTYPE) == "ISA"
  1417.             set BusType = 1
  1418.         else-ifstr(i) $(!STF_BUSTYPE) == "EISA"
  1419.             set BusType = 2
  1420.         else-ifstr(i) $(!STF_BUSTYPE) == "Jazz-Internal Bus"
  1421.             set BusType = 0
  1422.         else-ifstr(i) $(!STF_BUSTYPE) == "MCA"
  1423.             set BusType = 3
  1424.         else-ifstr(i) $(!STF_BUSTYPE) == "TCChannel"
  1425.             set BusType = 4
  1426.         else
  1427.             debug-output "Utility.inf: Unknown bus type"
  1428.         endif
  1429.     else
  1430.         set BusType = *($(!STF_NCDETINFO),5)
  1431.     endif
  1432.     return NO_ERROR, $(BusType)
  1433. [AddRpcProtocol]
  1434.     Set ARP_Protocol = $($0)
  1435.     Set ARP_ClientDll = $($1)
  1436.     Set ARP_ServerDll = $($2)
  1437.     read-syms InitBaseVars
  1438.     Set ARP_KeyRpc = $(KeyNull)
  1439.     Set ARP_KeyRpcServer = $(KeyNull)
  1440.     Set ARP_KeyRpcClient = $(KeyNull)
  1441.     Set RegistryErrorIndex = UNABLE_ACCESS_SOFTWARE_REG
  1442.     OpenRegKey $(!REG_H_LOCAL) "" "SOFTWARE\Microsoft\Rpc" $(MAXIMUM_ALLOWED) ARP_KeyRpc
  1443.     Ifstr(i) $(ARP_KeyRpc) == $(KeyNull)
  1444.        Goto ARP_Return
  1445.     Endif
  1446.     OpenRegKey $(ARP_KeyRpc) "" "ClientProtocols" $(MAXIMUM_ALLOWED) ARP_KeyClient
  1447.     Ifstr(i) $(ARP_KeyClient) == $(KeyNull)
  1448.        Goto ARP_Return
  1449.     Endif
  1450.     OpenRegKey $(ARP_KeyRpc) "" "ServerProtocols" $(MAXIMUM_ALLOWED) ARP_KeyServer
  1451.     Ifstr(i) $(ARP_KeyServer) == $(KeyNull)
  1452.        Goto ARP_Return
  1453.     Endif
  1454.     SetRegValue $(ARP_KeyClient) {$(ARP_Protocol),$(NoTitle),$(!REG_VT_SZ),$(ARP_ClientDll)}
  1455.     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  1456.         Goto ARP_Return
  1457.     Endif
  1458.     SetRegValue $(ARP_KeyServer) {$(ARP_Protocol),$(NoTitle),$(!REG_VT_SZ),$(ARP_ServerDll)}
  1459.     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  1460.         Goto ARP_Return
  1461.     Endif
  1462.     Set RegistryErrorIndex = NO_ERROR
  1463. ARP_Return = +
  1464.     Ifstr(i) $(ARP_KeyServer) != $(KeyNull)
  1465.         CloseRegKey $(ARP_KeyServer)
  1466.     Endif
  1467.     Ifstr(i) $(ARP_KeyClient) != $(KeyNull)
  1468.         CloseRegKey $(ARP_KeyClient)
  1469.     Endif
  1470.     Ifstr(i) $(ARP_KeyRpc) != $(KeyNull)
  1471.         CloseRegKey $(ARP_KeyRpc)
  1472.     Endif
  1473.     Return  $(RegistryErrorIndex)
  1474. [RemoveRpcProtocol]
  1475.     Set RRP_Protocol = $($0)
  1476.     read-syms InitBaseVars
  1477.     Set RRP_KeyRpc = $(KeyNull)
  1478.     Set RRP_KeyRpcServer = $(KeyNull)
  1479.     Set RRP_KeyRpcClient = $(KeyNull)
  1480.     Set RegistryErrorIndex = UNABLE_ACCESS_SOFTWARE_REG
  1481.     OpenRegKey $(!REG_H_LOCAL) "" "SOFTWARE\Microsoft\Rpc" $(MAXIMUM_ALLOWED) RRP_KeyRpc
  1482.     Ifstr(i) $(RRP_KeyRpc) == $(KeyNull)
  1483.        Goto RRP_Return
  1484.     Endif
  1485.     OpenRegKey $(RRP_KeyRpc) "" "ClientProtocols" $(MAXIMUM_ALLOWED) RRP_KeyClient
  1486.     Ifstr(i) $(RRP_KeyClient) == $(KeyNull)
  1487.        Goto RRP_Return
  1488.     Endif
  1489.     OpenRegKey $(RRP_KeyRpc) "" "ServerProtocols" $(MAXIMUM_ALLOWED) RRP_KeyServer
  1490.     Ifstr(i) $(RRP_KeyServer) == $(KeyNull)
  1491.        Goto RRP_Return
  1492.     Endif
  1493.     DeleteRegValue $(RRP_KeyClient) $(RRP_Protocol)
  1494.     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  1495.         Goto RRP_Return
  1496.     Endif
  1497.     DeleteRegValue $(RRP_KeyServer) $(RRP_Protocol)
  1498.     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  1499.         Goto RRP_Return
  1500.     Endif
  1501.     Set RegistryErrorIndex = NO_ERROR
  1502. RRP_Return = +
  1503.     Ifstr(i) $(RRP_KeyServer) != $(KeyNull)
  1504.         CloseRegKey $(RRP_KeyServer)
  1505.     Endif
  1506.     Ifstr(i) $(RRP_KeyClient) != $(KeyNull)
  1507.         CloseRegKey $(RRP_KeyClient)
  1508.     Endif
  1509.     Ifstr(i) $(RRP_KeyRpc) != $(KeyNull)
  1510.         CloseRegKey $(RRP_KeyRpc)
  1511.     Endif
  1512.     Return  $(RegistryErrorIndex)
  1513. [GetInfFileNameFromRegistry]
  1514.     read-syms InitBaseVars
  1515.     set KeyProduct = $($0)
  1516.     set InfName = ""
  1517.     OpenRegKey $(KeyProduct) "" "NetRules" $(!REG_KEY_READ) NetRuleKey
  1518.     Ifstr(i) $(NetRuleKey) != $(KeyNull)
  1519.         GetRegValue $(NetRuleKey) "InfName" NetRuleInfNameList
  1520.         set NetRuleInfName = *($(NetRuleInfNameList), 4)
  1521.         Split-String $(NetRuleInfName), "\", FilenameList
  1522.         QueryListSize ListSize $(FilenameList)
  1523.         set InfName = *($(FilenameList), $(ListSize))
  1524.         CloseRegKey $(KeyProduct)
  1525.     endif
  1526.     return $(InfName)
  1527. [ToggleBinding]
  1528.     Set SvcName = $($0)
  1529.     Set BindNumber = $($1)
  1530.     Set Action = $($2)
  1531.     Set Status = UNABLE_ACCESS_CONFIGURE_SERVICE
  1532.     Set KeySvc = ""
  1533.     Set KeyFrom = ""
  1534.     Set KeyTo = ""
  1535.     read-syms InitBaseVars
  1536.     OpenRegKey $(!REG_H_LOCAL) "" $(ServicesBaseName)"\"$(SvcName) $(MAXIMUM_ALLOWED) KeySvc
  1537.     Ifstr(i) $(KeySvc) == $(KeyNull)
  1538.         Debug-Output "UTILITY.INF: ToggleBinding: service key open FAILED"
  1539.         Goto TB_Return
  1540.     Endif
  1541.     Ifstr(i) $(Action) == activate
  1542.         Set FromKeyName = "Linkage\Disabled"
  1543.         Set ToKeyName   = "Linkage"
  1544.     Else
  1545.         Set FromKeyName = "Linkage"
  1546.         Set ToKeyName   = "Linkage\Disabled"
  1547.     Endif
  1548.     OpenRegKey $(KeySvc) "" $(FromKeyName) $(MAXIMUM_ALLOWED) KeyFrom
  1549.     Ifstr(i) $(KeyFrom) == $(KeyNull)
  1550.         Debug-Output "UTILITY.INF: ToggleBinding: from linkage key open FAILED"
  1551.         Goto TB_Return
  1552.     Endif
  1553.     OpenRegKey $(KeySvc) "" $(ToKeyName) $(MAXIMUM_ALLOWED) KeyTo
  1554.     Ifstr(i) $(KeyTo) == $(KeyNull)
  1555.         Debug-Output "UTILITY.INF: ToggleBinding: to linkage key open FAILED"
  1556.         Goto TB_Return
  1557.     Endif
  1558.     Set FromBindList   = {}
  1559.     Set FromExportList = {}
  1560.     Set FromRouteList  = {}
  1561.     Set ToBindList     = {}
  1562.     Set ToExportList   = {}
  1563.     Set ToRouteList    = {}
  1564.     Set ErrorTotal     = 0
  1565.     Debug-Output "UTILITY.INF: ToggleBinding; fetch all linkage values"
  1566.     GetRegValue $(KeyFrom),"Bind",TempValue
  1567.     Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
  1568.         Set FromBindList = *($(TempValue),4)
  1569.         Set-add ErrorTotal = $(ErrorTotal),1
  1570.     Endif
  1571.     GetRegValue $(KeyFrom),"Export",TempValue
  1572.     Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
  1573.         Set FromExportList = *($(TempValue),4)
  1574.         Set-add ErrorTotal = $(ErrorTotal),1
  1575.     Endif
  1576.     GetRegValue $(KeyFrom),"Route",TempValue
  1577.     Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
  1578.         Set FromRouteList = *($(TempValue),4)
  1579.         Set-add ErrorTotal = $(ErrorTotal),1
  1580.     Endif
  1581.     GetRegValue $(KeyTo),"Bind",TempValue
  1582.     Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
  1583.         Set ToBindList = *($(TempValue),4)
  1584.         Set-add ErrorTotal = $(ErrorTotal),1
  1585.     Endif
  1586.     GetRegValue $(KeyTo),"Export",TempValue
  1587.     Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
  1588.         Set ToExportList = *($(TempValue),4)
  1589.         Set-add ErrorTotal = $(ErrorTotal),1
  1590.     Endif
  1591.     GetRegValue $(KeyTo),"Route",TempValue
  1592.     Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
  1593.         Set ToRouteList = *($(TempValue),4)
  1594.         Set-add ErrorTotal = $(ErrorTotal),1
  1595.     Endif
  1596.     Ifint $(ErrorTotal) != 6
  1597.         Debug-Output "UTILITY.INF: ToggleBinding; Bind list retreival error, "$(ErrorTotal)
  1598.     Endif
  1599.     Debug-Output "UTILITY.INF: ToggleBinding; sanity check results"
  1600.     QueryListSize sz1 $(FromBindList)
  1601.     QueryListSize sz2 $(FromExportList)
  1602.     QueryListSize sz3 $(FromRouteList)
  1603.     Ifint $(sz1) != $(sz2)
  1604.         Goto TB_Return
  1605.     Endif
  1606.     Ifint $(sz1) != $(sz3)
  1607.         Goto TB_Return
  1608.     Endif
  1609.     QueryListSize sz2 $(ToBindList)
  1610.     QueryListSize sz3 $(ToExportList)
  1611.     QueryListSize sz4 $(ToRouteList)
  1612.     Ifint $(sz2) != $(sz3)
  1613.         Goto TB_Return
  1614.     Endif
  1615.     Ifint $(sz2) != $(sz4)
  1616.         Goto TB_Return
  1617.     Endif
  1618.     Debug-Output "UTILITY.INF: ToggleBinding; prepare to move binding"
  1619.     Ifint $(BindNumber) > $(sz1)
  1620.         Debug-Output "UTILITY.INF: ToggleBinding; binding to move was invalid"
  1621.         Set Status = INVALID_DATA_PASSED
  1622.     Endif
  1623.     Set FromBindItem   = *($(FromBindList),$(BindNumber))
  1624.     Set FromRouteItem  = *($(FromRouteList),$(BindNumber))
  1625.     Set FromExportItem = *($(FromExportList),$(BindNumber))
  1626.     Set ToBindList   = >($(ToBindList),$(FromBindItem))
  1627.     Set ToRouteList  = >($(ToRouteList),$(FromRouteItem))
  1628.     Set ToExportList = >($(ToExportList),$(FromExportItem))
  1629.     Set NewBind   = {}
  1630.     Set NewExport = {}
  1631.     Set NewRoute  = {}
  1632.     Set Index = 0
  1633.     ForListDo $(FromBindList)
  1634.         Set-add Index = $(Index),1
  1635.         Ifint $(Index) != $(BindNumber)
  1636.             Set NewBind   = >($(NewBind),$($))
  1637.             Set NewExport = >($(NewExport),*($(FromExportList),$(Index)))
  1638.             Set NewRoute  = >($(NewRoute),*($(FromRouteList),$(Index)))
  1639.         Endif
  1640.     EndForListDo
  1641.     Set FromBindList   = $(NewBind)
  1642.     Set FromExportList = $(NewExport)
  1643.     Set FromRouteList  = $(NewRoute)
  1644.     Set ErrorTotal = 0
  1645.     SetRegValue $(KeyFrom) {Bind,$(NoTitle),$(!REG_VT_MULTI_SZ),$(FromBindList)}
  1646.     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  1647.         Set-add ErrorTotal = $(ErrorTotal),1
  1648.     Endif
  1649.     SetRegValue $(KeyFrom) {Export,$(NoTitle),$(!REG_VT_MULTI_SZ),$(FromExportList)}
  1650.     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  1651.         Set-add ErrorTotal = $(ErrorTotal),1
  1652.     Endif
  1653.     SetRegValue $(KeyFrom) {Route,$(NoTitle),$(!REG_VT_MULTI_SZ),$(FromRouteList)}
  1654.     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  1655.         Set-add ErrorTotal = $(ErrorTotal),1
  1656.     Endif
  1657.     SetRegValue $(KeyTo) {Bind,$(NoTitle),$(!REG_VT_MULTI_SZ),$(ToBindList)}
  1658.     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  1659.         Set-add ErrorTotal = $(ErrorTotal),1
  1660.     Endif
  1661.     SetRegValue $(KeyTo) {Export,$(NoTitle),$(!REG_VT_MULTI_SZ),$(ToExportList)}
  1662.     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  1663.         Set-add ErrorTotal = $(ErrorTotal),1
  1664.     Endif
  1665.     SetRegValue $(KeyTo) {Route,$(NoTitle),$(!REG_VT_MULTI_SZ),$(ToRouteList)}
  1666.     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  1667.         Set-add ErrorTotal = $(ErrorTotal),1
  1668.     Endif
  1669.     Debug-Output "UTILITY.INF: ToggleBinding; Registry update error total = "$(ErrorTotal)
  1670.     Ifint $(ErrorTotal) != 0
  1671.        Set Status = UNABLE_WRITE_REGISTRY
  1672.     Else
  1673.        Set Status = NO_ERROR
  1674.     Endif
  1675. TB_Return = +
  1676.     Ifstr(i) $(KeyFrom) != $(KeyNull)
  1677.        CloseRegKey $(KeyFrom)
  1678.     Endif
  1679.     Ifstr(i) $(KeyTo) != $(KeyNull)
  1680.        CloseRegKey $(KeyTo)
  1681.     Endif
  1682.     Ifstr(i) $(KeySvc) != $(KeyNull)
  1683.        CloseRegKey $(KeySvc)
  1684.     Endif
  1685.     Return $(Status)
  1686. [SortListIndex]
  1687.     Set List = $($0)
  1688.     Set BoolAscend = $($1)
  1689.     Set BoolCaseSens = $($2)
  1690.     LibraryProcedure IndexList, $(!LIBHANDLE), GenerateSortedIndexList, $(List), $(BoolAscend), $(BoolCaseSens)
  1691.     Return $(IndexList)
  1692. [SortByIndex]
  1693.    Set List = $($0)
  1694.    Set IndexList = $($1)
  1695.    Set NewList = {}
  1696.    ForListDo $(IndexList)
  1697.       Set Index = $($)
  1698.       Set Item = *($(List),$(Index))
  1699.       Set NewList = >($(NewList),$(Item))
  1700.    EndForListDo
  1701.    Return $(NewList)
  1702. [SortList]
  1703.     Set List = $($0)
  1704.     Shell "" SortListIndex $(List) $($1) $($2)
  1705.     Set IndexList = $($R0)
  1706.     Shell "" SortByIndex $(List) $(IndexList)
  1707.     Set ResultList = $($R0)
  1708.     return $(ResultList)
  1709. [DetectionDllFiles]
  1710.     DetectionDllsFound = {} ? $(!LIBHANDLE) FindFileInstances $(!STF_WINDOWSSYSPATH)"\???ncdet.dll"
  1711. [UpdateDetectionDllNames]
  1712.     Set Status = STATUS_FAILED
  1713.     read-syms InitBaseVars
  1714.     Detect DetectionDllFiles
  1715.     Set DllValueName = "NetcardDlls"
  1716.     OpenRegKey $(!REG_H_LOCAL) "" "System\Setup" $(MAXIMUM_ALLOWED) KeySetup
  1717.     Ifstr(i) $(KeySetup) == $(KeyNull)
  1718.         Debug-Output "UTILITY.INF: [UpdateDetectionDllNames] cant open System\Setup key"
  1719.         Goto UDDN_Return
  1720.     Endif
  1721.     Set NewDllList = {"MSNCDET.DLL"}
  1722.     ForListDo $(DetectionDllsFound)
  1723.         Set NewDllList = >($(NewDllList),$($))
  1724.     EndForListDo
  1725.     Set UpdateRequired = 1
  1726.     GetRegValue $(KeySetup) $(DllValueName) DllNamesValue
  1727.     Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
  1728.         Set DllNames = *($(DllNamesValue),4)
  1729.         Debug-Output "UTILITY.INF: [UpdateDetectionDllNames] DllNames = "$(DllNames)
  1730.         Set UpdateRequired = 0
  1731.         ForListDo $(NewDllList)
  1732.             Set DllIndex = ~($(DllNames),$($))
  1733.             Ifint $(DllIndex) == 0
  1734.                 Set UpdateRequired = 1
  1735.             Endif
  1736.         EndForListDo
  1737.     Endif
  1738.     Set Status = STATUS_SUCCESSFUL
  1739.     Ifint $(UpdateRequired) == 1
  1740.         Debug-Output "UTILITY.INF: [UpdateDetectionDllNames] new DLL names = "$(NewDllList)
  1741.         Set ValueInfo = {$(DllValueName), $(NoTitle), $(!REG_VT_MULTI_SZ), $(NewDllList)}
  1742.         SetRegValue $(KeySetup) $(ValueInfo)
  1743.         Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  1744.             Set Status = STATUS_FAILED
  1745.         Else
  1746.             Shell "NCPARAM.INF" Param_ControlDetection DTEND
  1747.             Shell "NCPARAM.INF" Param_ControlDetection DTSTART
  1748.         Endif
  1749.     Else
  1750.         Set Status = STATUS_USERCANCEL
  1751.     Endif
  1752.     CloseRegKey $(KeySetup)
  1753. UDDN_Return = +
  1754.     Return $(Status)
  1755. [CheckIfCopyNecessary]
  1756.     Set Status = STATUS_SUCCESSFUL
  1757.     Set PathList = $($0)
  1758.     Set NamesList = $($1)
  1759.     Set Index = 0
  1760.     Set Found = 1
  1761.     ForListDo $(PathList)
  1762.         Set ThisPath = $($)
  1763.         Set-add Index = Index,1
  1764.         Set NameList = *($(NamesList),$(Index))
  1765.         ForListDo $(NameList)
  1766.             Set FileToCheck = $(ThisPath)\$($)
  1767.             LibraryProcedure FilePresent,$(!LIBHANDLE), CheckFileExistance $(FileToCheck)
  1768.             Ifstr(i) $(FilePresent) != "YES"
  1769.                 Set Found = 0
  1770.             Endif
  1771.         EndForListDo
  1772.     EndForListDo
  1773.     Ifint $(Found) != 1
  1774.         Set Status = STATUS_FAILED
  1775.     Endif
  1776.     Return $(Status)
  1777. [RegistryErrorsENG]
  1778. UNABLE_ACCESS_SOFTWARE_REG,"Unable to access SOFTWARE subtree in Registry"
  1779. UNABLE_CREATE_MANUFACTURER_KEY,"Unable to create Manufacturer key in Registry"
  1780. UNABLE_OPEN_MICROSOFT_KEY,"Unable to open Microsoft subkey in Registry"
  1781. UNABLE_CREATE_PRODUCT_KEY,"Unable to create subkey in Registry for Windows NT"
  1782. UNABLE_CREATE_PRODUCT_VERSION,"Unable to create version subkey in Registry for Windows NT"
  1783. UNABLE_CREATE_NETRULES_KEY,"Unable to create a NetRules subkey in Registry"
  1784. UNABLE_OPEN_HARDWARE_SECTION,"Unable to open HARDWARE subkey in Registry"
  1785. UNABLE_OPEN_NETWORKCARD_SECTION,"Unable to open NetworkCards subkey in Registry"
  1786. UNABLE_OPEN_EVENTLOG_SUBKEY,"Unable to open Eventlog subkey in Registry"
  1787. UNABLE_CREATE_NETCARD_CONFIGURATION,"Unable to create entry for network adapter in Registry"
  1788. UNABLE_ACCESS_CONFIGURE_SERVICE,"Unable to access Services subkey in Registry"
  1789. UNABLE_CREATE_CONFIGURE_SERVICE,"Unable to create Services subkey in Registry"
  1790. UNABLE_CREATE_SERVICE_SUBKEY,"Unable to create Services subkey in Registry"
  1791. INVALID_DATA_PASSED,"Invalid data passed to Registry utility routine"
  1792. SERVICE_AREA_ALREADY_EXIST,"Registry Service subkey already exists"
  1793. OPERATION_UNIMPLEMENTED,"Registry operation UNIMPLEMENTED"
  1794. CANNOT_FIND_COMPONENT_SERVICE,"Component service name not found or non-existent"
  1795. CANNOT_CONFIGURE_HARDWARE,"Cannot configure the hardware component"
  1796. CANNOT_CONFIGURE_SOFTWARE,"Cannot configure the software component"
  1797. UNABLE_WRITE_REGISTRY, "Cannot write to registry"
  1798. UNABLE_INSTALL, "Installation Error"
  1799. PROVIDER_ALREADY_EXISTED, "Provider already exists in Registry"
  1800. PROVIDER_ORDER_DOES_NOT_EXIST, "Provider order does not exist in Registry."
  1801. TCPIP_NONEXIST_ERROR, "Please install Microsoft TCP/IP before installing SNMP."
  1802. TCPIP_NONEXIST_ERROR_FTPD, "Please install Microsoft TCP/IP before installing FTP Server."
  1803. NO_BINDING_INFO, "Missing Binding Information. Please click BINDINGS button first."
  1804. CANNOT_OPEN_EVENTLOG_KEY, "Cannot open Eventlog subkey in Registry."
  1805. CANNOT_CREATE_SNMPPROXYKEY, "Cannot create SNMP Proxy subkey in Registry."
  1806. REF_COUNT_NOT_ZERO, "Please remove all related network adapter cards before removing the software driver."
  1807. UNABLE_REMOVE_CONFIGURE_SERVICE,"Unable to remove Services subkey for a software driver in Registry"
  1808. UNABLE_ACCESS_WINSOCK_MAP_INFO,"Unable to access WinSock mapping information in DLL"
  1809. VERIFY_WARNING,"The current netcard parameters are not verifiably correct and may result in usage problems or system failure.  Use them anyway?"
  1810. CANNOT_DETECT,"Setup is unable to obtain network adapter information from the associated network adapter DLL files.  Operation cannot continue."
  1811. UNABLE_COPY_FILE,"File copy operation failed."
  1812. ASK_SOURCE_FAIL,"Failed to obtain source file location."
  1813. SETUP_FAIL,"Setup operation failed."
  1814. SERVICE_MARKED_FOR_DELETE,"Unable to reinstall deleted service without system restart."
  1815. REBOOT_MACHINE_BEFORE_ADD_ADAPTER,"Please reboot your machine before you add a new adapter card."
  1816. NO_ERROR, ""
  1817. [RegistryErrorUnknownENG]
  1818. Error_Bogus = "UNKNOWN REGISTRY FAILURE"
  1819. [VerExistedENG]
  1820. ver = " ver "
  1821. Text = " already exists on the system. Please use [Update] to update the software."
  1822. [CardExistedENG]
  1823. Text = "A network card of this type is already installed in the system. Do you want to continue?"
  1824. [ProgressCopyENG]
  1825.     !p:ProCaption   = "Windows NT Networking Setup"
  1826.     !p:ProCancel    = "Cancel"
  1827.     !p:ProCancelMsg = "Windows NT is not correcly installed.  Are you sure you want "+
  1828.                       "to cancel copying files?"
  1829.     !p:ProCancelCap = "Setup Message"
  1830.     !p:ProText1     = "Copying:"
  1831.     !p:ProText2     = "To:"
  1832.     !p:Error        = "Unable to determine proper source disk location; copy cannot be performed."
  1833.  
  1834.  
  1835.  
  1836.