Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1040 lines
30 KiB

;--------------------------------------
; HARDWARE OPTION CLASSES WE UNDERSTAND
;--------------------------------------
[Options]
;
Computer = cpt
Video = vio
Layout = lay
Language = lng
Printer = prn
Sound = snd
Driver = drv
NetAdapter = nad
NetDriver = ndr
NetTransport = nxp
NetService = nsv
Network = nwk
NetProvider = npr
[OemOptionFiles]
OemFiles = {} ? $(!LIBHANDLE) FindFileInstances $(!STF_WINDOWSSYSPATH)"\oem"$(Abb)"*.inf"
[DetectFileTime]
FileDateTime = {"0","0"} ? $(!LIBHANDLE) GetFileLastWriteTime $(!STF_WINDOWSSYSPATH)"\"$(FileDateTimeName)
;-----------------------------------------------------------------------
;
; ROUTINE: ReturnOemOptions
;
; DESCRIPTION: This routine finds out if an OEM file representing
; the option exists in the windows sytem directory
; and returns the options represented in the INF.
;
; INPUTS: $0: Language to use
; $1: Option Type (Computer|Video|...)
;
; OUTPUTS: $R0: STATUS: STATUS_SUCCESSFUL |
; STATUS_FAILED
;
; $R1: OemOptionList: This is of form:
; { {Oemfile1, Option1List, Option1TextList},
; {Oemfile2, Option2List, Option2TextList},
; ...
; }
;
;
;------------------------------------------------------------------------
[ReturnOemOptions]
;
; Initialize
;
set Status = STATUS_FAILED
set OemOptionList = {}
set FromNetwork = $($2)
set AllChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789."
set Numerals = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" }
set Abb = #(Options, $($1), 1)
read-syms OemOptionFiles
detect OemOptionFiles
ifcontains(i) "oemnadzz.inf" in $(OemFiles)
;
; Put oemnadzz.inf at the beginning
;
set newList = {"oemnadzz.inf"}
ForListDo $(OemFiles)
ifstr(i) $($) != "oemnadzz.inf"
set newList = >($(newList),$($))
endif
EndForListDo
;set newList = >($(newList),"oemnadzz.inf")
set OemFiles = $(newList)
endif
debug-output $(OemFiles)
set TotalOptions = {}
ForListDo $(OemFiles)
set fExclude = ""
Split-String $($) $(AllChars) InfNameChars
ifcontains(i) *($(InfNameChars), 7) in $(Numerals)
; exclude if from network and a numerical item (thus a real net Oem)
;
set fExclude = $(FromNetwork)
endif
ifstr(i) $(fExclude) == ""
set OemFileName = $(!STF_WINDOWSSYSPATH)"\"$($)
ifstr(i) $(FromNetwork) == ""
shell "", GetOptionsFromINF $($0) $($1) $(OemFileName)
else
shell "", GetNetworkOptionsFromINF $($0) $($1) $(OemFileName)
endif
set CurrentInf = $($)
ifstr(i) $($R0) == STATUS_SUCCESSFUL
set Index = 0
set ReturnOption = $($R1)
set ReturnOptionText = $($R2)
ForListDo $(ReturnOption)
set-add Index = $(Index), 1
ifcontains(i) $($) not-in $(TotalOptions)
set OemOptionList = >($(OemOptionList), {$(CurrentInf), $($), *($(ReturnOptionText),$(Index))})
set TotalOptions = >($(TotalOptions), $($))
endif
EndForListDo
endif
endif
EndForListDo
set Status = STATUS_SUCCESSFUL
finish_GetCurrentOemOptions = +
Return $(Status) $(OemOptionList)
;-----------------------------------------------------------------------
;
; ROUTINE: GetNetworkOptionsFromINF
;
; DESCRIPTION: This routine checks to see if the specified file exists
; and if it is of the right type and gets option info from
; the INF. It is called for network option only.
;
; The different between this function and GetOptionsFromINF
; is that it will elminiate the dupliication of the same
; option.
;
; INPUTS: $0: Language To use
; $1: OptionType
; $2: OptionFileName
;
; OUTPUTS: $R0: STATUS: STATUS_SUCCESSFUL |
; STATUS_INFNOTFOUND |
; STATUS_FAILED
;
; $R1: OptionList
; $R2: OPtionTextList
;
;------------------------------------------------------------------------
[GetNetworkOptionsFromINF]
;
; Initialize
;
set Status = STATUS_FAILED
set OptionList = {}
set OptionTextList = {}
set FileToCheck = $($2)
install Install-SeeIfFileIsPresent
ifstr(i) $(STATUS) != "YES"
set Status = STATUS_INFNOTFOUND
goto finish_GetNetworkOptionsFromINF
endif
;
; See if we have cached this information into the Registry.
;
Shell "" GetOptionsFromRegistry $($1) $($2)
ifstr(i) $($R0) == "STATUS_SUCCESSFUL"
set OptionList = $($R1)
set OptionTextList = $($R2)
set Status = STATUS_SUCCESSFUL
goto finish_GetNetworkOptionsFromINF
endif
;
; Check that the INF represents the option we are looking for
;
shell $($2) Identify
ifstr(i) $($R0) == "STATUS_SUCCESSFUL"
ifstr(i) $($R1) == $($1)
set OptionList = {}
set OptionTextList = {}
forlistdo $(!STF_BUSTYPELIST)
shell $($2) ReturnOptions $($0) $($)
ifstr(i) $($R0) == STATUS_SUCCESSFUL
set Index = 0
set ReturnOption = $($R1)
set ReturnOptionText = $($R2)
ForListDo $(ReturnOption)
set-add Index = $(Index), 1
ifstr(i) $(OptionList) == {}
set OptionList = {$($)}
set OptionTextList = {*($(ReturnOptionText),$(Index))}
else
ifcontains(i) $($) not-in $(OptionList)
set OptionList = >($(OptionList),$($))
set OptionTextList = >($(OptionTextList),*($(ReturnOptionText),$(Index)))
endif
endif
EndForListDo
set Status = STATUS_SUCCESSFUL
endif
endforlistdo
ifstr(i) $(OptionList) != ""
Shell "" SetOptionsIntoRegistry $($1) $($2) $(OptionList) $(OptionTextList)
endif
endif
endif
finish_GetNetworkOptionsFromINF = +
Return $(Status) $(OptionList) $(OptionTextList)
;-----------------------------------------------------------------------
;
; ROUTINE: GetOptionsFromINF
;
; DESCRIPTION: This routine checks to see if the specified file exists
; and if it is of the right type and gets option info from
; the INF.
;
; INPUTS: $0: Language To use
; $1: OptionType
; $2: OptionFileName
;
; OUTPUTS: $R0: STATUS: STATUS_SUCCESSFUL |
; STATUS_INFNOTFOUND |
; STATUS_FAILED
;
; $R1: OptionList
; $R2: OPtionTextList
;
;------------------------------------------------------------------------
[GetOptionsFromINF]
;
; Initialize
;
set Status = STATUS_FAILED
set OptionList = {}
set OptionTextList = {}
set FileToCheck = $($2)
install Install-SeeIfFileIsPresent
ifstr(i) $(STATUS) != "YES"
set Status = STATUS_INFNOTFOUND
goto finish_GetOptionsFromINF
endif
;
; See if we have cached this information into the Registry.
;
Shell "" GetOptionsFromRegistry $($1) $($2)
ifstr(i) $($R0) == "STATUS_SUCCESSFUL"
set OptionList = $($R1)
set OptionTextList = $($R2)
set Status = STATUS_SUCCESSFUL
goto finish_GetOptionsFromINF
endif
;
; Check that the INF represents the option we are looking for
;
shell $($2) Identify
ifstr(i) $($R0) == "STATUS_SUCCESSFUL"
ifstr(i) $($R1) == $($1)
set OptionList = ""
shell $($2) ReturnOptions $($0) $($)
ifstr(i) $($R0) == STATUS_SUCCESSFUL
set OptionList = $($R1)
set OptionTextList = $($R2)
set Status = STATUS_SUCCESSFUL
endif
ifstr(i) $(OptionList) != ""
Shell "" SetOptionsIntoRegistry $($1) $($2) $(OptionList) $(OptionTextList)
endif
endif
endif
finish_GetOptionsFromINF = +
Return $(Status) $(OptionList) $(OptionTextList)
;-----------------------------------------------------------------------
;
; ROUTINE: GetNewOEMOption
;
; DESCRIPTION: This routine prompts the user for a new OEM file, presents
; the options supported and if the user chooses one of these
; copies over the INF to the windows system directory.
;
; INPUTS: $0: Language to use
; $1: OemOptionList
; $2: OptionType
; $3: OptDisketteSource
; $4: Optional Dialog Text
;
; OUTPUTS: $R0: STATUS: STATUS_SUCCESSFUL |
; STATUS_USERCANCEL |
; STATUS_FAILED |
;
; $R1: NewOemOptionList
; $R2: OemOptionChosen
; $R3: OemOptionChosenText
; $R4: OEMINFSource
;
;------------------------------------------------------------------------
[GetNewOEMOption]
;
set Status = STATUS_FAILED
set Option = $($2)
set OptDisketteSrc = $($3)
set OptionalDlgText = $($4)
set OptDiskette = #(OptionDiskettes$($0), $($2), 1)
set InfName1 = "OEMSETUP.INF"
set InfName2 = "OEMSETNT.INF"
set Abb = #(Options, $(Option), 1)
set NewOemOptionList = $($1)
set OptionChosen = ""
set OptionChosenText = ""
;
; Prompt the user for the diskette containing the INF
;
ask_dodiskette = +
;
; Reset the INF name to the standard default
;
set InfName = $(InfName1)
shell "" DoDiskette $($0) $(OptDiskette) $(OptDisketteSrc)
set Status = STATUS_FAILED
ifstr(i) $($R0) == STATUS_USERCANCEL
set Status = STATUS_USERCANCEL
goto finish_GetOEMOption
else-ifstr(i) $($R0) == STATUS_FAILED
goto finish_GetOEMOption
endif
set OptDisketteSrc = $($R1)
;
; Check that the Diskette contains an INF we are looking for
;
ask_inf_retry = +
FlushInf $(InfName)
LibraryProcedure FileToCheck, $(!LIBHANDLE), AppendBackSlash $(OptDisketteSrc)
set FileToCheck = $(FileToCheck)$(InfName)
install Install-SeeIfFileIsPresent
set OemSetupFilePath = $(FileToCheck)
set NfError = 1
ifstr(i) $(STATUS) == YES
set NfError = 2
;
; Check that the INF represents the option we are looking for
;
shell $(OemSetupFilePath) Identify
ifstr(i) $($R0) == "STATUS_SUCCESSFUL"
ifstr(i) $($R1) == $(Option)
ForListDo $(!STF_BUSTYPELIST)
shell $(OemSetupFilePath) ReturnOptions $($0) $($)
ifstr(i) $($R0) == STATUS_SUCCESSFUL
set OemList = $($R1)
set OemTextList = $($R2)
goto asksingleselection
endif
EndForListDo
endif
endif
endif
;
; The file isn't in NT format; try the alternate name.
;
ifstr(i) $(InfName) == $(InfName1)
Set InfName = $(InfName2)
goto ask_inf_retry
endif
read-syms NonFatalError$(NfError)$($0)
shell "subroutn.inf" SetupMessage $($0) "NONFATAL" $(NonFatal)
goto ask_dodiskette
;
; Present the OEM options to the user. Let the user select. If
; the user selects to cancel, don't change anything, just return
;
asksingleselection = +
shell "" DoSingleOption $(OemList) $(OemTextList) $(OptDiskette) $(OptionalDlgText)
ifstr(i) $($R0) == STATUS_FAILED
set Status = STATUS_FAILED
goto finish_GetOEMOption
else-ifstr(i) $($R0) == STATUS_USERCANCEL
set Status = STATUS_USERCANCEL
goto finish_GetOEMOption
endif
set OptionChosen = $($R1)
set OptionChosenText = $($R2)
;
; Determine the file name to use to copy over. First see if the INF
; is a duplicate
;
set Duplicate = FALSE
ForListDo $($1)
ifstr(i) *($($), 2) == $(OemList)
set OemFileName = *($($), 1)
set Duplicate = TRUE
FlushInf $(OemFileName)
goto copyinf
endif
EndForListDo
;
; Not a duplicate, we need to copy it under a unique name.
;
set Num = 0
nextinf = +
ifint $(Num) < 99
set OemFileName = "oem"$(Abb)$(Num)".inf"
set FileToCheck = $(!STF_WINDOWSSYSPATH)"\"$(OemFileName)
install Install-SeeIfFileIsPresent
ifstr(i) $(STATUS) == "YES"
set-add Num = $(Num) 1
goto nextinf
else
goto copyinf
endif
endif
goto finish_GetOEMOption
copyinf = +
;
; copy the INF over to the windows system directory
;
set OemSrc = $(OemSetupFilePath)
set OemDst = $(!STF_WINDOWSSYSPATH)"\"$(OemFileName)
install Install-OemINF
;
; form the new oem option list
;
ifstr(i) $(Duplicate) == TRUE
else
set NewOemOptionList = >($(NewOemOptionList), {$(OemFileName), $(OemList), $(OemTextList)})
endif
set Status = STATUS_SUCCESSFUL
finish_GetOEMOption = +
FlushInf $(InfName)
Return $(Status) $(NewOemOptionList) $(OptionChosen) $(OptionChosenText) $(OptDisketteSrc)
;-----------------------------------------------------------------------
;
; ROUTINE: GetNewOEMMultiOption
;
; DESCRIPTION: This routine prompts the user for a new OEM file, presents
; the options supported and if the user chooses one of these
; copies over the INF to the windows system directory.
;
; INPUTS: $0: Language to use
; $1: OemOptionList
; $2: OptionTypeList; e.g., { NetService, NetTransport }
; $3: OptDisketteSource
; $4: (Optional) Dialog Text
;
; OUTPUTS: $R0: STATUS: STATUS_SUCCESSFUL |
; STATUS_USERCANCEL |
; STATUS_FAILED |
;
; $R1: NewOemOptionList
; $R2: OemOptionChosen
; $R3: OemOptionChosenText
; $R4: OEMINFSource
;
;------------------------------------------------------------------------
[GetNewOEMMultiOption]
Debug-Output $(STF_CONTEXTINFNAME)": GetNewOEMMultiOption called"
set Status = STATUS_FAILED
set OptionType = ""
set OptionTypeList = $($2)
set OptDisketteSrc = $($3)
set OptionalDlgText = $($4)
set InfName1 = "OEMSETUP.INF"
set InfName2 = "OEMSETNT.INF"
read-syms OptionDisketteMulti$($0)
Set TypeNames = ^(Options,0)
Set TypeAbbs = ^(Options,1)
set NewOemOptionList = $($1)
set OptionChosen = ""
set OptionChosenText = ""
;
; Prompt the user for the diskette containing the INF
;
m_ask_dodiskette = +
Debug-Output $(STF_CONTEXTINFNAME)": GetNewOEMMultiOption shelling DoDiskette"
;
; Reset the INF name to the standard default
;
set InfName = $(InfName1)
shell "" DoDiskette $($0) $(OptDiskette) $(OptDisketteSrc)
set Status = STATUS_FAILED
ifstr(i) $($R0) == STATUS_USERCANCEL
set Status = STATUS_USERCANCEL
goto m_finish_GetOEMOption
else-ifstr(i) $($R0) == STATUS_FAILED
goto m_finish_GetOEMOption
endif
set OptDisketteSrc = $($R1)
;
; Check that the Diskette contains an INF we are looking for
;
m_ask_inf_retry = +
FlushInf $(InfName)
LibraryProcedure FileToCheck, $(!LIBHANDLE), AppendBackSlash $(OptDisketteSrc)
set FileToCheck = $(FileToCheck)$(InfName)
install Install-SeeIfFileIsPresent
set OemSetupFilePath = $(FileToCheck)
set NfError = 1
ifstr(i) $(STATUS) == YES
set NfError = 2
;
; Check that the INF represents the option we are looking for
;
shell $(OemSetupFilePath) Identify
ifstr(i) $($R0) == "STATUS_SUCCESSFUL"
ifcontains(i) $($R1) in $(OptionTypeList)
Set OptionType = $($R1)
ForListDo $(!STF_BUSTYPELIST)
shell $(OemSetupFilePath) ReturnOptions $($0) $($)
ifstr(i) $($R0) == STATUS_SUCCESSFUL
set OemList = $($R1)
set OemTextList = $($R2)
goto m_asksingleselection
endif
EndForListDo
endif
endif
endif
;
; The file wasn't found or isn't in NT format; try the alternate name.
;
ifstr(i) $(InfName) == $(InfName1)
Set InfName = $(InfName2)
goto m_ask_inf_retry
endif
read-syms NonFatalError$(NfError)$($0)
shell "subroutn.inf" SetupMessage $($0) "NONFATAL" $(NonFatal)
goto m_ask_dodiskette
;
; Present the OEM options to the user. Let the user select. If
; the user selects to cancel, don't change anything, just return
;
m_asksingleselection = +
shell "" DoSingleOption $(OemList) $(OemTextList) $(OptDiskette) $(OptionalDlgText)
ifstr(i) $($R0) == STATUS_FAILED
set Status = STATUS_FAILED
goto m_finish_GetOEMOption
else-ifstr(i) $($R0) == STATUS_USERCANCEL
set Status = STATUS_USERCANCEL
goto m_finish_GetOEMOption
endif
set OptionChosen = $($R1)
set OptionChosenText = $($R2)
;
; Determine the file name to use to copy over. First see if the INF
; is a duplicate
;
set Duplicate = FALSE
ForListDo $($1)
ifstr(i) *($($), 2) == $(OemList)
set OemFileName = *($($), 1)
set Duplicate = TRUE
FlushInf $(OemFileName)
goto m_copyinf
endif
EndForListDo
;
; Not a duplicate, we need to copy it under a unique name.
;
set Num = 0
Set Abb = *($(TypeAbbs),~($(TypeNames),$(OptionType)))
m_nextinf = +
ifint $(Num) < 99
set OemFileName = "oem"$(Abb)$(Num)".inf"
Debug-Output "OTHER.INF: Checking winsyspath for "$(OemFileName)
set FileToCheck = $(!STF_WINDOWSSYSPATH)"\"$(OemFileName)
install Install-SeeIfFileIsPresent
ifstr(i) $(STATUS) == "YES"
set-add Num = $(Num) 1
goto m_nextinf
else
goto m_copyinf
endif
endif
goto m_finish_GetOEMOption
m_copyinf = +
;
; copy the INF over to the windows system directory
;
set OemSrc = $(OemSetupFilePath)
set OemDst = $(!STF_WINDOWSSYSPATH)"\"$(OemFileName)
install Install-OemINF
;
; form the new oem option list
;
ifstr(i) $(Duplicate) == TRUE
else
set NewOemOptionList = >($(NewOemOptionList), {$(OemFileName), $(OemList), $(OemTextList)})
endif
set Status = STATUS_SUCCESSFUL
m_finish_GetOEMOption = +
FlushInf $(InfName)
Return $(Status) $(NewOemOptionList) $(OptionChosen) $(OptionChosenText) $(OptDisketteSrc)
;-----------------------------------------------------------------------
;
; ROUTINE: DoDiskette
;
; DESCRIPTION: This routine prompts the OEM for the source of the OEM
; Diskette
;
; INPUTS: $0: Language
; $1: OemDiskette
; $2: OemDisketteSrc
;
; OUTPUTS: $R0: STATUS: STATUS_SUCCESSFUL |
; STATUS_USERCANCEL |
; STATUS_FAILED
;
; $R1: Diskette Src
;
;------------------------------------------------------------------------
[DoDiskette]
;
;
set Status = STATUS_FAILED
set OemDiskette = $($1)
set OemDisketteSrc = $($2)
Debug-Output $(STF_CONTEXTINFNAME)": DoDiskette called"
read-syms DisketteDlg$($0)
ui start "Diskette"
ifstr(i) $(DLGEVENT) == "CONTINUE"
set OemDisketteSrc = $(EditTextOut)
ui pop 1
set Status = STATUS_SUCCESSFUL
goto finish_dodiskette
else-ifstr(i) $(DLGEVENT) == "BACK"
ui pop 1
set Status = STATUS_USERCANCEL
goto finish_dodiskette
else
ui pop 1
goto finish_dodiskette
endif
finish_dodiskette = +
Return $(Status) $(OemDisketteSrc)
;-----------------------------------------------------------------------
;
; ROUTINE: DoSingleOption
;
; DESCRIPTION: This routine presents the OEM Options to the user to
; get a selectiom
;
; INPUTS: $0: OptionList
; $1: OptionTextList
; $2: OptionTypeText
; $3: (Optional) dialog text
;
; OUTPUTS: $R0: STATUS: STATUS_SUCCESSFUL |
; STATUS_USERCANCEL |
; STATUS_FAILED
;
; $R1: OptionChosen
; $R2: OptionChosenText
;
;------------------------------------------------------------------------
[DoSingleOption]
set Status = STATUS_FAILED
set OemOptionChosen = ""
set OemOptionChosenText = ""
set OemOptionList = $($0)
set OemOptionTextList = $($1)
set OemOptionTypeText = $($2)
read-syms OemSingleOptionDlg$(!STF_LANGUAGE)
ifstr(i) $($3) != ""
set DlgText = $($3)
endif
ui start "Diskette"
ifstr(i) $(DLGEVENT) == "CONTINUE"
ui pop 1
ifstr(i) $(ListItemsOut) == ""
set Status = STATUS_USERCANCEL
else
set OemOptionChosenText = $(ListItemsOut)
set OemOptionChosen = *($($0), ~($(ListItemsIn), $(ListItemsOut)))
set Status = STATUS_SUCCESSFUL
endif
goto finish_dosingleoption
else-ifstr(i) $(DLGEVENT) == "BACK"
ui pop 1
set Status = STATUS_USERCANCEL
goto finish_dosingleoption
else
ui pop 1
set Status = STATUS_FAILED
goto finish_dosingleoption
endif
finish_dosingleoption = +
Return $(Status) $(OemOptionChosen) $(OemOptionChosenText)
;-----------------------------------------------------------------------
;
; ROUTINE: GetOptionsFromRegistry
;
; DESCRIPTION: Extract previously cached INF file option information
; from the Registry.
;
;
; INPUTS: $0: OptionType
; $1: OptionFileName
;
; OUTPUTS: $R0: STATUS: STATUS_SUCCESSFUL |
; STATUS_FAILED
;
; $R1: OptionList
; $R2: OptionTextList
;
; COMMENTARY:
; The Registry information was stored like this:
;
; HKEY_LOCAL_MACHINE\System\Setup\InfOptions\<filename>
;
; The Registry information is stored like this:
;
; HKEY_LOCAL_MACHINE\Software\Microsoft\Ncpa\InfOptions\<filename>
;
; DateLow = REG_DWORD <lsw of numeric timestamp of file>
;
; # Keys named <optionType>.<bus ID>
;
; NetDriver.ISA
; OptionList = REG_MULTI_SZ <list of options>
; OptionTextList = REG_MULTI_SZ <list of text options>
;
;------------------------------------------------------------------------
[GetOptionsFromRegistry]
Set InfType = $($0)
Set InfFullName = $($1)
Set Status = STATUS_FAILED
Set OptionList = {}
Set OptionTextList = {}
Set KeyInf = ""
Set KeyType = ""
Set RegLastError = $(!REG_ERROR_SUCCESS)
;
; See if there's a bus type defined. If not,don't even try.
;
Ifstr(i) $(!STF_BUSTYPE) == ""
goto finish_getregoptions
Endif
;
; Extract the file name from the tail of the full path\name
;
Split-String $(InfFullName) "\" NameInfo
QueryListSize NameInfoListSize $(NameInfo)
Set InfName = *($(NameInfo),$(NameInfoListSize))
Set KeyName = "Software\Microsoft\Ncpa\InfOptions\"$(InfName)
OpenRegKey $(!REG_H_LOCAL) "" $(KeyName) $(!REG_KEY_READ) KeyInf
Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
goto finish_getregoptions
Endif
;
; Key exists. Validate the file date/time stamp.
;
Set FileDateTimeName = $(InfName)
Detect DetectFileTime
Set TimeLow = *($(FileDateTime),1)
Ifint $(TimeLow) == 0
goto finish_getregoptions
Endif
GetRegValue $(KeyInf) DateLow ValueRegTimeLow
Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
goto finish_getregoptions
Endif
Set RegTimeLow = *($(ValueRegTimeLow),4)
Ifint $(TimeLow) != $(RegTimeLow)
goto finish_getregoptions
Endif
;
; Date time stamp matches. See if there's info
; for the given option type on the current bus
;
ForListDo $(!STF_BUSTYPELIST)
Set TypeKeyName = $(InfType)"."$($)
OpenRegKey $(KeyInf) "" $(TypeKeyName) $(!REG_KEY_READ) KeyType
ifint $(RegLastError) == $(!REG_ERROR_SUCCESS )
goto findit
endif
EndForListDo
Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
;
; No option data for this type.
; Not supported by this INF.
;
Set Status = STATUS_SUCCESSFUL
goto finish_getregoptions
Endif
findit = +
;
; Fetch the option list and the option text list.
;
GetRegValue $(KeyType) OptionList ValueOptionList
Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
goto finish_getregoptions
Endif
Set OptionList = *($(ValueOptionList),4)
GetRegValue $(KeyType) OptionTextList ValueOptionTextList
Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
goto finish_getregoptions
Endif
Set OptionTextList = *($(ValueOptionTextList),4)
Set Status = STATUS_SUCCESSFUL
finish_getregoptions =+
Ifstr(i) $(Status) != STATUS_SUCCESSFUL
Set OptionList = {}
Set OptionTextList = {}
Endif
Ifstr(i) $(KeyType) != ""
CloseRegKey $(KeyType)
Endif
Ifstr(i) $(KeyInf) != ""
CloseRegKey $(KeyInf)
Endif
return $(Status) $(OptionList) $(OptionTextList)
;-----------------------------------------------------------------------
;
; ROUTINE: SetOptionsIntoRegistry
;
; DESCRIPTION: Update cached INF file option information into
; the Registry.
;
;
; INPUTS: $0: OptionType
; $1: OptionFileName
; $2: OptionList
; $3: OptionTextList
;
; OUTPUTS: $R0: STATUS: STATUS_SUCCESSFUL |
; STATUS_USERCANCEL |
; STATUS_FAILED
;
;
;------------------------------------------------------------------------
[SetOptionsIntoRegistry]
Debug-Output "OTHER.INF: SetOptionsIntoRegistry - Entry "$($0)", "$($1)", "$($2)", "$($3)
Set OptionType = $($0)
Set InfFullName = $($1)
Set OptionList = $($2)
Set OptionTextList = $($3)
Set MaskAllAccess = 33554432
Set NoTitle = 0
Set RegLastError = $(!REG_ERROR_SUCCESS)
Set Status = STATUS_FAILED
Set KeyInf = ""
;
; See if there's a bus type defined. If not,don't even try.
;
Ifstr(i) $(!STF_BUSTYPE) == ""
goto finish_setregoptions
Endif
;
; Extract the file name from the tail of the full path\name
;
Split-String $(InfFullName) "\" NameInfo
QueryListSize NameInfoListSize $(NameInfo)
Set InfName = *($(NameInfo),$(NameInfoListSize))
Set KeyInfName = "SOFTWARE\Microsoft\Ncpa\InfOptions\"$(InfName)
Set KeyOptName = $(OptionType)"."$(!STF_BUSTYPE)
;
; Get the time stamp for this file; check for failure.
;
Set FileDateTimeName = $(InfName)
Detect DetectFileTime
Set TimeLsw = *($(FileDateTime),1)
Ifint $(TimeLsw) == 0
goto finish_setregoptions
Endif
;
; Create or open the key for this INF.
;
Set KeyInfo = {$(KeyInfName),$(NoTitle),""}
OpenRegKey $(!REG_H_LOCAL) "" $(KeyInfName) $(MaskAllAccess) KeyInf
ifstr(i) $(KeyInf) == ""
CreateRegKey $(!REG_H_LOCAL) $(KeyInfo) "" $(MaskAllAccess) "" KeyInf
Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
Debug-Output "OTHER.INF: SetOptionsIntoRegistry - Reg Error"$(KeyInfo)
goto finish_setregoptions
Endif
Endif
;
; Create or open the key for this type
;
Set KeyInfo = {$(KeyOptName),$(NoTitle),""}
OpenRegKey $(KeyInf) "" $(KeyOptName) $(MaskAllAccess) KeyType
ifstr(i) $(KeyType) == ""
CreateRegKey $(KeyInf) $(KeyInfo) "" $(MaskAllAccess) "" KeyType
Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
Debug-Output "OTHER.INF: SetOptionsIntoRegistry - Reg Error"$(KeyInfo)
goto finish_setregoptions
Endif
Endif
;
; Write the values. First the time stamp (under the INF key),
; then the lists (under the type.bustype sub-key).
;
Set ValueInfo = {DateLow, $(NoTitle), $(!REG_VT_DWORD), $(TimeLsw)}
SetRegValue $(KeyInf) $(ValueInfo)
Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
goto finish_setregoptions
Endif
Set ValueInfo = {OptionList, $(NoTitle), $(!REG_VT_MULTI_SZ), $(OptionList)}
SetRegValue $(KeyType) $(ValueInfo)
Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
goto finish_setregoptions
Endif
Set ValueInfo = {OptionTextList, $(NoTitle), $(!REG_VT_MULTI_SZ), $(OptionTextList)}
SetRegValue $(KeyType) $(ValueInfo)
Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
goto finish_setregoptions
Endif
Set Status = STATUS_SUCCESSFUL
finish_setregoptions =+
Ifstr(i) $(KeyType) != ""
CloseRegKey $(KeyType)
;
; If the update operation failed, nuke the type.bustype key and values
;
Ifstr(i) $(Status) != STATUS_SUCCESSFUL
DeleteRegTree $(KeyOptName)
Endif
Endif
Ifstr(i) $(KeyInf) != ""
CloseRegKey $(KeyInf)
Endif
Debug-Output "OTHER.INF: SetOptionsIntoRegistry - Exit "$(Status)
return $(Status)
[Install-SeeIfFileIsPresent]
LibraryProcedure STATUS,$(!LIBHANDLE), CheckFileExistance $(FileToCheck)
exit
[Install-OemINF]
LibraryProcedure STATUS,$(!NCPA_HANDLE), CopySingleFile $(!STF_HWND) $(OemSrc) $(OemDst)
exit