; ------------------------------------------------------------------------ ; Microsoft Windows NT and Driver Installation ; Thomas-Conrad Token Ring Drivers ; Copyright 1993,94 Thomas-Conrad Corporation ; v1.00 (940322) ; ------------------------------------------------------------------------ ; NOTES: To adapt this OEMSETNT.INF file for another flavor of adapter, ; look for the 'NOTE: Adapter Adaptation area' comments. ; The model for this installation calls for one .DLL, ; one driver .SYS file, and one installation .INF file. All are ; copied during installation and deleted during removal. ; To emit debug statements to the debugger, remove the comments ; in the first two statements in [InstallOption]. For documentation ; on this script language, dialogs, whys, wherefores, and weirdies, ; look to the 'NT Programmers Guide', chapters 2 and 4, 'ncpainf.doc' ; from the build 506 NT DDK, and 'setupddk.doc' from the build ; 506 NT DDK (neither made the release DDK for some reason). ; The only script language operator we use that's not documented ; anywhere is the 'tilde' (~), which returns finds the index of ; a match within a list. ; ------------------------------------------------------------------------ [Source Media Descriptions] 1 = "Thomas-Conrad Token Ring Drivers Diskette" [Signature] FileType = MICROSOFT_DRVLIB_FILE [GetSignature] read-syms Signature return $(FileType) [Files-Driver] 1, tctoknt.sys, SIZE=51712 1, eaglecaf.bin, SIZE=26880 [Files-Dll] 1, tctoknt.dll, SIZE=9216 [OptListENG] ; ----------------------------------------------------------------------------- ; This list supports multiple adapters of a similar type. ; Format is: tag = option, irqs, selection , name, title, description ; tag - tag required by script file, it's ignored for all intents... ; option - an NCPA variable used to drive option selection ; selection - displayed in 'Add Network Adapter' dialog box ; name - base name for adapter in the registry ; title - 'Installed Adapter Cards' item in the NCPA Network dialog box ; description - 'Description' item in the NCPA Network dialog box ; ----------------------------------------------------------------------------- ; tag = option, selection, name, title, description ; OptList_2 = tc$4045e, "Thomas-Conrad TC4045 Token Ring Adapter", "TCTOK", "TC4045 Token Ring Adapter", "Thomas-Conrad 16/4Mbps Token Ring Adapter/AT" OptList_3 = tc$4046e, "Thomas-Conrad TC4046 Token Ring Adapter", "TCTOK", "TC4046 Token Ring Adapter", "Thomas-Conrad 16/4Mbps Token Ring Adapter/MC" [FileConstants] ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; NOTE: Adapter Adaptation area ; TccBaseName - base filename for .sys, .dll files, binding rules ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Manufacturer = "Thomas-Conrad" TccBaseName = "tctok" SoftwareMajorVersion = "1" SoftwareMinorVersion = "00s1" InterruptTextList = ^(InterruptChoices, 1) InterruptValueList = ^(InterruptChoices, 2) IoBaseTextList = ^(IoBaseChoices, 1) IoBaseValueList = ^(IoBaseChoices, 2) DmaChannelTextList = ^(DmaChannelChoices, 1) DmaChannelValueList = ^(DmaChannelChoices, 2) SpeedTextList = ^(SpeedChoices, 1) SpeedValueList = ^(SpeedChoices, 2) SpeedRadioButtonIdxList = ^(SpeedChoices, 3) SlotNumberTextList = ^(SlotNumberChoices, 1) SlotNumberValueList = ^(SlotNumberChoices, 2) ; - - - - - - - - - - - - - - - NetEventDLL = "%SystemRoot%\System32\netevent.dll" IoLogMsgDLL = "%SystemRoot%\System32\IoLogMsg.dll" UtilityInf = "UTILITY.INF" SubroutineInf = "SUBROUTN.INF" SoftwareType = "driver" Exit_Code = 0 SoftwareVersion = $(SoftwareMajorVersion)"."$(SoftwareMinorVersion) SoftwareImage = "\SystemRoot\System32\drivers\"$(TccBaseName)"nt.sys" NetRuleSoftwareType = $(TccBaseName)"Sys ndisDriver "$(TccBaseName)"Driver" NetRuleSoftwareBindForm = """"$(TccBaseName)"Sys"" yes no container" NetRuleSoftwareBindable = {""$(TccBaseName)"Driver "$(TccBaseName)"Adapter non exclusive 100"} NetRuleSoftwareClass = {""$(TccBaseName)"Driver basic"} NetRuleSoftwareUse = $(SoftwareType) NetRuleHardwareType = $(TccBaseName)" "$(TccBaseName)"Adapter" NetRuleHardwareClass = {""$(TccBaseName)"Adapter basic"} NetRuleHardwareBindForm = " yes yes container" KeyName_SoftwareRoot = $(!NTN_SoftwareBase)"\"$(Manufacturer) KeyName_Software = $(KeyName_SoftwareRoot)"\"$(TccBaseName)"\CurrentVersion" [InterruptChoices] Interrupt_1 = "2/9", 2 Interrupt_2 = "3" , 3 Interrupt_4 = "5" , 5 Interrupt_4 = "6" , 6 Interrupt_5 = "7" , 7 Interrupt_6 = "10" , 10 Interrupt_7 = "11" , 11 Interrupt_8 = "12" , 12 [IoBaseChoices] IoBaseChoice_1 = "1A20", 6688 IoBaseChoice_2 = "2A20", 10784 IoBaseChoice_3 = "3A20", 14880 IoBaseChoice_4 = "3A40", 14912 IoBaseChoice_5 = "3A60", 14944 IoBaseChoice_6 = "3A80", 14976 IoBaseChoice_7 = "3AA0", 15008 IoBaseChoice_8 = "4AE0", 19168 [DmaChannelChoices] DmaChannelChoice_1 = "5", 5 DmaChannelChoice_2 = "6", 6 DmaChannelChoice_3 = "7", 7 DmaChannelChoice_4 = "1", 1 DmaChannelChoice_5 = "Disabled", 0 [SpeedChoices] SpeedChoice_1 = "4 Mbps", 4, 1 SpeedChoice_2 = "16 Mbps", 16, 2 [SlotNumberChoices] SlotNumberChoice_1 = "Slot 1", 1 SlotNumberChoice_2 = "Slot 2", 2 SlotNumberChoice_3 = "Slot 3", 3 SlotNumberChoice_4 = "Slot 4", 4 SlotNumberChoice_5 = "Slot 5", 5 SlotNumberChoice_6 = "Slot 6", 6 SlotNumberChoice_7 = "Slot 7", 7 SlotNumberChoice_8 = "Slot 8", 8 [FileConstantsENG] ProCaption = "Windows NT Setup" ProCancel = "Cancel" ProCancelMsg = "Your Thomas-Conrad Windows NT Networking "+ "Adapter is not correctly installed. Are "+ "you sure you want to cancel copying files?" ProCancelCap = "Network Setup Message" ProText1 = "Copying:" ProText2 = "To:" ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; NOTE: Adapter Adaptation area ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; SoftwareTitle - Short name, displayed in NCPA dlg box in ; 'Installed Network Software' window ; SoftwareDescription - Long name, Displayed in NCPA dlg box in ; 'Description' window when software selected ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SoftwareTitle = "TCC Token Ring Driver" SoftwareDescription = "Thomas-Conrad Token Ring Driver" ; - - - - - - - - - - - - - - - [DialogConstantsENG] ; - - - - - - - - - - - - - - - ; NOTE: Adapter Adaptation area ; - - - - - - - - - - - - - - - Help = "&Help" Exit = "Cancel" OK = "OK" HelpContext = "" Continue = "Continue" Cancel = "C&ancel" ; - - - - - - - - - - - - - - - [Basic4035DlgENG] ; - - - - - - - - - - - - - - - ; NOTE: Adapter Adaptation area ; - - - - - - - - - - - - - - - DlgType = "RadioCombination" DlgTemplate = "TCCTOK_4035" EditFocusOn = $(!IDC_COMBO1) ReInit = NO Caption = "" Combo1List = $(InterruptTextList) Combo1Out = $(InterruptTextDlgDefault) Combo2List = $(IoBaseTextList) Combo2Out = $(IoBaseTextDlgDefault) Combo3List = $(DmaChannelTextList) Combo3Out = $(DmaChannelTextDlgDefault) ComboListItemsIn = {Combo1List,Combo2List,Combo3List} ComboListItemsOut = {Combo1Out,Combo2Out,Combo3Out} RadioIn = "" ;; since AdvancedDlgENG is using EditText, we can't... EditTextIn = "" EditTextLim = "" NotifyFields = {NO, NO, NO} HelpContext = "" ; - - - - - - - - - - - - - - - [Basic4045DlgENG] ; - - - - - - - - - - - - - - - ; NOTE: Adapter Adaptation area ; - - - - - - - - - - - - - - - DlgType = "RadioCombination" DlgTemplate = "TCCTOK_4045" EditFocusOn = $(!IDC_COMBO1) ReInit = NO Caption = "" Combo1List = $(InterruptTextList) Combo1Out = $(InterruptTextDlgDefault) Combo2List = $(IoBaseTextList) Combo2Out = $(IoBaseTextDlgDefault) Combo3List = $(DmaChannelTextList) Combo3Out = $(DmaChannelTextDlgDefault) ComboListItemsIn = {Combo1List,Combo2List,Combo3List} ComboListItemsOut = {Combo1Out,Combo2Out,Combo3Out} RadioIn = { $(SpeedIntDlgDefault) } ;; since AdvancedDlgENG is using EditText, we can't... EditTextIn = "" EditTextLim = "" NotifyFields = {NO, NO, NO} HelpContext = "" ; - - - - - - - - - - - - - - - [Basic4046DlgENG] ; - - - - - - - - - - - - - - - ; NOTE: Adapter Adaptation area ; - - - - - - - - - - - - - - - DlgType = "RadioCombination" DlgTemplate = "TCCTOK_4046" EditFocusOn = $(!IDC_COMBO1) ReInit = NO Caption = "" Combo1List = $(SlotNumberTextList) Combo1Out = $(SlotNumberTextDlgDefault) ComboListItemsIn = {Combo1List} ComboListItemsOut = {Combo1Out} RadioIn = "" ;; since AdvancedDlgENG is using EditText, we can't... EditTextIn = "" EditTextLim = "" NotifyFields = {NO} HelpContext = "" ; - - - - - - - - - - - - - - - [AdvancedDlgENG] ; - - - - - - - - - - - - - - - ; NOTE: Adapter Adaptation area ; - - - - - - - - - - - - - - - DlgType = "RadioCombination" DlgTemplate = "TCCTOK_ADVANCED" EditFocusOn = $(IDC_EDIT1) ReInit = NO Caption = $(FunctionTitle) ;; since Basic4045DlgENG is using ComboList and Radio, we can't... ;; ComboListItemsIn = "" ;; ComboListItemsOut = "" ;; RadioIn = "" EditField1 = $(PacketSizeTextDlgDefault) EditField2 = $(NetAddressTextDlgDefault) EditField3 = $(ProductIdTextDlgDefault) EditTextIn = { $(EditField1), $(EditField2), $(EditField3) } EditTextLim = { 5, 17 36 } NotifyFields = "" HelpContext = "" ; - - - - - - - - - - - - - - - [Identify] ; ---------------------------------------------------------------- ; Identify ourselves as an NT installation script file ; and tell setup about us and our installation diskette ; ---------------------------------------------------------------- set Status = STATUS_SUCCESSFUL set Identifier = NetAdapter set Media = #("Source Media Descriptions", 1, 1) Return $(Status) $(Identifier) $(Media) [ReturnOptions] ; ---------------------------------------------------------------- ; If we support the requested language, return the NCPA variable ; list and its matching text list, so the user can select an ; option to process ; ---------------------------------------------------------------- set Status = STATUS_FAILED set OptionList = {} set OptionTextList = {} set LanguageList = ^(LanguagesSupported, 1) Ifcontains(i) $($0) in $(LanguageList) ifstr(i) $($1) == "" goto ReturnOptions_Set endif set PlatformList = ^(PlatformsSupported, 1) Ifcontains(i) $($1) in $(PlatformList) goto ReturnOptions_Set else set Status = STATUS_NOTSUPPORTED goto ReturnOptions_Exit endif else set Status = STATUS_NOLANGUAGE goto ReturnOptions_Exit endif ReturnOptions_Set = + set OptionList = ^(OptList$($0), 1) set OptionTextList = ^(OptList$($0), 2) set Status = STATUS_SUCCESSFUL ReturnOptions_Exit = + Return $(Status) $(OptionList) $(OptionTextList) [LanguagesSupported] ENG [GeneralConstants] from = "" to = "" ExitCodeOk = 0 ExitCodeCancel = 1 ExitCodeFatal = 2 Key_Null = "" MAXIMUM_ALLOWED = 33554432 RegistryErrorIndex = NO_ERROR Key_Product = "" Key_HardwareParameters = "" TRUE = 1 FALSE = 0 NoTitle = 0 ExitState = "Active" OldVersionExisted = $(FALSE) DriverPath = $(!STF_NTPATH)\drivers [date] Now = {} ? $(!LIBHANDLE) GetSystemDate [ProductType] STF_PRODUCT = Winnt STF_PLATFORM = I386 [PlatformsSupported] ISA EISA MCA [Install-Option] Debug-Output "$(STF_CONTEXTINFNAME): Entering Install-Option" set STF_VITAL = "" ifstr(i) $(AddCopy) == "YES" set STF_VITAL = "YES" AddSectionFilesToCopyList Files-Driver $(SrcDir) $(!STF_WINDOWSSYSPATH)\drivers AddSectionFilesToCopyList Files-Dll $(SrcDir) $(!STF_WINDOWSSYSPATH) endif ifstr(i) $(DoCopy) == "YES" set STF_VITAL = "YES" set !STF_NCPA_FLUSH_COPYLIST = TRUE CopyFilesInCopyList else LibraryProcedure STATUS,$(!LIBHANDLE), CopySingleFile $(SrcDir)\tctoknt.dll $(!STF_WINDOWSSYSPATH)\tctoknt.dll endif ifstr(i) $(DoConfig) == "YES" endif exit [Install-Update] Debug-Output "$(STF_CONTEXTINFNAME): Entering Install-Update" set STF_VITAL = "YES" set STF_OVERWRITE = "VERIFYSOURCEOLDER" AddSectionFilesToCopyList Files-Driver $(SrcDir) $(!STF_WINDOWSSYSPATH)\drivers AddSectionFilesToCopyList Files-Dll $(SrcDir) $(!STF_WINDOWSSYSPATH) set !STF_NCPA_FLUSH_COPYLIST = TRUE CopyFilesInCopyList exit [Remove-Option] Debug-Output "$(STF_CONTEXTINFNAME): Entering Remove-Option" set RemoveList = {} set RemoveList = >($(RemoveList), $(!STF_WINDOWSSYSPATH)"\drivers\"$(TccBaseName)"nt.sys") set RemoveList = >($(RemoveList), $(!STF_WINDOWSSYSPATH)"\drivers\eaglecaf.bin") set RemoveList = >($(RemoveList), $(!STF_WINDOWSSYSPATH)"\"$(TccBaseName)"nt.dll") set RemoveList = >($(RemoveList), $(STF_CONTEXTINFNAME)) ForListDo $(RemoveList) Debug-Output "Removing .$($)." LibraryProcedure Status , $(!LIBHANDLE), DelFile $($) EndForListDo exit [InstallOption] ;; set !DebugOutputControl = 1 ;; set !STF_DISPLAYDEBUGOUTPUT = 1 set TccOption = $($1) set SrcDir = $($2) set AddCopy = $($3) set DoCopy = $($4) set DoConfig = $($5) Debug-Output "$(STF_CONTEXTINFNAME): Entering InstallOption" Debug-Output "$(STF_CONTEXTINFNAME): STF_CWDIR: .$(!STF_CWDIR)." Debug-Output "$(STF_CONTEXTINFNAME): STF_LANGUAGE: .$(!STF_LANGUAGE)." Debug-Output "$(STF_CONTEXTINFNAME): !NTN_RegBase .$(!NTN_RegBase)." Debug-Output "$(STF_CONTEXTINFNAME): !NTN_SoftwareBase .$(!NTN_SoftwareBase)." Debug-Output "$(STF_CONTEXTINFNAME): TccOption: .$(TccOption). SrcDir: .$(SrcDir)." Debug-Output "$(STF_CONTEXTINFNAME): AddCopy: .$(AddCopy). DoCopy: .$(DoCopy). DoConfig: .$(DoConfig)." set LanguageList = ^(LanguagesSupported, 1) Ifcontains(i) $($0) NOT-IN $(LanguageList) Return STATUS_NOLANGUAGE endif set-subst LF = "\n" ; ---------------------------------------------------------------- ; Pick up the general constants and file constants ; ---------------------------------------------------------------- read-syms GeneralConstants read-syms FileConstants ; ---------------------------------------------------------------- ; Pick up the variables for this option (as selected by user) ; These would normally reside in FileConstants, but there's no ; dynamic selection mechanism supported in a read-syms section. ; ---------------------------------------------------------------- set OptionNameList = ^(OptList$(!STF_LANGUAGE), 1 ) set OptionHdwrNameList = ^(OptList$(!STF_LANGUAGE), 3 ) set OptionHdwrTitleList = ^(OptList$(!STF_LANGUAGE), 4 ) set OptionHdwrDescList = ^(OptList$(!STF_LANGUAGE), 5 ) set ProductHdwrName = *($(OptionHdwrNameList),+ ~($(OptionNameList), $(TccOption))) set ProductHdwrTitle = *($(OptionHdwrTitleList),+ ~($(OptionNameList), $(TccOption))) set ProductHdwrDesc = *($(OptionHdwrDescList),+ ~($(OptionNameList), $(TccOption))) Debug-Output "$(STF_CONTEXTINFNAME): ProductHdwrName .$(ProductHdwrName)." Debug-Output "$(STF_CONTEXTINFNAME): ProductHdwrTitle .$(ProductHdwrTitle)." Debug-Output "$(STF_CONTEXTINFNAME): ProductHdwrDesc .$(ProductHdwrDesc)." read-syms DialogConstants$(!STF_LANGUAGE) ifstr(i) $(!NTN_Origination) == "NCPA" set Continue = "OK" endif read-syms FileConstants$(!STF_LANGUAGE) detect date set-title $(FunctionTitle) set to = InstallOptionDispatch set from = InstallOptionDispatch set CommonStatus = STATUS_SUCCESSFUL EndWait InstallOptionDispatch = + Debug-Output "$(STF_CONTEXTINFNAME): Entering InstallOptionDispatch" ; ---------------------------------------------------------------- ; Figure out which label we need to dispatch to and ; what our error recovery 'features' will be ; ---------------------------------------------------------------- Ifstr(i) $(!NTN_InstallMode) == deinstall set StartLabel = RemoveAdapterFromRegistry else-Ifstr(i) $(!NTN_InstallMode) == Update set StartLabel = UpgradeSoftware else-Ifstr(i) $(!NTN_InstallMode) == bind set StartLabel = CheckAdapterBinding else-Ifstr(i) $(!NTN_InstallMode) == configure set StartLabel = GetAdapterConfigFromRegistry ; ---------------------------------------------------------------- ; We're going to configure, disallow configuring the driver ; ---------------------------------------------------------------- Ifstr(i) $(KeyName_Software) == $(!NTN_RegBase) Debug-Output "$(STF_CONTEXTINFNAME): Cannot configure driver software." Shell $(UtilityInf), RegistryErrorString, CANNOT_CONFIGURE_SOFTWARE ifint $($ShellCode) != $(!SHELL_CODE_OK) set ShellErrorSection = UtilityInf:RegistryErrorString goto ShellCodeError endif set Error = $($R0) set from = InstallOptionExit set to = InstallOptionExit goto SetNonFatalInfo endif else set StartLabel = TestForExistingInstallation set OEM_ABANDON_OPTIONS = {} set OEM_ABANDON_SOFTWARE = FALSE set OEM_ABANDON_ON = TRUE endif ; ---------------------------------------------------------------- ; Establish defaults for all configurable values ; ---------------------------------------------------------------- ; - - - - - - - - - - - - - - - ; NOTE: Adapter Adaptation area ; - - - - - - - - - - - - - - - set AdapterTypeValue = 1 set DmaChannelValue = *( $(DmaChannelValueList), 1 ) set InterruptValue = *( $(InterruptValueList), 1 ) set IoBaseValue = *( $(IoBaseValueList), 1 ) set McaPosIdValue = 81 set NetAddressValue = "" set PacketSizeValue = 16384 set ProductIdValue = "" set SlotNumberValue = *( $(SlotNumberValueList), 1 ) set SpeedValue = *( $(SpeedValueList), 2 ) ; - - - - - - - - - - - - - - - ; ---------------------------------------------------------------- ; Set the from/to labels vars for error cases, and dispatch... ; ---------------------------------------------------------------- set from = $(FatalError) set to = $(FatalError) goto $(StartLabel) TestForExistingInstallation = + ; ---------------------------------------------------------------- ; Test the registry for an existing installation. ; ---------------------------------------------------------------- ; Try to open the registry key for the driver so we can determine ; if a driver and adapter card are already installed. ; ---------------------------------------------------------------- set OldVersionExisted = $(FALSE) Debug-Output "$(STF_CONTEXTINFNAME): Entering TestForExistingInstallation" OpenRegKey $(!REG_H_LOCAL) "" $(KeyName_Software) $(MAXIMUM_ALLOWED) Key_Product Ifstr $(Key_Product) != $(Key_Null) CloseRegKey $(Key_Product) ; ---------------------------------------------------------------- ; Disallow multiple installs of the driver ; ---------------------------------------------------------------- ifstr(i) $(!NTN_RegBase) == $(KeyName_Software) Shell $(UtilityInf), VerExistedDlg, $(SoftwareTitle), $(SoftwareVersion) ifint $($ShellCode) != $(!SHELL_CODE_OK) set ShellErrorSection = UtilityInf:VerExistedDlg goto ShellCodeError endif goto end else ; ---------------------------------------------------------------- ; Allow multiple installs of the netcard (with a warning) ; ---------------------------------------------------------------- Shell $(UtilityInf), CardExistedDlg ifint $($ShellCode) != $(!SHELL_CODE_OK) set ShellErrorSection = UtilityInf:CardExistedDlg goto ShellCodeError endif ifstr(i) $($R1) == "OK" set OldVersionExisted = $(TRUE) else goto InstallOptionExit endif endif endif CopyAdapterFiles = + ; ---------------------------------------------------------------- ; Copy the adapter files from the diskette. ; ---------------------------------------------------------------- ; If we're already installed and it's configure mode, skip this ; and go get the configuration from the user. ; If we're not installed and it's install mode, and copy mode ; is set, ask the user for the install diskette, then install the ; option section (which has the .sys, .dll files enumerated). ; Our OEMSETNT.INF file has already been copied to the system ; directory and renamed to OEMNADx.inf. ; ---------------------------------------------------------------- Debug-Output "$(STF_CONTEXTINFNAME): Entering CopyAdapterFiles" ifint $(OldVersionExisted) == $(TRUE) ifstr(i) $(!NTN_InstallMode) == configure goto GetAdapterConfigFromUser endif endif StartWait ifint $(OldVersionExisted) == $(FALSE) ifstr(i) $(!NTN_InstallMode) == "install" Ifstr(i) $(DoCopy) == "YES" Shell $(UtilityInf), DoAskSource, $(!STF_CWDDIR), $(SrcDir) YES Ifint $($ShellCode) != $(!SHELL_CODE_OK) set ShellErrorSection = UtilityInf:DoAskSource Goto ShellCodeError Else-Ifstr(i) $($R0) == STATUS_FAILED Shell $(UtilityInf) RegistryErrorString "ASK_SOURCE_FAIL" ifint $($ShellCode) != $(!SHELL_CODE_OK) set ShellErrorSection = UtilityInf:RegistryErrorString goto ShellCodeError endif set Error = $($R0) Goto FatalError Else-Ifstr(i) $($R0) == STATUS_USERCANCEL Goto ProcessSuccessExit Endif Set SrcDir = $($R1) Endif install "Install-Option" ifstr(i) $(STF_INSTALL_OUTCOME) != STF_SUCCESS Shell $(UtilityInf) RegistryErrorString "UNABLE_COPY_FILE" ifint $($ShellCode) != $(!SHELL_CODE_OK) set ShellErrorSection = UtilityInf:RegistryErrorString goto ShellCodeError endif set Error = $($R0) goto FatalError endif endif endif GetAdapterConfigFromRegistry = + ; ---------------------------------------------------------------- ; Get the existing adapter's configuration from the registry ; ---------------------------------------------------------------- ; If we're install mode, there's no existing configuration, so ; skip this and go ask the user for the configuration ; ---------------------------------------------------------------- Debug-Output "$(STF_CONTEXTINFNAME): Entering GetAdapterConfigFromRegistry" ifstr(i) $(!NTN_InstallMode) == "install" goto GetAdapterConfigFromUser else ; ---------------------------------------------------------------- ; Ensure that we have an open product key ; ---------------------------------------------------------------- Ifstr $(Key_Product) == $(Key_Null) OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_RegBase) $(MAXIMUM_ALLOWED) Key_Product Ifstr $(Key_Product) == $(Key_Null) set RegistryErrorIndex = CANNOT_FIND_COMPONENT_SERVICE Debug-Output $(STF_CONTEXTINFNAME)": Cannot find component product key" goto FatalRegistryError Endif Endif ; ---------------------------------------------------------------- ; Find our netcard service key and open it ; ---------------------------------------------------------------- Shell $(UtilityInf) FindService, $(Key_Product) Ifint $($ShellCode) != $(!SHELL_CODE_OK) set ShellErrorSection = UtilityInf:FindService Goto ShellCodeError Endif Ifstr(i) $($R0) != NO_ERROR Debug-Output "$(STF_CONTEXTINFNAME): Utility:FindService error: $($R0)" Goto FatalRegistryError endif set Key_HardwareParameters = $($R2) ; ---------------------------------------------------------------- ; Close the service key and open our netcard parameters key ; ---------------------------------------------------------------- CloseRegKey $($R1) Ifstr $(Key_HardwareParameters) == $(Key_Null) set RegistryErrorIndex = CANNOT_FIND_COMPONENT_SERVICE Debug-Output $(STF_CONTEXTINFNAME)": Cannot find component service" goto FatalRegistryError endif set OldVersionExisted = $(TRUE) set ValueName = "" set ValueData = "" set ValueStr = "" set ValueList = {} ; ---------------------------------------------------------------- ; Walk the hardware service parameters value list and pick up ; (and save off) any values we're interested in. ; ---------------------------------------------------------------- EnumRegValue $(Key_HardwareParameters) ValueList ForListDo $(ValueList) set ValueItem = $($) set ValueName = *($(ValueItem),1) set ValueData = *($(ValueItem),4) ; - - - - - - - - - - - - - - - ; NOTE: Adapter Adaptation area ; - - - - - - - - - - - - - - - Ifstr(i) $(ValueName) == "AdapterType" set AdapterTypeValue = $(ValueData) else-Ifstr(i) $(ValueName) == "DmaChannel" set DmaChannelValue = $(ValueData) else-Ifstr(i) $(ValueName) == "Interrupt" set InterruptValue = $(ValueData) else-Ifstr(i) $(ValueName) == "IoBase" set IoBaseValue = $(ValueData) else-Ifstr(i) $(ValueName) == "NetAddress" set NetAddressValue = $(ValueData) else-Ifstr(i) $(ValueName) == "PacketSize" set PacketSizeValue = $(ValueData) else-Ifstr(i) $(ValueName) == "ProductId" set ProductIdValue = $(ValueData) else-Ifstr(i) $(ValueName) == "Speed" set SpeedValue = $(ValueData) else-Ifstr(i) $(ValueName) == "SlotNumber" set SlotNumberValue = $(ValueData) endif ; - - - - - - - - - - - - - - - Debug-Output "$(STF_CONTEXTINFNAME): $(ValueName) == .$(ValueData)." EndForListDo Endif GetAdapterConfigFromUser = + ; ---------------------------------------------------------------- ; Get/Confirm the adapter's configuration from/with the user ; ---------------------------------------------------------------- ; Load our DLL so we can get to our dialog box, then render the ; current configurable values (that have been previously been set ; to defaults or have had registry info plugged in) into textual ; defaults for the dialog box ; ---------------------------------------------------------------- Debug-Output "$(STF_CONTEXTINFNAME): Entering GetAdapterConfigFromUser" LoadLibrary $(Media) $(!STF_WINDOWSSYSPATH)\$(TccBaseName)nt.dll hLib set from = GetAdapterConfigFromUser GetAdpCfgFromUserOuterLoop = + Debug-Output "$(STF_CONTEXTINFNAME): Entering Basic..." ; - - - - - - - - - - - - - - - ; NOTE: Adapter Adaptation area ; - - - - - - - - - - - - - - - set InterruptTextDlgDefault = *($(InterruptTextList),+ ~($(InterruptValueList), + $(InterruptValue))) set IoBaseTextDlgDefault = *($(IoBaseTextList),+ ~($(IoBaseValueList), + $(IoBaseValue))) set DmaChannelTextDlgDefault = *($(DmaChannelTextList),+ ~($(DmaChannelValueList), + $(DmaChannelValue))) set SlotNumberTextDlgDefault = *($(SlotNumberTextList),+ ~($(SlotNumberValueList), + $(SlotNumberValue))) set SpeedIntDlgDefault = *($(SpeedRadioButtonIdxList),+ ~($(SpeedValueList), + $(SpeedValue))) ; ---------------------------------------------------------------- ; Get the dialog strings for the appropriate dialog box, ; and ask the user for the configuration. ; ---------------------------------------------------------------- ifstr(i) $(TccOption) == "tc$4035e" read-syms Basic4035Dlg$(!STF_LANGUAGE) else-ifstr(i) $(TccOption) == "tc$4045e" read-syms Basic4045Dlg$(!STF_LANGUAGE) else read-syms Basic4046Dlg$(!STF_LANGUAGE) endif endif ui start "InputDlg" $(hLib) ifstr(i) $(DLGEVENT) == "CONTINUE" ; ---------------------------------------------------------------- ; The user accepted, render the returned textual values back into ; actual values. For ISA, it's Interrupt, IoBase, and DmaChannel, ; Slot will end up being zero. For MCA, we're only interested ; in Slot, so Interrupt, IoBase, and DmaChannel will end up zero. ; ---------------------------------------------------------------- set InterruptValue = *($(InterruptValueList),+ ~($(InterruptTextList),+ $(Combo1Out))) set IoBaseValue = *($(IoBaseValueList),+ ~($(IoBaseTextList),+ $(Combo2Out))) set DmaChannelValue = *($(DmaChannelValueList),+ ~($(DmaChannelTextList),+ $(Combo3Out))) set SlotNumberValue = *($(SlotNumberValueList),+ ~($(SlotNumberTextList),+ $(Combo1Out))) set SpeedValue = *($(SpeedValueList),+ ~($(SpeedRadioButtonIdxList),+ *($(RadioOut),1))) Debug-Output "$(STF_CONTEXTINFNAME): User Accepted Basic configuration as follows:" Debug-Output "$(STF_CONTEXTINFNAME): InterruptValue == .$(InterruptValue)." Debug-Output "$(STF_CONTEXTINFNAME): IoBaseValue == .$(IoBaseValue)." Debug-Output "$(STF_CONTEXTINFNAME): DmaChannelValue == .$(DmaChannelValue)." Debug-Output "$(STF_CONTEXTINFNAME): SlotNumberValue == .$(SlotNumberValue)." Debug-Output "$(STF_CONTEXTINFNAME): SpeedValue == .$(SpeedValue)." ; - - - - - - - - - - - - - - - ui pop 1 FreeLibrary $(hLib) else-ifstr(i) $(DLGEVENT) == "EXIT" GetAdapterAdvancedConfigFromUser = + ; ---------------------------------------------------------------- ; This is a Klooge. We're using the control ID for exit to get to ; the advanced menu, but it beats rolling our own dialog code, eh? ; ---------------------------------------------------------------- Debug-Output "$(STF_CONTEXTINFNAME): Entering Advanced..." set PacketSizeTextDlgDefault = $(PacketSizeValue) set NetAddressTextDlgDefault = $(NetAddressValue) set ProductIdTextDlgDefault = $(ProductIdValue) read-syms AdvancedDlg$(!STF_LANGUAGE) ui start "AdvancedDlg" $(hLib) ifstr(i) $(DLGEVENT) == "CONTINUE" set PacketSizeValue = *($(EditTextOut),1) set NetAddressValue = *($(EditTextOut),2) set ProductIdValue = *($(EditTextOut),3) Debug-Output "$(STF_CONTEXTINFNAME): User accepted Advanced configuration as follows:" Debug-Output "$(STF_CONTEXTINFNAME): PacketSizeValue == .$(PacketSizeValue)." Debug-Output "$(STF_CONTEXTINFNAME): NetAddressValue == .$(NetAddressValue)." Debug-Output "$(STF_CONTEXTINFNAME): ProductIdValue == .$(ProductIdValue)." endif ; ---------------------------------------------------------------- ; Done with advanced, remove our dialog and go back to the ; earlier one (mca or isa, as appropriate) ; ---------------------------------------------------------------- ui pop 1 goto GetAdpCfgFromUserOuterLoop else-ifstr(i) $(DLGEVENT) == "CANCEL" ; ---------------------------------------------------------------- ; The user cancelled, exit ; ---------------------------------------------------------------- Debug-Output "$(STF_CONTEXTINFNAME): Dialog DLGEVENT = .$(DLGEVENT). Bye." set CommonStatus = STATUS_USERCANCEL ui pop 1 FreeLibrary $(hLib) goto InstallOptionExit else ; ---------------------------------------------------------------- ; The user did something we can't understand, exit ; ---------------------------------------------------------------- Debug-Output "$(STF_CONTEXTINFNAME): Dialog DLGEVENT = .$(DLGEVENT). Bye." ui pop 1 FreeLibrary $(hLib) goto InstallOptionExit endif AddAdapterSoftwareToRegistry = + ; ---------------------------------------------------------------- ; Add Adapter Software (Driver) information to the registry ; ---------------------------------------------------------------- Ifstr(i) $(!NTN_InstallMode) == configure goto AddAdapterConfigurationToRegistry Endif ifint $(OldVersionExisted) == $(TRUE) goto AddAdapterHardwareToRegistry Endif ; ---------------------------------------------------------------- ; Add the Software Component (driver) to the registry. ; This will create keys and values as follows: ; ; \SOFTWARE\$(Manufacturer)\$(TccBaseName)\CurrentVersion ; \SOFTWARE\$(Manufacturer)\$(TccBaseName)\CurrentVersion:RefCount ; \SOFTWARE\$(Manufacturer)\$(TccBaseName)\CurrentVersion:ServiceName ; \SOFTWARE\$(Manufacturer)\$(TccBaseName)\CurrentVersion\NetRules ; \SYSTEM\CurrentControlSet\$(TccBaseName) ; \SYSTEM\CurrentControlSet\$(TccBaseName):DisplayName ; \SYSTEM\CurrentControlSet\$(TccBaseName):ErrorControl ; \SYSTEM\CurrentControlSet\$(TccBaseName):Group ; \SYSTEM\CurrentControlSet\$(TccBaseName):ImagePath ; \SYSTEM\CurrentControlSet\$(TccBaseName):Start ; \SYSTEM\CurrentControlSet\$(TccBaseName):Type ; \SYSTEM\CurrentControlSet\$(TccBaseName)\Linkage ; \SYSTEM\CurrentControlSet\$(TccBaseName)\Linkage\Disabled ; \SYSTEM\CurrentControlSet\$(TccBaseName)\Parameters ; \SYSTEM\CurrentControlSet\$(TccBaseName)\Security ; \SYSTEM\CurrentControlSet\$(TccBaseName)\Security:Security ; ---------------------------------------------------------------- Shell $(UtilityInf), + AddSoftwareComponent, + $(Manufacturer), + $(TccBaseName), + $(TccBaseName), + $(SoftwareTitle), + $(STF_CONTEXTINFNAME), + $(SoftwareImage), + "kernel", "NDIS", {}, "",+ $(NetEventDLL) Set OEM_ABANDON_SOFTWARE = TRUE ifint $($ShellCode) != $(!SHELL_CODE_OK) set ShellErrorSection = UtilityInf:AddSoftwareComponent goto ShellCodeError endif set RegistryErrorIndex = $($R0) Ifstr(i) $(RegistryErrorIndex) != NO_ERROR EndWait Debug-Output $(STF_CONTEXTINFNAME)": AddAdapterSoftware - add component error" CloseRegKey $($R1) CloseRegKey $($R2) CloseRegKey $($R3) CloseRegKey $($R4) CloseRegKey $($R5) goto FatalRegistryError endif ; ---------------------------------------------------------------- ; Save the keys we'll use later and close the unused ones ; ---------------------------------------------------------------- Set Key_SoftwareProduct = $($R1) Set Key_SoftwareNetRules = $($R2) CloseRegKey $($R3) CloseRegKey $($R4) CloseRegKey $($R5) ; ---------------------------------------------------------------- ; Add the Software Product Information values to the registry key ; \SOFTWARE\$(Manufacturer)\$(TccBaseName)\CurrentVersion ; ---------------------------------------------------------------- set NewValueList = {+ {SoftwareType, $(NoTitle), $(!REG_VT_SZ), $(SoftwareType)},+ {MajorVersion, $(NoTitle), $(!REG_VT_DWORD), $(SoftwareMajorVersion)},+ {MinorVersion, $(NoTitle), $(!REG_VT_DWORD), $(SoftwareMinorVersion)},+ {Title, $(NoTitle), $(!REG_VT_SZ), $(SoftwareTitle)},+ {Description, $(NoTitle), $(!REG_VT_SZ), $(SoftwareDescription)},+ {ServiceName, $(NoTitle), $(!REG_VT_SZ), $(TccBaseName)},+ {InstallDate, $(NoTitle), $(!REG_VT_DWORD), *($(Now),1)}+ } Shell $(UtilityInf), AddValueList, $(Key_SoftwareProduct), $(NewValueList) ifint $($ShellCode) != $(!SHELL_CODE_OK) set ShellErrorSection = UtilityInf:AddValueList goto ShellCodeError endif Set RegistryErrorIndex = $($R0) Ifstr(i) $(RegistryErrorIndex) != NO_ERROR EndWait Debug-Output $(STF_CONTEXTINFNAME)": AddAdapterSoftware - add value list error" CloseRegKey $(Key_SoftwareProduct) CloseRegKey $(Key_SoftwareNetRules) goto FatalRegistryError endif ; ---------------------------------------------------------------- ; Add the Software Product Net Rules values to the registry key ; \SOFTWARE\$(Manufacturer)\$(TccBaseName)\CurrentVersion\NetRules ; ---------------------------------------------------------------- Set NewValueList = {+ {type, $(NoTitle), $(!REG_VT_SZ), $(NetRuleSoftwareType)},+ {use, $(NoTitle), $(!REG_VT_SZ), $(NetRuleSoftwareUse)}, + {bindform, $(NoTitle), $(!REG_VT_SZ), $(NetRuleSoftwareBindForm)}, + {class, $(NoTitle), $(!REG_VT_MULTI_SZ), $(NetRuleSoftwareClass)}, + {bindable, $(NoTitle), $(!REG_VT_MULTI_SZ), $(NetRuleSoftwareBindable)}, + {InfOption, $(NoTitle), $(!REG_VT_SZ), $(TccOption)}+ } Shell $(UtilityInf), AddValueList, $(Key_SoftwareNetRules), $(NewValueList) ifint $($ShellCode) != $(!SHELL_CODE_OK) set ShellErrorSection = UtilityInf:AddValueList goto ShellCodeError endif Set RegistryErrorIndex = $($R0) CloseRegKey $(Key_SoftwareProduct) CloseRegKey $(Key_SoftwareNetRules) Ifstr(i) $(RegistryErrorIndex) != NO_ERROR EndWait Debug-Output $(STF_CONTEXTINFNAME)": AddAdapterSoftware - add NetRule error" goto FatalRegistryError endif AddAdapterHardwareToRegistry = + ; ---------------------------------------------------------------- ; Add the Hardware Component (net card) the registry ; This will create keys and values as follows: ; ; \SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\... ; ...\$(AdapterNumber) ; ...\$(AdapterNumber)\NetRules ; \SYSTEM\CurrentControlSet\Services\... ; ...\$(ProductHdwrName)$(AdapterNumber) ; ...\$(ProductHdwrName)$(AdapterNumber)\Linkage ; ...\$(ProductHdwrName)$(AdapterNumber)\Linkage\Disabled ; ---------------------------------------------------------------- Shell $(UtilityInf), + AddHardwareComponent, + $(ProductHdwrName), + $(STF_CONTEXTINFNAME), + $(KeyName_Software) ifint $($R4) != -1 Set OEM_ABANDON_OPTIONS = >($(OEM_ABANDON_OPTIONS), $(!NTN_SoftwareBase)"\Microsoft\Windows NT\CurrentVersion\NetworkCards\"$($R4)) endif ifint $($ShellCode) != $(!SHELL_CODE_OK) set ShellErrorSection = UtilityInf:AddHardwareComponent goto ShellCodeError endif set RegistryErrorIndex = $($R0) Ifstr(i) $(RegistryErrorIndex) != NO_ERROR EndWait Debug-Output $(STF_CONTEXTINFNAME)": AddAdapterHardware - add component error" CloseRegKey $($R1) CloseRegKey $($R2) CloseRegKey $($R3) goto FatalRegistryError endif set Key_HardwareNetRules = $($R2) set Key_HardwareParameters = $($R3) set AdapterNumber = $($R4) ; ---------------------------------------------------------------- ; Add the Hardware Product Information to the registry key ; \SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\... ; ...\$(AdapterNumber) ; ---------------------------------------------------------------- set NewValueList = {+ {Manufacturer, $(NoTitle), $(!REG_VT_SZ), $(Manufacturer)},+ {Title, $(NoTitle), $(!REG_VT_SZ), "["$($R4)"] "$(ProductHdwrTitle)},+ {Description, $(NoTitle), $(!REG_VT_SZ), $(ProductHdwrDesc)},+ {ProductName, $(NoTitle), $(!REG_VT_SZ), $(ProductHdwrName)},+ {ServiceName, $(NoTitle), $(!REG_VT_SZ), $($R5)},+ {InstallDate, $(NoTitle), $(!REG_VT_DWORD), *($(Now),1)}+ } Shell $(UtilityInf), AddValueList, $($R1), $(NewValueList) ifint $($ShellCode) != $(!SHELL_CODE_OK) set ShellErrorSection = UtilityInf:AddValueList goto ShellCodeError endif CloseRegKey $($R1) set TempProdName = """"$(ProductHdwrName)$(AdapterNumber)"""" set TempBindForm = $(TempProdName)$(NetRuleHardwareBindForm) ; ---------------------------------------------------------------- ; Add the Hardware Net Rules to the registry key ; \SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\... ; ...\$(AdapterNumber)\NetRules ; ---------------------------------------------------------------- set NewValueList = {+ {type, $(NoTitle), $(!REG_VT_SZ), $(NetRuleHardwareType)},+ {bindform, $(NoTitle), $(!REG_VT_SZ), $(TempBindForm)}, + {class, $(NoTitle), $(!REG_VT_MULTI_SZ), $(NetRuleHardwareClass)}, + {InfOption, $(NoTitle), $(!REG_VT_SZ), $(TccOption)}+ } Shell $(UtilityInf), AddValueList, $(Key_HardwareNetRules), $(NewValueList) ifint $($ShellCode) != $(!SHELL_CODE_OK) set ShellErrorSection = UtilityInf:AddValueList goto ShellCodeError endif set RegistryErrorIndex = $($R0) Ifstr(i) $(RegistryErrorIndex) != NO_ERROR EndWait Debug-Output $(STF_CONTEXTINFNAME)": AddAdapterHardware - add NetRule error" CloseRegKey $(Key_HardwareParameters) CloseRegKey $(Key_HardwareNetRules) goto FatalRegistryError endif CloseRegKey $(Key_HardwareNetRules) goto AddAdapterConfigurationToRegistry AddAdapterConfigurationToRegistry = + Debug-Output "$(STF_CONTEXTINFNAME): Entering AddAdapterConfigurationToRegistry" Shell $(UtilityInf),GetBusTypeDialog,$(ProductHardware$(Option)Description) $(BusInterfaceType) $(BusNumber) ifint $($ShellCode) != $(!SHELL_CODE_OK) Debug-Output "ShellCode error." goto ShellCodeError endif set BusTypeValue = $($R1) set BusNumber = $($R2) ;davidlao ; Shell $(UtilityInf), GetBusTypeNum ; ifint $($ShellCode) != $(!SHELL_CODE_OK) ; set ShellErrorSection = UtilityInf:GetBusTypeNum ; goto ShellCodeError ; endif ; set BusTypeValue = $($R1) ; ---------------------------------------------------------------- ; Add the Hardware configuration information to the registry key ; \SYSTEM\CurrentControlSet\Services\$(ProductHdwrName)$(AdapterNumber) ; ---------------------------------------------------------------- ; - - - - - - - - - - - - - - - ; NOTE: Adapter Adaptation area ; - - - - - - - - - - - - - - - ifstr(i) $(TccOption) == "tc$4046e" set NewValueList = {+ {AdapterType, $(NoTitle), $(!REG_VT_DWORD), $(AdapterTypeValue)},+ {BusType, $(NoTitle), $(!REG_VT_DWORD), $(BusTypeValue)},+ {BusNumber, $(NoTitle), $(!REG_VT_DWORD), 0},+ {MediaType, $(NoTitle), $(!REG_VT_DWORD), 2},+ {McaPosId, $(NoTitle), $(!REG_VT_DWORD), $(McaPosIdValue)},+ {NetAddress, $(NoTitle), $(!REG_VT_SZ), $(NetAddressValue)},+ {PacketSize, $(NoTitle), $(!REG_VT_DWORD), $(PacketSizeValue)},+ {ProductId, $(NoTitle), $(!REG_VT_SZ), $(ProductIdValue)},+ {SlotNumber, $(NoTitle), $(!REG_VT_DWORD), $(SlotNumberValue)},+ {Speed, $(NoTitle), $(!REG_VT_DWORD), $(SpeedValue)}+ } else set NewValueList = {+ {AdapterType, $(NoTitle), $(!REG_VT_DWORD), $(AdapterTypeValue)},+ {BusType, $(NoTitle), $(!REG_VT_DWORD), $(BusTypeValue)},+ {BusNumber, $(NoTitle), $(!REG_VT_DWORD), 0},+ {MediaType, $(NoTitle), $(!REG_VT_DWORD), 2},+ {DmaChannel, $(NoTitle), $(!REG_VT_DWORD), $(DmaChannelValue)},+ {Interrupt, $(NoTitle), $(!REG_VT_DWORD), $(InterruptValue)},+ {IoBase, $(NoTitle), $(!REG_VT_DWORD), $(IoBaseValue)},+ {NetAddress, $(NoTitle), $(!REG_VT_SZ), $(NetAddressValue)},+ {PacketSize, $(NoTitle), $(!REG_VT_DWORD), $(PacketSizeValue)},+ {ProductId, $(NoTitle), $(!REG_VT_SZ), $(ProductIdValue)},+ {Speed, $(NoTitle), $(!REG_VT_DWORD), $(SpeedValue)}+ } endif ; - - - - - - - - - - - - - - - Shell $(UtilityInf), AddValueList, $(Key_HardwareParameters), $(NewValueList) CloseRegKey $(Key_HardwareParameters) ifint $($ShellCode) != $(!SHELL_CODE_OK) set ShellErrorSection = UtilityInf:AddValueList goto ShellCodeError endif set RegistryErrorIndex = $($R0) Ifstr(i) $(RegistryErrorIndex) != NO_ERROR Debug-Output $(STF_CONTEXTINFNAME)": AddAdapterConfiguration - add value list error" goto FatalRegistryError endif EndWait goto ProcessSuccessExit CheckAdapterBinding =+ Debug-Output "$(STF_CONTEXTINFNAME): Entering CheckAdapterBinding" set Error = "CheckAdapterBinding: not required for this adapter" goto FatalError RemoveAdapterFromRegistry = + ; ---------------------------------------------------------------- ; Remove the adapter by removing the hardware component. ; ---------------------------------------------------------------- ; When the registry reference count reaches zero, the software ; component will automatically be removed. If the last adapter ; is being removed from the registry, delete the associated ; file as well. Lastly, remove the \SOFTWARE\$(Manufacturer) key ; if it's empty. ; ---------------------------------------------------------------- Debug-Output "$(STF_CONTEXTINFNAME): Entering RemoveAdapterFromRegistry" OpenRegKey $(!REG_H_LOCAL) "" $(KeyName_Software) $(MAXIMUM_ALLOWED) KeyToReferenceCount Ifstr $(KeyToReferenceCount) == "" Debug-Output "$(STF_CONTEXTINFNAME): Could not open Software Base Key" set RefCountBeforeRemove = 2 goto InstallOptionExit endif GetRegValue $(KeyToReferenceCount),"RefCount", RefCountInfo set RefCountBeforeRemove = *($(RefCountInfo), 4) CloseRegKey $(KeyToReferenceCount) Debug-Output "$(STF_CONTEXTINFNAME): Removing Hardware Component" Shell $(UtilityInf), + RemoveHardwareComponent, + $(Manufacturer), + $(TccBaseName), + $(!NTN_RegBase) ifint $($ShellCode) != $(!SHELL_CODE_OK) set ShellErrorSection = UtilityInf:RemoveHardwareComponent goto ShellCodeError endif Ifstr(i) $($R0) != NO_ERROR Ifstr(i) $($R0) != REF_COUNT_NOT_ZERO goto FatalRegistryError endif endif ifint $(RefCountBeforeRemove) == 1 OpenRegKey $(!REG_H_LOCAL) "" $(KeyName_SoftwareRoot) $(MAXIMUM_ALLOWED) Key_SoftwareRoot EnumRegKey $(Key_SoftwareRoot) KeyList EnumRegValue $(Key_SoftwareRoot) ValueList CloseRegKey $(Key_SoftwareRoot) ifstr $(KeyList) == "{}" ifstr $(ValueList) == "{}" OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_SoftwareBase) $(MAXIMUM_ALLOWED) Key_SoftwareBase Debug-Output "$(STF_CONTEXTINFNAME): Deleting Registry Key .$(Key_SoftwareBase).\.$(Manufacturer)." DeleteRegKey $(Key_SoftwareBase) $(Manufacturer) CloseRegKey $(Key_SoftwareBase) endif endif install Remove-Option endif goto InstallOptionExit UpgradeSoftware = + Debug-Output "$(STF_CONTEXTINFNAME): Entering UpgradeSoftware" ifstr(i) $(KeyName_Software) == $(!NTN_RegBase) OpenRegKey $(!REG_H_LOCAL) "" $(KeyName_Software) $(MAXIMUM_ALLOWED) Key_Product Ifstr $(Key_Product) != $(Key_Null) GetRegValue $(Key_Product),"MajorVersion", VersionInfo set Version = *($(VersionInfo), 4) Shell $(UtilityInf), GetInfFileNameFromRegistry, $(Key_Product) ifint $($ShellCode) != $(!SHELL_CODE_OK) set ShellErrorSection = UtilityInf:GetFileNameFromRegistry goto ShellCodeError endif set !UG_Filename = $($R0) ifstr(i) $(!UG_Filename) != "" install "Install-Update" ifstr(i) $(STF_INSTALL_OUTCOME) != STF_SUCCESS goto FatalError endif endif SetRegValue $(Key_Product) {MajorVersion, $(NoTitle), $(!REG_VT_SZ), $(SoftwareMajorVersion)} SetRegValue $(Key_Product) {MinorVersion, $(NoTitle), $(!REG_VT_SZ), $(SoftwareMinorVersion)} ifint $(Version) != $(SoftwareVersion) Debug-Output "$(STF_CONTEXTINFNAME): Version .$(Version). != SoftwareVersion .$(SoftwareVersion)." endif CloseRegKey $(Key_Product) else goto FatalRegistryError endif else OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_RegBase) $(MAXIMUM_ALLOWED) NetworkCardKey Ifstr(i) $(NetworkCardKey) != $(Key_Null) GetRegValue $(NetworkCardKey),"ServiceName", ServiceNameInfo set ServiceName = *($(ServiceNameInfo), 4) OpenRegKey $(NetworkCardKey) "" "NetRules" $(MAXIMUM_ALLOWED) NetRuleKey Ifstr(i) $(NetRuleKey) != $(Key_Null) Debug-Output "$(STF_CONTEXTINFNAME): NetRuleKey .$(NetRuleKey). != Key_Null .$(Key_Null)." else goto FatalRegistryError endif CloseRegKey $(NetRules) CloseRegKey $(NetworkCardKey) else goto FatalRegistryError endif OpenRegKey $(!REG_H_LOCAL) + "" $(!NTN_ServiceBase)"\"$(ServiceName) + $(MAXIMUM_ALLOWED) + ServiceKey Ifstr(i) $(ServiceKey) != $(Key_Null) CloseRegKey $(ServiceKey) else goto FatalRegistryError endif endif goto InstallOptionExit ProcessSuccessExit = + goto InstallOptionExit ProcessAbandonInstall = + ForListDo $(OEM_ABANDON_OPTIONS) Shell $(UtilityInf), + RemoveHardwareComponent, + $(Manufacturer), + $(TccBaseName), + $($) ifint $($ShellCode) != $(!SHELL_CODE_OK) set ShellErrorSection = UtilityInf:RemoveHardwareComponent goto ShellCodeError endif set RegistryErrorIndex = $($R0) Ifstr(i) $(RegistryErrorIndex) != NO_ERROR goto FatalRegistryError endif EndForListDo Ifstr(i) $(OEM_ABANDON_SOFTWARE) == TRUE Shell $(UtilityInf), + RemoveSoftwareComponent, + $(Manufacturer), + $(TccBaseName), + FALSE ifint $($ShellCode) != $(!SHELL_CODE_OK) set ShellErrorSection = UtilityInf:RemoveSoftwareComponent goto ShellCodeError endif set RegistryErrorIndex = $($R0) Ifstr(i) $(RegistryErrorIndex) != NO_ERROR goto FatalRegistryError endif endif goto InstallOptionExit ProcessWarningMessage = + Shell $(SubroutineInf) SetupMessage, $(!STF_LANGUAGE), "WARNING", $(Error) ifint $($ShellCode) != $(!SHELL_CODE_OK) set ShellErrorSection = SubroutineInf:SetupMessage goto ShellCodeError endif ifstr(i) $($R1) == "OK" goto $(to) else-ifstr(i) $($R1) == "CANCEL" goto $(from) else goto "InstallOptionExit" endif SetNonFatalInfo = + Set CommonStatus = STATUS_USERCANCEL Set Severity = STATUS goto ProcessNonFatalMessage ProcessNonFatalMessage = + ifstr(i) $(Error) == "" Set Severity = NONFATAL Shell $(UtilityInf) RegistryErrorString "SETUP_FAIL" ifint $($ShellCode) != $(!SHELL_CODE_OK) set ShellErrorSection = UtilityInf:RegistryErrorString goto ShellCodeError endif set Error = $($R0) endif Shell $(SubroutineInf) SetupMessage, $(!STF_LANGUAGE), $(Severity), $(Error) ifint $($ShellCode) != $(!SHELL_CODE_OK) set ShellErrorSection = SubroutineInf:SetupMessage goto ShellCodeError endif ifstr(i) $($R1) == "OK" goto $(from) else goto "InstallOptionExit" endif FatalRegistryError = + Shell $(UtilityInf) RegistryErrorString $(RegistryErrorIndex) ifint $($ShellCode) != $(!SHELL_CODE_OK) set ShellErrorSection = UtilityInf:RegistryErrorString goto ShellCodeError endif set Error = $($R0) goto FatalError FatalError = + ifstr(i) $(Error) == "" Shell $(UtilityInf) RegistryErrorString "SETUP_FAIL" ifint $($ShellCode) != $(!SHELL_CODE_OK) set ShellErrorSection = UtilityInf:RegistryErrorString goto ShellCodeError endif set Error = $($R0) endif Shell $(SubroutineInf) SetupMessage, $(!STF_LANGUAGE), "FATAL", $(Error) ifint $($ShellCode) != $(!SHELL_CODE_OK) set ShellErrorSection = UtilityInf:SetupMessage goto ShellCodeError endif goto SetFailedStatusAndExit ShellCodeError = + Debug-Output $(STF_CONTEXTINFNAME)": Shell error, $(ShellErrorSection)" set DlgType = "MessageBox" set STF_MB_TITLE = "Error: "$(FunctionTitle) set STF_MB_TEXT = "Shell Code Error" set STF_MB_TYPE = 1 set STF_MB_ICON = 3 set STF_MB_DEF = 1 ui start "Error Message" goto SetFailedStatusAndExit SetFailedStatusAndExit = + set CommonStatus = STATUS_FAILED ifstr(i) $(OEM_ABANDON_ON) == TRUE set OEM_ABANDON_ON = FALSE goto ProcessAbandonInstall endif goto InstallOptionExit InstallOptionExit = + Return $(CommonStatus)