home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1996 February / VPR9602A.ISO / pc98 / utility.in_ / utility.inf
INI File  |  1995-10-25  |  95KB  |  2,314 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_ParameterMessageFile = $($12)
  217.     set CS_KeyServices   = $($13)
  218.     set CS_KeyTempSvc    = ""
  219.     set CS_KeySvcManager = ""
  220.     set CS_KeyParameters = ""
  221.     set CS_KeyLinkage    = ""
  222.     set CS_UseRegistry   = $(!NTN_ScUseRegistry)
  223.     Debug-Output "UTILITY.INF: [CreateService] entered for "$(CS_NameOfService)
  224.     Ifstr(i) $(CS_UseRegistry) != "YES"
  225.         Ifstr(i) $(CS_UseRegistry) != "NO"
  226.             Set CS_UseRegistry = "NO"
  227.         Endif
  228.     Endif
  229.     Ifstr(i) $(CS_Dependencies) == ""
  230.         Set CS_Dependencies = {}
  231.     Endif
  232.     Ifstr(i) $(CS_KeyServices) == ""
  233.         Shell "", BaseServiceKey
  234.         set RegistryErrorIndex = $($R0)
  235.         Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  236.            set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  237.            goto C_S_Return
  238.         endif
  239.         set CS_KeyServices = $($R1)
  240.         set CS_KeyServicesOpened = $($R1)
  241.     Endif
  242.     ifstr(i) $(CS_TypeOfService) == "system"
  243.         set TypeValue = 2
  244.         set StartValue = 3
  245.     else-ifstr(i) $(CS_TypeOfService) == "systemstart"
  246.         set TypeValue = 2
  247.         set StartValue = 1
  248.     else-ifstr(i) $(CS_TypeOfService) == "systemauto"
  249.         set TypeValue = 2
  250.         set StartValue = 2
  251.     else-ifstr(i) $(CS_TypeOfService) == "adapter"
  252.         set TypeValue = 4
  253.         set StartValue = 3
  254.         Set CS_UseRegistry = "YES"
  255.     else-ifstr(i) $(CS_TypeOfService) == "kernelauto"
  256.         set TypeValue = 1
  257.         set StartValue = 1
  258.     else-ifstr(i) $(CS_TypeOfService) == "autoserviceshare"
  259.         set TypeValue = 32
  260.         set StartValue = 2
  261.     else-ifstr(i) $(CS_TypeOfService) == "transport"
  262.         set TypeValue = 2
  263.         set StartValue = 3
  264.     else-ifstr(i) $(CS_TypeOfService) == "kernel"
  265.         set TypeValue = 1
  266.         set StartValue = 3
  267.     else-ifstr(i) $(CS_TypeOfService) == "kernelautostart"
  268.         set TypeValue = 1
  269.         set StartValue = 2
  270.     else-ifstr(i) $(CS_TypeOfService) == "kerneldisable"
  271.         set TypeValue = 1
  272.         set StartValue = 4
  273.     else-ifstr(i) $(CS_TypeOfService) == "service"
  274.         set TypeValue = 16
  275.         set StartValue = 3
  276.     else-ifstr(i) $(CS_TypeOfService) == "serviceauto"
  277.         set TypeValue = 16
  278.         set StartValue = 2
  279.     else-ifstr(i) $(CS_TypeOfService) == "servicedisable"
  280.         set TypeValue = 16
  281.         set StartValue = 4
  282.     else-ifstr(i) $(CS_TypeOfService) == "serviceshare"
  283.         set TypeValue = 32
  284.         set StartValue = 3
  285.     else
  286.         Set CS_UseRegistry = "YES"
  287.         Debug-Output "UTILITY.INF: [CreateService] Unrecognized TypeOfService parameter"
  288.         set TypeValue = 4
  289.         set StartValue = 3
  290.     endif
  291.     Ifint $(TypeValue) > 4
  292.         Ifstr(i) $(CS_ObjectName) == ""
  293.             set CS_ObjectName = "LocalSystem"
  294.         Endif
  295.     Endif
  296.     OpenRegKey $(CS_KeyServices) "" $(CS_NameOfService) $(MAXIMUM_ALLOWED) +
  297.         CS_KeyTempSvc
  298.     ifstr $(CS_KeyTempSvc) != $(KeyNull)
  299.         GetRegValue $(CS_KeyTempSvc),"DeleteFlag", DeleteFlagInfo
  300.         set DeleteFlag = *($(DeleteFlagInfo), 4)
  301.         ifint $(DeleteFlag) == 1
  302.             Set RegistryErrorIndex = REBOOT_MACHINE_BEFORE_ADD_ADAPTER
  303.             goto C_S_Return
  304.         endif
  305.     endif
  306.     ifstr(i) $(CS_UseRegistry) == "YES"
  307.         Debug-Output "UTILITY.INF: [CreateService] "$(CS_NameOfService)" using Registry"
  308.         ifstr(i) $(CS_KeyTempSvc) == $(KeyNull)
  309.            CreateRegKey $(CS_KeyServices) {$(CS_NameOfService),$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" CS_KeyTempSvc
  310.         else
  311.            Debug-Output "UTILITY.INF: service key "$(CS_NameOfService)" already existed"
  312.            Set RegistryErrorIndex = UNABLE_CREATE_CONFIGURE_SERVICE
  313.            CloseRegKey $(CS_KeyTempSvc)
  314.            Goto C_S_Return
  315.         endif
  316.         Ifstr(i) $(CS_KeyTempSvc) == $(KeyNull)
  317.            Debug-Output "UTILITY.INF: could not create service key "$(CS_NameOfService)
  318.            Set RegistryErrorIndex = UNABLE_CREATE_CONFIGURE_SERVICE
  319.            CloseRegKey $(CS_KeyTempSvc)
  320.            Goto C_S_Return
  321.         else
  322.             set NewValueList = {+
  323.                                {Type,$(NoTitle),$(!REG_VT_DWORD),$(TypeValue)},+
  324.                                {Start,$(NoTitle),$(!REG_VT_DWORD),$(StartValue)},+
  325.                                {ErrorControl,$(NoTitle),$(!REG_VT_DWORD),$(CS_ErrorControl)}+
  326.                                }
  327.             Ifint $(TypeValue) > 4
  328.                 Set NewValueList = >($(NewValueList), +
  329.                         {ObjectName,$(NoTitle),$(!REG_VT_SZ),$(CS_ObjectName)})
  330.             Endif
  331.             ifstr(i) $(CS_Group) != ""
  332.                 set NewValueList = >($(NewValueList), +
  333.                         {Group,$(NoTitle),$(!REG_VT_SZ),$(CS_Group)})
  334.             endif
  335.             ifstr(i) $(CS_ImagePath) != ""
  336.                 set NewValueList = >($(NewValueList), +
  337.                         {ImagePath,$(NoTitle),$(!REG_VT_EXPAND_SZ),$(CS_ImagePath)})
  338.             endif
  339.             ifstr(i) $(CS_Dependencies) != ""
  340.                 ifstr(i) $(CS_Dependencies) != {}
  341.                     set NewValueList = >($(NewValueList), +
  342.                         {Dependencies,$(NoTitle),$(!REG_VT_MULTI_SZ),$(CS_Dependencies)})
  343.                 endif
  344.             endif
  345.             Shell "", AddValueList, $(CS_KeyTempSvc), $(NewValueList)
  346.             set RegistryErrorIndex = $($R0)
  347.             Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  348.                     Debug-Output "Registry error: Add value list"
  349.             endif
  350.         endif
  351.     else
  352.         Debug-Output "UTILITY.INF: [CreateService] "$(CS_NameOfService)" using CreateService() wrapper"
  353.         Set FLibraryErrCtl = 1
  354.         LibraryProcedure CS_CreateResult $(!NCPA_HANDLE), CPlSetup, $(!STF_HWND), CREATESVC,+
  355.             $(CS_NameOfService), $(CS_DisplayName), $(StartValue), $(TypeValue), $(CS_ErrorControl),+
  356.             $(CS_ImagePath), $(CS_Group),$(CS_Dependencies),$(CS_ObjectName)
  357.         Set FLibraryErrCtl = 0
  358.         Set CS_CreateError = *($(CS_CreateResult),1)
  359.         Ifint $(CS_CreateError) != 0
  360.              Debug-Output "UTILITY.INF: CreateService wrapper failed, error: "$(CS_CreateResult)
  361.              Ifint $(CS_CreateError) == 1073
  362.                  Set RegistryErrorIndex = SERVICE_ALREADY_EXISTS
  363.              Else-ifint $(CS_CreateError) == 1072
  364.                  Set RegistryErrorIndex = SERVICE_MARKED_FOR_DELETE
  365.              Else
  366.                  Set RegistryErrorIndex = UNABLE_CREATE_CONFIGURE_SERVICE
  367.              Endif
  368.              CloseRegKey $(CS_KeyTempSvc)
  369.              Goto C_S_Return
  370.         Endif
  371.         OpenRegKey $(CS_KeyServices) "" $(CS_NameOfService) $(MAXIMUM_ALLOWED) CS_KeyTempSvc
  372.         ifstr $(CS_KeyTempSvc) == $(KeyNull)
  373.              Debug-Output "UTILITY.INF: unable to open new service key"
  374.              set RegistryErrorIndex = UNABLE_CREATE_CONFIGURE_SERVICE
  375.              CloseRegKey $(CS_KeyTempSvc)
  376.              Goto C_S_Return
  377.         endif
  378.     endif
  379.     CreateRegKey $(CS_KeyTempSvc) {"Parameters",$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" CS_KeyParameters
  380.     ifstr $(CS_KeyParameters) == $(KeyNull)
  381.         OpenRegKey $(CS_KeyTempSvc) "" "Parameters" $(MAXIMUM_ALLOWED) +
  382.             CS_KeyParameters
  383.     endif
  384.     Ifstr $(CS_KeyParameters) == $(KeyNull)
  385.        set RegistryErrorIndex = UNABLE_CREATE_SERVICE_SUBKEY
  386.        CloseRegKey $(CS_KeyTempSvc)
  387.        goto C_S_Return
  388.     endif
  389.     set RegistryErrorIndex = NO_ERROR
  390.     CreateRegKey $(CS_KeyTempSvc) {"Linkage",$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" CS_KeyLinkage
  391.     Ifstr $(CS_KeyLinkage) == $(KeyNull)
  392.         OpenRegKey $(CS_KeyTempSvc) "" "Linkage" $(MAXIMUM_ALLOWED) CS_KeyLinkage
  393.     Endif
  394.     Ifstr $(CS_KeyLinkage) == $(KeyNull)
  395.        set RegistryErrorIndex = UNABLE_CREATE_SERVICE_SUBKEY
  396.        CloseRegKey $(CS_KeyTempSvc)
  397.        goto C_S_Return
  398.     endif
  399.     CreateRegKey $(CS_KeyLinkage) {"Disabled",$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" CS_KeyDisabled
  400.     Ifstr $(CS_KeyDisabled) == $(KeyNull)
  401.         OpenRegKey $(CS_KeyLinkage) "" "Disabled" $(MAXIMUM_ALLOWED) CS_KeyDisabled
  402.     Endif
  403.     Ifstr $(CS_KeyDisabled) == $(KeyNull)
  404.        set RegistryErrorIndex = UNABLE_CREATE_SERVICE_SUBKEY
  405.        CloseRegKey $(CS_KeyTempSvc)
  406.        CloseRegKey $(CS_KeyLinkage)
  407.        goto C_S_Return
  408.     endif
  409.     CloseRegKey $(CS_KeyDisabled)
  410.     ifstr(i) $(CS_EventFile) != ""
  411.         OpenRegKey $(!REG_H_LOCAL) "" "SYSTEM\CurrentControlSet\Services\EventLog\"$(CS_EventLogLocation) $(MAXIMUM_ALLOWED) CS_KeyEventLog
  412.         Ifstr $(CS_KeyEventLog) == $(KeyNull)
  413.            debug-output "Cannot open eventlog key"
  414.            set RegistryErrorIndex = UNABLE_OPEN_EVENTLOG_SUBKEY
  415.            CloseRegKey $(CS_KeyTempSvc)
  416.            CloseRegKey $(CS_KeyParameters)
  417.            CloseRegKey $(CS_KeyLinkage)
  418.            goto C_S_Return
  419.         else
  420.            CreateRegKey $(CS_KeyEventLog) {$(CS_EventSourceName),$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" CS_KeyService
  421.            ifstr(i) $(CS_KeyService) == ""
  422.                OpenRegKey $(CS_KeyEventLog) "" $(CS_EventSourceName) $(MAXIMUM_ALLOWED) CS_KeyService
  423.            endif
  424.            Ifstr $(CS_KeyService) != $(KeyNull)
  425.                SetRegValue $(CS_KeyService) {EventMessageFile,$(NoTitle),$(!REG_VT_EXPAND_SZ),$(CS_EventFile)}
  426.                SetRegValue $(CS_KeyService) {TypesSupported,$(NoTitle),$(!REG_VT_DWORD),$(CS_TypeSupported)}
  427.                ifstr(i) $(CS_ParameterMessageFile) != ""
  428.                    SetRegValue $(CS_KeyService) {ParameterMessageFile,$(NoTitle),$(!REG_VT_EXPAND_SZ),$(CS_ParameterMessageFile)}
  429.                endif
  430.                CloseRegKey $(CS_KeyService)
  431.            endif
  432.         Endif
  433.     endif
  434. C_S_Return = +
  435.     Ifstr $(CS_KeyServicesOpened) != $(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_KeyNetcards = $($0)
  442.     ifstr $($1) == ""
  443.         set AA_AdapterNumber = 1
  444.     else
  445.         set AA_AdapterNumber = $($1)
  446.     endif
  447.     set AA_KeyNetcards = ""
  448.     set AA_KeyTemp = ""
  449.     set RegistryErrorIndex = NO_ERROR
  450.     Debug-Output "[AssignAdapterNumber] starting with "$(AA_AdapterNumber)
  451.     Ifstr(i) $(AA_KeyNetcards) == $(KeyNull)
  452.         OpenRegKey $(!REG_H_LOCAL) "" $(NetworkCardKeyName) $(MAXIMUM_ALLOWED) AA_KeyNetcards
  453.         set AA_KeyNetcardsOpened = $(AA_KeyNetcards)
  454.     endif
  455.     Ifstr $(AA_KeyNetcards) == $(KeyNull)
  456.        set RegistryErrorIndex = UNABLE_OPEN_NETWORKCARD_SECTION
  457.        goto A_A_Return
  458.     endif
  459. A_A_TryAgain = +
  460.     ifint $(AA_AdapterNumber) < 10
  461.         set Tmp_Zero_AdapterNumber = "0"$(AA_AdapterNumber)
  462.         OpenRegKey $(AA_KeyNetcards) "" $(Tmp_Zero_AdapterNumber) $(MAXIMUM_ALLOWED) AA_Zero_KeyTemp
  463.         ifstr(i) $(AA_Zero_KeyTemp) != ""
  464.             CloseRegKey $(AA_Zero_KeyTemp)
  465.             goto Next_Number
  466.         endif
  467.     endif
  468.     set Tmp_AA_AdapterNumber = $(AA_AdapterNumber)
  469.     OpenRegKey $(AA_KeyNetcards) "" $(Tmp_AA_AdapterNumber) $(MAXIMUM_ALLOWED) AA_KeyTemp
  470.     Ifstr $(AA_KeyTemp) == $(KeyNull)
  471.         Goto A_A_Found
  472.     Endif
  473.     CloseRegKey $(AA_KeyTemp)
  474. Next_Number = +
  475.     Set AA_KeyTemp = $(KeyNull)
  476.     Set-add AA_AdapterNumber = $(AA_AdapterNumber),1
  477.     Goto A_A_TryAgain
  478. A_A_Found =+
  479.     CloseRegKey $(AA_KeyNetcardsOpened)
  480. A_A_Return = +
  481.     return $(RegistryErrorIndex) $(AA_AdapterNumber)
  482. [InstallNetcard]
  483.    read-syms InitBaseVars
  484.    set IN_Infname     = $($0)
  485.    set IN_KeyNetcardsArea = $($1)
  486.    set IN_CardNumber  = $($2)
  487.    set IN_KeyNetcard  = ""
  488.    set IN_KeyNetRules = ""
  489.     Shell "" AssignAdapterNumber $(IN_KeyNetcardsArea) $(IN_CardNumber)
  490.     set RegistryErrorIndex = $($R0)
  491.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  492.         goto I_N_Return
  493.     endif
  494.     set IN_CardNumber = $($R1)
  495.     CreateRegKey $(!REG_H_LOCAL) {$(NetworkCardKeyName)\$(IN_CardNumber),$(NoTitle),GenericClass} +
  496.                   "" $(MAXIMUM_ALLOWED) "" IN_KeyNetcard
  497.     Ifstr $(IN_KeyNetcard) == $(KeyNull)
  498.        set RegistryErrorIndex = UNABLE_CREATE_NETCARD_CONFIGURATION
  499.        goto I_N_Return
  500.     endif
  501.     CreateRegKey $(IN_KeyNetcard) {NetRules,$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" IN_KeyNetRules
  502.     Ifstr $(IN_KeyNetRules) == $(KeyNull)
  503.        set RegistryErrorIndex = UNABLE_CREATE_NETRULES_KEY
  504.        goto I_N_Return
  505.     endif
  506.     Ifstr $(IN_Infname) != ""
  507.        Shell "", ReduceInfPath, $(IN_Infname)
  508.        SetRegValue $(IN_KeyNetRules) {InfName,$(NoTitle),$(!REG_VT_SZ),$($R0)}
  509.     endif
  510.     set RegistryErrorIndex = NO_ERROR
  511. I_N_Return = +
  512.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  513.         Debug-Output "UTILITY.INF: [InstallNetcard]: "$(RegistryErrorIndex)
  514.         Ifstr $(IN_KeyNetRules) != $(KeyNull)
  515.             CloseRegKey $(IN_KeyNetRules)
  516.             set IN_KeyNetrules = ''
  517.         endif
  518.         set IN_KeyNetcard = ""
  519.     endif
  520.     return $(RegistryErrorIndex), $(IN_KeyNetcard), $(IN_CardNumber), $(IN_KeyNetRules)
  521. [LinkToService]
  522.     read-syms InitBaseVars
  523.     SetRegValue $($0) {ServiceName,$(NoTitle),$(!REG_VT_SZ),$($1)}
  524. L_S_Return = +
  525.     return $(RegistryErrorIndex)
  526. [IncrementRefCount]
  527.     read-syms InitBaseVars
  528.     OpenRegKey $(!REG_H_LOCAL) "" $($0) $(MAXIMUM_ALLOWED) SoftwareKey
  529.     Ifstr $(SoftwareKey) == $(KeyNull)
  530.        Debug-Output "UTILITY.INF: could not open Software base key"
  531.        set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  532.        goto IncrementRefCount_Return
  533.     endif
  534.     GetRegValue $(SoftwareKey),"RefCount", RefCountInfo
  535.     set RefCount = *($(RefCountInfo), 4)
  536.     Set-add RefCount = $(RefCount),1
  537.     SetRegValue $(SoftwareKey) {RefCount,$(NoTitle),$(!REG_VT_DWORD),$(RefCount)}
  538.     CloseRegKey $(SoftwareKey)
  539. IncrementRefCount_Return = +
  540.     return $(RegistryErrorIndex)
  541. [DecrementRefCount]
  542.     read-syms InitBaseVars
  543.     OpenRegKey $(!REG_H_LOCAL) "" $($0) $(MAXIMUM_ALLOWED) SoftwareKey
  544.     Ifstr $(SoftwareKey) == $(KeyNull)
  545.        Debug-Output "UTILITY.INF: could not open Software base key"
  546.        set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  547.        goto DecrementRefCount_Return
  548.     endif
  549.     GetRegValue $(SoftwareKey),"RefCount", RefCountInfo
  550.     set RefCount = *($(RefCountInfo), 4)
  551.     ifint $(RefCount) == 0
  552.         goto DecrementRefCount_Return
  553.     endif
  554.     Set-sub RefCount = $(RefCount),1
  555.     SetRegValue $(SoftwareKey) {RefCount,$(NoTitle),$(!REG_VT_DWORD),$(RefCount)}
  556.     CloseRegKey $(SoftwareKey)
  557. DecrementRefCount_Return = +
  558.     return $(RegistryErrorIndex)
  559. [IsRefCountEqualZero]
  560.     read-syms InitBaseVars
  561.     OpenRegKey $(!REG_H_LOCAL) "" $($0) $(MAXIMUM_ALLOWED) SoftwareKey
  562.     Ifstr $(SoftwareKey) == $(KeyNull)
  563.        Debug-Output "UTILITY.INF: could not open Software base key"
  564.        set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  565.        set RefCountEqualZero = 1
  566.        goto IsRefCountEqualZero_Return
  567.     endif
  568.     GetRegValue $(SoftwareKey),"RefCount", RefCountInfo
  569.     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  570.         set RefCount = 0
  571.     else
  572.         set RefCount = *($(RefCountInfo), 4)
  573.     endif
  574.     Ifint $(RefCount) == 0
  575.         set RefCountEqualZero = 1
  576.     else
  577.         set RefCountEqualZero = 0
  578.     endif
  579.     CloseRegKey $(SoftwareKey)
  580. IsRefCountEqualZero_Return = +
  581.     return $(RegistryErrorIndex) $(RefCountEqualZero)
  582. [FindService]
  583.     read-syms InitBaseVars
  584.     set FS_KeyThisService = ""
  585.     set FS_KeyParameters  = ""
  586.     set FS_KeyComponent   = $($0)
  587.     set FS_TypeComponent  = $($1)
  588.     Shell "", BaseServiceKey
  589.     set FS_KeyServices = $($R1)
  590.     set RegistryErrorIndex = $($R0)
  591.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  592.        goto F_S_Return
  593.     endif
  594.     EnumRegValue $(FS_KeyComponent) FS_ValueList
  595.     set FS_SvcName = ""
  596.     ForListDo $(FS_ValueList)
  597.         set FS_ValueName = *($($),1)
  598.         Ifstr(i) $(FS_ValueName) == ServiceName
  599.             set FS_SvcName = *($($),4)
  600.             goto F_S_Break1
  601.         endif
  602.     EndForListDo
  603. F_S_Break1 = +
  604.     Ifstr $(FS_SvcName) == $(KeyNull)
  605.        set RegistryErrorIndex = CANNOT_FIND_COMPONENT_SERVICE
  606.        goto F_S_Return
  607.     endif
  608.     OpenRegKey $(FS_KeyServices) "" $(FS_SvcName) $(MAXIMUM_ALLOWED) FS_KeyThisService
  609.     Ifstr $(FS_KeyThisService) == $(KeyNull)
  610.        set RegistryErrorIndex = CANNOT_FIND_COMPONENT_SERVICE
  611.        goto F_S_Return
  612.     endif
  613.     OpenRegKey $(FS_KeyThisService) "" "Parameters" $(MAXIMUM_ALLOWED) FS_KeyParameters
  614.     Ifstr $(FS_KeyParameters) == $(KeyNull)
  615.        set RegistryErrorIndex = CANNOT_FIND_COMPONENT_SERVICE
  616.        goto F_S_Return
  617.     endif
  618. F_S_Return = +
  619.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  620.         Ifstr $(FS_KeyParameters) != $(KeyNull)
  621.             CloseRegKey $(FS_KeyParameters)
  622.         endif
  623.         Ifstr $(FS_KeyThisService) != $(KeyNull)
  624.            CloseRegKey $(FS_KeyThisService)
  625.         endif
  626.     endif
  627.     return $(RegistryErrorIndex), $(FS_KeyThisService) $(FS_KeyParameters)
  628. [GetServiceParameters]
  629.     read-syms InitBaseVars
  630.     set GP_KeyComponent = $($0)
  631.     set GP_KeyService = ""
  632.     set GP_KeyParameters = ""
  633.     set GP_ValueList  = {}
  634.     FindService $(GP_KeyComponent) $($1)
  635.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  636.         goto G_P_Return
  637.     endif
  638.     set GP_KeyService = $($R1)
  639.     set GP_KeyParameters = $($R2)
  640.     EnumRegValue $(GP_KeyParameters) GP_ValueList
  641. G_P_Return = +
  642.     return $(RegistryErrorIndex) $(GP_KeyService) $(GP_KeyParameters) $(GP_ValueList)
  643. [AddSoftwareComponent]
  644.     read-syms InitBaseVars
  645.     set AS_MfgName       = $($0)
  646.     set AS_ProdName      = $($1)
  647.     set AS_SvcName       = $($2)
  648.     set AS_DisplayName   = $($3)
  649.     set AS_Infname       = $($4)
  650.     set AS_ImagePath     = $($5)
  651.     set AS_ServiceType   = $($6)
  652.     set AS_Group         = $($7)
  653.     set AS_Dependencies  = $($8)
  654.     set AS_ObjectName    = $($9)
  655.     set AS_EventFile     = $($10)
  656.     set AS_TypeSupported = $($11)
  657.     set AS_EventLocation = $($12)
  658.     set AS_ErrorCtlValue = $($13)
  659.     set AS_EventSource   = $($14)
  660.     set AS_ParameterMessageFile = $($15)
  661.     set AS_KeyServicesArea = $($16)
  662.     set AS_KeyVersion    = ""
  663.     set AS_KeyNetRules   = ""
  664.     set AS_KeyService    = ""
  665.     set AS_KeyParameters = ""
  666.     set AS_KeyLinkage    = ""
  667.     Shell "", CreateService,$(AS_SvcName),$(AS_DisplayName),$(AS_ImagePath),+
  668.           $(AS_ServiceType),$(AS_Group),$(AS_Dependencies),$(AS_ObjectName),+
  669.           $(AS_EventFile),$(AS_TypeSupported),$(AS_EventLocation),+
  670.           $(AS_ErrorCtlValue),$(AS_EventSource),$(AS_ParameterMessageFile),+
  671.           $(AS_KeyServicesArea)
  672.     set RegistryErrorIndex = $($R0)
  673.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  674.        goto A_S_Return
  675.     endif
  676.     set AS_KeyService    = $($R1)
  677.     set AS_KeyParameters = $($R2)
  678.     set AS_KeyLinkage    = $($R3)
  679.     Shell "", InstallSoftwareProduct, $(AS_MfgName), $(AS_ProdName), $(AS_Infname)
  680.     set RegistryErrorIndex = $($R0)
  681.     Ifstr(i) $(RegistryErrorIndex) == NO_ERROR
  682.         set AS_KeyVersion  = $($R1)
  683.         set AS_KeyNetRules = $($R2)
  684.         Shell "", LinkToService, $(AS_KeyVersion), $(AS_SvcName), service
  685.         set RegistryErrorIndex = $($R0)
  686.         Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  687.             goto A_S_Return
  688.         endif
  689.         GetRegValue $(AS_KeyVersion),"RefCount", RefCountInfo
  690.         Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  691.             SetRegValue $(AS_KeyVersion) {RefCount,$(NoTitle),$(!REG_VT_DWORD),0}
  692.         endif
  693.     endif
  694. A_S_Return = +
  695.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  696.        Ifstr $(AS_KeyNetRules) != $(KeyNull)
  697.           CloseRegKey $(AS_KeyNetRules)
  698.        endif
  699.        Ifstr $(AS_KeyParameters) != $(KeyNull)
  700.           CloseRegKey $(AS_KeyParameters)
  701.        endif
  702.        Ifstr $(AS_KeyLinkage) != $(KeyNull)
  703.           CloseRegKey $(AS_KeyLinkage)
  704.        endif
  705.        Ifstr $(AS_KeyVersion) != $(KeyNull)
  706.           CloseRegKey $(AS_KeyVersion)
  707.           Set AS_ProdKeyName = $(!NTN_SoftwareBase)"\"$(AS_MfgName)"\"$(AS_ProdName)
  708.           OpenRegKey $(!REG_H_LOCAL) "" $(AS_ProdKeyName) $(MAXIMUM_ALLOWED) AS_KeyProduct
  709.           Ifstr(i) $(AS_KeyProduct) != $(KeyNull)
  710.               DeleteRegKey $(AS_KeyProduct) "CurrentVersion"
  711.               CloseRegKey $(AS_KeyProduct)
  712.           Endif
  713.        Endif
  714.        Ifstr $(AS_KeyService) != $(KeyNull)
  715.           Debug-Output "UTILITY.INF: DeleteRegTree Service Key"
  716.        endif
  717.        set AS_KeyVersion = ""
  718.        set AS_KeyNetRules = ""
  719.        set AS_KeyService = ""
  720.        set AS_KeyParameters = ""
  721.        set AS_KeyLinkage = ""
  722.     endif
  723.     return $(RegistryErrorIndex), $(AS_KeyVersion), $(AS_KeyNetRules), $(AS_KeyService),+
  724.            $(AS_KeyParameters), $(AS_KeyLinkage)
  725. [AddHardwareComponent]
  726.     read-syms InitBaseVars
  727.     set AH_SvcName       = $($0)
  728.     set AH_Infname       = $($1)
  729.     set AH_SoftwareName  = $($2)
  730.     set AH_KeyServicesArea = $($3)
  731.     set AH_KeyNetcardsArea = $($4)
  732.     set AH_AdapNum       = $($5)
  733.     set AH_KeyNetcard    = ""
  734.     set AH_KeyNetRules   = ""
  735.     set AH_KeyService    = ""
  736.     set AH_KeyParameters = ""
  737.     Shell "", InstallNetcard, $(AH_Infname) $(AH_KeyNetcardsArea) $(AH_AdapNum)
  738.     set RegistryErrorIndex = $($R0)
  739.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  740.         Debug-Output "UTILITY.INF: [AddHardwareComponent] InstallNetcard returned: "$(RegistryErrorIndex)
  741.         goto A_H_Return
  742.     endif
  743.     set AH_KeyNetcard  = $($R1)
  744.     set AH_AdapNum     = $($R2)
  745.     set AH_SvcName     = $(AH_SvcName)$(AH_AdapNum)
  746.     set AH_KeyNetRules = $($R3)
  747.     Shell "", CreateService, $(AH_SvcName), "", "", "adapter","",{},"","","","","","","", $(AH_KeyServicesArea)
  748.     set RegistryErrorIndex = $($R0)
  749.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  750.         Debug-Output "UTILITY.INF: CreateService returned "$(RegistryErrorIndex)
  751.         goto A_H_Return
  752.     endif
  753.     CloseRegKey $($R1)
  754.     set AH_KeyParameters = $($R2)
  755.     CloseRegKey $($R3)
  756.     Shell "", LinkToService, $(AH_KeyNetcard), $(AH_SvcName)
  757.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  758.         Debug-Output "UTILITY.INF: [AddHardwareComponent] LinkToService returned "$(RegistryErrorIndex)
  759.         goto A_H_Return
  760.     endif
  761.     Shell "", IncrementRefCount, $(AH_SoftwareName)
  762.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  763.         Debug-Output "UTILITY.INF: [AddHardwareComponent] IncrementRefCount returned "$(RegistryErrorIndex)
  764.         goto A_H_Return
  765.     endif
  766. A_H_Return = +
  767.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  768.         Debug-Output "UTILITY.INF: [AddHardwareComponent] returning error: "$(RegistryErrorIndex)
  769.         Ifstr(i) $(AH_KeyNetRules) != $(KeyNull)
  770.            CloseRegKey $(AH_KeyNetRules)
  771.         Endif
  772.         Ifstr(i) $(AH_KeyNetcard) != $(KeyNull)
  773.         Endif
  774.         set AH_KeyNetRules = ""
  775.         set AH_KeyNetcard = ""
  776.     endif
  777.     return $(RegistryErrorIndex), $(AH_KeyNetcard), $(AH_KeyNetRules), $(AH_KeyParameters),+
  778.            $(AH_AdapNum), $(AH_SvcName)
  779. [MCAFindBus]
  780.     read-syms InitBaseVars
  781.     set RegistryErrorIndex = NO_ERROR
  782.     set MultifunctionAdapter = "HARDWARE\Description\System\MultifunctionAdapter"
  783.     set InfoList = {}
  784.     OpenRegKey $(!REG_H_LOCAL) "" $(MultifunctionAdapter) $(MAXIMUM_ALLOWED) KeyMultiAdapter
  785.     Ifstr $(KeyMultiAdapter) == $(KeyNull)
  786.         goto MCAFindBus_return
  787.     endif
  788.     EnumRegKey $(KeyMultiAdapter) BusList
  789.     Debug-Output "Buslist"
  790.     Debug-Output $(BusList)
  791.     ForListDo $(BusList)
  792.         set BusNum = *($($),1)
  793.         set RegName = $(MultifunctionAdapter)"\"$(BusNum)
  794.         Debug-Output "BusNum"
  795.         Debug-Output $(BusNum)
  796.         OpenRegKey $(!REG_H_LOCAL) "" $(RegName) $(MAXIMUM_ALLOWED) KeyBus
  797.         ifstr $(KeyBus) != $(KeyNull)
  798.             GetRegValue $(KeyBus),"Configuration Data",ConfigData
  799.             ifstr $(ConfigData) != $(KeyNull)
  800.                 set CardInfo = *($(ConfigData), 4 )
  801.                 set Position = 33
  802.                 set SlotNum = 1
  803.                 QueryListSize ListSize $(CardInfo)
  804. Loop1 =+
  805.                 ifint $(Position) < $(ListSize)
  806.                     set-add NextByte = $(Position), 1
  807.                     ifint *($(CardInfo), $(Position)) == $($0)
  808.                         ifint *($(CardInfo), $(NextByte)) == $($1)
  809.                             LibraryProcedure RealBusNum, $(!LIBHANDLE), GetMCABusInformation, $(KeyBus), "Configuration Data", $(BusNum)
  810.                             Debug-Output $(RealBusNum)
  811.                             set BusNum = *($(RealBusNum),1)
  812.                             Debug-Output $(SlotNum)
  813.                             set-mul mcaid = $($1), 256
  814.                             set-add mcaid = $(mcaid), $($0)
  815.                             set InfoList = >($(InfoList),{$(BusNum),$(SlotNum),$(mcaid)})
  816.                         endif
  817.                     endif
  818.                     set-add Position = $(Position), 6
  819.                     set-add SlotNum = $(SlotNum), 1
  820.                     goto Loop1
  821.                 endif
  822.             endif
  823.             CloseRegKey $(KeyBus)
  824.         endif
  825.     EndForListDo
  826.     CloseRegKey $(KeyMultiAdapter)
  827. MCAFindBus_return = +
  828.     return $(RegistryErrorIndex) $(InfoList)
  829. [EISAFindBus]
  830.     read-syms InitBaseVars
  831.     set MaskNum = $($1)
  832.     ifstr(i) $($1) == ""
  833.         set MaskNum = 16777215  
  834.     endif
  835.     set RegistryErrorIndex = NO_ERROR
  836.     set EISAAdapter = "HARDWARE\Description\System\EISAAdapter"
  837.     set InfoList = {}
  838.     OpenRegKey $(!REG_H_LOCAL) "" $(EISAAdapter) $(MAXIMUM_ALLOWED) KeyEISAAdapter
  839.     Ifstr $(KeyEISAAdapter) == $(KeyNull)
  840.         goto EISAFindBus_return
  841.     endif
  842.     EnumRegKey $(KeyEISAAdapter) BusList
  843.     Debug-Output "Buslist"
  844.     Debug-Output $(BusList)
  845.     ForListDo $(BusList)
  846.         set BusNum = *($($),1)
  847.         OpenRegKey $(!REG_H_LOCAL) "" $(EISAAdapter)"\"$(BusNum) $(MAXIMUM_ALLOWED) KeyEISAAdapterBus
  848.         LibraryProcedure SlotList, $(!LIBHANDLE), GetEisaSlotInformation, $(KeyEISAAdapterBus), "Configuration Data", $($0), $(MaskNum)
  849.         ifstr(i) $(SlotList) != {}
  850.             ForListDo $(SlotList)
  851.                 set SlotNum = $($)
  852.                 ifstr(i) $(SlotNum) != "ERROR"
  853.                     Debug-Output $(BusNum)
  854.                     Debug-Output $(SlotNum)
  855.                     set InfoList = >($(InfoList),{$(BusNum),$(SlotNum),$($0)})
  856.                 endif
  857.             EndForListDo
  858.         endif
  859.     EndForListDo
  860.     CloseRegKey $(KeyEISAAdapter)
  861. EISAFindBus_return = +
  862.     return $(RegistryErrorIndex) $(InfoList)
  863. [GetPCIInformation]
  864.     read-syms InitBaseVars
  865.     set VendorID = $($0)
  866.     set DeviceID = $($1)
  867.     set MultiAdapter = "HARDWARE\Description\System\MultifunctionAdapter"
  868.     set InfoList = {}
  869.     OpenRegKey $(!REG_H_LOCAL) "" $(MultiAdapter) $(MAXIMUM_ALLOWED) KeyMultiAdapter
  870.     Ifstr $(KeyMultiAdapter) == $(KeyNull)
  871.         goto GetPCIInformation_return
  872.     endif
  873.     EnumRegKey $(KeyMultiAdapter) BusList
  874.     Debug-Output "Buslist"
  875.     Debug-Output $(BusList)
  876.     set BusNum = 0
  877.     set index = 0
  878.     ForListDo $(BusList)
  879.         OpenRegKey $(!REG_H_LOCAL) "" $(MultiAdapter)"\"$(index) $(MAXIMUM_ALLOWED) KeyMultiAdapterBus
  880.         GetRegValue $(KeyMultiAdapterBus) "Identifier" IdentifierInfo
  881.         ifstr(i) *($(IdentifierInfo),4) == "PCI"
  882.             set device = 0
  883. next_device = +
  884.             ifint $(device) < 32
  885.                 set function = 0
  886. next_function = +
  887.                 ifint $(function) < 8
  888.                     LibraryProcedure Result, $(!LIBHANDLE), GetPciInformation, $(BusNum), $(device), $(function)
  889.                     debug-output $(BusNum)".."$(device)".."$(function)".."$(Result)
  890.                     ifint *($(Result),1) == 65535
  891.                         Set-add device = $(device),1
  892.                         goto next_device
  893.                     endif
  894.                     ifint *($(Result),1) == $(VendorID)
  895.                         ifint *($(Result),2) == $(DeviceID)
  896.                             set InfoList = >($(InfoList),{$(BusNum),$(device),$(function)})
  897.                         endif
  898.                     endif
  899.                     set-add function = $(function), 1
  900.                     goto next_function                       
  901.                 endif
  902.                 Set-add device = $(device),1
  903.                 goto next_device
  904.             endif
  905. finish_bus = +
  906.             set-add BusNum = $(BusNum),1
  907.         endif
  908.         set-add index = $(index),1
  909.     EndForListDo
  910.     CloseRegKey $(KeyMultiAdapter)
  911. GetPCIInformation_return = +
  912.     return $(InfoList)
  913. [AddNetworkProvider]
  914.     read-syms InitBaseVars
  915.     set RegistryErrorIndex = NO_ERROR
  916.     set ProviderDeviceName = $($3)
  917.     ifstr(i) $(ProviderDeviceName) == ""
  918.         set ProviderDeviceName = $($0)
  919.     endif
  920.     OpenRegKey $(!REG_H_LOCAL) "" $(CurrentControlSet)"\control\NetworkProvider\order" $(MAXIMUM_ALLOWED) OrderKey
  921.     ifstr(i) $(OrderKey) == $(KeyNull)
  922.                   CreateRegKey $(!REG_H_LOCAL) {$(CurrentControlSet)"\control\NetworkProvider\order",$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" OrderKey
  923.     endif
  924.     GetRegValue $(OrderKey) "ProviderOrder" OrderValue
  925.     set Order = *($(OrderValue), 4 )
  926.     ifstr(i) $(OrderValue) == $(KeyNull)
  927.                 goto AddFirstProvider
  928.     else-ifstr(i) $(Order) == $(KeyNull)
  929.                 goto AddFirstProvider
  930.     else
  931.                 goto AddProvider
  932.     endif
  933. AddFirstProvider = +
  934.     SetRegValue $(OrderKey) {ProviderOrder,$(NoTitle),$(!REG_VT_SZ),$($0)}
  935.     goto WriteProviderInfo
  936. AddProvider = +
  937.     Split-String $(Order) "," OrderList
  938.     ifContains(i) $($0) in $(OrderList)
  939.     else
  940.         set Order = $(Order)","$($0)
  941.         SetRegValue $(OrderKey) {ProviderOrder,$(NoTitle),$(!REG_VT_SZ),$(Order)}
  942.     endif
  943.     goto WriteProviderInfo
  944. WriteProviderInfo = +
  945.     CloseRegKey $(OrderKey)
  946.     OpenRegKey $(!REG_H_LOCAL) "" $(ServicesBaseName)"\"$($0)"\networkprovider" $(MAXIMUM_ALLOWED) ProviderKey
  947.     Ifstr(i) $(ProviderKey) == $(KeyNull)
  948.         CreateRegKey $(!REG_H_LOCAL) {$(ServicesBaseName)"\"$($0)"\networkprovider",$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" ProviderKey
  949.     endif
  950.     set NewValueList = {{Devicename,$(NoTitle),$(!REG_VT_SZ),"\Device\"$(ProviderDeviceName)},+
  951.                         {ProviderPath, $(NoTitle), $(!REG_VT_EXPAND_SZ), $($1)},+
  952.                         {Name, $(NoTitle), $(!REG_VT_SZ), $($2)}}
  953.     Shell "" AddValueList $(ProviderKey) $(NewValueList)
  954.     CloseRegKey $(ProviderKey)
  955. AddNetworkProvider_return = +
  956.     return $(RegistryErrorIndex)
  957. [AddServiceProvider]
  958.     read-syms InitBaseVars
  959.     set RegistryErrorIndex = NO_ERROR
  960.     set ClassNum = $($3)
  961.     ifstr(i) $(ClassNum) == ""
  962.         set ClassNum = 8
  963.     endif
  964.     OpenRegKey $(!REG_H_LOCAL) "" $(CurrentControlSet)"\control\ServiceProvider\order" $(MAXIMUM_ALLOWED) OrderKey
  965.     ifstr(i) $(OrderKey) == $(KeyNull)
  966.         CreateRegKey $(!REG_H_LOCAL) {$(CurrentControlSet)"\control\ServiceProvider\Order",$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" OrderKey
  967.         SetRegValue $(OrderKey) {ExcludedProviders,$(NoTitle),$(!REG_VT_MULTI_SZ),{}}
  968.     endif
  969.     GetRegValue $(OrderKey) "ProviderOrder" OrderValue
  970.     set Order = *($(OrderValue), 4 )
  971.     ifstr(i) $(OrderValue) == $(KeyNull)
  972.                 goto AddFirstProvider
  973.     else-ifstr(i) $(Order) == $(KeyNull)
  974.                 goto AddFirstProvider
  975.     else
  976.                 goto AddProvider
  977.     endif
  978. AddFirstProvider = +
  979.     SetRegValue $(OrderKey) {ProviderOrder,$(NoTitle),$(!REG_VT_MULTI_SZ),{$($0)}}
  980.     goto WriteProviderInfo
  981. AddProvider = +
  982.     ifContains(i) $($0) in $(Order)
  983.     else
  984.         set Order = >($(Order),$($0))
  985.         SetRegValue $(OrderKey) {ProviderOrder,$(NoTitle),$(!REG_VT_MULTI_SZ),$(Order)}
  986.     endif
  987.     goto WriteProviderInfo
  988. WriteProviderInfo = +
  989.     CloseRegKey $(OrderKey)
  990.     OpenRegKey $(!REG_H_LOCAL) "" $(ServicesBaseName)"\"$($0)"\Serviceprovider" $(MAXIMUM_ALLOWED) ProviderKey
  991.     Ifstr(i) $(ProviderKey) == $(KeyNull)
  992.         CreateRegKey $(!REG_H_LOCAL) {$(ServicesBaseName)"\"$($0)"\Serviceprovider",$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" ProviderKey
  993.     endif
  994.     set NewValueList = {{Class,$(NoTitle),$(!REG_VT_DWORD),$(ClassNum)},+
  995.                         {ProviderPath, $(NoTitle), $(!REG_VT_EXPAND_SZ), $($1)},+
  996.                         {Name, $(NoTitle), $(!REG_VT_SZ), $($2)}}
  997.     Shell "" AddValueList $(ProviderKey) $(NewValueList)
  998.     CloseRegKey $(ProviderKey)
  999. AddProvider_return = +
  1000.     return $(RegistryErrorIndex)
  1001. [RemoveServiceProvider]
  1002.     read-syms InitBaseVars
  1003.     set RegistryErrorIndex = NO_ERROR
  1004.     OpenRegKey $(!REG_H_LOCAL) "" $(CurrentControlSet)"\control\ServiceProvider\order" $(MAXIMUM_ALLOWED) OrderKey
  1005.     ifstr(i) $(OrderKey) == $(KeyNull)
  1006.         set RegistryErrorIndex = PROVIDER_ORDER_DOES_NOT_EXIST
  1007.         goto RemoveProvider_return
  1008.     endif
  1009.     GetRegValue $(OrderKey) "ProviderOrder" OrderValue
  1010.     set Order = *($(OrderValue), 4 )
  1011.     set NewOrderList = {}
  1012.     set FirstTime = TRUE
  1013.     set Found = FALSE
  1014.     ForListDo $(Order)
  1015.         ifstr(i) $($) != $($0)
  1016.             ifstr(i) $(FirstTime) == TRUE
  1017.                 set FirstTime = FALSE
  1018.                 set NewOrderList = {$($)}
  1019.             else
  1020.                 set NewOrderList = >($(NewOrderList),$($))
  1021.             endif
  1022.         else
  1023.             set Found = TRUE
  1024.         endif
  1025.     EndForListDo
  1026.     ifstr(i) $(Found) == FALSE
  1027.     else
  1028.         ifstr(i) $(NewOrderList) == {}
  1029.             set NewOrderList = ""
  1030.         endif
  1031.         SetRegValue $(OrderKey) {ProviderOrder,$(NoTitle),$(!REG_VT_MULTI_SZ),$(NewOrderList)}
  1032.     endif
  1033.     OpenRegKey $(!REG_H_LOCAL) "" $(ServicesBaseName)\$($0) $(MAXIMUM_ALLOWED) ProviderKey
  1034.     ifstr $(ProviderKey) != $(KeyNull)
  1035.         DeleteRegTree $(ProviderKey) "ServiceProvider"
  1036.     endif
  1037. RemoveProvider_return = +
  1038.     return $(RegistryErrorIndex)
  1039. [RemoveNetworkProvider]
  1040.     read-syms InitBaseVars
  1041.     set RegistryErrorIndex = NO_ERROR
  1042.     OpenRegKey $(!REG_H_LOCAL) "" $(CurrentControlSet)"\control\NetworkProvider\order" $(MAXIMUM_ALLOWED) OrderKey
  1043.     ifstr(i) $(OrderKey) == $(KeyNull)
  1044.         set RegistryErrorIndex = PROVIDER_ORDER_DOES_NOT_EXIST
  1045.         goto RemoveNetworkProvider_return
  1046.     endif
  1047.     GetRegValue $(OrderKey) "ProviderOrder" OrderValue
  1048.     set Order = *($(OrderValue), 4 )
  1049.     Split-String $(Order) "," OrderList
  1050.     set NewOrderList = {}
  1051.     set FirstTime = TRUE
  1052.     set Found = FALSE
  1053.     ForListDo $(OrderList)
  1054.         ifstr(i) $($) != ","
  1055.             ifstr(i) $($) != $($0)
  1056.                 ifstr(i) $(FirstTime) == TRUE
  1057.                     set FirstTime = FALSE
  1058.                     set NewOrderList = $($)
  1059.                 else
  1060.                     set NewOrderList = $(NewOrderList)","$($)
  1061.                 endif
  1062.             else
  1063.                 set Found = TRUE
  1064.             endif
  1065.         endif
  1066.     EndForListDo
  1067.     ifstr(i) $(Found) == FALSE
  1068.     else
  1069.         ifstr(i) $(NewOrderList) == {}
  1070.             set NewOrderList = ""
  1071.         endif
  1072.         SetRegValue $(OrderKey) {ProviderOrder,$(NoTitle),$(!REG_VT_SZ),$(NewOrderList)}
  1073.     endif
  1074.     OpenRegKey $(!REG_H_LOCAL) "" $(ServicesBaseName)\$($0) $(MAXIMUM_ALLOWED) ProviderKey
  1075.     ifstr $(ProviderKey) != $(KeyNull)
  1076.         DeleteRegTree $(ProviderKey) "NetworkProvider"
  1077.     endif
  1078. RemoveNetworkProvider_return = +
  1079.     return $(RegistryErrorIndex)
  1080. [PrepareToCopy]
  1081.     Read-syms ProgressCopy$(!STF_LANGUAGE)
  1082.     Return STATUS_SUCCESSFUL
  1083. [DoAskSource]
  1084.     Set DAS_CWDDIR  = $($0)
  1085.     Set DAS_SRCDIR  = $($1)
  1086.     Set DAS_BUILTIN = $($2)
  1087.     Set DAS_Result  = STATUS_FAILED
  1088.     Ifstr(i) $(!STF_SRCDIR_OVERRIDE) != ""
  1089.         Set DAS_SRCDIR = $(!STF_SRCDIR_OVERRIDE)
  1090.         Set DAS_Result = STATUS_SUCCESSFUL
  1091.         Goto DAS_exit
  1092.     Endif
  1093.     Ifstr(i) $(DAS_BUILTIN) == YES
  1094.         Ifstr(i) $(!NTN_InstallPhase) == primary
  1095.             Ifstr(i) $(!STF_SRCDIR_WINNT) != ""
  1096.                 Set DAS_SRCDIR = $(!STF_SRCDIR_WINNT)
  1097.             Endif
  1098.             Set DAS_Result = STATUS_SUCCESSFUL
  1099.             Goto DAS_exit
  1100.         Endif
  1101.     Endif
  1102.     Debug-Output "UTILITY.INF: [DoAskSource] STF_CWDDIR = "$(DAS_CWDDIR)" STF_SRCDIR = "$(DAS_SRCDIR)
  1103.     Ifstr(i) $(DAS_SRCDIR) == ""
  1104.         Set DAS_SRCDIR = "A:\"
  1105.     Endif
  1106.     Ifstr(i) $(DAS_SRCDIR) == $(!STF_SRCDIR_USED)
  1107.         Set DAS_SRCDIR = $(!STF_SRCDIR_KEYED)
  1108.     Endif
  1109.     Shell "subroutn.inf" DoAskSource $(DAS_SRCDIR)
  1110.     ifint $($ShellCode) != $(!SHELL_CODE_OK)
  1111.         Debug-Output "UTILITY.INF: shelling SUBROUTN.INF [DoAskSource] failed"
  1112.         goto DAS_exit
  1113.     endif
  1114.     Set DAS_Result = $($R0)
  1115.     Ifstr(i) $(DAS_Result) == STATUS_USERCANCEL
  1116.         Set !p:CommonStatus = STATUS_USERCANCEL
  1117.         goto DAS_exit
  1118.     Endif
  1119.     Set DAS_SRCDIR = $($R1)
  1120.     Set !STF_SRCDIR_USED = $($R1)
  1121.     Set !STF_SRCDIR_KEYED = $($R3)
  1122. DAS_exit =+
  1123.     Read-syms ProgressCopy$(!STF_LANGUAGE)
  1124.     Return $(DAS_Result) $(DAS_SRCDIR)
  1125. [RemoveSoftwareComponent]
  1126.     Debug-Output "Remove Software Component..."
  1127.     read-syms InitBaseVars
  1128.     set RS_Manufacturer = $($0)
  1129.     set RS_ProductName  = $($1)
  1130.     set RS_CheckRefCount = $($2)
  1131.     set RS_VersionNum   = "CurrentVersion"
  1132.     set RS_ManufacturerKey = $(!NTN_SoftwareBase)"\"$(RS_Manufacturer)
  1133.     set RS_ProductKey   = $(!NTN_SoftwareBase)"\"$(RS_Manufacturer)"\"$(RS_ProductName)
  1134.     set RS_ProductVerKey        = $(!NTN_SoftwareBase)"\"$(RS_Manufacturer)"\"$(RS_ProductName)"\"$(RS_VersionNum)
  1135.     set RegistryErrorIndex      = NO_ERROR
  1136.     ifstr(i) $(RS_CheckRefCount) != FALSE
  1137.         Shell "", IsRefCountEqualZero, $(RS_ProductVerKey)
  1138.         Ifstr(i) $($R0) != NO_ERROR
  1139.             Debug-Output "UTILITY.INF: [RemoveSoftwareComponent] IsRefCountEqualZero returned "$($R0)
  1140.             goto RemoveSoftwareComponent_Return
  1141.         endif
  1142.         Ifint $($R1) == 0
  1143.             set RegistryErrorIndex = REF_COUNT_NOT_ZERO
  1144.             goto RemoveSoftwareComponent_Return
  1145.         endif
  1146.     endif
  1147.     OpenRegKey $(!REG_H_LOCAL) "" $(RS_ManufacturerKey) $(MAXIMUM_ALLOWED) ProductKey
  1148.     Ifstr $(ProductKey) == $(KeyNull)
  1149.        Debug-Output "UTILITY.INF: could not open Software product key"
  1150.        set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  1151.        goto RemoveSoftwareComponent_Return
  1152.     endif
  1153.     DeleteRegTree $(ProductKey) $(RS_ProductName)
  1154.     CloseRegKey $(ProductKey)
  1155.     Shell "" RemoveService, $(RS_ProductName), "YES"
  1156.     Set RS_RemoveError = $($R0)
  1157.     Ifint $(RS_RemoveError) != 0
  1158.          Debug-Output "UTILITY.INF: RemoveService wrapper failed, error: "$(RS_RemoveResult)
  1159.          Set RegistryErrorIndex = UNABLE_REMOVE_CONFIGURE_SERVICE
  1160.          Goto RemoveSoftwareComponent_Return
  1161.     Endif
  1162. RemoveSoftwareComponent_Return = +
  1163.     Return $(RegistryErrorIndex)
  1164. [RemoveHardwareComponent]
  1165.     Debug-Output "Remove Hardware Component..."
  1166.     read-syms InitBaseVars
  1167.     set RH_Manufacturer = $($0)
  1168.     set RH_ProductName  = $($1)
  1169.     set RH_VersionNum   = "CurrentVersion"
  1170.     set RH_ProductKey   = $(!NTN_SoftwareBase)"\"$($0)"\"$($1)"\"$(RH_VersionNum)
  1171.     set RH_NetCardName  = $($2)
  1172.     Split-String $(RH_NetCardName), "\", CardInfo
  1173.     set RH_NetCardNum   = *($(CardInfo),11)
  1174.     set RH_NetCardBase  = *($(CardInfo),1)*($(CardInfo),2)*($(CardInfo),3)*($(CardInfo),4)*($(CardInfo),5)*($(CardInfo),6)*($(CardInfo),7)*($(CardInfo),8)*($(CardInfo),9)
  1175.     set RegistryErrorIndex      = NO_ERROR
  1176.     Shell "", DecrementRefCount, $(RH_ProductKey)
  1177.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  1178.         Debug-Output "UTILITY.INF: [AddHardwareComponent] IncrementRefCount returned "$(RegistryErrorIndex)
  1179.         goto RemoveHardwareComponent_Return
  1180.     endif
  1181.     OpenRegKey $(!REG_H_LOCAL) "" $(RH_NetCardBase) $(MAXIMUM_ALLOWED) NetCardKey
  1182.     Ifstr $(NetCardKey) == $(KeyNull)
  1183.        Debug-Output "UTILITY.INF: could not open NetworkCards key"
  1184.        set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  1185.        goto RemoveHardwareComponent_Return
  1186.     endif
  1187.     OpenRegKey $(NetCardKey) "" $(RH_NetCardNum) $(MAXIMUM_ALLOWED) NetCardNumKey
  1188.     Ifstr $(NetCardNumKey) == $(KeyNull)
  1189.        Debug-Output "UTILITY.INF: could not open NetworkCards Number key"
  1190.        set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  1191.        goto RemoveHardwareComponent_Return
  1192.     endif
  1193.     GetRegValue $(NetCardNumKey),"ServiceName", RH_ServiceNameInfo
  1194.     set RH_ServiceName = *($(RH_ServiceNameInfo), 4)
  1195.     ifstr(i) $(RH_ServiceName) == ""
  1196.         set RH_ServiceName = $(RH_ProductName)$(RH_NetCardNum)
  1197.     endif
  1198.     CloseRegKey $(NetCardNumKey)
  1199.     DeleteRegTree $(NetCardKey) $(RH_NetCardNum)
  1200.     CloseRegKey $(NetCardKey)
  1201.     Shell "", RemoveService, $(RH_ServiceName), "NO"
  1202.     Set RS_RemoveError = $($R0)
  1203.     Ifint $(RS_RemoveError) != 0
  1204.          Debug-Output "UTILITY.INF: RemoveService wrapper failed, error: "$(RS_RemoveResult)
  1205.          Set RegistryErrorIndex = UNABLE_REMOVE_CONFIGURE_SERVICE
  1206.          Goto RemoveHardwareComponent_Return
  1207.     Endif
  1208.     Shell "", IsRefCountEqualZero, $(RH_ProductKey)
  1209.     Ifstr(i) $($R0) != NO_ERROR
  1210.         Debug-Output "UTILITY.INF: [RemoveHardwareComponent] IsRefCountEqualZero returned "$($R0)
  1211.         goto RemoveHardwareComponent_Return
  1212.     endif
  1213.     Ifint $($R1) == 1
  1214.         Debug-Output "Remove software component..."
  1215.         Shell "" RemoveSoftwareComponent, $(RH_Manufacturer), $(RH_ProductName)
  1216.         set RegistryErrorIndex = $($R0)
  1217.     endif
  1218.     debug-output "remove netbios information..."
  1219.     LibraryProcedure Result, $(!NCPA_HANDLE), RemoveRouteFromNETBIOS, $(RH_ServiceName)
  1220. RemoveHardwareComponent_Return = +
  1221.     Return $(RegistryErrorIndex)
  1222. [RemoveService]
  1223.     read-syms InitBaseVars
  1224.     Set RS_SvcName = $($0)
  1225.     Set RS_UseDelSvc = $($1)
  1226.     OpenRegKey $(!REG_H_LOCAL) "" "SYSTEM\CurrentControlSet\Services\"$(RS_SvcName) +
  1227.         $(MAXIMUM_ALLOWED) ServiceKey
  1228.     Ifstr $(ServiceKey) == $(KeyNull)
  1229.         Debug-Output "UTILITY.INF: could not open SYSTEM Service key "$(RS_SvcName)
  1230.         goto RemoveService_Return
  1231.     endif
  1232.     OpenRegKey $(ServiceKey) "" "Parameters" $(MAXIMUM_ALLOWED) ParameterKey
  1233.     Ifstr $(ParameterKey) != $(KeyNull)
  1234.          DeleteRegValue $(ParameterKey) "NbProvider"
  1235.          CloseRegKey $(ParameterKey)
  1236.     Endif
  1237.     CloseRegKey $(ServiceKey)
  1238.     ifstr(i) $(RS_UseDelSvc) == "YES"
  1239.         Set FLibraryErrCtl = 1
  1240.         LibraryProcedure RS_RemoveResult $(!NCPA_HANDLE), CPlSetup, +
  1241.           $(!STF_HWND), DELETESVC, $(RS_SvcName)
  1242.         Set FLibraryErrCtl = 0
  1243.         Set RS_RemoveError = *($(RS_RemoveResult),1)
  1244.         Ifint $(RS_RemoveError) != 0
  1245.              Debug-Output "UTILITY.INF: RemoveService wrapper failed, error: "$(RS_RemoveResult)
  1246.              Set RegistryErrorIndex = UNABLE_REMOVE_CONFIGURE_SERVICE
  1247.              Goto RemoveService_Return
  1248.         Endif
  1249.     else
  1250.         OpenRegKey $(!REG_H_LOCAL) "" "SYSTEM\CurrentControlSet\Services" +
  1251.         $(MAXIMUM_ALLOWED) ServiceKey
  1252.         Ifstr $(ServiceKey) == $(KeyNull)
  1253.            Debug-Output "UTILITY.INF: could not open SYSTEM Service key "$(RS_SvcName)
  1254.            set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  1255.            goto RemoveService_Return
  1256.         endif
  1257.         DeleteRegTree $(ServiceKey) $(RS_SvcName)
  1258.         CloseRegKey $(ServiceKey)
  1259.     endif
  1260. RemoveService_Return = +
  1261.     return $(RegistryErrorIndex)
  1262. [IsNetCardAlreadyInstalled]
  1263.     read-syms InitBaseVars
  1264.     set AlreadyExisted  = "NO"
  1265.     set BusNum  = $($0)
  1266.     set SlotNum = $($1)
  1267.     set Description = $($2)
  1268.     set Product = $($3)
  1269.     set SkipDescriptionCheck = $($4)
  1270.     ifstr(i) $(SkipDescriptionCheck) == ""
  1271.         set SkipDescriptionCheck = "NO"
  1272.     endif
  1273.     OpenRegKey $(!REG_H_LOCAL) "" $(NetworkCardKeyName) $(MAXIMUM_ALLOWED) IE_KeyNetcards
  1274.     Ifstr $(IE_KeyNetcards) == $(KeyNull)
  1275.        set RegistryErrorIndex = UNABLE_OPEN_NETWORKCARD_SECTION
  1276.        goto IE_Return
  1277.     endif
  1278.     EnumRegKey $(IE_KeyNetcards) IE_KeyNameList
  1279.     ForListDo  $(IE_KeyNameList)
  1280.         set IE_KeyName = *($($),1)
  1281.         OpenRegKey $(IE_KeyNetcards) "" $(IE_KeyName) $(MAXIMUM_ALLOWED) IE_Card
  1282.         Ifstr $(IE_Card) == $(KeyNull)
  1283.            set RegistryErrorIndex = UNABLE_OPEN_NETWORKCARD_SECTION
  1284.            goto IE_Return
  1285.         endif
  1286.         GetRegValue $(IE_Card),"Description", DescriptionInfo
  1287.         GetRegValue $(IE_Card),"ProductName", ProductNameInfo
  1288.         set CardDescription     = *($(DescriptionInfo), 4)
  1289.         set CardProductName     = *($(ProductNameInfo), 4)
  1290.         ifstr(i) $(SkipDescriptionCheck) == "YES"
  1291.             set CardDescription = $(Description)
  1292.             set CardProductName = $(Product)
  1293.         endif
  1294.         ifstr(i) $(CardDescription) == $(Description)
  1295.             ifstr(i) $(CardProductName) == $(Product)
  1296.                 GetRegValue $(IE_Card), "ServiceName", ServiceNameInfo
  1297.                 set ServiceName = *($(ServiceNameInfo), 4)
  1298.                 OpenRegKey $(!REG_H_LOCAL) "" +
  1299.                    $(ServicesBaseName)"\"$(ServiceName)"\Parameters" +
  1300.                    $(MAXIMUM_ALLOWED) IE_KeyService
  1301.                 Ifstr $(IE_KeyService) == $(KeyNull)
  1302.                    set RegistryErrorIndex = UNABLE_OPEN_NETWORKCARD_SECTION
  1303.                    goto IE_Return
  1304.                 endif
  1305.                 GetRegValue $(IE_KeyService), "BusNumber", BusInfo
  1306.                 GetRegValue $(IE_KeyService), "SlotNumber", SlotInfo
  1307.                 set CardBusNum = *($(BusInfo), 4)
  1308.                 set CardSlotNum = *($(SlotInfo), 4)
  1309.                 ifint $(CardBusNum) == $(BusNum)
  1310.                     ifint $(CardSlotNum) == $(SlotNum)
  1311.                         set AlreadyExisted = "YES"
  1312.                     endif
  1313.                 endif
  1314.             endif
  1315.         endif
  1316.     EndForListDo
  1317. IE_Return = +
  1318.     return $(RegistryErrorIndex) $(AlreadyExisted)
  1319. [UpdateWinsockService]
  1320.     read-syms InitBaseVars
  1321.     Set UW_NameOfService = $($0)
  1322.     Set UW_Adding        = $($1)
  1323.     Set UW_KeyServices   = $(KeyNull)
  1324.     Set UW_KeyParameters = $(KeyNull)
  1325.     Shell "", BaseServiceKey
  1326.     Set RegistryErrorIndex = $($R0)
  1327.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  1328.        Set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  1329.        Goto U_W_Return
  1330.     endif
  1331.     Set UW_KeyServices = $($R1)
  1332.     OpenRegKey $(UW_KeyServices) "" "WinSock\Parameters" $(MAXIMUM_ALLOWED) UW_KeyParameters
  1333.     Ifstr(i) $(UW_KeyParameters) == $(KeyNull)
  1334.         Debug-Output "UTILITY.INF:  Create WinSock Service"
  1335.         Shell "", CreateService, "WinSock", "", "", "adapter", "", {}
  1336.         Set RegistryErrorIndex = $($R0)
  1337.         Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  1338.             Debug-Output "UTILITY.INF: CreateService for WinSock returned "$(RegistryErrorIndex)
  1339.             Goto U_W_Return
  1340.         Endif
  1341.         CloseRegKey $($R1)
  1342.         Set UW_KeyParameters = $($R2)
  1343.         CloseRegKey $($R3)
  1344.     Else
  1345.         Debug-Output "UTILITY.INF:  Open WinSock Service"
  1346.     Endif
  1347.     Ifstr(i) $(UW_KeyParameters) == $(KeyNull)
  1348.         Set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  1349.         Goto U_W_Return
  1350.     Endif
  1351.     GetRegValue $(UW_KeyParameters) "Transports" UW_TransportsValue
  1352.     Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
  1353.         Set UW_TransportsList = *($(UW_TransportsValue), 4)
  1354.     Else
  1355.         Set UW_TransportsList = {}
  1356.     Endif
  1357.     Ifstr(i) $(UW_TransportsList) == ""
  1358.         Set UW_TransportsList = {}
  1359.     Endif
  1360.     Ifstr(i) $(UW_Adding) == "TRUE"
  1361.         Set UW_TransportsList = >($(UW_TransportsList), $(UW_NameOfService))
  1362.     Else
  1363.         Set UW_NewList = {}
  1364.         ForListDo $(UW_TransportsList)
  1365.             Ifstr(i) $($) != $(UW_NameOfService)
  1366.                 Set UW_NewList = >($(UW_NewList), $($))
  1367.             Endif
  1368.         EndForListDo
  1369.         Set UW_TransportsList = $(UW_NewList)
  1370.     Endif
  1371.     SetRegValue $(UW_KeyParameters) {Transports, $(NoTitle), $(!REG_VT_MULTI_SZ), $(UW_TransportsList)}
  1372.     Debug-Output "UTILITY.INF:  WinSock transport info added/deleted for "$(UW_NameOfService)
  1373. U_W_Return = +
  1374.     Ifstr $(UW_KeyParameters) != $(KeyNull)
  1375.         CloseRegKey $(UW_KeyParameters)
  1376.     Endif
  1377.     Ifstr $(UW_KeyServices) != $(KeyNull)
  1378.         CloseRegKey $(UW_KeyServices)
  1379.     Endif
  1380.     Return $(RegistryErrorIndex)
  1381. [AddWinsockInfo]
  1382.     read-syms InitBaseVars
  1383.     Set AW_NameOfService = $($0)
  1384.     Set AW_DLLName       = $($1)
  1385.     Set AW_MaxAddrLgt    = $($2)
  1386.     Set AW_MinAddrLgt    = $($3)
  1387.     Set AW_KeyServices   = $(KeyNull)
  1388.     Set AW_KeyParameters = $(KeyNull)
  1389.     Set AW_KeySockets    = $(KeyNull)
  1390.     Shell "", AddAFD
  1391.     Set RegistryErrorIndex = $($R0)
  1392.     Ifstr(i) $(RegistryErrorIndex) == NO_ERROR
  1393.         Shell "", BaseServiceKey
  1394.         Set RegistryErrorIndex = $($R0)
  1395.     Endif
  1396.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  1397.        Set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  1398.        Goto A_W_Return
  1399.     endif
  1400.     Set AW_KeyServices = $($R1)
  1401.     OpenRegKey $(AW_KeyServices) "" $(AW_NameOfService)"\Parameters" $(MAXIMUM_ALLOWED) AW_KeyParameters
  1402.     Ifstr(i) $(AW_KeyParameters) == $(KeyNull)
  1403.        Set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  1404.        Goto A_W_Return
  1405.     Endif
  1406.     OpenRegKey $(AW_KeyParameters) "" "Winsock" $(MAXIMUM_ALLOWED) AW_KeySockets
  1407.     Ifstr(i) $(AW_KeySockets) == $(KeyNull)
  1408.         CreateRegKey $(AW_KeyParameters) {Winsock,$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" AW_KeySockets
  1409.     Endif
  1410.     Ifstr(i) $(AW_KeySockets) == $(KeyNull)
  1411.        Set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  1412.        Goto A_W_Return
  1413.     Endif
  1414.     Set AW_ValueList = {{HelperDllName    ,$(NoTitle),$(!REG_VT_EXPAND_SZ),$(AW_DLLName)},+
  1415.                         {MaxSockAddrLength,$(NoTitle),$(!REG_VT_DWORD),$(AW_MaxAddrLgt)},+
  1416.                         {MinSockAddrLength,$(NoTitle),$(!REG_VT_DWORD),$(AW_MinAddrLgt)}}
  1417.     Shell "", AddValueList, $(AW_KeySockets), $(AW_ValueList)
  1418.     Set RegistryErrorIndex = $($R0)
  1419.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  1420.         Debug-Output "UTILITY.INF: [AddWinsockInfo] Registry error: Add value list"
  1421.     Endif
  1422.     Set FLibraryErrCtl = 1
  1423.     LibraryProcedure AW_MapResult $(!NCPA_HANDLE), CPlSetup, $(!STF_HWND), WINSOCKMAP, $(AW_DLLName), $(AW_KeySockets)
  1424.     Set FLibraryErrCtl = 0
  1425.     Set AW_MapError = *($(AW_MapResult),1)
  1426.     Ifint $(AW_MapError) != 0
  1427.         Debug-Output "UTILITY.INF: [AddWinsockInfo] WINSOCKMAP returned "$(AW_MapError)
  1428.         Set RegistryErrorIndex = UNABLE_ACCESS_WINSOCK_MAP_INFO
  1429.         Goto A_W_Return
  1430.     Endif
  1431.     Shell "" UpdateWinsockService $(AW_NameOfService) TRUE
  1432.     Set RegistryErrorIndex = $($R0)
  1433. A_W_Return = +
  1434.     Ifstr $(AW_KeySockets) != $(KeyNull)
  1435.         CloseRegKey $(AW_KeySockets)
  1436.     Endif
  1437.     Ifstr $(AW_KeyParameters) != $(KeyNull)
  1438.         CloseRegKey $(AW_KeyParameters)
  1439.     Endif
  1440.     Ifstr $(AW_KeyServices) != $(KeyNull)
  1441.         CloseRegKey $(AW_KeyServices)
  1442.     Endif
  1443.     Return $(RegistryErrorIndex)
  1444. [RemoveWinsockInfo]
  1445.     read-syms InitBaseVars
  1446.     Set RW_NameOfService = $($0)
  1447.     Set RW_KeyServices   = $(KeyNull)
  1448.     Set RW_KeySockets    = $(KeyNull)
  1449.     Shell "", BaseServiceKey
  1450.     Set RegistryErrorIndex = $($R0)
  1451.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  1452.        Set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  1453.        Goto R_W_Return
  1454.     endif
  1455.     Set RW_KeyServices = $($R1)
  1456.     OpenRegKey $(RW_KeyServices) "" $(RW_NameOfService)"\Parameters" $(MAXIMUM_ALLOWED) RW_KeySockets
  1457.     Ifstr(i) $(RW_KeySockets) == $(KeyNull)
  1458.        Set RegistryErrorIndex = NO_ERROR
  1459.     else
  1460.        DeleteRegTree $(RW_KeySockets) "Winsock"
  1461.     Endif
  1462.     Shell "" UpdateWinsockService $(RW_NameOfService) FALSE
  1463.     Set RegistryErrorIndex = $($R0)
  1464. R_W_Return = +
  1465.     Ifstr $(RW_KeySockets) != $(KeyNull)
  1466.         CloseRegKey $(RW_KeySockets)
  1467.     Endif
  1468.     Ifstr $(RW_KeyServices) != $(KeyNull)
  1469.         CloseRegKey $(RW_KeyServices)
  1470.     Endif
  1471.     Return $(RegistryErrorIndex)
  1472. [BindingInfo-DEC]
  1473. BindingInfo     = {+
  1474.                   "lanceDriver dec100Adapter non exclusive 100",+
  1475.                   "lanceDriver dec101Adapter non exclusive 100",+
  1476.                   "lanceDriver decetherworksturboAdapter non exclusive 100",+
  1477.                   "lanceDriver dec422Adapter non exclusive 100",+
  1478.                   "lanceDriver decpcAdapter non exclusive 100",+
  1479.                   "lanceDriver decstatAdapter non exclusive 100"+
  1480.                   }
  1481. [BindingInfo-WD]
  1482. BindingInfo     = {+
  1483.                           "smc8000nDriver smcisaAdapter non exclusive 100",+
  1484.                           "smc8000nDriver wd8003eaAdapter non exclusive 100",+
  1485.                           "smc8000nDriver wd8003waAdapter non exclusive 100",+
  1486.                           "smc8000nDriver wd8013epaAdapter non exclusive 100",+
  1487.                           "smc8000nDriver wd8013wpaAdapter non exclusive 100"+
  1488.                           }
  1489. [BindingInfo-PROTEON]
  1490. BindingInfo     = {+
  1491.                            "proteonDriver p1990Adapter non exclusive 100",+
  1492.                            "proteonDriver p1390Adapter non exclusive 100"+
  1493.                           }
  1494. [BindingInfo-PRONET16]
  1495. BindingInfo     = {+
  1496.                            "pronet16Driver p199XAdapter non exclusive 100",+
  1497.                            "pronet16Driver p139XAdapter non exclusive 100"+
  1498.                           }
  1499. [BindingInfo-IBMTOK2E]
  1500. BindingInfo     = {+
  1501.                            "ibmtok2eDriver ibmtok2eAdapter non exclusive 100"+
  1502.                           }
  1503. [BindingInfo-IBM]
  1504. BindingInfo     = {"ibmtokDriver ibmtokAdapter non exclusive 100",+
  1505.                    "ibmtokDriver ibmtokmcAdapter non exclusive 100"}
  1506. [GetBindingInfo]
  1507.     set BindingInfo = {}
  1508.     read-syms BindingInfo-$($0)
  1509.     return "NO_ERROR", $(BindingInfo)
  1510. [AddStreams]
  1511.     read-syms InitBaseVars
  1512.     OpenRegKey $(!REG_H_LOCAL) "" $(ServicesBaseName)"\streams" $(MAXIMUM_ALLOWED) BS_KeyServices
  1513.     Ifstr $(BS_KeyServices) == $(KeyNull)
  1514.         set OldOption = $(!NTN_InfOption)
  1515.         set !NTN_InfOption = STREAMS
  1516.         Shell "oemnxpst.inf" InstallOption $(!STF_LANGUAGE) "STREAMS" $(!STF_SRCDIR) $(!NtLmAddCopy) $(!NtLmDoCopy) $(!NtLmDoConfig)
  1517.         set !NTN_InfOption = $(OldOption)
  1518.     else
  1519.         CloseRegKey $(BS_KeyServices)
  1520.         Debug-Output "UTILITY.INF: streams already installed"
  1521.     endif
  1522.     Shell "", IncrementRefCount, "Software\Microsoft\streams\CurrentVersion"
  1523. AddStreamsReturn = +
  1524.     return NO_ERROR
  1525. [RemoveStreams]
  1526.     read-syms InitBaseVars
  1527.     OpenRegKey $(!REG_H_LOCAL) "" $(ServicesBaseName)"\streams" $(MAXIMUM_ALLOWED) BS_KeyServices
  1528.     Ifstr $(BS_KeyServices) != $(KeyNull)
  1529.         CloseRegKey $(BS_KeyServices)
  1530.         Shell "", DecrementRefCount, "Software\Microsoft\streams\CurrentVersion"
  1531.         Shell "", IsRefCountEqualZero, "Software\Microsoft\streams\CurrentVersion"
  1532.         Ifstr(i) $($R0) != NO_ERROR
  1533.             Debug-Output "UTILITY.INF: [RemoveSoftwareComponent] IsRefCountEqualZero returned "$($R0)
  1534.             goto RemoveStreamsReturn
  1535.         endif
  1536.         Ifint $($R1) != 1
  1537.             goto RemoveStreamsReturn
  1538.         endif
  1539.         set OldOption = $(!NTN_InfOption)
  1540.         set OldInstallMode = $(!NTN_InstallMode)
  1541.         set !NTN_InfOption = STREAMS
  1542.         set !NTN_InstallMode = deinstall
  1543.         Shell "oemnxpst.inf" InstallOption $(!STF_LANGUAGE) "STREAMS" $(!STF_SRCDIR) $(!NtLmAddCopy) $(!NtLmDoCopy) $(!NtLmDoConfig)
  1544.         set !NTN_InfOption = $(OldOption)
  1545.         set !NTN_InstallMode = $(OldInstallMode)
  1546.     endif
  1547. RemoveStreamsReturn = +
  1548.     return NO_ERROR
  1549. [AddAFD]
  1550.     read-syms InitBaseVars
  1551.     read-syms AFDVars
  1552.     Set Result = NO_ERROR
  1553.     OpenRegKey $(!REG_H_LOCAL) "" $(ServicesBaseName)"\AFD" $(MAXIMUM_ALLOWED) BS_KeyServices
  1554.     Ifstr $(BS_KeyServices) == $(KeyNull)
  1555.         Shell "", CreateService, $(ProductAFDName),+
  1556.             $(ProductAFDTitle),+
  1557.             $(ProductAFDImagePath),+
  1558.             $(ProductAFDSvcType), "", {}, "",+
  1559.             "%SystemRoot%\System32\IoLogMsg.dll"
  1560.         Set Result = $($R0)
  1561.     else
  1562.         CloseRegKey $(BS_KeyServices)
  1563.     endif
  1564. AddAFDReturn = +
  1565.     return $(Result)
  1566. [GetBusTypeNum]
  1567.     read-syms InitBaseVars
  1568.     set DetCard = $(!p:DetectedCard)
  1569.     ifstr(i) $(DetCard) == ""
  1570.         set DetCard = FALSE
  1571.     endif
  1572.     ifstr(i) $(DetCard) == FALSE
  1573.         set BusType = 1
  1574.         ifstr(i) $(!STF_BUSTYPE) == "ISA"
  1575.             set BusType = 1
  1576.         else-ifstr(i) $(!STF_BUSTYPE) == "EISA"
  1577.             set BusType = 2
  1578.         else-ifstr(i) $(!STF_BUSTYPE) == "Jazz-Internal Bus"
  1579.             set BusType = 0
  1580.         else-ifstr(i) $(!STF_BUSTYPE) == "MCA"
  1581.             set BusType = 3
  1582.         else-ifstr(i) $(!STF_BUSTYPE) == "TCChannel"
  1583.             set BusType = 4
  1584.         else-ifstr(i) $(!STF_BUSTYPE) == "PCI"
  1585.             set BusType = 5
  1586.         else-ifstr(i) $(!STF_BUSTYPE) == "PCMCIA"
  1587.             set BusType = 1
  1588.         else
  1589.             debug-output "Utility.inf: Unknown bus type"
  1590.         endif
  1591.     else
  1592.         set BusType = *($(!STF_NCDETINFO),5)
  1593.     endif
  1594.     return NO_ERROR, $(BusType)
  1595. [AddRpcProtocol]
  1596.     Set ARP_Protocol = $($0)
  1597.     Set ARP_ClientDll = $($1)
  1598.     Set ARP_ServerDll = $($2)
  1599.     read-syms InitBaseVars
  1600.     Set ARP_KeyRpc = $(KeyNull)
  1601.     Set ARP_KeyRpcServer = $(KeyNull)
  1602.     Set ARP_KeyRpcClient = $(KeyNull)
  1603.     Set RegistryErrorIndex = UNABLE_ACCESS_SOFTWARE_REG
  1604.     OpenRegKey $(!REG_H_LOCAL) "" "SOFTWARE\Microsoft\Rpc" $(MAXIMUM_ALLOWED) ARP_KeyRpc
  1605.     Ifstr(i) $(ARP_KeyRpc) == $(KeyNull)
  1606.        Goto ARP_Return
  1607.     Endif
  1608.     OpenRegKey $(ARP_KeyRpc) "" "ClientProtocols" $(MAXIMUM_ALLOWED) ARP_KeyClient
  1609.     Ifstr(i) $(ARP_KeyClient) == $(KeyNull)
  1610.        Goto ARP_Return
  1611.     Endif
  1612.     OpenRegKey $(ARP_KeyRpc) "" "ServerProtocols" $(MAXIMUM_ALLOWED) ARP_KeyServer
  1613.     Ifstr(i) $(ARP_KeyServer) == $(KeyNull)
  1614.        Goto ARP_Return
  1615.     Endif
  1616.     SetRegValue $(ARP_KeyClient) {$(ARP_Protocol),$(NoTitle),$(!REG_VT_SZ),$(ARP_ClientDll)}
  1617.     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  1618.         Goto ARP_Return
  1619.     Endif
  1620.     SetRegValue $(ARP_KeyServer) {$(ARP_Protocol),$(NoTitle),$(!REG_VT_SZ),$(ARP_ServerDll)}
  1621.     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  1622.         Goto ARP_Return
  1623.     Endif
  1624.     Set RegistryErrorIndex = NO_ERROR
  1625. ARP_Return = +
  1626.     Ifstr(i) $(ARP_KeyServer) != $(KeyNull)
  1627.         CloseRegKey $(ARP_KeyServer)
  1628.     Endif
  1629.     Ifstr(i) $(ARP_KeyClient) != $(KeyNull)
  1630.         CloseRegKey $(ARP_KeyClient)
  1631.     Endif
  1632.     Ifstr(i) $(ARP_KeyRpc) != $(KeyNull)
  1633.         CloseRegKey $(ARP_KeyRpc)
  1634.     Endif
  1635.     Return  $(RegistryErrorIndex)
  1636. [AddClientRpcProtocol]
  1637.     Set ARP_Protocol = $($0)
  1638.     Set ARP_ClientDll = $($1)
  1639.     read-syms InitBaseVars
  1640.     Set ARP_KeyRpc = $(KeyNull)
  1641.     Set ARP_KeyRpcClient = $(KeyNull)
  1642.     Set RegistryErrorIndex = UNABLE_ACCESS_SOFTWARE_REG
  1643.     OpenRegKey $(!REG_H_LOCAL) "" "SOFTWARE\Microsoft\Rpc" $(MAXIMUM_ALLOWED) ARP_KeyRpc
  1644.     Ifstr(i) $(ARP_KeyRpc) == $(KeyNull)
  1645.        Goto ARP_Return
  1646.     Endif
  1647.     OpenRegKey $(ARP_KeyRpc) "" "ClientProtocols" $(MAXIMUM_ALLOWED) ARP_KeyClient
  1648.     Ifstr(i) $(ARP_KeyClient) == $(KeyNull)
  1649.        Goto ARP_Return
  1650.     Endif
  1651.     SetRegValue $(ARP_KeyClient) {$(ARP_Protocol),$(NoTitle),$(!REG_VT_SZ),$(ARP_ClientDll)}
  1652.     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  1653.         Goto ARP_Return
  1654.     Endif
  1655.     Set RegistryErrorIndex = NO_ERROR
  1656. ARP_Return = +
  1657.     Ifstr(i) $(ARP_KeyClient) != $(KeyNull)
  1658.         CloseRegKey $(ARP_KeyClient)
  1659.     Endif
  1660.     Ifstr(i) $(ARP_KeyRpc) != $(KeyNull)
  1661.         CloseRegKey $(ARP_KeyRpc)
  1662.     Endif
  1663.     Return  $(RegistryErrorIndex)
  1664. [AddServerRpcProtocol]
  1665.     Set ARP_Protocol = $($0)
  1666.     Set ARP_ServerDll = $($1)
  1667.     read-syms InitBaseVars
  1668.     Set ARP_KeyRpc = $(KeyNull)
  1669.     Set ARP_KeyRpcServer = $(KeyNull)
  1670.     Set RegistryErrorIndex = UNABLE_ACCESS_SOFTWARE_REG
  1671.     OpenRegKey $(!REG_H_LOCAL) "" "SOFTWARE\Microsoft\Rpc" $(MAXIMUM_ALLOWED) ARP_KeyRpc
  1672.     Ifstr(i) $(ARP_KeyRpc) == $(KeyNull)
  1673.        Goto ARP_Return
  1674.     Endif
  1675.     OpenRegKey $(ARP_KeyRpc) "" "ServerProtocols" $(MAXIMUM_ALLOWED) ARP_KeyServer
  1676.     Ifstr(i) $(ARP_KeyServer) == $(KeyNull)
  1677.        Goto ARP_Return
  1678.     Endif
  1679.     SetRegValue $(ARP_KeyServer) {$(ARP_Protocol),$(NoTitle),$(!REG_VT_SZ),$(ARP_ServerDll)}
  1680.     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  1681.         Goto ARP_Return
  1682.     Endif
  1683.     Set RegistryErrorIndex = NO_ERROR
  1684. ARP_Return = +
  1685.     Ifstr(i) $(ARP_KeyServer) != $(KeyNull)
  1686.         CloseRegKey $(ARP_KeyServer)
  1687.     Endif
  1688.     Ifstr(i) $(ARP_KeyRpc) != $(KeyNull)
  1689.         CloseRegKey $(ARP_KeyRpc)
  1690.     Endif
  1691.     Return  $(RegistryErrorIndex)
  1692. [AddMixRpcProtocol]
  1693.     set ServiceA = $($0)
  1694.     set ServiceB = $($1)
  1695.     Set ARP_Protocol = $($2)
  1696.     Set ARP_ClientDll = $($3)
  1697.     Set ARP_ServerDll = $($4)
  1698.     read-syms InitBaseVars
  1699.     OpenRegKey $(!REG_H_LOCAL) "" "System\CurrentControlSet\Services\"$(ServiceA) $(MAXIMUM_ALLOWED) KeyServiceA
  1700.     OpenRegKey $(!REG_H_LOCAL) "" "System\CurrentControlSet\Services\"$(ServiceB) $(MAXIMUM_ALLOWED) KeyServiceB
  1701.     ifstr(i) $(KeyServiceA) != $(KeyNull)
  1702.         ifstr(i) $(KeyServiceB) != $(KeyNull)
  1703.             Shell "" AddRpcProtocol $(ARP_Protocol) $(ARP_ClientDll) $(ARP_ServerDll)
  1704.             set ReturnCode = $($R0)
  1705.         endif
  1706.     endif
  1707.     set ReturnCode = NO_ERROR
  1708. return_AddMixRpcProtocl = +
  1709.     return $(ReturnCode)
  1710. [RemoveRpcProtocol]
  1711.     Set RRP_Protocol = $($0)
  1712.     read-syms InitBaseVars
  1713.     Set RRP_KeyRpc = $(KeyNull)
  1714.     Set RRP_KeyRpcServer = $(KeyNull)
  1715.     Set RRP_KeyRpcClient = $(KeyNull)
  1716.     Set RegistryErrorIndex = UNABLE_ACCESS_SOFTWARE_REG
  1717.     OpenRegKey $(!REG_H_LOCAL) "" "SOFTWARE\Microsoft\Rpc" $(MAXIMUM_ALLOWED) RRP_KeyRpc
  1718.     Ifstr(i) $(RRP_KeyRpc) == $(KeyNull)
  1719.        Goto RRP_Return
  1720.     Endif
  1721.     OpenRegKey $(RRP_KeyRpc) "" "ClientProtocols" $(MAXIMUM_ALLOWED) RRP_KeyClient
  1722.     Ifstr(i) $(RRP_KeyClient) == $(KeyNull)
  1723.        Goto RRP_Return
  1724.     Endif
  1725.     OpenRegKey $(RRP_KeyRpc) "" "ServerProtocols" $(MAXIMUM_ALLOWED) RRP_KeyServer
  1726.     Ifstr(i) $(RRP_KeyServer) == $(KeyNull)
  1727.        Goto RRP_Return
  1728.     Endif
  1729.     DeleteRegValue $(RRP_KeyClient) $(RRP_Protocol)
  1730.     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  1731.         Goto RRP_Return
  1732.     Endif
  1733.     DeleteRegValue $(RRP_KeyServer) $(RRP_Protocol)
  1734.     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  1735.         Goto RRP_Return
  1736.     Endif
  1737.     Set RegistryErrorIndex = NO_ERROR
  1738. RRP_Return = +
  1739.     Ifstr(i) $(RRP_KeyServer) != $(KeyNull)
  1740.         CloseRegKey $(RRP_KeyServer)
  1741.     Endif
  1742.     Ifstr(i) $(RRP_KeyClient) != $(KeyNull)
  1743.         CloseRegKey $(RRP_KeyClient)
  1744.     Endif
  1745.     Ifstr(i) $(RRP_KeyRpc) != $(KeyNull)
  1746.         CloseRegKey $(RRP_KeyRpc)
  1747.     Endif
  1748.     Return  $(RegistryErrorIndex)
  1749. [RemoveClientRpcProtocol]
  1750.     Set RRP_Protocol = $($0)
  1751.     read-syms InitBaseVars
  1752.     Set RRP_KeyRpc = $(KeyNull)
  1753.     Set RRP_KeyRpcClient = $(KeyNull)
  1754.     Set RegistryErrorIndex = UNABLE_ACCESS_SOFTWARE_REG
  1755.     OpenRegKey $(!REG_H_LOCAL) "" "SOFTWARE\Microsoft\Rpc" $(MAXIMUM_ALLOWED) RRP_KeyRpc
  1756.     Ifstr(i) $(RRP_KeyRpc) == $(KeyNull)
  1757.        Goto RRP_Return
  1758.     Endif
  1759.     OpenRegKey $(RRP_KeyRpc) "" "ClientProtocols" $(MAXIMUM_ALLOWED) RRP_KeyClient
  1760.     Ifstr(i) $(RRP_KeyClient) == $(KeyNull)
  1761.        Goto RRP_Return
  1762.     Endif
  1763.     DeleteRegValue $(RRP_KeyClient) $(RRP_Protocol)
  1764.     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  1765.         Goto RRP_Return
  1766.     Endif
  1767.     Set RegistryErrorIndex = NO_ERROR
  1768. RRP_Return = +
  1769.     Ifstr(i) $(RRP_KeyClient) != $(KeyNull)
  1770.         CloseRegKey $(RRP_KeyClient)
  1771.     Endif
  1772.     Ifstr(i) $(RRP_KeyRpc) != $(KeyNull)
  1773.         CloseRegKey $(RRP_KeyRpc)
  1774.     Endif
  1775.     Return  $(RegistryErrorIndex)
  1776. [RemoveServerRpcProtocol]
  1777.     Set RRP_Protocol = $($0)
  1778.     read-syms InitBaseVars
  1779.     Set RRP_KeyRpc = $(KeyNull)
  1780.     Set RRP_KeyRpcServer = $(KeyNull)
  1781.     Set RegistryErrorIndex = UNABLE_ACCESS_SOFTWARE_REG
  1782.     OpenRegKey $(!REG_H_LOCAL) "" "SOFTWARE\Microsoft\Rpc" $(MAXIMUM_ALLOWED) RRP_KeyRpc
  1783.     Ifstr(i) $(RRP_KeyRpc) == $(KeyNull)
  1784.        Goto RRP_Return
  1785.     Endif
  1786.     OpenRegKey $(RRP_KeyRpc) "" "ServerProtocols" $(MAXIMUM_ALLOWED) RRP_KeyServer
  1787.     Ifstr(i) $(RRP_KeyServer) == $(KeyNull)
  1788.        Goto RRP_Return
  1789.     Endif
  1790.     DeleteRegValue $(RRP_KeyServer) $(RRP_Protocol)
  1791.     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  1792.         Goto RRP_Return
  1793.     Endif
  1794.     Set RegistryErrorIndex = NO_ERROR
  1795. RRP_Return = +
  1796.     Ifstr(i) $(RRP_KeyServer) != $(KeyNull)
  1797.         CloseRegKey $(RRP_KeyServer)
  1798.     Endif
  1799.     Ifstr(i) $(RRP_KeyRpc) != $(KeyNull)
  1800.         CloseRegKey $(RRP_KeyRpc)
  1801.     Endif
  1802.     Return  $(RegistryErrorIndex)
  1803. [GetInfFileNameFromRegistry]
  1804.     read-syms InitBaseVars
  1805.     set KeyProduct = $($0)
  1806.     set InfName = ""
  1807.     OpenRegKey $(KeyProduct) "" "NetRules" $(!REG_KEY_READ) NetRuleKey
  1808.     Ifstr(i) $(NetRuleKey) != $(KeyNull)
  1809.         GetRegValue $(NetRuleKey) "InfName" NetRuleInfNameList
  1810.         set NetRuleInfName = *($(NetRuleInfNameList), 4)
  1811.         Split-String $(NetRuleInfName), "\", FilenameList
  1812.         QueryListSize ListSize $(FilenameList)
  1813.         set InfName = *($(FilenameList), $(ListSize))
  1814.         CloseRegKey $(NetRuleKey)
  1815.     endif
  1816.     return $(InfName)
  1817. [ToggleBinding]
  1818.     Set SvcName = $($0)
  1819.     Set BindNumber = $($1)
  1820.     Set Action = $($2)
  1821.     Set Status = UNABLE_ACCESS_CONFIGURE_SERVICE
  1822.     Set KeySvc = ""
  1823.     Set KeyFrom = ""
  1824.     Set KeyTo = ""
  1825.     read-syms InitBaseVars
  1826.     OpenRegKey $(!REG_H_LOCAL) "" $(ServicesBaseName)"\"$(SvcName) $(MAXIMUM_ALLOWED) KeySvc
  1827.     Ifstr(i) $(KeySvc) == $(KeyNull)
  1828.         Debug-Output "UTILITY.INF: ToggleBinding: service key open FAILED"
  1829.         Goto TB_Return
  1830.     Endif
  1831.     Ifstr(i) $(Action) == activate
  1832.         Set FromKeyName = "Linkage\Disabled"
  1833.         Set ToKeyName   = "Linkage"
  1834.     Else
  1835.         Set FromKeyName = "Linkage"
  1836.         Set ToKeyName   = "Linkage\Disabled"
  1837.     Endif
  1838.     OpenRegKey $(KeySvc) "" $(FromKeyName) $(MAXIMUM_ALLOWED) KeyFrom
  1839.     Ifstr(i) $(KeyFrom) == $(KeyNull)
  1840.         Debug-Output "UTILITY.INF: ToggleBinding: from linkage key open FAILED"
  1841.         Goto TB_Return
  1842.     Endif
  1843.     OpenRegKey $(KeySvc) "" $(ToKeyName) $(MAXIMUM_ALLOWED) KeyTo
  1844.     Ifstr(i) $(KeyTo) == $(KeyNull)
  1845.         Debug-Output "UTILITY.INF: ToggleBinding: to linkage key open FAILED"
  1846.         Goto TB_Return
  1847.     Endif
  1848.     Set FromBindList   = {}
  1849.     Set FromExportList = {}
  1850.     Set FromRouteList  = {}
  1851.     Set ToBindList     = {}
  1852.     Set ToExportList   = {}
  1853.     Set ToRouteList    = {}
  1854.     Set ErrorTotal     = 0
  1855.     Debug-Output "UTILITY.INF: ToggleBinding; fetch all linkage values"
  1856.     GetRegValue $(KeyFrom),"Bind",TempValue
  1857.     Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
  1858.         Set FromBindList = *($(TempValue),4)
  1859.         Set-add ErrorTotal = $(ErrorTotal),1
  1860.     Endif
  1861.     GetRegValue $(KeyFrom),"Export",TempValue
  1862.     Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
  1863.         Set FromExportList = *($(TempValue),4)
  1864.         Set-add ErrorTotal = $(ErrorTotal),1
  1865.     Endif
  1866.     GetRegValue $(KeyFrom),"Route",TempValue
  1867.     Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
  1868.         Set FromRouteList = *($(TempValue),4)
  1869.         Set-add ErrorTotal = $(ErrorTotal),1
  1870.     Endif
  1871.     GetRegValue $(KeyTo),"Bind",TempValue
  1872.     Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
  1873.         Set ToBindList = *($(TempValue),4)
  1874.         Set-add ErrorTotal = $(ErrorTotal),1
  1875.     Endif
  1876.     GetRegValue $(KeyTo),"Export",TempValue
  1877.     Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
  1878.         Set ToExportList = *($(TempValue),4)
  1879.         Set-add ErrorTotal = $(ErrorTotal),1
  1880.     Endif
  1881.     GetRegValue $(KeyTo),"Route",TempValue
  1882.     Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
  1883.         Set ToRouteList = *($(TempValue),4)
  1884.         Set-add ErrorTotal = $(ErrorTotal),1
  1885.     Endif
  1886.     Ifint $(ErrorTotal) != 6
  1887.         Debug-Output "UTILITY.INF: ToggleBinding; Bind list retreival error, "$(ErrorTotal)
  1888.     Endif
  1889.     Debug-Output "UTILITY.INF: ToggleBinding; sanity check results"
  1890.     QueryListSize sz1 $(FromBindList)
  1891.     QueryListSize sz2 $(FromExportList)
  1892.     QueryListSize sz3 $(FromRouteList)
  1893.     Ifint $(sz1) != $(sz2)
  1894.         Goto TB_Return
  1895.     Endif
  1896.     Ifint $(sz1) != $(sz3)
  1897.         Goto TB_Return
  1898.     Endif
  1899.     QueryListSize sz2 $(ToBindList)
  1900.     QueryListSize sz3 $(ToExportList)
  1901.     QueryListSize sz4 $(ToRouteList)
  1902.     Ifint $(sz2) != $(sz3)
  1903.         Goto TB_Return
  1904.     Endif
  1905.     Ifint $(sz2) != $(sz4)
  1906.         Goto TB_Return
  1907.     Endif
  1908.     Debug-Output "UTILITY.INF: ToggleBinding; prepare to move binding"
  1909.     Ifint $(BindNumber) > $(sz1)
  1910.         Debug-Output "UTILITY.INF: ToggleBinding; binding to move was invalid"
  1911.         Set Status = INVALID_DATA_PASSED
  1912.     Endif
  1913.     Set FromBindItem   = *($(FromBindList),$(BindNumber))
  1914.     Set FromRouteItem  = *($(FromRouteList),$(BindNumber))
  1915.     Set FromExportItem = *($(FromExportList),$(BindNumber))
  1916.     Set ToBindList   = >($(ToBindList),$(FromBindItem))
  1917.     Set ToRouteList  = >($(ToRouteList),$(FromRouteItem))
  1918.     Set ToExportList = >($(ToExportList),$(FromExportItem))
  1919.     Set NewBind   = {}
  1920.     Set NewExport = {}
  1921.     Set NewRoute  = {}
  1922.     Set Index = 0
  1923.     ForListDo $(FromBindList)
  1924.         Set-add Index = $(Index),1
  1925.         Ifint $(Index) != $(BindNumber)
  1926.             Set NewBind   = >($(NewBind),$($))
  1927.             Set NewExport = >($(NewExport),*($(FromExportList),$(Index)))
  1928.             Set NewRoute  = >($(NewRoute),*($(FromRouteList),$(Index)))
  1929.         Endif
  1930.     EndForListDo
  1931.     Set FromBindList   = $(NewBind)
  1932.     Set FromExportList = $(NewExport)
  1933.     Set FromRouteList  = $(NewRoute)
  1934.     Set ErrorTotal = 0
  1935.     SetRegValue $(KeyFrom) {Bind,$(NoTitle),$(!REG_VT_MULTI_SZ),$(FromBindList)}
  1936.     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  1937.         Set-add ErrorTotal = $(ErrorTotal),1
  1938.     Endif
  1939.     SetRegValue $(KeyFrom) {Export,$(NoTitle),$(!REG_VT_MULTI_SZ),$(FromExportList)}
  1940.     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  1941.         Set-add ErrorTotal = $(ErrorTotal),1
  1942.     Endif
  1943.     SetRegValue $(KeyFrom) {Route,$(NoTitle),$(!REG_VT_MULTI_SZ),$(FromRouteList)}
  1944.     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  1945.         Set-add ErrorTotal = $(ErrorTotal),1
  1946.     Endif
  1947.     SetRegValue $(KeyTo) {Bind,$(NoTitle),$(!REG_VT_MULTI_SZ),$(ToBindList)}
  1948.     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  1949.         Set-add ErrorTotal = $(ErrorTotal),1
  1950.     Endif
  1951.     SetRegValue $(KeyTo) {Export,$(NoTitle),$(!REG_VT_MULTI_SZ),$(ToExportList)}
  1952.     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  1953.         Set-add ErrorTotal = $(ErrorTotal),1
  1954.     Endif
  1955.     SetRegValue $(KeyTo) {Route,$(NoTitle),$(!REG_VT_MULTI_SZ),$(ToRouteList)}
  1956.     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  1957.         Set-add ErrorTotal = $(ErrorTotal),1
  1958.     Endif
  1959.     Debug-Output "UTILITY.INF: ToggleBinding; Registry update error total = "$(ErrorTotal)
  1960.     Ifint $(ErrorTotal) != 0
  1961.        Set Status = UNABLE_WRITE_REGISTRY
  1962.     Else
  1963.        Set Status = NO_ERROR
  1964.     Endif
  1965. TB_Return = +
  1966.     Ifstr(i) $(KeyFrom) != $(KeyNull)
  1967.        CloseRegKey $(KeyFrom)
  1968.     Endif
  1969.     Ifstr(i) $(KeyTo) != $(KeyNull)
  1970.        CloseRegKey $(KeyTo)
  1971.     Endif
  1972.     Ifstr(i) $(KeySvc) != $(KeyNull)
  1973.        CloseRegKey $(KeySvc)
  1974.     Endif
  1975.     Return $(Status)
  1976. [SortListIndex]
  1977.     Set List = $($0)
  1978.     Set BoolAscend = $($1)
  1979.     Set BoolCaseSens = $($2)
  1980.     LibraryProcedure IndexList, $(!LIBHANDLE), GenerateSortedIndexList, $(List), $(BoolAscend), $(BoolCaseSens)
  1981.     Return $(IndexList)
  1982. [SortByIndex]
  1983.    Set List = $($0)
  1984.    Set IndexList = $($1)
  1985.    Set NewList = {}
  1986.    ForListDo $(IndexList)
  1987.       Set Index = $($)
  1988.       Set Item = *($(List),$(Index))
  1989.       Set NewList = >($(NewList),$(Item))
  1990.    EndForListDo
  1991.    Return $(NewList)
  1992. [SortList]
  1993.     Set List = $($0)
  1994.     Shell "" SortListIndex $(List) $($1) $($2)
  1995.     Set IndexList = $($R0)
  1996.     Shell "" SortByIndex $(List) $(IndexList)
  1997.     Set ResultList = $($R0)
  1998.     return $(ResultList)
  1999. [DetectionDllFiles]
  2000.     DetectionDllsFound = {} ? $(!LIBHANDLE) FindFileInstances $(!STF_WINDOWSSYSPATH)"\???ncdet.dll"
  2001. [UpdateDetectionDllNames]
  2002.     Set Status = STATUS_FAILED
  2003.     read-syms InitBaseVars
  2004.     Detect DetectionDllFiles
  2005.     Set DllValueName = "NetcardDlls"
  2006.     OpenRegKey $(!REG_H_LOCAL) "" "System\Setup" $(MAXIMUM_ALLOWED) KeySetup
  2007.     Ifstr(i) $(KeySetup) == $(KeyNull)
  2008.         Debug-Output "UTILITY.INF: [UpdateDetectionDllNames] cant open System\Setup key"
  2009.         Goto UDDN_Return
  2010.     Endif
  2011.     Set NewDllList = {"MSNCDET.DLL"}
  2012.     ForListDo $(DetectionDllsFound)
  2013.         Set NewDllList = >($(NewDllList),$($))
  2014.     EndForListDo
  2015.     Set UpdateRequired = 1
  2016.     GetRegValue $(KeySetup) $(DllValueName) DllNamesValue
  2017.     Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
  2018.         Set DllNames = *($(DllNamesValue),4)
  2019.         Debug-Output "UTILITY.INF: [UpdateDetectionDllNames] DllNames = "$(DllNames)
  2020.         Set UpdateRequired = 0
  2021.         ForListDo $(NewDllList)
  2022.             Set DllIndex = ~($(DllNames),$($))
  2023.             Ifint $(DllIndex) == 0
  2024.                 Set UpdateRequired = 1
  2025.             Endif
  2026.         EndForListDo
  2027.     Endif
  2028.     Set Status = STATUS_SUCCESSFUL
  2029.     Ifint $(UpdateRequired) == 1
  2030.         Debug-Output "UTILITY.INF: [UpdateDetectionDllNames] new DLL names = "$(NewDllList)
  2031.         Set ValueInfo = {$(DllValueName), $(NoTitle), $(!REG_VT_MULTI_SZ), $(NewDllList)}
  2032.         SetRegValue $(KeySetup) $(ValueInfo)
  2033.         Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  2034.             Set Status = STATUS_FAILED
  2035.         Else
  2036.             Shell "NCPARAM.INF" Param_ControlDetection DTEND
  2037.             Shell "NCPARAM.INF" Param_ControlDetection DTSTART
  2038.         Endif
  2039.     Else
  2040.         Set Status = STATUS_USERCANCEL
  2041.     Endif
  2042.     CloseRegKey $(KeySetup)
  2043. UDDN_Return = +
  2044.     Return $(Status)
  2045. [CheckIfCopyNecessary]
  2046.     Set Status = STATUS_SUCCESSFUL
  2047.     Set PathList = $($0)
  2048.     Set NamesList = $($1)
  2049.     Set Index = 0
  2050.     Set Found = 1
  2051.     ForListDo $(PathList)
  2052.         Set ThisPath = $($)
  2053.         Set-add Index = Index,1
  2054.         Set NameList = *($(NamesList),$(Index))
  2055.         ForListDo $(NameList)
  2056.             Set FileToCheck = $(ThisPath)\$($)
  2057.             LibraryProcedure FilePresent,$(!LIBHANDLE), CheckFileExistance $(FileToCheck)
  2058.             Ifstr(i) $(FilePresent) != "YES"
  2059.                 Set Found = 0
  2060.             Endif
  2061.         EndForListDo
  2062.     EndForListDo
  2063.     Ifint $(Found) != 1
  2064.         Set Status = STATUS_FAILED
  2065.     Endif
  2066.     Return $(Status)
  2067. [GetBusTypeDialog]
  2068.     set CardName = $($0)
  2069.     set BusInterfaceType = $($1)
  2070.     set BusNumber = $($2)
  2071.     ifstr(i) $(BusInterfaceType) == ""
  2072.         set BusInterfaceType = 1        
  2073.     endif
  2074.     ifstr(i) $(BusNumber) == ""
  2075.         set BusNumber = 0               
  2076.     endif
  2077.     set FLibraryErrCtl = 1
  2078.     LibraryProcedure BusInfo $(!NCPA_HANDLE), GetBusTypeDialog, $(!STF_HWND), $(CardName), $(BusInterfaceType), $(BusNumber)
  2079.     set FLibraryErrCtl = 0
  2080.     ifint *($(BusInfo),1) == 0
  2081.         set ReturnValue = NO_ERROR
  2082.         set BusInterfaceType = *($(BusInfo),2)
  2083.         set BusNumber = *($(BusInfo),3)
  2084.     else
  2085.         set ReturnValue = ERROR
  2086.     endif
  2087.     Return $(ReturnValue), $(BusInterfaceType), $(BusNumber)
  2088. [SetMasterComponent]
  2089.     Read-syms InitBaseVars
  2090.     Set Vendor         = $($0)
  2091.     Set Product        = $($1)
  2092.     Set InfName        = $($2)
  2093.     Set InfOption      = $($3)
  2094.     Set Adding         = 1
  2095.     Ifstr(i) $($4) == REMOVE
  2096.        Set Adding = 0
  2097.     Endif
  2098.     Set Status         = STATUS_FAILED
  2099.     Set Error          = ""
  2100.     Set InfNamesList   = {}
  2101.     Set InfOptionsList = {}
  2102.     Set InfIndex       = 0
  2103.     Set NameListSize   = 0
  2104.     Set OptionListSize = 0
  2105.     Set UpdateRequired = 0
  2106.     Set MasterKey      = ""
  2107.     OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_SoftwareBase)"\"$(Vendor)"\"$(Product)"\CurrentVersion" +
  2108.               $(MAXIMUM_ALLOWED) MasterKey
  2109.     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  2110.         Set Error = CANNOT_FIND_COMPONENT_SERVICE
  2111.         Debug-Output "UTILITY.INF: Cant open master component key: "$(Product)
  2112.         Goto SMC_Return
  2113.     Endif
  2114.     GetRegValue $(MasterKey) DependentInfNames InfNamesValue
  2115.     Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
  2116.         Set InfNamesList = *($(InfNamesValue),4)
  2117.         Set InfIndex = ~($(InfNamesList),$(InfName))
  2118.         QueryListSize NameListSize $(InfNamesList)
  2119.     Endif
  2120.     GetRegValue $(MasterKey) DependentInfOptions InfOptionsValue
  2121.     Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
  2122.         Set InfOptionsList = *($(InfOptionsValue),4)
  2123.         QueryListSize OptionListSize $(InfOptionsList)
  2124.     Endif
  2125.     Ifint $(NameListSize) != $(OptionListSize)
  2126.         Set Error = UNABLE_INSTALL
  2127.         Debug-Output "UTILITY.INF: Dependent INF list degenerate: "$(Product)
  2128.         Goto SMC_Return
  2129.     Endif
  2130.     Ifint $(Adding) == 1
  2131.         Ifint $(InfIndex) == 0
  2132.             Set UpdateRequired = 1
  2133.             Set InfNamesList = >($(InfNamesList),$(InfName))
  2134.             Set InfOptionsList = >($(InfOptionsList),$(InfOption))
  2135.         Endif
  2136.     Else
  2137.         Ifint $(InfIndex) != 0
  2138.             Set UpdateRequired = 1
  2139.             Set TlistNames = {}
  2140.             Set TlistOptions = {}
  2141.             Set Tindex = 0
  2142.             ForListDo $(InfNamesList)
  2143.                 Set-add Tindex = $(Tindex), 1
  2144.                 Ifstr(i) $($) != $(InfName)
  2145.                     Set TlistNames = >($(TlistNames),$($))
  2146.                     Set TlistOptions = >($(TlistOptions),*($(InfOptionsList),$(Tindex)))
  2147.                 Endif
  2148.             EndForListDo
  2149.             Set InfNamesList = TlistNames
  2150.             Set InfOptionsList = TlistOptions
  2151.         Endif
  2152.     Endif
  2153.     Set Status = STATUS_SUCCESSFUL
  2154.     Ifint $(UpdateRequired) == 0
  2155.         Goto SMC_Return
  2156.     Endif
  2157.     SetRegValue $(MasterKey) {DependentInfNames,$(NoTitle),$(!REG_VT_MULTI_SZ),$(InfNamesList)}
  2158.     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  2159.         Debug-Output "UTILITY.INF: master component value update failed (1)"
  2160.         Set Status = UNABLE_WRITE_REGISTRY
  2161.     Endif
  2162.     SetRegValue $(MasterKey) {DependentInfOptions,$(NoTitle),$(!REG_VT_MULTI_SZ),$(InfOptionsList)}
  2163.     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  2164.         Debug-Output "UTILITY.INF: master component value update failed (2)"
  2165.         Set Status = UNABLE_WRITE_REGISTRY
  2166.     Endif
  2167. SMC_Return =+
  2168.     Ifstr(i) $(MasterKey) != $(KeyNull)
  2169.        CloseRegKey $(MasterKey)
  2170.     Endif
  2171.     Return $(Status) $(Error)
  2172. [RemoveDependentComponents]
  2173.     Read-syms InitBaseVars
  2174.     Set Vendor         = $($0)
  2175.     Set Product        = $($1)
  2176.     Set Status         = STATUS_FAILED
  2177.     Set Error          = ""
  2178.     Set InfNamesList   = {}
  2179.     Set InfOptionsList = {}
  2180.     Set InfIndex       = 0
  2181.     Set NameListSize   = 0
  2182.     Set OptionListSize = 0
  2183.     Set UpdateRequired = 0
  2184.     Set MasterKey      = ""
  2185.     OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_SoftwareBase)"\"$(Vendor)"\"$(Product)"\CurrentVersion" +
  2186.               $(MAXIMUM_ALLOWED) MasterKey
  2187.     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  2188.         Debug-Output "UTILITY.INF: Cant open master component key: "$(Product)
  2189.         Set Error = CANNOT_FIND_COMPONENT_SERVICE
  2190.         Goto RDC_Return
  2191.     Endif
  2192.     GetRegValue $(MasterKey) DependentInfNames InfNamesValue
  2193.     Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
  2194.         Set InfNamesList = *($(InfNamesValue),4)
  2195.         Set InfIndex = ~($(InfNamesList),$(InfName))
  2196.         QueryListSize NameListSize $(InfNamesList)
  2197.     Endif
  2198.     GetRegValue $(MasterKey) DependentInfOptions InfOptionsValue
  2199.     Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
  2200.         Set InfOptionsList = *($(InfOptionsValue),4)
  2201.         QueryListSize OptionListSize $(InfOptionsList)
  2202.     Endif
  2203.     Ifint $(NameListSize) != $(OptionListSize)
  2204.         Set Error = UNABLE_INSTALL
  2205.         Debug-Output "UTILITY.INF: Dependent INF list degenerate: "$(Product)
  2206.         Goto RDC_Return
  2207.     Endif
  2208.     Ifint $(NameListSize) == 0
  2209.         Set Status = STATUS_SUCCESSFUL
  2210.         Goto RDC_Return
  2211.     Endif
  2212.     Set OldOption = $(!NTN_InfOption)
  2213.     Set OldMode   = $(!NTN_InstallMode)
  2214.     Set OldInf    = $(!NTN_Infname)
  2215.     Set !NTN_InstallMode = deinstall
  2216.     Set Tindex = 0
  2217.     ForListDo $(InfNamesList)
  2218.         Set-add Tindex = $(Tindex), 1
  2219.         Set !NTN_InfOption = *($(InfOptionsList),$(Tindex))
  2220.         Set !NTN_Infname = $($)
  2221.         Debug-Output "UTILITY.INF: Removing "$(Product)" dependent: "$(InfName)":"$(InfOption)
  2222.         Shell $(!NTN_Infname) InstallOption $(!STF_LANGUAGE) $(!NTN_InfOption) $(!STF_SRCDIR) +
  2223.               $(!NtLmAddCopy) $(!NtLmDoCopy) $(!NtLmDoConfig)
  2224.     EndForListDo
  2225.     Set !NTN_InfOption   = $(OldOption)
  2226.     Set !NTN_InstallMode = $(OldMode)
  2227.     Set !NTN_Infname     = $(OldInf)
  2228.     Set Status = STATUS_SUCCESSFUL
  2229. RDC_Return =+
  2230.     Ifstr(i) $(MasterKey) != $(KeyNull)
  2231.        CloseRegKey $(MasterKey)
  2232.     Endif
  2233.     return $(Status) $(Error)
  2234. [AddDefaultNetCardParameters]
  2235.     set KeyParameter = $($0)
  2236.     ForListDo $(!NetCardParameterName)
  2237.         set Name = $($)
  2238.         set Value = *($(!NetCardParameterValue), $(#))
  2239.         ifstr(i) $(Name) == "NetworkAddress"
  2240.             set Type = $(!REG_VT_SZ)
  2241.         else
  2242.             set Type = $(!REG_VT_DWORD)
  2243.         endif
  2244.  Debug-Output "Name = "$(Name)
  2245.  Debug-Output "Value = "$(Value)
  2246.         SetRegValue $(KeyParameter) {$(Name),$(NoTitle),$(Type),$(Value)}
  2247.     EndForListDo
  2248.     return
  2249. [AFDVars]
  2250. ProductAFDTitle         = "AFD Networking Support Environment"
  2251. ProductAFDName          = "Afd"
  2252. ProductAFDImagePath     = "\SystemRoot\System32\drivers\afd.sys"
  2253. ProductAFDSvcType       = "kernelautostart"
  2254. [RegistryErrorsENG]
  2255. UNABLE_ACCESS_SOFTWARE_REG,"レジストリの SOFTWARE サブツリーにアクセスできません。"
  2256. UNABLE_CREATE_MANUFACTURER_KEY,"レジストリに Manufacturer キーを作成できません。"
  2257. UNABLE_OPEN_MICROSOFT_KEY,"レジストリに Microsoft サブキーを開くことができません。"
  2258. UNABLE_CREATE_PRODUCT_KEY,"Windows NT のレジストリにサブキーを作成できません。"
  2259. UNABLE_CREATE_PRODUCT_VERSION,"Windows NT のレジストリにバージョン サブキーを作成できません。"
  2260. UNABLE_CREATE_NETRULES_KEY,"レジストリに NetRules サブキーを作成できません。"
  2261. UNABLE_OPEN_HARDWARE_SECTION,"レジストリの HARDWARE サブキーを開くことができません。"
  2262. UNABLE_OPEN_NETWORKCARD_SECTION,"レジストリの NetworkCards サブキーを開くことができません。"
  2263. UNABLE_OPEN_EVENTLOG_SUBKEY,"レジストリの Eventlog サブキーを開くことができません。"
  2264. UNABLE_CREATE_NETCARD_CONFIGURATION,"レジストリにネットワーク アダプタのエントリを作成できません。"
  2265. UNABLE_ACCESS_CONFIGURE_SERVICE,"レジストリの Services サブキーにアクセスできません。"
  2266. UNABLE_CREATE_CONFIGURE_SERVICE,"レジストリに Services サブキーを作成できません。"
  2267. UNABLE_CREATE_SERVICE_SUBKEY,"レジストリに Services サブキーを作成できません。"
  2268. INVALID_DATA_PASSED,"レジストリ ユーティリティのルーチンに無効なデータが渡されました。"
  2269. SERVICE_ALREADY_EXISTS,"レジストリの Services サブキーはすでに存在しています。"
  2270. OPERATION_UNIMPLEMENTED,"レジストリの操作を実行できません。"
  2271. CANNOT_FIND_COMPONENT_SERVICE,"コンポーネント サービスの名前が見つからないか、存在しません。"
  2272. CANNOT_CONFIGURE_HARDWARE,"ハードウェア コンポーネントを構成できません。"
  2273. CANNOT_CONFIGURE_SOFTWARE,"ソフトウェア コンポーネントを構成できません。"
  2274. UNABLE_WRITE_REGISTRY, "レジストリに書き込めません。"
  2275. UNABLE_INSTALL, "組み込みエラー"
  2276. PROVIDER_ALREADY_EXISTED, "プロバイダはすでにレジストリに存在しています。"
  2277. PROVIDER_ORDER_DOES_NOT_EXIST, "プロバイダのオーダーがレジストリに存在しません。"
  2278. TCPIP_NONEXIST_ERROR, "SNMP を組み込む前に Microsoft TCP/IP を組み込んでください。"
  2279. TCPIP_NONEXIST_ERROR_FTPD, "FTP サーバーを組み込む前に Microsoft TCP/IP を組み込んでください。"
  2280. NO_BINDING_INFO, "バインド情報がありません。[バインド]ボタンをクリックしてください。"
  2281. CANNOT_OPEN_EVENTLOG_KEY, "レジストリの Eventlog サブキーを開くことができません。"
  2282. CANNOT_CREATE_SNMPPROXYKEY, "レジストリに SNMP Proxy サブキーを作成することができません。"
  2283. REF_COUNT_NOT_ZERO, "ソフトウェア ドライバを削除する前に、関連するネットワーク アダプタ カードを削除してください。"
  2284. UNABLE_REMOVE_CONFIGURE_SERVICE,"レジストリのソフトウェア ドライバの Services サブキーを削除することができません。"
  2285. UNABLE_ACCESS_WINSOCK_MAP_INFO,"DLL の WinSock マッピング情報にアクセスできません。"
  2286. VERIFY_WARNING,"現在使用されているネットワーク カードのパラメータが正しくありません。使用上の問題やシステム障害の原因となる可能性があります。これらのパラメータを使用しますか?"
  2287. CANNOT_DETECT,"セットアップは、関連するネットワーク アダプタの DLL ファイルからネットワーク アダプタの情報を取得できません。操作を続行できません。"
  2288. UNABLE_COPY_FILE,"ファイルのコピーに失敗しました。"
  2289. ASK_SOURCE_FAIL,"コピー元のファイルが見つかりませんでした。"
  2290. SETUP_FAIL,"セットアップに失敗しました。"
  2291. SERVICE_MARKED_FOR_DELETE,"このネットワーク コンポーネントは削除されています。コンピュータを再起動してから再度組み込んでください。"
  2292. REBOOT_MACHINE_BEFORE_ADD_ADAPTER,"このネットワーク コンポーネントは削除されています。コンピュータを再起動してから再度組み込んでください。"
  2293. CANT_REMOVE_WKSTA_NTAS,"Windows NT ドメイン コントローラからこのワークステーションを削除できません。"
  2294. CANT_REMOVE_SERVER_NTAS,"Windows NT ドメイン コントローラからこのサーバーを削除できません。"
  2295. NO_ERROR, ""
  2296. DLC_NONEXIST_ERROR, "Remoteboot を組み込む前に、Microsoft DLC を組み込んでください。"
  2297. NBF_NONEXIST_ERROR, "Remoteboot を組み込む前に、 NetBEUI プロトコルを組み込んでください。"
  2298. [RegistryErrorUnknownENG]
  2299. Error_Bogus = "不明なレジストリの障害"
  2300. [VerExistedENG]
  2301. ver = " ver "
  2302. Text = " は、すでにシステムに存在します。ソフトウェアを更新するには、[更新]ボタンをクリックしてください。"
  2303. [CardExistedENG]
  2304. Text = "この種類のネットワーク カードはすでにシステムに組み込まれています。組み込みを続行しますか?"
  2305. [ProgressCopyENG]
  2306.     ProCaption   = "Windows NT ネットワーク セットアップ"
  2307.     ProCancel    = "キャンセル"
  2308.     ProCancelMsg = "Windows NT ネットワークは正しく組み込まれていません。"+
  2309.                    "ファイルのコピーを中止しますか?"
  2310.     ProCancelCap = "セットアップ メッセージ"
  2311.     ProText1     = "コピー元:"
  2312.     ProText2     = "コピー先:"
  2313.     Error        = "適切なコピー元のディスクが見つかりません。コピーできません。"
  2314.