Annotation of ntddk/src/setup/inf/ndis/utility.inf, revision 1.1

1.1     ! root        1: ;*************************************************************************
        !             2: ;
        !             3: ;       UTILITY.INF
        !             4: ;
        !             5: ;   Network Installation utility functions.  Each major piece of
        !             6: ;   functionality is coded as a [Section], and is invoked by name from
        !             7: ;   the outer level INF.  See TEMPLATE.INF for example usage.
        !             8: ;
        !             9: ;  CHANGES:
        !            10: ;               DavidHov   6/11/92   Added Service"Linkage" key return
        !            11: ;                                    value to [AddSoftwareComponent]
        !            12: ;
        !            13: ;               DavidHov   8/24/92   Add WinSock support routines for
        !            14: ;                                    transports
        !            15: ;
        !            16: ;
        !            17: ;
        !            18: ;*************************************************************************
        !            19: 
        !            20: ;
        !            21: ;--------------------------------------------------------------------------
        !            22: ;  Header to be used at the front of all externally available INF sections.
        !            23: ;--------------------------------------------------------------------------
        !            24: ;
        !            25: ;*************************************************************************
        !            26: ;
        !            27: ;     SECTION:   sectionname
        !            28: ;
        !            29: ;     PURPOSE:   <describe purpose of section>
        !            30: ;
        !            31: ;   ARGUMENTS:   $0
        !            32: ;                $1
        !            33: ;
        !            34: ;     RETURNS:   $R0
        !            35: ;                $R1
        !            36: ;
        !            37: ;  REFERENCES:   <list of global or parent variables referenced>
        !            38: ;
        !            39: ;    MODIFIES:   <list of global or parent variables modified>
        !            40: ;
        !            41: ;
        !            42: ;*************************************************************************
        !            43: ;*************************************************************************
        !            44: ;  end of section sectionname
        !            45: ;*************************************************************************
        !            46: 
        !            47: ;
        !            48: ;  Initialize general constants
        !            49: ;
        !            50: [InitBaseVars]
        !            51: 
        !            52: KeyNull            = ""
        !            53: MAXIMUM_ALLOWED    = 33554432
        !            54: KeyInfo            = {}
        !            55: RegistryErrorIndex = NO_ERROR
        !            56: NoTitle            = 0
        !            57: 
        !            58: CurrentControlSet  = "SYSTEM\CurrentControlSet"
        !            59: ServicesBaseName   = $(CurrentControlSet)"\Services"
        !            60: NetworkCardKeyName = $(!NTN_SoftwareBase)"\Microsoft\Windows NT\CurrentVersion\NetworkCards"
        !            61: 
        !            62: !RegLastError      = NO_ERROR
        !            63: 
        !            64: [RegistryErrorSetup]
        !            65: RegistryErrorIndex = ^(RegistryErrors$(!STF_LANGUAGE),1)
        !            66: RegistryErrorList = ^(RegistryErrors$(!STF_LANGUAGE),2)
        !            67: 
        !            68: ;*************************************************************************
        !            69: ;
        !            70: ;     SECTION:   RegistryErrorString
        !            71: ;
        !            72: ;     PURPOSE:   Translate a numeric registry error code into a string
        !            73: ;
        !            74: ;   ARGUMENTS:   $0     Registry error code
        !            75: ;
        !            76: ;     RETURNS:   $R0    String containing displayable text in language
        !            77: ;
        !            78: ;  REFERENCES:   !STF_LANGUAGE  -- global "user's language"  variable;
        !            79: ;                               see [RegistryErrorSetup]
        !            80: ;
        !            81: ;    MODIFIES:   Nothing
        !            82: ;
        !            83: ;
        !            84: ;*************************************************************************
        !            85: [RegistryErrorString]
        !            86: 
        !            87:      read-syms RegistryErrorSetup
        !            88:      read-syms RegistryErrorUnknown$(!STF_LANGUAGE)
        !            89: 
        !            90:      set RE_String = *($(RegistryErrorList),~($(RegistryErrorIndex),$($0)))
        !            91: 
        !            92:      Ifstr $(RE_String) == ""
        !            93:         set RE_String = $(Error_Bogus)
        !            94:      endif
        !            95: 
        !            96:      return $(RE_String)
        !            97: 
        !            98: ;*************************************************************************
        !            99: ;  end of section RegistryErrorString
        !           100: ;*************************************************************************
        !           101: 
        !           102: ;*************************************************************************
        !           103: ;
        !           104: ;     SECTION:   BaseServiceKey
        !           105: ;
        !           106: ;     PURPOSE:   Return an open key handle to the top of the services tree
        !           107: ;
        !           108: ;   ARGUMENTS:   none
        !           109: ;
        !           110: ;     RETURNS:   $R0    Registry error code
        !           111: ;                $R1    Registry key variable for SERVICES0
        !           112: ;
        !           113: ;  REFERENCES:   Nothing
        !           114: ;
        !           115: ;    MODIFIES:   Nothing
        !           116: ;
        !           117: ;*************************************************************************
        !           118: [BaseServiceKey]
        !           119:     read-syms InitBaseVars
        !           120:     set BS_KeyServices = ""
        !           121: 
        !           122:     OpenRegKey $(!REG_H_LOCAL) "" $(ServicesBaseName) $(MAXIMUM_ALLOWED) BS_KeyServices
        !           123: 
        !           124:     Ifstr $(BS_KeyServices) == $(KeyNull)
        !           125:        Debug-Output "UTILITY.INF: could not open Services base key"
        !           126:        set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
        !           127:     endif
        !           128: 
        !           129: B_S_Return = +
        !           130:     return $(RegistryErrorIndex), $(BS_KeyServices)
        !           131: 
        !           132: ;*************************************************************************
        !           133: ;
        !           134: ;     SECTION:   ReduceInfPath
        !           135: ;
        !           136: ;     PURPOSE:   Process the path\name string to an INF file.  If
        !           137: ;                its path points to STF_WINDOWSSYSPATH, remove the path prefix.
        !           138: ;
        !           139: ;   ARGUMENTS:   $0     Path\name to INF file
        !           140: ;
        !           141: ;     RETURNS:   $R0    Resulting string
        !           142: ;
        !           143: ;  REFERENCES:   Nothing
        !           144: ;
        !           145: ;    MODIFIES:   Nothing
        !           146: ;
        !           147: ;*************************************************************************
        !           148: [ReduceInfPath]
        !           149:     Set RIP_Result = $($0)
        !           150: 
        !           151:     Split-String $(RIP_Result) "\" InList
        !           152:     Set BasePath = $(!STF_WINDOWSSYSPATH)"\"
        !           153:     Split-String $(BasePath) "\" BaseList
        !           154: 
        !           155:     ;
        !           156:     ;   See how many of the path elements match
        !           157:     ;
        !           158: 
        !           159:     Set Indx = 0
        !           160:     Set Matched = 0
        !           161:     QueryListSize InListSize, $(InList)
        !           162:     ForListDo $(BaseList)
        !           163:         Set-add Indx = $(Indx),1
        !           164:         Ifint $(Indx) <= $(InListSize)
        !           165:             Set Instr = *($(InList),$(Indx))
        !           166:             Ifstr(i) $($) == $(Instr)
        !           167:                 Set-add Matched = $(Matched),1
        !           168:             Endif
        !           169:         Endif
        !           170:     EndForListDo
        !           171: 
        !           172:     ;
        !           173:     ;   If all the path elements of the input path matched
        !           174:     ;   those of STF_WINDOWSSYSPATH, strip them off of the result.
        !           175:     ;
        !           176: 
        !           177:     Ifint $(Indx) == $(Matched)
        !           178:         Set RIP_Result = ""
        !           179:         Set Indx2 = 0
        !           180:         ForListDo $(InList)
        !           181:             Set-add Indx2 = $(Indx2),1
        !           182:             Ifint $(Indx2) > $(Indx)
        !           183:                 Set RIP_Result = $(RIP_Result)$($)
        !           184:             Endif
        !           185:         EndForListDo
        !           186:     Endif
        !           187: 
        !           188:     Return $(RIP_Result)
        !           189: 
        !           190: ;*************************************************************************
        !           191: ;
        !           192: ;     SECTION:  InstallSoftwareProduct
        !           193: ;
        !           194: ;     PURPOSE:  Add a new component into the Registry
        !           195: ;
        !           196: ;   ARGUMENTS:  $0   name of Manufacturer
        !           197: ;               $1   name of Product
        !           198: ;               $2   full INF path and name
        !           199: ;
        !           200: ;    RETURNS:   $R0  error code or zero if no error
        !           201: ;               $R1  Registry key variable for
        !           202: ;                      SOFTWARE\Manufacturer\Product\Version key
        !           203: ;               $R2  Registry key variable for
        !           204: ;                      ...\NetRules
        !           205: ;
        !           206: ;  REFERENCES:  none
        !           207: ;
        !           208: ;    MODIFIES:  none
        !           209: ;
        !           210: ;*************************************************************************
        !           211: 
        !           212: [InstallSoftwareProduct]
        !           213:     read-syms InitBaseVars
        !           214: 
        !           215:     set IS_MfgName  = $($0)
        !           216:     set IS_ProdName = $($1)
        !           217:     set IS_Infname  = $($2)
        !           218:     set IS_KeySoftware = ""
        !           219:     set IS_KeyMfg = ""
        !           220:     set IS_KeyProduct = ""
        !           221:     set IS_KeyVersion = ""
        !           222:     set IS_KeyNetRules = ""
        !           223:     set IS_MfgCreated = 1
        !           224:     set IS_ProductCreated = 1
        !           225: ;
        !           226: ;   Validate the arguments passed in
        !           227: ;
        !           228:     set RegistryErrorIndex = INVALID_DATA_PASSED
        !           229: 
        !           230:     Ifstr(i) $(IS_MfgName) == ""
        !           231:        goto I_S_Return
        !           232:     endif
        !           233:     Ifstr(i) $(IS_ProdName) == ""
        !           234:        goto I_S_Return
        !           235:     endif
        !           236: 
        !           237:     set RegistryErrorIndex = NO_ERROR
        !           238: ;
        !           239: ;   Open the HKEY_LOCAL_MACHINE\SOFTWARE key
        !           240: ;
        !           241:     OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_SoftwareBase) $(MAXIMUM_ALLOWED) IS_KeySoftware
        !           242: 
        !           243:     Ifstr $(IS_KeySoftware) == $(KeyNull)
        !           244:        set RegistryErrorIndex = UNABLE_ACCESS_SOFTWARE_REG
        !           245:        goto I_S_Return
        !           246:     endif
        !           247: ;
        !           248: ;   Create the Manufacturer's key if necessary
        !           249: ;
        !           250:     CreateRegKey $(IS_KeySoftware) {$(IS_MfgName),$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" IS_KeyMfg
        !           251:     Ifstr $(IS_KeyMfg) == $(KeyNull)
        !           252:        set IS_MfgCreated = 0
        !           253:        OpenRegKey $(IS_KeySoftware) "" $(IS_MfgName) $(MAXIMUM_ALLOWED) IS_KeyMfg
        !           254:        Ifstr $(IS_KeyMfg) == $(KeyNull)
        !           255:           set RegistryErrorIndex = UNABLE_OPEN_MICROSOFT_KEY
        !           256:           goto I_S_Return
        !           257:        endif
        !           258:     endif
        !           259: ;
        !           260: ;   Create the Software Product key if necessary
        !           261: ;
        !           262:     CreateRegKey $(IS_KeyMfg) {$(IS_ProdName),$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" IS_KeyProduct
        !           263:     Ifstr $(IS_KeyProduct) == $(KeyNull)
        !           264:        set IS_ProductCreated = 0
        !           265:        OpenRegKey $(IS_KeyMfg) "" $(IS_ProdName) $(MAXIMUM_ALLOWED) IS_KeyProduct
        !           266:        Ifstr $(IS_KeyProduct) == $(KeyNull)
        !           267:           set RegistryErrorIndex = UNABLE_CREATE_PRODUCT_KEY
        !           268:           goto I_S_Return
        !           269:        endif
        !           270:     endif
        !           271: ;
        !           272: ;   Create the software product version key.
        !           273: ;
        !           274:     CreateRegKey $(IS_KeyProduct) {"CurrentVersion",$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" IS_KeyVersion
        !           275:     Ifstr $(IS_KeyVersion) == $(KeyNull)
        !           276:        OpenRegKey $(IS_KeyProduct) "" "CurrentVersion" $(MAXIMUM_ALLOWED) IS_KeyVersion
        !           277:        Ifstr $(IS_KeyVersion) == $(KeyNull)
        !           278:           set RegistryErrorIndex = UNABLE_CREATE_PRODUCT_VERSION
        !           279:           goto I_S_Return
        !           280:        endif
        !           281:     endif
        !           282: 
        !           283:     set RegistryErrorIndex = NO_ERROR
        !           284: ;
        !           285: ;   Create the NetRules key
        !           286: ;
        !           287:     CreateRegKey $(IS_KeyVersion) {NetRules,$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" IS_KeyNetRules
        !           288:     Ifstr $(IS_KeyNetRules) == $(KeyNull)
        !           289:        OpenRegKey $(IS_KeyVersion) "" NetRules $(MAXIMUM_ALLOWED) IS_KeyNetRules
        !           290:        Ifstr $(IS_KeyNetRules) == $(KeyNull)
        !           291:           set RegistryErrorIndex = UNABLE_CREATE_NETRULES_KEY
        !           292:           goto I_S_Return
        !           293:        endif
        !           294:     endif
        !           295: ;
        !           296: ;   Set the "Infname" value if non-null; reduce it if it's in %SystemRoot%
        !           297: ;
        !           298:     Ifstr $(IS_Infname) != ""
        !           299:        Shell "", ReduceInfPath, $(IS_Infname)
        !           300:        SetRegValue $(IS_KeyNetRules) {InfName,$(NoTitle),$(!REG_VT_SZ),$($R0)}
        !           301:     endif
        !           302: 
        !           303: ;
        !           304: ;  Exit, leaving $(IS_KeyVersion) and $(IS_KeyNetRules) open for the caller...
        !           305: ;
        !           306: I_S_Return = +
        !           307:     Ifstr $(IS_KeyProduct) != ""
        !           308:         Ifint $(IS_ProductCreated) == 1
        !           309:            Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        !           310:               Debug-Output "UTILITY.INF: DeleteRegTree Product Key"
        !           311:               ;DeleteRegTree $(IS_KeyProduct) ""
        !           312:               set IS_KeyProduct = ""
        !           313:            endif
        !           314:         endif
        !           315:         Ifstr $(IS_KeyProduct) != ""
        !           316:            CloseRegKey $(IS_KeyProduct)
        !           317:         endif
        !           318:     endif
        !           319:     Ifstr $(IS_KeyMfg) != ""
        !           320:         Ifint $(IS_MfgCreated) == 1
        !           321:            Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        !           322:               ;DeleteRegTree $(IS_KeyMfg) ""
        !           323:               Debug-Output "UTILITY.INF: DeleteRegTree Manufacturer Key"
        !           324:               set IS_KeyMfg = ""
        !           325:            endif
        !           326:         endif
        !           327:         Ifstr $(IS_KeyMfg) != ""
        !           328:            CloseRegKey $(IS_KeyMfg)
        !           329:         endif
        !           330:     endif
        !           331:     Ifstr $(IS_KeySoftware) != ""
        !           332:         CloseRegKey $(IS_KeySoftware)
        !           333:     endif
        !           334:     return $(RegistryErrorIndex), $(IS_KeyVersion), $(IS_KeyNetRules)
        !           335: 
        !           336: ;*************************************************************************
        !           337: ;  end of section InstallSoftwareProduct
        !           338: ;*************************************************************************
        !           339: 
        !           340: ;*************************************************************************
        !           341: ;
        !           342: ;     SECTION:   AddValueList
        !           343: ;
        !           344: ;     PURPOSE:   Given a nested list of value items, add each to the given
        !           345: ;                key.   Key is left open.
        !           346: ;
        !           347: ;   ARGUMENTS:   $0    Registry key handle
        !           348: ;                $1    List of value items; for example:
        !           349: ;                          { {ValueName1,0,$(!REG_VT_SZ),$(ValueData1)}, +
        !           350: ;                            {ValueName2,0,$(!REG_VT_SZ),$(ValueData2)} }
        !           351: ;
        !           352: ;     RETURNS:   $R0   Registry error code.
        !           353: ;
        !           354: ;
        !           355: ;  REFERENCES:   Nothing
        !           356: ;
        !           357: ;    MODIFIES:   Nothing
        !           358: ;
        !           359: ;*************************************************************************
        !           360: [AddValueList]
        !           361:    set RegistryErrorIndex = NO_ERROR
        !           362: 
        !           363:    ForListDo $($1)
        !           364:        SetRegValue $($0) $($)
        !           365:        ifint $(RegLastError) != 0
        !           366:           Debug-Output "UTILITY.INF: Value write fail data: "$($)
        !           367:           Debug-Output "UTILITY.INF: Value write fail key: "$($0)
        !           368:           return UNABLE_WRITE_REGISTRY
        !           369:        endif
        !           370:    EndForListDo
        !           371: 
        !           372:    return $(RegistryErrorIndex)
        !           373: 
        !           374: ;*************************************************************************
        !           375: ;  end of section AddValueList
        !           376: ;*************************************************************************
        !           377: 
        !           378: ;*************************************************************************
        !           379: ;
        !           380: ;     SECTION:   DeleteSoftwareProduct
        !           381: ;
        !           382: ;     PURPOSE:   Delete the given product from the Registry entirely
        !           383: ;
        !           384: ;   ARGUMENTS:   $0     Product Key Handle
        !           385: ;
        !           386: ;     RETURNS:   $R0    Registry error code
        !           387: ;                $R1
        !           388: ;
        !           389: ;  REFERENCES:   Nothing
        !           390: ;
        !           391: ;    MODIFIES:   Nothing
        !           392: ;
        !           393: ;*************************************************************************
        !           394: [DeleteSoftwareProduct]
        !           395: 
        !           396:    set RegistryErrorIndex = NO_ERROR
        !           397: 
        !           398:    Debug-Output "UTILITY.INF: DeleteRegTree Software Product"
        !           399:    DeleteRegTree $($0) ""
        !           400: 
        !           401:    return $(RegistryErrorIndex)
        !           402: 
        !           403: ;*************************************************************************
        !           404: ;  end of section DeleteSoftwareProduct
        !           405: ;*************************************************************************
        !           406: 
        !           407: ;*************************************************************************
        !           408: ;
        !           409: ;     SECTION:   VerExistedDlg
        !           410: ;
        !           411: ;     PURPOSE:   Popup a dialog and tell the user that the same ver of
        !           412: ;                the software already exists in the registery tree.
        !           413: ;                Ask the user whether he want to continue or not
        !           414: ;
        !           415: ;   ARGUMENTS:   $0     Product Name
        !           416: ;                $0     Product version
        !           417: ;
        !           418: ;     RETURNS:   $R0    Registry error code
        !           419: ;                $R1    either "continue" or "exit"
        !           420: ;
        !           421: ;  REFERENCES:   Nothing
        !           422: ;
        !           423: ;    MODIFIES:   Nothing
        !           424: ;
        !           425: ;*************************************************************************
        !           426: 
        !           427: [VerExistedDlg]
        !           428: 
        !           429:    set RegistryErrorIndex = NO_ERROR
        !           430: 
        !           431:    set-subst LF = "\n"
        !           432:    read-syms VerExisted$(!STF_LANGUAGE)
        !           433: 
        !           434:    set DlgText = $($0)+
        !           435:              $(ver)+
        !           436:              $($1)+
        !           437:              $(Text)
        !           438:    Shell "Subroutn.Inf" SetupMessage $(!STF_LANGUAGE) "NONFATAL" $(DlgText)
        !           439: 
        !           440:    ifint $($ShellCode) != $(!SHELL_CODE_OK)
        !           441:         set RegistryErrorIndex = ERROR
        !           442:    endif
        !           443: 
        !           444:    return $(RegistryErrorIndex), $($R1)
        !           445: 
        !           446: ;*************************************************************************
        !           447: ;  end of section VerExistedDialog
        !           448: ;*************************************************************************
        !           449: 
        !           450: ;*************************************************************************
        !           451: ;
        !           452: ;     SECTION:   CardExistedDlg
        !           453: ;
        !           454: ;     PURPOSE:   Popup a dialog and tell the user that the network card
        !           455: ;                is lready installed and ask them whether theyr want to
        !           456: ;                continue.
        !           457: ;
        !           458: ;   ARGUMENTS:   NONE
        !           459: ;
        !           460: ;     RETURNS:   $R0    Registry error code
        !           461: ;                $R1    either "continue" or "exit"
        !           462: ;
        !           463: ;  REFERENCES:   Nothing
        !           464: ;
        !           465: ;    MODIFIES:   Nothing
        !           466: ;
        !           467: ;*************************************************************************
        !           468: 
        !           469: [CardExistedDlg]
        !           470: 
        !           471:    set RegistryErrorIndex = NO_ERROR
        !           472: 
        !           473:    set-subst LF = "\n"
        !           474:    read-syms CardExisted$(!STF_LANGUAGE)
        !           475: 
        !           476:    set DlgText = $(Text)
        !           477: 
        !           478:    Shell "Subroutn.Inf" SetupMessage $(!STF_LANGUAGE) "WARNING" $(DlgText)
        !           479: 
        !           480:    ifint $($ShellCode) != $(!SHELL_CODE_OK)
        !           481:         set RegistryErrorIndex = ERROR
        !           482:    endif
        !           483: 
        !           484:    return $(RegistryErrorIndex), $($R1)
        !           485: 
        !           486: ;*************************************************************************
        !           487: ;  end of section CardExistedDialog
        !           488: ;*************************************************************************
        !           489: 
        !           490: ;*************************************************************************
        !           491: ;
        !           492: ;     SECTION:   CreateService
        !           493: ;
        !           494: ;     PURPOSE:   Create the Services area entry for a new product
        !           495: ;
        !           496: ;   ARGUMENTS:   $0     Name of the service (no imbedded blanks, etc.)
        !           497: ;                $1     Display Name of service
        !           498: ;                $2     image path string
        !           499: ;                $3     type of service:
        !           500: ;                               system
        !           501: ;                               adapter
        !           502: ;                               driver
        !           503: ;                               transport
        !           504: ;                               service
        !           505: ;                               serviceshare
        !           506: ;                $4     group, if any or ""
        !           507: ;                $5     dependency **list**, if any or {}
        !           508: ;                $6     ObjectName, usually ""
        !           509: ;                $7     EventMessageFile [Optional]
        !           510: ;                $8     TypeSupported    [Optional]
        !           511: ;                $9     EventLog Location[Optional]
        !           512: ;                $10    Error control value [Optional]
        !           513: ;                $11    Event Source name [Optional]
        !           514: ;
        !           515: ;
        !           516: ;     RETURNS:   $R0    Registry error code
        !           517: ;                $R1    Service area key handle
        !           518: ;                $R2    Parameters key handle
        !           519: ;                $R3    Linkage key handle
        !           520: ;
        !           521: ;  REFERENCES:   <list of global or parent variables referenced>
        !           522: ;
        !           523: ;    MODIFIES:   <list of global or parent variables modified>
        !           524: ;
        !           525: ;       NOTES:   If $(!NTN_ScUseRegistry) is != "", then direct Registry
        !           526: ;                access is used in lieu of the Service Controller API
        !           527: ;                wrapper.  The Registry is automatically used if the
        !           528: ;                service type is "adapter".
        !           529: ;
        !           530: ;                The image path format varies for drivers and other
        !           531: ;                services.  For drivers of any kind, it's an NT name space
        !           532: ;                name.  For services, it's a REG_EXPAND_SZ format Win32 name.
        !           533: ;
        !           534: ;
        !           535: ;     CHANGES:   DavidHov:  6/11/92.  "Groups" is REG_SZ, not REG_EXPAND_SZ
        !           536: ;                           Adapters are type=4, start=4.
        !           537: ;                           Only services get "ObjectName" value
        !           538: ;
        !           539: ;
        !           540: ;
        !           541: ;
        !           542: ;*************************************************************************
        !           543: [CreateService]
        !           544:     read-syms InitBaseVars
        !           545: 
        !           546:     set CS_NameOfService = $($0)
        !           547:     set CS_DisplayName   = $($1)
        !           548:     set CS_ImagePath     = $($2)
        !           549:     set CS_TypeOfService = $($3)
        !           550:     set CS_Group         = $($4)
        !           551:     set CS_Dependencies  = $($5)
        !           552:     set CS_ObjectName    = $($6)
        !           553:     set CS_EventFile     = $($7)
        !           554:     set CS_TypeSupported = $($8)
        !           555:     ifstr(i) $(CS_TypeSupported) == ""
        !           556:         set CS_TypeSupported = 7
        !           557:     endif
        !           558:     ; Set event log location
        !           559:     set CS_EventLogLocation = $($9)
        !           560:     ifstr(i) $(CS_EventLogLocation) == ""
        !           561:         set CS_EventLogLocation = "System"
        !           562:     endif
        !           563:     set CS_ErrorControl = $($10)
        !           564:     ifstr(i) $(CS_ErrorControl) == ""
        !           565:         set CS_ErrorControl = 1
        !           566:     endif
        !           567:     set CS_EventSourceName = $($11)
        !           568:     ifstr(i) $(CS_EventSourceName) == ""
        !           569:         set CS_EventSourceName = $(CS_NameOfService)
        !           570:     endif
        !           571: 
        !           572:     set CS_KeyServices   = ""
        !           573:     set CS_KeyTempSvc    = ""
        !           574:     set CS_KeySvcManager = ""
        !           575:     set CS_KeyParameters = ""
        !           576:     set CS_KeyLinkage    = ""
        !           577:     set CS_UseRegistry   = $(!NTN_ScUseRegistry)
        !           578: 
        !           579:     Debug-Output "UTILITY.INF: [CreateService] entered for "$(CS_NameOfService)
        !           580: 
        !           581:     Ifstr(i) $(CS_UseRegistry) != "YES"
        !           582:         Ifstr(i) $(CS_UseRegistry) != "NO"
        !           583:             Set CS_UseRegistry = "NO"
        !           584:         Endif
        !           585:     Endif
        !           586: 
        !           587:     Ifstr(i) $(CS_Dependencies) == ""
        !           588:         Set CS_Dependencies = {}
        !           589:     Endif
        !           590: 
        !           591: ;
        !           592: ;  Get the base key handle for the services area
        !           593: ;
        !           594:     Shell "", BaseServiceKey
        !           595:     set RegistryErrorIndex = $($R0)
        !           596:     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        !           597:        set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
        !           598:        goto C_S_Return
        !           599:     endif
        !           600: 
        !           601:     set CS_KeyServices = $($R1)
        !           602: 
        !           603:     ifstr(i) $(CS_TypeOfService) == "system"
        !           604:         set TypeValue = 2
        !           605:         set StartValue = 3
        !           606:     else-ifstr(i) $(CS_TypeOfService) == "systemstart"
        !           607:         set TypeValue = 2
        !           608:         set StartValue = 1
        !           609:     else-ifstr(i) $(CS_TypeOfService) == "systemauto"
        !           610:         set TypeValue = 2
        !           611:         set StartValue = 2
        !           612:     else-ifstr(i) $(CS_TypeOfService) == "adapter"
        !           613:         set TypeValue = 4
        !           614:         set StartValue = 3
        !           615:         Set CS_UseRegistry = "YES"
        !           616:     else-ifstr(i) $(CS_TypeOfService) == "kernelauto"
        !           617:         set TypeValue = 1
        !           618:         set StartValue = 1
        !           619:     else-ifstr(i) $(CS_TypeOfService) == "autoserviceshare"
        !           620:         set TypeValue = 32
        !           621:         set StartValue = 2
        !           622:     else-ifstr(i) $(CS_TypeOfService) == "transport"
        !           623:         set TypeValue = 2
        !           624:         set StartValue = 3
        !           625:     else-ifstr(i) $(CS_TypeOfService) == "kernel"
        !           626:         set TypeValue = 1
        !           627:         set StartValue = 3
        !           628:     else-ifstr(i) $(CS_TypeOfService) == "kernelautostart"
        !           629:         set TypeValue = 1
        !           630:         set StartValue = 2
        !           631:     else-ifstr(i) $(CS_TypeOfService) == "kerneldisable"
        !           632:         set TypeValue = 1
        !           633:         set StartValue = 4
        !           634:     else-ifstr(i) $(CS_TypeOfService) == "service"
        !           635:         set TypeValue = 16
        !           636:         set StartValue = 3
        !           637:     else-ifstr(i) $(CS_TypeOfService) == "serviceauto"
        !           638:         set TypeValue = 16
        !           639:         set StartValue = 2
        !           640:     else-ifstr(i) $(CS_TypeOfService) == "serviceshare"
        !           641:         set TypeValue = 32
        !           642:         set StartValue = 3
        !           643:     else
        !           644:         Set CS_UseRegistry = "YES"
        !           645:         Debug-Output "UTILITY.INF: [CreateService] Unrecognized TypeOfService parameter"
        !           646:         set TypeValue = 4
        !           647:         set StartValue = 3
        !           648:     endif
        !           649: 
        !           650:     Ifint $(TypeValue) > 4
        !           651:         Ifstr(i) $(CS_ObjectName) == ""
        !           652:             set CS_ObjectName = "LocalSystem"
        !           653:         Endif
        !           654:     Endif
        !           655: 
        !           656:     OpenRegKey $(CS_KeyServices) "" $(CS_NameOfService) $(MAXIMUM_ALLOWED) +
        !           657:         CS_KeyTempSvc
        !           658:     ifstr $(CS_KeyTempSvc) != $(KeyNull)
        !           659:         ; wait a minute.. somebody already installed the driver
        !           660:         ; go to open other keys
        !           661: 
        !           662:         ; check whether it is marked for deletion
        !           663:         GetRegValue $(CS_KeyTempSvc),"DeleteFlag", DeleteFlagInfo
        !           664:         set DeleteFlag = *($(DeleteFlagInfo), 4)
        !           665:         ifint $(DeleteFlag) == 1
        !           666:             Set RegistryErrorIndex = REBOOT_MACHINE_BEFORE_ADD_ADAPTER
        !           667:             goto C_S_Return
        !           668:         endif
        !           669:         ;
        !           670:         ; Device section of the registry already exist.
        !           671:         ; Let the code below to handle it. It will popup a dialog
        !           672:         ; and returns error code.
        !           673:         ;
        !           674:     endif
        !           675: 
        !           676:     ifstr(i) $(CS_UseRegistry) == "YES"
        !           677:         ;
        !           678:         Debug-Output "UTILITY.INF: [CreateService] "$(CS_NameOfService)" using Registry"
        !           679:         ;
        !           680:         ; Create our own service
        !           681:         ;
        !           682:         OpenRegKey $(CS_KeyServices) "" $(CS_NameOfService) $(MAXIMUM_ALLOWED) +
        !           683:         CS_KeyTempSvc
        !           684:         ifstr $(CS_KeyTempSvc) == $(KeyNull)
        !           685:            CreateRegKey $(CS_KeyServices) {$(CS_NameOfService),$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" CS_KeyTempSvc
        !           686:         else
        !           687:            Debug-Output "UTILITY.INF: service key "$(CS_NameOfService)" already existed"
        !           688:            Set RegistryErrorIndex = UNABLE_CREATE_CONFIGURE_SERVICE
        !           689:            CloseRegKey $(CS_KeyTempSvc)
        !           690:            CloseRegKey $(CS_KeyServices)
        !           691:            Goto C_S_Return
        !           692:         endif
        !           693: 
        !           694:         Ifstr(i) $(CS_KeyTempSvc) == $(KeyNull)
        !           695: 
        !           696:            Debug-Output "UTILITY.INF: could not create service key "$(CS_NameOfService)
        !           697:            Set RegistryErrorIndex = UNABLE_CREATE_CONFIGURE_SERVICE
        !           698:            CloseRegKey $(CS_KeyTempSvc)
        !           699:            CloseRegKey $(CS_KeyServices)
        !           700:            Goto C_S_Return
        !           701: 
        !           702:         else
        !           703: 
        !           704:             set NewValueList = {+
        !           705:                                {Type,$(NoTitle),$(!REG_VT_DWORD),$(TypeValue)},+
        !           706:                                {Start,$(NoTitle),$(!REG_VT_DWORD),$(StartValue)},+
        !           707:                                {ErrorControl,$(NoTitle),$(!REG_VT_DWORD),$(CS_ErrorControl)}+
        !           708:                                }
        !           709: 
        !           710:             Ifint $(TypeValue) > 4
        !           711:                 Set NewValueList = >($(NewValueList), +
        !           712:                         {ObjectName,$(NoTitle),$(!REG_VT_SZ),$(CS_ObjectName)})
        !           713:             Endif
        !           714: 
        !           715:             ifstr(i) $(CS_Group) != ""
        !           716:                 set NewValueList = >($(NewValueList), +
        !           717:                         {Group,$(NoTitle),$(!REG_VT_SZ),$(CS_Group)})
        !           718:             endif
        !           719: 
        !           720:             ifstr(i) $(CS_ImagePath) != ""
        !           721:                 set NewValueList = >($(NewValueList), +
        !           722:                         {ImagePath,$(NoTitle),$(!REG_VT_EXPAND_SZ),$(CS_ImagePath)})
        !           723:             endif
        !           724: 
        !           725:             ifstr(i) $(CS_Dependencies) != ""
        !           726:                 ifstr(i) $(CS_Dependencies) != {}
        !           727:                     set NewValueList = >($(NewValueList), +
        !           728:                         {Dependencies,$(NoTitle),$(!REG_VT_MULTI_SZ),$(CS_Dependencies)})
        !           729:                 endif
        !           730:             endif
        !           731: 
        !           732:             Shell "", AddValueList, $(CS_KeyTempSvc), $(NewValueList)
        !           733: 
        !           734:             set RegistryErrorIndex = $($R0)
        !           735: 
        !           736:             Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        !           737:                     Debug-Output "Registry error: Add value list"
        !           738:             endif
        !           739: 
        !           740:         endif
        !           741:     else
        !           742:         Debug-Output "UTILITY.INF: [CreateService] "$(CS_NameOfService)" using CreateService() wrapper"
        !           743:         ;
        !           744:         ; Call NCPA to create service key.
        !           745:         ;
        !           746:         Set FLibraryErrCtl = 1
        !           747:         LibraryProcedure CS_CreateResult $(!NCPA_HANDLE), CPlSetup, $(!STF_HWND), CREATESVC,+
        !           748:             $(CS_NameOfService), $(CS_DisplayName), $(StartValue), $(TypeValue), $(CS_ErrorControl),+
        !           749:             $(CS_ImagePath), $(CS_Group),$(CS_Dependencies),$(CS_ObjectName)
        !           750:         Set FLibraryErrCtl = 0
        !           751:         ;
        !           752:         ; Check the return code
        !           753:         ;
        !           754:         Set CS_CreateError = *($(CS_CreateResult),1)
        !           755:         Ifint $(CS_CreateError) != 0
        !           756:              Debug-Output "UTILITY.INF: CreateService wrapper failed, error: "$(CS_CreateResult)
        !           757:              ;
        !           758:              ;  See if the error is special
        !           759:              ;
        !           760:              Ifint $(CS_CreateResult) == 1073
        !           761:                  Set RegistryErrorIndex = SERVICE_ALREADY_EXISTS
        !           762:              Else-ifint $(CS_CreateResult) == 1072
        !           763:                  Set RegistryErrorIndex = SERVICE_MARKED_FOR_DELETE
        !           764:              Else
        !           765:                  Set RegistryErrorIndex = UNABLE_CREATE_CONFIGURE_SERVICE
        !           766:              Endif
        !           767:              CloseRegKey $(CS_KeyTempSvc)
        !           768:              CloseRegKey $(CS_KeyServices)
        !           769:              Goto C_S_Return
        !           770:         Endif
        !           771:         ;
        !           772:         ;  Now open the key which should have been created by the service controller
        !           773:         ;
        !           774:         OpenRegKey $(CS_KeyServices) "" $(CS_NameOfService) $(MAXIMUM_ALLOWED) CS_KeyTempSvc
        !           775:         ifstr $(CS_KeyTempSvc) == $(KeyNull)
        !           776:              Debug-Output "UTILITY.INF: unable to open new service key"
        !           777:              set RegistryErrorIndex = UNABLE_CREATE_CONFIGURE_SERVICE
        !           778:              CloseRegKey $(CS_KeyTempSvc)
        !           779:              CloseRegKey $(CS_KeyServices)
        !           780:              Goto C_S_Return
        !           781:         endif
        !           782:     endif
        !           783: 
        !           784: ;
        !           785: ;   Open or Create the Parameters subkey
        !           786: ;
        !           787:     OpenRegKey $(CS_KeyTempSvc) "" "Parameters" $(MAXIMUM_ALLOWED) +
        !           788:         CS_KeyParameters
        !           789:     ifstr $(CS_KeyParameters) == $(KeyNull)
        !           790:         CreateRegKey $(CS_KeyTempSvc) {"Parameters",$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" CS_KeyParameters
        !           791:     endif
        !           792: 
        !           793:     Ifstr $(CS_KeyParameters) == $(KeyNull)
        !           794:        set RegistryErrorIndex = UNABLE_CREATE_SERVICE_SUBKEY
        !           795:        CloseRegKey $(CS_KeyTempSvc)
        !           796:        CloseRegKey $(CS_KeyServices)
        !           797:        goto C_S_Return
        !           798:     endif
        !           799: 
        !           800:     set RegistryErrorIndex = NO_ERROR
        !           801: ;
        !           802: ;   Open or Create the Linkage subkey
        !           803: ;
        !           804:     OpenRegKey $(CS_KeyTempSvc) "" "Linkage" $(MAXIMUM_ALLOWED) CS_KeyLinkage
        !           805:     Ifstr $(CS_KeyLinkage) == $(KeyNull)
        !           806:         CreateRegKey $(CS_KeyTempSvc) {"Linkage",$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" CS_KeyLinkage
        !           807:     Endif
        !           808: 
        !           809:     Ifstr $(CS_KeyLinkage) == $(KeyNull)
        !           810:        set RegistryErrorIndex = UNABLE_CREATE_SERVICE_SUBKEY
        !           811:        CloseRegKey $(CS_KeyTempSvc)
        !           812:        CloseRegKey $(CS_KeyServices)
        !           813:        goto C_S_Return
        !           814:     endif
        !           815: ;
        !           816: ;   Open or Create the Linkage\Disabled subkey
        !           817: ;
        !           818:     OpenRegKey $(CS_KeyLinkage) "" "Disabled" $(MAXIMUM_ALLOWED) CS_KeyDisabled
        !           819:     Ifstr $(CS_KeyDisabled) == $(KeyNull)
        !           820:         CreateRegKey $(CS_KeyLinkage) {"Disabled",$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" CS_KeyDisabled
        !           821:     Endif
        !           822: 
        !           823:     Ifstr $(CS_KeyDisabled) == $(KeyNull)
        !           824:        set RegistryErrorIndex = UNABLE_CREATE_SERVICE_SUBKEY
        !           825:        CloseRegKey $(CS_KeyTempSvc)
        !           826:        CloseRegKey $(CS_KeyServices)
        !           827:        CloseRegKey $(CS_KeyLinkage)
        !           828:        goto C_S_Return
        !           829:     endif
        !           830:     CloseRegKey $(CS_KeyDisabled)
        !           831: 
        !           832: 
        !           833:     ;
        !           834:     ; Create Eventlog information
        !           835:     ;
        !           836:     ifstr(i) $(CS_EventFile) != ""
        !           837:         OpenRegKey $(!REG_H_LOCAL) "" "SYSTEM\CurrentControlSet\Services\EventLog\"$(CS_EventLogLocation) $(MAXIMUM_ALLOWED) CS_KeyEventLog
        !           838:         Ifstr $(CS_KeyEventLog) == $(KeyNull)
        !           839:            ; cannot open eventlog
        !           840:            debug-output "Cannot open eventlog key"
        !           841:            set RegistryErrorIndex = UNABLE_OPEN_EVENTLOG_SUBKEY
        !           842:            CloseRegKey $(CS_KeyTempSvc)
        !           843:            CloseRegKey $(CS_KeyServices)
        !           844:            CloseRegKey $(CS_KeyParameters)
        !           845:            CloseRegKey $(CS_KeyLinkage)
        !           846:            goto C_S_Return
        !           847:         else
        !           848:            ; set up the service key
        !           849:            OpenRegKey $(CS_KeyEventLog) "" $(CS_EventSourceName) $(MAXIMUM_ALLOWED) CS_KeyService
        !           850:            ifstr(i) $(CS_KeyService) == ""
        !           851:                CreateRegKey $(CS_KeyEventLog) {$(CS_EventSourceName),$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" CS_KeyService
        !           852:            endif
        !           853: 
        !           854:            Ifstr $(CS_KeyService) != $(KeyNull)
        !           855:                ; create the EventMessageFile and TypeSupported fields
        !           856:                SetRegValue $(CS_KeyService) {EventMessageFile,$(NoTitle),$(!REG_VT_EXPAND_SZ),$(CS_EventFile)}
        !           857:                SetRegValue $(CS_KeyService) {TypesSupported,$(NoTitle),$(!REG_VT_DWORD),$(CS_TypeSupported)}
        !           858:                CloseRegKey $(CS_KeyService)
        !           859:            endif
        !           860:         Endif
        !           861:     endif
        !           862: 
        !           863: ;
        !           864: ; Return the keys and error codes
        !           865: ;
        !           866: C_S_Return = +
        !           867:     Ifstr $(CS_KeyServices) != $(KeyNull)
        !           868:         CloseRegKey $(CS_KeyServices)
        !           869:     endif
        !           870:     return $(RegistryErrorIndex), $(CS_KeyTempSvc), $(CS_KeyParameters), $(CS_KeyLinkage)
        !           871: 
        !           872: ;*************************************************************************
        !           873: ;  end of section CreateService
        !           874: ;*************************************************************************
        !           875: 
        !           876: 
        !           877: ;*************************************************************************
        !           878: ;
        !           879: ;     SECTION:   AssignAdapterNumber
        !           880: ;
        !           881: ;     PURPOSE:   Enumerate the netcards, and return a numeric value which
        !           882: ;                is unused.
        !           883: ;
        !           884: ;   ARGUMENTS:   None.
        !           885: ;
        !           886: ;     RETURNS:   $R0    Regisitry Error Code
        !           887: ;                $R1    Numeric value to be use for new adapter;
        !           888: ;                       (1,2,3..)
        !           889: ;
        !           890: ;  REFERENCES:   Nothing
        !           891: ;
        !           892: ;    MODIFIES:   Nothing
        !           893: ;
        !           894: ;
        !           895: ;*************************************************************************
        !           896: [AssignAdapterNumber]
        !           897:     read-syms InitBaseVars
        !           898: 
        !           899:     set AA_AdapterNumber = 1
        !           900:     set AA_KeyNetcards = ""
        !           901:     set AA_KeyTemp = ""
        !           902:     set RegistryErrorIndex = NO_ERROR
        !           903: 
        !           904:     OpenRegKey $(!REG_H_LOCAL) "" $(NetworkCardKeyName) $(MAXIMUM_ALLOWED) AA_KeyNetcards
        !           905: 
        !           906:     Ifstr $(AA_KeyNetcards) == $(KeyNull)
        !           907:        set RegistryErrorIndex = UNABLE_OPEN_NETWORKCARD_SECTION
        !           908:        goto A_A_Return
        !           909:     endif
        !           910: ;
        !           911: ;  Loop to find an unused adapter number
        !           912: ;
        !           913: A_A_TryAgain = +
        !           914:     Ifint $(AA_AdapterNumber) > 100
        !           915:         Set AA_AdapterNumber = 0
        !           916:         Set RegistryErrorIndex = UNABLE_OPEN_NETWORKCARD_SECTION
        !           917:         Goto A_A_Found
        !           918:     Endif
        !           919: 
        !           920:     ifint $(AA_AdapterNumber) < 10
        !           921:         set Tmp_AA_AdapterNumber = "0"$(AA_AdapterNumber)
        !           922:     else
        !           923:         set Tmp_AA_AdapterNumber = $(AA_AdapterNumber)
        !           924:     endif
        !           925: 
        !           926:     OpenRegKey $(AA_KeyNetcards) "" $(Tmp_AA_AdapterNumber) $(MAXIMUM_ALLOWED) AA_KeyTemp
        !           927: 
        !           928:     Ifstr $(AA_KeyTemp) == $(KeyNull)
        !           929:         Goto A_A_Found
        !           930:     Endif
        !           931: 
        !           932:     CloseRegKey $(AA_KeyTemp)
        !           933:     Set AA_KeyTemp = $(KeyNull)
        !           934:     Set-add AA_AdapterNumber = $(AA_AdapterNumber),1
        !           935:     Goto A_A_TryAgain
        !           936: 
        !           937: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        !           938: ;;BUGBUG:  The code below should work
        !           939: ;;
        !           940: ;    EnumRegKey $(AA_KeyNetcards) AA_KeyNameList
        !           941: ;
        !           942: ;    ForListDo  $(AA_KeyNameList)
        !           943: ;        set AA_KeyName = *($($),1)
        !           944: ;        Ifint $(AA_AdapterNumber) != $(AA_KeyName)
        !           945: ;             goto A_A_Found
        !           946: ;        endif
        !           947: ;        set-add AA_AdapterNumber = $(AA_AdapterNumber),1
        !           948: ;    EndForListDo
        !           949: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        !           950: 
        !           951: A_A_Found =+
        !           952:     IfInt $(AA_AdapterNumber) <= 9
        !           953:         set AA_AdapterNumber = "0"$(AA_AdapterNumber)
        !           954:     endif
        !           955:     CloseRegKey $(AA_KeyNetcards)
        !           956: 
        !           957: A_A_Return = +
        !           958:     return $(RegistryErrorIndex) $(AA_AdapterNumber)
        !           959: 
        !           960: ;*************************************************************************
        !           961: ;  end of section AssignAdapterNumber
        !           962: ;*************************************************************************
        !           963: 
        !           964: ;*************************************************************************
        !           965: ;
        !           966: ;     SECTION:   InstallNetcard
        !           967: ;
        !           968: ;     PURPOSE:   Create a new HARDWARE\Netcard\(n) area in the Registry
        !           969: ;
        !           970: ;   ARGUMENTS:   $0     Name if the INF file
        !           971: ;
        !           972: ;     RETURNS:   $R0    Registry error code
        !           973: ;                $R1    Netcard\(n) key handle
        !           974: ;                $R2    numeric index of netcard (n)
        !           975: ;                $R3    NetRules key handle
        !           976: ;
        !           977: ;  REFERENCES:   Nothing
        !           978: ;
        !           979: ;    MODIFIES:   Nothing
        !           980: ;
        !           981: ;
        !           982: ;*************************************************************************
        !           983: [InstallNetcard]
        !           984:    read-syms InitBaseVars
        !           985: 
        !           986:    set IN_Infname     = $($0)
        !           987:    set IN_CardNumber  = 0
        !           988:    set IN_KeyNetcard  = ""
        !           989:    set IN_KeyNetRules = ""
        !           990: ;
        !           991: ;   Assign a number to this network card and create its key
        !           992: ;
        !           993:     Shell "" AssignAdapterNumber
        !           994: 
        !           995:     set RegistryErrorIndex = $($R0)
        !           996:     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        !           997:         goto I_N_Return
        !           998:     endif
        !           999: 
        !          1000:     set IN_CardNumber = $($R1)
        !          1001: 
        !          1002:     CreateRegKey $(!REG_H_LOCAL) {$(NetworkCardKeyName)\$(IN_CardNumber),$(NoTitle),GenericClass} +
        !          1003:                   "" $(MAXIMUM_ALLOWED) "" IN_KeyNetcard
        !          1004: 
        !          1005:     Ifstr $(IN_KeyNetcard) == $(KeyNull)
        !          1006:        set RegistryErrorIndex = UNABLE_CREATE_NETCARD_CONFIGURATION
        !          1007:        goto I_N_Return
        !          1008:     endif
        !          1009: ;
        !          1010: ;   Create the NetRules key
        !          1011: ;
        !          1012:     CreateRegKey $(IN_KeyNetcard) {NetRules,$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" IN_KeyNetRules
        !          1013:     Ifstr $(IN_KeyNetRules) == $(KeyNull)
        !          1014:        set RegistryErrorIndex = UNABLE_CREATE_NETRULES_KEY
        !          1015:        goto I_N_Return
        !          1016:     endif
        !          1017: ;
        !          1018: ;   Set the "Infname" value if non-null; reduce it if it's in %SystemRoot%
        !          1019: ;
        !          1020:     Ifstr $(IN_Infname) != ""
        !          1021:        Shell "", ReduceInfPath, $(IN_Infname)
        !          1022:        SetRegValue $(IN_KeyNetRules) {InfName,$(NoTitle),$(!REG_VT_SZ),$($R0)}
        !          1023:     endif
        !          1024: 
        !          1025:     set RegistryErrorIndex = NO_ERROR
        !          1026: 
        !          1027: I_N_Return = +
        !          1028:     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        !          1029:         Debug-Output "UTILITY.INF: [InstallNetcard]: "$(RegistryErrorIndex)
        !          1030:         Ifstr $(IN_KeyNetRules) != $(KeyNull)
        !          1031:             CloseRegKey $(IN_KeyNetRules)
        !          1032:             set IN_KeyNetrules = ''
        !          1033:         endif
        !          1034: ;BUGBUG  DeleteRegTree $(IN_KeyNetcard)
        !          1035:         set IN_KeyNetcard = ""
        !          1036:     endif
        !          1037:     return $(RegistryErrorIndex), $(IN_KeyNetcard), $(IN_CardNumber), $(IN_KeyNetRules)
        !          1038: 
        !          1039: ;*************************************************************************
        !          1040: ;  end of section InstallNetcard
        !          1041: ;*************************************************************************
        !          1042: 
        !          1043: ;*************************************************************************
        !          1044: ;
        !          1045: ;     SECTION:   LinkToService
        !          1046: ;
        !          1047: ;     PURPOSE:   Link a software or hardware component to its
        !          1048: ;                corresponding service area entry
        !          1049: ;
        !          1050: ;   ARGUMENTS:   $0     Registry key handle to primary component key
        !          1051: ;                $1     Name of service (no imbedded blanks, etc.)
        !          1052: ;
        !          1053: ;     RETURNS:   $R0    Registry error code
        !          1054: ;
        !          1055: ;  REFERENCES:   Nothing
        !          1056: ;
        !          1057: ;    MODIFIES:   Nothing
        !          1058: ;
        !          1059: ;
        !          1060: ;*************************************************************************
        !          1061: [LinkToService]
        !          1062: 
        !          1063:     read-syms InitBaseVars
        !          1064: 
        !          1065:     SetRegValue $($0) {ServiceName,$(NoTitle),$(!REG_VT_SZ),$($1)}
        !          1066: 
        !          1067: L_S_Return = +
        !          1068:     return $(RegistryErrorIndex)
        !          1069: 
        !          1070: ;*************************************************************************
        !          1071: ;  end of section LinkToService
        !          1072: ;*************************************************************************
        !          1073: 
        !          1074: ;*************************************************************************
        !          1075: ;
        !          1076: ;     SECTION:   IncrementRefCount
        !          1077: ;
        !          1078: ;     PURPOSE:   Increment the reference counter in the registry
        !          1079: ;
        !          1080: ;   ARGUMENTS:   $0     Registry key name
        !          1081: ;
        !          1082: ;     RETURNS:   $R0    Registry error code
        !          1083: ;
        !          1084: ;  REFERENCES:   Nothing
        !          1085: ;
        !          1086: ;    MODIFIES:   Nothing
        !          1087: ;
        !          1088: ;
        !          1089: ;*************************************************************************
        !          1090: [IncrementRefCount]
        !          1091:     read-syms InitBaseVars
        !          1092: 
        !          1093:     OpenRegKey $(!REG_H_LOCAL) "" $($0) $(MAXIMUM_ALLOWED) SoftwareKey
        !          1094: 
        !          1095:     Ifstr $(SoftwareKey) == $(KeyNull)
        !          1096:        Debug-Output "UTILITY.INF: could not open Software base key"
        !          1097:        set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
        !          1098:        goto IncrementRefCount_Return
        !          1099:     endif
        !          1100: 
        !          1101:     GetRegValue $(SoftwareKey),"RefCount", RefCountInfo
        !          1102:     set RefCount = *($(RefCountInfo), 4)
        !          1103:     Set-add RefCount = $(RefCount),1
        !          1104:     SetRegValue $(SoftwareKey) {RefCount,$(NoTitle),$(!REG_VT_DWORD),$(RefCount)}
        !          1105:     CloseRegKey $(SoftwareKey)
        !          1106: 
        !          1107: IncrementRefCount_Return = +
        !          1108:     return $(RegistryErrorIndex)
        !          1109: 
        !          1110: ;*************************************************************************
        !          1111: ;  end of section IncrementRefCount
        !          1112: ;*************************************************************************
        !          1113: 
        !          1114: ;*************************************************************************
        !          1115: ;
        !          1116: ;     SECTION:   DecrementRefCount
        !          1117: ;
        !          1118: ;     PURPOSE:   Decrement the reference counter in the registry
        !          1119: ;
        !          1120: ;   ARGUMENTS:   $0     Registry key name
        !          1121: ;
        !          1122: ;     RETURNS:   $R0    Registry error code
        !          1123: ;
        !          1124: ;  REFERENCES:   Nothing
        !          1125: ;
        !          1126: ;    MODIFIES:   Nothing
        !          1127: ;
        !          1128: ;
        !          1129: ;*************************************************************************
        !          1130: [DecrementRefCount]
        !          1131:     read-syms InitBaseVars
        !          1132: 
        !          1133:     OpenRegKey $(!REG_H_LOCAL) "" $($0) $(MAXIMUM_ALLOWED) SoftwareKey
        !          1134: 
        !          1135:     Ifstr $(SoftwareKey) == $(KeyNull)
        !          1136:        Debug-Output "UTILITY.INF: could not open Software base key"
        !          1137:        set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
        !          1138:        goto DecrementRefCount_Return
        !          1139:     endif
        !          1140: 
        !          1141:     GetRegValue $(SoftwareKey),"RefCount", RefCountInfo
        !          1142:     set RefCount = *($(RefCountInfo), 4)
        !          1143:     ifint $(RefCount) == 0
        !          1144:         ; something wrong
        !          1145:         goto DecrementRefCount_Return
        !          1146:     endif
        !          1147:     Set-sub RefCount = $(RefCount),1
        !          1148:     SetRegValue $(SoftwareKey) {RefCount,$(NoTitle),$(!REG_VT_DWORD),$(RefCount)}
        !          1149:     CloseRegKey $(SoftwareKey)
        !          1150: 
        !          1151: DecrementRefCount_Return = +
        !          1152:     return $(RegistryErrorIndex)
        !          1153: 
        !          1154: ;*************************************************************************
        !          1155: ;  end of section DecrementRefCount
        !          1156: ;*************************************************************************
        !          1157: 
        !          1158: ;*************************************************************************
        !          1159: ;
        !          1160: ;     SECTION:   IsRefCountEqual0
        !          1161: ;
        !          1162: ;     PURPOSE:   check the reference counter in the registry is equal to 0 or
        !          1163: ;                not
        !          1164: ;
        !          1165: ;   ARGUMENTS:   $0     Registry key name
        !          1166: ;
        !          1167: ;     RETURNS:   $R0    Registry error code
        !          1168: ;                $R1    0 - if ref count != 0
        !          1169: ;                       1 - if ref count = 0
        !          1170: ;
        !          1171: ;  REFERENCES:   Nothing
        !          1172: ;
        !          1173: ;    MODIFIES:   Nothing
        !          1174: ;
        !          1175: ;
        !          1176: ;*************************************************************************
        !          1177: [IsRefCountEqualZero]
        !          1178:     read-syms InitBaseVars
        !          1179: 
        !          1180:     OpenRegKey $(!REG_H_LOCAL) "" $($0) $(MAXIMUM_ALLOWED) SoftwareKey
        !          1181: 
        !          1182:     Ifstr $(SoftwareKey) == $(KeyNull)
        !          1183:        Debug-Output "UTILITY.INF: could not open Software base key"
        !          1184:        set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
        !          1185:        goto IsRefCountEqualZero_Return
        !          1186:     endif
        !          1187: 
        !          1188:     GetRegValue $(SoftwareKey),"RefCount", RefCountInfo
        !          1189:     set RefCount = *($(RefCountInfo), 4)
        !          1190:     Ifint $(RefCount) == 0
        !          1191:         set RefCountEqualZero = 1
        !          1192:     else
        !          1193:         set RefCountEqualZero = 0
        !          1194:     endif
        !          1195:     CloseRegKey $(SoftwareKey)
        !          1196: 
        !          1197: IsRefCountEqualZero_Return = +
        !          1198:     return $(RegistryErrorIndex) $(RefCountEqualZero)
        !          1199: 
        !          1200: 
        !          1201: ;*************************************************************************
        !          1202: ;
        !          1203: ;     SECTION:   FindService
        !          1204: ;
        !          1205: ;     PURPOSE:   Given a hardware or software component key handle,
        !          1206: ;                return a key handle to the corresponding Service entry
        !          1207: ;
        !          1208: ;   ARGUMENTS:   $0   Registry key handle to primary component
        !          1209: ;                $1   type of component (adapter, etc.)
        !          1210: ;
        !          1211: ;     RETURNS:   $R0  Registry error code
        !          1212: ;                $R1  Registry key handle for Service area
        !          1213: ;                $R2  Registry key handle for Parameters subkey
        !          1214: ;
        !          1215: ;  REFERENCES:   Nothing
        !          1216: ;
        !          1217: ;    MODIFIES:   Nothing
        !          1218: ;
        !          1219: ;
        !          1220: ;*************************************************************************
        !          1221: [FindService]
        !          1222:     read-syms InitBaseVars
        !          1223: 
        !          1224:     set FS_KeyThisService = ""
        !          1225:     set FS_KeyParameters  = ""
        !          1226:     set FS_KeyComponent   = $($0)
        !          1227:     set FS_TypeComponent  = $($1)
        !          1228: 
        !          1229:     Shell "", BaseServiceKey
        !          1230: 
        !          1231:     set FS_KeyServices = $($R1)
        !          1232:     set RegistryErrorIndex = $($R0)
        !          1233: 
        !          1234:     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        !          1235:        goto F_S_Return
        !          1236:     endif
        !          1237: ;
        !          1238: ;  Obtain the all the values for the component key.
        !          1239: ;
        !          1240:     EnumRegValue $(FS_KeyComponent) FS_ValueList
        !          1241: 
        !          1242: ; BUGBUG:  Check RegLastError
        !          1243: 
        !          1244:     set FS_SvcName = ""
        !          1245: 
        !          1246:     ForListDo $(FS_ValueList)
        !          1247:         set FS_ValueName = *($($),1)
        !          1248:         Ifstr(i) $(FS_ValueName) == ServiceName
        !          1249:             set FS_SvcName = *($($),4)
        !          1250:             goto F_S_Break1
        !          1251:         endif
        !          1252:     EndForListDo
        !          1253: F_S_Break1 = +
        !          1254: 
        !          1255:     Ifstr $(FS_SvcName) == $(KeyNull)
        !          1256:        set RegistryErrorIndex = CANNOT_FIND_COMPONENT_SERVICE
        !          1257:        goto F_S_Return
        !          1258:     endif
        !          1259: 
        !          1260:     OpenRegKey $(FS_KeyServices) "" $(FS_SvcName) $(MAXIMUM_ALLOWED) FS_KeyThisService
        !          1261:     Ifstr $(FS_KeyThisService) == $(KeyNull)
        !          1262:        set RegistryErrorIndex = CANNOT_FIND_COMPONENT_SERVICE
        !          1263:        goto F_S_Return
        !          1264:     endif
        !          1265: 
        !          1266:     OpenRegKey $(FS_KeyThisService) "" "Parameters" $(MAXIMUM_ALLOWED) FS_KeyParameters
        !          1267:     Ifstr $(FS_KeyParameters) == $(KeyNull)
        !          1268:        set RegistryErrorIndex = CANNOT_FIND_COMPONENT_SERVICE
        !          1269:        goto F_S_Return
        !          1270:     endif
        !          1271: 
        !          1272: F_S_Return = +
        !          1273:     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        !          1274:         Ifstr $(FS_KeyParameters) != $(KeyNull)
        !          1275:             CloseRegKey $(FS_KeyParameters)
        !          1276:         endif
        !          1277:         Ifstr $(FS_KeyThisService) != $(KeyNull)
        !          1278:            CloseRegKey $(FS_KeyThisService)
        !          1279:         endif
        !          1280:     endif
        !          1281:     return $(RegistryErrorIndex), $(FS_KeyThisService) $(FS_KeyParameters)
        !          1282: 
        !          1283: ;*************************************************************************
        !          1284: ;  end of section FindService
        !          1285: ;*************************************************************************
        !          1286: ;*************************************************************************
        !          1287: ;
        !          1288: ;     SECTION:   GetServiceParameters
        !          1289: ;
        !          1290: ;     PURPOSE:   Given a component key and type, return a list of
        !          1291: ;                all its current parameters
        !          1292: ;
        !          1293: ;   ARGUMENTS:   $0   Registry key handle to primary component
        !          1294: ;                $1   type of component (adapter, etc.)
        !          1295: ;
        !          1296: ;     RETURNS:   $R0  Registry error code
        !          1297: ;                $R1  Registry key handle for Service area
        !          1298: ;                $R2  Registry key handle for Parameters subkey
        !          1299: ;                $R3  Value list of all values under Parameters subkey
        !          1300: ;
        !          1301: ;  REFERENCES:   Nothing
        !          1302: ;
        !          1303: ;    MODIFIES:   Nothing
        !          1304: ;
        !          1305: ;*************************************************************************
        !          1306: [GetServiceParameters]
        !          1307:     read-syms InitBaseVars
        !          1308:     set GP_KeyComponent = $($0)
        !          1309:     set GP_KeyService = ""
        !          1310:     set GP_KeyParameters = ""
        !          1311:     set GP_ValueList  = {}
        !          1312: 
        !          1313:     FindService $(GP_KeyComponent) $($1)
        !          1314:     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        !          1315:         goto G_P_Return
        !          1316:     endif
        !          1317: 
        !          1318:     set GP_KeyService = $($R1)
        !          1319:     set GP_KeyParameters = $($R2)
        !          1320: 
        !          1321:     EnumRegValue $(GP_KeyParameters) GP_ValueList
        !          1322: 
        !          1323: G_P_Return = +
        !          1324:     return $(RegistryErrorIndex) $(GP_KeyService) $(GP_KeyParameters) $(GP_ValueList)
        !          1325: 
        !          1326: ;*************************************************************************
        !          1327: ;  end of section sectionname
        !          1328: ;*************************************************************************
        !          1329: 
        !          1330: ;*************************************************************************
        !          1331: ;
        !          1332: ;     SECTION:   AddSoftwareComponent
        !          1333: ;
        !          1334: ;     PURPOSE:   Adds all the Registry information necessary for
        !          1335: ;                a new software component.  This involves creating
        !          1336: ;                the SOFTWARE area and the SERVICE area.
        !          1337: ;
        !          1338: ;   ARGUMENTS:   $0   name of Manufacturer
        !          1339: ;                $1   name of Product
        !          1340: ;                $2   service name to use (no imbedded blanks, etc.)
        !          1341: ;                $3   Display Name for service
        !          1342: ;                $4   full path name to the INF file for configuration
        !          1343: ;                $5   ImagePath
        !          1344: ;                $6   type of the software,
        !          1345: ;                       see [CreateService] for complete list
        !          1346: ;                $7   service order group, if any or ""
        !          1347: ;                $8   dependency **list**, if any or {}
        !          1348: ;                $9   ObjectName. if "", it will set to "LocalSystem"
        !          1349: ;                $10  EventMessageFile    [optional]
        !          1350: ;                $11  TypeSupported       [optional]
        !          1351: ;                $12  event log location  [optional]
        !          1352: ;                $13  error control value [optional]
        !          1353: ;                $14  event log source    [optional]
        !          1354: ;
        !          1355: ;    RETURNS:   $R0  error code or zero if no error
        !          1356: ;               $R1  Registry key variable for
        !          1357: ;                      SOFTWARE\Manufacturer\Product\Version key
        !          1358: ;               $R2  Registry key variable for
        !          1359: ;                      SOFTWARE\...\NetRules
        !          1360: ;               $R3  Registry key handle for Services key
        !          1361: ;               $R4  "Parameters" key handle for Services area
        !          1362: ;               $R5  "Linkage" key handle for Services area
        !          1363: ;
        !          1364: ;  REFERENCES:  Nothing
        !          1365: ;
        !          1366: ;    MODIFIES:  Nothing
        !          1367: ;
        !          1368: ;*************************************************************************
        !          1369: [AddSoftwareComponent]
        !          1370:     read-syms InitBaseVars
        !          1371: 
        !          1372:     set AS_MfgName       = $($0)
        !          1373:     set AS_ProdName      = $($1)
        !          1374:     set AS_SvcName       = $($2)
        !          1375:     set AS_DisplayName   = $($3)
        !          1376:     set AS_Infname       = $($4)
        !          1377:     set AS_ImagePath     = $($5)
        !          1378:     set AS_ServiceType   = $($6)
        !          1379:     set AS_Group         = $($7)
        !          1380:     set AS_Dependencies  = $($8)
        !          1381:     set AS_ObjectName    = $($9)
        !          1382:     set AS_EventFile     = $($10)
        !          1383:     set AS_TypeSupported = $($11)
        !          1384:     set AS_EventLocation = $($12)
        !          1385:     set AS_ErrorCtlValue = $($13)
        !          1386:     set AS_EventSource   = $($14)
        !          1387:     set AS_KeyVersion    = ""
        !          1388:     set AS_KeyNetRules   = ""
        !          1389:     set AS_KeyService    = ""
        !          1390:     set AS_KeyParameters = ""
        !          1391:     set AS_KeyLinkage    = ""
        !          1392: 
        !          1393: ;
        !          1394: ;   Create the Service entry for this product
        !          1395: ;
        !          1396:     Shell "", CreateService,$(AS_SvcName),$(AS_DisplayName),$(AS_ImagePath),+
        !          1397:           $(AS_ServiceType),$(AS_Group),$(AS_Dependencies),$(AS_ObjectName),+
        !          1398:           $(AS_EventFile),$(AS_TypeSupported),+
        !          1399:           $(AS_EventLocation),$(AS_ErrorCtlValue),$(AS_EventSource)
        !          1400: 
        !          1401:     set RegistryErrorIndex = $($R0)
        !          1402:     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        !          1403:        goto A_S_Return
        !          1404:     endif
        !          1405: 
        !          1406:     set AS_KeyService    = $($R1)
        !          1407:     set AS_KeyParameters = $($R2)
        !          1408:     set AS_KeyLinkage    = $($R3)
        !          1409: ;
        !          1410: ;   Service area is created.   Create the software area and link them
        !          1411: ;
        !          1412:     Shell "", InstallSoftwareProduct, $(AS_MfgName), $(AS_ProdName), $(AS_Infname)
        !          1413: 
        !          1414:     set RegistryErrorIndex = $($R0)
        !          1415:     Ifstr(i) $(RegistryErrorIndex) == NO_ERROR
        !          1416:         set AS_KeyVersion  = $($R1)
        !          1417:         set AS_KeyNetRules = $($R2)
        !          1418:         Shell "", LinkToService, $(AS_KeyVersion), $(AS_SvcName), service
        !          1419: 
        !          1420:         set RegistryErrorIndex = $($R0)
        !          1421:         Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        !          1422:             goto A_S_Return
        !          1423:         endif
        !          1424: 
        !          1425:         ;
        !          1426:         ; Add Reference Counter
        !          1427:         ;
        !          1428:         GetRegValue $(AS_KeyVersion),"RefCount", RefCountInfo
        !          1429:         Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
        !          1430:             ; no RefCount variable
        !          1431:             SetRegValue $(AS_KeyVersion) {RefCount,$(NoTitle),$(!REG_VT_DWORD),0}
        !          1432:         endif
        !          1433: 
        !          1434:     endif
        !          1435: 
        !          1436: A_S_Return = +
        !          1437:     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        !          1438:        Ifstr $(AS_KeyNetRules) != $(KeyNull)
        !          1439:           CloseRegKey $(AS_KeyNetRules)
        !          1440:        endif
        !          1441:        Ifstr $(AS_KeyParameters) != $(KeyNull)
        !          1442:           CloseRegKey $(AS_KeyParameters)
        !          1443:        endif
        !          1444:        Ifstr $(AS_KeyLinkage) != $(KeyNull)
        !          1445:           CloseRegKey $(AS_KeyLinkage)
        !          1446:        endif
        !          1447:        Ifstr $(AS_KeyVersion) != $(KeyNull)
        !          1448:           CloseRegKey $(AS_KeyVersion)
        !          1449:           Set AS_ProdKeyName = $(!NTN_SoftwareBase)"\"$(AS_MfgName)"\"$(AS_ProdName)
        !          1450:           OpenRegKey $(!REG_H_LOCAL) "" $(AS_ProdKeyName) $(MAXIMUM_ALLOWED) AS_KeyProduct
        !          1451:           Ifstr(i) $(AS_KeyProduct) != $(KeyNull)
        !          1452:               DeleteRegKey $(AS_KeyProduct) "CurrentVersion"
        !          1453:               CloseRegKey $(AS_KeyProduct)
        !          1454:           Endif
        !          1455:        Endif
        !          1456:        Ifstr $(AS_KeyService) != $(KeyNull)
        !          1457:           Debug-Output "UTILITY.INF: DeleteRegTree Service Key"
        !          1458:           ;DeleteRegTree $(AS_KeyService) ""
        !          1459:        endif
        !          1460: 
        !          1461:        set AS_KeyVersion = ""
        !          1462:        set AS_KeyNetRules = ""
        !          1463:        set AS_KeyService = ""
        !          1464:        set AS_KeyParameters = ""
        !          1465:        set AS_KeyLinkage = ""
        !          1466: 
        !          1467:     endif
        !          1468:     return $(RegistryErrorIndex), $(AS_KeyVersion), $(AS_KeyNetRules), $(AS_KeyService),+
        !          1469:            $(AS_KeyParameters), $(AS_KeyLinkage)
        !          1470: 
        !          1471: ;*************************************************************************
        !          1472: ;  end of section  AddSoftwareComponent
        !          1473: ;*************************************************************************
        !          1474: 
        !          1475: ;*************************************************************************
        !          1476: ;
        !          1477: ;     SECTION:   AddHardwareComponent
        !          1478: ;
        !          1479: ;     PURPOSE:   Adds all the Registry information necessary for
        !          1480: ;                a new network adapater card
        !          1481: ;
        !          1482: ;   ARGUMENTS:   $0   service name to use (no imbedded blanks, etc.).
        !          1483: ;                     This name will have the numeric value from
        !          1484: ;                     InstallNetCard appended to it for uniqueness.
        !          1485: ;                $1   INF name for this adapter
        !          1486: ;                $2   Driver name in software section
        !          1487: ;
        !          1488: ;
        !          1489: ;    RETURNS:    $R0  Registry error code or zero if no error
        !          1490: ;                $R1  Registry key variable for HARDWARE\Netcard\(n)
        !          1491: ;                $R2  Registry key variable for HARDWARE\Netcard\(n)\\NetRules
        !          1492: ;                $R3  Registry key handle for <service>\Parameters key
        !          1493: ;                $R4  Adapter number assigned to adapter
        !          1494: ;                $R5  Service name generated by combining svc name with
        !          1495: ;                     adapter number
        !          1496: ;
        !          1497: ;  REFERENCES:  Nothing
        !          1498: ;
        !          1499: ;    MODIFIES:  Nothing
        !          1500: ;
        !          1501: ;*************************************************************************
        !          1502: [AddHardwareComponent]
        !          1503: 
        !          1504:     read-syms InitBaseVars
        !          1505: 
        !          1506:     set AH_SvcName       = $($0)
        !          1507:     set AH_Infname       = $($1)
        !          1508:     set AH_SoftwareName  = $($2)
        !          1509:     set AH_KeyNetcard    = ""
        !          1510:     set AH_KeyNetRules   = ""
        !          1511:     set AH_KeyService    = ""
        !          1512:     set AH_KeyParameters = ""
        !          1513:     set AH_AdapNum       = -1
        !          1514: ;
        !          1515: ;  Create the HARDWARE\Netcard entry for this adapter
        !          1516: ;
        !          1517:     Shell "", InstallNetcard, $(AH_Infname)
        !          1518: 
        !          1519:     set RegistryErrorIndex = $($R0)
        !          1520:     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        !          1521:         Debug-Output "UTILITY.INF: [AddHardwareComponent] InstallNetcard returned: "$(RegistryErrorIndex)
        !          1522:         goto A_H_Return
        !          1523:     endif
        !          1524: 
        !          1525:     set AH_KeyNetcard  = $($R1)
        !          1526:     set AH_AdapNum     = $($R2)
        !          1527:     set AH_SvcName     = $(AH_SvcName)$(AH_AdapNum)
        !          1528:     set AH_KeyNetRules = $($R3)
        !          1529: ;
        !          1530: ;  Create the SERVICES entry for this adapter; no binary path, no group,
        !          1531: ;    no dependencies.
        !          1532: ;
        !          1533:     Shell "", CreateService, $(AH_SvcName), "", "", "adapter","",{}
        !          1534: 
        !          1535:     set RegistryErrorIndex = $($R0)
        !          1536:     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        !          1537:         Debug-Output "UTILITY.INF: CreateService returned "$(RegistryErrorIndex)
        !          1538:         goto A_H_Return
        !          1539:     endif
        !          1540: 
        !          1541:     CloseRegKey $($R1)
        !          1542:     set AH_KeyParameters = $($R2)
        !          1543:     CloseRegKey $($R3)
        !          1544: 
        !          1545: ;
        !          1546: ;  Link the Netcard entry to the Service created
        !          1547: ;
        !          1548:     Shell "", LinkToService, $(AH_KeyNetcard), $(AH_SvcName)
        !          1549:     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        !          1550:         Debug-Output "UTILITY.INF: [AddHardwareComponent] LinkToService returned "$(RegistryErrorIndex)
        !          1551:         goto A_H_Return
        !          1552:     endif
        !          1553: 
        !          1554: ;
        !          1555: ;   Add the reference counter in the driver section
        !          1556: ;
        !          1557:     Shell "", IncrementRefCount, $(AH_SoftwareName)
        !          1558:     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        !          1559:         Debug-Output "UTILITY.INF: [AddHardwareComponent] IncrementRefCount returned "$(RegistryErrorIndex)
        !          1560:         goto A_H_Return
        !          1561:     endif
        !          1562: 
        !          1563: A_H_Return = +
        !          1564:     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        !          1565:         Debug-Output "UTILITY.INF: [AddHardwareComponent] returning error: "$(RegistryErrorIndex)
        !          1566:         Ifstr(i) $(AH_KeyNetRules) != $(KeyNull)
        !          1567:            CloseRegKey $(AH_KeyNetRules)
        !          1568:         Endif
        !          1569:         Ifstr(i) $(AH_KeyNetcard) != $(KeyNull)
        !          1570:             ; Let the RemoveHardware handle it
        !          1571:             ;DeleteRegTree $(AH_KeyNetcard) ""
        !          1572:         Endif
        !          1573:         set AH_KeyNetRules = ""
        !          1574:         set AH_KeyNetcard = ""
        !          1575:     endif
        !          1576: 
        !          1577:     return $(RegistryErrorIndex), $(AH_KeyNetcard), $(AH_KeyNetRules), $(AH_KeyParameters),+
        !          1578:            $(AH_AdapNum), $(AH_SvcName)
        !          1579: 
        !          1580: ;*************************************************************************
        !          1581: ;  end of section  AddHardwareComponent
        !          1582: ;*************************************************************************
        !          1583: 
        !          1584: ;*************************************************************************
        !          1585: ;
        !          1586: ;     SECTION:   MCAFindBus
        !          1587: ;
        !          1588: ;     PURPOSE:   Find adpater(s) location
        !          1589: ;
        !          1590: ;   ARGUMENTS:   $0   The least signifiance byte of the device ID
        !          1591: ;                $1   The most signifiance byte of the device ID
        !          1592: ;
        !          1593: ;
        !          1594: ;    RETURNS:    $R0  Registry error code or zero if no error
        !          1595: ;                $R1  The list of adapter location
        !          1596: ;                       {{bus0,slot0},{bus1,slot1},{bus2,slot2}...{busk,slotk}}
        !          1597: ;
        !          1598: ;  REFERENCES:  Nothing
        !          1599: ;
        !          1600: ;    MODIFIES:  Nothing
        !          1601: ;
        !          1602: ;*************************************************************************
        !          1603: 
        !          1604: [MCAFindBus]
        !          1605:     read-syms InitBaseVars
        !          1606:     set RegistryErrorIndex = NO_ERROR
        !          1607: 
        !          1608:     set MultifunctionAdapter = "HARDWARE\Description\System\MultifunctionAdapter"
        !          1609:     set InfoList = {}
        !          1610: 
        !          1611:     OpenRegKey $(!REG_H_LOCAL) "" $(MultifunctionAdapter) $(MAXIMUM_ALLOWED) KeyMultiAdapter
        !          1612: 
        !          1613:     Ifstr $(KeyMultiAdapter) == $(KeyNull)
        !          1614:         goto MCAFindBus_return
        !          1615:     endif
        !          1616: 
        !          1617:     EnumRegKey $(KeyMultiAdapter) BusList
        !          1618: 
        !          1619:     Debug-Output "Buslist"
        !          1620:     Debug-Output $(BusList)
        !          1621: 
        !          1622:     ForListDo $(BusList)
        !          1623:         set BusNum = *($($),1)
        !          1624:         set RegName = $(MultifunctionAdapter)"\"$(BusNum)
        !          1625:         Debug-Output "BusNum"
        !          1626:         Debug-Output $(BusNum)
        !          1627:         OpenRegKey $(!REG_H_LOCAL) "" $(RegName) $(MAXIMUM_ALLOWED) KeyBus
        !          1628: 
        !          1629:         ifstr $(KeyBus) != $(KeyNull)
        !          1630:             GetRegValue $(KeyBus),"Configuration Data",ConfigData
        !          1631:             ifstr $(ConfigData) != $(KeyNull)
        !          1632:                 set CardInfo = *($(ConfigData), 4 )
        !          1633:                 ;
        !          1634:                 ; Skip the header and jump to data position 33
        !          1635:                 ;
        !          1636:                 set Position = 33
        !          1637:                 set SlotNum = 1
        !          1638:                 QueryListSize ListSize $(CardInfo)
        !          1639: Loop1 =+
        !          1640:                 ifint $(Position) < $(ListSize)
        !          1641:                     set-add NextByte = $(Position), 1
        !          1642:                     ifint *($(CardInfo), $(Position)) == $($0)
        !          1643:                         ifint *($(CardInfo), $(NextByte)) == $($1)
        !          1644:                             ;
        !          1645:                             ; Set up the hardware
        !          1646:                             ;
        !          1647:                             Debug-Output $(BusNum)
        !          1648:                             Debug-Output $(SlotNum)
        !          1649:                             set-mul mcaid = $($1), 256
        !          1650:                             set-add mcaid = $(mcaid), $($0)
        !          1651:                             set InfoList = >($(InfoList),{$(BusNum),$(SlotNum),$(mcaid)})
        !          1652:                         endif
        !          1653:                     endif
        !          1654:                     set-add Position = $(Position), 6
        !          1655:                     set-add SlotNum = $(SlotNum), 1
        !          1656:                     goto Loop1
        !          1657:                 endif
        !          1658:             endif
        !          1659:             CloseRegKey $(KeyBus)
        !          1660:         endif
        !          1661:     EndForListDo
        !          1662: 
        !          1663:     CloseRegKey $(KeyMultiAdapter)
        !          1664: 
        !          1665: MCAFindBus_return = +
        !          1666: 
        !          1667:     return $(RegistryErrorIndex) $(InfoList)
        !          1668: 
        !          1669: ;*************************************************************************
        !          1670: ;  end of section  MCAFindBus
        !          1671: ;*************************************************************************
        !          1672: 
        !          1673: ;*************************************************************************
        !          1674: ;
        !          1675: ;     SECTION:   EISAFindBus
        !          1676: ;
        !          1677: ;     PURPOSE:   Find adpater(s) location
        !          1678: ;
        !          1679: ;   ARGUMENTS:   $0   The compress ID of the EISA card
        !          1680: ;                $1   EISA Compressed ID mask
        !          1681: ;
        !          1682: ;
        !          1683: ;    RETURNS:    $R0  Registry error code or zero if no error
        !          1684: ;                $R1  The list of adapter location
        !          1685: ;                       {{bus0,slot0},{bus1,slot1},{bus2,slot2}...{busk,slotk}}
        !          1686: ;
        !          1687: ;  REFERENCES:  Nothing
        !          1688: ;
        !          1689: ;    MODIFIES:  Nothing
        !          1690: ;
        !          1691: ;*************************************************************************
        !          1692: 
        !          1693: [EISAFindBus]
        !          1694:     read-syms InitBaseVars
        !          1695:     set MaskNum = $($1)
        !          1696:     ifstr(i) $($1) == ""
        !          1697:         set MaskNum = 16777215  ; 0xffffff
        !          1698:     endif
        !          1699: 
        !          1700:     set RegistryErrorIndex = NO_ERROR
        !          1701: 
        !          1702:     set EISAAdapter = "HARDWARE\Description\System\EISAAdapter"
        !          1703:     set InfoList = {}
        !          1704: 
        !          1705:     OpenRegKey $(!REG_H_LOCAL) "" $(EISAAdapter) $(MAXIMUM_ALLOWED) KeyEISAAdapter
        !          1706: 
        !          1707:     Ifstr $(KeyEISAAdapter) == $(KeyNull)
        !          1708:         goto EISAFindBus_return
        !          1709:     endif
        !          1710: 
        !          1711:     EnumRegKey $(KeyEISAAdapter) BusList
        !          1712: 
        !          1713:     Debug-Output "Buslist"
        !          1714:     Debug-Output $(BusList)
        !          1715: 
        !          1716:     ForListDo $(BusList)
        !          1717:         set BusNum = *($($),1)
        !          1718:         OpenRegKey $(!REG_H_LOCAL) "" $(EISAAdapter)"\"$(BusNum) $(MAXIMUM_ALLOWED) KeyEISAAdapterBus
        !          1719:         LibraryProcedure SlotList, $(!LIBHANDLE), GetEisaSlotInformation, $(KeyEISAAdapterBus), "Configuration Data", $($0), $(MaskNum)
        !          1720:         ifstr(i) $(SlotList) != {}
        !          1721:             ForListDo $(SlotList)
        !          1722:                 set SlotNum = $($)
        !          1723:                 ifstr(i) $(SlotNum) != "ERROR"
        !          1724:                     Debug-Output $(BusNum)
        !          1725:                     Debug-Output $(SlotNum)
        !          1726:                     set InfoList = >($(InfoList),{$(BusNum),$(SlotNum),$($0)})
        !          1727:                 endif
        !          1728:             EndForListDo
        !          1729:         endif
        !          1730:     EndForListDo
        !          1731: 
        !          1732:     CloseRegKey $(KeyEISAAdapter)
        !          1733: 
        !          1734: EISAFindBus_return = +
        !          1735: 
        !          1736:     return $(RegistryErrorIndex) $(InfoList)
        !          1737: 
        !          1738: ;*************************************************************************
        !          1739: ;  end of section  EISAFindBus
        !          1740: ;*************************************************************************
        !          1741: 
        !          1742: ;*************************************************************************
        !          1743: ;
        !          1744: ;     SECTION:   AddNetworkProvider
        !          1745: ;
        !          1746: ;     PURPOSE:   Add a network provider entry into the registry
        !          1747: ;
        !          1748: ;   ARGUMENTS:   $0   network provider id. i.e., lanmanredirector
        !          1749: ;                $1   network provder location. i.e, c:\nt\windows\system\ntlanman.dll
        !          1750: ;                $2   English name of the provider. i.e, NT Lan Manager
        !          1751: ;                $3   network provider device name, if different from network
        !          1752: ;                     provider
        !          1753: ;
        !          1754: ;
        !          1755: ;    RETURNS:    $R0  Registry error code or zero if no error
        !          1756: ;
        !          1757: ;  REFERENCES:  Nothing
        !          1758: ;
        !          1759: ;    MODIFIES:  Nothing
        !          1760: ;
        !          1761: ;*************************************************************************
        !          1762: 
        !          1763: [AddNetworkProvider]
        !          1764:     read-syms InitBaseVars
        !          1765: 
        !          1766:     set RegistryErrorIndex = NO_ERROR
        !          1767: 
        !          1768:     set ProviderDeviceName = $($3)
        !          1769:     ifstr(i) $(ProviderDeviceName) == ""
        !          1770:         set ProviderDeviceName = $($0)
        !          1771:     endif
        !          1772: 
        !          1773: ;    OpenRegKey $(!REG_H_LOCAL) "" $(CurrentControlSet)"\control\NetworkProvider\Active\"$($0) $(MAXIMUM_ALLOWED) ActiveKey
        !          1774: ;    ifstr(i) $(OrderKey) == $(KeyNull)
        !          1775: ;                 CreateRegKey $(!REG_H_LOCAL) {$(CurrentControlSet)"\control\NetworkProvider\Active\"$($0),$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" ActiveKey
        !          1776: ;    endif
        !          1777: 
        !          1778:     OpenRegKey $(!REG_H_LOCAL) "" $(CurrentControlSet)"\control\NetworkProvider\order" $(MAXIMUM_ALLOWED) OrderKey
        !          1779:     ifstr(i) $(OrderKey) == $(KeyNull)
        !          1780:                   CreateRegKey $(!REG_H_LOCAL) {$(CurrentControlSet)"\control\NetworkProvider\order",$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" OrderKey
        !          1781:     endif
        !          1782: 
        !          1783:     GetRegValue $(OrderKey) "ProviderOrder" OrderValue
        !          1784:     set Order = *($(OrderValue), 4 )
        !          1785:     ifstr(i) $(OrderValue) == $(KeyNull)
        !          1786:                 goto AddFirstProvider
        !          1787:     else-ifstr(i) $(Order) == $(KeyNull)
        !          1788:                 goto AddFirstProvider
        !          1789:     else
        !          1790:                 goto AddProvider
        !          1791:     endif
        !          1792: 
        !          1793: AddFirstProvider = +
        !          1794:     SetRegValue $(OrderKey) {ProviderOrder,$(NoTitle),$(!REG_VT_SZ),$($0)}
        !          1795:     goto WriteProviderInfo
        !          1796: 
        !          1797: AddProvider = +
        !          1798:     Split-String $(Order) "," OrderList
        !          1799:     ifContains(i) $($0) in $(OrderList)
        !          1800:         ; Enable if we cannot have the same provider
        !          1801:         ;
        !          1802:         ;set RegistryErrorIndex = PROVIDER_ALREADY_EXISTED
        !          1803:         ;goto AddnetworkProvider_return
        !          1804:     else
        !          1805:         set Order = $(Order)","$($0)
        !          1806:         SetRegValue $(OrderKey) {ProviderOrder,$(NoTitle),$(!REG_VT_SZ),$(Order)}
        !          1807:     endif
        !          1808: 
        !          1809:     goto WriteProviderInfo
        !          1810: 
        !          1811: WriteProviderInfo = +
        !          1812: 
        !          1813:     CloseRegKey $(OrderKey)
        !          1814: 
        !          1815:     OpenRegKey $(!REG_H_LOCAL) "" $(ServicesBaseName)"\"$($0)"\networkprovider" $(MAXIMUM_ALLOWED) ProviderKey
        !          1816: 
        !          1817:     Ifstr(i) $(ProviderKey) == $(KeyNull)
        !          1818:         CreateRegKey $(!REG_H_LOCAL) {$(ServicesBaseName)"\"$($0)"\networkprovider",$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" ProviderKey
        !          1819:     endif
        !          1820: 
        !          1821:     set NewValueList = {{Devicename,$(NoTitle),$(!REG_VT_SZ),"\device\"$(ProviderDeviceName)},+
        !          1822:                         {ProviderPath, $(NoTitle), $(!REG_VT_EXPAND_SZ), $($1)},+
        !          1823:                         {Name, $(NoTitle), $(!REG_VT_SZ), $($2)}}
        !          1824: 
        !          1825:     Shell "" AddValueList $(ProviderKey) $(NewValueList)
        !          1826: 
        !          1827:     CloseRegKey $(ProviderKey)
        !          1828: 
        !          1829: AddNetworkProvider_return = +
        !          1830: 
        !          1831:     return $(RegistryErrorIndex)
        !          1832: 
        !          1833: ;*************************************************************************
        !          1834: ;  end of section  AddNetworkProvider
        !          1835: ;*************************************************************************
        !          1836: 
        !          1837: ;*************************************************************************
        !          1838: ;
        !          1839: ;     SECTION:   RemoveNetworkProvider
        !          1840: ;
        !          1841: ;     PURPOSE:   Remove network provider entry
        !          1842: ;
        !          1843: ;   ARGUMENTS:   $0   provider name
        !          1844: ;
        !          1845: ;    RETURNS:    $R0  Registry error code or zero if no error
        !          1846: ;
        !          1847: ;  REFERENCES:  Nothing
        !          1848: ;
        !          1849: ;    MODIFIES:  Nothing
        !          1850: ;
        !          1851: ;*************************************************************************
        !          1852: 
        !          1853: [RemoveNetworkProvider]
        !          1854:     read-syms InitBaseVars
        !          1855: 
        !          1856:     set RegistryErrorIndex = NO_ERROR
        !          1857: 
        !          1858:     OpenRegKey $(!REG_H_LOCAL) "" $(CurrentControlSet)"\control\NetworkProvider\order" $(MAXIMUM_ALLOWED) OrderKey
        !          1859:     ifstr(i) $(OrderKey) == $(KeyNull)
        !          1860:         set RegistryErrorIndex = PROVIDER_ORDER_DOES_NOT_EXIST
        !          1861:         goto RemoveNetworkProvider_return
        !          1862:     endif
        !          1863: 
        !          1864:     GetRegValue $(OrderKey) "ProviderOrder" OrderValue
        !          1865:     set Order = *($(OrderValue), 4 )
        !          1866: 
        !          1867:     Split-String $(Order) "," OrderList
        !          1868:     set NewOrderList = {}
        !          1869:     set FirstTime = TRUE
        !          1870:     set Found = FALSE
        !          1871:     ForListDo $(OrderList)
        !          1872:         ifstr(i) $($) != ","
        !          1873:             ifstr(i) $($) != $($0)
        !          1874:                 ifstr(i) $(FirstTime) == TRUE
        !          1875:                     set FirstTime = FALSE
        !          1876:                     set NewOrderList = $($)
        !          1877:                 else
        !          1878:                     set NewOrderList = $(NewOrderList)","$($)
        !          1879:                 endif
        !          1880:             else
        !          1881:                 set Found = TRUE
        !          1882:             endif
        !          1883:         endif
        !          1884:     EndForListDo
        !          1885: 
        !          1886:     ifstr(i) $(Found) == FALSE
        !          1887:         set RegistryErrorIndex = PROVIDER_ORDER_DOES_NOT_EXIST
        !          1888:         goto RemoveNetworkProvider_return
        !          1889:     else
        !          1890:         ifstr(i) $(NewOrderList) == {}
        !          1891:             set NewOrderList = ""
        !          1892:         endif
        !          1893:         SetRegValue $(OrderKey) {ProviderOrder,$(NoTitle),$(!REG_VT_SZ),$(NewOrderList)}
        !          1894:     endif
        !          1895: 
        !          1896:     OpenRegKey $(!REG_H_LOCAL) "" $(ServicesBaseName) $(MAXIMUM_ALLOWED) ProviderKey
        !          1897: 
        !          1898:     ifstr $(ProviderKey) != $(KeyNull)
        !          1899:         DeleteRegTree $(ProviderKey) $($0)
        !          1900:     endif
        !          1901: 
        !          1902: RemoveNetworkProvider_return = +
        !          1903:     return $(RegistryErrorIndex)
        !          1904: 
        !          1905: ;*************************************************************************
        !          1906: ;
        !          1907: ;     SECTION:   PrepareToCopy
        !          1908: ;
        !          1909: ;     PURPOSE:   Establish the variables required to perform
        !          1910: ;                "CopyFilesInCopyList"
        !          1911: ;
        !          1912: ;   ARGUMENTS:   none
        !          1913: ;
        !          1914: ;     RETURNS:   $R0    STATUS_SUCCESSFUL
        !          1915: ;
        !          1916: ;  REFERENCES:   nothing
        !          1917: ;
        !          1918: ;    MODIFIES:   see [ProgressCopyEng] above for list of variables
        !          1919: ;                modified/created in parent context.
        !          1920: ;
        !          1921: ;       NOTES:   Read NOTES commentary for section [DoAskSource]
        !          1922: ;
        !          1923: ;*************************************************************************
        !          1924: [PrepareToCopy]
        !          1925: ;
        !          1926: ; Read the progress copy symbols.
        !          1927: ;
        !          1928:     Read-syms ProgressCopy$(!STF_LANGUAGE)
        !          1929: 
        !          1930:     Return STATUS_SUCCESSFUL
        !          1931: 
        !          1932: ;*************************************************************************
        !          1933: ;  end of section PrepareToCopy
        !          1934: ;*************************************************************************
        !          1935: 
        !          1936: 
        !          1937: ;*************************************************************************
        !          1938: ;
        !          1939: ;     SECTION:   DoAskSource
        !          1940: ;
        !          1941: ;     PURPOSE:   Determine or ask to location of the network binaries
        !          1942: ;
        !          1943: ;   ARGUMENTS:   $0   current value of STF_CWDDIR
        !          1944: ;                $1   current value of STF_SRCDIR
        !          1945: ;                $2   "YES" if part of NT base product (i.e., not OEM)
        !          1946: ;                     "NO" otherwise.
        !          1947: ;
        !          1948: ;    RETURNS:    $R0: STATUS:  STATUS_SUCCESSFUL |
        !          1949: ;                              STATUS_USERCANCEL |
        !          1950: ;                              STATUS_FAILED
        !          1951: ;                $R1  path to sources
        !          1952: ;
        !          1953: ;  REFERENCES:   Nothing
        !          1954: ;
        !          1955: ;    MODIFIES:   !STF_SRCDIR_USED       changed to point to the user's
        !          1956: ;                                       keyed location
        !          1957: ;                !STF_SRCDIR_KEYED
        !          1958: ;
        !          1959: ;       NOTES:   The SETUP copy operations read the symbol table the old way;
        !          1960: ;                this means that they will only utilize local symbols for
        !          1961: ;                the necessary progress variables.  This section/function assumes
        !          1962: ;                that it's being called by an INF at THE EXACT SAME CONTEXT LEVEL
        !          1963: ;                AT WHICH THE INSTALL FUNCTION WILL BE INVOKED!  It stores the
        !          1964: ;                values specifically into the parent context so the progress dialog
        !          1965: ;                function can see them.
        !          1966: ;
        !          1967: ;*************************************************************************
        !          1968: [DoAskSource]
        !          1969:     Set DAS_CWDDIR  = $($0)
        !          1970:     Set DAS_SRCDIR  = $($1)
        !          1971:     Set DAS_BUILTIN = $($2)
        !          1972:     Set DAS_Result  = STATUS_FAILED
        !          1973: ;
        !          1974: ;  If !STF_SRCDIR_OVERRIDE is not empty, use it instead.
        !          1975: ;
        !          1976:     Ifstr(i) $(!STF_SRCDIR_OVERRIDE) != ""
        !          1977:         Set DAS_SRCDIR = $(!STF_SRCDIR_OVERRIDE)
        !          1978:         Set DAS_Result = STATUS_SUCCESSFUL
        !          1979:         Goto DAS_exit
        !          1980:     Endif
        !          1981: ;
        !          1982: ;  If this is a built-in component during primary installation,
        !          1983: ;  use the given source path automatically unless !SFT_SRCDIR_WINNT
        !          1984: ;  is set.   This is for the WINNT case, where Setup's SourcePath lies.
        !          1985: ;
        !          1986:     Ifstr(i) $(DAS_BUILTIN) == YES
        !          1987:         Ifstr(i) $(!NTN_InstallPhase) == primary
        !          1988:             Ifstr(i) $(!STF_SRCDIR_WINNT) != ""
        !          1989:                 Set DAS_SRCDIR = $(!STF_SRCDIR_WINNT)
        !          1990:             Endif
        !          1991:             Set DAS_Result = STATUS_SUCCESSFUL
        !          1992:             Goto DAS_exit
        !          1993:         Endif
        !          1994:     Endif
        !          1995: 
        !          1996:     Debug-Output "UTILITY.INF: [DoAskSource] STF_CWDDIR = "$(DAS_CWDDIR)" STF_SRCDIR = "$(DAS_SRCDIR)
        !          1997: ;
        !          1998: ; Set default to drive A: if necessary
        !          1999: ;
        !          2000:     Ifstr(i) $(DAS_SRCDIR) == ""
        !          2001:         Set DAS_SRCDIR = "A:\"
        !          2002:     Endif
        !          2003: ;
        !          2004: ; If this is the same SRCDIR as last time, replace it with the string
        !          2005: ; actually keyed by the user.  This causes UNC names to reappear in their
        !          2006: ; original form; the name of the automatically "used" remote drive should
        !          2007: ; never be shown.
        !          2008: ;
        !          2009:     Ifstr(i) $(DAS_SRCDIR) == $(!STF_SRCDIR_USED)
        !          2010:         Set DAS_SRCDIR = $(!STF_SRCDIR_KEYED)
        !          2011:     Endif
        !          2012: ;
        !          2013: ; Ask for the setup sources
        !          2014: ;
        !          2015:     Shell "subroutn.inf" DoAskSource $(DAS_SRCDIR)
        !          2016: 
        !          2017:     ifint $($ShellCode) != $(!SHELL_CODE_OK)
        !          2018:         Debug-Output "UTILITY.INF: shelling SUBROUTN.INF [DoAskSource] failed"
        !          2019:         goto DAS_exit
        !          2020:     endif
        !          2021: 
        !          2022:     Set DAS_Result = $($R0)
        !          2023: 
        !          2024:     Ifstr(i) $(DAS_Result) == STATUS_USERCANCEL
        !          2025:         ;
        !          2026:         ; BUGBUG:  All the INFs should change to handle this correctly.
        !          2027:         ;
        !          2028:         Set !p:CommonStatus = STATUS_USERCANCEL
        !          2029:         goto DAS_exit
        !          2030:     Endif
        !          2031: 
        !          2032:     Set DAS_SRCDIR = $($R1)
        !          2033: ;
        !          2034: ; Save the actual and converted SRCDIRs
        !          2035: ;
        !          2036:     Set !STF_SRCDIR_USED = $($R1)
        !          2037:     Set !STF_SRCDIR_KEYED = $($R3)
        !          2038: 
        !          2039: DAS_exit =+
        !          2040: ;
        !          2041: ; Read the progress copy symbols.
        !          2042: ;
        !          2043:     Read-syms ProgressCopy$(!STF_LANGUAGE)
        !          2044: 
        !          2045:     Return $(DAS_Result) $(DAS_SRCDIR)
        !          2046: 
        !          2047: ;*************************************************************************
        !          2048: ;  end of section  DoAskSource
        !          2049: ;*************************************************************************
        !          2050: 
        !          2051: ;*************************************************************************
        !          2052: ;
        !          2053: ;     SECTION:   RemoveSoftwareComponent
        !          2054: ;
        !          2055: ;     PURPOSE:   Remove the specified software component from the
        !          2056: ;                registry. It will remove the entry in the software
        !          2057: ;                section of the registry first. Then it will remove
        !          2058: ;                the entry in the service section of the registry.
        !          2059: ;
        !          2060: ;   ARGUMENTS:   $0   Manufacturer Name
        !          2061: ;                $1   Product Name
        !          2062: ;                $2   Boolean flag for zero reference count checking
        !          2063: ;                     ( optional. If it is defined, skip checking )
        !          2064: ;
        !          2065: ;
        !          2066: ;    RETURNS:    $R0  Registry error code or zero if no error
        !          2067: ;
        !          2068: ;  REFERENCES:  Nothing
        !          2069: ;
        !          2070: ;    MODIFIES:  Nothing
        !          2071: ;
        !          2072: ;*************************************************************************
        !          2073: 
        !          2074: [RemoveSoftwareComponent]
        !          2075:     Debug-Output "Remove Software Component..."
        !          2076: 
        !          2077:     read-syms InitBaseVars
        !          2078: 
        !          2079:     set RS_Manufacturer = $($0)
        !          2080:     set RS_ProductName  = $($1)
        !          2081:     set RS_CheckRefCount = $($2)
        !          2082:     set RS_VersionNum   = "CurrentVersion"
        !          2083:     set RS_ManufacturerKey = $(!NTN_SoftwareBase)"\"$(RS_Manufacturer)
        !          2084:     set RS_ProductKey   = $(!NTN_SoftwareBase)"\"$(RS_Manufacturer)"\"$(RS_ProductName)
        !          2085:     set RS_ProductVerKey        = $(!NTN_SoftwareBase)"\"$(RS_Manufacturer)"\"$(RS_ProductName)"\"$(RS_VersionNum)
        !          2086: 
        !          2087:     set RegistryErrorIndex      = NO_ERROR
        !          2088: 
        !          2089:     ;
        !          2090:     ; Check the reference counter first
        !          2091:     ;
        !          2092:     ifstr(i) $(RS_CheckRefCount) != FALSE
        !          2093: 
        !          2094:         Shell "", IsRefCountEqualZero, $(RS_ProductVerKey)
        !          2095: 
        !          2096:         Ifstr(i) $($R0) != NO_ERROR
        !          2097:             Debug-Output "UTILITY.INF: [RemoveSoftwareComponent] IsRefCountEqualZero returned "$($R0)
        !          2098:             goto RemoveSoftwareComponent_Return
        !          2099:         endif
        !          2100: 
        !          2101:         Ifint $($R1) == 0
        !          2102:             set RegistryErrorIndex = REF_COUNT_NOT_ZERO
        !          2103:             goto RemoveSoftwareComponent_Return
        !          2104:         endif
        !          2105: 
        !          2106:     endif
        !          2107: 
        !          2108:     ;
        !          2109:     ; Remove the software first
        !          2110:     ;
        !          2111: 
        !          2112:     OpenRegKey $(!REG_H_LOCAL) "" $(RS_ManufacturerKey) $(MAXIMUM_ALLOWED) ProductKey
        !          2113: 
        !          2114:     Ifstr $(ProductKey) == $(KeyNull)
        !          2115:        Debug-Output "UTILITY.INF: could not open Software product key"
        !          2116:        set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
        !          2117:        goto RemoveSoftwareComponent_Return
        !          2118:     endif
        !          2119: 
        !          2120:     DeleteRegTree $(ProductKey) $(RS_ProductName)
        !          2121: 
        !          2122:     CloseRegKey $(ProductKey)
        !          2123: 
        !          2124:     ;
        !          2125:     ; Remove the service
        !          2126:     ;
        !          2127:     Shell "" RemoveService, $(RS_ProductName), "YES"
        !          2128: 
        !          2129:     Set RS_RemoveError = $($R0)
        !          2130:     Ifint $(RS_RemoveError) != 0
        !          2131:          Debug-Output "UTILITY.INF: RemoveService wrapper failed, error: "$(RS_RemoveResult)
        !          2132:          Set RegistryErrorIndex = UNABLE_REMOVE_CONFIGURE_SERVICE
        !          2133:          Goto RemoveSoftwareComponent_Return
        !          2134:     Endif
        !          2135: 
        !          2136: RemoveSoftwareComponent_Return = +
        !          2137: 
        !          2138:     Return $(RegistryErrorIndex)
        !          2139: 
        !          2140: ;*************************************************************************
        !          2141: ;  end of section  RemoveSoftwareComponent
        !          2142: ;*************************************************************************
        !          2143: 
        !          2144: ;*************************************************************************
        !          2145: ;
        !          2146: ;     SECTION:   RemoveHardwareComponent
        !          2147: ;
        !          2148: ;     PURPOSE:   Remove the adapter entry from the registry. First
        !          2149: ;                remove the adapter entry under Networkcards. Then it
        !          2150: ;                will remove the service entry under SYSTEM.
        !          2151: ;
        !          2152: ;   ARGUMENTS:   $0   Manufacturer Name (i.e., 3Com)
        !          2153: ;                $1   Product Name (i.e., Elnk)
        !          2154: ;                $2   Net Card Name (i.e., Elnkii05)
        !          2155: ;
        !          2156: ;
        !          2157: ;    RETURNS:    $R0  Registry error code or zero if no error
        !          2158: ;
        !          2159: ;  REFERENCES:  Nothing
        !          2160: ;
        !          2161: ;    MODIFIES:  Nothing
        !          2162: ;
        !          2163: ;*************************************************************************
        !          2164: 
        !          2165: [RemoveHardwareComponent]
        !          2166:     Debug-Output "Remove Hardware Component..."
        !          2167:     read-syms InitBaseVars
        !          2168: 
        !          2169:     set RH_Manufacturer = $($0)
        !          2170:     set RH_ProductName  = $($1)
        !          2171:     set RH_VersionNum   = "CurrentVersion"
        !          2172:     set RH_ProductKey   = $(!NTN_SoftwareBase)"\"$($0)"\"$($1)"\"$(RH_VersionNum)
        !          2173:     set RH_NetCardName  = $($2)
        !          2174:     Split-String $(RH_NetCardName), "\", CardInfo
        !          2175:     set RH_NetCardNum   = *($(CardInfo),11)
        !          2176:     set RH_NetCardBase  = *($(CardInfo),1)*($(CardInfo),2)*($(CardInfo),3)*($(CardInfo),4)*($(CardInfo),5)*($(CardInfo),6)*($(CardInfo),7)*($(CardInfo),8)*($(CardInfo),9)
        !          2177: 
        !          2178:     set RegistryErrorIndex      = NO_ERROR
        !          2179: 
        !          2180:     ;
        !          2181:     ; decrement the reference counter first
        !          2182:     ;
        !          2183: 
        !          2184:     Shell "", DecrementRefCount, $(RH_ProductKey)
        !          2185: 
        !          2186:     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        !          2187:         Debug-Output "UTILITY.INF: [AddHardwareComponent] IncrementRefCount returned "$(RegistryErrorIndex)
        !          2188:         goto RemoveHardwareComponent_Return
        !          2189:     endif
        !          2190: 
        !          2191:     ;
        !          2192:     ; Remove the Net card first
        !          2193:     ;
        !          2194: 
        !          2195:     OpenRegKey $(!REG_H_LOCAL) "" $(RH_NetCardBase) $(MAXIMUM_ALLOWED) NetCardKey
        !          2196: 
        !          2197:     Ifstr $(NetCardKey) == $(KeyNull)
        !          2198:        Debug-Output "UTILITY.INF: could not open NetworkCards key"
        !          2199:        set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
        !          2200:        goto RemoveHardwareComponent_Return
        !          2201:     endif
        !          2202: 
        !          2203:     OpenRegKey $(NetCardKey) "" $(RH_NetCardNum) $(MAXIMUM_ALLOWED) NetCardNumKey
        !          2204: 
        !          2205:     Ifstr $(NetCardNumKey) == $(KeyNull)
        !          2206:        Debug-Output "UTILITY.INF: could not open NetworkCards Number key"
        !          2207:        set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
        !          2208:        goto RemoveHardwareComponent_Return
        !          2209:     endif
        !          2210: 
        !          2211:     GetRegValue $(NetCardNumKey),"ServiceName", RH_ServiceNameInfo
        !          2212:     set RH_ServiceName = *($(RH_ServiceNameInfo), 4)
        !          2213: 
        !          2214:     ifstr(i) $(RH_ServiceName) == ""
        !          2215:         ; if we cannot get the service name, make a guess
        !          2216:         set RH_ServiceName = $(RH_ProductName)$(RH_NetCardNum)
        !          2217:     endif
        !          2218: 
        !          2219:     CloseRegKey $(NetCardNumKey)
        !          2220: 
        !          2221:     DeleteRegTree $(NetCardKey) $(RH_NetCardNum)
        !          2222: 
        !          2223:     CloseRegKey $(NetCardKey)
        !          2224: 
        !          2225:     Shell "", RemoveService, $(RH_ServiceName), "NO"
        !          2226: 
        !          2227:     Set RS_RemoveError = $($R0)
        !          2228:     Ifint $(RS_RemoveError) != 0
        !          2229:          Debug-Output "UTILITY.INF: RemoveService wrapper failed, error: "$(RS_RemoveResult)
        !          2230:          Set RegistryErrorIndex = UNABLE_REMOVE_CONFIGURE_SERVICE
        !          2231:          Goto RemoveHardwareComponent_Return
        !          2232:     Endif
        !          2233: 
        !          2234: 
        !          2235:     ;
        !          2236:     ; If driver reference count is equal to 0, remove it.
        !          2237:     ;
        !          2238: 
        !          2239:     Shell "", IsRefCountEqualZero, $(RH_ProductKey)
        !          2240: 
        !          2241:     Ifstr(i) $($R0) != NO_ERROR
        !          2242:         Debug-Output "UTILITY.INF: [RemoveHardwareComponent] IsRefCountEqualZero returned "$($R0)
        !          2243:         goto RemoveHardwareComponent_Return
        !          2244:     endif
        !          2245: 
        !          2246:     Ifint $($R1) == 1
        !          2247:         Debug-Output "Remove software component..."
        !          2248:         Shell "" RemoveSoftwareComponent, $(RH_Manufacturer), $(RH_ProductName)
        !          2249:         set RegistryErrorIndex = $($R0)
        !          2250:     endif
        !          2251: 
        !          2252:     debug-output "remove netbios information..."
        !          2253:     LibraryProcedure Result, $(!NCPA_HANDLE), RemoveRouteFromNETBIOS, $(RH_ServiceName)
        !          2254: 
        !          2255: RemoveHardwareComponent_Return = +
        !          2256: 
        !          2257:     Return $(RegistryErrorIndex)
        !          2258: 
        !          2259: ;*************************************************************************
        !          2260: ;  end of section  RemoveHardwareComponent
        !          2261: ;*************************************************************************
        !          2262: 
        !          2263: ;*************************************************************************
        !          2264: ;
        !          2265: ;     SECTION:   RemoveService
        !          2266: ;
        !          2267: ;     PURPOSE:   Remove a specified service from the registry. It is
        !          2268: ;                called by RemoveSoftwareComponent and
        !          2269: ;                RemoveHardwareComponent. Or, if the service is
        !          2270: ;                created by calling "CreateService", we will
        !          2271: ;                need to use this subroutine to remove it.
        !          2272: ;
        !          2273: ;   ARGUMENTS:   $0   Service Name
        !          2274: ;                $1   "YES" - we use DeleteService to remove the service
        !          2275: ;                     "NO"  - we use DeleteRegTree to remove the
        !          2276: ;                             registry tree
        !          2277: ;
        !          2278: ;    RETURNS:    $R0  Registry error code or zero if no error
        !          2279: ;
        !          2280: ;  REFERENCES:  Nothing
        !          2281: ;
        !          2282: ;    MODIFIES:  Nothing
        !          2283: ;
        !          2284: ;*************************************************************************
        !          2285: 
        !          2286: [RemoveService]
        !          2287:     read-syms InitBaseVars
        !          2288:     Set RS_SvcName = $($0)
        !          2289:     Set RS_UseDelSvc = $($1)
        !          2290: 
        !          2291:     ; Make sure the service key exists first.
        !          2292: 
        !          2293:     OpenRegKey $(!REG_H_LOCAL) "" "SYSTEM\CurrentControlSet\Services\"$(RS_SvcName) +
        !          2294:         $(MAXIMUM_ALLOWED) ServiceKey
        !          2295: 
        !          2296:     Ifstr $(ServiceKey) == $(KeyNull)
        !          2297:         Debug-Output "UTILITY.INF: could not open SYSTEM Service key "$(RS_SvcName)
        !          2298:         goto RemoveService_Return
        !          2299:     endif
        !          2300: 
        !          2301:     ; Remove the NbProvider value if it exists
        !          2302: 
        !          2303:     OpenRegKey $(ServiceKey) "" "Parameters" $(MAXIMUM_ALLOWED) ParameterKey
        !          2304: 
        !          2305:     Ifstr $(ParameterKey) != $(KeyNull)
        !          2306:          DeleteRegValue $(ParameterKey) "NbProvider"
        !          2307:          CloseRegKey $(ParameterKey)
        !          2308:     Endif
        !          2309: 
        !          2310:     CloseRegKey $(ServiceKey)
        !          2311: 
        !          2312:     ifstr(i) $(RS_UseDelSvc) == "YES"
        !          2313: 
        !          2314:         ; Remove the service
        !          2315: 
        !          2316:         Set FLibraryErrCtl = 1
        !          2317:         LibraryProcedure RS_RemoveResult $(!NCPA_HANDLE), CPlSetup, +
        !          2318:           $(!STF_HWND), DELETESVC, $(RS_SvcName)
        !          2319:         Set FLibraryErrCtl = 0
        !          2320: 
        !          2321:         ; Check the return code
        !          2322: 
        !          2323:         Set RS_RemoveError = *($(RS_RemoveResult),1)
        !          2324:         Ifint $(RS_RemoveError) != 0
        !          2325:              Debug-Output "UTILITY.INF: RemoveService wrapper failed, error: "$(RS_RemoveResult)
        !          2326:              Set RegistryErrorIndex = UNABLE_REMOVE_CONFIGURE_SERVICE
        !          2327:              Goto RemoveService_Return
        !          2328:         Endif
        !          2329: 
        !          2330:     else
        !          2331: 
        !          2332:         OpenRegKey $(!REG_H_LOCAL) "" "SYSTEM\CurrentControlSet\Services" +
        !          2333:         $(MAXIMUM_ALLOWED) ServiceKey
        !          2334: 
        !          2335:         Ifstr $(ServiceKey) == $(KeyNull)
        !          2336:            Debug-Output "UTILITY.INF: could not open SYSTEM Service key "$(RS_SvcName)
        !          2337:            set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
        !          2338:            goto RemoveService_Return
        !          2339:         endif
        !          2340: 
        !          2341:         DeleteRegTree $(ServiceKey) $(RS_SvcName)
        !          2342: 
        !          2343:         CloseRegKey $(ServiceKey)
        !          2344: 
        !          2345:     endif
        !          2346: 
        !          2347: RemoveService_Return = +
        !          2348:     return $(RegistryErrorIndex)
        !          2349: 
        !          2350: ;*************************************************************************
        !          2351: ;  end of section  RemoveService
        !          2352: ;*************************************************************************
        !          2353: 
        !          2354: ;*************************************************************************
        !          2355: ;
        !          2356: ;     SECTION:   IsNetCardAlreadyInstalled
        !          2357: ;
        !          2358: ;     PURPOSE:   This subroutine is called by EISA and MCA net card
        !          2359: ;                setup. Given the bus number and slot number, it will
        !          2360: ;                return a boolean to idicate whether the card is
        !          2361: ;                already installed or not.
        !          2362: ;
        !          2363: ;   ARGUMENTS:   $0   Bus Number
        !          2364: ;                $1   Slot Number
        !          2365: ;                $2   Product Description
        !          2366: ;                $3   Product Name
        !          2367: ;
        !          2368: ;    RETURNS:    $R0  Registry error code or zero if no error
        !          2369: ;                $R1  "YES" - if the net card already installed
        !          2370: ;                     "NO"  - if the net card is not in the registry
        !          2371: ;
        !          2372: ;  REFERENCES:  Nothing
        !          2373: ;
        !          2374: ;    MODIFIES:  Nothing
        !          2375: ;
        !          2376: ;*************************************************************************
        !          2377: 
        !          2378: [IsNetCardAlreadyInstalled]
        !          2379:     read-syms InitBaseVars
        !          2380: 
        !          2381:     set AlreadyExisted  = "NO"
        !          2382: 
        !          2383:     set BusNum  = $($0)
        !          2384:     set SlotNum = $($1)
        !          2385:     set Description = $($2)
        !          2386:     set Product = $($3)
        !          2387: 
        !          2388:     OpenRegKey $(!REG_H_LOCAL) "" $(NetworkCardKeyName) $(MAXIMUM_ALLOWED) IE_KeyNetcards
        !          2389: 
        !          2390:     Ifstr $(IE_KeyNetcards) == $(KeyNull)
        !          2391:        set RegistryErrorIndex = UNABLE_OPEN_NETWORKCARD_SECTION
        !          2392:        goto IE_Return
        !          2393:     endif
        !          2394: 
        !          2395:     EnumRegKey $(IE_KeyNetcards) IE_KeyNameList
        !          2396: 
        !          2397:     ;
        !          2398:     ; Compare all the NetworkCards entry and see whether they have the
        !          2399:     ; same title and productname.
        !          2400:     ;
        !          2401:     ForListDo  $(IE_KeyNameList)
        !          2402:         set IE_KeyName = *($($),1)
        !          2403:         OpenRegKey $(IE_KeyNetcards) "" $(IE_KeyName) $(MAXIMUM_ALLOWED) IE_Card
        !          2404: 
        !          2405:         Ifstr $(IE_Card) == $(KeyNull)
        !          2406:            set RegistryErrorIndex = UNABLE_OPEN_NETWORKCARD_SECTION
        !          2407:            goto IE_Return
        !          2408:         endif
        !          2409: 
        !          2410:         GetRegValue $(IE_Card),"Description", DescriptionInfo
        !          2411:         GetRegValue $(IE_Card),"ProductName", ProductNameInfo
        !          2412:         set CardDescription     = *($(DescriptionInfo), 4)
        !          2413:         set CardProductName     = *($(ProductNameInfo), 4)
        !          2414: 
        !          2415:         ifstr(i) $(CardDescription) == $(Description)
        !          2416:             ifstr(i) $(CardProductName) == $(Product)
        !          2417: 
        !          2418:                 ;
        !          2419:                 ; We find the same product type. make sure that it
        !          2420:                 ; does not have the same bus number and slot number
        !          2421:                 ;
        !          2422: 
        !          2423:                 GetRegValue $(IE_Card), "ServiceName", ServiceNameInfo
        !          2424:                 set ServiceName = *($(ServiceNameInfo), 4)
        !          2425: 
        !          2426:                 OpenRegKey $(!REG_H_LOCAL) "" +
        !          2427:                    $(ServicesBaseName)"\"$(ServiceName)"\Parameters" +
        !          2428:                    $(MAXIMUM_ALLOWED) IE_KeyService
        !          2429: 
        !          2430:                 Ifstr $(IE_KeyService) == $(KeyNull)
        !          2431:                    set RegistryErrorIndex = UNABLE_OPEN_NETWORKCARD_SECTION
        !          2432:                    goto IE_Return
        !          2433:                 endif
        !          2434: 
        !          2435:                 GetRegValue $(IE_KeyService), "BusNumber", BusInfo
        !          2436:                 GetRegValue $(IE_KeyService), "SlotNumber", SlotInfo
        !          2437:                 set CardBusNum = *($(BusInfo), 4)
        !          2438:                 set CardSlotNum = *($(SlotInfo), 4)
        !          2439: 
        !          2440:                 ifint $(CardBusNum) == $(BusNum)
        !          2441:                     ifint $(CardSlotNum) == $(SlotNum)
        !          2442:                         ;
        !          2443:                         ; Don't install this card. It is already installed
        !          2444:                         ;
        !          2445:                         set AlreadyExisted = "YES"
        !          2446:                     endif
        !          2447:                 endif
        !          2448: 
        !          2449:             endif
        !          2450:         endif
        !          2451:     EndForListDo
        !          2452: 
        !          2453: IE_Return = +
        !          2454:     return $(RegistryErrorIndex) $(AlreadyExisted)
        !          2455: 
        !          2456: ;*************************************************************************
        !          2457: ;  end of section  IsNetCardAlreadyInstalled
        !          2458: ;*************************************************************************
        !          2459: 
        !          2460: ;*************************************************************************
        !          2461: ;
        !          2462: ;     SECTION:   UpdateWinsockService
        !          2463: ;
        !          2464: ;     PURPOSE:   This section creates, if necessary, the WinSock
        !          2465: ;                service data object.  This Registry key is a placeholder
        !          2466: ;                for all WinSock mapping information.  In particular,
        !          2467: ;                it contains a value called Transports, which contains
        !          2468: ;                a REG_MULTI_SZ listing the names of all transports
        !          2469: ;                which export a sockets interface (through a DLL).
        !          2470: ;
        !          2471: ;                Then, we either add or remove the name of this transport
        !          2472: ;                from the list.
        !          2473: ;
        !          2474: ;   ARGUMENTS:   $0   Name of Transport Service supporting WinSock
        !          2475: ;                $1   TRUE if adding data; FALSE if removing data
        !          2476: ;
        !          2477: ;     RETURNS:   $R0  Registry error code or zero if no error
        !          2478: ;
        !          2479: ;  REFERENCES:   none
        !          2480: ;
        !          2481: ;    MODIFIES:   none
        !          2482: ;
        !          2483: ;
        !          2484: ;*************************************************************************
        !          2485: [UpdateWinsockService]
        !          2486:     read-syms InitBaseVars
        !          2487: ;
        !          2488: ;  Get the base key handle for the services area
        !          2489: ;
        !          2490:     Set UW_NameOfService = $($0)
        !          2491:     Set UW_Adding        = $($1)
        !          2492:     Set UW_KeyServices   = $(KeyNull)
        !          2493:     Set UW_KeyParameters = $(KeyNull)
        !          2494: 
        !          2495:     Shell "", BaseServiceKey
        !          2496:     Set RegistryErrorIndex = $($R0)
        !          2497:     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        !          2498:        Set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
        !          2499:        Goto U_W_Return
        !          2500:     endif
        !          2501:     Set UW_KeyServices = $($R1)
        !          2502: 
        !          2503:     OpenRegKey $(UW_KeyServices) "" "WinSock\Parameters" $(MAXIMUM_ALLOWED) UW_KeyParameters
        !          2504: 
        !          2505:     Ifstr(i) $(UW_KeyParameters) == $(KeyNull)
        !          2506:         Debug-Output "UTILITY.INF:  Create WinSock Service"
        !          2507:         Shell "", CreateService, "WinSock", "", "", "adapter", "", {}
        !          2508:         Set RegistryErrorIndex = $($R0)
        !          2509:         Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        !          2510:             Debug-Output "UTILITY.INF: CreateService for WinSock returned "$(RegistryErrorIndex)
        !          2511:             Goto U_W_Return
        !          2512:         Endif
        !          2513:         CloseRegKey $($R1)
        !          2514:         Set UW_KeyParameters = $($R2)
        !          2515:         CloseRegKey $($R3)
        !          2516:     Else
        !          2517:         Debug-Output "UTILITY.INF:  Open WinSock Service"
        !          2518:     Endif
        !          2519: 
        !          2520:     Ifstr(i) $(UW_KeyParameters) == $(KeyNull)
        !          2521:         Set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
        !          2522:         Goto U_W_Return
        !          2523:     Endif
        !          2524: ;
        !          2525: ;  Get the old REG_MULTI_SZ containing the list of supported transports;
        !          2526: ;   add the new transport service name to the list or remove it.
        !          2527: ;
        !          2528:     GetRegValue $(UW_KeyParameters) "Transports" UW_TransportsValue
        !          2529:     Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
        !          2530:         Set UW_TransportsList = *($(UW_TransportsValue), 4)
        !          2531:     Else
        !          2532:         Set UW_TransportsList = {}
        !          2533:     Endif
        !          2534: 
        !          2535:     Ifstr(i) $(UW_TransportsList) == ""
        !          2536:         Set UW_TransportsList = {}
        !          2537:     Endif
        !          2538: ;
        !          2539: ;  If we're removing the transport, do so; else, append it to the
        !          2540: ;   end of the list.
        !          2541: ;
        !          2542:     Ifstr(i) $(UW_Adding) == "TRUE"
        !          2543:         Set UW_TransportsList = >($(UW_TransportsList), $(UW_NameOfService))
        !          2544:     Else
        !          2545:         Set UW_NewList = {}
        !          2546:         ForListDo $(UW_TransportsList)
        !          2547:             Ifstr(i) $($) != $(UW_NameOfService)
        !          2548:                 Set UW_NewList = >($(UW_NewList), $($))
        !          2549:             Endif
        !          2550:         EndForListDo
        !          2551:         Set UW_TransportsList = $(UW_NewList)
        !          2552:     Endif
        !          2553: 
        !          2554:     SetRegValue $(UW_KeyParameters) {Transports, $(NoTitle), $(!REG_VT_MULTI_SZ), $(UW_TransportsList)}
        !          2555: 
        !          2556:     Debug-Output "UTILITY.INF:  WinSock transport info added/deleted for "$(UW_NameOfService)
        !          2557: 
        !          2558: U_W_Return = +
        !          2559:     Ifstr $(UW_KeyParameters) != $(KeyNull)
        !          2560:         CloseRegKey $(UW_KeyParameters)
        !          2561:     Endif
        !          2562:     Ifstr $(UW_KeyServices) != $(KeyNull)
        !          2563:         CloseRegKey $(UW_KeyServices)
        !          2564:     Endif
        !          2565: 
        !          2566:     Return $(RegistryErrorIndex)
        !          2567: 
        !          2568: ;*************************************************************************
        !          2569: ;  end of section UpdateWinsockService
        !          2570: ;*************************************************************************
        !          2571: 
        !          2572: ;*************************************************************************
        !          2573: ;
        !          2574: ;     SECTION:   AddWinsockInfo
        !          2575: ;
        !          2576: ;     PURPOSE:   This function adds WinSock sockets provider info
        !          2577: ;                to a transport.
        !          2578: ;
        !          2579: ;   ARGUMENTS:   $0   Service name of transport driver
        !          2580: ;                $1   DLL name for WinSock interface to transport
        !          2581: ;                $2   integer value for MaxSockAddrLength
        !          2582: ;                $3   integer value for MinSockAddrLength
        !          2583: ;
        !          2584: ;     RETURNS:   $R0  Registry error code or zero if no error
        !          2585: ;                $R1  Key handle to <service>\Parameters\Winsock
        !          2586: ;
        !          2587: ;  REFERENCES:   none
        !          2588: ;
        !          2589: ;    MODIFIES:   none
        !          2590: ;
        !          2591: ;
        !          2592: ;       NOTES:   This function/section calls the NCPA function CPlSetup
        !          2593: ;                to bind to the DLL in question and add the value of the
        !          2594: ;                export function WSHWinSockMapping() to the Registry under
        !          2595: ;                the "<service>\Parameters\Winsock:Mapping" value.  To do
        !          2596: ;                this, the Registry key handle in SETUP form is passed
        !          2597: ;                to the NCPA export.
        !          2598: ;
        !          2599: ;
        !          2600: ;*************************************************************************
        !          2601: [AddWinsockInfo]
        !          2602:     read-syms InitBaseVars
        !          2603: ;
        !          2604: ;  Get the base key handle for the services area
        !          2605: ;
        !          2606:     Set AW_NameOfService = $($0)
        !          2607:     Set AW_DLLName       = $($1)
        !          2608:     Set AW_MaxAddrLgt    = $($2)
        !          2609:     Set AW_MinAddrLgt    = $($3)
        !          2610: 
        !          2611:     Set AW_KeyServices   = $(KeyNull)
        !          2612:     Set AW_KeyParameters = $(KeyNull)
        !          2613:     Set AW_KeySockets    = $(KeyNull)
        !          2614: 
        !          2615:     Shell "", AddAFD
        !          2616:     Set RegistryErrorIndex = $($R0)
        !          2617: 
        !          2618:     Ifstr(i) $(RegistryErrorIndex) == NO_ERROR
        !          2619:         Shell "", BaseServiceKey
        !          2620:         Set RegistryErrorIndex = $($R0)
        !          2621:     Endif
        !          2622: 
        !          2623:     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        !          2624:        Set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
        !          2625:        Goto A_W_Return
        !          2626:     endif
        !          2627:     Set AW_KeyServices = $($R1)
        !          2628: 
        !          2629:     OpenRegKey $(AW_KeyServices) "" $(AW_NameOfService)"\Parameters" $(MAXIMUM_ALLOWED) AW_KeyParameters
        !          2630:     Ifstr(i) $(AW_KeyParameters) == $(KeyNull)
        !          2631:        Set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
        !          2632:        Goto A_W_Return
        !          2633:     Endif
        !          2634: 
        !          2635:     OpenRegKey $(AW_KeyParameters) "" "Winsock" $(MAXIMUM_ALLOWED) AW_KeySockets
        !          2636:     Ifstr(i) $(AW_KeySockets) == $(KeyNull)
        !          2637:         CreateRegKey $(AW_KeyParameters) {Winsock,$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" AW_KeySockets
        !          2638:     Endif
        !          2639: 
        !          2640:     Ifstr(i) $(AW_KeySockets) == $(KeyNull)
        !          2641:        Set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
        !          2642:        Goto A_W_Return
        !          2643:     Endif
        !          2644: 
        !          2645:     Set AW_ValueList = {{HelperDllName    ,$(NoTitle),$(!REG_VT_EXPAND_SZ),$(AW_DLLName)},+
        !          2646:                         {MaxSockAddrLength,$(NoTitle),$(!REG_VT_DWORD),$(AW_MaxAddrLgt)},+
        !          2647:                         {MinSockAddrLength,$(NoTitle),$(!REG_VT_DWORD),$(AW_MinAddrLgt)}}
        !          2648: 
        !          2649:     Shell "", AddValueList, $(AW_KeySockets), $(AW_ValueList)
        !          2650: 
        !          2651:     Set RegistryErrorIndex = $($R0)
        !          2652:     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        !          2653:         Debug-Output "UTILITY.INF: [AddWinsockInfo] Registry error: Add value list"
        !          2654:     Endif
        !          2655: ;
        !          2656: ;  Extract the WinSock mapping information from the DLL
        !          2657: ;
        !          2658:     Set FLibraryErrCtl = 1
        !          2659:     LibraryProcedure AW_MapResult $(!NCPA_HANDLE), CPlSetup, $(!STF_HWND), WINSOCKMAP, $(AW_DLLName), $(AW_KeySockets)
        !          2660:     Set FLibraryErrCtl = 0
        !          2661: 
        !          2662:     Set AW_MapError = *($(AW_MapResult),1)
        !          2663:     Ifint $(AW_MapError) != 0
        !          2664:         Debug-Output "UTILITY.INF: [AddWinsockInfo] WINSOCKMAP returned "$(AW_MapError)
        !          2665:         Set RegistryErrorIndex = UNABLE_ACCESS_WINSOCK_MAP_INFO
        !          2666:         Goto A_W_Return
        !          2667:     Endif
        !          2668: ;
        !          2669: ;  Add this service to the WinSock transports list.
        !          2670: ;
        !          2671:     Shell "" UpdateWinsockService $(AW_NameOfService) TRUE
        !          2672:     Set RegistryErrorIndex = $($R0)
        !          2673: 
        !          2674: A_W_Return = +
        !          2675:     Ifstr $(AW_KeySockets) != $(KeyNull)
        !          2676:         CloseRegKey $(AW_KeySockets)
        !          2677:     Endif
        !          2678:     Ifstr $(AW_KeyParameters) != $(KeyNull)
        !          2679:         CloseRegKey $(AW_KeyParameters)
        !          2680:     Endif
        !          2681:     Ifstr $(AW_KeyServices) != $(KeyNull)
        !          2682:         CloseRegKey $(AW_KeyServices)
        !          2683:     Endif
        !          2684: 
        !          2685:     Return $(RegistryErrorIndex)
        !          2686: 
        !          2687: ;*************************************************************************
        !          2688: ;  end of section AddWinsockInfo
        !          2689: ;*************************************************************************
        !          2690: 
        !          2691: ;*************************************************************************
        !          2692: ;
        !          2693: ;     SECTION:   RemoveWinsockInfo
        !          2694: ;
        !          2695: ;     PURPOSE:   This function removes WinSock sockets provider
        !          2696: ;                information from a transport
        !          2697: ;
        !          2698: ;   ARGUMENTS:   $0   Service name of transport driver
        !          2699: ;
        !          2700: ;     RETURNS:   $R0  Registry error code or zero if no error
        !          2701: ;
        !          2702: ;  REFERENCES:   none
        !          2703: ;
        !          2704: ;    MODIFIES:   none
        !          2705: ;
        !          2706: ;
        !          2707: ;*************************************************************************
        !          2708: [RemoveWinsockInfo]
        !          2709:     read-syms InitBaseVars
        !          2710: ;
        !          2711: ;  Get the base key handle for the services area
        !          2712: ;
        !          2713:     Set RW_NameOfService = $($0)
        !          2714: 
        !          2715:     Set RW_KeyServices   = $(KeyNull)
        !          2716:     Set RW_KeySockets    = $(KeyNull)
        !          2717: 
        !          2718:     Shell "", BaseServiceKey
        !          2719:     Set RegistryErrorIndex = $($R0)
        !          2720: 
        !          2721:     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
        !          2722:        Set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
        !          2723:        Goto R_W_Return
        !          2724:     endif
        !          2725: 
        !          2726:     Set RW_KeyServices = $($R1)
        !          2727: 
        !          2728:     OpenRegKey $(RW_KeyServices) "" $(RW_NameOfService)"\Parameters" $(MAXIMUM_ALLOWED) RW_KeySockets
        !          2729:     Ifstr(i) $(RW_KeySockets) == $(KeyNull)
        !          2730:        Set RegistryErrorIndex = NO_ERROR
        !          2731:        Goto R_W_Return
        !          2732:     Endif
        !          2733: ;
        !          2734: ;  Delete the \Parameters\Winsock key.  Ignore errors, since the service
        !          2735: ;   is almost certainly being deinstalled.
        !          2736: ;
        !          2737:     DeleteRegTree $(RW_KeySockets) "Winsock"
        !          2738: ;
        !          2739: ;  Remove this service from the WinSock transports list.
        !          2740: ;
        !          2741:     Shell "" UpdateWinsockService $(RW_NameOfService) FALSE
        !          2742:     Set RegistryErrorIndex = $($R0)
        !          2743: 
        !          2744: R_W_Return = +
        !          2745:     Ifstr $(RW_KeySockets) != $(KeyNull)
        !          2746:         CloseRegKey $(RW_KeySockets)
        !          2747:     Endif
        !          2748:     Ifstr $(RW_KeyServices) != $(KeyNull)
        !          2749:         CloseRegKey $(RW_KeyServices)
        !          2750:     Endif
        !          2751: 
        !          2752:     Return $(RegistryErrorIndex)
        !          2753: 
        !          2754: ;*************************************************************************
        !          2755: ;  end of section RemoveWinsockInfo
        !          2756: ;*************************************************************************
        !          2757: 
        !          2758: ;*************************************************************************
        !          2759: ;
        !          2760: ;     SECTION:   GetBindingInfo
        !          2761: ;
        !          2762: ;     PURPOSE:   This function returns the bindable rules for the given
        !          2763: ;                manufacturer.
        !          2764: ;
        !          2765: ;   ARGUMENTS:   $0   manufacturer name
        !          2766: ;
        !          2767: ;     RETURNS:   $R0  Registry error code or zero if no error
        !          2768: ;                $R1  Bindable rule
        !          2769: ;
        !          2770: ;  REFERENCES:   none
        !          2771: ;
        !          2772: ;    MODIFIES:   none
        !          2773: ;
        !          2774: ;
        !          2775: ;*************************************************************************
        !          2776: 
        !          2777: [BindingInfo-DEC]
        !          2778: BindingInfo     = {+
        !          2779:                   "lanceDriver dec100Adapter non exclusive 100",+
        !          2780:                   "lanceDriver dec101Adapter non exclusive 100",+
        !          2781:                   "lanceDriver decetherworksturboAdapter non exclusive 100",+
        !          2782:                   "lanceDriver dec422Adapter non exclusive 100",+
        !          2783:                   "lanceDriver decpcAdapter non exclusive 100",+
        !          2784:                   "lanceDriver decstatAdapter non exclusive 100"+
        !          2785:                   }
        !          2786: 
        !          2787: [BindingInfo-WD]
        !          2788: BindingInfo     = {+
        !          2789:                           "smc8000nDriver smcisaAdapter non exclusive 100",+
        !          2790:                           "smc8000nDriver wd8003eaAdapter non exclusive 100",+
        !          2791:                           "smc8000nDriver wd8003waAdapter non exclusive 100",+
        !          2792:                           "smc8000nDriver wd8013epaAdapter non exclusive 100",+
        !          2793:                           "smc8000nDriver wd8013wpaAdapter non exclusive 100"+
        !          2794:                           }
        !          2795: [BindingInfo-PROTEON]
        !          2796: BindingInfo     = {+
        !          2797:                            "proteonDriver p1990Adapter non exclusive 100",+
        !          2798:                            "proteonDriver p1390Adapter non exclusive 100"+
        !          2799:                           }
        !          2800: 
        !          2801: [BindingInfo-IBM]
        !          2802: BindingInfo     = {"ibmtokDriver ibmtokAdapter non exclusive 100",+
        !          2803:                    "ibmtokDriver ibmtokmcAdapter non exclusive 100"}
        !          2804: 
        !          2805: [GetBindingInfo]
        !          2806:     set BindingInfo = {}
        !          2807:     read-syms BindingInfo-$($0)
        !          2808:     return "NO_ERROR", $(BindingInfo)
        !          2809: 
        !          2810: ;*************************************************************************
        !          2811: ;  end of section GetBindingInfo
        !          2812: ;*************************************************************************
        !          2813: 
        !          2814: ;*************************************************************************
        !          2815: ;
        !          2816: ;     SECTION:   AddStreams
        !          2817: ;
        !          2818: ;     PURPOSE:   Add Streams component
        !          2819: ;
        !          2820: ;   ARGUMENTS:   nothing
        !          2821: ;
        !          2822: ;     RETURNS:   $R0    error code
        !          2823: ;
        !          2824: ;    MODIFIES:   Nothing
        !          2825: ;
        !          2826: ;*************************************************************************
        !          2827: 
        !          2828: [AddStreams]
        !          2829:     read-syms InitBaseVars
        !          2830: 
        !          2831:     OpenRegKey $(!REG_H_LOCAL) "" $(ServicesBaseName)"\streams" $(MAXIMUM_ALLOWED) BS_KeyServices
        !          2832: 
        !          2833:     Ifstr $(BS_KeyServices) == $(KeyNull)
        !          2834: 
        !          2835:         set OldOption = $(!NTN_InfOption)
        !          2836:         set !NTN_InfOption = STREAMS
        !          2837:         Shell "oemnxpst.inf" InstallOption $(!STF_LANGUAGE) "STREAMS" $(!STF_SRCDIR) $(!NtLmAddCopy) $(!NtLmDoCopy) $(!NtLmDoConfig)
        !          2838:         set !NTN_InfOption = $(OldOption)
        !          2839:     else
        !          2840:         CloseRegKey $(BS_KeyServices)
        !          2841:         Debug-Output "UTILITY.INF: streams already installed"
        !          2842:     endif
        !          2843:     ;
        !          2844:     ; Increase the reference counter
        !          2845:     ;
        !          2846:     Shell "", IncrementRefCount, "Software\Microsoft\streams\CurrentVersion"
        !          2847: 
        !          2848: AddStreamsReturn = +
        !          2849:     return NO_ERROR
        !          2850: 
        !          2851: ;*************************************************************************
        !          2852: ;
        !          2853: ;     SECTION:   RemoveStreams
        !          2854: ;
        !          2855: ;     PURPOSE:   Remove Streams component
        !          2856: ;
        !          2857: ;   ARGUMENTS:   nothing
        !          2858: ;
        !          2859: ;     RETURNS:   $R0    error code
        !          2860: ;
        !          2861: ;    MODIFIES:   Nothing
        !          2862: ;
        !          2863: ;*************************************************************************
        !          2864: 
        !          2865: [RemoveStreams]
        !          2866:     read-syms InitBaseVars
        !          2867: 
        !          2868:     OpenRegKey $(!REG_H_LOCAL) "" $(ServicesBaseName)"\streams" $(MAXIMUM_ALLOWED) BS_KeyServices
        !          2869: 
        !          2870:     Ifstr $(BS_KeyServices) != $(KeyNull)
        !          2871:         CloseRegKey $(BS_KeyServices)
        !          2872:         Shell "", DecrementRefCount, "Software\Microsoft\streams\CurrentVersion"
        !          2873:         Shell "", IsRefCountEqualZero, "Software\Microsoft\streams\CurrentVersion"
        !          2874:         Ifstr(i) $($R0) != NO_ERROR
        !          2875:             Debug-Output "UTILITY.INF: [RemoveSoftwareComponent] IsRefCountEqualZero returned "$($R0)
        !          2876:             goto RemoveStreamsReturn
        !          2877:         endif
        !          2878: 
        !          2879:         Ifint $($R1) != 1
        !          2880:             ; if not zero, remove it next time
        !          2881:             goto RemoveStreamsReturn
        !          2882:         endif
        !          2883: 
        !          2884:         set OldOption = $(!NTN_InfOption)
        !          2885:         set OldInstallMode = $(!NTN_InstallMode)
        !          2886:         set !NTN_InfOption = STREAMS
        !          2887:         set !NTN_InstallMode = deinstall
        !          2888:         Shell "oemnxpst.inf" InstallOption $(!STF_LANGUAGE) "STREAMS" $(!STF_SRCDIR) $(!NtLmAddCopy) $(!NtLmDoCopy) $(!NtLmDoConfig)
        !          2889:         set !NTN_InfOption = $(OldOption)
        !          2890:         set !NTN_InstallMode = $(OldInstallMode)
        !          2891:     endif
        !          2892: 
        !          2893: RemoveStreamsReturn = +
        !          2894:     return NO_ERROR
        !          2895: 
        !          2896: ;*************************************************************************
        !          2897: ;
        !          2898: ;     SECTION:   AddAFD
        !          2899: ;
        !          2900: ;     PURPOSE:   Add AFD component
        !          2901: ;
        !          2902: ;   ARGUMENTS:   nothing
        !          2903: ;
        !          2904: ;     RETURNS:   $R0    error code
        !          2905: ;
        !          2906: ;    MODIFIES:   Nothing
        !          2907: ;
        !          2908: ;*************************************************************************
        !          2909: 
        !          2910: [AFDVars]
        !          2911: ;
        !          2912: ; AFD Software data
        !          2913: ;
        !          2914: ProductAFDName          = "Afd"
        !          2915: ProductAFDTitle         = "AFD Networking Support Environment"
        !          2916: ProductAFDImagePath     = "\SystemRoot\System32\drivers\afd.sys"
        !          2917: ProductAFDSvcType       = "kernelautostart"
        !          2918: 
        !          2919: [AddAFD]
        !          2920:     read-syms InitBaseVars
        !          2921:     read-syms AFDVars
        !          2922:     Set Result = NO_ERROR
        !          2923: 
        !          2924:     OpenRegKey $(!REG_H_LOCAL) "" $(ServicesBaseName)"\AFD" $(MAXIMUM_ALLOWED) BS_KeyServices
        !          2925: 
        !          2926:     Ifstr $(BS_KeyServices) == $(KeyNull)
        !          2927: 
        !          2928:         Shell "", CreateService, $(ProductAFDName),+
        !          2929:             $(ProductAFDTitle),+
        !          2930:             $(ProductAFDImagePath),+
        !          2931:             $(ProductAFDSvcType), "", {"+TDI"}, "",+
        !          2932:             "%SystemRoot%\System32\IoLogMsg.dll"
        !          2933:         Set Result = $($R0)
        !          2934:     else
        !          2935:         CloseRegKey $(BS_KeyServices)
        !          2936:     endif
        !          2937: 
        !          2938: AddAFDReturn = +
        !          2939:     return $(Result)
        !          2940: 
        !          2941: ;*************************************************************************
        !          2942: ;
        !          2943: ;     SECTION:   GetBusTypeNum
        !          2944: ;
        !          2945: ;     PURPOSE:   return the Bus Type Number
        !          2946: ;
        !          2947: ;   ARGUMENTS:   nothing
        !          2948: ;
        !          2949: ;     RETURNS:   $R0    error code
        !          2950: ;                $R1    bus number
        !          2951: ;
        !          2952: ;    MODIFIES:   Nothing
        !          2953: ;
        !          2954: ;*************************************************************************
        !          2955: 
        !          2956: [GetBusTypeNum]
        !          2957:     read-syms InitBaseVars
        !          2958:     set DetCard = $(!p:DetectedCard)
        !          2959:     ifstr(i) $(DetCard) == ""
        !          2960:         set DetCard = FALSE
        !          2961:     endif
        !          2962:     ifstr(i) $(DetCard) == FALSE
        !          2963:         ; Assume it is an ISA Bus
        !          2964:         set BusType = 1
        !          2965:         ifstr(i) $(!STF_BUSTYPE) == "ISA"
        !          2966:             set BusType = 1
        !          2967:         else-ifstr(i) $(!STF_BUSTYPE) == "EISA"
        !          2968:             set BusType = 2
        !          2969:         else-ifstr(i) $(!STF_BUSTYPE) == "Jazz-Internal Bus"
        !          2970:             set BusType = 0
        !          2971:         else-ifstr(i) $(!STF_BUSTYPE) == "MCA"
        !          2972:             set BusType = 3
        !          2973:         else-ifstr(i) $(!STF_BUSTYPE) == "TCChannel"
        !          2974:             set BusType = 4
        !          2975:         else
        !          2976:             debug-output "Utility.inf: Unknown bus type"
        !          2977:         endif
        !          2978:     else
        !          2979:         set BusType = *($(!STF_NCDETINFO),5)
        !          2980:     endif
        !          2981:     return NO_ERROR, $(BusType)
        !          2982: 
        !          2983: ;*************************************************************************
        !          2984: ;
        !          2985: ;     SECTION:   AddRpcProtocol
        !          2986: ;
        !          2987: ;     PURPOSE:   Update the sections of the SOFTWARE\Microsoft\Rpc keys
        !          2988: ;                to reflect the presenceof a new protocol in the system.
        !          2989: ;
        !          2990: ;   ARGUMENTS:   $0     complete RPC protocol string; e.g., "ncacn_ip_tcp"
        !          2991: ;                $1     name of client DLL (no path); e.g., "rpcltc5.dll"
        !          2992: ;                $2     name of server DLL (no path); e.g., "rpclts5.dll"
        !          2993: ;
        !          2994: ;     RETURNS:   $R0    STATUS_SUCCESSFUL if ok; error otherwise.
        !          2995: ;
        !          2996: ;  REFERENCES:   Nothing
        !          2997: ;
        !          2998: ;    MODIFIES:   Nothing
        !          2999: ;
        !          3000: ;
        !          3001: ;*************************************************************************
        !          3002: [AddRpcProtocol]
        !          3003:     Set ARP_Protocol = $($0)
        !          3004:     Set ARP_ClientDll = $($1)
        !          3005:     Set ARP_ServerDll = $($2)
        !          3006:     read-syms InitBaseVars
        !          3007:     Set ARP_KeyRpc = $(KeyNull)
        !          3008:     Set ARP_KeyRpcServer = $(KeyNull)
        !          3009:     Set ARP_KeyRpcClient = $(KeyNull)
        !          3010:     Set RegistryErrorIndex = UNABLE_ACCESS_SOFTWARE_REG
        !          3011: 
        !          3012:     OpenRegKey $(!REG_H_LOCAL) "" "SOFTWARE\Microsoft\Rpc" $(MAXIMUM_ALLOWED) ARP_KeyRpc
        !          3013: 
        !          3014:     Ifstr(i) $(ARP_KeyRpc) == $(KeyNull)
        !          3015:        Goto ARP_Return
        !          3016:     Endif
        !          3017: 
        !          3018:     OpenRegKey $(ARP_KeyRpc) "" "ClientProtocols" $(MAXIMUM_ALLOWED) ARP_KeyClient
        !          3019:     Ifstr(i) $(ARP_KeyClient) == $(KeyNull)
        !          3020:        Goto ARP_Return
        !          3021:     Endif
        !          3022: 
        !          3023:     OpenRegKey $(ARP_KeyRpc) "" "ServerProtocols" $(MAXIMUM_ALLOWED) ARP_KeyServer
        !          3024:     Ifstr(i) $(ARP_KeyServer) == $(KeyNull)
        !          3025:        Goto ARP_Return
        !          3026:     Endif
        !          3027: 
        !          3028:     SetRegValue $(ARP_KeyClient) {$(ARP_Protocol),$(NoTitle),$(!REG_VT_SZ),$(ARP_ClientDll)}
        !          3029:     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
        !          3030:         Goto ARP_Return
        !          3031:     Endif
        !          3032: 
        !          3033:     SetRegValue $(ARP_KeyServer) {$(ARP_Protocol),$(NoTitle),$(!REG_VT_SZ),$(ARP_ServerDll)}
        !          3034:     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
        !          3035:         Goto ARP_Return
        !          3036:     Endif
        !          3037: 
        !          3038:     Set RegistryErrorIndex = NO_ERROR
        !          3039: 
        !          3040: ARP_Return = +
        !          3041:     Ifstr(i) $(ARP_KeyServer) != $(KeyNull)
        !          3042:         CloseRegKey $(ARP_KeyServer)
        !          3043:     Endif
        !          3044:     Ifstr(i) $(ARP_KeyClient) != $(KeyNull)
        !          3045:         CloseRegKey $(ARP_KeyClient)
        !          3046:     Endif
        !          3047:     Ifstr(i) $(ARP_KeyRpc) != $(KeyNull)
        !          3048:         CloseRegKey $(ARP_KeyRpc)
        !          3049:     Endif
        !          3050:     Return  $(RegistryErrorIndex)
        !          3051: 
        !          3052: ;*************************************************************************
        !          3053: ;  end of section AddRpcProtocol
        !          3054: ;*************************************************************************
        !          3055: 
        !          3056: ;*************************************************************************
        !          3057: ;
        !          3058: ;     SECTION:   RemoveRpcProtocol
        !          3059: ;
        !          3060: ;     PURPOSE:   Remove information about an installed RPC protocol.
        !          3061: ;
        !          3062: ;   ARGUMENTS:   $0     complete RPC protocol string (see [AddRpcProtocol]).
        !          3063: ;
        !          3064: ;     RETURNS:   $R0    STATUS_SUCCESSFUL if ok; error otherwise.
        !          3065: ;
        !          3066: ;  REFERENCES:   Nothing
        !          3067: ;
        !          3068: ;    MODIFIES:   Nothing
        !          3069: ;
        !          3070: ;
        !          3071: ;*************************************************************************
        !          3072: [RemoveRpcProtocol]
        !          3073:     Set RRP_Protocol = $($0)
        !          3074:     read-syms InitBaseVars
        !          3075:     Set RRP_KeyRpc = $(KeyNull)
        !          3076:     Set RRP_KeyRpcServer = $(KeyNull)
        !          3077:     Set RRP_KeyRpcClient = $(KeyNull)
        !          3078:     Set RegistryErrorIndex = UNABLE_ACCESS_SOFTWARE_REG
        !          3079: 
        !          3080:     OpenRegKey $(!REG_H_LOCAL) "" "SOFTWARE\Microsoft\Rpc" $(MAXIMUM_ALLOWED) RRP_KeyRpc
        !          3081: 
        !          3082:     Ifstr(i) $(RRP_KeyRpc) == $(KeyNull)
        !          3083:        Goto RRP_Return
        !          3084:     Endif
        !          3085: 
        !          3086:     OpenRegKey $(RRP_KeyRpc) "" "ClientProtocols" $(MAXIMUM_ALLOWED) RRP_KeyClient
        !          3087:     Ifstr(i) $(RRP_KeyClient) == $(KeyNull)
        !          3088:        Goto RRP_Return
        !          3089:     Endif
        !          3090: 
        !          3091:     OpenRegKey $(RRP_KeyRpc) "" "ServerProtocols" $(MAXIMUM_ALLOWED) RRP_KeyServer
        !          3092:     Ifstr(i) $(RRP_KeyServer) == $(KeyNull)
        !          3093:        Goto RRP_Return
        !          3094:     Endif
        !          3095: 
        !          3096:     DeleteRegValue $(RRP_KeyClient) $(RRP_Protocol)
        !          3097:     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
        !          3098:         Goto RRP_Return
        !          3099:     Endif
        !          3100: 
        !          3101:     DeleteRegValue $(RRP_KeyServer) $(RRP_Protocol)
        !          3102:     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
        !          3103:         Goto RRP_Return
        !          3104:     Endif
        !          3105: 
        !          3106:     Set RegistryErrorIndex = NO_ERROR
        !          3107: 
        !          3108: RRP_Return = +
        !          3109:     Ifstr(i) $(RRP_KeyServer) != $(KeyNull)
        !          3110:         CloseRegKey $(RRP_KeyServer)
        !          3111:     Endif
        !          3112:     Ifstr(i) $(RRP_KeyClient) != $(KeyNull)
        !          3113:         CloseRegKey $(RRP_KeyClient)
        !          3114:     Endif
        !          3115:     Ifstr(i) $(RRP_KeyRpc) != $(KeyNull)
        !          3116:         CloseRegKey $(RRP_KeyRpc)
        !          3117:     Endif
        !          3118:     Return  $(RegistryErrorIndex)
        !          3119: 
        !          3120: ;*************************************************************************
        !          3121: ;  end of section RemoveRpcProtocl
        !          3122: ;*************************************************************************
        !          3123: 
        !          3124: ;*************************************************************************
        !          3125: ;
        !          3126: ;     SECTION:   GetInfFileNameFromRegistry
        !          3127: ;
        !          3128: ;     PURPOSE:   get the inf file name from the product' NetRules section.
        !          3129: ;
        !          3130: ;   ARGUMENTS:   $0     product key handle
        !          3131: ;                       (ie, system\software\Microsoft\Lance\CurrentVersion)
        !          3132: ;
        !          3133: ;     RETURNS:   $R0    Inf file name.
        !          3134: ;
        !          3135: ;  REFERENCES:   Nothing
        !          3136: ;
        !          3137: ;    MODIFIES:   Nothing
        !          3138: ;
        !          3139: ;
        !          3140: ;*************************************************************************
        !          3141: 
        !          3142: [GetInfFileNameFromRegistry]
        !          3143:     read-syms InitBaseVars
        !          3144:     set KeyProduct = $($0)
        !          3145:     set InfName = ""
        !          3146: 
        !          3147:     OpenRegKey $(KeyProduct) "" "NetRules" $(!REG_KEY_READ) NetRuleKey
        !          3148:     Ifstr(i) $(NetRuleKey) != $(KeyNull)
        !          3149:         GetRegValue $(NetRuleKey) "InfName" NetRuleInfNameList
        !          3150:         set NetRuleInfName = *($(NetRuleInfNameList), 4)
        !          3151:         Split-String $(NetRuleInfName), "\", FilenameList
        !          3152:         QueryListSize ListSize $(FilenameList)
        !          3153:         set InfName = *($(FilenameList), $(ListSize))
        !          3154:         CloseRegKey $(KeyProduct)
        !          3155:     endif
        !          3156: 
        !          3157:     return $(InfName)
        !          3158: 
        !          3159: ;*************************************************************************
        !          3160: ;
        !          3161: ;     SECTION:   ToggleBinding
        !          3162: ;
        !          3163: ;     PURPOSE:   Take the named binding from the list of "Disabled"
        !          3164: ;                bindings and merge it with the active bindings.
        !          3165: ;
        !          3166: ;   ARGUMENTS:   $0     name of service
        !          3167: ;                $1     number of binding
        !          3168: ;                $2     "activate" or "disable"
        !          3169: ;
        !          3170: ;     RETURNS:   $R0    NO_ERROR if OK; RegistryError if not.
        !          3171: ;
        !          3172: ;  REFERENCES:   None
        !          3173: ;
        !          3174: ;    MODIFIES:   None
        !          3175: ;
        !          3176: ;       NOTES:   This routine takes either the given inactive binding
        !          3177: ;                and activates it or the given active binding and
        !          3178: ;                deactivates it.
        !          3179: ;
        !          3180: ;
        !          3181: ;*************************************************************************
        !          3182: [ToggleBinding]
        !          3183:     Set SvcName = $($0)
        !          3184:     Set BindNumber = $($1)
        !          3185:     Set Action = $($2)
        !          3186:     Set Status = UNABLE_ACCESS_CONFIGURE_SERVICE
        !          3187:     Set KeySvc = ""
        !          3188:     Set KeyFrom = ""
        !          3189:     Set KeyTo = ""
        !          3190: 
        !          3191:     read-syms InitBaseVars
        !          3192: 
        !          3193:     OpenRegKey $(!REG_H_LOCAL) "" $(ServicesBaseName)"\"$(SvcName) $(MAXIMUM_ALLOWED) KeySvc
        !          3194:     Ifstr(i) $(KeySvc) == $(KeyNull)
        !          3195:         Debug-Output "UTILITY.INF: ToggleBinding: service key open FAILED"
        !          3196:         Goto TB_Return
        !          3197:     Endif
        !          3198: 
        !          3199:     Ifstr(i) $(Action) == activate
        !          3200:         Set FromKeyName = "Linkage\Disabled"
        !          3201:         Set ToKeyName   = "Linkage"
        !          3202:     Else
        !          3203:         Set FromKeyName = "Linkage"
        !          3204:         Set ToKeyName   = "Linkage\Disabled"
        !          3205:     Endif
        !          3206: 
        !          3207:     ;  Open the Linkage and Linkage\Disabled subkeys
        !          3208: 
        !          3209:     OpenRegKey $(KeySvc) "" $(FromKeyName) $(MAXIMUM_ALLOWED) KeyFrom
        !          3210:     Ifstr(i) $(KeyFrom) == $(KeyNull)
        !          3211:         Debug-Output "UTILITY.INF: ToggleBinding: from linkage key open FAILED"
        !          3212:         Goto TB_Return
        !          3213:     Endif
        !          3214:     OpenRegKey $(KeySvc) "" $(ToKeyName) $(MAXIMUM_ALLOWED) KeyTo
        !          3215:     Ifstr(i) $(KeyTo) == $(KeyNull)
        !          3216:         Debug-Output "UTILITY.INF: ToggleBinding: to linkage key open FAILED"
        !          3217:         Goto TB_Return
        !          3218:     Endif
        !          3219: 
        !          3220:     ;  Fetch all their values, allowing for complete absence.
        !          3221:     ;  First, from the "From" key
        !          3222: 
        !          3223:     Set FromBindList   = {}
        !          3224:     Set FromExportList = {}
        !          3225:     Set FromRouteList  = {}
        !          3226:     Set ToBindList     = {}
        !          3227:     Set ToExportList   = {}
        !          3228:     Set ToRouteList    = {}
        !          3229:     Set ErrorTotal     = 0
        !          3230: 
        !          3231:     Debug-Output "UTILITY.INF: ToggleBinding; fetch all linkage values"
        !          3232: 
        !          3233:     GetRegValue $(KeyFrom),"Bind",TempValue
        !          3234:     Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
        !          3235:         Set FromBindList = *($(TempValue),4)
        !          3236:         Set-add ErrorTotal = $(ErrorTotal),1
        !          3237:     Endif
        !          3238: 
        !          3239:     GetRegValue $(KeyFrom),"Export",TempValue
        !          3240:     Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
        !          3241:         Set FromExportList = *($(TempValue),4)
        !          3242:         Set-add ErrorTotal = $(ErrorTotal),1
        !          3243:     Endif
        !          3244: 
        !          3245:     GetRegValue $(KeyFrom),"Route",TempValue
        !          3246:     Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
        !          3247:         Set FromRouteList = *($(TempValue),4)
        !          3248:         Set-add ErrorTotal = $(ErrorTotal),1
        !          3249:     Endif
        !          3250: 
        !          3251:     ;  Next, from the "To" key
        !          3252: 
        !          3253:     GetRegValue $(KeyTo),"Bind",TempValue
        !          3254:     Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
        !          3255:         Set ToBindList = *($(TempValue),4)
        !          3256:         Set-add ErrorTotal = $(ErrorTotal),1
        !          3257:     Endif
        !          3258: 
        !          3259:     GetRegValue $(KeyTo),"Export",TempValue
        !          3260:     Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
        !          3261:         Set ToExportList = *($(TempValue),4)
        !          3262:         Set-add ErrorTotal = $(ErrorTotal),1
        !          3263:     Endif
        !          3264: 
        !          3265:     GetRegValue $(KeyTo),"Route",TempValue
        !          3266:     Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
        !          3267:         Set ToRouteList = *($(TempValue),4)
        !          3268:         Set-add ErrorTotal = $(ErrorTotal),1
        !          3269:     Endif
        !          3270: 
        !          3271:     ;  We have all the data.   Do some sanity checking.
        !          3272:     ;  Are the lists the same size?
        !          3273: 
        !          3274:     Ifint $(ErrorTotal) != 6
        !          3275:         Debug-Output "UTILITY.INF: ToggleBinding; Bind list retreival error, "$(ErrorTotal)
        !          3276:     Endif
        !          3277: 
        !          3278:     Debug-Output "UTILITY.INF: ToggleBinding; sanity check results"
        !          3279: 
        !          3280:     QueryListSize sz1 $(FromBindList)
        !          3281:     QueryListSize sz2 $(FromExportList)
        !          3282:     QueryListSize sz3 $(FromRouteList)
        !          3283:     Ifint $(sz1) != $(sz2)
        !          3284:         Goto TB_Return
        !          3285:     Endif
        !          3286:     Ifint $(sz1) != $(sz3)
        !          3287:         Goto TB_Return
        !          3288:     Endif
        !          3289: 
        !          3290:     QueryListSize sz2 $(ToBindList)
        !          3291:     QueryListSize sz3 $(ToExportList)
        !          3292:     QueryListSize sz4 $(ToRouteList)
        !          3293:     Ifint $(sz2) != $(sz3)
        !          3294:         Goto TB_Return
        !          3295:     Endif
        !          3296:     Ifint $(sz2) != $(sz4)
        !          3297:         Goto TB_Return
        !          3298:     Endif
        !          3299: 
        !          3300:     ;  Does the requested element exist?
        !          3301: 
        !          3302:     Debug-Output "UTILITY.INF: ToggleBinding; prepare to move binding"
        !          3303: 
        !          3304:     Ifint $(BindNumber) > $(sz1)
        !          3305:         Debug-Output "UTILITY.INF: ToggleBinding; binding to move was invalid"
        !          3306:         Set Status = INVALID_DATA_PASSED
        !          3307:     Endif
        !          3308: 
        !          3309:     ;  We're ready.  Move the data around.
        !          3310:     ;  Extract the element from the "From" lists, append it
        !          3311:     ;  to the "To" lists...
        !          3312: 
        !          3313:     Set FromBindItem   = *($(FromBindList),$(BindNumber))
        !          3314:     Set FromRouteItem  = *($(FromRouteList),$(BindNumber))
        !          3315:     Set FromExportItem = *($(FromExportList),$(BindNumber))
        !          3316: 
        !          3317:     Set ToBindList   = >($(ToBindList),$(FromBindItem))
        !          3318:     Set ToRouteList  = >($(ToRouteList),$(FromRouteItem))
        !          3319:     Set ToExportList = >($(ToExportList),$(FromExportItem))
        !          3320: 
        !          3321:     ;  Regenerate the "From" lists by iteration.
        !          3322: 
        !          3323:     Set NewBind   = {}
        !          3324:     Set NewExport = {}
        !          3325:     Set NewRoute  = {}
        !          3326:     Set Index = 0
        !          3327:     ForListDo $(FromBindList)
        !          3328:         Set-add Index = $(Index),1
        !          3329:         Ifint $(Index) != $(BindNumber)
        !          3330:             Set NewBind   = >($(NewBind),$($))
        !          3331:             Set NewExport = >($(NewExport),*($(FromExportList),$(Index)))
        !          3332:             Set NewRoute  = >($(NewRoute),*($(FromRouteList),$(Index)))
        !          3333:         Endif
        !          3334:     EndForListDo
        !          3335: 
        !          3336:     ;  Replace the old values
        !          3337: 
        !          3338:     Set FromBindList   = $(NewBind)
        !          3339:     Set FromExportList = $(NewExport)
        !          3340:     Set FromRouteList  = $(NewRoute)
        !          3341: 
        !          3342:     ;  Update the registry.
        !          3343: 
        !          3344:     Set ErrorTotal = 0
        !          3345: 
        !          3346:     SetRegValue $(KeyFrom) {Bind,$(NoTitle),$(!REG_VT_MULTI_SZ),$(FromBindList)}
        !          3347:     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
        !          3348:         Set-add ErrorTotal = $(ErrorTotal),1
        !          3349:     Endif
        !          3350:     SetRegValue $(KeyFrom) {Export,$(NoTitle),$(!REG_VT_MULTI_SZ),$(FromExportList)}
        !          3351:     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
        !          3352:         Set-add ErrorTotal = $(ErrorTotal),1
        !          3353:     Endif
        !          3354:     SetRegValue $(KeyFrom) {Route,$(NoTitle),$(!REG_VT_MULTI_SZ),$(FromRouteList)}
        !          3355:     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
        !          3356:         Set-add ErrorTotal = $(ErrorTotal),1
        !          3357:     Endif
        !          3358: 
        !          3359:     SetRegValue $(KeyTo) {Bind,$(NoTitle),$(!REG_VT_MULTI_SZ),$(ToBindList)}
        !          3360:     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
        !          3361:         Set-add ErrorTotal = $(ErrorTotal),1
        !          3362:     Endif
        !          3363:     SetRegValue $(KeyTo) {Export,$(NoTitle),$(!REG_VT_MULTI_SZ),$(ToExportList)}
        !          3364:     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
        !          3365:         Set-add ErrorTotal = $(ErrorTotal),1
        !          3366:     Endif
        !          3367:     SetRegValue $(KeyTo) {Route,$(NoTitle),$(!REG_VT_MULTI_SZ),$(ToRouteList)}
        !          3368:     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
        !          3369:         Set-add ErrorTotal = $(ErrorTotal),1
        !          3370:     Endif
        !          3371: 
        !          3372:     Debug-Output "UTILITY.INF: ToggleBinding; Registry update error total = "$(ErrorTotal)
        !          3373: 
        !          3374:     Ifint $(ErrorTotal) != 0
        !          3375:        Set Status = UNABLE_WRITE_REGISTRY
        !          3376:     Else
        !          3377:        Set Status = NO_ERROR
        !          3378:     Endif
        !          3379: 
        !          3380: TB_Return = +
        !          3381:     Ifstr(i) $(KeyFrom) != $(KeyNull)
        !          3382:        CloseRegKey $(KeyFrom)
        !          3383:     Endif
        !          3384:     Ifstr(i) $(KeyTo) != $(KeyNull)
        !          3385:        CloseRegKey $(KeyTo)
        !          3386:     Endif
        !          3387:     Ifstr(i) $(KeySvc) != $(KeyNull)
        !          3388:        CloseRegKey $(KeySvc)
        !          3389:     Endif
        !          3390:     Return $(Status)
        !          3391: 
        !          3392: ;*************************************************************************
        !          3393: ;  end of section ToggleBinding
        !          3394: ;*************************************************************************
        !          3395: 
        !          3396: ;-------------------------------------------------------------------------
        !          3397: ;
        !          3398: ; ROUTINE:      SortListIndex
        !          3399: ;
        !          3400: ; DESCRIPTION:  Sort a list into sequence, returning an "index" list, which
        !          3401: ;               indicates the sort position of each of the original list
        !          3402: ;               elements.
        !          3403: ;
        !          3404: ; INPUTS:       $0: List to be sorted
        !          3405: ;               $1: TRUE for ascending sort (FALSE otherwise)
        !          3406: ;               $2: TRUE for case-insensitive sort (FALSE otherwise)
        !          3407: ;
        !          3408: ; OUTPUTS:      $R0:  Index list
        !          3409: ;
        !          3410: ; NOTES:        Lists of displayable numeric values will automatically
        !          3411: ;               be sorted numerically if they are all decimal or hex
        !          3412: ;               and the sort is case-insensitive (param $2 FALSE).
        !          3413: ;
        !          3414: ;----------------------------------------------------------------------------
        !          3415: [SortListIndex]
        !          3416:     Set List = $($0)
        !          3417:     Set BoolAscend = $($1)
        !          3418:     Set BoolCaseSens = $($2)
        !          3419: 
        !          3420:     LibraryProcedure IndexList, $(!LIBHANDLE), GenerateSortedIndexList, $(List), $(BoolAscend), $(BoolCaseSens)
        !          3421: 
        !          3422:     Return $(IndexList)
        !          3423: 
        !          3424: ;-------------------------------------------------------------------------
        !          3425: ;
        !          3426: ; ROUTINE:      SortByIndex
        !          3427: ;
        !          3428: ; DESCRIPTION:  Sort a list into the sequence given by an "index list".
        !          3429: ;
        !          3430: ; INPUTS:       $0: List to be sorted
        !          3431: ;               $1: Index list
        !          3432: ;
        !          3433: ; OUTPUTS:      $R0: Index list
        !          3434: ;
        !          3435: ;----------------------------------------------------------------------------
        !          3436: [SortByIndex]
        !          3437:    Set List = $($0)
        !          3438:    Set IndexList = $($1)
        !          3439:    Set NewList = {}
        !          3440: 
        !          3441:    ForListDo $(IndexList)
        !          3442:       Set Index = $($)
        !          3443:       Set Item = *($(List),$(Index))
        !          3444:       Set NewList = >($(NewList),$(Item))
        !          3445:    EndForListDo
        !          3446: 
        !          3447:    Return $(NewList)
        !          3448: 
        !          3449: ;-------------------------------------------------------------------------
        !          3450: ;
        !          3451: ; ROUTINE:      SortList
        !          3452: ;
        !          3453: ; DESCRIPTION:  Sort a list into sequence, returning a sorted list.
        !          3454: ;
        !          3455: ; INPUTS:       $0: List to be sorted
        !          3456: ;               $1: TRUE for ascending sort (FALSE otherwise)
        !          3457: ;               $2: TRUE for case-sensitive sort (FALSE for case-ins)
        !          3458: ;
        !          3459: ; OUTPUTS:      $R0:  Sorted list
        !          3460: ;
        !          3461: ; NOTES:        Lists of displayable numeric values will automatically
        !          3462: ;               be sorted numerically if they are all decimal or hex
        !          3463: ;               and the sort is case-insensitive (param $2 FALSE).
        !          3464: ;
        !          3465: ;----------------------------------------------------------------------------
        !          3466: [SortList]
        !          3467:     Set List = $($0)
        !          3468:     Shell "" SortListIndex $(List) $($1) $($2)
        !          3469:     Set IndexList = $($R0)
        !          3470:     Shell "" SortByIndex $(List) $(IndexList)
        !          3471:     Set ResultList = $($R0)
        !          3472: 
        !          3473:     return $(ResultList)
        !          3474: 
        !          3475: ;*************************************************************************
        !          3476: ;  end of file   UTILITY.INF
        !          3477: ;*************************************************************************
        !          3478: 
        !          3479: ;*************************************************************************
        !          3480: ;
        !          3481: ;     SECTION:   UpdateDetectionDllNames
        !          3482: ;
        !          3483: ;     PURPOSE:   Search for files of the name ???NCDET.DLL.
        !          3484: ;                Update the Registry accordingly.
        !          3485: ;
        !          3486: ;
        !          3487: ;   ARGUMENTS:   None
        !          3488: ;
        !          3489: ;     RETURNS:   $R0  STATUS_SUCCESSFUL   if Registry updated
        !          3490: ;                     STATUS_USERCANCEL   if no update was required
        !          3491: ;                     STATUS_FAILED       if failed
        !          3492: ;
        !          3493: ;       NOTES:   This routine searches for all DLLs named ???NCDET.DLL
        !          3494: ;                and adds them to a list containing the name of the
        !          3495: ;                "standard" detection DLL, MSNCDET.DLL.
        !          3496: ;
        !          3497: ;                Netcard detection is stopped and restarted if the
        !          3498: ;                Registry is updated.
        !          3499: ;
        !          3500: ;  REFERENCES:
        !          3501: ;
        !          3502: ;    MODIFIES:
        !          3503: ;
        !          3504: ;*************************************************************************
        !          3505: [DetectionDllFiles]
        !          3506:     DetectionDllsFound = {} ? $(!LIBHANDLE) FindFileInstances $(!STF_WINDOWSSYSPATH)"\???ncdet.dll"
        !          3507: 
        !          3508: [UpdateDetectionDllNames]
        !          3509:     Set Status = STATUS_FAILED
        !          3510:     read-syms InitBaseVars
        !          3511:     Detect DetectionDllFiles
        !          3512:     Set DllValueName = "NetcardDlls"
        !          3513: 
        !          3514:     OpenRegKey $(!REG_H_LOCAL) "" "System\Setup" $(MAXIMUM_ALLOWED) KeySetup
        !          3515:     Ifstr(i) $(KeySetup) == $(KeyNull)
        !          3516:         Debug-Output "UTILITY.INF: [UpdateDetectionDllNames] cant open System\Setup key"
        !          3517:         Goto UDDN_Return
        !          3518:     Endif
        !          3519: 
        !          3520:     ;  Prefix the list with MSNCDET.DLL
        !          3521: 
        !          3522:     Set NewDllList = {"MSNCDET.DLL"}
        !          3523:     ForListDo $(DetectionDllsFound)
        !          3524:         Set NewDllList = >($(NewDllList),$($))
        !          3525:     EndForListDo
        !          3526: 
        !          3527:     ;  Get the old list
        !          3528: 
        !          3529:     Set UpdateRequired = 1
        !          3530:     GetRegValue $(KeySetup) $(DllValueName) DllNamesValue
        !          3531:     Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
        !          3532:         Set DllNames = *($(DllNamesValue),4)
        !          3533:         Debug-Output "UTILITY.INF: [UpdateDetectionDllNames] DllNames = "$(DllNames)
        !          3534:         Set UpdateRequired = 0
        !          3535: 
        !          3536:         ;  See if all the names are already present
        !          3537: 
        !          3538:         ForListDo $(NewDllList)
        !          3539:             Set DllIndex = ~($(DllNames),$($))
        !          3540:             Ifint $(DllIndex) == 0
        !          3541:                 Set UpdateRequired = 1
        !          3542:             Endif
        !          3543:         EndForListDo
        !          3544:     Endif
        !          3545: 
        !          3546:     Set Status = STATUS_SUCCESSFUL
        !          3547: 
        !          3548:     Ifint $(UpdateRequired) == 1
        !          3549:         Debug-Output "UTILITY.INF: [UpdateDetectionDllNames] new DLL names = "$(NewDllList)
        !          3550:         Set ValueInfo = {$(DllValueName), $(NoTitle), $(!REG_VT_MULTI_SZ), $(NewDllList)}
        !          3551:         SetRegValue $(KeySetup) $(ValueInfo)
        !          3552:         Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
        !          3553:             Set Status = STATUS_FAILED
        !          3554:         Else
        !          3555:             Shell "NCPARAM.INF" Param_ControlDetection DTEND
        !          3556:             Shell "NCPARAM.INF" Param_ControlDetection DTSTART
        !          3557:         Endif
        !          3558:     Else
        !          3559:         Set Status = STATUS_USERCANCEL
        !          3560:     Endif
        !          3561:     CloseRegKey $(KeySetup)
        !          3562: 
        !          3563: UDDN_Return = +
        !          3564:     Return $(Status)
        !          3565: 
        !          3566: ;*************************************************************************
        !          3567: ;  end of section UpdateDetectionDllNames
        !          3568: ;*************************************************************************
        !          3569: 
        !          3570: ;*************************************************************************
        !          3571: ;
        !          3572: ;     SECTION:   CheckIfCopyNecessary
        !          3573: ;
        !          3574: ;     PURPOSE:   Check a set of files and see if all are present.  Used
        !          3575: ;                to offer the user a "current files" versus "new files"
        !          3576: ;                choice.
        !          3577: ;
        !          3578: ;   ARGUMENTS:   $0    list of path names corresponding to names
        !          3579: ;                      given in next parameter
        !          3580: ;                $1    nested list of file names; see NOTES below
        !          3581: ;
        !          3582: ;     RETURNS:   $R0   STATUS_SUCCESSFUL or
        !          3583: ;                      STATUS_FAILED
        !          3584: ;
        !          3585: ;  REFERENCES:   nothing
        !          3586: ;
        !          3587: ;    MODIFIES:   nothing
        !          3588: ;
        !          3589: ;       NOTES:   Typical values (taken from OEMNSVWK.INF) might be:
        !          3590: ;
        !          3591: ;                $0:    {$(!STF_WINDOWSSYSPATH),$(!STF_WINDOWSSYSPATH)\drivers}
        !          3592: ;                $1:    {{"BOWSVC.DLL","WKSSVC.DLL","LMREPL.EXE"},+
        !          3593: ;                        {"SMBTRSUP.SYS","BROWSER.SYS","RDR.SYS"}}
        !          3594: ;
        !          3595: ;
        !          3596: ;*************************************************************************
        !          3597: [CheckIfCopyNecessary]
        !          3598:     Set Status = STATUS_SUCCESSFUL
        !          3599:     Set PathList = $($0)
        !          3600:     Set NamesList = $($1)
        !          3601: 
        !          3602:     Set Index = 0
        !          3603:     Set Found = 1
        !          3604:     ForListDo $(PathList)
        !          3605:         Set ThisPath = $($)
        !          3606:         Set-add Index = Index,1
        !          3607:         Set NameList = *($(NamesList),$(Index))
        !          3608:         ForListDo $(NameList)
        !          3609:             Set FileToCheck = $(ThisPath)\$($)
        !          3610:             LibraryProcedure FilePresent,$(!LIBHANDLE), CheckFileExistance $(FileToCheck)
        !          3611:             Ifstr(i) $(FilePresent) != "YES"
        !          3612:                 Set Found = 0
        !          3613:             Endif
        !          3614:         EndForListDo
        !          3615:     EndForListDo
        !          3616: 
        !          3617:     Ifint $(Found) != 1
        !          3618:         Set Status = STATUS_FAILED
        !          3619:     Endif
        !          3620: 
        !          3621:     Return $(Status)
        !          3622: 
        !          3623: ;*************************************************************************
        !          3624: ;  end of section CheckIfCopyNecessary
        !          3625: ;*************************************************************************
        !          3626: 
        !          3627: ;*************************************************************************
        !          3628: ;
        !          3629: ;     SECTION:   CetBusTypeDialog
        !          3630: ;
        !          3631: ;     PURPOSE:   Call the GetBusDialog function in ncpa.cpl and
        !          3632: ;                get the location of the network card.
        !          3633: ;
        !          3634: ;   ARGUMENTS:   $0    Card name description
        !          3635: ;                $1    Default bus type
        !          3636: ;                $2    Default bus number
        !          3637: ;
        !          3638: ;     RETURNS:   $R0   NO_ERROR
        !          3639: ;                $R1   BusType
        !          3640: ;                $R2   BusNumber
        !          3641: ;
        !          3642: ;  REFERENCES:   nothing
        !          3643: ;
        !          3644: ;    MODIFIES:   nothing
        !          3645: ;
        !          3646: ;*************************************************************************
        !          3647: 
        !          3648: [GetBusTypeDialog]
        !          3649:     set CardName = $($0)
        !          3650:     set BusInterfaceType = $($1)
        !          3651:     set BusNumber = $($2)
        !          3652: 
        !          3653:     ifstr(i) $(BusInterfaceType) == ""
        !          3654:         set BusInterfaceType = 1        ; ISA
        !          3655:     endif
        !          3656:     ifstr(i) $(BusNumber) == ""
        !          3657:         set BusNumber = 0               ; Bus 0
        !          3658:     endif
        !          3659:     set FLibraryErrCtl = 1
        !          3660:     LibraryProcedure BusInfo $(!NCPA_HANDLE), GetBusTypeDialog, $(!STF_HWND), $(CardName), $(BusInterfaceType), $(BusNumber)
        !          3661:     set FLibraryErrCtl = 0
        !          3662: 
        !          3663:     ; return values
        !          3664: 
        !          3665:     ifint *($(BusInfo),1) == 0
        !          3666:         set ReturnValue = NO_ERROR
        !          3667:         set BusInterfaceType = *($(BusInfo),2)
        !          3668:         set BusNumber = *($(BusInfo),3)
        !          3669:     else
        !          3670:         set ReturnValue = ERROR
        !          3671:     endif
        !          3672: 
        !          3673:     Return $(ReturnValue), $(BusInterfaceType), $(BusNumber)
        !          3674: 
        !          3675: ;*************************************************************************
        !          3676: ;  end of section GetBusTypeDialog
        !          3677: ;*************************************************************************
        !          3678: 
        !          3679: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.