home *** CD-ROM | disk | FTP | other *** search
/ PC World 2004 December / PCWorld_2004-12_cd.bin / software / temacd / omnisquad / OPFSetup.exe / Disk1 / data1.cab / 9xDrivers / OEMSETUP.INF < prev    next >
Encoding:
INI File  |  2003-11-20  |  112.0 KB  |  3,425 lines

  1. [Identification]
  2.     OptionType = NetService
  3. [Options]
  4.     OPFFLTNT
  5. [FileConstants]
  6. NoNdisWanSupport    = 0
  7. UtilityInf              = "UTILITY.INF"
  8. subroutineinf           = "SUBROUTN.INF"
  9. SoftwareType            = "service"
  10. Exit_Code               = 0
  11. NetEventDLL             = "%SystemRoot%\System32\netevent.dll"
  12. Manufacturer            = "Microsoft"
  13. ProductMajorVersion     = "5"
  14. ProductMinorVersion     = "1"
  15. ProductVersion          = $(ProductMajorVersion)"."$(ProductMinorVersion)
  16.  
  17. ProductSoftwareName     = IM
  18. ProductSoftwareName4.0  = OPFFLTNT
  19. ProductSoftwareImagePath = "\SystemRoot\System32\drivers\OPFFLTNT.SYS"
  20. ProductSoftKey          = $(!NTN_SoftwareBase)"\"$(Manufacturer)
  21. ProductKeyName          = $(ProductSoftKey)"\"$(ProductSoftwareName)"\CurrentVersion"
  22. ProductKeyName4.0       = $(ProductSoftKey)"\"$(ProductSoftwareName4.0)"\CurrentVersion"
  23.  
  24. ProductHardwareSupport  = 0
  25. ProductSoftwareSupport  = 132
  26.  
  27.  
  28. IMTransports               = {    imTransport,+
  29.                               imTcpipTransport,+
  30.                               imIpxTransport,+
  31.                               imNetBiosTransport+
  32.                           }
  33.  
  34. SupportedTransports     = {    ndisTransport,+
  35.                                tcpipTransport,+
  36.                                ipxTransport,+
  37.                               netBiosTransport+
  38.                           }
  39.  
  40. IMDrivers                  = {    imDriver }
  41. SupportedDrivers        = {    ndisDriver}
  42.  
  43. IMAdapters                = {imAdapter}
  44.  
  45. NetRuleSoftwareType     = $(ProductSoftwareName)" "*($(\IMDrivers),1)" "*($(IMTransports),1)
  46. NetRuleSoftwareUse      = $(SoftwareType)" yes yes"
  47. NetRuleSoftwareClass    = {*($(IMDrivers),1)" basic",*($(IMTransports),1)" basic"}
  48. NetRuleHardwareClass    = {*($(IMAdapters),1)" basic"}
  49.  
  50. ;
  51. ; TCPIP protocol only
  52. ;
  53. NetRuleSoftwareBindable = {+
  54.             *($(IMTransports),1)" "*($(IMAdapters),1)" non non 100"}+
  55.             *($(IMTransports),1)" "*($(ndisDrivers),1)" non non 100"}
  56.  
  57. ;
  58. ; Multiprotocol (test)
  59. ;
  60. ;NetRuleSoftwareBindable = {+
  61. ;            *($(IMTransports),2)" "*($(IMAdapters),1)+
  62. ;            " non non 100",+
  63. ;            *($(IMTransports),3)" "*($(IMAdapters),1)+
  64. ;            " non non 100"}
  65.  
  66. NetRuleSoftwareBindForm = " yes no simple"       
  67. NetRuleHardwareBindForm = " yes yes container"       
  68. ProductSoftwareReview   = "1" 
  69.  
  70. MicroSW                 = $(!NTN_SoftwareBase)"\Microsoft\"
  71. CVNetRules              = "\CurrentVersion\NetRules"
  72.  
  73. ;
  74. ; TCPIP protocol only
  75. ;
  76. NetRuleDriverKeys       = {{$(MicroSW)"Tcpip"$(CVNetRules),1}}
  77. NetRuleTransportKeys    = {{$(MicroSW)"Ndiswan"$(CVNetRules),2}}
  78. TransportServiceKeys    = {$(!NTN_ServiceBase)"\Tcpip",+
  79.             $(!NTN_ServiceBase)"\NetBT"}
  80.  
  81. ;
  82. ; Multiprotocol (test)
  83. ;
  84. ;NetRuleDriverKeys       = {{$(MicroSW)"Tcpip"$(CVNetRules),1},+
  85. ;            {$(MicroSW)"NwlnkIpx"$(CVNetRules),1}}
  86. ;NetRuleTransportKeys    = {{$(MicroSW)"Ndiswan"$(CVNetRules),2},+
  87. ;            {$(MicroSW)"Ndiswan"$(CVNetRules),3}}
  88. ;TransportServiceKeys    = {$(!NTN_ServiceBase)"\Tcpip",+
  89. ;            $(!NTN_ServiceBase)"\NwlnkIpx"}
  90.  
  91. NetBTServiceKey         = $(!NTN_ServiceBase)"\NetBT\Adapters"
  92. IMServiceKeyName       = $(!NTN_ServiceBase)"\"$(ProductSoftwareName) 
  93. IMLinkageKeyName       = $(IMServiceKeyName)"\Linkage"
  94. NtCurrentVersion        = $(MicroSW)"Windows NT\CurrentVersion"
  95. NetworkCardsKeyName     = $(NtCurrentVersion)"\NetworkCards"
  96.  
  97. ServiceOrder            = "SYSTEM\CurrentControlSet\Control\ServiceGroupOrder"
  98. ReviewProgram           = "SOFTWARE\Microsoft\Ncpa\CurrentVersion"
  99. IMSoftwareKey        = "SOFTWARE\"$(Manufacturer)"\"
  100. NetRules        = $(IMSoftwareKey)$(ProductSoftwareName)$(CVNetRules)
  101. RunOnce            = $(!NTN_SoftwareBase)+
  102.                 "\Microsoft\Windows\CurrentVersion\RunOnce"
  103. FixupServices           = {$(!NTN_ServiceBase)"\LanmanServer\Linkage",+
  104.                            $(!NTN_ServiceBase)"\LanmanWorkstation\Linkage"}
  105.  
  106. [GeneralConstants]
  107. from      = ""
  108. to        = ""
  109. ExitCodeOk     = 0
  110. ExitCodeCancel = 1
  111. ExitCodeFatal  = 2
  112. KeyNull         = ""
  113. MAXIMUM_ALLOWED   = 33554432
  114. RegistryErrorIndex = NO_ERROR
  115. KeyProduct      = ""
  116. KeyParameters   = ""
  117. TRUE            = 1
  118. FALSE           = 0
  119. NoTitle            = 0
  120. ExitState   = "Active"
  121. OldVersionExisted = $(FALSE)
  122. DriverPath      = $(!STF_NTPATH)\drivers
  123. [date]
  124.     ifstr(i) $(!LIBHANDLE) == ""
  125.         LoadLibrary "x" setupdll.dll !LIBHANDLE
  126.     endif
  127.     Now = {} ? $(!LIBHANDLE) GetSystemDate
  128. [Identify]
  129.     read-syms Identification
  130.     set Status     = STATUS_SUCCESSFUL
  131.     set Identifier = $(OptionType)
  132.     set Media      = #("Source Media Descriptions", 1, 1)
  133.     Return $(Status) $(Identifier) $(Media)
  134. [ReturnOptions]
  135.     set Status        = STATUS_FAILED
  136.     set OptionList     = {}
  137.     set OptionTextList = {}
  138.     set LanguageList = ^(LanguagesSupported, 1)
  139.     Ifcontains(i) $($0) in $(LanguageList)
  140.     goto returnoptions
  141.     else
  142.     set Status = STATUS_NOLANGUAGE
  143.     goto finish_ReturnOptions
  144.     endif
  145. returnoptions = +
  146.     set OptionList     = ^(Options, 1)
  147.     set OptionTextList = ^(OptionsText$($0), 1)
  148.     set Status         = STATUS_SUCCESSFUL
  149. finish_ReturnOptions = +
  150.     Return $(Status) $(OptionList) $(OptionTextList)
  151.  
  152. [Shell Commands]
  153.     set-title "Ndis Intermediate Driver Sample Setup"
  154.     set !G:DebugOutputControl = 1
  155.     exit
  156. [InstallOption]
  157.     set Option   = $($1)
  158.     set SrcDir   = $($2)
  159.     set AddCopy  = $($3)
  160.     set DoCopy   = $($4)
  161.     set DoConfig = $($5)
  162.     set LanguageList = ^(LanguagesSupported, 1)
  163.     Ifcontains(i) $($0) NOT-IN $(LanguageList)
  164.     Return STATUS_NOLANGUAGE
  165.     endif
  166.     Debug-Output "OEMSETNT.INF: STF_CWDDIR is: "$(!STF_CWDDIR)
  167.     Debug-Output "OEMSETNT.INF: STF_LANGUAGE is: "$(!STF_LANGUAGE)
  168.     set-subst LF = "\n"
  169.     read-syms GeneralConstants
  170.     read-syms FileConstants
  171.     read-syms DialogConstants$(!STF_LANGUAGE)
  172.     ifstr(i) $(!NTN_Origination) == "NCPA"
  173.     set Continue = $(OK)
  174.     endif
  175.     read-syms FileConstants$(!STF_LANGUAGE)
  176.     detect date
  177.     set-title  $(FunctionTitle)
  178.     set to   = Begin
  179.     set from = Begin
  180.     set CommonStatus = STATUS_SUCCESSFUL
  181.     EndWait
  182. Begin = +
  183.     Ifstr(i) $(!NTN_InstallMode) == deinstall
  184.     set StartLabel = removeadapter
  185.     else-Ifstr(i) $(!NTN_InstallMode) == Update
  186.     set StartLabel = UpgradeSoftware
  187.     else-Ifstr(i) $(!NTN_InstallMode) == bind
  188.     set StartLabel = bindingadapter
  189.     else-Ifstr(i) $(!NTN_InstallMode) == cleanup
  190.         set StartLabel = cleanupSoftware
  191.     else-Ifstr(i) $(!NTN_InstallMode) == configure
  192.     Shell $(UtilityInf),RegistryErrorString,CANNOT_CONFIGURE_SOFTWARE
  193.     ifint $($ShellCode) != $(!SHELL_CODE_OK)
  194.         Debug-Output "OEMSETNT.INF: ShellCode error: no error string."
  195.         goto ShellCodeError
  196.     endif
  197.     set Error = $($R0)
  198.     set from = end
  199.     set to = end
  200.     goto nonfatalinfo
  201.     else
  202.     set StartLabel = installadapter
  203.     endif
  204.     set RadioDefault = 2
  205.     set RadioIn = {$(RadioDefault)}
  206.     set Size = 2        ;
  207.     set from = $(fatal)
  208.     set to = $(fatal)
  209.     goto $(StartLabel)
  210. installadapter = +
  211.  
  212.     OpenRegKey $(!REG_H_LOCAL) "" $(ProductKeyName) $(MAXIMUM_ALLOWED) +
  213.         KeyProduct
  214.     Ifstr $(KeyProduct) != $(KeyNull)
  215.  
  216.         GetRegValue $(KeyProduct) MajorVersion major
  217.         GetRegValue $(KeyProduct) MinorVersion minor
  218.         CloseRegKey $(KeyProduct)
  219.  
  220.         ifstr $(major) == ""
  221.             goto noVersionCheck
  222.         endif
  223.         ifstr $(minor) == ""
  224.             goto noVersionCheck
  225.         endif
  226.  
  227.         ifint *($(major),4) > $(ProductMajorVersion)
  228.             CloseRegKey $(KeyProduct)
  229.             goto versionOlder
  230.         endif
  231.  
  232.         ifint *($(major),4) == $(ProductMinorVersion)
  233.             ifint *($(minor),4) > $(ProductMinorVersion)
  234.                 CloseRegKey $(KeyProduct)
  235.                 goto versionOlder
  236.             endif
  237.         endif
  238.  
  239.         ifstr *($(major),4) == $(ProductMajorVersion)
  240.             ifstr *($(minor),4) == $(ProductMinorVersion)
  241.                 goto versionExist
  242.             endif
  243.         endif
  244.     endif
  245.  
  246. noVersionCheck = +
  247.     ;
  248.     ; remove 5.0 IM
  249.     ;
  250.     ;Shell "" RemoveIM
  251.  
  252.     ;
  253.     ; remove 4.0 IM
  254.     ;
  255.     Shell "" MyRemoveSoftwareComponent,$(Manufacturer),+
  256.         $(ProductSoftwareName4.0),$(ProductSoftwareName),+
  257.             $(STF_CONTEXTINFNAME)
  258.  
  259.     ifstr $($R0) == STATUS_SUCCESSFUL
  260.         goto installproduct
  261.     endif
  262.  
  263.     goto end
  264.  
  265. versionExist = +
  266.     Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), "FATAL", +
  267.     $(ProductSoftwareTitle)" "*($(major),4)"."*($(minor),4)+
  268.     " is already installed."
  269.     ifint $($ShellCode) != $(!SHELL_CODE_OK)
  270.         Debug-Output "ShellCode error: cannot get an error string."
  271.         goto ShellCodeError
  272.     endif
  273.     goto end
  274.  
  275. versionOlder = +
  276.     Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), "FATAL", +
  277.     $(ProductSoftwareTitle)" "*($(major),4)"."*($(minor),4)+
  278.     " is already installed.  Upgrading to version "+
  279.     $(ProductMajorVersion)"."$(ProductMinorVersion)" is not allowed."
  280.     ifint $($ShellCode) != $(!SHELL_CODE_OK)
  281.         Debug-Output "ShellCode error: cannot get an error string."
  282.         goto ShellCodeError
  283.     endif
  284.     goto end
  285.  
  286. installproduct = +
  287.     StartWait
  288.     ifint $(OldVersionExisted) == $(FALSE)
  289.     Ifstr(i) $(DoCopy) == "YES"
  290.  
  291.            ;OpenRegKey $(!REG_H_LOCAL) "" +
  292.         ;"SOFTWARE\Microsoft\Windows Nt\CurrentVersion" +
  293.         ;$(MAXIMUM_ALLOWED) MSCVHandle
  294.            ;Ifstr $(MSCVHandle) != $(KeyNull)
  295.                ;set srcPath = ""
  296.                ;GetRegValue $(MSCVHandle) SourcePath srcPath
  297.            ;endif
  298.  
  299.            ;set SrcDir = $(!STF_WINDOWSSYSPATH)
  300.            set SrcKey = $(!NTN_SoftwareBase)"\"$(Manufacturer)"\TCPIP"
  301.  
  302.            OpenRegKey $(!REG_H_LOCAL) "" $(SrcKey) $(MAXIMUM_ALLOWED) KeyHandle
  303.            Ifstr $(KeyHandle) != $(KeyNull)
  304.                GetRegValue $(KeyHandle) Path value
  305.                ifint $(RegLastError) == 0
  306.                    ;set SrcDir = *($(value),4)
  307.                    
  308.                    set paths = {*($(value),4)}
  309.                    set names = {NMFTR.SYS}
  310.                    Shell $(UtilityInf) CheckIfCopyNecessary $(paths) $(names)
  311.  
  312.                Ifint $($ShellCode) == $(!SHELL_CODE_OK)
  313.                        Ifstr $($R0) == STATUS_SUCCESSFUL
  314.                            set SrcDir = *($(value),4)
  315.                        CloseRegKey $(KeyHandle)
  316.                            goto skip_DoAskSource 
  317.                        endif
  318.                    endif
  319.                endif
  320.            CloseRegKey $(KeyHandle)
  321.            endif
  322.  
  323.        Shell $(UtilityInf), DoAskSource, $(!STF_CWDDIR), $(SrcDir) YES
  324.  
  325.        Ifint $($ShellCode) != $(!SHELL_CODE_OK)
  326.            Goto ShellCodeError
  327.        Else-Ifstr(i) $($R0) == STATUS_FAILED
  328.            Shell $(UtilityInf) RegistryErrorString "ASK_SOURCE_FAIL"
  329.            ifint $($ShellCode) != $(!SHELL_CODE_OK)
  330.            goto ShellCodeError
  331.            endif
  332.            set Error = $($R0)
  333.            Goto fatal
  334.        Else-Ifstr(i) $($R0) == STATUS_USERCANCEL
  335.            Goto successful
  336.        Endif
  337.        Set SrcDir = $($R1)
  338.     Endif
  339. skip_DoAskSource = +
  340.     install "Install-Option"
  341.     ifstr(i) $(STF_INSTALL_OUTCOME) != STF_SUCCESS
  342.        Shell $(UtilityInf) RegistryErrorString "UNABLE_COPY_FILE"
  343.        ifint $($ShellCode) != $(!SHELL_CODE_OK)
  344.            goto ShellCodeError
  345.        endif
  346.        set Error = $($R0)
  347.        goto fatal
  348.     endif
  349.     set OEM_ABANDON_ON = TRUE
  350.     Shell $(UtilityInf), AddSoftwareComponent, $(Manufacturer), +
  351.         $(ProductSoftwareName), $(ProductSoftwareName), +
  352.         $(ProductSoftwareDisplayName), $(STF_CONTEXTINFNAME), +
  353.         $(ProductSoftwareImagePath), "kernelautostart", +
  354.             $(ProductSoftwareGroup), "", "", $(NetEventDLL)
  355.     set RegistryErrorIndex = $($R0)
  356.     Ifstr(i) $(RegistryErrorIndex) !=  NO_ERROR
  357.             ;
  358.             ; Try to recover
  359.             ;
  360.             OpenRegKey $(!REG_H_LOCAL) "" $(ProductKeyName)"\NetRules" +
  361.             $(MAXIMUM_ALLOWED) SoftNetRuleKey
  362.             Ifstr $(SoftNetRuleKey) != $(KeyNull)
  363.                 OpenRegKey $(!REG_H_LOCAL) "" +
  364.             $(ProductSoftKey)"\"$(ProductSoftwareName) +
  365.             $(MAXIMUM_ALLOWED) SoftProductKey
  366.                 Ifstr $(SoftProductKey) != $(KeyNull)
  367.                     OpenRegKey $(!REG_H_LOCAL) "" $(IMServiceKeyName) +
  368.             $(MAXIMUM_ALLOWED) sHandle
  369.                     Ifstr $(sHandle) != $(KeyNull)
  370.                         CloseRegKey $(sHandle)
  371.                         goto continueInstall
  372.                     else
  373.                         CloseRegKey $(SoftProductKey)
  374.                         CloseRegKey $(SoftNetRuleKey)
  375.                         Shell $(subroutineinf) SetupMessage,+
  376.                 $(!STF_LANGUAGE),"FATAL",+
  377.                 $(ProductSoftwareTitle)" has recently been "+
  378.                 "removed.  You must reboot before installing "+
  379.                 "it again."
  380.                     CloseRegKey $($R1)
  381.                     CloseRegKey $($R2)
  382.                     CloseRegKey $($R3)
  383.                     CloseRegKey $($R4)
  384.                     CloseRegKey $($R5)
  385.                     goto fatal
  386.                     endif
  387.                 else
  388.                     CloseRegKey $(SoftNetRuleKey)
  389.                 endif
  390.             endif
  391.            
  392.         EndWait
  393.         CloseRegKey $($R1)
  394.         CloseRegKey $($R2)
  395.         CloseRegKey $($R3)
  396.         CloseRegKey $($R4)
  397.         CloseRegKey $($R5)
  398.         goto fatalRegistry
  399.     endif
  400.     Set SoftProductKey      = $($R1)
  401.     Set SoftNetRuleKey      = $($R2)
  402.     Set SoftServiceKey      = $($R3)
  403.     set KeyParameters       = $($R4)
  404.     Set SoftLinkageKey      = $($R5)
  405.  
  406. continueInstall = +
  407.  
  408.         Shell "" GetNtVersion
  409.         ifstr $($R0) == "3.51"
  410.         set NewValueList = { +
  411.         {SoftwareType,$(NoTitle),+
  412.          $(!REG_VT_SZ),$(SoftwareType)},+
  413.         {MajorVersion,$(NoTitle),$(!REG_VT_DWORD),+
  414.          $(ProductMajorVersion)},+
  415.         {MinorVersion,$(NoTitle),$(!REG_VT_DWORD),+
  416.          $(ProductMinorVersion)},+
  417.         {Title,$(NoTitle),$(!REG_VT_SZ),+
  418.          $(ProductSoftwareTitle)},+
  419.         {Description,$(NoTitle),$(!REG_VT_SZ),+
  420.          $(ProductSoftwareDescription)},+
  421.         {ServiceName,$(NoTitle),$(!REG_VT_SZ),+
  422.          $(ProductSoftwareName)},+
  423.         {Review,$(NoTitle),$(!REG_VT_DWORD),+
  424.          $(ProductSoftwareReview)},+
  425.         {InstallDate,$(NoTitle),$(!REG_VT_DWORD),+
  426.          *($(Now),1)}}
  427.         else
  428.         set NewValueList = { +
  429.         {SoftwareType,$(NoTitle),+
  430.          $(!REG_VT_SZ),$(SoftwareType)},+
  431.         {MajorVersion,$(NoTitle),$(!REG_VT_DWORD),+
  432.          $(ProductMajorVersion)},+
  433.         {MinorVersion,$(NoTitle),$(!REG_VT_DWORD),+
  434.          $(ProductMinorVersion)},+
  435.         {Title,$(NoTitle),$(!REG_VT_SZ),+
  436.          $(ProductSoftwareTitle)},+
  437.         {Description,$(NoTitle),$(!REG_VT_SZ),+
  438.          $(ProductSoftwareDescription)},+
  439.         {ServiceName,$(NoTitle),$(!REG_VT_SZ),+
  440.          $(ProductSoftwareName)},+
  441.         {Review,$(NoTitle),$(!REG_VT_DWORD),+
  442.          $(ProductSoftwareReview)},+
  443.         {OperationsSupport,$(NoTitle),$(!REG_VT_DWORD),+
  444.          $(ProductSoftwareSupport)},+
  445.         {InstallDate,$(NoTitle),$(!REG_VT_DWORD),+
  446.          *($(Now),1)}}
  447.         endif
  448.  
  449.     Shell  $(UtilityInf), AddValueList, $(SoftProductKey), $(NewValueList)
  450.     set RegistryErrorIndex = $($R0)
  451.     Ifstr $(RegistryErrorIndex) != NO_ERROR
  452.         CloseRegKey $(SoftProductKey)
  453.         CloseRegKey $(SoftNetRuleKey)
  454.         CloseRegKey $(SoftServiceKey)
  455.         CloseRegKey $(SoftLinkageKey)
  456.         CloseRegKey $(KeyParameters)
  457.         goto fatalRegistry
  458.     endif
  459.         set-subst NetRuleSoftwareBindForm = "\042"$(ProductSoftwareName)"\042"+
  460.                         $(NetRuleSoftwareBindForm)
  461.     set NewValueList = { +
  462.           {type,$(NoTitle),$(!REG_VT_SZ),$(NetRuleSoftwareType)}, +
  463.           {use,$(NoTitle),$(!REG_VT_SZ),$(NetRuleSoftwareUse)}, +
  464.           {class,$(NoTitle),$(!REG_VT_MULTI_SZ),$(NetRuleSoftwareClass)},+   
  465.           {bindform,$(NoTitle),$(!REG_VT_SZ),$(NetRuleSoftwareBindForm)},+
  466.       {bindable,$(NoTitle),$(!REG_VT_MULTI_SZ),$(NetRuleSoftwareBindable)},+
  467.           {InfOption,$(NoTitle),$(!REG_VT_SZ),$(Option)}}
  468.     Shell  $(UtilityInf), AddValueList, $(SoftNetRuleKey), $(NewValueList)
  469.     set RegistryErrorIndex = $($R0)
  470.     Ifstr $(RegistryErrorIndex) != NO_ERROR
  471.         CloseRegKey $(SoftProductKey)
  472.         CloseRegKey $(SoftNetRuleKey)
  473.         CloseRegKey $(SoftServiceKey)
  474.         CloseRegKey $(SoftLinkageKey)
  475.         CloseRegKey $(KeyParameters)
  476.         goto fatalRegistry
  477.     endif
  478.  
  479.     CloseRegKey $(SoftProductKey)
  480.     CloseRegKey $(SoftNetRuleKey)
  481.     CloseRegKey $(SoftServiceKey)
  482.     CloseRegKey $(SoftLinkageKey)
  483.     endif
  484.  
  485.     ;Ifstr $(MSCVHandle) != $(KeyNull)
  486.         ;ifstr $(srcPath) != ""
  487.             ;SetRegValue $(MSCVProduct) $(srcPath)
  488.         ;endif
  489.         ;CloseRegKey $(MSCVHandle)
  490.     ;endif
  491.  
  492.     ;
  493.     ; Modify Driver NetRules
  494.     ;
  495.     ForListDo $(NetRuleDriverKeys)
  496.         ;
  497.         ; upgrade from 4.0 rule first
  498.         ;
  499.         Shell "" ChangeNetRules *($($),1) IMSAMPTransport +
  500.         *($(SupportedDrivers),*($($),2)) Bindable
  501.  
  502.         Shell "" ChangeNetRules *($($),1) *($(SupportedDrivers),*($($),2)) +
  503.         *($(IMDrivers),*($($),2)) Bindable
  504.         Ifint $($ShellCode) != $(!SHELL_CODE_OK)
  505.             set RegistryErrorIndex = $($ShellCode)
  506.             goto fatalRegistry
  507.         endif
  508.         Ifstr $($R0) != STATUS_SUCCESS
  509.             set RegistryErrorIndex = $($R0)
  510.             goto fatalRegistry
  511.         endif
  512.     EndForListDo
  513.  
  514.     ;
  515.     ; Modify Transport NetRules
  516.     ;
  517.     Shell "" NdisWanSupport
  518.     ifint $($R0) != 1
  519.         Shell "" GetNtVersion
  520.         ifstr $($R0) != "3.51"
  521.             ForListDo $(NetRuleTransportKeys)
  522.                 Shell "" ChangeNetRules *($($),1) +
  523.             *($(SupportedTransports),*($($),2)) +
  524.             *($(IMTransports),*($($),2))  Bindable
  525.                 Ifint $($ShellCode) != $(!SHELL_CODE_OK)
  526.                     set RegistryErrorIndex = $($ShellCode)
  527.                     goto fatalRegistry
  528.                 endif
  529.                 Ifstr $($R0) != STATUS_SUCCESS
  530.                     Ifstr $($R0) != CANNOT_FIND_COMPONENT_SERVICE
  531.                         set RegistryErrorIndex = $($R0)
  532.                         goto fatalRegistry
  533.                     endif
  534.                 endif
  535.             endForListDo
  536.         endif
  537.     endif
  538.  
  539.     ;
  540.     ; Modify NetBT (WINS) class
  541.     ;
  542.     Shell "" ChangeNetRules $(MicroSW)"NetBT"$(CVNetRules) +
  543.     *($(SupportedTransports),4) *($(IMTransports),1) Class
  544.     Ifint $($ShellCode) != $(!SHELL_CODE_OK)
  545.         set RegistryErrorIndex = $($ShellCode)
  546.         goto fatalRegistry
  547.     endif
  548.     Ifstr $($R0) != STATUS_SUCCESS
  549.         Ifstr $($R0) != CANNOT_FIND_COMPONENT_SERVICE
  550.             set RegistryErrorIndex = $($R0)
  551.             goto fatalRegistry
  552.         endif
  553.     endif
  554.  
  555.     ;
  556.     ; Add Protocol parameters and NetworkCard settings
  557.     ;
  558.     Shell "", SetAdapterParameter $(Option) FORCE
  559.     Ifint $($ShellCode) != $(!SHELL_CODE_OK)
  560.         set RegistryErrorIndex = $($ShellCode)
  561.         goto fatal
  562.     endif
  563.     Ifstr $($R0) != STATUS_SUCCESSFUL
  564.         Ifstr $($R0) != STATUS_REBIND
  565.             set RegistryErrorIndex = $($R0)
  566.             goto fatal
  567.         endif
  568.     endif
  569.  
  570.     ;
  571.     ; Add install file to ReviewPrograms
  572.     ;
  573.     OpenRegKey $(!REG_H_LOCAL) "" $(NetRules) $(MAXIMUM_ALLOWED) KeyProduct
  574.     Ifstr $(KeyProduct) != $(KeyNull)
  575.         GetRegValue $(KeyProduct),"InfName", infName
  576.         ifint $(RegLastError) == 0
  577.             Shell "" AddToList *($(infName),4) OEMNSVRA.INF +
  578.             $(ReviewProgram) ReviewPrograms
  579.             ifint $($ShellCode) == $(!SHELL_CODE_OK)
  580.                 ifstr $($R0) != STATUS_SUCCESSFUL
  581.                     Shell "" AddToList *($(infName),4) NBINFO.INF +
  582.                 $(ReviewProgram) ReviewPrograms BEFORE
  583.                 endif
  584.             endif
  585.         endif
  586.         CloseRegKey $(KeyProduct)
  587.     endif
  588.  
  589.     ;
  590.     ; Add our Group to the service group list
  591.     ;
  592.     Shell "" AddToList $(ProductSoftwareGroup) NDIS $(ServiceOrder) List
  593.  
  594.     goto writeparameters
  595. writeparameters = +
  596.     CloseRegKey $(KeyParameters)
  597.     EndWait
  598.     goto successful
  599. bindingadapter =+
  600.     ;
  601.     ; Delete IM DependOnGroup and DependOnService
  602.     ;
  603.     OpenRegKey $(!REG_H_LOCAL) "" $(IMServiceKeyName) $(MAXIMUM_ALLOWED) +
  604.         KeyProduct
  605.     Ifstr $(KeyProduct) == $(KeyNull)
  606.         set RegistryErrorIndex = CANNOT_FIND_COMPONENT_SERVICE
  607.         Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), "FATAL", +
  608.         $(IMServiceKeyName)" empty!"
  609.         goto fatal
  610.     Endif
  611.     DeleteRegValue $(KeyProduct) DependOnGroup
  612.     DeleteRegValue $(KeyProduct) DependOnService
  613.     CloseRegKey $(KeyProduct)
  614.  
  615.     ;
  616.     ; Modify Transport NetRules
  617.     ;
  618.     set bindType = 1
  619.     Shell "" NdisWanSupport
  620.     ifint $($R0) != 1
  621.         ForListDo $(NetRuleTransportKeys)
  622.             Shell "" ChangeNetRules *($($),1) +
  623.         *($(SupportedTransports),*($($),2)) +
  624.         *($(IMTransports),*($($),2)) Bindable
  625.             Ifint $($ShellCode) != $(!SHELL_CODE_OK)
  626.                 set RegistryErrorIndex = $($ShellCode)
  627.                 goto fatal
  628.             endif
  629.             Ifstr $($R0) != STATUS_SUCCESS
  630.                 Ifstr $($R0) != CANNOT_FIND_COMPONENT_SERVICE
  631.                     set RegistryErrorIndex = $($R0)
  632.                     goto fatal
  633.                 endif
  634.             endif
  635.             Ifstr $($R1) == 0 ;IM is installed before RAS
  636.                 set bindType = 2
  637.             endif
  638.         endForListDo
  639.     endif
  640.  
  641.     ;
  642.     ; Modify NetBT (WINS) class
  643.     ;
  644.     Shell "" ChangeNetRules $(MicroSW)"NetBT"$(CVNetRules) +
  645.     *($(SupportedTransports),4) *($(IMTransports),1) Class
  646.     Ifint $($ShellCode) != $(!SHELL_CODE_OK)
  647.         set RegistryErrorIndex = $($ShellCode)
  648.         goto fatal
  649.     endif
  650.     Ifstr $($R0) != STATUS_SUCCESS
  651.         Ifstr $($R0) != CANNOT_FIND_COMPONENT_SERVICE
  652.             set RegistryErrorIndex = $($R0)
  653.             goto fatal
  654.         endif
  655.     endif
  656.  
  657.     ;
  658.     ; Remove IM from Transport's DependOnService
  659.     ;
  660.     Shell "" FixupTransportDependOnService
  661.  
  662.     set rebind = FALSE
  663.  
  664.     ;
  665.     ; Add Protocol parameters and NetworkCard settings
  666.     ;
  667.     Shell "" SetAdapterParameter $(Option)
  668.     Ifint $($ShellCode) != $(!SHELL_CODE_OK)
  669.         set RegistryErrorIndex = $($ShellCode)
  670.         goto fatal
  671.     endif
  672.     Ifstr $($R0) == STATUS_REBIND
  673.         set rebind = TRUE
  674.     else-ifstr $($R0) != STATUS_SUCCESSFUL
  675.         set RegistryErrorIndex = $($R0)
  676.         goto fatal
  677.     endif
  678.  
  679.     ;
  680.     ; Remove no longer used IM cards
  681.     ;
  682.     Shell "" RemoveIMCards UNWANTED
  683.     Ifstr $($R0) == STATUS_REBIND
  684.         set rebind = TRUE
  685.     endif
  686.  
  687.     ;
  688.     ; Fixup binding now that we might have added/removed some adapters
  689.     ;
  690.     Shell "" NdisWanSupport
  691.     ifint $($R0) != 1
  692.         Shell "" FixupBindings
  693.     else
  694.         Shell "" GetNtVersion
  695.         ifstr $($R0) == "3.51"
  696.             Shell "" FixupBindings
  697.         endif
  698.     endif
  699.  
  700.     ifstr $(rebind) == TRUE
  701.         OpenRegKey $(!REG_H_LOCAL) "" $(IMServiceKeyName) $(MAXIMUM_ALLOWED) +
  702.         KeyProduct
  703.         Ifstr $(KeyProduct) == $(KeyNull)
  704.             set RegistryErrorIndex = CANNOT_FIND_COMPONENT_SERVICE
  705.             Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), "FATAL", +
  706.         $(IMServiceKeyName)" empty!"
  707.             goto fatal
  708.         endif
  709.  
  710.         SetRegValue $(KeyProduct) +
  711.         {Rebind,$(NoTitle),$(!REG_VT_DWORD),$(bindType)}
  712.         ifint $(RegLastError) != 0
  713.             set RegistryErrorIndex = $(RegLastError)
  714.             goto fatal
  715.         endif
  716.  
  717.         CloseRegKey $(KeyProduct)
  718.     endif
  719.  
  720.     ;
  721.     ; Reconfig protocol since some adapter information may have changed
  722.     ;
  723.     ;shell "oemnxptc.inf",InstallOption,$($0),TC,$($2),$($3),+
  724.             ;$($4),$($5),$($6),$($7),$($8)
  725.  
  726.     ;
  727.     ; add our installation file to ReviewPrograms
  728.     ;
  729.     OpenRegKey $(!REG_H_LOCAL) "" $(NetRules) $(MAXIMUM_ALLOWED) KeyProduct
  730.     Ifstr $(KeyProduct) != $(KeyNull)
  731.         GetRegValue $(KeyProduct),"InfName", infName
  732.         ifint $(RegLastError) == 0
  733.             Shell "" AddToList *($(infName),4) OEMNSVRA.INF +
  734.             $(ReviewProgram) ReviewPrograms
  735.             ifint $($ShellCode) == $(!SHELL_CODE_OK)
  736.                 ifstr $($R0) != STATUS_SUCCESSFUL
  737.                     Shell "" AddToList *($(infName),4) NBINFO.INF +
  738.                 $(ReviewProgram) ReviewPrograms BEFORE
  739.                 endif
  740.             endif
  741.         endif
  742.         CloseRegKey $(KeyProduct)
  743.     endif
  744.  
  745.     ;
  746.     ; Add our Group to the service group list
  747.     ;
  748.     Shell "" AddToList $(ProductSoftwareGroup) NDIS $(ServiceOrder) List
  749.  
  750.     goto successful
  751.  
  752. removeadapter = +
  753.     Shell "" RemoveIM
  754.  
  755.     Shell "" GetNtVersion
  756.     ifstr $($R0) == "3.51"
  757.         Shell "" FixupBindingsAfterRemove $(!NTN_ServiceBase)"\Tcpip\Linkage"
  758.         Shell "" FixupBindingsAfterRemove $(!NTN_ServiceBase)"\NetBT\Linkage"
  759.         Shell "" FixupAdaptersAfterRemove
  760.     endif
  761.     goto end
  762.  
  763. UpgradeSoftware = +
  764.     ifstr(i) $(ProductKeyName) == $(!NTN_RegBase)
  765.     OpenRegKey $(!REG_H_LOCAL) "" $(ProductKeyName) $(MAXIMUM_ALLOWED) +
  766.         KeyProduct
  767.     Ifstr $(KeyProduct) != $(KeyNull)
  768.         GetRegValue $(KeyProduct),"MajorVersion", VersionInfo
  769.         set Version = *($(VersionInfo), 4)
  770.         Shell $(UtilityInf), GetInfFileNameFromRegistry, $(KeyProduct)
  771.         ifint $($ShellCode) != $(!SHELL_CODE_OK)
  772.         Debug-Output "ShellCode error"
  773.             CloseRegKey $(KeyProduct)
  774.         goto ShellCodeError
  775.         endif
  776.         set !UG_Filename = $($R0)
  777.         ifstr(i) $(!UG_Filename) != ""
  778.         install "Install-Update"
  779.         ifstr(i) $(STF_INSTALL_OUTCOME) != STF_SUCCESS
  780.                 CloseRegKey $(KeyProduct)
  781.             goto fatal
  782.         endif
  783.         endif
  784.         SetRegValue $(KeyProduct) {MajorVersion,$(NoTitle),$(!REG_VT_SZ),+
  785.             $(ProductMajorVersion)}
  786.         SetRegValue $(KeyProduct) {MinorVersion,$(NoTitle),$(!REG_VT_SZ),+
  787.             $(ProductMinorVersion)}
  788.         ifint $(Version) != $(ProductVersion)
  789.         endif
  790.         CloseRegKey $(KeyProduct)
  791.     else
  792.         goto fatalregistry
  793.     endif
  794.     endif
  795.     goto end
  796. cleanupSoftware = +
  797.     Shell "" RemoveBobcatINFs
  798.     goto end
  799. successful = +
  800.     goto end
  801. warning = +
  802.     Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), "WARNING", $(Error)
  803.     ifint $($ShellCode) != $(!SHELL_CODE_OK)
  804.     goto ShellCodeError
  805.     endif
  806.     ifstr(i) $($R1) == "OK"
  807.     goto $(to)
  808.     else-ifstr(i) $($R1) == "CANCEL"
  809.     goto $(from)
  810.     else
  811.     goto "end"
  812.     endif
  813. nonfatalinfo = +
  814.     Set CommonStatus = STATUS_USERCANCEL
  815.     Set Severity = STATUS
  816.     goto nonfatalmsg
  817. nonfatal = +
  818.     Set Severity = NONFATAL
  819.     goto nonfatalmsg
  820. nonfatalmsg = +
  821.     ifstr(i) $(Error) == ""
  822.     Shell $(UtilityInf) RegistryErrorString "SETUP_FAIL"
  823.     ifint $($ShellCode) != $(!SHELL_CODE_OK)
  824.         goto ShellCodeError
  825.     endif
  826.     set Error = $($R0)
  827.     endif
  828.     Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), $(Severity), $(Error)
  829.     ifint $($ShellCode) != $(!SHELL_CODE_OK)
  830.     goto ShellCodeError
  831.     endif
  832.     ifstr(i) $($R1) == "OK"
  833.     goto $(from)
  834.     else
  835.     goto "end"
  836.     endif
  837. fatalregistry = +
  838.     Shell $(UtilityInf) RegistryErrorString $(RegistryErrorIndex)
  839.     ifint $($ShellCode) != $(!SHELL_CODE_OK)
  840.     goto ShellCodeError
  841.     endif
  842.     set Error = $($R0)
  843.     goto fatal
  844. fatal = +
  845.     Shell "" RemoveIM
  846.     ifstr(i) $(Error) == ""
  847.     Shell $(UtilityInf) RegistryErrorString "SETUP_FAIL"
  848.     ifint $($ShellCode) != $(!SHELL_CODE_OK)
  849.         goto ShellCodeError
  850.     endif
  851.     set Error = $($R0)
  852.     endif
  853.     Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), "FATAL", $(Error)
  854.     ifint $($ShellCode) != $(!SHELL_CODE_OK)
  855.     goto ShellCodeError
  856.     endif
  857.     goto setfailed
  858. ShellCodeError = +
  859.     set DlgType      = "MessageBox"
  860.     set STF_MB_TITLE = $(ShellCodeErrorTitle)
  861.     set STF_MB_TEXT  = $(ShellCodeErrorText) 
  862.     set STF_MB_TYPE  = 1
  863.     set STF_MB_ICON  = 3
  864.     set STF_MB_DEF   = 1
  865.     ui start "Error Message"
  866.     goto setfailed
  867. setfailed = +
  868.     set CommonStatus = STATUS_FAILED
  869.     ifstr(i) $(OEM_ABANDON_ON) == TRUE
  870.     set OEM_ABANDON_ON = FALSE
  871.     goto removeadapter
  872.     endif
  873.     goto end
  874. end = +
  875.     goto term
  876. term = +
  877.     Return $(CommonStatus)
  878. [BindingsReview]
  879.     set Option   = $($1)
  880.     set SrcDir   = $($2)
  881.     set AddCopy  = $($3)
  882.     set DoCopy   = $($4)
  883.     set DoConfig = $($5)
  884.  
  885.     read-syms GeneralConstants
  886.     read-syms FileConstants
  887.     read-syms FileConstantsENG
  888.  
  889.     OpenRegKey $(!REG_H_LOCAL) "" $(IMServiceKeyName) $(MAXIMUM_ALLOWED) +
  890.         KeyProduct
  891.     Ifstr $(KeyProduct) == $(KeyNull)
  892.         Return STATUS_USERCANCEL
  893.     endif
  894.  
  895.     GetRegValue $(KeyProduct) Rebind rebind
  896.     ifint $(RegLastError) != 0
  897.         goto bindingsReview_cont
  898.     endif
  899.  
  900.     DeleteRegValue $(KeyProduct) Rebind
  901.  
  902.     CloseRegKey $(KeyProduct)
  903.  
  904.     ifint *($(rebind),4) == 1
  905.         Shell "" GetNtVersion
  906.         ifstr $($R0) == "4.0"
  907.             Shell "" GetImSampPath
  908.             ifstr $($R0) == STATUS_SUCCESSFUL
  909.                 set cmd = $($R1)"\wgagent.dll,ReviewBindings"
  910.  
  911.                 Shell subroutn.inf, SetupMessage $(!STF_LANGUAGE) "NONFATAL" +
  912.             "OPFFLTNT has discovered newly added or removed "+
  913.             "adapter(s).  It is necessary to redo the network "+
  914.             "bindings.  The current series of dialog windows will "+
  915.             "again be displayed.  Don't reboot the system until "+
  916.             "the binding process is completed."
  917.  
  918.                 StartDetachedProcess ExitCode "x" "" +
  919.             $(!STF_WINDOWSSYSPATH)"\rundll32.exe" $(cmd)
  920.                 ifstr $(ExitCode) != "ERROR"
  921.                     Return STATUS_SUCCESSFUL
  922.                 else
  923.                     Shell subroutn.inf, SetupMessage $(!STF_LANGUAGE) "FATAL" +
  924.                 "Unable to start detached process"
  925.                     Return STATUS_USERCANCEL
  926.                 endif
  927.             endif
  928.         endif
  929.     else-ifint *($(rebind),4) == 2
  930.         Shell "" GetNtVersion
  931.         ifstr $($R0) == "4.0"
  932.             Shell "" GetImSampPath
  933.             ifstr $($R0) == STATUS_SUCCESSFUL
  934.                 set cmd = $($R1)"\wgagent.dll,ReviewBindings"
  935.  
  936.                 Shell subroutn.inf, SetupMessage $(!STF_LANGUAGE) "NONFATAL" +
  937.             "OPFFLTNT has discovered newly added RAS "+
  938.             "adapter(s).  It is necessary to remove and reinstall "+
  939.             "IM.  The current series of dialog windows "+
  940.             "will again be displayed to remove IM.  Don't reboot "+
  941.             "the system until the binding process is completed.  "+
  942.             "After the reboot, IM will be installed automatically."
  943.  
  944.                 Shell "" RemoveIM
  945.  
  946.                 StartDetachedProcess ExitCode "x" "" +
  947.             $(!STF_WINDOWSSYSPATH)"\rundll32.exe" $(cmd)
  948.                 ifstr $(ExitCode) == "ERROR"
  949.                     Shell subroutn.inf, SetupMessage $(!STF_LANGUAGE) "FATAL" +
  950.                 "Unable to start detached process"
  951.                     Return STATUS_USERCANCEL
  952.                 endif
  953.  
  954.                 ;
  955.                 ; Install new IM after next reboot
  956.                 ;
  957.                 OpenRegKey $(!REG_H_LOCAL) "" $(RunOnce) +
  958.             $(MAXIMUM_ALLOWED) runHandle
  959.                 ifstr $(runHandle) == $(KeyNull)
  960.                     CreateRegKey $(!REG_H_LOCAL) {$(RunOnce),0,GenericClass} +
  961.             "" $(MAXIMUM_ALLOWED) "" runHandle
  962.                 endif
  963.  
  964.                 ifstr $(runHandle) == $(KeyNull)
  965.                     Shell subroutn.inf, SetupMessage $(!STF_LANGUAGE) "FATAL" +
  966.                 "Unable to add IM auto-install"
  967.                     Return STATUS_USERCANCEL
  968.                 endif
  969.  
  970.                 SetRegValue $(runHandle) {InstallIM,0,+
  971.             $(!REG_VT_SZ),"rundll32 wgagent.dll,DllRegisterServer"}
  972.                 ifint $(RegLastError) != 0
  973.                     CloseRegKey $(runHandle)
  974.                     Shell subroutn.inf, SetupMessage $(!STF_LANGUAGE) "FATAL" +
  975.                 "Unable to install IM auto-install"
  976.                     Return STATUS_USERCANCEL
  977.                 endif
  978.  
  979.                 CloseRegKey $(runHandle)
  980.                 Return STATUS_SUCCESSFUL
  981.             endif
  982.         endif
  983.     endif
  984.  
  985. bindingsReview_cont = +
  986.     ;
  987.     ; NDISWAN 
  988.     ;
  989.     Shell "" NdisWanSupport
  990.     ifint $($R0) != 1
  991.         ifstr(i) $(!LIBHANDLE) == ""
  992.             LoadLibrary "x" setupdll.dll !LIBHANDLE
  993.             ifstr(i) $(!LIBHANDLE) == ""
  994.                 Shell subroutn.inf, SetupMessage $(!STF_LANGUAGE) "FATAL" +
  995.                 "IM Dial-Up Networking setup was unable "+
  996.             "to load setupdll.dll in the system32 "+
  997.             "directory.  Please make sure this file is "+
  998.             "present on your computer. Setup will now exit."
  999.                 Return STATUS_USERCANCEL
  1000.             endif
  1001.         endif
  1002.  
  1003.         Shell "" GetNtVersion
  1004.         ifstr $($R0) == "4.0"
  1005.             Shell "" SetRasArpBindValueFromTcpIP
  1006.         endif
  1007.         Shell "" UpdateLLInterface
  1008.     endif
  1009.  
  1010.     ;Shell "" GetImSampPath
  1011.     ;ifstr $($R0) == STATUS_SUCCESSFUL
  1012.         ;
  1013.         ; Install Newt into 'Run' key in registry
  1014.         ;
  1015.         ;RunProgram ExitCode NEWT32 "" $($R1)\newt32.exe -i
  1016.     ;endif
  1017.  
  1018.   ;clean up the IM bindings
  1019. Debug-Output "OEMSETNT.INF: Loading BINDPRUNE.DLL"
  1020.  
  1021.      LoadLibrary "x" BindPrune.dll !PRUNEHANDLE
  1022. Debug-Output "OEMSETNT.INF: Calling ImPruneBindings"
  1023.  
  1024.     LibraryProcedure Result $(!PRUNEHANDLE) ImPruneBindings
  1025. Debug-Output "OEMSETNT.INF: Binding pruning complete"
  1026.  
  1027.  
  1028.  
  1029.     Return STATUS_SUCCESSFUL
  1030. [Install-Option]
  1031.     set STF_VITAL = ""
  1032.     ifstr(i) $(AddCopy) == "YES"
  1033.     AddSectionFilesToCopyList Files-$(Option) $(SrcDir) +
  1034.                 $(!STF_WINDOWSSYSPATH)\drivers
  1035.     endif
  1036.     ifstr(i) $(DoCopy) == "YES"
  1037.        set !STF_NCPA_FLUSH_COPYLIST = TRUE
  1038.        CopyFilesInCopyList
  1039.     endif
  1040.     ifstr(i) $(DoConfig) == "YES"
  1041.     endif
  1042.     Exit
  1043. [Install-Update]
  1044.    set STF_VITAL        = ""
  1045.    set STF_OVERWRITE    = "VERIFYSOURCEOLDER"
  1046.    AddSectionFilesToCopyList Files-$(Option) $(SrcDir) +
  1047.                 $(!STF_WINDOWSSYSPATH)\drivers
  1048.    AddSectionFilesToCopyList Files-Inf $(SrcDir) $(!STF_WINDOWSSYSPATH)
  1049.    set !STF_NCPA_FLUSH_COPYLIST = TRUE
  1050.    CopyFilesInCopyList
  1051.    exit
  1052. [Source Media Descriptions]
  1053.     1  = "OPFFLTNT Installation Disk"  , TAGFILE = disk1
  1054. [ProductType]
  1055. STF_PRODUCT  = Winnt
  1056. STF_PLATFORM = I386              ;should be able to detect automatically?
  1057.  
  1058. [Files-Inf]
  1059. 1,BINDPRUNE.DLL,SIZE=2000
  1060. 2,oemsetnt.inf,SIZE=2000,RENAME=$(!UG_Filename) 
  1061.  
  1062. [Files-OPFFLTNT]
  1063. 1,OPFFLTNT.SYS,SIZE=2000  
  1064. [Files-]
  1065. 1,OPFFLTNT.SYS,SIZE=2000  
  1066.  
  1067. [LanguagesSupported]
  1068.     ENG
  1069. [OptionsTextENG]
  1070.     NDISPERF     = "OPFFLTNT"
  1071. [FileConstantsENG]
  1072. ProCaption   = "Windows NT Setup"
  1073. ProCancel    = "Cancel"
  1074. ProCancelMsg = "Windows NT Networking is not correctly installed.  "+
  1075.            "Are you sure you want to cancel copying files?"
  1076. ProCancelCap = "Network Setup Message"
  1077. ProText1     = "Copying:"
  1078. ProText2     = "To:"
  1079. FunctionTitle   = "OPFFLTNT"
  1080. ProductSoftwareDescription = "OPFFLTNT"
  1081. ProductSoftwareDisplayName = "OPFFLTNT"
  1082. ProductSoftwareTitle    = "OPFFLTNT"
  1083. ProductSoftwareGroup    = "NDISWAN"
  1084. ShellCodeErrorTitle     = "Error: "$(FunctionTitle)
  1085. ShellCodeErrorText      = "Shell Code Error."
  1086. [DialogConstantsENG]
  1087. Help        = "&Help"
  1088. Exit        = "Cancel"
  1089. OK          = "OK"
  1090. HelpContext = ""
  1091. Continue    = "Continue"
  1092. Cancel      = "Cancel"
  1093. [FileDependentDlgENG]
  1094. GroupLabel = "Optimization:"
  1095. Radio1 = "&Minimize Memory Used"
  1096. Radio2 = "&Balance"
  1097. Radio3 = "M&aximize Throughput && Connections"
  1098. DlgType = "Radio"               
  1099. DlgTemplate = "NBF"             
  1100. Caption = $(FunctionTitle)
  1101. OptionsGreyed = {}
  1102. HelpContext = $(!IDH_DB_OEMSETNT_INS)
  1103.  
  1104. ;*************************************************************************
  1105. ;
  1106. ;     SECTION:   FixupBindings
  1107. ;
  1108. ;     PURPOSE:   <fixup the bindings after added/deleted some adapters>
  1109. ;
  1110. ;   ARGUMENTS:
  1111. ;
  1112. ;     RETURNS:   $R0 - 0 if success
  1113. ;
  1114. ;  REFERENCES:   <list of global or parent variables referenced>
  1115. ;
  1116. ;*************************************************************************
  1117. [FixupBindings]
  1118.  
  1119.     read-syms GeneralConstants
  1120.     read-syms FileConstants
  1121.  
  1122.     set status = STATUS_SUCCESSFUL
  1123.     set temp = "temp"
  1124.  
  1125.     set tcpDisableLinkages = {}
  1126.     OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_ServiceBase)"\Tcpip\Linkage\Disabled" +
  1127.         $(MAXIMUM_ALLOWED) KeyProduct
  1128.     Ifstr $(KeyProduct) != $(KeyNull)
  1129.         GetRegValue $(KeyProduct) Bind tcpDisableLinkage
  1130.         ifint $(RegLastError) == 0
  1131.             set tcpDisableLinkages = *($(tcpDisableLinkage),4)
  1132.         endif
  1133.         CloseRegKey $(KeyProduct)
  1134.     endif
  1135.  
  1136.     OpenRegKey $(!REG_H_LOCAL) "" $(IMLinkageKeyName)"\Disabled" +
  1137.         $(MAXIMUM_ALLOWED) KeyProduct
  1138.     Ifstr $(KeyProduct) == $(KeyNull)
  1139.         Return CANNOT_FIND_COMPONENT_SERVICE
  1140.     endif
  1141.  
  1142.     GetRegValue $(KeyProduct) Bind disableLinkage
  1143.     ifint $(RegLastError) != 0
  1144.         set disableLinkages = {}
  1145.     else
  1146.         set disableLinkages = *($(disableLinkage),4)
  1147.     endif
  1148.     CloseRegKey $(KeyProduct)
  1149.  
  1150.     OpenRegKey $(!REG_H_LOCAL) "" $(NetworkCardsKeyName) $(MAXIMUM_ALLOWED) +
  1151.         CardsHandle
  1152.     ifint $(RegLastError) != 0
  1153.         return STATUS_FAILED
  1154.     endif
  1155.  
  1156.     EnumRegKey $(CardsHandle) CardList
  1157.     ifint $(RegLastError) != 0
  1158.         CloseRegKey $(CardsHandle)
  1159.         return STATUS_FAILED
  1160.     endif
  1161.  
  1162.     CloseRegKey $(CardsHandle)
  1163.  
  1164.     set ImBind = {}
  1165.     set ImExport = {}
  1166.     set ImRoute = {}
  1167.     set TcpBind = {}
  1168.     set TcpExport = {}
  1169.     set TcpRoute = {}
  1170.     set NetBTExport = {}
  1171.     set RefCnt = 0
  1172.     set q = \042\042\042\042\042\042\042\042
  1173.  
  1174.     ifstr(i) $(!LIBHANDLE) == ""
  1175.         LoadLibrary "x" setupdll.dll !LIBHANDLE
  1176.     endif
  1177.     set compareSize = 0
  1178.     set compareString = $(ProductSoftwareName)"_NdisWan"
  1179.     Split-String $(compareString) $(compareString) charList
  1180.     ForListDo $(charList)
  1181.         set-add compareSize = $(compareSize),1
  1182.     EndForListDo
  1183.  
  1184.     set adapterList = {}
  1185.     set ndiswanList = {}
  1186.     set tcpipDisableList = {}
  1187.     ForListDo $(CardList)
  1188.         OpenRegKey $(!REG_H_LOCAL) "" $(NetworkCardsKeyName)"\"*($($),1) +
  1189.         $(MAXIMUM_ALLOWED) CardHandle
  1190.         ifint $(RegLastError) != 0
  1191.             return STATUS_FAILED
  1192.         endif
  1193.  
  1194.         GetRegValue $(CardHandle) ProductName value
  1195.         ifint $(RegLastError) != 0
  1196.             CloseRegKey $(CardHandle)
  1197.             return STATUS_FAILED
  1198.         endif
  1199.  
  1200.         ifstr *($(value),4) == $(ProductSoftwareName)
  1201.             GetRegValue $(CardHandle) ServiceName value
  1202.             ifint $(RegLastError) != 0
  1203.                 CloseRegKey $(CardHandle)
  1204.                 return STATUS_FAILED
  1205.             endif
  1206.  
  1207.             set disable = 0
  1208.             set currentCard = "\Device\"*($(value),4)
  1209.  
  1210.             ForListDo $(disableLinkages)
  1211.                 ifstr(i) $($) == $(currentCard)
  1212.                     set disable = 1
  1213.                 endif
  1214.             EndForListDo
  1215.  
  1216.             ifint $(disable) == 0
  1217.                 LibraryProcedure Result $(!LIBHANDLE) SetupStrncmp +
  1218.                 *($(value),4) $(compareString) $(compareSize)
  1219.                 ifint $(Result) == 0
  1220.                     set ndiswanList = >($(ndiswanList),*($(value),4))
  1221.                 else
  1222.                     set adapterList = >($(adapterList),*($(value),4))
  1223.                 endif
  1224.             else
  1225.                 ForListDo $(tcpDisableLinkages)
  1226.                     ifstr(i) $($) == $(currentCard)
  1227.                         set disable = 2
  1228.                     endif
  1229.                 EndForListDo
  1230.                 ifint $(disable) == 1
  1231.                     set tcpipDisableList = >($(tcpipDisableList),*($(value),4))
  1232.                 endif
  1233.             endif
  1234.  
  1235.             set-add RefCnt = $(RefCnt),1
  1236.         endif
  1237.  
  1238.         CloseRegKey $(CardHandle)
  1239.     EndForListDo
  1240.  
  1241.     ifstr $(!IM_NDISWAN) == ""
  1242.         set !IM_NDISWAN = {}
  1243.     endif
  1244.  
  1245.     Shell "" GetNtVersion
  1246.     ifstr $($R0) == "3.51"
  1247.         set disableLinkages = {}
  1248.         OpenRegKey $(!REG_H_LOCAL) "" +
  1249.         $(!NTN_ServiceBase)"\Tcpip\Linkage\Disabled" +
  1250.         $(MAXIMUM_ALLOWED) KeyProduct
  1251.         Ifstr $(KeyProduct) != $(KeyNull)
  1252.             GetRegValue $(KeyProduct) Bind disableLinkage
  1253.             ifint $(RegLastError) == 0
  1254.                 set disableLinkages = *($(disableLinkage),4)
  1255.             endif
  1256.             CloseRegKey $(KeyProduct)
  1257.         endif
  1258.  
  1259.         ForListDo $(!IM_NDISWAN)
  1260.             set disable = 0
  1261.             set currentCard = "\Device\"$($)
  1262.             ForListDo $(disableLinkages)
  1263.                 ifstr(i) $($) == $(currentCard)
  1264.                     set disable = 1
  1265.                 endif
  1266.             EndForListDo
  1267.             ifint $(disable) == 0
  1268.                 set TcpBind = >($(TcpBind), $(currentCard))
  1269.                 set TcpExport = >($(TcpExport),"\Device\Tcpip\"$($))
  1270.                 set NetBTExport = >($(NetBTExport),"\Device\NetBT_"$($))
  1271.                 set tmp = $(q)NdisWan$(q)" "$(q)$($)$(q)
  1272.                 set TcpRoute = >($(TcpRoute), $(tmp))
  1273.             endif
  1274.         EndForListDo
  1275.         goto fixupBindings_cont
  1276.     endif
  1277.  
  1278.     ForListDo $(!IM_NDISWAN)
  1279.         set currentCard = $(ProductSoftwareName)"_"$($)
  1280.         ForListDo $(ndiswanList)
  1281.             ifstr $(currentCard) == $($)
  1282.                 set ImBind = >($(ImBind), "\Device\"$($))
  1283.                 set ImExport = >($(ImExport), "\Device\"$($))
  1284.                 set ImRoute = >($(ImRoute), $(q)$($)$(q))
  1285.                 set TcpBind = >($(TcpBind), "\Device\"$($))
  1286.                 set TcpExport = >($(TcpExport), "\Device\Tcpip\"$($))
  1287.                 set NetBTExport = >($(NetBTExport),"\Device\NetBT_"$($))
  1288.                 set tmp = $(q)$(ProductSoftwareName)$(q)" "$(q)$($)$(q)
  1289.                 set TcpRoute = >($(TcpRoute), $(tmp))
  1290.             endif
  1291.         EndForListDo
  1292.     EndForListDo
  1293.  
  1294. fixupBindings_cont = +
  1295.  
  1296.     ForListDo $(adapterList)
  1297.         set ImBind = >($(ImBind), "\Device\"$($))
  1298.         set ImExport = >($(ImExport), "\Device\"$($))
  1299.         set ImRoute = >($(ImRoute), $(q)$($)$(q))
  1300.         set TcpBind = >($(TcpBind), "\Device\"$($))
  1301.         set TcpExport = >($(TcpExport), "\Device\Tcpip\"$($))
  1302.         set NetBTExport = >($(NetBTExport),"\Device\NetBT_"$($))
  1303.         set tmp = $(q)$(ProductSoftwareName)$(q)" "$(q)$($)$(q)
  1304.         set TcpRoute = >($(TcpRoute), $(tmp))
  1305.     EndForListDo
  1306.  
  1307.     ForListDo $(tcpipDisableList)
  1308.         set TcpBind = >($(TcpBind), "\Device\"$($))
  1309.         set TcpExport = >($(TcpExport), "\Device\Tcpip\"$($))
  1310.         set NetBTExport = >($(NetBTExport),"\Device\NetBT_"$($))
  1311.         set tmp = $(q)$(ProductSoftwareName)$(q)" "$(q)$($)$(q)
  1312.         set TcpRoute = >($(TcpRoute), $(tmp))
  1313.     EndForListDo
  1314.  
  1315.     OpenRegKey $(!REG_H_LOCAL) "" $(IMServiceKeyName) $(MAXIMUM_ALLOWED) +
  1316.         IMHandle  
  1317.     ifint $(RegLastError) != 0
  1318.         return STATUS_FAILED
  1319.     endif
  1320.  
  1321. fixupBindings_CreateTempKey = +
  1322.  
  1323.     CreateRegKey $(IMHandle) {$(temp),$(NoTitle),GenericClass} "" +
  1324.         $(MAXIMUM_ALLOWED) "" TempHandle
  1325.     ifint $(RegLastError) == 1011 ; key already exist
  1326.         DeleteRegTree $(IMHandle) $(temp)
  1327.         goto fixupBindings_CreateTempKey
  1328.     else-ifint $(RegLastError) != 0
  1329.         CloseRegKey $(IMHandle)
  1330.         return STATUS_FAILED
  1331.     endif
  1332.  
  1333.     set-subst NewValueList = {+
  1334.         {Bind,$(NoTitle),$(!REG_VT_MULTI_SZ),$(ImBind)},+
  1335.         {Export,$(NoTitle),$(!REG_VT_MULTI_SZ),$(ImExport)},+
  1336.         {Route,$(NoTitle),$(!REG_VT_MULTI_SZ),$(ImRoute)}}
  1337.  
  1338.     Shell $(UtilityInf) AddValueList $(TempHandle) $(NewValueList)
  1339.     Ifint $($ShellCode) != $(!SHELL_CODE_OK)
  1340.         set status = STATUS_FAILED
  1341.         goto fixupBindings_exit
  1342.     Endif
  1343.     Ifstr(i) $($R0) != NO_ERROR
  1344.         set status = STATUS_FAILED
  1345.         goto fixupBindings_exit
  1346.     Endif
  1347.  
  1348.     Shell "",CopyRegTree,$(IMServiceKeyName)"\"$(temp),$(IMServiceKeyName),+
  1349.         Linkage,$(NoTitle),GenericClass,FORCE
  1350.  
  1351.     set-subst NewValueList = {+
  1352.         {Bind,$(NoTitle),$(!REG_VT_MULTI_SZ),$(TcpBind)},+
  1353.         {Export,$(NoTitle),$(!REG_VT_MULTI_SZ),$(TcpExport)},+
  1354.         {Route,$(NoTitle),$(!REG_VT_MULTI_SZ),$(TcpRoute)}}
  1355.  
  1356.     Shell $(UtilityInf) AddValueList $(TempHandle) $(NewValueList)
  1357.     Ifint $($ShellCode) != $(!SHELL_CODE_OK)
  1358.         set status = STATUS_FAILED
  1359.         goto fixupBindings_exit
  1360.     Endif
  1361.     Ifstr(i) $($R0) != NO_ERROR
  1362.         set status = STATUS_FAILED
  1363.         goto fixupBindings_exit
  1364.     Endif
  1365.  
  1366.     Shell "",CopyRegTree,$(IMServiceKeyName)"\"$(temp),+
  1367.         $(!NTN_ServiceBase)"\Tcpip",Linkage,$(NoTitle),+
  1368.         GenericClass,FORCE
  1369.  
  1370.     set-subst NewValueList = {+
  1371.         {Bind,$(NoTitle),$(!REG_VT_MULTI_SZ),$(TcpBind)},+
  1372.         {Export,$(NoTitle),$(!REG_VT_MULTI_SZ),$(NetBTExport)},+
  1373.         {Route,$(NoTitle),$(!REG_VT_MULTI_SZ),$(TcpRoute)}}
  1374.  
  1375.     Shell $(UtilityInf) AddValueList $(TempHandle) $(NewValueList)
  1376.     Ifint $($ShellCode) != $(!SHELL_CODE_OK)
  1377.         set status = STATUS_FAILED
  1378.         goto fixupBindings_exit
  1379.     Endif
  1380.     Ifstr(i) $($R0) != NO_ERROR
  1381.         set status = STATUS_FAILED
  1382.         goto fixupBindings_exit
  1383.     Endif
  1384.  
  1385.     Shell "",CopyRegTree,$(IMServiceKeyName)"\"$(temp),+
  1386.         $(!NTN_ServiceBase)"\NetBT",Linkage,$(NoTitle),+
  1387.         GenericClass,FORCE
  1388.  
  1389.     OpenRegKey $(!REG_H_LOCAL) "" $(ProductKeyName) $(MAXIMUM_ALLOWED) SoftKey
  1390.     Ifstr $(SoftKey) != $(KeyNull)
  1391.         SetRegValue $(SoftKey) {RefCount,$(NoTitle),$(!REG_VT_DWORD),$(RefCnt)}
  1392.         CloseRegKey $(SoftKey)
  1393.     endif
  1394.  
  1395. fixupBindings_exit = +
  1396.  
  1397.     DeleteRegTree $(IMHandle) $(temp)
  1398.     CloseRegKey $(IMHandle)
  1399.     CloseRegKey $(TempHandle)
  1400.     return $(status)
  1401.  
  1402. ;*************************************************************************
  1403. ;
  1404. ;     SECTION:   GetImSampPath
  1405. ;
  1406. ;     PURPOSE:   <Get the ImSamp path>
  1407. ;
  1408. ;   ARGUMENTS:
  1409. ;
  1410. ;     RETURNS:   $R0 - STATUS_SUCCESSFUL/STATUS_FAILED
  1411. ;                $R1 - ImSamp path
  1412. ;
  1413. ;  REFERENCES:   <list of global or parent variables referenced>
  1414. ;
  1415. ;*************************************************************************
  1416. [GetImSampPath]
  1417.  
  1418.     read-syms GeneralConstants
  1419.     read-syms FileConstants
  1420.  
  1421.     OpenRegKey $(!REG_H_LOCAL) "" $(IMSoftwareKey)"TCPIP" +
  1422.             $(MAXIMUM_ALLOWED) KeySoftware
  1423.     Ifstr $(KeySoftware) != $(KeyNull)
  1424.         GetRegValue $(KeySoftware) Path value
  1425.         ifint $(RegLastError) == 0
  1426.             CloseRegKey $(KeySoftware)
  1427.             return STATUS_SUCCESSFUL, *($(value),4)
  1428.         endif
  1429.         CloseRegKey $(KeySoftware)
  1430.     endif
  1431.  
  1432.     return STATUS_FAILED
  1433.  
  1434. ;*************************************************************************
  1435. ;
  1436. ;     SECTION:   ReplaceText
  1437. ;
  1438. ;     PURPOSE:   <Replace string1 with string2 in text>
  1439. ;
  1440. ;   ARGUMENTS:   $0 - text
  1441. ;                $1 - string1
  1442. ;                $2 - string2
  1443. ;
  1444. ;     RETURNS:   $R0 - STATUS_SUCCESSFUL/STATUS_FAILED
  1445. ;
  1446. ;  REFERENCES:   <list of global or parent variables referenced>
  1447. ;
  1448. ;*************************************************************************
  1449. [ReplaceText]
  1450.  
  1451.     read-syms GeneralConstants
  1452.     read-syms FileConstants
  1453.  
  1454.     Shell "" GetImSampPath
  1455.     ifstr $($R0) != STATUS_SUCCESSFUL
  1456.         return $($R0)
  1457.     endif
  1458.  
  1459.     ifstr(i) $(!myLIBHANDLE) == ""
  1460.         LoadLibrary "x" $($R1)"\wgagent.dll" !myLIBHANDLE
  1461.     endif
  1462.     LibraryProcedure Result $(!myLIBHANDLE),ReplaceTxt,$($0),$($1),$($2)
  1463.     ;FreeLibrary $(myLIBHANDLE)
  1464.  
  1465.     ifint *($(Result),1) == 0
  1466.         return STATUS_SUCCESSFUL, *($(Result),2)
  1467.     else
  1468.         return STATUS_FAILED
  1469.     endif
  1470.  
  1471. ;*************************************************************************
  1472. ;
  1473. ;     SECTION:   FindNetworkCardProductName
  1474. ;
  1475. ;     PURPOSE:   <Find network card's product name from the service name
  1476. ;
  1477. ;   ARGUMENTS:   $0 - service name
  1478. ;
  1479. ;     RETURNS:   $R0 - STATUS_SUCCESSFUL/STATUS_FAILED
  1480. ;
  1481. ;  REFERENCES:   <list of global or parent variables referenced>
  1482. ;
  1483. ;*************************************************************************
  1484. [FindNetworkCardProductName]
  1485.  
  1486.     read-syms GeneralConstants
  1487.     read-syms FileConstants
  1488.  
  1489.     OpenRegKey $(!REG_H_LOCAL) "" $(NetworkCardsKeyName) $(MAXIMUM_ALLOWED) +
  1490.         KeyHandle
  1491.     Ifstr $(KeyHandle) != $(KeyNull)
  1492.         EnumRegKey $(KeyHandle) KeyList
  1493.         ifint $(RegLastError) == 0
  1494.             ForListDo $(KeyList)
  1495.                 OpenRegKey $(!REG_H_LOCAL) "" +
  1496.             $(NetworkCardsKeyName)"\"*($($),1) +
  1497.             $(MAXIMUM_ALLOWED) kHandle
  1498.                 Ifstr $(kHandle) != $(KeyNull)
  1499.                     GetRegValue $(kHandle) ServiceName value
  1500.                     ifint $(RegLastError) == 0
  1501.                         ifstr *($(value),4) == $($0)
  1502.                             GetRegValue $(kHandle) ProductName value
  1503.                             ifint $(RegLastError) == 0
  1504.                                 CloseRegKey $(kHandle)
  1505.                                 CloseRegKey $(KeyHandle)
  1506.                                 return STATUS_SUCCESSFUL, *($(value),4)
  1507.                             endif
  1508.                         endif
  1509.                     endif
  1510.                     CloseRegKey $(kHandle)
  1511.                 endif
  1512.             EndForListDo
  1513.         endif
  1514.         CloseRegKey $(KeyHandle)
  1515.     endif
  1516.  
  1517.     return STATUS_FAILED
  1518.  
  1519. ;*************************************************************************
  1520. ;
  1521. ;     SECTION:   FixupBindingsAfterRemove
  1522. ;
  1523. ;     PURPOSE:   <fixup the bindings after IM is removed
  1524. ;
  1525. ;   ARGUMENTS:   $0 - service bindings to fixup
  1526. ;
  1527. ;     RETURNS:   $R0 - 0 if success
  1528. ;
  1529. ;  REFERENCES:   <list of global or parent variables referenced>
  1530. ;
  1531. ;*************************************************************************
  1532. [FixupBindingsAfterRemove]
  1533.  
  1534.     read-syms GeneralConstants
  1535.     read-syms FileConstants
  1536.  
  1537.     set status = STATUS_SUCCESSFUL
  1538.  
  1539.     OpenRegKey $(!REG_H_LOCAL) "" $($0) $(MAXIMUM_ALLOWED) TcpHandle
  1540.     Ifstr $(TcpHandle) == $(KeyNull)
  1541.         return STATUS_FAILED
  1542.     endif
  1543.  
  1544.     set routeList = {}
  1545.  
  1546.     GetRegValue $(TcpHandle) Bind value
  1547.     ifint $(RegLastError) == 0
  1548.     set list = {}
  1549.     ForListDo *($(value),4)
  1550.             Shell "" ReplaceText $($) $(ProductSoftwareName)"_" ""
  1551.             ifstr $($R0) == STATUS_SUCCESSFUL
  1552.                 set list = >($(list),$($R1))
  1553.                 Split-String $($R1) "\" temp
  1554.                 set routeList = >($(routeList),*($(temp),4))
  1555.             endif
  1556.         EndForListDo
  1557.         ifstr $(list) != {}
  1558.             set NewValue = {Bind,$(NoTitle),$(!REG_VT_MULTI_SZ),$(list)}
  1559.             SetRegValue $(TcpHandle) $(NewValue)
  1560.         endif
  1561.     endif
  1562.  
  1563.     GetRegValue $(TcpHandle) Export value
  1564.     ifint $(RegLastError) == 0
  1565.         set list = {}
  1566.         ForListDo *($(value),4)
  1567.             Shell "" ReplaceText $($) $(ProductSoftwareName)"_" ""
  1568.             ifstr $($R0) == STATUS_SUCCESSFUL
  1569.                 set list = >($(list),$($R1))
  1570.             endif
  1571.         EndForListDo
  1572.         ifstr $(list) != {}
  1573.             set NewValue = {Export,$(NoTitle),$(!REG_VT_MULTI_SZ),$(list)}
  1574.             SetRegValue $(TcpHandle) $(NewValue)
  1575.         endif
  1576.     endif
  1577.  
  1578.     set route = {}
  1579.     set q = \042\042\042\042\042\042\042\042
  1580.     ForListDo $(routeList)
  1581.         Shell "" FindNetworkCardProductName $($)
  1582.         ifstr $($R0) == STATUS_SUCCESSFUL 
  1583.             set temp = $(q)$($R1)$(q)" "$(q)$($)$(q)
  1584.             set route = >($(route), $(temp))
  1585.         endif
  1586.     EndForListDo
  1587.  
  1588.     ifstr $(route) != {}
  1589.         set-subst NewValue = {{Route,$(NoTitle),$(!REG_VT_MULTI_SZ),$(route)}}
  1590.         Shell $(UtilityInf) AddValueList $(TcpHandle) $(NewValue)
  1591.     endif
  1592.  
  1593.     CloseRegKey $(TcpHandle)
  1594.     return STATUS_SUCCESSFUL
  1595.  
  1596. ;*************************************************************************
  1597. ;
  1598. ;     SECTION:   FixupAdaptersAfterRemove
  1599. ;
  1600. ;     PURPOSE:   <fixup the adapters after IM is removed
  1601. ;
  1602. ;   ARGUMENTS:
  1603. ;
  1604. ;     RETURNS:   $R0 - 0 if success
  1605. ;
  1606. ;  REFERENCES:   <list of global or parent variables referenced>
  1607. ;
  1608. ;*************************************************************************
  1609. [FixupAdaptersAfterRemove]
  1610.  
  1611.     read-syms GeneralConstants
  1612.     read-syms FileConstants
  1613.  
  1614.     OpenRegKey $(!REG_H_LOCAL) "" $(NetworkCardsKeyName) $(MAXIMUM_ALLOWED) +
  1615.         KeyHandle
  1616.     Ifstr $(KeyHandle) != $(KeyNull)
  1617.  
  1618.         EnumRegKey $(KeyHandle) KeyList
  1619.         ifint $(RegLastError) == 0
  1620.  
  1621.             ForListDo $(KeyList)
  1622.                 set deleteSrcKey = NO
  1623.                 set oldInstance = *($($),1)
  1624.                 set srcKey = $(NetworkCardsKeyName)"\"$(oldInstance)
  1625.                 OpenRegKey $(!REG_H_LOCAL) "" $(srcKey) +
  1626.             $(MAXIMUM_ALLOWED) kHandle
  1627.                 Ifstr $(kHandle) != $(KeyNull)
  1628.  
  1629.                     GetRegValue $(kHandle) ProductName product
  1630.                     ifint $(RegLastError) == 0
  1631.  
  1632.                         GetRegValue $(kHandle) ServiceName service
  1633.                         ifint $(RegLastError) == 0
  1634.  
  1635.                             set productStr = *($(product),4)
  1636.                             set serviceStr = *($(service),4)
  1637.                             Split-String $(productStr) $(productStr) product
  1638.                             Split-String $(serviceStr) $(serviceStr) service
  1639.                             QueryListSize productSize $(product)
  1640.                             QueryListSize serviceSize $(service)
  1641.  
  1642.                             ifint $(serviceSize) > $(productSize)
  1643.                                 set count = 0
  1644.                                 set instance = 0
  1645.                                 ForListDo $(service)
  1646.                                     set-add count = $(count),1
  1647.                                     ifint $(count) > $(productSize)
  1648.                                         set-mul instance = $(instance),10
  1649.                                         set-add instance = $(instance),$($)
  1650.                                     endif
  1651.                                 EndForListDo
  1652.  
  1653.                                 ifint $(oldInstance) != $(instance)
  1654.                                     Shell "",CopyRegTree,$(srcKey),+
  1655.                     $(NetworkCardsKeyName),$(instance),+
  1656.                     $(NoTitle),GenericClass,FORCE
  1657.                                     Ifint $($ShellCode) == $(!SHELL_CODE_OK)
  1658.                                         Ifstr $($R0) == STATUS_SUCCESSFUL
  1659.                                             set deleteSrcKey = YES
  1660.                                         endif
  1661.                                     endif
  1662.                                 endif
  1663.                             endif
  1664.                         endif
  1665.                     endif
  1666.  
  1667.                     CloseRegKey $(kHandle)
  1668.  
  1669.                     ifstr $(deleteSrcKey) == YES
  1670.                         OpenRegKey $(!REG_H_LOCAL) "" $(NetworkCardsKeyName) +
  1671.                 $(MAXIMUM_ALLOWED) kHandle
  1672.                         Ifstr $(kHandle) != $(KeyNull)
  1673.                             DeleteRegTree $(kHandle) $(oldInstance)
  1674.                             CloseRegKey $(kHandle)
  1675.                         endif
  1676.                     endif
  1677.  
  1678.                 endif
  1679.             EndForListDo
  1680.         endif
  1681.     Endif
  1682.  
  1683.     return STATUS_SUCCESSFUL
  1684.  
  1685. ;*************************************************************************
  1686. ;
  1687. ;     SECTION:   FixupTransportsAfterRemove
  1688. ;
  1689. ;     PURPOSE:   <fixup the transports after IM is removed
  1690. ;
  1691. ;   ARGUMENTS:
  1692. ;
  1693. ;     RETURNS:   $R0 - 0 if success
  1694. ;
  1695. ;  REFERENCES:   <list of global or parent variables referenced>
  1696. ;
  1697. ;*************************************************************************
  1698. [FixupTransportsAfterRemove]
  1699.  
  1700.     read-syms GeneralConstants
  1701.     read-syms FileConstants
  1702.  
  1703.     OpenRegKey $(!REG_H_LOCAL) "" $(NetBTServiceKey) +
  1704.         $(MAXIMUM_ALLOWED) Transport
  1705.     Ifstr $(Transport) == $(KeyNull)
  1706.         return STATUS_FAILED
  1707.     endif
  1708.  
  1709.     EnumRegKey $(Transport) CardList
  1710.     ifint $(RegLastError) != 0
  1711.         CloseRegKey $(Transport)
  1712.         return STATUS_FAILED
  1713.     endif
  1714.  
  1715.     ForListDo $(CardList)
  1716.         set source = *($($),1)
  1717.         Split-String $(source) "_" name
  1718.         ifstr *($(name),1) == $(ProductSoftwareName)
  1719.             Debug-Output $(name)
  1720.             ifstr *($(name),2) == "_"
  1721.                 set card = ""
  1722.                 ForListDo $(name)
  1723.                     ifint $(#) > 2
  1724.                         set card = $(card)$($)
  1725.                     endif
  1726.                 EndForListDo
  1727.  
  1728.                 Shell "",CopyRegTree,$(NetBTServiceKey)"\"$(source),+
  1729.             $(NetBTServiceKey),$(card),+
  1730.             $(NoTitle),GenericClass,FORCE
  1731.  
  1732.                 DeleteRegTree $(Transport) $(source)
  1733.             endif
  1734.         endif
  1735.     EndForListDo
  1736.  
  1737.     CloseRegKey $(Transport)
  1738.  
  1739.     return STATUS_SUCCESSFUL
  1740.  
  1741. ;*************************************************************************
  1742. ;
  1743. ;     SECTION:   FixupServicesAfterRemove
  1744. ;
  1745. ;     PURPOSE:   <fixup the services after IM is removed
  1746. ;
  1747. ;   ARGUMENTS:
  1748. ;
  1749. ;     RETURNS:   $R0 - 0 if success
  1750. ;
  1751. ;  REFERENCES:   <list of global or parent variables referenced>
  1752. ;
  1753. ;*************************************************************************
  1754.  
  1755. [FixupServicesAfterRemove]
  1756.  
  1757.     read-syms GeneralConstants
  1758.     read-syms FileConstants
  1759.  
  1760.     ForListDo $(FixupServices)
  1761.  
  1762.         OpenRegKey $(!REG_H_LOCAL) "" $($) $(MAXIMUM_ALLOWED) Service
  1763.         Ifstr $(Service) != $(KeyNull)
  1764.  
  1765.             GetRegValue $(Service) Bind value
  1766.             ifint $(RegLastError) == 0
  1767.                 set outValue = {}
  1768.                 ForListDo *($(value),4)
  1769.                     Split-String $($) "\_" name
  1770.                     ifstr *($(name),6) != $(ProductSoftwareName)
  1771.                         set outValue = >($(outValue), $($))
  1772.                     else
  1773.                         set out = ""
  1774.                         ForListDo $(name)
  1775.                             ifint $(#) != 6
  1776.                                 ifint $(#) != 7
  1777.                                     set out = $(out)$($)
  1778.                                 endif
  1779.                             endif
  1780.                         EndForListDo
  1781.                         set outValue = >($(outValue), $(out))
  1782.                     endif
  1783.                 EndForListDo
  1784.                 set value = {{Bind,$(NoTitle),$(!REG_VT_MULTI_SZ),$(outValue)}}
  1785.                 Shell  $(UtilityInf), AddValueList, $(Service), $(value)
  1786.             endif
  1787.  
  1788.             GetRegValue $(Service) Export value
  1789.             ifint $(RegLastError) == 0
  1790.                 set outValue = {}
  1791.                 ForListDo *($(value),4)
  1792.                     Split-String $($) "\_" name
  1793.                     ifstr *($(name),8) != $(ProductSoftwareName)
  1794.                         set outValue = >($(outValue), $($))
  1795.                     else
  1796.                         set out = ""
  1797.                         ForListDo $(name)
  1798.                             ifint $(#) != 8
  1799.                                 ifint $(#) != 9
  1800.                                     set out = $(out)$($)
  1801.                                 endif
  1802.                             endif
  1803.                         EndForListDo
  1804.                         set outValue = >($(outValue), $(out))
  1805.                     endif
  1806.                 EndForListDo
  1807.                 set value = {{Export,$(NoTitle),+
  1808.                 $(!REG_VT_MULTI_SZ),$(outValue)}}
  1809.                 Shell  $(UtilityInf), AddValueList, $(Service), $(value)
  1810.             endif
  1811.  
  1812.             GetRegValue $(Service) Route value
  1813.             ifint $(RegLastError) == 0
  1814.                 set outValue = {}
  1815.                 set q = \042\042\042\042\042\042\042\042
  1816.                 set-subst quote = "\042"
  1817.  
  1818.                 ForListDo *($(value),4)
  1819.                     Shell "" ReplaceText $($), $(quote), ""
  1820.                     ifstr $($R0) == STATUS_SUCCESSFUL
  1821.                         Split-String $($R1) " " name
  1822.                         Split-String *($(name),3) "_" product
  1823.  
  1824.                         ifstr *($(product),1) != $(ProductSoftwareName)
  1825.                             set out = ""
  1826.                             ForListDo $(name)
  1827.                                 ifstr $($) == " "
  1828.                                     set out = $(out)$($)
  1829.                                 else
  1830.                                     set out = $(out)$(q)$($)$(q)
  1831.                                 endif
  1832.                             EndForListDo
  1833.                             Shell "" ReplaceText $(out), $(quote), ""
  1834.                             set outValue = >($(outValue), $($R1))
  1835.                         else
  1836.                             set serviceName = ""
  1837.                             ForListDo $(product)
  1838.                                 ifint $(#) > 2
  1839.                                     set serviceName = $(serviceName)$($)
  1840.                                 endif
  1841.                             EndForListDo
  1842.  
  1843.                             LibraryProcedure Result $(!LIBHANDLE) SetupStrncmp +
  1844.                         $(serviceName) "NdisWan" 7
  1845.                             ifint $(Result) == 0
  1846.                                 set out = $(q)*($(name),1)$(q)" "+
  1847.                         $(q)$(serviceName)$(q)
  1848.                                 set outValue = >($(outValue), $(out))
  1849.                             else
  1850.                                 Shell "" FindNetworkCardProductName +
  1851.                     $(serviceName)
  1852.                                 ifstr $($R0) == STATUS_SUCCESSFUL 
  1853.                                     set out = $(q)*($(name),1)$(q)" "+
  1854.                         $(q)$($R1)$(q)" "+
  1855.                         $(q)$(serviceName)$(q)
  1856.                                     set outValue = >($(outValue), $(out))
  1857.                                 endif
  1858.                             endif
  1859.                         endif
  1860.                     endif
  1861.                 EndForListDo
  1862.                 set-subst value = {{Route,$(NoTitle),+
  1863.                     $(!REG_VT_MULTI_SZ),$(outValue)}}
  1864.                 Shell  $(UtilityInf), AddValueList, $(Service), $(value)
  1865.             endif
  1866.  
  1867.         endif
  1868.  
  1869.     EndForListDo
  1870.  
  1871.     return STATUS_SUCCESSFUL
  1872.  
  1873.  
  1874. ;*************************************************************************
  1875. ;
  1876. ;     SECTION:   NdisWanSupport
  1877. ;
  1878. ;     PURPOSE:   Support NdisWan adapters
  1879. ;
  1880. ;   ARGUMENTS:
  1881. ;
  1882. ;     RETURNS:   $R0 - 0 for yes, 1 for no
  1883. ;
  1884. ;  REFERENCES:   <list of global or parent variables referenced>
  1885. ;
  1886. ;*************************************************************************
  1887. [NdisWanSupport]
  1888.  
  1889.     Shell "" GetNtVersion
  1890.     ifstr $($R0) == "3.51"
  1891.         return 0
  1892.     endif
  1893.  
  1894.     read-syms FileConstants
  1895.  
  1896.     return $(NoNdisWanSupport)
  1897.  
  1898. ;*************************************************************************
  1899. ;
  1900. ;     SECTION:   GetNtVersion
  1901. ;
  1902. ;     PURPOSE:   Get Windows NT Version
  1903. ;
  1904. ;   ARGUMENTS:
  1905. ;
  1906. ;     RETURNS:   $R0 - NT version or return code
  1907. ;
  1908. ;  REFERENCES:   <list of global or parent variables referenced>
  1909. ;
  1910. ;*************************************************************************
  1911. [GetNtVersion]
  1912.  
  1913.     ifstr $(!IM_NT_VERSION) != ""
  1914.         return $(!IM_NT_VERSION)
  1915.     endif
  1916.  
  1917.     read-syms GeneralConstants
  1918.     read-syms FileConstants
  1919.  
  1920.     OpenRegKey $(!REG_H_LOCAL) "" $(NtCurrentVersion) $(MAXIMUM_ALLOWED) Handle 
  1921.     ifint $(RegLastError) != 0
  1922.         return STATUS_FAILED
  1923.     endif
  1924.  
  1925.     GetRegValue $(Handle) CurrentVersion value
  1926.     ifint $(RegLastError) != 0
  1927.         CloseRegKey $(Handle)
  1928.         return STATUS_FAILED
  1929.     endif
  1930.  
  1931.     CloseRegKey $(Handle)
  1932.     set !IM_NT_VERSION = *($(value),4)
  1933.     return $(!IM_NT_VERSION)
  1934.  
  1935. ;*************************************************************************
  1936. ;
  1937. ;     SECTION:   CopyRegTree
  1938. ;
  1939. ;     PURPOSE:   <duplicate registry tree>
  1940. ;
  1941. ;   ARGUMENTS:   $0 - Source Tree
  1942. ;                $1 - Destination Base
  1943. ;                $2 - Destination Key Name
  1944. ;                $3 - Destination Key Index
  1945. ;                $4 - Destination Key Class
  1946. ;                $5 - FORCE overwrite or not
  1947. ;
  1948. ;     RETURNS:   $R0 - 0 if success
  1949. ;
  1950. ;  REFERENCES:   <list of global or parent variables referenced>
  1951. ;
  1952. ;*************************************************************************
  1953. [CopyRegTree]
  1954.  
  1955.     read-syms GeneralConstants
  1956.     read-syms FileConstants
  1957.  
  1958.     Shell "" GetImSampPath
  1959.     ifstr $($R0) != STATUS_SUCCESSFUL
  1960.         goto previous_CopyRegTree
  1961.     endif
  1962.  
  1963.     ifstr(i) $(!myLIBHANDLE) == ""
  1964.         LoadLibrary "x" $($R1)"\wgagent.dll" !myLIBHANDLE
  1965.     endif
  1966.     LibraryProcedure Result $(!myLIBHANDLE),CopyRegTree,$($0),$($1),$($2),+
  1967.             $($3),$($4),$($5)
  1968.     ;FreeLibrary $(myLIBHANDLE)
  1969.  
  1970.     ifint *($(Result),1) == 0
  1971.         return STATUS_SUCCESSFUL
  1972.     else
  1973.         return STATUS_FAILED
  1974.     endif
  1975.  
  1976. previous_CopyRegTree = +
  1977.  
  1978.     Shell "" GetNtVersion
  1979.     ifstr $($R0) == "3.51"
  1980.         goto old_CopyRegTree
  1981.     endif
  1982.  
  1983. new_CopyRegTree = +
  1984.  
  1985.     OpenRegKey $(!REG_H_LOCAL) "" $($0) $(MAXIMUM_ALLOWED) srcHandle  
  1986.     ifint $(RegLastError) != 0
  1987.         return STATUS_FAILED
  1988.     endif
  1989.  
  1990.     OpenRegKey $(!REG_H_LOCAL) "" $($1) $(MAXIMUM_ALLOWED) dstHandle  
  1991.     ifint $(RegLastError) != 0
  1992.         CloseRegKey $(srcHandle)
  1993.         return STATUS_FAILED
  1994.     endif
  1995.  
  1996.     CreateRegKey $(dstHandle) {$($2),$($3),$($4)} "" $(MAXIMUM_ALLOWED) "" dst  
  1997.  
  1998.     ifint $(RegLastError) == 0
  1999.         CloseRegKey $(dstHandle)
  2000.     else-ifint $(RegLastError) == 1011 ; key already exist
  2001.         CloseRegKey $(dstHandle)
  2002.         OpenRegKey $(!REG_H_LOCAL) "" $($1)"\"$($2) $(MAXIMUM_ALLOWED) dst
  2003.         ifint $(RegLastError) != 0
  2004.             CloseRegKey $(srcHandle)
  2005.             return STATUS_FAILED
  2006.         endif
  2007.     else
  2008.         CloseRegKey $(dstHandle)
  2009.         CloseRegKey $(srcHandle)
  2010.         return STATUS_FAILED
  2011.     endif
  2012.  
  2013.     LibraryProcedure CopyResult $(!NCPA_HANDLE),RegCopyTree,$(srcHandle),$(dst) 
  2014.     Set CopyError = *($(CopyResult),1)
  2015.     CloseRegKey $(srcHandle)
  2016.     CloseRegKey $(dst)
  2017.     Ifint $(CopyError) != 0
  2018.         return STATUS_FAILED
  2019.     endif
  2020.  
  2021.     return STATUS_SUCCESSFUL
  2022.  
  2023. ;
  2024. ; Old CopyRegTree routine.  There is limitation/bug in EnumRegValue in that
  2025. ; it can't always read all the registry values.  The library procedure in
  2026. ; NCPA don't seem to have this problem!
  2027. ;
  2028.  
  2029. old_CopyRegTree = +
  2030. ;   Shell $(subroutineinf) SetupMessage,$(!STF_LANGUAGE), "NONFATAL", +
  2031. ;    $($0)" "$($1)" "$($2)" "$($3)" "$($4)
  2032.  
  2033.     OpenRegKey $(!REG_H_LOCAL) "" $($0) $(MAXIMUM_ALLOWED) KeyHandle  
  2034.     ifint $(RegLastError) != 0
  2035.         goto error_copyTree
  2036.     endif
  2037.  
  2038.     EnumRegValue $(KeyHandle) ValueList
  2039. ;   ifint $(RegLastError) != 0
  2040. ;       CloseRegKey $(KeyHandle)
  2041. ;       goto error_copyTree
  2042. ;   endif
  2043.  
  2044.     EnumRegKey $(KeyHandle) KeyList
  2045.     ifint $(RegLastError) != 0
  2046.         CloseRegKey $(KeyHandle)
  2047.         goto error_copyTree
  2048.     endif
  2049.  
  2050.     CloseRegKey $(KeyHandle)
  2051.  
  2052.     OpenRegKey $(!REG_H_LOCAL) "" $($1) $(MAXIMUM_ALLOWED) KeyHandle  
  2053.     ifint $(RegLastError) != 0
  2054.         goto error_copyTree
  2055.     endif
  2056.  
  2057.     set NewKey = {$($2),$($3),$($4)}
  2058. ;   Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), "NONFATAL", $(NewKey)
  2059.     CreateRegKey $(KeyHandle) $(NewKey) "" $(MAXIMUM_ALLOWED) "" +
  2060.         NewKeyHandle  
  2061.  
  2062.     ifint $(RegLastError) == 0
  2063.         CloseRegKey $(KeyHandle)
  2064.         goto addValueList_copyTree
  2065.     else-ifint $(RegLastError) == 1011 ; key already exist
  2066.         CloseRegKey $(KeyHandle)
  2067.         goto openRegKey_copyTree
  2068.     else
  2069.         CloseRegKey $(KeyHandle)
  2070.         goto error_copyTree
  2071.     endif
  2072.  
  2073. openRegKey_copyTree = +
  2074.  
  2075.     OpenRegKey $(!REG_H_LOCAL) "" $($1)"\"$($2) $(MAXIMUM_ALLOWED) +
  2076.         NewKeyHandle
  2077.     ifint $(RegLastError) != 0
  2078.         goto error_copyTree
  2079.     endif
  2080.  
  2081. addValueList_copyTree = +
  2082.  
  2083.     ifstr $(ValueList) != ""
  2084.         ForListDo $(ValueList)
  2085.             ifstr $($5) == FORCE
  2086.                 SetRegValue $(NewKeyHandle) $($)
  2087.             else
  2088.                 GetRegValue $(NewKeyHandle) *($($),1) value
  2089.                 ifint $(RegLastError) != 0
  2090.                     SetRegValue $(NewKeyHandle) $($)
  2091.                 endif
  2092.             endif
  2093.         EndForListDo
  2094.     endif
  2095.  
  2096.     CloseRegKey $(NewKeyHandle)
  2097.  
  2098.     ForListDo $(KeyList)
  2099.         set NewKey = *($($),1)
  2100.         Shell "",CopyRegTree,$($0)"\"$(NewKey),$($1)"\"$($2),$(NewKey),+
  2101.             *($($),2),*($($),3),$($5)
  2102.         ifint $($ShellCode) != $(!SHELL_CODE_OK)
  2103.             goto error_copyTree
  2104.         endif
  2105.         ifstr $($R0) != STATUS_SUCCESSFUL
  2106.             goto error_copyTree
  2107.         endif
  2108.     EndForListDo
  2109.     return STATUS_SUCCESSFUL
  2110.  
  2111. error_copyTree = +
  2112. ;   Shell $(subroutineinf) SetupMessage,$(!STF_LANGUAGE),"NONFATAL",errCopyTree
  2113.     OpenRegKey $(!REG_H_LOCAL) "" $($1) $(MAXIMUM_ALLOWED) KeyHandle  
  2114.     ifint $(RegLastError) == 0
  2115.         DeleteRegTree $(KeyHandle) $($2)
  2116.     endif
  2117.     CloseRegKey $(KeyHandle)
  2118.     return STATUS_FAILED
  2119.  
  2120. ;*************************************************************************
  2121. ;
  2122. ;     SECTION:   RemoveIMServices
  2123. ;
  2124. ;     PURPOSE:   <remove IM services>
  2125. ;
  2126. ;   ARGUMENTS:
  2127. ;
  2128. ;     RETURNS:
  2129. ;
  2130. ;  REFERENCES:   <list of global or parent variables referenced>
  2131. ;
  2132. ;*************************************************************************
  2133. [RemoveIMServices]
  2134.  
  2135.     read-syms GeneralConstants
  2136.     read-syms FileConstants
  2137.  
  2138.     OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_ServiceBase) $(MAXIMUM_ALLOWED) +
  2139.         KeyHandle
  2140.     Ifstr $(KeyHandle) != $(KeyNull)
  2141.         EnumRegKey $(KeyHandle) KeyList
  2142.         Ifint $(RegLastError) == 0
  2143.             ForListDo $(KeyList)
  2144.                 Split-String *($($),1) "_" KeyCheck
  2145.                 ifstr *($(KeyCheck),1) == $(ProductSoftwareName)
  2146.             Debug-Output $(KeyCheck)
  2147.                     ifstr *($(KeyCheck),2) == "_"
  2148.                 Debug-Output *($($),1)
  2149.                         DeleteRegTree $(KeyHandle) *($($),1)
  2150.                     endif
  2151.                 endif
  2152.             EndForListDo
  2153.         Endif
  2154.         CloseRegKey $(KeyHandle)
  2155.     endif
  2156.     return
  2157.  
  2158. ;*************************************************************************
  2159. ;
  2160. ;     SECTION:   RemoveIMCards
  2161. ;
  2162. ;     PURPOSE:   <remove IM cards>
  2163. ;
  2164. ;   ARGUMENTS:   $0 - if "UNWANTED" then only remove unused IM cards
  2165. ;
  2166. ;     RETURNS:   $R0 - STATUS_SUCCESSFUL or STATUS_REBIND
  2167. ;
  2168. ;  REFERENCES:   <list of global or parent variables referenced>
  2169. ;
  2170. ;*************************************************************************
  2171. [RemoveIMCards]
  2172.  
  2173.     read-syms GeneralConstants
  2174.     read-syms FileConstants
  2175.  
  2176.     set status = STATUS_SUCCESSFUL
  2177.  
  2178.     OpenRegKey $(!REG_H_LOCAL) "" $(NetworkCardsKeyName) $(MAXIMUM_ALLOWED) +
  2179.         KeyHandle
  2180.     Ifstr $(KeyHandle) != $(KeyNull)
  2181.         EnumRegKey $(KeyHandle) KeyList
  2182.         ifint $(RegLastError) == 0
  2183.             ForListDo $(KeyList)
  2184.                 OpenRegKey $(!REG_H_LOCAL) "" +
  2185.             $(NetworkCardsKeyName)"\"*($($),1) +
  2186.             $(MAXIMUM_ALLOWED) kHandle
  2187.                 Ifstr $(kHandle) != $(KeyNull)
  2188.                     GetRegValue $(kHandle) ProductName value
  2189.                     ifint $(RegLastError) == 0
  2190.                         ifstr *($(value),4) == $(ProductSoftwareName)
  2191.                           set skipDelete = NO
  2192.  
  2193.                           GetRegValue $(kHandle) ServiceName value
  2194.                           ifint $(RegLastError) == 0
  2195.                             ifstr $($0) == UNWANTED
  2196.                               Split-String *($(value),4) "_" name
  2197.                               ifstr *($(name),1) == $(ProductSoftwareName)
  2198.                                 ForListDo $(KeyList)
  2199.                                   OpenRegKey $(!REG_H_LOCAL) "" +
  2200.                     $(NetworkCardsKeyName)"\"*($($),1) +
  2201.                     $(MAXIMUM_ALLOWED) rHandle
  2202.                                   ifstr $(rHandle) != $(KeyNull)
  2203.                                     GetRegValue $(rHandle) ServiceName service
  2204.                                     ifint $(RegLastError) == 0
  2205.                                       set svc = ""
  2206.                                       ForListDo $(name)
  2207.                                         ifint $(#) > 2
  2208.                                           set svc = $(svc)$($)
  2209.                                         endif
  2210.                                       EndForListDo
  2211.                                       ifstr *($(service),4) == $(svc)
  2212.                                         set skipDelete = YES
  2213.                                       endif
  2214.                                     endif
  2215.                                     CloseRegKey $(rHandle)
  2216.                                   endif
  2217.                                 EndForListDo
  2218.                               endif
  2219.                             endif
  2220.                           endif
  2221.  
  2222.                           ifstr $(skipDelete) == NO
  2223.                             ;
  2224.                             ; delete the corresponding service too
  2225.                             ;
  2226.                             OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_ServiceBase) +
  2227.                     $(MAXIMUM_ALLOWED) rHandle
  2228.                             ifstr $(rHandle) != $(KeyNull)
  2229.                               DeleteRegTree $(rHandle) *($(value),4)
  2230.                               CloseRegKey $(rHandle)
  2231.                             endif
  2232.  
  2233.                             Debug-Output $($)
  2234.                             DeleteRegTree $(KeyHandle) *($($),1)
  2235.  
  2236.                             set status = STATUS_REBIND
  2237.                           endif
  2238.                         endif
  2239.                     endif
  2240.                     CloseRegKey $(kHandle)
  2241.                 endif
  2242.             EndForListDo
  2243.         endif
  2244.         CloseRegKey $(KeyHandle)
  2245.     endif
  2246.     return $(status)
  2247.  
  2248. ;*************************************************************************
  2249. ;
  2250. ;     SECTION:   AddIMCard
  2251. ;
  2252. ;     PURPOSE:   <add IM card>
  2253. ;
  2254. ;   ARGUMENTS:   $0 - card to add
  2255. ;                $1 - parent key name
  2256. ;                $2 - InfOption
  2257. ;                $3 - card instance
  2258. ;                $4 - NDISWAN?
  2259. ;
  2260. ;     RETURNS:   $R0: STATUS_FAILED, STATUS_SUCCESSFUL, STATUS_REBIND
  2261. ;
  2262. ;  REFERENCES:   <list of global or parent variables referenced>
  2263. ;
  2264. ;*************************************************************************
  2265. [AddIMCard]
  2266.  
  2267.     read-syms GeneralConstants
  2268.     read-syms FileConstants
  2269.     read-syms FileConstantsENG
  2270.  
  2271.     OpenRegKey $(!REG_H_LOCAL) "" $($1) $(MAXIMUM_ALLOWED) KeyCard
  2272.     Ifstr $(KeyCard) == $(KeyNull)
  2273.         return STATUS_FAILED
  2274.     Endif
  2275.  
  2276.     EnumRegKey $(KeyCard) cardList
  2277.     Ifint $(RegLastError) != 0
  2278.         CloseRegKey $(KeyCard)
  2279.         return STATUS_FAILED
  2280.     Endif
  2281.  
  2282.     ForListDo $(cardList)
  2283.         set Card = $($1)"\"*($($),1)
  2284.         OpenRegKey $(!REG_H_LOCAL) "" $(Card) $(MAXIMUM_ALLOWED) kHandle
  2285.         Ifstr $(kHandle) != $(KeyNull)
  2286.             GetRegValue $(kHandle) ServiceName serviceName
  2287.             Ifint $(RegLastError) == 0
  2288.                 Ifstr *($(serviceName),4) == $(ProductSoftwareName)"_"$($0)
  2289.                     CloseRegKey $(KeyCard)
  2290.                     CloseRegKey $(kHandle)
  2291.                     return STATUS_SUCCESS ;Card already exist
  2292.                 Endif
  2293.             Endif
  2294.             CloseRegKey $(kHandle)
  2295.         Endif
  2296.     EndForListDo
  2297.  
  2298.     ForListDo $(cardList)
  2299.         set Card = $($1)"\"*($($),1)
  2300.         OpenRegKey $(!REG_H_LOCAL) "" $(Card) $(MAXIMUM_ALLOWED) kHandle
  2301.         Ifstr $(kHandle) != $(KeyNull)
  2302.             GetRegValue $(kHandle) ServiceName serviceName
  2303.             Ifint $(RegLastError) == 0
  2304.                 Ifstr *($(serviceName),4) == $($0)
  2305.                     ;
  2306.                     ; get a new instance value
  2307.                     ;
  2308.                     Shell $(UtilityInf),AssignAdapterNumber,"",1
  2309.                     Ifint $($ShellCode) != $(!SHELL_CODE_OK)
  2310.                         set NewCardInstance = 9*($($),1)
  2311.                     Else-Ifstr(i) $($R0) != NO_ERROR
  2312.                         set NewCardInstance = 8*($($),1)
  2313.                     Else
  2314.                         set NewCardInstance = $($R1)
  2315.                     Endif
  2316.  
  2317.                     CreateRegKey $(KeyCard) +
  2318.             {$(NewCardInstance),$(NoTitle),GenericClass} "" +
  2319.             $(MAXIMUM_ALLOWED) "" newHandle
  2320.                     Ifstr $(newHandle) != $(KeyNull)
  2321.                         GetRegValue $(kHandle) Title title
  2322.                         GetRegValue $(kHandle) Description desc
  2323.                         set serviceName = $(ProductSoftwareName)"_"$($0)
  2324.  
  2325.                         detect date
  2326.  
  2327.                         Shell "" GetNtVersion
  2328.                         ifstr $($R0) == "3.51"
  2329.  
  2330.                             set NewValueList = {+
  2331.                 {Title,$(NoTitle),$(!REG_VT_SZ),+
  2332. +;                               "["$(NewCardInstance)"] "+
  2333.                  $(ProductSoftwareTitle)" "+
  2334.                  *($(title),4)},+
  2335.                 {Description,$(NoTitle),$(!REG_VT_SZ),+
  2336.                  $(ProductSoftwareTitle)" -> "*($(desc),4)},+
  2337.                 {Manufacturer,$(NoTitle),$(!REG_VT_SZ),+
  2338.                  $(Manufacturer)},+
  2339.                 {ProductName,$(NoTitle),$(!REG_VT_SZ),+
  2340.                  $(ProductSoftwareName)},+
  2341.                 {ServiceName,$(NoTitle),$(!REG_VT_SZ),+
  2342.                  $(serviceName)},+
  2343.                 {InstallDate,$(NoTitle),$(!REG_VT_DWORD),+
  2344.                  *($(Now),1)}}
  2345.                         else
  2346.                             Ifint $($4) == 0
  2347.                                 set NewValueList = {+
  2348.                   {Title,$(NoTitle),$(!REG_VT_SZ),+
  2349. +;                  "["$(NewCardInstance)"] "+
  2350. +;                  $(ProductSoftwareTitle)" -> "+
  2351.                    *($(title),4)},+
  2352.                   {Description,$(NoTitle),$(!REG_VT_SZ),+
  2353.                    $(ProductSoftwareTitle)" -> "*($(desc),4)},+
  2354.                   {Manufacturer,$(NoTitle),$(!REG_VT_SZ),+
  2355.                    $(Manufacturer)},+
  2356.                   {ProductName,$(NoTitle),$(!REG_VT_SZ),+
  2357.                    $(ProductSoftwareName)},+
  2358.                   {ServiceName,$(NoTitle),$(!REG_VT_SZ),+
  2359.                    $(serviceName)},+
  2360.                   {OperationsSupport,$(NoTitle),+
  2361.                    $(!REG_VT_DWORD),$(ProductHardwareSupport)},+
  2362.                   {InstallDate,$(NoTitle),$(!REG_VT_DWORD),+
  2363.                    *($(Now),1)}}
  2364.                             else
  2365.                                 set NewValueList = {+
  2366.                   {Title,$(NoTitle),$(!REG_VT_SZ),+
  2367. +;                  "["$(NewCardInstance)"] "+
  2368. +;                  $(ProductSoftwareTitle)" -> "+
  2369.                    *($(title),4)},+
  2370.                   {Description,$(NoTitle),$(!REG_VT_SZ),+
  2371.                    $(ProductSoftwareTitle)" -> "*($(desc),4)},+
  2372.                   {Manufacturer,$(NoTitle),$(!REG_VT_SZ),+
  2373.                    $(Manufacturer)},+
  2374.                   {ProductName,$(NoTitle),$(!REG_VT_SZ),+
  2375.                    $(ProductSoftwareName)},+
  2376.                   {ServiceName,$(NoTitle),$(!REG_VT_SZ),+
  2377.                    $(serviceName)},+
  2378.                   {Hidden,$(NoTitle),$(!REG_VT_DWORD),1},+
  2379.                   {InstallDate,$(NoTitle),$(!REG_VT_DWORD),+
  2380.                    *($(Now),1)}}
  2381.                             endif
  2382.                         endif
  2383.  
  2384.                         Shell  $(UtilityInf), AddValueList, $(newHandle),+
  2385.                 $(NewValueList)
  2386.  
  2387.                         CreateRegKey $(newHandle) +
  2388.                 {NetRules,$(NoTitle),GenericClass} "" +
  2389.                 $(MAXIMUM_ALLOWED) "" netHandle
  2390.                         Ifstr $(netHandle) != $(KeyNull)
  2391.                             set-subst bindform = "\042"$(serviceName)"\042"+
  2392.                         $(NetRuleHardwareBindForm)
  2393.                             Shell $(UtilityInf),ReduceInfPath,+
  2394.                         $(STF_CONTEXTINFNAME)
  2395.                             set NewValueList = {+
  2396.                 {bindform,$(NoTitle),$(!REG_VT_SZ),+
  2397.                  $(bindform)},+
  2398.                 {class,$(NoTitle),$(!REG_VT_MULTI_SZ),+
  2399.                  $(NetRuleHardwareClass)},+
  2400.                 {type,$(NoTitle),$(!REG_VT_SZ),+
  2401.                  $(serviceName)" "*($(IMAdapters),1)},+
  2402.                 {InfOption,$(NoTitle),$(!REG_VT_SZ),+
  2403.                  $($2)},+
  2404.                 {InfName,$(NoTitle),$(!REG_VT_SZ),+
  2405.                  $($R0)}}
  2406.                             Shell  $(UtilityInf), AddValueList, +
  2407.                     $(netHandle), $(NewValueList)
  2408.                             CloseRegKey $(netHandle)
  2409.                         Endif
  2410.  
  2411.                         CloseRegKey $(newHandle)
  2412.                     Endif
  2413.                 Endif
  2414.             Endif
  2415.             CloseRegKey $(kHandle)
  2416.         Endif
  2417.     EndForListDo
  2418.  
  2419.     Shell "" GetNtVersion
  2420.     ifstr $($R0) == "3.51"
  2421.         ;
  2422.         ; swap card keys
  2423.         ;
  2424.         OpenRegKey $(!REG_H_LOCAL) "" $($1) $(MAXIMUM_ALLOWED) rHandle
  2425.         ifstr $(rHandle) != $(KeyNull)
  2426.             set temp = temp
  2427.  
  2428.             Shell "",CopyRegTree,$($1)"\"$($3),$($1),$(temp),+
  2429.             $(NoTitle),GenericClass,FORCE
  2430.  
  2431.             Ifint $($ShellCode) != $(!SHELL_CODE_OK)
  2432.                 CloseRegKey $(rHandle)
  2433.                 Return $($ShellCode)
  2434.             endif
  2435.             Ifstr $($R0) != STATUS_SUCCESSFUL
  2436.                 CloseRegKey $(rHandle)
  2437.                 Return $($R0)
  2438.             endif
  2439.  
  2440.             Shell "",CopyRegTree,$($1)"\"$(NewCardInstance),$($1),$($3),+
  2441.             $(NoTitle),GenericClass,FORCE
  2442.  
  2443.             Ifint $($ShellCode) != $(!SHELL_CODE_OK)
  2444.                 CloseRegKey $(rHandle)
  2445.                 Return $($ShellCode)
  2446.             endif
  2447.             Ifstr $($R0) != STATUS_SUCCESSFUL
  2448.                 CloseRegKey $(rHandle)
  2449.                 Return $($R0)
  2450.             endif
  2451.  
  2452.             Shell "",CopyRegTree,$($1)"\"$(temp),$($1),$(NewCardInstance),+
  2453.             $(NoTitle),GenericClass,FORCE
  2454.  
  2455.             Ifint $($ShellCode) != $(!SHELL_CODE_OK)
  2456.                 CloseRegKey $(rHandle)
  2457.                 Return $($ShellCode)
  2458.             endif
  2459.             Ifstr $($R0) != STATUS_SUCCESSFUL
  2460.                 CloseRegKey $(rHandle)
  2461.                 Return $($R0)
  2462.             endif
  2463.  
  2464.             DeleteRegTree $(rHandle) $(temp)
  2465.  
  2466.             CloseRegKey $(rHandle)
  2467.         endif
  2468.     endif
  2469.  
  2470.     CloseRegKey $(KeyCard)
  2471.     return STATUS_REBIND
  2472.  
  2473. ;*************************************************************************
  2474. ;
  2475. ;     SECTION:   ChangeListText
  2476. ;
  2477. ;     PURPOSE:   <change text in list string>
  2478. ;
  2479. ;   ARGUMENTS:   $0 - input string
  2480. ;                $1 - string to be substitued
  2481. ;                $2 - string to substitue with
  2482. ;
  2483. ;     RETURNS:   $R0 - output string
  2484. ;
  2485. ;  REFERENCES:   <list of global or parent variables referenced>
  2486. ;
  2487. ;*************************************************************************
  2488. [ChangeListText]
  2489.  
  2490.     read-syms GeneralConstants
  2491.     read-syms FileConstants
  2492.     read-syms FileConstantsENG
  2493.  
  2494.     ;Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), "NONFATAL", $($0)" "$($1)" "$($2)
  2495.     set returnList = {}
  2496.     set noChange = 1
  2497.     ForListDo $($0)
  2498.         set newList = ""
  2499.         Split-String $($) " " stringList
  2500.         ForListDo $(stringList)
  2501.             Ifstr $($) == $($1)
  2502.                 set newList = $(newList)$($2)
  2503.                 set noChange = 0
  2504.             Else
  2505.                 set newList = $(newList)$($)
  2506.             Endif
  2507.         EndForListDo
  2508.         set returnList = >($(returnList),$(newList))
  2509.     ;Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), "NONFATAL", $(returnList)
  2510.     EndForListDo
  2511.     return $(returnList) $(noChange)
  2512.  
  2513. ;*************************************************************************
  2514. ;
  2515. ;     SECTION:   ChangeNetRules
  2516. ;
  2517. ;     PURPOSE:   <change netRules>
  2518. ;
  2519. ;   ARGUMENTS:   $0 - netRules key
  2520. ;                $1 - string to be substitued
  2521. ;                $2 - string to substitue with
  2522. ;                $3 - registry text
  2523. ;
  2524. ;     RETURNS:   $R0 - return status
  2525. ;                $R1 - no change status
  2526. ;
  2527. ;  REFERENCES:   <list of global or parent variables referenced>
  2528. ;
  2529. ;*************************************************************************
  2530. [ChangeNetRules]
  2531.  
  2532.     read-syms GeneralConstants
  2533.     read-syms FileConstants
  2534.     read-syms FileConstantsENG
  2535.  
  2536.     OpenRegKey $(!REG_H_LOCAL) "" $($0) $(MAXIMUM_ALLOWED) KeyProduct
  2537.     Ifstr $(KeyProduct) == $(KeyNull)
  2538.         return CANNOT_FIND_COMPONENT_SERVICE
  2539.     Endif
  2540.  
  2541.     GetRegValue $(KeyProduct) $($3) bindText
  2542.     Ifint $(RegLastError) != 0
  2543.         CloseRegKey $(KeyProduct)
  2544.         Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), "FATAL", +
  2545.         $($0)"\Bindable not found!"
  2546.         return CANNOT_FIND_COMPONENT_SERVICE
  2547.     Endif
  2548.  
  2549.     shell "" ChangeListText *($(bindText),4) $($1) $($2)
  2550.     Ifint $($ShellCode) != $(!SHELL_CODE_OK)
  2551.         CloseRegKey $(KeyProduct)
  2552.         Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), "FATAL", +
  2553.         $($ShellCode)": ChangeListText shell error!"
  2554.         return $($ShellCode)
  2555.     endif
  2556.     set noChange = $($R1)
  2557.  
  2558.     set NewValueList = {{*($(bindText),1),*($(bindText),2),*($(bindText),3),+
  2559.             $($R0)}}
  2560.     Shell $(UtilityInf), AddValueList, $(KeyProduct), $(NewValueList)
  2561.     CloseRegKey $(KeyProduct)
  2562.     Ifint $($ShellCode) != $(!SHELL_CODE_OK)
  2563.         Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), "FATAL", +
  2564.         $($ShellCode)": AddValueList shell error!"
  2565.         return $($ShellCode)
  2566.     Endif
  2567.     Ifstr(i) $($R0) != NO_ERROR
  2568.         Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), "FATAL", +
  2569.         $($R0)": AddValueList returns error!"
  2570.         return $($R0)
  2571.     Endif
  2572.  
  2573.     return STATUS_SUCCESS $(noChange)
  2574.  
  2575. ;*************************************************************************
  2576. ;
  2577. ;     SECTION:   FixupTransportDependOnService
  2578. ;
  2579. ;     PURPOSE:   Remove IM from DependOnService
  2580. ;
  2581. ;   ARGUMENTS:
  2582. ;
  2583. ;     RETURNS:   
  2584. ;
  2585. ;  REFERENCES:   <list of global or parent variables referenced>
  2586. ;
  2587. ;*************************************************************************
  2588. [FixupTransportDependOnService]
  2589.  
  2590.     read-syms GeneralConstants
  2591.     read-syms FileConstants
  2592.     read-syms FileConstantsENG
  2593.  
  2594.     ForListDo $(TransportServiceKeys)
  2595.         OpenRegKey $(!REG_H_LOCAL) "" $($) $(MAXIMUM_ALLOWED) KeyProduct
  2596.         Ifstr $(KeyProduct) != $(KeyNull)
  2597.             GetRegValue $(KeyProduct) DependOnService dependOnList
  2598.             Ifint $(RegLastError) == 0
  2599.                 set TransportBindList = {}
  2600.                 ForListDo *($(dependOnList),4)
  2601.                     Ifstr $($) != $(ProductSoftwareName)
  2602.                         set TransportBindList = >($(TransportBindList),$($))
  2603.                     endif
  2604.                 EndForListDo
  2605.                 set NewValueList = {DependOnService,$(NoTitle),+
  2606.                     $(!REG_VT_MULTI_SZ),+
  2607.                     $(TransportBindList)}
  2608.                 SetRegValue $(KeyProduct) $(NewValueList)
  2609.                 Ifint $(RegLastError) != 0
  2610.                     set RegistryErrorIndex = $(RegLastError)
  2611.                     CloseRegKey $(KeyProduct)
  2612.                     goto fatal
  2613.                 endif
  2614.             endif
  2615.             CloseRegKey $(KeyProduct)
  2616.         Endif
  2617.     EndForListDo
  2618.  
  2619.     return
  2620.  
  2621. ;*************************************************************************
  2622. ;
  2623. ;     SECTION:   AddToList
  2624. ;
  2625. ;     PURPOSE:   Add new value to list.  If new value is already in the
  2626. ;                order list, it is taken out first.
  2627. ;
  2628. ;   ARGUMENTS:   $0 - value to add
  2629. ;                $1 - reference value
  2630. ;                $2 - key where list resides
  2631. ;                $3 - name of list
  2632. ;                $4 - add BEFORE or AFTER reference value
  2633. ;
  2634. ;     RETURNS:   $R0 - return status
  2635. ;
  2636. ;  REFERENCES:   <list of global or parent variables referenced>
  2637. ;
  2638. ;*************************************************************************
  2639. [AddToList]
  2640.  
  2641.     read-syms GeneralConstants
  2642.     read-syms FileConstants
  2643.     read-syms FileConstantsENG
  2644.  
  2645.     set Status = STATUS_FAILURE
  2646.  
  2647.     OpenRegKey $(!REG_H_LOCAL) "" $($2) $(MAXIMUM_ALLOWED) KeyGroup
  2648.     set OldList = {}
  2649.     Ifstr(i) $(KeyGroup) != $(KeyNull)
  2650.         GetRegValue  $(KeyGroup) $($3) TmpList
  2651.         ifint $(RegLastError) == 0
  2652.             ForListDo *($(TmpList), 4)
  2653.                 set OldList = >($(OldList), $($))
  2654.             EndForListDo
  2655.         endif
  2656.         Debug-Output "AddToList current list "$(OldList)
  2657.         set NewGroupList = {}
  2658.         ForListDo $(OldList)
  2659.             ifstr(i) $($) != $($0)
  2660.                 ifstr(i) $($4) == BEFORE
  2661.                     ifstr(i) $($) == $($1)
  2662.                         set NewGroupList = >($(NewGroupList), $($0) )
  2663.                         set Status = STATUS_SUCCESSFUL
  2664.                     endif
  2665.                     set NewGroupList = >($(NewGroupList), $($))
  2666.                 else
  2667.                     set NewGroupList = >($(NewGroupList), $($))
  2668.                     ifstr(i) $($) == $($1)
  2669.                         set NewGroupList = >($(NewGroupList), $($0) )
  2670.                         set Status = STATUS_SUCCESSFUL
  2671.                     endif
  2672.                 endif
  2673.             endif
  2674.         EndForListDo
  2675.         Debug-Output "AddToList new list "$(NewGroupList)
  2676.         SetRegValue $(KeyGroup) {$($3),$(NoTitle),$(!REG_VT_MULTI_SZ),+
  2677.                     $(NewGroupList)}
  2678.         CloseRegKey $(KeyGroup)
  2679.     else
  2680.         Debug-Output "AddToList error open ServiceGroupOrder key"
  2681.     endif
  2682.  
  2683.     return $(Status)
  2684.  
  2685. ;*************************************************************************
  2686. ;
  2687. ;     SECTION:   SetAdapterParameter
  2688. ;
  2689. ;     PURPOSE:   Copy Transport Parameters from real adapters to
  2690. ;                IM adapters.
  2691. ;
  2692. ;   ARGUMENTS:   $0 - InfOption
  2693. ;                $1 - FORCE CopyRegTree or not
  2694. ;
  2695. ;     RETURNS:   $R0 - return status
  2696. ;
  2697. ;  REFERENCES:   <list of global or parent variables referenced>
  2698. ;
  2699. ;*************************************************************************
  2700. [SetAdapterParameter]
  2701.  
  2702.     read-syms GeneralConstants
  2703.     read-syms FileConstants
  2704.     read-syms FileConstantsENG
  2705.  
  2706.     ;
  2707.     ; Copy Transport parameters using IM's bind list
  2708.     ;
  2709.     OpenRegKey $(!REG_H_LOCAL) "" $(NetworkCardsKeyName) $(MAXIMUM_ALLOWED) +
  2710.         KeyProduct
  2711.     Ifstr $(KeyProduct) == $(KeyNull)
  2712.         Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), "FATAL", +
  2713.         $(NetworkCardsKeyName)" empty!"
  2714.         Return CANNOT_FIND_COMPONENT_SERVICE
  2715.     Endif
  2716.  
  2717.     EnumRegKey $(KeyProduct) KeyList
  2718.     Ifint $(RegLastError) != 0
  2719.         CloseRegKey $(KeyProduct)
  2720.         Return $(RegLastError)
  2721.     Endif
  2722.  
  2723.     CloseRegKey $(KeyProduct)
  2724.  
  2725.     set status = STATUS_SUCCESSFUL
  2726.     set dialOutIp = {}
  2727.     set dialInIp = {}
  2728.     set !IM_NDISWAN = {}
  2729.  
  2730.     ForListDo $(KeyList)
  2731.         OpenRegKey $(!REG_H_LOCAL) "" $(NetworkCardsKeyName)"\"*($($),1) +
  2732.             $(MAXIMUM_ALLOWED) kHandle
  2733.         Ifstr $(kHandle) != $(KeyNull)
  2734.             GetRegValue $(kHandle) ProductName productName
  2735.             ifint $(RegLastError) == 0
  2736.                 ifstr *($(productName),4) != $(ProductSoftwareName)
  2737.                     GetRegValue $(kHandle) ServiceName value
  2738.                     ifint $(RegLastError) == 0
  2739.  
  2740.                         set ndiswan = 0;
  2741.  
  2742.                         ;
  2743.                         ; Check for NdisWan adapters
  2744.                         ;
  2745.                         ifstr(i) $(!LIBHANDLE) == ""
  2746.                             LoadLibrary "x" setupdll.dll !LIBHANDLE
  2747.                         endif
  2748.                         LibraryProcedure Result $(!LIBHANDLE) SetupStrncmp +
  2749.                     *($(value),4) "NdisWan" 7
  2750.                         ifint $(Result) == 0
  2751.                             Shell "" NdisWanSupport
  2752.                             ifint $($R0) == 1
  2753.                                 goto next_adapter
  2754.                             endif
  2755.                             ;
  2756.                             ; NdisWan DialOut IP adapters
  2757.                             ;
  2758.                             ifstr(i) *($(productName),4) == NdisWanDialOutIp
  2759.  
  2760.                                 ifstr $(dialOutIp) == ""
  2761.                                     set dialOutIp = {}
  2762.                                 endif
  2763.                                 set dialOutIp = >($(dialOutIp),*($(value),4))
  2764.  
  2765.                                 Shell "" GetNtVersion
  2766.                                 ifstr $($R0) != "3.51"
  2767.                                     set ndiswan = 1;
  2768.                                     goto continue_add_adapter
  2769.                                 endif
  2770.                             ;
  2771.                             ; NdisWan DialIn IP adapters
  2772.                             ;
  2773.                             else-ifstr(i) *($(productName),4) == NdisWanDialInIp
  2774.  
  2775.                                 ifstr $(dialInIp) == ""
  2776.                                     set dialInIp = {}
  2777.                                 endif
  2778.                                 set dialInIp = >($(dialInIp),*($(value),4))
  2779.  
  2780.                                 Shell "" GetNtVersion
  2781.                                 ifstr $($R0) != "3.51"
  2782.                                     set ndiswan = 1;
  2783.                                     goto continue_add_adapter
  2784.                                 endif
  2785.                             endif
  2786.                             goto next_adapter
  2787.                         endif
  2788.  
  2789. check_hidden_adapter = +
  2790.                         ;
  2791.                         ; don't attach to hidden adapters
  2792.                         ;
  2793.                         GetRegValue $(kHandle) Hidden hidden
  2794.                         ifint $(RegLastError) == 0
  2795.                             ifint *($(hidden),4) == 1
  2796.                                 goto next_adapter
  2797.                             endif
  2798.                         endif
  2799.  
  2800.                         ;
  2801.                         ; make sure adapter is a supported type
  2802.                         ;
  2803.                         GetRegValue $(kHandle) Manufacturer manu
  2804.                         ifint $(RegLastError) != 0
  2805.                             goto next_adapter
  2806.                         endif
  2807.                         OpenRegKey $(!REG_H_LOCAL) "" "SOFTWARE\"+
  2808.                 *($(manu),4)"\"*($(productName),4)+
  2809.                 "\CurrentVersion\NetRules" +
  2810.                 $(MAXIMUM_ALLOWED) nHandle
  2811.                         Ifstr $(nHandle) == $(KeyNull)
  2812.                             goto next_adapter
  2813.                         endif
  2814.                         GetRegValue $(nHandle) type type
  2815.                         ifint $(RegLastError) != 0
  2816.                             goto next_adapter
  2817.                         endif
  2818.                         Split-String *($(type),4) " " driver
  2819.                         set addAdapter = 0
  2820.                         ForListDo $(SupportedDrivers)
  2821.                             ifstr(i) *($(driver),3) == $($)
  2822.                                 set addAdapter = 1
  2823.                             endif
  2824.                         EndForListDo
  2825.                         ifint $(addAdapter) != 1
  2826.                             goto next_adapter
  2827.                         endif
  2828.  
  2829. continue_add_adapter = +
  2830.                         ;
  2831.                         ; add software component of IM adapter from
  2832.                         ;  real adapter
  2833.                         ;
  2834.                         set srcDev = *($(value),4)
  2835.                         set dstDev = $(ProductSoftwareName)"_"$(srcDev)
  2836.  
  2837.                         Shell "",CopyRegTree,$(!NTN_ServiceBase)"\"$(srcDev),+
  2838.                 $(!NTN_ServiceBase),$(dstDev),+
  2839.                 $(NoTitle),GenericClass,$($1)
  2840.                         Ifint $($ShellCode) != $(!SHELL_CODE_OK)
  2841.                             CloseRegKey $(kHandle)
  2842.                             Return $($ShellCode)
  2843.                         endif
  2844.                         Ifstr $($R0) != STATUS_SUCCESSFUL
  2845.                             CloseRegKey $(kHandle)
  2846.                             Return $($R0)
  2847.                         endif
  2848.  
  2849.                         ifint $(ndiswan) == 0
  2850.                 ;
  2851.                 ; remove hardware parameters
  2852.                 ;
  2853.                             set parms = $(!NTN_ServiceBase)"\"+
  2854.                     $(dstDev)"\Parameters"
  2855.                             OpenRegKey $(!REG_H_LOCAL) "" $(parms) +
  2856.                 $(MAXIMUM_ALLOWED) KeyProduct
  2857.                             Ifstr $(KeyProduct) == $(KeyNull)
  2858.                                 CloseRegKey $(kHandle)
  2859.                                 Shell $(subroutineinf) SetupMessage, +
  2860.                     $(!STF_LANGUAGE), "FATAL", +
  2861.                     $(parms)" empty!"
  2862.                                 Return CANNOT_FIND_COMPONENT_SERVICE
  2863.                             Endif
  2864.  
  2865.                             EnumRegValue $(KeyProduct) ValueList
  2866.                             ForListDo $(ValueList)
  2867.                                 DeleteRegValue $(KeyProduct) *($($),1)
  2868.                             EndForListDo
  2869.                             CloseRegKey $(KeyProduct)
  2870.                         Endif
  2871.  
  2872.                         ;
  2873.                         ; add hardware component of IM adapter from
  2874.                         ;  real adapter
  2875.                         ;
  2876.                         Shell "" AddIMCard $(srcDev) $(NetworkCardsKeyName) +
  2877.                 $($0) *($($),1) $(ndiswan)
  2878.                         ifstr $($R0) == STATUS_REBIND
  2879.                             set status = $($R0)
  2880.                         endif
  2881.  
  2882.                         ;
  2883.                         ; add WINS parameters
  2884.                         ;
  2885.                         set srcWINS = $(NetBTServiceKey)"\"$(srcDev)
  2886.                         OpenRegKey $(!REG_H_LOCAL) "" $(srcWINS) +
  2887.                 $(MAXIMUM_ALLOWED) winsHandle
  2888.                         Ifstr $(winsHandle) != $(KeyNull)
  2889.                             Shell "",CopyRegTree,$(srcWINS),$(NetBTServiceKey),+
  2890.                 $(dstDev),$(NoTitle),GenericClass,FORCE
  2891.                             CloseRegKey $(winsHandle)
  2892.                         endif
  2893. next_adapter = +
  2894.                     endif
  2895.                 endif
  2896.             endif
  2897.             CloseRegKey $(kHandle)
  2898.         endif
  2899.     EndForListDo
  2900.  
  2901.     ForListDo $(dialOutIp)
  2902.         set !IM_NDISWAN = >($(!IM_NDISWAN),$($))
  2903.     EndForListDo
  2904.     ForListDo $(dialInIp)
  2905.         set !IM_NDISWAN = >($(!IM_NDISWAN),$($))
  2906.     EndForListDo
  2907.  
  2908.     Return $(status)
  2909.  
  2910. ;*************************************************************************
  2911. ;
  2912. ;     SECTION:   ResetAdapterParameter
  2913. ;
  2914. ;     PURPOSE:   Copy Transport Parameters from IM adapters to
  2915. ;                real adapters.
  2916. ;
  2917. ;   ARGUMENTS:
  2918. ;
  2919. ;     RETURNS:   $R0 - return status
  2920. ;
  2921. ;  REFERENCES:   <list of global or parent variables referenced>
  2922. ;
  2923. ;*************************************************************************
  2924. [ResetAdapterParameter]
  2925.  
  2926.     read-syms GeneralConstants
  2927.     read-syms FileConstants
  2928.     read-syms FileConstantsENG
  2929.  
  2930.     ;
  2931.     ; Copy Transport parameters using IM's bind list
  2932.     ;
  2933.     OpenRegKey $(!REG_H_LOCAL) "" $(IMLinkageKeyName) $(MAXIMUM_ALLOWED) +
  2934.         KeyProduct
  2935.     Ifstr $(KeyProduct) == $(KeyNull)
  2936. ;        Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), "FATAL", +
  2937. ;        $(IMLinkageKeyName)" empty!"
  2938.         Return CANNOT_FIND_COMPONENT_SERVICE
  2939.     Endif
  2940.  
  2941.     GetRegValue $(KeyProduct) Bind bindList
  2942.     Ifint $(RegLastError) != 0
  2943.         CloseRegKey $(KeyProduct)
  2944.         Return $(RegLastError)
  2945.     endif
  2946.     set devices = *($(bindList),4)
  2947.  
  2948.     ForListDo $(devices)
  2949.         Split-String *($($),1) "\" device
  2950.         set srcDev = *($(device),4)
  2951.  
  2952.         Split-String $(srcDev) "_" device
  2953.         set dstDev = ""
  2954.         ForListDo $(device)
  2955.             ifint $(#) > 2
  2956.                 set dstDev = $(dstDev)$($)
  2957.             endif
  2958.         EndForListDo
  2959.  
  2960.         set srcTree = $(!NTN_ServiceBase)"\"$(srcDev)
  2961.         Shell "",CopyRegTree,$(srcTree),$(!NTN_ServiceBase),+
  2962.             $(dstDev),$(NoTitle),GenericClass,FORCE
  2963.     EndForListDo
  2964.  
  2965.     CloseRegKey $(KeyProduct)
  2966.     Return STATUS_SUCCESSFUL
  2967.  
  2968. ;*************************************************************************
  2969. ;
  2970. ;     SECTION:   RemoveIM
  2971. ;
  2972. ;     PURPOSE:   Remove IM is called during remove adapter phase or
  2973. ;                when any fatal error is detected.
  2974. ;
  2975. ;   ARGUMENTS:
  2976. ;
  2977. ;     RETURNS:
  2978. ;
  2979. ;  REFERENCES:   <list of global or parent variables referenced>
  2980. ;
  2981. ;*************************************************************************
  2982. [RemoveIM]
  2983.  
  2984.     read-syms GeneralConstants
  2985.     read-syms FileConstants
  2986.     read-syms FileConstantsENG
  2987.  
  2988.     OpenRegKey $(!REG_H_LOCAL) "" $(ProductKeyName) $(MAXIMUM_ALLOWED) SoftKey
  2989.     Ifstr $(SoftKey) != $(KeyNull)
  2990.         SetRegValue $(SoftKey) {RefCount,$(NoTitle),$(!REG_VT_DWORD),0}
  2991.         CloseRegKey $(SoftKey)
  2992.     endif
  2993.  
  2994.     ;
  2995.     ; Remove install file from ReviewPrograms and delete install file
  2996.     ;
  2997.     OpenRegKey $(!REG_H_LOCAL) "" $(NetRules) $(MAXIMUM_ALLOWED) KeyProduct
  2998.     Ifstr $(KeyProduct) == $(KeyNull)
  2999.         goto removeadapter_removeSoftwareComponent
  3000.     endif
  3001.  
  3002.     GetRegValue $(KeyProduct),"InfName", infName
  3003.     ifint $(RegLastError) != 0
  3004.         CloseRegKey $(KeyProduct)
  3005.         goto removeadapter_removeSoftwareComponent
  3006.     endif
  3007.  
  3008.     CloseRegKey $(KeyProduct)
  3009.     Shell "" AddToList *($(infName),4),,$(ReviewProgram),ReviewPrograms
  3010.     Split-String *($(infName),4) "0123456789" checkList
  3011.     Ifstr *($(checkList),1) != *($(infName),4)
  3012.         AddFileToDeleteList $(!STF_WINDOWSSYSPATH)"\"*($(infName),4)
  3013.     endif
  3014.  
  3015.     ;Shell "" GetImSampPath
  3016.     ;ifstr $($R0) == STATUS_SUCCESSFUL
  3017.         ;ifstr(i) $(!LIBHANDLE) == ""
  3018.             ;LoadLibrary "x" setupdll.dll !LIBHANDLE
  3019.         ;endif
  3020.         ;set NEWT = $($R1)\newt32.exe
  3021.         ;LibraryProcedure stat,$(!LIBHANDLE),CheckFileExistance $(NEWT)
  3022.         ;ifstr(i) $(stat) != NO
  3023.             ;
  3024.             ; Remove Newt from 'Run' key in registry (CT 7/20/97)
  3025.             ;
  3026.             ;RunProgram ExitCode NEWT32 "" $(NEWT) -u
  3027.  
  3028.             ;
  3029.             ; Remove NEWT32 on the next bootup sequence
  3030.             ;
  3031.             ;AddFileToDeleteList $(NEWT)
  3032.         ;endif
  3033.     ;endif
  3034.  
  3035. removeadapter_removeSoftwareComponent = +
  3036.     ;
  3037.     ; Copy back current adapter settings
  3038.     ;
  3039.     Shell "" ResetAdapterParameter 
  3040.  
  3041.     ;
  3042.     ; Remove software component
  3043.     ;
  3044.     Shell "" MyRemoveSoftwareComponent,$(Manufacturer),$(ProductSoftwareName),""
  3045.  
  3046.     ;
  3047.     ; Change NetRules back
  3048.     ;
  3049.     ForListDo $(NetRuleDriverKeys)
  3050.         Shell "" ChangeNetRules *($($),1) *($(IMDrivers),*($($),2)) +
  3051.         *($(SupportedDrivers),*($($),2)) Bindable
  3052.     EndForListDo
  3053.     Shell "" GetNtVersion
  3054.     ifstr $($R0) != "3.51"
  3055.         ForListDo $(NetRuleTransportKeys)
  3056.             Shell "" ChangeNetRules *($($),1) +
  3057.         *($(IMTransports),*($($),2)) +
  3058.         *($(SupportedTransports),*($($),2)) Bindable
  3059.         EndForListDo
  3060.     endif
  3061.     Shell "" ChangeNetRules $(MicroSW)"NetBT"$(CVNetRules) +
  3062.     *($(IMTransports),1) *($(SupportedTransports),4) Class
  3063.  
  3064.     ;
  3065.     ; Remove IM services and cards
  3066.     ;
  3067.     ;Shell "" RemoveIMServices
  3068.     Shell "" RemoveIMCards ALL
  3069.  
  3070.     Shell "" FixupTransportsAfterRemove
  3071.     Shell "" FixupServicesAfterRemove
  3072.  
  3073.     return
  3074.  
  3075. ;*************************************************************************
  3076. ;
  3077. ;     SECTION:   MyRemoveSoftwareComponent
  3078. ;
  3079. ;     PURPOSE:   Remove software component.
  3080. ;
  3081. ;   ARGUMENTS:   $0 - Manufacturer
  3082. ;                $1 - Product software name
  3083. ;                $2 - Product software name to upgrade to 
  3084. ;                $3 - Inf name if this is a upgrade
  3085. ;
  3086. ;     RETURNS:
  3087. ;
  3088. ;  REFERENCES:   <list of global or parent variables referenced>
  3089. ;
  3090. ;*************************************************************************
  3091. [MyRemoveSoftwareComponent]
  3092.  
  3093.     read-syms GeneralConstants
  3094.     read-syms FileConstants
  3095.     read-syms FileConstantsENG
  3096.  
  3097.     Shell "" GetNtVersion
  3098.     ifstr $($R0) == "3.51"
  3099.  
  3100.         OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_SoftwareBase)"\"$($0) +
  3101.         $(MAXIMUM_ALLOWED) keyHandle
  3102.         ifstr $(keyHandle) != $(KeyNull)
  3103.             ifstr $($2) != ""
  3104.                 ;
  3105.                 ; try to set ServiceName Key first before CopyRegTree
  3106.                 ;
  3107.                 CreateRegKey $(keyHandle) {$($2),0,GenericClass} "" +
  3108.                     $(MAXIMUM_ALLOWED) "" driverHandle
  3109.                 ifstr $(driverHandle) != $(KeyNull)
  3110.                     CreateRegKey $(driverHandle) +
  3111.                 {CurrentVersion,0,GenericClass} "" +
  3112.                         $(MAXIMUM_ALLOWED) "" cvHandle
  3113.                     ifstr $(cvHandle) != $(KeyNull)
  3114.                 SetRegValue $(cvHandle) {ServiceName, 0, +
  3115.                 $(!REG_VT_SZ), $(ProductSoftwareName)}
  3116.                 SetRegValue $(cvHandle) {MajorVersion, 0, +
  3117.                 $(!REG_VT_DWORD), $(ProductMajorVersion)}
  3118.                 SetRegValue $(cvHandle) {MinorVersion, 0, +
  3119.                 $(!REG_VT_DWORD), $(ProductMinorVersion)}
  3120.                         CreateRegKey $(cvHandle) +
  3121.                 {NetRules,0,GenericClass} "" +
  3122.                         $(MAXIMUM_ALLOWED) "" nrHandle
  3123.                         ifstr $(nrHandle) != $(KeyNull)
  3124.                         Shell $(UtilityInf),ReduceInfPath,$($3)
  3125.                     SetRegValue $(nrHandle) {InfName, 0, +
  3126.                 $(!REG_VT_SZ), $($R0)}
  3127.                             CloseRegKey $(nrHandle)
  3128.                         endif
  3129.                         CloseRegKey $(cvHandle)
  3130.                     endif
  3131.                     CloseRegKey $(driverHandle)
  3132.                 endif
  3133.  
  3134.                 Shell "",CopyRegTree,$(!NTN_SoftwareBase)"\"$($0)"\"$($1),+
  3135.             $(!NTN_SoftwareBase)"\"$($0),$($2),+
  3136.             $(NoTitle),GenericClass
  3137.  
  3138.                 set removeBobcatINFs = TRUE
  3139.             endif
  3140.             DeleteRegTree $(keyHandle) $($1)
  3141.             CloseRegKey $(keyHandle)
  3142.         endif
  3143.  
  3144.         OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_ServiceBase) +
  3145.         $(MAXIMUM_ALLOWED) keyHandle
  3146.         ifstr $(keyHandle) != $(KeyNull)
  3147.             ifstr $($2) != ""
  3148.                 Shell "",CopyRegTree,$(!NTN_ServiceBase)"\"$($1),+
  3149.             $(!NTN_ServiceBase),$($2),+
  3150.             $(NoTitle),GenericClass
  3151.                 set removeBobcatINFs = TRUE
  3152.             endif
  3153.             DeleteRegTree $(keyHandle) $($1)
  3154.             CloseRegKey $(keyHandle)
  3155.         endif
  3156.  
  3157.         set status = STATUS_SUCCESSFUL
  3158.  
  3159.     else
  3160.  
  3161.         ifstr $($2) == ""
  3162.  
  3163.             Shell $(UtilityInf),RemoveSoftwareComponent,$($0),$($1)
  3164.             set status = STATUS_SUCCESSFUL
  3165.  
  3166.         else
  3167.  
  3168.             set status = STATUS_SUCCESSFUL
  3169.  
  3170.             OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_SoftwareBase)"\"$($0)"\"$($1) +
  3171.         $(MAXIMUM_ALLOWED) keyHandle
  3172.             ifstr $(keyHandle) != $(KeyNull)
  3173.                 set removeBobcatINFs = TRUE
  3174.                 CloseRegKey $(keyHandle)
  3175.                 set status = STATUS_REBOOT
  3176.             endif
  3177.  
  3178.             OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_ServiceBase)"\"$($1) +
  3179.         $(MAXIMUM_ALLOWED) keyHandle
  3180.             ifstr $(keyHandle) != $(KeyNull)
  3181.                 set removeBobcatINFs = TRUE
  3182.                 CloseRegKey $(keyHandle)
  3183.                 set status = STATUS_REBOOT
  3184.             endif
  3185.  
  3186.             ifstr $(status) == STATUS_REBOOT
  3187.                 Shell $(UtilityInf),RemoveSoftwareComponent,$($0),$($1)
  3188.                 ;
  3189.                 ; remove 4.0 rule
  3190.                 ;
  3191.                 ForListDo $(NetRuleDriverKeys)
  3192.                     Shell "" ChangeNetRules *($($),1) NMFTRTransport +
  3193.                 *($(SupportedDrivers),*($($),2)) Bindable
  3194.                 EndForListDo
  3195.                 Shell "" GetNtVersion
  3196.                 ifstr $($R0) != "3.51"
  3197.                     ForListDo $(NetRuleTransportKeys)
  3198.                         Shell "" ChangeNetRules *($($),1) +
  3199.                 *($(IMTransports),*($($),2)) +
  3200.                 *($(SupportedTransports),*($($),2)) Bindable
  3201.                     EndForListDo
  3202.                 endif
  3203.                 Shell "" ChangeNetRules $(MicroSW)"NetBT"$(CVNetRules) +
  3204.             *($(IMTransports),1) *($(SupportedTransports),4) Class
  3205.  
  3206.                 ;
  3207.                 ; Install new IM after next reboot
  3208.                 ;
  3209.                 OpenRegKey $(!REG_H_LOCAL) "" $(RunOnce) +
  3210.             $(MAXIMUM_ALLOWED) runHandle
  3211.                 ifstr $(runHandle) == $(KeyNull)
  3212.                     CreateRegKey $(!REG_H_LOCAL) {$(RunOnce),0,GenericClass} +
  3213.             "" $(MAXIMUM_ALLOWED) "" runHandle
  3214.                 endif
  3215.  
  3216.                 ifstr $(runHandle) != $(KeyNull)
  3217.                     SetRegValue $(runHandle) {InstallIM,0,+
  3218.             $(!REG_VT_SZ),"rundll32 wgagent.dll,DllRegisterServer"}
  3219.                     CloseRegKey $(runHandle)
  3220.  
  3221.                     Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE),+
  3222.             "NONFATAL", +
  3223.             "Setup has removed a previous version of OPFFLTNT "+
  3224.             "IM.  A reboot is require before the new OPFFLTNT "+ 
  3225.             "IM can be added.  On the next reboot, the new "+
  3226.             "OPFFLTNT IM will be installed automatically."
  3227.                 endif
  3228.             endif
  3229.         endif
  3230.     endif
  3231.  
  3232.     ifstr $(removeBobcatINFs) == TRUE
  3233.         shell "" RemoveBobcatINFs
  3234.     endif
  3235.  
  3236.     return $(status)
  3237.  
  3238. ;*************************************************************************
  3239. ;
  3240. ;     SECTION:   RemoveBobcatINFs
  3241. ;
  3242. ;     PURPOSE:   Remove bobcat inf files.
  3243. ;
  3244. ;   ARGUMENTS:   
  3245. ;
  3246. ;     RETURNS:
  3247. ;
  3248. ;  REFERENCES:   <list of global or parent variables referenced>
  3249. ;
  3250. ;*************************************************************************
  3251. [RemoveBobcatINFs]
  3252.  
  3253.     read-syms GeneralConstants
  3254.     read-syms FileConstants
  3255.     read-syms FileConstantsENG
  3256.  
  3257.     set list = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,+
  3258.         10,11,12,13,14,15,16,17,18,19,+
  3259.         20,21,22,23,24,25,26,27,28,29,+
  3260.         30,31,32,33,34,35,36,37,38,39,+
  3261.         40,41,42,43,44,45,46,47,48,49,+
  3262.         50,51,52,53,54,55,56,57,58,59,+
  3263.         60,61,62,63,64,65,66,67,68,69,+
  3264.         70,71,72,73,74,75,76,77,78,79,+
  3265.         80,81,82,83,84,85,86,87,88,89,+
  3266.         90,91,92,93,94,95,96,97,98,99}
  3267.     ;
  3268.     ; Delete bobcat INF instances
  3269.     ;
  3270.     ForListDo $(list)
  3271.         set infName = OEMNSV$($).INF
  3272.         Shell $(infName),ReturnOptions ENG
  3273.         ifint $($ShellCode) == $(!SHELL_CODE_OK)
  3274.             ifstr $($R0) == STATUS_SUCCESSFUL
  3275.                 ifstr *($($R2),1) == $(ProductSoftwareTitle)
  3276.                         AddFileToDeleteList $(!STF_WINDOWSSYSPATH)"\"$(infName)
  3277.                 endif
  3278.             endif
  3279.         endif
  3280.     EndForListDo 
  3281.  
  3282.     return
  3283.  
  3284. ;*************************************************************************
  3285. ; taken from oemnsvra.inf for NDISWAN 
  3286. ;*************************************************************************
  3287.  
  3288. [UpdateLLInterface]
  3289.     read-syms GeneralConstants
  3290.     read-syms FileConstants
  3291.     read-syms FileConstantsENG
  3292.  
  3293.     Debug-Output "UpdateLLInterface: entry"
  3294.     set Status = STATUS_FAILED
  3295.     set KeyNull = ""
  3296.     set LLInterface = "\Device\RASARP"
  3297.     set IPLinkageKeyName = $(!NTN_ServiceBase)"\TCPIP\Linkage"
  3298.     OpenRegKey $(!REG_H_LOCAL) "" $(IPLinkageKeyName) $(MAXIMUM_ALLOWED) +
  3299.         KeyIpLinkage
  3300.     ifstr $(KeyIpLinkage) == $(KeyNull)
  3301.        Debug-Output "IM: UpdateLLInterface: couldn't open IP Linkage key"
  3302.        goto UpdateLLInterfaceEnd
  3303.     endif
  3304.  
  3305.     set compareSize = 0
  3306.     set compareString = $(ProductSoftwareName)"_NdisWan"
  3307.     Split-String $(compareString) $(compareString) charList
  3308.     ForListDo $(charList)
  3309.         set-add compareSize = $(compareSize),1
  3310.     EndForListDo
  3311.  
  3312.     set NdisWanList = {}
  3313.     GetRegValue    $(KeyIpLinkage) "Bind" TmpList
  3314.     ForListDo *($(TmpList),4)
  3315.         Split-String $($), "\", BindList
  3316.         QueryListSize ListSize $(BindList)
  3317.         set ServiceName = *($(BindList), $(ListSize))
  3318.         LibraryProcedure Result $(!LIBHANDLE) SetupStrncmp $(ServiceName) +
  3319.             $(compareString) $(compareSize)
  3320.         ifint $(Result) == 0
  3321.             set NdisWanList = >($(NdisWanList), $(ServiceName))
  3322.         endif
  3323.     EndForListDo
  3324.     CloseRegKey $(KeyIpLinkage)
  3325.     QueryListSize ListSize $(NdisWanList)
  3326.     ifint $(ListSize) >= 1
  3327.     ForListDo $(NdisWanList)
  3328.         set ServiceKeyName = $(!NTN_ServiceBase)"\"$($)"\Parameters\TCPIP"
  3329.         OpenRegKey $(!REG_H_LOCAL) "" $(ServiceKeyName) +
  3330.             $(MAXIMUM_ALLOWED) KeyNdisWan
  3331.         ifstr $(KeyNdisWan) != $(KeyNull)
  3332.             SetRegValue $(KeyNdisWan) {IPAddress, 0, +
  3333.                               $(!REG_VT_MULTI_SZ), {"0.0.0.0"}}
  3334.             SetRegValue $(KeyNdisWan) {SubnetMask, 0, +
  3335.                               $(!REG_VT_MULTI_SZ), {"0.0.0.0"}}
  3336.             SetRegValue $(KeyNdisWan) {DefaultGateway, 0, +
  3337.                               $(!REG_VT_MULTI_SZ), {""}}
  3338.             SetRegValue $(KeyNdisWan) {LLInterface, $(NoTitle),+
  3339.                                          $(!REG_VT_SZ), $(LLInterface)}
  3340.             SetRegValue $(KeyNdisWan) {EnableDHCP, 0, +
  3341.                                           $(!REG_VT_DWORD), 0}
  3342.         else
  3343.             CreateRegKey $(!REG_H_LOCAL) +
  3344.                          {$(ServiceKeyName),0,GenericClass} "" +
  3345.                           $(MAXIMUM_ALLOWED) "" KeyNdisWan
  3346.             ifstr $(KeyNdisWan) != $(KeyNull)
  3347.         SetRegValue $(KeyNdisWan) {IPAddress, 0, +
  3348.                     $(!REG_VT_MULTI_SZ), {"0.0.0.0"}}
  3349.         SetRegValue $(KeyNdisWan) {SubnetMask, 0, +
  3350.                     $(!REG_VT_MULTI_SZ), {"0.0.0.0"}}
  3351.         SetRegValue $(KeyNdisWan) {DefaultGateway, 0, +
  3352.                     $(!REG_VT_MULTI_SZ), {""}}
  3353.         SetRegValue $(KeyNdisWan) {LLInterface, 0,+
  3354.                     $(!REG_VT_SZ), $(LLInterface)}
  3355.         SetRegValue $(KeyNdisWan) {EnableDHCP, 0,+
  3356.                     $(!REG_VT_DWORD), 0}
  3357.         SetRegValue $(KeyNdisWan) {UseZeroBroadcast, 0, +
  3358.                     $(!REG_VT_DWORD), 0}
  3359.             else
  3360.         Debug-Output "IM: UpdateLLInterface: couldn't "+
  3361.             "create NdisWan params-tcpip key"
  3362.                 goto UpdateLLInterfaceEnd
  3363.             endif
  3364.         endif
  3365.         CloseRegKey $(KeyNdisWan)
  3366.         EndForListDo
  3367.     endif
  3368.     set Status = STATUS_SUCCESSFUL
  3369. UpdateLLInterfaceEnd =+
  3370.     Debug-Output "UpdateLLInterface: exit"
  3371.     return $(Status)
  3372.  
  3373. [SetRasArpBindValueFromTcpIP]
  3374.     read-syms GeneralConstants
  3375.     read-syms FileConstants
  3376.     read-syms FileConstantsENG
  3377.  
  3378.     Debug-Output "SetRasArpBindValueFromTcpIP: entry"
  3379.     set Status = STATUS_FAILED
  3380.     set KeyNull = ""
  3381.     set IPLinkageKeyName = $(!NTN_ServiceBase)"\TCPIP\Linkage"
  3382.     OpenRegKey $(!REG_H_LOCAL) "" $(IPLinkageKeyName) $(MAXIMUM_ALLOWED) +
  3383.         KeyIpLinkage
  3384.     ifstr $(KeyIpLinkage) == $(KeyNull)
  3385.         Debug-Output "IM: SetRasArpBindValueFromTcpIP: can't open IP Linkage"
  3386.         goto SetRasArpBindValueFromTcpIPEnd
  3387.     endif
  3388.  
  3389.     set compareSize = 0
  3390.     set compareString = $(ProductSoftwareName)"_NdisWan"
  3391.     Split-String $(compareString) $(compareString) charList
  3392.     ForListDo $(charList)
  3393.         set-add compareSize = $(compareSize),1
  3394.     EndForListDo
  3395.  
  3396.     set NdisWanList = {}
  3397.     GetRegValue $(KeyIpLinkage) "Bind" TmpList
  3398.     ForListDo *($(TmpList),4)
  3399.         Split-String $($), "\", BindList
  3400.         QueryListSize ListSize $(BindList)
  3401.         set ServiceName = *($(BindList), $(ListSize))
  3402.         LibraryProcedure Result $(!LIBHANDLE) SetupStrncmp $(ServiceName) +
  3403.             $(compareString) $(compareSize)
  3404.         ifint $(Result) == 0
  3405.             set NdisWanList = >($(NdisWanList), $($))
  3406.         endif
  3407.     EndForListDo
  3408.     set RasArpLinkageKeyName = $(!NTN_ServiceBase)"\RASARP\Linkage"
  3409.     OpenRegKey $(!REG_H_LOCAL) "" $(RasArpLinkageKeyName) $(MAXIMUM_ALLOWED) +
  3410.         KeyRasArpLinkage
  3411.     ifstr $(KeyRasArpLinkage) != $(KeyNull)
  3412.         SetRegValue $(KeyRasArpLinkage) {Bind, 0, $(!REG_VT_MULTI_SZ), +
  3413.         $(NdisWanList)}
  3414.         CloseRegKey $(KeyRasArpLinkage)
  3415.     endif
  3416.     CloseRegKey $(KeyIpLinkage)
  3417.     set Status = STATUS_SUCCESSFUL
  3418. SetRasArpBindValueFromTcpIPEnd=+
  3419.     Debug-Output "SetRasArpBindValueFromTcpIP: entry"
  3420.     return $(Status)
  3421.  
  3422. ;*************************************************************************
  3423. ; end code taken from oemnsvra.inf for NDISWAN 
  3424. ;*************************************************************************
  3425.