;
; Novell NetWare for Windows NT Setup Common Shell Sections.
;
;
; ===================================================================================

;
; The following is the version info for Novell
;

;VeRsIoN=v4.70 Novell Client Install for Windows NT (970910)
;CoPyRiGhT=copyright 1992-1998, by Novell, INC. All rights reserved.

[NwBaseVars]
	MAXIMUM_ALLOWED  = 33554432
	KeyNull                         = ""
	RegistryErrorIndex = NO_ERROR
	NoTitle                         = 0
	!RegLastError           = NO_ERROR
	UtilityInf                      = "UTILITY.INF"
	IDH_NETWAREWRKSTATIONPARMS =    901
	IDH_NETWAREIPXBIND                      =       902
	IDH_IPXSPXPARMS                         =       903
	IDH_NETWORKPROTOCOL                     =       904
	IDH_NETWAREODISETTINGS          =       905
	IDH_NETWARECLIENTINSTALL        =       906
	IDH_NETWARENDISODI                      =       907
	IDH_NODEADDRESSOVERIDE          =       908
	IDH_RESMGRCONFIG                        =       951
	Help            = "&Help"
	OK                      = "&OK"
	Continue        = "Con&tinue"
	Cancel          = "&Cancel"
	Advanced = "&Advanced"

[IpxVars]
	 IpxServiceName = "IpxSpx"
	 IpxParameters  = $(!NTN_ServiceBase)"\"$(IpxServiceName)"\Parameters"
	 IpxCardName            = "Card Name"
	 IpxCardInstance = "Card Instance"
	 IpxNtCardInstance = "Nt Card Instance"

[OdiNSupVars]
	 OdiNSupServiceName     = "ODINSUP"
	 OdiNSupParameters      = $(!NTN_ServiceBase)"\"$(OdiNSupServiceName)"\Parameters"
	 OdiNSupLinkage         = $(!NTN_ServiceBase)"\"$(OdiNSupServiceName)"\Linkage"
	 OdiNSupCardName                = "Bind"
	 OdiNSupCardInstance = "BoardInstance"

[OdiVars]
	 DriverName      = "OdiLoad"
	 OdiModules      = "ODI_Modules"
	 OdiLinkName    = "OdiLoadName"
	 OdiModuleName = $(!NTN_ServiceBase)"\"$(DriverName)"\"$(OdiModules)
	 NetworkCardsKeyName = $(!NTN_SoftwareBase)"\Microsoft\Windows NT\CurrentVersion\NetworkCards"


; ===================================================================================
;
;
; ===================================================================================
;
; Section to create a list of all installed ODI adapters.       Used by IpxSpx configure.
; Could also be used by ODINSUP configure.
;
; INPUT:
;        NONE
;
; OUTPUT:
;        $($R0) List of installed ODI adapter names.
;        $($R1) List of installed ODI adapter titles.
;        $($R2) List of installed ODI adapter card numbers.
;        $($R3) Number of installed ODI adapters.
;
; ===================================================================================

[GetOdiAdapterList]
;
; In this section we will create a list of installed ODI adapters.
;
	read-syms NwBaseVars
	read-syms OdiVars

	Set OdiCardNumList = {}
	Set OdiTitleList = {}
	Set OdiCardList = {}


	OpenRegKey $(!REG_H_LOCAL) "" $(NetworkCardsKeyName) $(MAXIMUM_ALLOWED) NetCardsKey

	Ifstr(i) $(NetCardsKey) == ""
		Debug-Output "NWSUBS.INF: Can't Open Registry key "$(NetworkCardsKeyName)
		set CommonStatus = STATUS_USERCANCEL
	Else
;
;               Get a list of all installed network cards
;
		EnumRegKey $(NetCardsKey) NetCardsList

		Set NumberOdiAdapters = 0

		ForListDo $(NetCardsList)
			Set CardNumber = *($($), 1)

			OpenRegKey $(NetCardsKey) "" $(CardNumber) $(MAXIMUM_ALLOWED) CardKey
			Ifstr(i) $(CardKey) == ""
				Debug-Output "NWSUBS.INF: Can't open adapter "$(Card)
			Else
				GetRegValue $(CardKey) "OdiAdapter" OdiValueList
				Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
					set OdiAdapter = *($(OdiValueList), 4)

					Ifstr(i) $(OdiAdapter) == "1"
;
;                                               Must be an ODI Adapter so add it to our lists.
;
						set-add NumberOdiAdapters = $(NumberOdiAdapters), 1

						GetRegValue $(CardKey) "Title" OdiTitleValues
						Set OdiTitle = *($(OdiTitleValues), 4)
						GetRegValue $(CardKey) "ProductName" OdiNameValues
						Set OdiName = *($(OdiNameValues), 4)

						Set OdiCardNumList = >($(OdiCardNumList), $(CardNumber))
						Set OdiTitleList = >($(OdiTitleList), $(OdiTitle))
						Set OdiCardList = >($(OdiCardList), $(OdiName))
					Endif
				Endif

				CloseRegKey $(CardKey)
			Endif

		EndForListDo

		Debug-Output "NWSUBS.INF: OdiCardNumList		= "$(OdiCardNumList)
		Debug-Output "NWSUBS.INF: OdiTitleList			= "$(OdiTitleList)
		Debug-Output "NWSUBS.INF: OdiCardList			= "$(OdiCardList)
		Debug-Output "NWSUBS.INF: NumberOdiAdapters	= "$(NumberOdiAdapters)

		CloseRegKey $(NetCardsKey)

	Endif

	return $(OdiTitleList) $(OdiCardList) $(OdiCardNumList) $(NumberOdiAdapters)

; ===================================================================================
;
; This section creates a list of the frame types loaded by OdiLoad.
;
; ===================================================================================

;[GetOdiLoadFrameList]
;        read-syms InitBaseVars
;
;        return


; ===================================================================================
; NwSetCardInstance:
;
;        INPUT:
;                $($0) - Open Key to Services\OdiLoad or "" and I'll open it (*** NOT USED ***).
;                $($1) - Open key to Services\OdiLoad\Odi_Modules or "" and I'll open it.
;                $($2) - Open key to Services\OdiLoad\Odi_Modules\ne2000 #1 or "" and I'll try
;                                               to open the key $($3) under Odi_Modules, that is if $($3) is not "".
;                $($3) - The card name (ne2000 #1, etc) or "".
;                                               The 'ne2000 #1' will vary based on card name and instance.
;                                               If something other than "" is passed then the Card Instance assigned
;                       to this OdiLoad-able Module is returned as $($R1) otherwise
;                                               $($R1) will equal 1.
;
;        OUTPUT:
;                $($R0) - Result NO_ERROR if successful, otherwise an error string.
;                $($R1) - New OdiLoad Board instance for the card currently being installed
;                                        or 1 if the card name passed in $($3) is "".
;
;
;
; Sets the BoardInstance for ALL installed Odi Modules.
;
; ===================================================================================

[NwSetCardInstance]
	Set KeyOdiLoad          =       $($0)
	Set KeyOdiModules =     $($1)
	Set KeyOdiCard          =       $($2)
	Set OdiCardName =       $($3)

	read-syms NwBaseVars
	read-syms OdiVars

	Set CurInstance = 1
;
; Get a list of installed Odi Modules and create a list of the base card names.
;
	Set CloseOdiModules = FALSE

	Ifstr(i) $(KeyOdiModules) == ""
		OpenRegKey $(!REG_H_LOCAL) "" $(OdiModuleName) $(MAXIMUM_ALLOWED) KeyOdiModules
		Ifstr(i) $(KeyOdiModules) == ""
			Set Result = "Can't open "$(OdiModuleName)
			Debug-Output "NWSUBS.INF: SetCardInstance, "$(Result)
			goto Exit_SetCardInstance
		Endif
		CloseOdiModules = TRUE
	Endif

	EnumRegKey $(KeyOdiModules) OdiModulesList

	Set OdiList = {}
	Set BaseNameList = {}

	ForListDo $(OdiModulesList)
		Set CurList = $($)
		Set CurModule = *($(CurList), 1)
		Set OdiList = >($(OdiList), $(CurModule))
		Set CloseCard = FALSE

		Split-String $(CurModule) " " NamePartList
		Set NameBase = *($(NamePartList), 1)
		Ifcontains(i) $(NameBase) in $(BaseNameList)
			Debug-Output "NWSUBS.INF: "$(NameBase)" already in list"
		Else
			Set BaseNameList = >($(BaseNameList), $(NameBase))
		Endif

		set-add Inst$(NameBase) = $(Inst$(NameBase)), 1

		Set KeyToCard = ""

		Ifstr(i) $(OdiCardName) != ""
			Ifstr(i) $(OdiCardName) == $(CurModule)
				Set KeyToCard = $(KeyOdiCard)
				Set CurInstance = $(Inst$(NameBase))
			Endif
		Endif
		Ifstr(i) $(KeyToCard) == ""
			OpenRegKey $(KeyOdiModules) "" $(CurModule) $(MAXIMUM_ALLOWED) KeyToCard
			Ifstr(i) $(KeyToCard) == ""
				Set Result = "Can't Open "$(CurModule)
				Debug-Output "NWSUBS.INF: SetCardInstance, "$(Result)
				goto Exit_SetCardInstance
			Endif
			Set CloseCard = TRUE
		Endif

		SetRegValue $(KeyToCard) {BoardInstance,$(NoTitle),$(!REG_VT_DWORD),$(Inst$(NameBase))}

		Ifstr(i) $(CloseCard) == TRUE
			CloseRegKey $(KeyToCard)
		Endif

	EndForListDo

	Debug-Output "NWSUBS.INF: OdiList = "$(OdiList)
	Debug-Output "NWSUBS.INF: BaseNameList = "$(BaseNameList)

	ForListDo $(BaseNameList)
		set CardName = $($)
		Debug-Output "NWSUBS.INF: "$(CardName)" cards found = "$(Inst$(CardName))
	EndForListDo

	Set Result = NO_ERROR

Exit_SetCardInstance = +
	Ifstr(i) $(CloseOdiModules) == TRUE
		Debug-Output "NWSUBS.INF: Close Odi Modules"
		CloseRegKey $(KeyOdiModules)
	Endif

	return $(Result) $(CurInstance)


; ===================================================================================
; ===================================================================================

[NwSetIpxCard]
	Set OdiCardName = $($0)
	Set OdiCardInstance = $($1)

	Debug-Output "NwSetIpxCard: OdiCardName = "$(OdiCardName)
	Debug-Output "NwSetIpxCard: OdiCardInstance = "$(OdiCardInstance)

	read-syms NwBaseVars
	read-syms IpxVars
	read-syms OdiVars
	read-syms OdiNSupVars
	read-syms InstallOption$(!STF_LANGUAGE)

	Set Result = NO_ERROR

	; If more than one board ask the user which board to bind to.
	;
	Shell $(NwSubsInf) GetOdiAdapterList

	Set OdiTitleList                = $($R0)
	Set OdiCardList          = $($R1)
	Set OdiNtNumberList     = $($R2)
	Set NumberOdiAdapters = $($R3)

	Shell "" GetLanguageDir
	Set NLSDirName = $($R0)

	Shell "" GetNTVersion
	Set NTMajorVersion = $($R0)

	LoadLibrary $(LoadDisk3Text) $(!STF_WINDOWSSYSPATH)"\nwsetup.dll" NwLibHandle
	SetHelpFile $(!STF_WINDOWSSYSPATH)"\nls\"$(NLSDirName)"\setupnw.hlp" $(!MinimumID) $(!MaximumID)
	

	Ifint $(NumberOdiAdapters) > 1
		;
		; More than one ODI adapter is installed so allow
		; the user to select which one to bind to.
		;
	
	
		Ifstr(i) $(OdiCurBindCardName) != ""
			 Debug-Output "NWSUBS.INF: OdiCurBindCardName = "$(OdiCurBindCardName)
			 Set DefaultOdiTitle = *($(OdiTitleList), ~($(OdiCardList), $(OdiCurBindCardName)))
		Endif
	
		Ifstr(i) $(DefaultOdiTitle) == ""
			 Set DefaultOdiTitle = *($(OdiTitleList), 1)
		Endif
	
		Debug-Output "NWSUBS.INF: DefaultOdiTitle = "$(DefaultOdiTitle)
	
		read-syms IPXBindDlg$(!STF_LANGUAGE)
		ui start "IPXBIND" $(NwLibHandle)
		ui pop 1

		ifstr(i) $(DLGEVENT) == "BACK"
			set AdapterSelected = ""
		else
			Set AdapterSelected = *($(DefaultOdiTitle), 1)
		endif
	
		Debug-Output "NWSUBS.INF: AdapterSelected = "$(AdapterSelected)
		
		Ifstr(i) $(AdapterSelected) == ""
			Debug-Output "NWSUBS.INF: Cancel Selected"
			Set CardToBindTo = *($(OdiCardList), 1)
			Set CardInstance = 1
			Set NtAdapterNumber = *($(OdiNtNumberList), 1)
		Else
			Set CardToBindTo = *($(OdiCardList), ~($(OdiTitleList), $(AdapterSelected)))
			Debug-Output "CardToBindTo = "$(CardToBindTo)
	
			Set NtAdapterNumber = *($(OdiNtNumberList), ~($(OdiTitleList), $(AdapterSelected)))
			Debug-Output "NtAdapterNumber = "$(NtAdapterNumber)
	
			Set NtAdapterKeyName = $(NetworkCardsKeyName)"\"$(NtAdapterNumber)
			OpenRegKey $(!REG_H_LOCAL) "" $(NtAdapterKeyName) $(MAXIMUM_ALLOWED) KeyNtAdapter
			Ifstr(i) $(KeyNtAdapter) != ""
	
				GetRegValue $(KeyNtAdapter),"ServiceName", ServiceNameList
				Set ServiceName = *($(ServiceNameList), 4)
				CloseRegKey $(KeyNtAdapter)
		
		
				; Open the lan man card's service\Parameters.
				;
				OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_ServiceBase)"\"$(ServiceName)"\Parameters" $(MAXIMUM_ALLOWED) KeyService
				ifstr(i) $(KeyService) == ""
		
					 Debug-Output "NWSUBS.INF: NwSetIpxCard, Can't open "$(ServiceName)
		
				Else
					; Get the OdiLoad link.
					;
					GetRegValue $(KeyService) $(OdiLinkName) CardInstanceList
					Set CardInstanceName = *($(CardInstanceList), 4)
					CloseRegKey $(KeyService)
			
					OpenRegKey $(!REG_H_LOCAL) "" $(OdiModuleName)"\"$(CardInstanceName) $(MAXIMUM_ALLOWED) KeyOdiCard
					Ifstr(i) $(KeyOdiCard) != ""
						GetRegValue $(KeyOdiCard) "BoardInstance" BoardInstanceList
						Set CardInstance = *($(BoardInstanceList), 4)
						Debug-Output "1: Selected CardInstance = "$(CardInstance)
						CloseRegKey $(KeyOdiCard)
					Endif
				Endif
			Else
				Debug-Output "Can't open "$(NtAdapterKeyName)
			Endif
		Endif
	Else
		Set CardToBindTo = *($(OdiCardList), 1)
		Set CardInstance = 1
		Set NtAdapterNumber = *($(OdiNtNumberList), 1)
	Endif

	OpenRegKey $(!REG_H_LOCAL) "" $(IpxParameters) $(MAXIMUM_ALLOWED) KeyIpxParameters
	Ifstr(i) $(KeyIpxParameters) == ""
		Set Result = "Can't open IpxSpx service."
		Debug-Output "NWSUBS.INF: "$(Result)
	Else
		GetRegValue $(KeyIpxParameters) $(IpxCardName) CurrentCardNameList
		Set CurrentCardName = *($(CurrentCardNameList), 4)
		Debug-Output "CurrentCardName = "$(CurrentCardName)" CardToBindTo = "$(CardToBindTo)

		Set GUIResult = ""

		Ifstr(i) $(CurrentCardName) != $(CardToBindTo)
			Shell "" NwSetFrameType $(CardToBindTo) $(NtAdapterNumber) $(NwLibHandle)

			Set GUIResult = $($R0)
		Endif

		SetRegValue $(KeyIpxParameters) {$(IpxCardName),$(NoTitle),$(!REG_VT_SZ),$(CardToBindTo)}
		Ifstr(i) $(OdiCardInstance) == ""
			Debug-Output "NWSUBS.INF: NwSetIpxCard, OdiCardInstance set to default."
			Set OdiCardInstance = "1"
		Endif

		SetRegValue $(KeyIpxParameters) {$(IpxCardInstance),$(NoTitle),$(!REG_VT_DWORD),$(OdiCardInstance)}
		Debug-Output "2: NtAdapterNumber = "$(NtAdapterNumber)
		SetRegValue $(KeyIpxParameters) {$(IpxNtCardInstance),$(NoTitle),$(!REG_VT_SZ),$(NtAdapterNumber)}
		Ifstr(i) $(GUIResult) != ""
			SetRegValue $(KeyIpxParameters) {"Frame Type",$(NoTitle),$(!REG_VT_SZ),$(GUIResult)}
		Endif

		CloseRegKey $(KeyIpxParameters)
	Endif

	; Find the ODINSUPXX service name
	;

	OpenRegKey $(!REG_H_LOCAL) "" $(NetworkCardsKeyName) $(MAXIMUM_ALLOWED) NetCardsKey

	Ifstr(i) $(NetCardsKey) != ""
		EnumRegKey $(NetCardsKey) NetCardsList
		Debug-Output "NetCardsList = "$(NetCardsList)
		ForListDo $(NetCardsList)
			Set CardNumber = *($($), 1)
			Debug-Output "CardNumber = "$(CardNumber)
			OpenRegKey $(NetCardsKey) "" $(CardNumber) $(MAXIMUM_ALLOWED) KeyCardNumber
			Ifstr(i) $(KeyCardNumber) != ""
				GetRegValue $(KeyCardNumber), "ProductName", ProductNameList
				Set ProductName = *($(ProductNameList), 4)
				Debug-Output "ProductName = "$(ProductName)
				Ifstr(i) $(ProductName) == "ODINSUP"
					GetRegValue $(KeyCardNumber), "ServiceName", ServiceNameList
					Set ServiceName = *($(ServiceNameList), 4)
					OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_ServiceBase)"\"$(ServiceName)"\Parameters" $(MAXIMUM_ALLOWED) KeyOdiNSupParameters
				Endif
				CloseRegKey $(KeyCardNumber)
			Endif
		EndForListDo
		CloseRegKey $(NetCardsKey)
	Endif


;       OpenRegKey $(!REG_H_LOCAL) "" $(OdiNSupParameters) $(MAXIMUM_ALLOWED) KeyOdiNSupParameters

	Ifstr(i) $(KeyOdiNSupParameters) != ""

		Ifint $(NumberOdiAdapters) > 1
			;
			; More than one ODI adapter is installed so allow
			; the user to select which one to bind to.
			;
	
	
			Ifstr(i) $(OdiCurBindCardName) != ""
				Debug-Output "NWSUBS.INF: OdiCurBindCardName = "$(OdiCurBindCardName)
				Set DefaultOdiTitle = *($(OdiTitleList), ~($(OdiCardList), $(OdiCurBindCardName)))
			Endif
	
			Ifstr(i) $(DefaultOdiTitle) == ""
				Set DefaultOdiTitle = *($(OdiTitleList), 1)
			Endif
	
			Debug-Output "NWSUBS.INF: DefaultOdiTitle = "$(DefaultOdiTitle)

			read-syms OdinsupDlg$(!STF_LANGUAGE)
			ui start "ODINSUP" $(NwLibHandle)
			ui pop 1
	
			ifstr(i) $(DLGEVENT) == "BACK"
				set AdapterSelected = ""
			else
				Set AdapterSelected = *($(DefaultOdiTitle), 1)
			endif

			Debug-Output "NWSUBS.INF: ODINSUP AdapterSelected = "$(AdapterSelected)

			Ifstr(i) $(AdapterSelected) == ""
				Debug-Output "NWSUBS.INF: Cancel Selected"
				Set CardToBindTo = *($(OdiCardList), 1)
				Set CardInstance = 1
			Else
				Set CardToBindTo = *($(OdiCardList), ~($(OdiTitleList), $(AdapterSelected)))
				Debug-Output "CardToBindTo = "$(CardToBindTo)
	
				Set NtAdapterNumber = *($(OdiNtNumberList), ~($(OdiTitleList), $(AdapterSelected)))
				Debug-Output "NtAdapterNumber = "$(NtAdapterNumber)
	
				Set NtAdapterKeyName = $(NetworkCardsKeyName)"\"$(NtAdapterNumber)
				OpenRegKey $(!REG_H_LOCAL) "" $(NtAdapterKeyName) $(MAXIMUM_ALLOWED) KeyNtAdapter
				Ifstr(i) $(KeyNtAdapter) != ""
	
					GetRegValue $(KeyNtAdapter),"ServiceName", ServiceNameList
					Set ServiceName = *($(ServiceNameList), 4)
					CloseRegKey $(KeyNtAdapter)
	
	
					; Open the lan man card's service\Parameters.
					;
					OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_ServiceBase)"\"$(ServiceName)"\Parameters" $(MAXIMUM_ALLOWED) KeyService
					ifstr(i) $(KeyService) == ""
	
						Debug-Output "NWSUBS.INF: NwSetIpxCard, Can't open "$(ServiceName)
	
					Else
						; Get the OdiLoad link.
						;
						GetRegValue $(KeyService) $(OdiLinkName) CardInstanceList
						Set CardInstanceName = *($(CardInstanceList), 4)
						CloseRegKey $(KeyService)
		
						OpenRegKey $(!REG_H_LOCAL) "" $(OdiModuleName)"\"$(CardInstanceName) $(MAXIMUM_ALLOWED) KeyOdiCard
						Ifstr(i) $(KeyOdiCard) != ""
							GetRegValue $(KeyOdiCard) "BoardInstance" BoardInstanceList
							Set CardInstance = *($(BoardInstanceList), 4)
							Debug-Output "2: Selected CardInstance = "$(CardInstance)
							CloseRegKey $(KeyOdiCard)
						Endif
					Endif
				Else
					Debug-Output "Can't open "$(NtAdapterKeyName)
				Endif
			Endif
		Else
			;
			; only one ODI adapter so use same card name as ipx.
			;
			Debug-Output "NWSUBS.INF: ODISUP bound to "$(CardToBindTo)
		Endif


		SetRegValue $(KeyOdiNSupParameters) {$(OdiNSupCardName),$(NoTitle),$(!REG_VT_SZ),$(CardToBindTo)}
		Ifstr(i) $(OdiCardInstance) == ""
			Debug-Output "NWSUBS.INF: NwSetIpxCard, OdiCardInstance set to default."
			Set OdiCardInstance = "1"
		Endif
		SetRegValue $(KeyOdiNSupParameters) {$(OdiNSupCardInstance),$(NoTitle),$(!REG_VT_DWORD),$(OdiCardInstance)}

		CloseRegKey $(KeyOdiNSupParameters)
	Endif

	FreeLibrary $(NwLibHandle)


	return $(Result)


; ===================================================================================
;
; Remove an installed NetWare ODI Adapter.
;
; We start with the SOFTWARE\Windows NT\NetworkCards\## key name.       Open this key and
; get the 'ServiceName' link value, use this string to open the service\Parameters key
; for this adapter.     Get the OdiLoadName link value from service\Parameters and open
; this key.
;
; ===================================================================================

[NwRemoveAdapter]
	 Set LanManCardInstance = $($0)

	 read-syms NwBaseVars
	 read-syms IpxVars
	 read-syms OdiVars
	 read-syms OdiNSupVars
	read-syms InstallOption$(!STF_LANGUAGE)

	 Set Result = NO_ERROR

	 Debug-Output "NWSUBS.INF: ------------------------------------------------------"
	 Debug-Output "NWSUBS.INF: NwRemoveAdapter called with "$(LanManCardInstance)

;       Open the lan man card.
;
	 OpenRegKey $(!REG_H_LOCAL) "" $(LanManCardInstance) $(MAXIMUM_ALLOWED) KeyLanManCard
	 Ifstr(i) $(KeyLanManCard) == ""

			Debug-Output "NWSUBS.INF: RemoveAdapter, Can't open "$(LanManCardInstance)

	 Else

;       Clear the OdiAdapter Flag so that this adapter does not show up on the
;                list of Odi adapters for Ipx to bind too.
;
	SetRegValue $(KeyLanManCard) {OdiAdapter,$(NoTitle),$(!REG_VT_DWORD),0}

;                Get the lanman cards service name link.
;
			GetRegValue $(KeyLanManCard),"ServiceName", ServiceNameList
			Set ServiceName = *($(ServiceNameList), 4)
			CloseRegKey $(KeyLanManCard)


;                Open the lan man card's service\Parameters.
;
			OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_ServiceBase)"\"$(ServiceName)"\Parameters" $(MAXIMUM_ALLOWED) KeyService
	ifstr(i) $(KeyService) == ""

		 Debug-Output "NWSUBS.INF: RemoveAdapter, Can't open "$(ServiceName)

	Else
;                               Get the OdiLoad link.
;
		 GetRegValue $(KeyService) $(OdiLinkName) CardInstanceList
		 Set CardInstanceName = *($(CardInstanceList), 4)
		 CloseRegKey $(KeyService)
	
		 OpenRegKey $(!REG_H_LOCAL) "" $(OdiModuleName) $(MAXIMUM_ALLOWED) KeyOdiModules
		 Ifstr(i) $(KeyOdiModules) == ""
	
		Debug-Output "NWSUBS.INF: RemoveAdapter, Can't open "$(OdiModulesName)
	
		 Else
;
;                                       Get the Board instance for the card being deleted before we delete it.
;

		OpenRegKey $(KeyOdiModules) "" $(CardInstanceName) $(MAXIMUM_ALLOWED) KeyOdiCard
		Ifstr(i) $(KeyOdiCard) == ""
			 Set Result = "Can't open card "$(CardInstanceName)
			 Debug-Output "NWSUBS.INF: NwRemoveAdapter, "$(Result)
		Else
			 GetRegValue $(KeyOdiCard) "BoardInstance" InstanceValues
			 Set DeletedCardInstance = *($(InstanceValues), 4)
			 Debug-Output "NWSUBS.INF: Board Instance of Card being Removed = "$(DeletedCardInstance)
			 CloseRegKey $(KeyOdiCard)
		Endif
;
; Delete the card from ODI Modules.
;
		Debug-Output "NWSUBS.INF: Deleting card "$(CardInstanceName)
		Debug-Output "NWSUBS.INF: From Key "$(OdiModuleName)

		DeleteRegTree $(KeyOdiModules) $(CardInstanceName)
	
		FlushRegKey $(KeyOdiModules)

		Shell "" NwSetCardInstance "" $(KeyOdiModules) "" ""


;               Check IpxSpx parameters to see if IpxSpx is bound to the
;                                       adapter just removed or to a greater instance of this model of adapter.
;
		OpenRegKey $(!REG_H_LOCAL) "" $(IpxParameters) $(MAXIMUM_ALLOWED) KeyIpxParameters
		Ifstr(i) $(KeyIpxParameters) == ""
			 Debug-Output "NWSUBS.INF: NwRemoveAdapter, Can't open "$(IpxParameters)
		Else
;                                                Get Ipx CardName and CardInstance
;
			 GetRegValue $(KeyIpxParameters) $(IpxCardName) TmpCardList
			 Set CurIpxCardName = *($(TmpCardList), 4)

			 GetRegValue $(KeyIpxParameters) $(IpxCardInstance) TmpInstanceList
			 Set CurIpxCardInstance = *($(TmpInstanceList), 4)

			 GetRegValue $(KeyIpxParameters) $(IpxNtCardInstance) TmpNtInstanceList
			 Set NtAdapterNumber = *($(TmpNtInstanceList), 4)

			 Debug-Output "NWSUBS.INF: CurIpxCardName		-- "$(CurIpxCardName)
			 Debug-Output "				CurIpxCardInstance -- "$(CurIpxCardInstance)
			 Debug-Output "				NtAdapterNumber	 -- "$(NtAdapterNumber)

;                                                Get the base name of the ODI Module being removed.
;
			 Split-String $(CardInstanceName) " " CardInstanceValues
			 Set CardBaseName = *($(CardInstanceValues), 1)
			 Debug-Output "NWSUBS.INF: CardBaseName = "$(CardBaseName)

			 Ifstr(i) $(CardBaseName) == $(CurIpxCardName)
					Debug-Output "NWSUBS.INF: Ipx bound to a card with the same name: "$(CardBaseName)

			Ifint $(DeletedCardInstance) < $(CurIpxCardInstance)
				 Debug-Output "NWSUBS.INF: Existing Board Instance Okay"
			Else-Ifint $(DeletedCardInstance) == $(CurIpxCardInstance)
				 Debug-Output "NWSUBS.INF: The board Ipx was bound to has been removed."
								Shell $(NwSubsInf) GetOdiAdapterList

									 Set OdiTitleList               = $($R0)
								Set OdiCardList          = $($R1)
				 Set OdiNtNumberList    = $($R2)
				 Set NumberOdiAdapters = $($R3)

								Debug-Output "NWSUBS.INF: OdiTitleList = "$(OdiTitleList)
								Debug-Output "NWSUBS.INF: OdiCardList	= "$(OdiCardList)
									 Debug-Output "NWSUBS.INF: R2				= "$($R2)
									 Debug-Output "NWSUBS.INF: NumberOdiAdapters = "$(NumberOdiAdapters)

				 Set ReBind = FALSE

						Shell "" GetLanguageDir
						Set NLSDirName = $($R0)
			
						Shell "" GetNTVersion
						Set NTMajorVersion = $($R0)

						LoadLibrary $(LoadDisk3Text) $(!STF_WINDOWSSYSPATH)"\nwsetup.dll" NwLibHandle
						SetHelpFile $(!STF_WINDOWSSYSPATH)"\nls\"$(NLSDirName)"\setupnw.hlp" $(!MinimumID) $(!MaximumID)

				 Ifint $(NumberOdiAdapters) < 1
						Debug-Output "NWSUBS.INF: No ODI Adapters Installed."
				 Else-Ifint $(NumberOdiAdapters) == 1
						Set CardToBindTo = *($(OdiCardList), 1)
						Set CardInstance = 1
									Set NtAdapterNumber = *($(OdiNtNumberList), 1)
						Debug-Output "NWSUBS.INF: Only one ODI Adapter Installed "$(CardToBindTo)
				Set ReBind = TRUE;
				Else
						;
						; More than one ODI adapter is installed so allow
						; the user to select which one to bind to.
						;


						Ifstr(i) $(OdiCurBindCardName) != ""
							Debug-Output "NWSUBS.INF: OdiCurBindCardName = "$(OdiCurBindCardName)
							Set DefaultOdiTitle = *($(OdiTitleList), ~($(OdiCardList), $(OdiCurBindCardName)))
						Endif
			
						Ifstr(i) $(DefaultOdiTitle) == ""
							Set DefaultOdiTitle = *($(OdiTitleList), 1)
						Endif
			
						Debug-Output "NWSUBS.INF: DefaultOdiTitle = "$(DefaultOdiTitle)

		  read-syms IPXBindDlg$(!STF_LANGUAGE)
						ui start "IPXBIND" $(NwLibHandle)
						ui pop 1

						ifstr(i) $(DLGEVENT) == "BACK"
							set AdapterSelected = ""
						else
							Set AdapterSelected = *($(DefaultOdiTitle), 1)
						endif

						Debug-Output "NWSUBS.INF: AdapterSelected = "$(AdapterSelected)
						Ifstr(i) $(AdapterSelected) == ""
							Debug-Output "NWSUBS.INF: Cancel Selected"
							Set CardToBindTo = *($(OdiCardList), 1)
							Set CardInstance = 1
							Set NtAdapterNumber = *($(OdiNtNumberList), 1)
						Else
							Set CardToBindTo = *($(OdiCardList), ~($(OdiTitleList), $(AdapterSelected)))
							Debug-Output "CardToBindTo = "$(CardToBindTo)

							Set NtAdapterNumber = *($(OdiNtNumberList), ~($(OdiTitleList), $(AdapterSelected)))
							Debug-Output "NtAdapterNumber = "$(NtAdapterNumber)

							Set NtAdapterKeyName = $(NetworkCardsKeyName)"\"$(NtAdapterNumber)
							OpenRegKey $(!REG_H_LOCAL) "" $(NtAdapterKeyName) $(MAXIMUM_ALLOWED) KeyNtAdapter
							Ifstr(i) $(KeyNtAdapter) != ""

								GetRegValue $(KeyNtAdapter),"ServiceName", ServiceNameList
								Set ServiceName = *($(ServiceNameList), 4)
								CloseRegKey $(KeyNtAdapter)
			
								 ; Open the lan man card's service\Parameters.
								 ;
								OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_ServiceBase)"\"$(ServiceName)"\Parameters" $(MAXIMUM_ALLOWED) KeyService
								ifstr(i) $(KeyService) == ""
			
									Debug-Output "NWSUBS.INF: RemoveAdapter, Can't open "$(ServiceName)
								Else
										; Get the OdiLoad link.
										;
									GetRegValue $(KeyService) $(OdiLinkName) CardInstanceList
									Set TmpCardInstanceName = *($(CardInstanceList), 4)
									CloseRegKey $(KeyService)
				
									OpenRegKey $(!REG_H_LOCAL) "" $(OdiModuleName)"\"$(TmpCardInstanceName) $(MAXIMUM_ALLOWED) KeyOdiCard
									Ifstr(i) $(KeyOdiCard) != ""
										GetRegValue $(KeyOdiCard) "BoardInstance" BoardInstanceList
										Set CardInstance = *($(BoardInstanceList), 4)
										Debug-Output "Selected CardInstance = "$(CardInstance)
										CloseRegKey $(KeyOdiCard)
									Endif
								Endif
							Else
								Debug-Output "Can't open "$(NtAdapterKeyName)
							Endif
						Endif
			
				Set ReBind = TRUE
				Endif
				 Ifstr(i) $(ReBind) == TRUE
						SetRegValue $(KeyIpxParameters) {$(IpxCardInstance),$(NoTitle),$(!REG_VT_DWORD),$(CardInstance)}
								SetRegValue $(KeyIpxParameters) {$(IpxCardName),$(NoTitle),$(!REG_VT_SZ),$(CardToBindTo)}
				SetRegValue $(KeyIpxParameters) {$(IpxNtCardInstance),$(NoTitle),$(!REG_VT_SZ),$(NtAdapterNumber)}
				Shell "" NwSetFrameType $(CardToBindTo) $(NtAdapterNumber) $(NwLibHandle)

				Set GUIResult = $($R0)
				Ifstr(i) $(GUIResult) != ""
										 SetRegValue $(KeyIpxParameters) {"FrameType",$(NoTitle),$(!REG_VT_SZ),$(GUIResult)}
				Endif
				 Endif

						FreeLibrary $(NwLibHandle)

					Else
						Set-sub CardInstance = $(DeletedCardInstance), 1
						Debug-Output "NWSUBS.INF: Need to change board instance "$(CardInstance)
						SetRegValue $(KeyIpxParameters) {$(IpxCardInstance),$(NoTitle),$(!REG_VT_DWORD),$(CardInstance)}
				SetRegValue $(KeyIpxParameters) {$(IpxNtCardInstance),$(NoTitle),$(!REG_VT_SZ),$(NtAdapterNumber)}
					Endif

			 Else
					Debug-Output "NWSUBS.INF: Ipx NOT bound to a card with this name : "$(CardBaseName)
			 Endif


			 CloseRegKey $(KeyIpxParameters)
		Endif
	
					 ; Find the ODINSUPXX service name
					 ;

					 OpenRegKey $(!REG_H_LOCAL) "" $(NetworkCardsKeyName) $(MAXIMUM_ALLOWED) NetCardsKey

					 Ifstr(i) $(NetCardsKey) != ""
						 EnumRegKey $(NetCardsKey) NetCardsList
						 Debug-Output "NetCardsList = "$(NetCardsList)
						 ForListDo $(NetCardsList)
								Set CardNumber = *($($), 1)
								Debug-Output "CardNumber = "$(CardNumber)
								OpenRegKey $(NetCardsKey) "" $(CardNumber) $(MAXIMUM_ALLOWED) KeyCardNumber
								Ifstr(i) $(KeyCardNumber) != ""
							 GetRegValue $(KeyCardNumber), "ProductName", ProductNameList
							 Set ProductName = *($(ProductNameList), 4)
							 Debug-Output "ProductName = "$(ProductName)
							 Ifstr(i) $(ProductName) == "ODINSUP"
									GetRegValue $(KeyCardNumber), "ServiceName", ServiceNameList
									Set ServiceName = *($(ServiceNameList), 4)
									OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_ServiceBase)"\"$(ServiceName)"\Parameters" $(MAXIMUM_ALLOWED) KeyOdiNSupParameters
							 Endif
				 CloseRegKey $(KeyCardNumber)
								Endif
						 EndForListDo
			 CloseRegKey $(NetCardsKey)
					 Endif
		;
		; Check to see if ODINSUP was bound too this card.
		;
;                                        OpenRegKey $(!REG_H_LOCAL) "" $(OdiNSupParameters) $(MAXIMUM_ALLOWED) KeyOdiNSupParameters

		Ifstr(i) $(KeyOdiNSupParameters) != ""
			 GetRegValue $(KeyOdiNSupParameters) $(OdiNSupCardName) TmpCardList
			 Set CurOdiNSupCardName = *($(TmpCardList), 4)
			 Debug-Output "NWSUBS.INF: CurOdiNSupCardName = "$(CurOdiNSupCardName)

			 GetRegValue $(KeyOdiNSupParameters) $(OdiNSupCardInstance) TmpInstanceList
			 Set CurOdiNSupCardInstance = *($(TmpInstanceList), 4)
			 Debug-Output "NWSUBS.INF: CurOdiNSupCardInstance = "$(CurOdiNSupCardInstance)


;                                                Get the base name of the ODI Module being removed.
;
			 Split-String $(CardInstanceName) " " CardInstanceValues
			 Set CardBaseName = *($(CardInstanceValues), 1)
			 Debug-Output "NWSUBS.INF: CardBaseName = "$(CardBaseName)

			 Ifstr(i) $(CardBaseName) == $(CurOdiNSupCardName)
					Debug-Output "NWSUBS.INF: ODINSUP bound to a card with the same name: "$(CardBaseName)

			Ifint $(DeletedCardInstance) < $(CurOdiNSupCardInstance)
				 Debug-Output "NWSUBS.INF: Existing Board Instance Okay"
			Else-Ifint $(DeletedCardInstance) == $(CurOdiNSupCardInstance)
				 Debug-Output "NWSUBS.INF: The board ODINSUP was bound to has been removed."
								Shell $(NwSubsInf) GetOdiAdapterList

									 Set OdiTitleList               = $($R0)
								Set OdiCardList          = $($R1)
				 Set OdiNtNumberList    = $($R2)
				 Set NumberOdiAdapters = $($R3)

								Debug-Output "NWSUBS.INF: OdiTitleList = "$(OdiTitleList)
								Debug-Output "NWSUBS.INF: OdiCardList	= "$(OdiCardList)
									 Debug-Output "NWSUBS.INF: R2				= "$($R2)
									 Debug-Output "NWSUBS.INF: NumberOdiAdapters = "$(NumberOdiAdapters)

				 Set CardInstance = $(DeletedCardInstance)

				 Set ReBind = FALSE

				 Ifint $(NumberOdiAdapters) < 1
						Debug-Output "NWSUBS.INF: No ODI Adapters Installed."
				 Else-Ifint $(NumberOdiAdapters) == 1
						Set CardToBindTo = *($(OdiCardList), 1)
						Set CardInstance = 1
						Debug-Output "NWSUBS.INF: Only one ODI Adapter Installed "$(CardToBindTo)
				Set ReBind = TRUE;
				 Else
						;
						; More than one ODI adapter is installed so allow
						; the user to select which one to bind to.
						;
					
						Shell "" GetLanguageDir
						Set NLSDirName = $($R0)

						Shell "" GetNTVersion
						Set NTMajorVersion = $($R0)

						LoadLibrary $(LoadDisk3Text) $(!STF_WINDOWSSYSPATH)"\nwsetup.dll" NwLibHandle
						SetHelpFile $(!STF_WINDOWSSYSPATH)"\nls\"$(NLSDirName)"\setupnw.hlp" $(!MinimumID) $(!MaximumID)
			
						Ifstr(i) $(OdiCurBindCardName) != ""
							Debug-Output "NWSUBS.INF: OdiCurBindCardName = "$(OdiCurBindCardName)
							Set DefaultOdiTitle = *($(OdiTitleList), ~($(OdiCardList), $(OdiCurBindCardName)))
						Endif
			
						Ifstr(i) $(DefaultOdiTitle) == ""
							Set DefaultOdiTitle = *($(OdiTitleList), 1)
						Endif
			
						Debug-Output "NWSUBS.INF: DefaultOdiTitle = "$(DefaultOdiTitle)
			
						read-syms OdinsupDlg$(!STF_LANGUAGE)
						ui start "ODINSUP" $(NwLibHandle)
						ui pop 1
	
						ifstr(i) $(DLGEVENT) == "BACK"
							set AdapterSelected = ""
						else
							Set AdapterSelected = *($(DefaultOdiTitle), 1)
						endif

						Debug-Output "NWSUBS.INF: AdapterSelected = "$(AdapterSelected)

						Ifstr(i) $(AdapterSelected) == ""
							Debug-Output "NWSUBS.INF: Cancel Selected"
							Set CardToBindTo = *($(OdiCardList), 1)
							Set CardInstance = 1
						Else
							Set CardToBindTo = *($(OdiCardList), ~($(OdiTitleList), $(AdapterSelected)))
							Debug-Output "CardToBindTo = "$(CardToBindTo)

							Set NtAdapterNumber = *($(OdiNtNumberList), ~($(OdiTitleList), $(AdapterSelected)))
							Debug-Output "NtAdapterNumber = "$(NtAdapterNumber)

							Set NtAdapterKeyName = $(NetworkCardsKeyName)"\"$(NtAdapterNumber)
							OpenRegKey $(!REG_H_LOCAL) "" $(NtAdapterKeyName) $(MAXIMUM_ALLOWED) KeyNtAdapter
							Ifstr(i) $(KeyNtAdapter) != ""

								GetRegValue $(KeyNtAdapter),"ServiceName", ServiceNameList
								Set ServiceName = *($(ServiceNameList), 4)
								CloseRegKey $(KeyNtAdapter)
								 ; Open the lan man card's service\Parameters.
								 ;
							OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_ServiceBase)"\"$(ServiceName)"\Parameters" $(MAXIMUM_ALLOWED) KeyService
							ifstr(i) $(KeyService) == ""
			
								Debug-Output "NWSUBS.INF: RemoveAdapter, Can't open "$(ServiceName)
			
							Else
										; Get the OdiLoad link.
										;
								GetRegValue $(KeyService) $(OdiLinkName) CardInstanceList
								Set TmpCardInstanceName = *($(CardInstanceList), 4)
								CloseRegKey $(KeyService)
				
								OpenRegKey $(!REG_H_LOCAL) "" $(OdiModuleName)"\"$(TmpCardInstanceName) $(MAXIMUM_ALLOWED) KeyOdiCard
						 Ifstr(i) $(KeyOdiCard) != ""
								GetRegValue $(KeyOdiCard) "BoardInstance" BoardInstanceList
						Set CardInstance = *($(BoardInstanceList), 4)
						Debug-Output "Selected CardInstance = "$(CardInstance)
								CloseRegKey $(KeyOdiCard)
						 Endif


							Endif
					 Else
							Debug-Output "Can't open "$(NtAdapterKeyName)
					 Endif

				Endif
			
						FreeLibrary $(NwLibHandle)

				Set ReBind = TRUE
				 Endif

				 Ifstr(i) $(ReBind) == TRUE
									SetRegValue $(KeyOdiNSupParameters) {$(OdiNSupCardInstance),$(NoTitle),$(!REG_VT_DWORD),$(CardInstance)}
							 SetRegValue $(KeyOdiNSupParameters) {$(OdiNSupCardName),$(NoTitle),$(!REG_VT_SZ),$(CardToBindTo)}
				 Endif
					Else
						Set-sub CardInstance = $(DeletedCardInstance), 1
						Debug-Output "NWSUBS.INF: Need to change board instance "$(CardInstance)
						SetRegValue $(KeyOdiNSupParameters) {$(OdiNSupCardInstance),$(NoTitle),$(!REG_VT_DWORD),$(CardInstance)}
					Endif

			 Else
					Debug-Output "NWSUBS.INF: Ipx NOT bound to a card with this name : "$(CardBaseName)
			 Endif


			 CloseRegKey $(KeyOdiNSupParameters)

					 Endif

		FlushRegKey $(KeyOdiModules)
		CloseRegKey $(KeyOdiModules)
	
		 Endif
	Endif

	 Endif


Exit_RemoveAdapter = +
	 Debug-Output "NWSUBS.INF: ------------------------------------------------------"

	 return $(Result)

; ===================================================================================
;
; Add an Odi Load Module and set its Parameters.
;
; ===================================================================================

[NwAddOdiLoadModule]
	 read-syms NwBaseVars
	 read-syms IpxVars
	 read-syms OdiVars

	 Set CardInstanceName = $($0)
	 Set AdapterNumber       = $($1)
	 Set OdiParmList                = $($2)

	 Set Result = "NO_ERROR"

	 OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_ServiceBase)"\"$(DriverName) $(MAXIMUM_ALLOWED) KeyOdiLoad
	 Ifstr $(KeyOdiLoad) == $(KeyNull)
			set Result = CANNOT_FIND_COMPONENT_SERVICE
			Debug-Output "NWSUBS.INF: Cannot open service "$(DriverName)
			goto Exit_AddOdiLoadModule
	 Endif

	 Set KeyOdiCard = $(KeyNull)
	 Debug-Output "NWSUBS.INF: CardInstanceName = "$(CardInstanceName)

;
; Try to create Odi_Modules registry key.       If this fails try to open the key.
; If this fails exit.
;
	 CreateRegKey $(KeyOdiLoad) {$(OdiModules),$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" KeyOdiModules
	 Ifstr(i) $(KeyOdiModules) == $(KeyNull)
			OpenRegKey $(KeyOdiLoad) "" $(OdiModules) $(MAXIMUM_ALLOWED) KeyOdiModules
			Ifstr(i) $(KeyOdiLoad) == $(KeyNull)
				set Result = CANNOT_FIND_COMPONENT_SERVICE
				Debug-Output "Cannot find "$(DriverName)"\"$(OdiModules)
				CloseRegKey $(KeyOdiLoad)
				goto Exit_AddOdiLoadModule
			Endif
	 Endif

	 Ifstr(i) $(AdapterNumber) != ""
			;       This adapter was just installed; allow creation of the #nn key
			CreateRegKey $(KeyOdiModules) {$(CardInstanceName),$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" KeyOdiCard
	 Endif

	 Ifstr(i) $(KeyOdiCard) == $(KeyNull)
			;
			;       This is either an old card, or a prior version of the key existed.
			;
			OpenRegKey $(KeyOdiModules) "" $(CardInstanceName) $(MAXIMUM_ALLOWED) KeyOdiCard
			Ifstr(i) $(KeyOdiCard) == $(KeyNull)
				Set Result = CANNOT_FIND_COMPONENT_SERVICE
				Debug-Output "NWSUBS.INF: Can't Open "$(CardInstanceName)
				CloseRegKey $(KeyOdiLoad)
				CloseRegKey $(KeyOdiModules)
				goto Exit_AddOdiLoadModule
			Endif
	 Endif

	 SetRegValue $(KeyOdiCard) {"Parameters",$(NoTitle),$(!REG_VT_MULTI_SZ),$(OdiParmList)}

	 FlushRegKey $(KeyOdiCard)

;
; flush the Odi_Modules key so that the card we just added will show up in the enum
;

	 FlushRegKey $(KeyOdiModules)

	 FlushRegKey $(KeyOdiLoad)

	 Shell "" NwSetCardInstance $(KeyOdiLoad) $(KeyOdiModules) $(KeyOdiCard) $(CardInstanceName)

	 Set Result = $($R0)

	 CloseRegKey $(KeyOdiCard)

	 CloseRegKey $(KeyOdiModules)

	 FlushRegKey $(KeyOdiLoad)
	 CloseRegKey $(KeyOdiLoad)

	 Ifstr(i) $(Result) != NO_ERROR
			Debug-Output "NWSUBS.INF: SetCardInstance "$(Result)
			goto Exit_AddOdiLoadModule
	 Endif

	 Set OdiCardInstance = $($R1)

	 Debug-Output "OdiCardInstance = "$(OdiCardInstance)

;
; Update the card name and card instance in IpxSpx to be the last card installed
;
;        Shell "" NwSetIpxCard $(CardInstanceName) $(OdiCardInstance)
;
;        Set Result = $($R0)
;        Ifstr(i) $(Result) != NO_ERROR
;                       Debug-Output "NWSUBS.INF: NwSetIpxCard "$(Result)
;                       goto Exit_AddOdiLoadModule
;        Endif

Exit_AddOdiLoadModule = +

	 return $(Result)
;
; Remove the Nt Adapter Info.
;
;

[NwRemoveNtAdapter]
	 read-syms NwBaseVars
	 read-syms IpxVars
	 read-syms OdiVars

	 Set ProductKeyName = $($0)
	 Set Manufacturer       = $($1)
	 Set NetCardName         = $($2)

	 Ifstr(i) $(NetCardName) == ""
			set NetCardName = $(!NTN_RegBase)
	 Endif

	 Debug-Output "NWSUBS.INF: NwRemoveNtAdapter, NTN_RegBase = "$(!NTN_RegBase)
	 Debug-Output "NWSUBS.INF: ProductKeyName = "$(ProductKeyName)
	 Debug-Output "NWSUBS.INF: Manufacturer = "$(Manufacturer)
	 Debug-Output "NWSUBS.INF: NetCardName = "$(NetCardName)

; ===================================================================================
;
; Increment the OdiLoad reference count so OdiLoad is not removed as a
; service.
;
; ===================================================================================

	 Shell $(UtilityInf), IncrementRefCount, $(ProductKeyName) $(Manufacturer)
	 Ifint $($ShellCode) != $(!SHELL_CODE_OK)
			Debug-Output "NWSUBS.INF: IncrementRefCount ShellCode error "$($ShellCode)
			Set Result = "SHELL_CODE_ERROR"
			goto Exit_RemoveNtAdapter
	 Endif

	 set Result = $($R0)

;        Ifstr(i) $(Result) != NO_ERROR
;                       Debug-Output "NWSUBS.INF: IncrementRefCount "$(ProductKeyName)": "$(Result)
;                       goto Exit_RemoveNtAdapter
;        Endif

	 Shell $(UtilityInf), RemoveHardwareComponent, $(Manufacturer), +
				$(DriverName), $(NetCardName)
	 ifint $($ShellCode) != $(!SHELL_CODE_OK)
			Debug-Output "NWSUBS.INF: RemoveHardwareComponent ShellCode error "$($ShellCode)
			Set Result = "SHELL_CODE_ERROR"
			goto Exit_RemoveNtAdapter
	 endif

	 set Result = $($R0)

	 Ifstr(i) $(Result) != NO_ERROR
			Debug-Output "NWSUBS.INF: RemoveHardwareComponent "$(Result)
	Shell "" ReallyRemoveHardwareComponent $(Manufacturer), +
			 $(DriverName), $(!NTN_RegBase)
	 endif

; Decrement the reference count so OdiLoad can be removed when all the
; ODI adapters have been removed.
;
	 Shell $(UtilityInf), DecrementRefCount, $(ProductKeyName)
	 Ifint $($ShellCode) != $(!SHELL_CODE_OK)
			Debug-Output "NWSUBS.INF: DecrementRefCount ShellCode error "$($ShellCode)
			Set Result = "SHELL_CODE_ERROR"
			goto Exit_RemoveNtAdapter
	 Endif

	 set Result = $($R0)

;        Ifstr(i) $(Result) != NO_ERROR
;                       Debug-Output "NWSUBS.INF: DecrementRefCount "$(Result)
;                       goto Exit_RemoveNtAdapter
;        Endif

Exit_RemoveNtAdapter = +

	 return $(Result)
;
; Select the card Ipx is bound to.
;
;

[NwSelectIpxCard]
	Set OdiCardName = $($0)
	Set OdiCardInstance = $($1)
	Set AlwaysPromptUser = $($2)

	Debug-Output "OdiCardName			"$(OdiCardName)
	Debug-Output "OdiCardInstance	 "$(OdiCardInstance)
	Debug-Output "AlwaysPromptUser	"$(AlwaysPromptUser)

	read-syms NwBaseVars
	read-syms IpxVars
	read-syms OdiVars
	read-syms OdiNSupVars
	read-syms InstallOption$(!STF_LANGUAGE)

	Set Result = NO_ERROR

	Shell $(NwSubsInf) GetOdiAdapterList

	Set OdiTitleList                = $($R0)
	Set OdiCardList          = $($R1)
	Set OdiNtNumberList     = $($R2)
	Set NumberOdiAdapters = $($R3)

	Set DoDialog = FALSE;
	Ifint $(NumberOdiAdapters) > 1
		Set DoDialog = TRUE
	Endif
	Ifstr(i) $(AlwaysPromptUser) == TRUE
		Set DoDialog = TRUE
	Endif

	Ifstr(i) $(DoDialog) == TRUE
		;
		; More than one ODI adapter is installed so allow
		; the user to select which one to bind to.
		;

		Shell "" GetLanguageDir
		Set NLSDirName = $($R0)
		
		Shell "" GetNTVersion
		Set NTMajorVersion = $($R0)

		LoadLibrary $(LoadDisk3Text) $(!STF_WINDOWSSYSPATH)"\nwsetup.dll" NwLibHandle
		SetHelpFile $(!STF_WINDOWSSYSPATH)"\nls\"$(NLSDirName)"\setupnw.hlp" $(!MinimumID) $(!MaximumID)

		Ifstr(i) $(OdiCardName) == ""
			OpenRegKey $(!REG_H_LOCAL) "" $(IpxParameters) $(MAXIMUM_ALLOWED) KeyIpxParameters
			Ifstr(i) $(KeyIpxParameters) != ""
				GetRegValue $(KeyIpxParameters) $(IpxCardName) TmpCardList
				Set OdiCardName = *($(TmpCardList), 4)
				GetRegValue $(KeyIpxParameters) $(IpxCardInstance) TmpInstanceList
				Set OdiCardInstance = *($(TmpInstanceList), 4)
				GetRegValue $(KeyIpxParameters) $(IpxNtCardInstance) TmpNtInstanceList
				Set NtAdapterNumber = *($(TmpNtInstanceList), 4)
				Debug-Output "Ipx Currently bound too "$(OdiCardName)
				Debug-Output "								"$(OdiCardInstance)
				Debug-Output "Nt Card Instance			"$(NtAdapterNumber)
				Debug-Output $(OdiTitleList)
				Debug-Output $(OdiCardList)
				Debug-Output $(OdiNtNumberList)
				CloseRegKey $(KeyIpxParameters)
			Endif
		Endif
	
		Ifstr(i) $(NtAdapterNumber) != ""
			Set DefaultOdiTitle = *($(OdiTitleList), ~($(OdiNtNumberList), $(NtAdapterNumber)))
		Endif
	
		Ifstr(i) $(DefaultOdiTitle) == ""
			 Set DefaultOdiTitle = *($(OdiTitleList), 1)
		Endif
	
		Debug-Output "NWSUBS.INF: NwSelectIpxCard DefaultOdiTitle = "$(DefaultOdiTitle)
	
		read-syms IPXBindDlg$(!STF_LANGUAGE)
		ui start "IPXBIND" $(NwLibHandle)
		ui pop 1
		
		ifstr(i) $(DLGEVENT) == "BACK"
			set AdapterSelected = ""
		else
			Set AdapterSelected = *($(DefaultOdiTitle), 1)
		endif
	
		Debug-Output "NWSUBS.INF: AdapterSelected = "$(AdapterSelected)
	
		Ifstr(i) $(AdapterSelected) == ""
			Debug-Output "NWSUBS.INF: Cancel Selected"
			Set CardToBindTo = *($(OdiCardList), 1)
			Set CardInstance = 1
		Else
			Set CardToBindTo = *($(OdiCardList), ~($(OdiTitleList), $(AdapterSelected)))
			Debug-Output "CardToBindTo = "$(CardToBindTo)
	
			Set NtAdapterNumber = *($(OdiNtNumberList), ~($(OdiTitleList), $(AdapterSelected)))
			Debug-Output "3: NtAdapterNumber = "$(NtAdapterNumber)
	
			Set NtAdapterKeyName = $(NetworkCardsKeyName)"\"$(NtAdapterNumber)
			OpenRegKey $(!REG_H_LOCAL) "" $(NtAdapterKeyName) $(MAXIMUM_ALLOWED) KeyNtAdapter
			Ifstr(i) $(KeyNtAdapter) != ""
				GetRegValue $(KeyNtAdapter),"ServiceName", ServiceNameList
				Set ServiceName = *($(ServiceNameList), 4)
				CloseRegKey $(KeyNtAdapter)
	
	
				; Open the lan man card's service\Parameters.
				;
				OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_ServiceBase)"\"$(ServiceName)"\Parameters" $(MAXIMUM_ALLOWED) KeyService
				Ifstr(i) $(KeyService) == ""
	
					Debug-Output "NWSUBS.INF: NwSelectIpxCard, Can't open "$(ServiceName)
	
				Else
					; Get the OdiLoad link.
					;
					GetRegValue $(KeyService) $(OdiLinkName) CardInstanceList
					Set CardInstanceName = *($(CardInstanceList), 4)
					CloseRegKey $(KeyService)
		
					OpenRegKey $(!REG_H_LOCAL) "" $(OdiModuleName)"\"$(CardInstanceName) $(MAXIMUM_ALLOWED) KeyOdiCard
					Ifstr(i) $(KeyOdiCard) != ""
						GetRegValue $(KeyOdiCard) "BoardInstance" BoardInstanceList
						Set CardInstance = *($(BoardInstanceList), 4)
						Debug-Output "3: Selected CardInstance = "$(CardInstance)
						CloseRegKey $(KeyOdiCard)
					Endif
	
				Endif
			Else
				Debug-Output "Can't open "$(NtAdapterKeyName)
			Endif
	
		Endif

	Else
		Debug-Output "SelectIpxCard OdiCardList = "$(OdiCardList)

		Split-String $(OdiCardName) " " CardNameParts
		Set CardToBindTo = *($(CardNameParts),1)
	Endif

	OpenRegKey $(!REG_H_LOCAL) "" $(IpxParameters) $(MAXIMUM_ALLOWED) KeyIpxParameters
	Ifstr(i) $(KeyIpxParameters) == ""
		Set Result = "Can't open IpxSpx service."
		Debug-Output "NWSUBS.INF: "$(Result)
	Else
		SetRegValue $(KeyIpxParameters) {$(IpxCardName),$(NoTitle),$(!REG_VT_SZ),$(CardToBindTo)}
		Ifstr(i) $(OdiCardInstance) == ""
			Debug-Output "NWSUBS.INF: NwSelectIpxCard, OdiCardInstance set to default."
			Set OdiCardInstance = "1"
		Endif
		SetRegValue $(KeyIpxParameters) {$(IpxCardInstance),$(NoTitle),$(!REG_VT_DWORD),$(OdiCardInstance)}
		SetRegValue $(KeyIpxParameters) {$(IpxNtCardInstance),$(NoTitle),$(!REG_VT_SZ),$(NtAdapterNumber)}
		Shell "" NwSetFrameType $(CardToBindTo) $(NtAdapterNumber) $(NwLibHandle)

		Set GUIResult = $($R0)
		Ifstr(i) $(GUIResult) != ""
			SetRegValue $(KeyIpxParameters) {"FrameType",$(NoTitle),$(!REG_VT_SZ),$(GUIResult)}
		Endif
		CloseRegKey $(KeyIpxParameters)
	Endif

	return $(Result)

[ReallyRemoveHardwareComponent]
	 read-syms NwBaseVars
	 Set Result = "NO_ERROR"

	 Set Manufacturer = $($0)
	 Set DriverName = $($1)
	 Set AdapterName        = $($2)
	 set DriverKey  = $(!NTN_SoftwareBase)"\"$(Manufacturer)"\"$(DriverName)"\CurrentVersion"

	 Split-String $(AdapterName), "\", AdapterPathList

	 Set AdapterNumber = *($(AdapterPathList),11)
	 Set NetCardsBase       = *($(AdapterPathList),1)*($(AdapterPathList),2)*($(AdapterPathList),3)*($(AdapterPathList),4)*($(AdapterPathList),5)*($(AdapterPathList),6)*($(AdapterPathList),7)*($(AdapterPathList),8)*($(AdapterPathList),9)

	 OpenRegKey $(!REG_H_LOCAL) "" $(NetCardsBase) $(MAXIMUM_ALLOWED) NetCardsKey
	 Ifstr $(NetCardsKey) == ""
		 Set Result = "Can't Open "$(NetCardsBase)
		 Debug-Output "NWSUBS.INF: "$(Result)
		 goto ReallyRemoveHardwareComponent_Return
	 Endif

	 OpenRegKey $(NetCardsKey) "" $(AdapterNumber) $(MAXIMUM_ALLOWED) AdapterNumberKey
	 Ifstr $(AdapterNumberKey) == ""
		 Set Result = "Can't Open "$(AdapterNumber)
		 Debug-Output "NWSUBS.INF: "$(Result)
		 goto ReallyRemoveHardwareComponent_Return
	 endif

	 GetRegValue $(AdapterNumberKey),"ServiceName", ServiceNameList
	 Set ServiceName = *($(ServiceNameList), 4)

	 CloseRegKey $(AdapterNumberKey)
	 DeleteRegTree $(NetCardKey) $(AdapterNumber)
	 CloseRegKey $(NetCardsKey)
	 Shell $(UtilityInf), RemoveService, $(ServiceName), "NO"
	 debug-output "remove netbios information..."
	 LibraryProcedure Result, $(!NCPA_HANDLE), RemoveRouteFromNETBIOS, $(ServiceName)

ReallyRemoveHardwareComponent_Return = +
	 return $(Result)

[ProgressCopyENG]
	 !p:ProCaption  = "NetWare for Windows NT Setup"
	 !p:ProCancel    = "Cancel"
	 !p:ProCancelMsg = "NetWare for Windows NT is not correctly installed.	Are you sure you want "+
							 "to cancel copying files?"
	 !p:ProCancelCap = "Setup Message"
	 !p:ProText1            = "Copying:"
	 !p:ProText2            = "To:"
	 !p:Error                       = "Unable to determine proper source disk location; copy cannot be performed."

[DoAskSource]
	read-syms DoAskSource$(!STF_LANGUAGE)

	Set DAS_CWDDIR          = $($0)
	Set DAS_SRCDIR          = $($1)
	Set DAS_BUILTIN = $($2)
	Set DAS_Result          = STATUS_FAILED
	Ifstr(i) $(!STF_SRCDIR_OVERRIDE) != ""
		Set DAS_SRCDIR = $(!STF_SRCDIR_OVERRIDE)
		Set DAS_Result = STATUS_SUCCESSFUL
		Goto DAS_exit
	Endif
	Ifstr(i) $(DAS_BUILTIN) == YES
		Ifstr(i) $(!NTN_InstallPhase) == primary
			Ifstr(i) $(!STF_SRCDIR_WINNT) != ""
				Set DAS_SRCDIR = $(!STF_SRCDIR_WINNT)
			Endif
			Set DAS_Result = STATUS_SUCCESSFUL
			Goto DAS_exit
		Endif
	Endif
	Debug-Output "NWSUBS.INF: [DoAskSource] STF_CWDDIR = "$(DAS_CWDDIR)" STF_SRCDIR = "$(DAS_SRCDIR)
	Ifstr(i) $(DAS_SRCDIR) == ""
		Set DAS_SRCDIR = "A:\"
	Endif
	Ifstr(i) $(DAS_SRCDIR) == $(!STF_SRCDIR_USED)
		Set DAS_SRCDIR = $(!STF_SRCDIR_KEYED)
	Endif
	Shell "subroutn.inf" DoAskSourceEx $(DAS_SRCDIR) $(NetWareDlgText)
	ifint $($ShellCode) != $(!SHELL_CODE_OK)
		Debug-Output "UTILITY.INF: shelling SUBROUTN.INF [DoAskSource] failed"
		goto DAS_exit
	endif
	Set DAS_Result = $($R0)
	Set DAS_SRCDIR = $($R1)
	Set !STF_SRCDIR_USED = $($R1)
	Set !STF_SRCDIR_KEYED = $($R3)
DAS_exit =+
	Read-syms ProgressCopy$(!STF_LANGUAGE)
	Return $(DAS_Result) $(DAS_SRCDIR)

[DoAskLANSource]
	read-syms DoAskSource$(!STF_LANGUAGE)

	Set DAS_CWDDIR  = $($0)
	Set DAS_SRCDIR  = $($1)

	Debug-Output "DAS_CWDDIR = "$(DAS_CWDDIR)
	Debug-Output "DAS_SRCDIR = "$(DAS_SRCDIR)
	Debug-Output "STF_SRCDIR_USED = "$(!STF_SRCDIR_USED)
	Debug-Output "STF_SRCDIR_KEYED = "$(!STF_SRCDIR_KEYED)

	Set DAS_BUILTIN = $($2)
	Set DAS_Result  = STATUS_FAILED
	Debug-Output "NWSUBS.INF: [DoAskLANSource] STF_CWDDIR = "$(DAS_CWDDIR)" STF_SRCDIR = "$(DAS_SRCDIR)
	Ifstr(i) $(DAS_SRCDIR) == ""
		Set DAS_SRCDIR = "A:\"
	Endif
	Ifstr(i) $(DAS_SRCDIR) == $(!STF_SRCDIR_USED)
		Set DAS_SRCDIR = $(!STF_SRCDIR_KEYED)
	Endif
	Shell "subroutn.inf" DoAskSourceEx $(DAS_SRCDIR) $(NetWareLANDlgText)
	ifint $($ShellCode) != $(!SHELL_CODE_OK)
		Debug-Output "UTILITY.INF: shelling SUBROUTN.INF [DoAskLANSource] failed"
		goto DAS_exit
	endif
	Set DAS_Result = $($R0)
	Set DAS_SRCDIR = $($R1)
	Set !STF_SRCDIR_USED = $($R1)
	Set !STF_SRCDIR_KEYED = $($R3)
DAS_exit =+
	Read-syms ProgressCopy$(!STF_LANGUAGE)
	Return $(DAS_Result) $(DAS_SRCDIR)

; ===========================================================================
; NwSetFrameType
;       Set the frame type for a loaded ODI adapter from the list of frames loaded
;       by OdiLoad.
;
; INPUT:
;        $($0) Base name of card to set to frame type for (ie NE2000).
;        $($1) NT card instance (ie 01).
;        $($2) Open handle to nwsubs or "" and I'll open it.
;
; OUTPUT:
;        $($R0) Frame Selected or ""
;
; ===========================================================================

[NwSetFrameType]
	read-syms NwBaseVars
	read-syms IpxVars
	read-syms OdiVars
	read-syms OdiNSupVars
	read-syms InstallOption$(!STF_LANGUAGE)

	Set CardToBindTo         = $($0)
	Set NtAdapterNumber = $($1)
	Set NwLibHandle         = $($2)

	Set CloseLibrary = FALSE

	Ifstr(i) $(NwLibHandle) == ""

		Shell "" GetLanguageDir
		Set NLSDirName = $($R0)
		
		Shell "" GetNTVersion
		Set NTMajorVersion = $($R0)

		LoadLibrary $(LoadDisk3Text) $(!STF_WINDOWSSYSPATH)"\nwsetup.dll" NwLibHandle
		SetHelpFile $(!STF_WINDOWSSYSPATH)"\nls\"$(NLSDirName)"\setupnw.hlp" $(!MinimumID) $(!MaximumID)
		Set CloseLibrary = TRUE
	Endif

	Debug-Output "CardToBindTo = "$(CardToBindTo)
	Set-add TempAdapterNumber = $(NtAdapterNumber),0
	Set OdiLoadModuleName = $(CardToBindTo)" #"$(TempAdapterNumber)
	Debug-Output "OdiLoadModuleName = "$(OdiLoadModuleName)

	; Set the frame type
	;
	Set OdiParmList = {}

	OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_ServiceBase)"\OdiLoad\ODI_Modules\"$(OdiLoadModuleName) $(MAXIMUM_ALLOWED) KeyOdiModule
	Ifstr(i) $(KeyOdiModule) != ""
		GetRegValue $(KeyOdiModule), "Parameters", OdiParmInfo
		Set OdiParmList = *($(OdiParmInfo), 4)
		Debug-Output "OdiParmList = "$(OdiParmList)
		CloseRegKey $(KeyOdiModule)
	 Endif

	Set FrameList = "AUTO DETECT"
	set ProtocolID = ""
	set FrameListDefault = ""

	ForListDo $(OdiParmList)
		Set Item = $($)
		Split-String $(Item) " " ParmParts
		Set ParmName = *($(ParmParts), 1)
		Ifstr(i) $(ParmName) == "Frame"
			Set ParmData = *($(ParmParts), 3)
			ifstr $(FrameList) == ""
				Set FrameList = {$(ParmData)}
			else
				Set FrameList = >($(FrameList), $(ParmData))
			endif
		Endif
	EndForListDo

	set StandardFrameList = $(FrameList)

	OpenRegKey $(!REG_H_LOCAL) "" $(IpxParameters) $(MAXIMUM_ALLOWED) KeyIpxParameters
	Ifstr(i) $(KeyIpxParameters) != ""
		set CloseIPX = TRUE
		set ParameterList = {}
		GetRegValue $(KeyIpxParameters) "Protocol Id" ParameterList
		ifstr *($(ParameterList), 4) != ""
			set ProtocolID = *($(ParameterList), 4)
			set ParameterList = {}
			GetRegValue $(KeyIpxParameters) "Frame Type" ParameterList
			set FrameList = >($(FrameList), *($(ParameterList), 4))
			set NewFrameTypeName = *($(ParameterList), 4)
			set FrameListDefault = *($(ParameterList), 4)
		endif
	endif

	set FrameList = >($(FrameList), "Other Non-Standard Frame Type")

	Debug-Output "FrameList "$(FrameList)

	ifstr $(FrameListDefault) == ""
		Set FrameListDefault = *($(FrameList), 1)
	endif

	Debug-Output "FrameListDefault = "$(FrameListDefault)

dotheframedlg =+
	read-syms IPXDlg$(!STF_LANGUAGE)
	ui start "Framelist" $(NwLibHandle)


	ifstr(i) $(DLGEVENT) == "CONTINUE"
		set GUIResult = *($(ComboOut), 1)
		Debug-Output "OK hit"
		ifcontains(i) $(GUIResult) IN $(StandardFrameList)
			DeleteRegValue $(KeyIpxParameters) "Protocol Id"
		else-ifstr(i) $(GUIResult) == "Other Non-Standard Frame Type"
			read-syms NewFrameTypeDlg$(!STF_LANGUAGE)
			ui start "NewFrameType" $(NwLibHandle)
			ui pop 1
			ifstr(i) $(DLGEVENT) == "CONTINUE"
				Debug-Output "OK hit"
				set GUIResult = *($(EditTextOut), 1)
				set ProtocolID = *($(EditTextOut), 2)
				set KeyValueList = {"Protocol Id",$(NoTitle),$(!REG_VT_DWORD),$(ProtocolID)}
				SetRegValue $(KeyIpxParameters) $(KeyValueList)
			else-ifstr(i) $(DLGEVENT) == "BACK"
				Debug-Output "Action: CANCEL"
				goto dotheframedlg
			endif
		endif
	else-ifstr(i) $(DLGEVENT) == "BACK"
		;
		; if you hit DEFAULT, you get the default frame which is the first item in the list
		;
		set GUIResult = *($(StandardFrameList), 1)
		DeleteRegValue $(KeyIpxParameters) "Protocol Id"
	endif
	ui pop 1

	Ifstr(i) $(CloseIPX) == TRUE
		CloseRegKey $(KeyIpxParameters)
	Endif

	Ifstr(i) $(CloseLibrary) == TRUE
		 FreeLibrary $(NwLibHandle)
	Endif

	Debug-Output "Returning GUIResult = "$(GUIResult)
	Return $(GUIResult)

; ===========================================================================
; NwGetNICBusInfo
;       Get Information about the BUS.  If there is only one BUS present then
;       the information will be returned without any user intervention.  If there
;       are more than one BUS, the user will need to select the BUS where the NIC
;       will be installed.
;
; INPUT:
;        $($0) Network Card Adapter Registry Name (Card type and instance i.e. NE2000)
;        $($1) Bus Interface Type
;        $($2) Bus Number
;
; OUTPUT:
;        $($R0) Return Status
;        $($R1) BusNumber
;        $($R2) BusTypeName
;        $($R3) BusInterfaceType (ID)
;
; ===========================================================================

[NwGetNICBusInfo]
	
	set CardInstanceName = $($0)
	set BusInterfaceType = $($1)
	set BusNumber = $($2)
	set BusTypeName = ""

	Shell "UTILITY.INF", GetBusTypeDialog, $(CardInstanceName), $(BusInterfaceType), $(BusNumber)

	ifint $($ShellCode) != $(!SHELL_CODE_OK)
		Debug-Output "OEMNADNH.INF: GetBusTypeDialog ShellCode error "$($ShellCode)
		goto NwGetNICBusInfoERROR
	else

		set BusInterfaceType = $($R1)
		set BusNumber = $($R2)

		;This next section should be redone as a list and internationalized
		;==================================================================
		ifint $(BusInterfaceType) == 0
			set BusTypeName = "Internal"
		else-ifint $(BusInterfaceType) == 1
			set BusTypeName = "ISA"
		else-ifint $(BusInterfaceType) == 2
			set BusTypeName = "EISA"
		else-ifint $(BusInterfaceType) == 3
			set BusTypeName = "MicroChannel"
		else-ifint $(BusInterfaceType) == 4
			set BusTypeName = "TurboChannel"
		else-ifint $(BusInterfaceType) == 5
			set BusTypeName = "PCIBus"
		else-ifint $(BusInterfaceType) == 6
			set BusTypeName = "VMEBus"
		else-ifint $(BusInterfaceType) == 7
			set BusTypeName = "NuBus"
		else-ifint $(BusInterfaceType) == 8
			set BusTypeName = "PCMCIABus"
		else-ifint $(BusInterfaceType) == 9
			set BusTypeName = "CBus"
		else-ifint $(BusInterfaceType) == 10
			set BusTypeName = "MPIBus"
		else-ifint $(BusInterfaceType) == 11
			set BusTypeName = "MPSABus"
		else
			set BusTypeName = "***ERROR:Illegal Bus Type***"
		endif
	endif


NwGetNICBusInfoERROR = +
	
	Return $(ShellCode) $(BusNumber) $(BusTypeName) $(BusInterfaceType)

;
;
; ===================================================================================
;
;                                                GetTotalAdapterList
; ===================================================================================
;
; Section to create a list of all installed ODI and NDIS adapters.      Used by OEMSETUP bindings.
;
; INPUT:
;        NONE
;
; OUTPUT:
;        $($R0) List of installed ODI adapter names.
;        $($R1) List of installed ODI adapter titles.
;        $($R2) List of installed ODI adapter card numbers.
;        $($R3) Number of installed ODI adapters.
;        $($R4) List of installed NDIS adapter names.
;        $($R5) List of installed NDIS adapter titles.
;        $($R6) List of installed NDIS adapter card numbers.
;        $($R7) Number of installed NDIS adapters.
;   $($R8)  Adapter card number of ODINSUP or "" if not loaded
;
; ===================================================================================

[GetTotalAdapterList]
;
; In this section we will create a list of all installed adapters.
;
	read-syms NwBaseVars
	read-syms OdiVars

	Debug-Output " "
	Debug-Output "NWSUBS.INF:  Entering function GetTotalAdapterList"
	Debug-Output " "

	Set OdiCardNumList                              = {}
	Set OdiTitleList                                        = {}
	Set OdiCardList                                 = {}
	Set NdisCardNumList                             = {}
	Set NdisTitleList                                       = {}
	Set NdisCardList                                        = {}
	Set NumberNdisAdapters                  = 0
	Set ODINSUPCardNumber                   = ""
	Set NetWareIPCardNumList                = {}
	Set NWCMDCardNumList                    = {}
	Set IsHidden                                            = ""
	set OdiAdapter                                          = ""
	Set NumberOdiAdapters                   = 0
	Set NumberNetWareIPAdapters             = 0
	Set NumberNWCMDAdapters                 = 0


	OpenRegKey $(!REG_H_LOCAL) "" $(NetworkCardsKeyName) $(MAXIMUM_ALLOWED) NetCardsKey

	Ifstr(i) $(NetCardsKey) == ""
		Debug-Output "NWSUBS.INF: Can't Open Registry key "$(NetworkCardsKeyName)
		set CommonStatus = STATUS_USERCANCEL
	Else

		FlushRegKey $(NetCardsKey)
;
;               Get a list of all installed network cards
;
		EnumRegKey $(NetCardsKey) NetCardsList

		ForListDo $(NetCardsList)
			Set CardNumber = *($($), 1)

			OpenRegKey $(NetCardsKey) "" $(CardNumber) $(MAXIMUM_ALLOWED) CardKey
			Ifstr(i) $(CardKey) == ""
				Debug-Output "NWSUBS.INF: Can't open adapter "$(Card)
			Else
				GetRegValue $(CardKey) "Title" TitleValues
				Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
					Set CardTitle = *($(TitleValues), 4)
				Else
					Set CardTitle = ""
				Endif

				GetRegValue $(CardKey) "ProductName" NameValues
				Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
					Set CardName = *($(NameValues), 4)
				Else
					Set CardName = ""
				Endif

				GetRegValue $(CardKey) "Hidden" HiddenValues
				Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
					Set IsHidden = *($(HiddenValues), 4)
				Else
					Set IsHidden = ""
				Endif

				GetRegValue $(CardKey) "OdiAdapter" OdiValueList
				Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
					set OdiAdapter = *($(OdiValueList), 4)
				Else
					set OdiAdapter = ""
				Endif

				Ifstr(i) $(OdiAdapter) == "1"

					;
					; Must be an ODI Adapter so add it to our lists.
					;

					Set-add NumberOdiAdapters = $(NumberOdiAdapters), 1
					Set OdiCardNumList = >($(OdiCardNumList), $(CardNumber))
					Set OdiTitleList = >($(OdiTitleList), $(CardTitle))
					Set OdiCardList = >($(OdiCardList), $(CardName))

				Else-Ifstr(i) $(CardName) == "ODINSUP"
					Set ODINSUPCardNumber = $(CardNumber)

				Else-Ifstr(i) $(CardName) == "NetWareIP"
					Set-add NumberNetWareIPAdapters = $(NumberNetWareIPAdapters), 1
					Set NetWareIPCardNumList = >($(NetWareIPCardNumList), $(CardNumber))

				Else-Ifstr(i) $(CardName) == "NWCMD"
					Set-add NumberNWCMDAdapters = $(NumberNWCMDAdapters), 1
					Set NWCMDCardNumList = >($(NWCMDCardNumList), $(CardNumber))

				Else

					;
					;       Must be an NDIS Adapter so add it to our lists if it isn't hidden
					;

					Ifstr(i) $(IsHidden) != "1"
						Set-add NumberNdisAdapters = $(NumberNdisAdapters), 1
						Set NdisCardNumList = >($(NdisCardNumList), $(CardNumber))
						Set NdisTitleList = >($(NdisTitleList), $(CardTitle))
						Set NdisCardList = >($(NdisCardList), $(CardName))
					Endif
				Endif

			CloseRegKey $(CardKey)
			Endif
		EndForListDo

		Debug-Output "NWSUBS.INF: OdiCardList					= "$(OdiCardList)
		Debug-Output "NWSUBS.INF: OdiTitleList					= "$(OdiTitleList)
		Debug-Output "NWSUBS.INF: OdiCardNumList				= "$(OdiCardNumList)
		Debug-Output "NWSUBS.INF: NumberOdiAdapters			= "$(NumberOdiAdapters)
		Debug-Output "NWSUBS.INF: NdisCardList					= "$(NdisCardList)
		Debug-Output "NWSUBS.INF: NdisTitleList				= "$(NdisTitleList)
		Debug-Output "NWSUBS.INF: NdisCardNumList				= "$(NdisCardNumList)
		Debug-Output "NWSUBS.INF: NumberNdisAdapters			= "$(NumberNdisAdapters)
		Debug-Output "NWSUBS.INF: ODINSUP card number		= "$(ODINSUPCardNumber)
		Debug-Output "NWSUBS.INF: NetWareIP card number		= "$(NetWareIPCardNumList)
		Debug-Output "NWSUBS.INF: NumberNetWareIPAdapters	= "$(NumberNetWareIPAdapters)
		Debug-Output "NWSUBS.INF: NWCMD card number			= "$(NWCMDCardNumList)
		Debug-Output "NWSUBS.INF: NumberNWCMDAdapters		= "$(NumberNWCMDAdapters)

		CloseRegKey $(NetCardsKey)
	Endif

	Debug-Output " "
	Debug-Output "NWSUBS.INF:  Exiting function GetTotalAdapterList"
	Debug-Output " "

	return $(OdiCardList) $(OdiTitleList) $(OdiCardNumList) $(NumberOdiAdapters) $(NdisCardList) $(NdisTitleList) $(NdisCardNumList) $(NumberNdisAdapters) $(ODINSUPCardNumber) $(NetWareIPCardNumList) $(NumberNetWareIPAdapters) $(NWCMDCardNumList) $(NumberNWCMDAdapters)




;
;
; ===================================================================================
;
;                                                GetIpxCardList
; ===================================================================================
;
; Section to create a combined list of all installed Odi and Ndis adapters.
; Used by OEMSETUP when configuring IPX.
;
; INPUT:
;        NONE
;
; OUTPUT:
;        $($R0) List of installed network cards.
;        $($R1) List of media type for installed network cards (ie {"ETHERNET","TOKEN-RING",...}).
;        $($R2) List of driver type for installed network cards (ie {"ODI","NDIS",...}).
;        $($R3) Number of installed network cards.
;   $($R4)  Product name list.
;   $($R5)  Service name list.
;   $($R6)  NetWareIP installed ? (YES/NO)
;   $($R7)  List of network card numbers.
;
; ===================================================================================

[GetIpxCardList]
;
; In this section we will create a list of all installed network cards.
;
	read-syms NwBaseVars
	read-syms OdiVars

	Debug-Output "NWSUBS.INF: GetIpxCardList"

	Set NetworkCardList = {}
	Set MediaTypeList = {}
	Set DriverTypeList = {}
	Set NumberNetworkCards = 0
	Set ProductNameList = {}
	Set ServiceNameList = {}
	Set NetWareIPInstalled = ""
	Set CardNumberList = {}

	Set IsHidden = ""
	set OdiAdapter = ""

;       ;
;       ;  Check if NetWareIP installed
;       ;
       OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_ServiceBase)"\NetWareIP" $(MAXIMUM_ALLOWED) KeyNetWareIP
       Ifstr $(KeyNetWareIP) != $(KeyNull)
               GetRegValue $(KeyNetWareIP) "DeleteFlag" DeleteFlagList
               Set NetWareIPDeleteFlag = *($(DeleteFlagList), 4)
               Debug-Output "NetWareIPDeleteFlag = "$(NetWareIPDeleteFlag)
               Ifint $(NetWareIPDeleteFlag) != 1
                       Set NetWareIPInstalled = YES
                       Debug-Output "NWSUBS.INF: bindnetware, NetWareIP is installed"
               Else
                       Set NetWareIPInstalled = ""
                       Debug-Output "NWSUBS.INF: bindnetware, NetWareIP NOT installed"
               Endif
               CloseRegKey $(KeyNetWareIP)
       Endif


       ifstr(i) $(NetWareIPInstalled) == YES
               set NetworkCardList = {"Novell NetWare/IP Support"}
               set MediaTypeList = {"NetWareIP"}
               set DriverTypeList = {"ODI"}
               set NumberNetworkCards = 1
               set ProductNameList = {"NetWareIP"}
               set ServiceNameList = {"NetWareIP"}
               goto GetIpxCardListEXIT
       endif

	OpenRegKey $(!REG_H_LOCAL) "" $(NetworkCardsKeyName) $(MAXIMUM_ALLOWED) NetCardsKey

	Ifstr(i) $(NetCardsKey) == ""
		Debug-Output "NWSUBS.INF: Can't Open Registry key "$(NetworkCardsKeyName)
		set CommonStatus = STATUS_USERCANCEL
	Else

		FlushRegKey $(NetCardsKey)

		;
		; Get a list of all installed network cards
		;

		EnumRegKey $(NetCardsKey) NetCardsList

		ForListDo $(NetCardsList)
			Set CardNumber = *($($), 1)

			OpenRegKey $(NetCardsKey) "" $(CardNumber) $(MAXIMUM_ALLOWED) CardKey
			Ifstr(i) $(CardKey) == ""
				Debug-Output "NWSUBS.INF: Can't open adapter "$(Card)
			Else
				GetRegValue $(CardKey) "Title" TitleValues
				Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
					Set CardTitle = *($(TitleValues), 4)
				Else
					Set CardTitle = ""
				Endif
				GetRegValue $(CardKey) "ProductName" NameValues
				Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
					Set CardName = *($(NameValues), 4)
				Else
					Set CardName = ""
				Endif
				GetRegValue $(CardKey) "Hidden" HiddenValues
				Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
					Set IsHidden = *($(HiddenValues), 4)
				Else
					Set IsHidden = ""
				Endif
				GetRegValue $(CardKey) "OdiAdapter" OdiValueList
				Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
					set OdiAdapter = *($(OdiValueList), 4)
				Else
					set OdiAdapter = ""
				Endif
				GetRegValue $(CardKey) "ServiceName" ValueList
				Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
					set ServiceName = *($(ValueList), 4)
				Else
					set ServiceName = ""
				Endif

				ifstr(i) $(IsHidden) != "1"
					;
					; It's not hidden so add it to the lists
					;

					Set-add NumberNetworkCards = $(NumberNetworkCards), 1
					Set NetworkCardList = >($(NetworkCardList), $(CardTitle))
					Set ProductNameList = >($(ProductNameList), $(CardName))
					Set ServiceNameList = >($(ServiceNameList), $(ServiceName))
					Set CardNumberList  = >($(CardNumberList), $(CardNumber))

					set MediaType = "UNKNOWN"
					set ServiceParameters = $(!NTN_ServiceBase)"\"$(ServiceName)"\Parameters"
					OpenRegKey $(!REG_H_LOCAL) ""  $(ServiceParameters) $(MAXIMUM_ALLOWED) ServiceParametersKey
					ifstr(i) $(ServiceParametersKey) != ""
						GetRegValue $(ServiceParametersKey) "MediaType" ValueList
						Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
							set NdisMediaType = *($(ValueList), 4)
							ifstr(i) $(NdisMediaType) == "1"
								set MediaType = "ETHERNET"
							else-ifstr(i) $(NdisMediaType) == "2"
								set MediaType = "TOKEN-RING"
							else-ifstr(i) $(NdisMediaType) == "4"
								set MediaType = "FDDI"
							else
								Debug-Output "NWSUBS.INF: Unknown media type "$(NdisMediaType)
							endif
						Endif
						CloseRegKey $(ServiceParametersKey)
					endif
					set MediaTypeList = >($(MediaTypeList), $(MediaType))


					Ifstr(i) $(OdiAdapter) == "1"
						;
						; Must be an ODI Adapter so add ODI to driver type list.
						;
						Set DriverTypeList = >($(DriverTypeList), "ODI")
					Else
						;
						;       Must be an NDIS Adapter so add NDIS to driver type list.
						;
						Set DriverTypeList = >($(DriverTypeList), "NDIS")
					Endif

				endif

			CloseRegKey $(CardKey)
			Endif
		EndForListDo

		Debug-Output "NWSUBS.INF: NetworkCardList		 = "$(NetworkCardList)
		Debug-Output "NWSUBS.INF: MediaTypeList       = "$(MediaTypeList)
		Debug-Output "NWSUBS.INF: DriverTypeList      = "$(DriverTypeList)
		Debug-Output "NWSUBS.INF: NumberNetworkCards  = "$(NumberNetworkCards)

		CloseRegKey $(NetCardsKey)
	Endif

GetIpxCardListEXIT = +

	return $(NetworkCardList) $(MediaTypeList) $(DriverTypeList) $(NumberNetworkCards) $(ProductNameList) $(ServiceNameList) $(NetWareIPInstalled) $(CardNumberList)


;
;
; ===================================================================================
;
;
; ===================================================================================
;
;  Section to check for needed drivers - ODINSUP
;
; INPUT:
;        NONE
;
; OUTPUT:
;        NONE
; ===================================================================================

[CheckIfODINSUPIsNeeded]

	read-syms NwBaseVars

	Debug-Output " "
	Debug-Output "NWSUBS.INF:  Entering function CheckIfODINSUPIsNeeded"
	Debug-Output " "

	Shell $(NwSubsInf), GetTotalAdapterList

	Set OdiProductNameList                  = $($R0)
	Set OdiTitleList                                        = $($R1)
	Set OdiCardList                                 = $($R2)
	Set NumberOdiAdapters                   = $($R3)
	Set NdisProductNameList                 = $($R4)
	Set NdisTitleList                                       = $($R5)
	Set NdisCardList                                        = $($R6)
	Set NumberNdisAdapters                  = $($R7)
	Set ODINSUPCardNumber                   = $($R8)
	Set NetWareIPCardNumList                = $($R9)
	Set NumberNetWareIPAdapters     = $($R10)

	;
	; Is there an ODI driver installed?
	;
	ifint $(NumberOdiAdapters) >= 1
		;
		;  turn on ODINSUP
		;
		OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_ServiceBase)"\Odinsup" $(MAXIMUM_ALLOWED) KeyProduct
		ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
			Set KeyValueList = {"Start",$(NoTitle),$(!REG_VT_DWORD),2}
			SetRegValue $(KeyProduct) $(KeyValueList)
			CloseRegKey $(KeyProduct)
		Endif
		;
		;  turn on Odiload
		;
		OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_ServiceBase)"\Odiload" $(MAXIMUM_ALLOWED) KeyProduct
		ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
			Set KeyValueList = {"Start",$(NoTitle),$(!REG_VT_DWORD),2}
			SetRegValue $(KeyProduct) $(KeyValueList)
			CloseRegKey $(KeyProduct)
		Endif
		;
		;  turn off VMLID
		;
		OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_ServiceBase)"\OdiVMLID" $(MAXIMUM_ALLOWED) KeyProduct
		ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
			Set KeyValueList = {"Start",$(NoTitle),$(!REG_VT_DWORD),4}
			SetRegValue $(KeyProduct) $(KeyValueList)
			CloseRegKey $(KeyProduct)
		Endif
	Else
		;
		;  turn off ODINSUP
		;
		OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_ServiceBase)"\Odinsup" $(MAXIMUM_ALLOWED) KeyProduct
		Ifstr $(KeyProduct) != $(KeyNull)
			Set KeyValueList = {"Start",$(NoTitle),$(!REG_VT_DWORD),4}
			SetRegValue $(KeyProduct) $(KeyValueList)
			CloseRegKey $(KeyProduct)
		Endif
		;
		;  turn off Odiload
		;
		OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_ServiceBase)"\Odiload" $(MAXIMUM_ALLOWED) KeyProduct
		Ifstr $(KeyProduct) != $(KeyNull)
			Set KeyValueList = {"Start",$(NoTitle),$(!REG_VT_DWORD),4}
			SetRegValue $(KeyProduct) $(KeyValueList)
			CloseRegKey $(KeyProduct)
		Endif
		;
		;  turn on VMLID
		;
		OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_ServiceBase)"\OdiVMLID" $(MAXIMUM_ALLOWED) KeyProduct
		ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
			Set KeyValueList = {"Start",$(NoTitle),$(!REG_VT_DWORD),2}
			SetRegValue $(KeyProduct) $(KeyValueList)
			CloseRegKey $(KeyProduct)
		Endif
	Endif

	Debug-Output " "
	Debug-Output "NWSUBS.INF:  Exiting function CheckIfODINSUPIsNeeded"
	Debug-Output " "

	Return


;
;
; ===================================================================================
;
;                                                NWConfigureSourceRouting
; ===================================================================================
;
; Section to ask the user if they want source routing.
;
; INPUT:
;        $($0)  "ODI" or "Novell"
;
; OUTPUT:
;        NONE
;
; ===================================================================================

[NWConfigureSourceRouting]
	read-syms InstallOption$(!STF_LANGUAGE)
	read-syms NwBaseVars
	read-syms OdiVars

	set SourceRoutingService = $(!NTN_ServiceBase)"\OdiSourceRouting"
	OpenRegKey $(!REG_H_LOCAL) "" $(SourceRoutingService) $(MAXIMUM_ALLOWED) KeySetup
	Ifstr(i) $(KeySetup) != ""

		set DlgType       = "MessageBox"
		set STF_MB_TITLE = $(UseSourceRouteTitle)
		set STF_MB_TEXT  = $(UseSourceRouteText)
		set STF_MB_TYPE  = 3
		set STF_MB_ICON  = 1
		set STF_MB_DEF  = 2
	
		GetRegValue $(KeySetup) "Start" StartValueList
		set StartValue = *($(StartValueList), 4)

		Ifint $(StartValue) != 4
			set STF_MB_DEF = 1                      
		Endif

		ui start "SourceRoutingBox"
	
		Ifstr(i) $(DLGEVENT) == "YES"
			set StartValue = 2
		Else
			set StartValue = 4
		Endif
	
		SetRegValue $(KeySetup) {Start,$(NoTitle),$(!REG_VT_DWORD), $(StartValue)}
		Debug-Output "NWSUBS.INF: Source Routing Start value set to "$(StartValue)
		CloseRegKey $(KeySetup)
	Endif

	Return


;*************************************************************************
;
;               SECTION:                InstallEx-ServiceGroupOrder
;
;               PURPOSE:                Called at install time and at bind time to install the
;                                               NetWare Services in the Service Group Order.
;
;               ARGUMENTS:      None
;
;               RETURNS:                None
;
;               REFERENCES:     None
;
;               MODIFIES:       None
;
;*************************************************************************
[InstallEx-ServiceGroupOrder]

	StartWait
	read-syms NwBaseVars

	Set ValueName           = "List"
	Set Status                      = STATUS_SUCCESSFUL
	Set Predecessor = $($0)
	Set ListToAdd           = $($1)

	Debug-Output "NWSUBS.INF:  ListToAdd is "$(ListToAdd)

	OpenRegKey $(!REG_H_LOCAL) "" "System\CurrentControlSet\Control\ServiceGroupOrder" $(MAXIMUM_ALLOWED) KeySgo
	Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
		GetRegValue $(KeySgo) $(ValueName) SgoValue
		Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
			Debug-Output "NWSUBS.INF:  Can't get list value from ServiceGroupOrder"
			set Status = STATUS_FAILED
			Goto IEX_Sgo_Return
		Endif
	else
		Debug-Output "NWSUBS.INF:  Can't open ServiceGroupOrder key"
		set Status = STATUS_FAILED
		Goto IEX_Sgo_Return
	Endif

	Set SgoList = *($(SgoValue), 4)
	Set NewList = {}

	ForListDo $(SgoList)
		Set SgoItem = $($)
		Ifstr(i) $(SgoItem) == $(Predecessor)
			Set NewList = >($(NewList), $(SgoItem))

			;
			; Add all NetWare names to the list here
			;

			ForListDo $(ListToAdd)
				Set NewList = >($(NewList), $($))
			EndForListDo
		else
			set InListToAdd = 0
			ForListDo $(ListToAdd)
				set SvcItem = $($)

				ifstr(i) $(SgoItem) == $(SvcItem)
					;
					; The SgoItem is in ListToAdd.  Don't add it now.  It will
					; be added with the ListToAdd when predecessor is found.
					;

					set InListToAdd = 1
				endif

			EndForListDo

			ifint $(InListToAdd) == 0
				set NewList = >($(NewList), $(SgoItem))
			endif
		endif
	EndForListDo

	SetRegValue $(KeySgo) {$(ValueName), $(NoTitle), $(!REG_VT_MULTI_SZ), $(NewList)}
	Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
		Debug-Output "NWSUBS.INF:  Can't update ServiceGroupOrder value"
		set Status = STATUS_FAILED
	Endif

	CloseRegKey $(KeySgo)

IEX_Sgo_Return = +
	Return $(Status)


; ===================================================================================
;
; SECTION: GetLanguageDir               Gets the NLS directory from the registry
;
; INPUT: NONE
;
; OUTPUT: $($R0)        Language directory if found
;
; ===================================================================================
[GetLanguageDir]
	set NLSDirName = ""
	set NovellParameters = $(!NTN_ServiceBase)"\Novell\Parameters"
	OpenRegKey $(!REG_H_LOCAL) "" $(NovellParameters) $(MAXIMUM_ALLOWED) KeyNovellParameters
	ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
		GetRegValue $(KeyNovellParameters) "NWLanguage" NWLanguageList
		ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
			set ValueType = *($(NWLanguageList), 3)
			ifstr(i) $(ValueType) == $(!REG_VT_SZ)
				set NLSDirName = *($(NWLanguageList), 4)
			else-ifstr(i) $(ValueType) == $(!REG_VT_MULTI_SZ)
				set LanguageList = *($(NWLanguageList), 4)
				set NLSDirName = *($(LanguageList), 1)
			endif
		else
			goto nolanguage
		endif
		CloseRegKey $(KeyNovellParameters)
	else
		goto nolanguage
	Endif

nolanguage = +
	
	ifstr(i) $(NLSDirName) == ""
		set NLSDirName = "English"
	endif

	return $(NLSDirName)

; ====================================================================================
;
; SECTION: GetNTVersion         Gets the NT major and minor versions from the registry
;
; INPUT: NONE
;
; OUTPUT: $($R0)        =       MajorNTVersion  
;         $($R1)        =       MinorNTVersion  
;
; ====================================================================================
[GetNTVersion]
	set CurrentVersion = $(!NTN_SoftwareBase)"\Microsoft\Windows NT\CurrentVersion"
	OpenRegKey $(!REG_H_LOCAL) "" $(CurrentVersion) $(MAXIMUM_ALLOWED) CurrentVersionKey
	ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
		GetRegValue $(CurrentVersionKey) "CurrentVersion" VersionList
		ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
			set VersionListData = *($(VersionList), 4)
			Split-string $(VersionListData) "." SplitVersionList
			Set NTMajorVersion = *($(SplitVersionList), 1)
			Set NTMinorVersion = *($(SplitVersionList), 3)

			Debug-OutPut "NWSUBS.INF: Windows NT current version is "$(VersionListData)
			Debug-OutPut "NWSUBS.INF: Windows NT Major version is "$(NTMajorVersion)
			Debug-OutPut "NWSUBS.INF: Windows NT Minor version is "$(NTMinorVersion)
		else
			Debug-Output "NWSUBS.INF:  Error getting NT version"
		endif
		CloseRegKey $(CurrentVersionKey)
	else
		Debug-Output "NWSUBS.INF:  Error opening "$(CurrentVersion)
	endif
	return $(NTMajorVersion) $(NTMinorVersion)



;----------InstallOptionENG-------------------------------------------------
;
; InstallOptionENG:
;
;     This section has all of the strings that are displayed on the screen.
;               They are seperated so that the file can be easily transtated.
;
;------------------------------------------------------------------------
[InstallOptionENG]
	UseSourceRouteTitle = "Configure ODI Source Routing"

	UseSourceRouteText = "Use ODI Source Routing support?"

	LoadDisk3Text = "Please load the Novell NetWare Client for Windows NT "+
		"disk 3 into drive "


[DoAskSourceENG]
	NetWareDlgText = "Please enter the full path to the Novell NetWare "+
		"Client for Windows NT distribution files.  Then choose Continue."
	
	NetWareLANDlgText = "Please enter the full path to the NetWare Client "+
		"for Windows NT distribution files.  If installing from floppy "+
		"diskette, enter the floppy drive to use and the system will "+
		"prompt you for the correct diskette."


[OdinsupDlgENG]
	DlgType = "RadioCombination"
	DlgTemplate = "ONELIST"
	Caption = "NetWare NDIS over ODI (ODINSUP) Setup"
	Label1 = "Installed ODI Adapters"
	EditTextIn = ""
	EditTextLim = ""
	CBOptionsGreyed = {}
	HelpContext = $(IDH_NETWARENDISODI)
	ComboListItemsIn = { OdiTitleList }
	ComboListItemsOut = { DefaultOdiTitle }
	NotifyFields = { "NO" }

[IPXBindDlgENG]
	DlgType = "RadioCombination"
	DlgTemplate = "ONELIST"
	Caption = "NetWare IPX Bind"
	Label1 = "ODI Adapter to bind IPX to"
	EditTextIn = ""
	EditTextLim = ""
	CBOptionsGreyed = {}
	HelpContext = $(IDH_NETWAREIPXBIND)
	ComboListItemsIn = { OdiTitleList }
	ComboListItemsOut = { DefaultOdiTitle }
	NotifyFields = { "NO" }

[IPXDlgENG]
	DlgType = "RadioCombination"
	Label1 = "Enter the board and the default frame type to bind to IPX"
	Label2 = "Board"
	Label3 = "Frame"
	DlgTemplate = "IPXFRAME"
	Caption = "IPX Bind Parameters"
	EditTextIn = ""
	EditTextLim = ""
	CBOptionsGreyed = {}
	RadioOptionsGreyed = {}
	HelpContext = $(IDH_NETWAREIPXBIND)
	ComboOut = $(FrameListDefault)
	ComboListItemsIn = { FrameList }
	ComboListItemsOut = { ComboOut }
	NotifyFields = { "NO" }

[NewFrameTypeDlgENG]
	Label1 = "WARNING: Entering a non-standard frametype could prevent this workstation from communicating with the network."
	Label2 = "Frame Type"
	Label3 = "Protocol Identifier"
	ICON = BANG
	DlgType = "RadioCombination"
	DlgTemplate = "DLG_NETWORKPROTOCOL"
	Caption = "Network Protocol"
	EditTextIn = { $(NewFrameTypeName), $(ProtocolID) }
	EditTextLim = { "", 12 }
	CBOptionsGreyed = {}
	RadioOptionsGreyed = {}
	HelpContext = $(IDH_NETWORKPROTOCOL)
	ComboOut = {}
	ComboListItemsIn = {}
	ComboListItemsOut = {}
	NotifyFields = {}

[AdvancedIPXSPXDlgENG]
	DlgType = "RadioCombination"
	DlgTemplate = "DLG_IPXSPXPARAMETERS"
	Caption = "IPX/SPX Parameters"
	EditTextLim = { "5", "1", "2", "5", "10", "10", "10" }
	CBOptionsGreyed = {}
	HelpContext = $(IDH_IPXSPXPARMS)


; ===================================================================================
;
; ===================================================================================

[DriverTable]
	NE2000,         ODI_NE2000
	NE1000,         ODI_NE2000
	AM1500T,        ODI_NE1500T
	AM1500T,        ODI_M1500
	AM1500T,        ODI_NE2100
	NONE,           ODI_M2100
	IBMTOK,         ODI_IBMTOK1     
	IBMTOK,         ODI_NTR2000
	EWORK,          ODI_EWRK3
	HP27247B,       ODI_HP27247B
	HP27252A,       ODI_HP27252A
	J2573A,         ODI_HPJ2573A
	NONE,           ODI_MADGEODI
	NONE,           ODI_SMC8216
	SMC8416,        ODI_SMC8416
	NONE,           ODI_SMC8115T
	NONE,           ODI_SMC8115T_A
	TC$4045e,       ODI_TC4045
	TC$4046e,       ODI_TC4046
	NE2000MCA,      ODI_NE2
	NONE,                   ODI_NE232
	IBMTOKMC,       ODI_IBMTOKMC
	NONE,                   ODI_MADGEODIMC
	NONE,                   ODI_SMC8216MC
	NONE,                   ODI_SMC8416MC
	NONE,                   ODI_SMC8115TMC
	NONE,                   ODI_SMC8115T_AMC
	NONE,                   ODI_TCTOKHMC
	NE3200,         ODI_NE3200
	NONE,           ODI_ES3210
	NONE,                   ODI_EWRK3EISA
	NONE,                   ODI_HP27247BEISA
	NONE,                   ODI_HP27252AEISA
	NONE,                   ODI_HPJ2577AEISA
	NONE,                   ODI_MADGEODIEISA
	NONE,                   ODI_NE3300EISA
	NONE,                   ODI_SMC8216EISA
	NONE,                   ODI_SMC8416EISA
	NONE,                   ODI_SMC8115TEISA
	NONE,                   ODI_SMC8115T_AEISA
	SMC8232,                ODI_SMC8232EISA
	NONE,                   ODI_SMC8332EISA
	NONE,                   ODI_SMC9232
	NONE,                   ODI_TCE32ESHEISA
	NONE,                   ODI_TC4045EISA
	NONE,                   ODI_TC4046EISA
