📄 oemsetup.inf
字号:
; of lists:{{bus0,slot0,func0},{bus1,slot1,func1},...{busN,slotN,funcN}}
;-----------------------------------------------------------------------
; Since multiple Vendor/DeviceIDs are supported, call GetPCIInformation
; for each set, building the bus/slot/function list.
Set BusDevFuncList = {}
ForListDo ^(VendorDeviceIDs, 1)
Shell "Utility.Inf", GetPCIInformation, *($($), 1), *($($), 2)
ForListDo $($R0)
Set BusDevFuncList = >($(BusDevFuncList), $($))
EndForListDo
EndForListDo
; Check for an empty adapter list and abort with error if empty.
IfStr $(BusDevFuncList) == {}
Shell "Subroutn.Inf" SetupMessage $(!STF_LANGUAGE) "STATUS" +
"No supported adapters were found in the system. "+
"Install the adapter in another PCI slot and try again."
return STATUS_USERCANCEL
EndIf
;-----------------------------------------------------------------------
; Search through the bus/slot/function list looking for previously
; installed adapters that match. A match is found by searching through
; the installed miniport instances and matching on bus/slot. If a match
; is found, assume that the adapter is already setup and remove the
; adapter from the bus/slot/function list.
;-----------------------------------------------------------------------
Set NewBusDevFuncList = {}
ForListDo $(BusDevFuncList)
Set BusNumber = *($($), 1)
Set SlotNumber = *($($), 2)
Shell "Utility.Inf", IsNetCardAlreadyInstalled, $(BusNumber), +
$(SlotNumber), "", "", "YES"
IfStr $($R1) != "YES"
Set NewBusDevFuncList = >($(NewBusDevFuncList), $($))
EndIf
EndForListDo
Set BusDevFuncList = $(NewBusDevFuncList)
; Check for an empty adapter list. If the list is empty, it means that
; all detected adapters already have a NetworkCard entry in the
; registry, or some rogue NetworkCard is pretending to be the software
; key for this adapter. In any case, we're done. The user can remove
; the rogue NetworkCard and reinstall with this software if they want.
IfStr $(BusDevFuncList) == {}
return STATUS_USERCANCEL
EndIf
;-----------------------------------------------------------------------
; Create the software component (service) if it doesn't already exist.
;-----------------------------------------------------------------------
OpenRegKey $(!REG_H_LOCAL) "" $(SoftwareKeyName) $(!REG_KEY_READ) hKey
IfStr $(hKey) == ""
; The software component didn't exist...Let's create it.
Shell "Utility.Inf", AddSoftwareComponent, $(Manufacturer), +
$(SoftwareName), $(SoftwareName), $(SoftwareTitle), +
$(STF_CONTEXTINFNAME), $(SoftwareImagePath), "kernel", +
"NDIS", {}, "", $(NetEventDLL)
Set hKeyCurrentVersion = $($R1)
Set hKeyNetRule = $($R2)
; Insert other details to the software component's current
; version key.
Shell "Utility.Inf", AddValueList, $(hKeyCurrentVersion), +
^(SoftwareCurrentVersion, 1)
; Insert the net bind rules.
Shell "Utility.Inf", AddValueList, $(hKeyNetRule), +
^(SoftwareNetBindRules, 1)
EndIf
CloseRegKey $(hKey)
;-----------------------------------------------------------------------
; For each detected adapter, create a hardware component (miniport
; instance).
;-----------------------------------------------------------------------
ForListDo $(BusDevFuncList)
; Get Bus and Slot from PCI device information
Set BusNumber = *($($), 1)
Set SlotNumber = *($($), 2)
; Create a new miniport instance, AKA hardware component.
Shell "Utility.Inf", AddHardwareComponent, $(SoftwareName), +
$(STF_CONTEXTINFNAME), $(SoftwareKeyName)
Set hKeyNetCard = $($R1)
Set hKeyNetRule = $($R2)
Set hKeyParameter = $($R3)
Set AdapterNumber = $($R4)
; Insert other details to the NetworkCard key.
Shell "Utility.Inf", AddValueList, $(hKeyNetCard), +
^(NetworkCardValues, 1)
; Add the miniport parameters.
Shell "Utility.Inf", AddValueList, $(hKeyParameter), +
^(MiniportParameters, 1)
; Insert the net bind rules.
Shell "Utility.Inf", AddValueList, $(hKeyNetRule), +
^(HardwareNetBindRules, 1)
; Install unattended answer file overrides if running in
; unattended mode.
IfStr(i) $(!STF_GUI_UNATTENDED) == "YES"
Shell "Utility.Inf", AddDefaultNetCardParameters, +
$(hKeyParameter)
EndIf
EndForListDo
;-----------------------------------------------------------------------
; Install the driver.
;-----------------------------------------------------------------------
Install "Install-Option"
return STATUS_SUCCESSFUL
;*******************************************************************************
; Called when user clicks the Remove button on the NCPA to remove an
; adapter.
;*******************************************************************************
RemoveAdapter = +
;-----------------------------------------------------------------------
; Delete the hardware component (miniport instance). If this is the
; last instance, the software component will be deleted as well.
;-----------------------------------------------------------------------
Shell "Utility.Inf", RemoveHardwareComponent, $(Manufacturer), +
$(SoftwareName), $(!NTN_RegBase)
return STATUS_SUCCESSFUL
;*******************************************************************************
; Called when user clicks the Properties button on the NCPA to modify adapter's
; settings.
;*******************************************************************************
ConfigureAdapter = +
;* Retrieve paramters from the registry
OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_RegBase) $(!REG_KEY_READ) hNetCardKey
Set AdapterDisplayName = ""
IfStr(i) $(hNetCardKey) != $(KeyNull)
;* Get ServiceName and AdapterTitle
GetRegValue $(hNetCardKey) "ServiceName" ServiceInfo
Set ServiceName = *($(ServiceInfo),4)
GetRegValue $(hNetCardKey) "Title" AdapterTitle
Set AdapterDisplayName = *($(AdapterTitle), 4)
OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_ServiceBase)"\"$(ServiceName)"\Parameters" $(!REG_KEY_READ) hParamKey
IfStr(i) $(hParamKey) != $(KeyNull)
;* Setup the current value for Speed and Duplex
GetRegValue $(hParamKey) "Speed" SpeedInfo
Set SpeedIndex = *($(SpeedInfo),4)
IfInt $(SpeedIndex) == 10 ; 10 Mbps
Set SpeedValue = $(Speed10Mbps)
Else-IfInt $(SpeedIndex) == 100 ; 100 Mbps
Set SpeedValue = $(Speed100Mbps)
Else
Set SpeedValue = $(AutoDetect)
EndIf
GetRegValue $(hParamKey) "ForceDpx" DuplexInfo
Set DuplexIndex = *($(DuplexInfo), 4)
IfInt $(DuplexIndex) == "1"
Set DuplexValue = $(HalfDuplex)
Else-IfInt $(DuplexIndex) == "2"
Set DuplexValue = $(FullDuplex)
Else
Set DuplexValue = $(AutoDetect)
EndIf
CloseRegKey $(hParamKey)
Else
Set SpeedValue = 0
Set DuplexValue = 0
EndIf
CloseRegKey $(hNetCardKey)
EndIf
IfStr(i) AdapterDisplayName == ""
Set AdapterDisplayName = $(HardwareTitle)
EndIf
read-syms AdapterPropertiesDlg
ui start "AdapterProperties"
IfStr(i) $(DLGEVENT) == "CONTINUE"
Set SpeedValue = $(Combo1Out)
Set DuplexValue = $(Combo2Out);
;*** Save Speed setting
IfStr $(SpeedValue) == $(AutoDetect)
Set CommonSpeed = 0
Else-IfStr $(SpeedValue) == $(Speed10Mbps)
Set CommonSpeed = 10
Else
Set CommonSpeed = 100
EndIf
;*** Save Duplex setting
IfStr $(DuplexValue) == $(AutoDetect)
Set CommonDuplex = 0
Else-IfStr $(DuplexValue) == $(HalfDuplex)
Set CommonDuplex = 1
Else
Set CommonDuplex = 2
EndIf
Else
return STATUS_USERCANCEL
EndIf
; *** Save paramters to the registry
OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_RegBase) $(!REG_KEY_READ) hNetCardKey
IfStr(i) $(hNetCardKey) != $(KeyNull)
GetRegValue $(hNetCardKey) "ServiceName" ServiceInfo
Set ServiceName = *($(ServiceInfo),4)
OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_ServiceBase)"\"$(ServiceName)"\Parameters" $(!REG_KEY_WRITE) hParamKey
IfStr(i) $(hParamKey) != $(KeyNull)
SetRegValue $(hParamKey) {Speed, $(NoTitle), $(!REG_VT_DWORD), $(CommonSpeed)}
SetRegValue $(hParamKey) {ForceDpx, $(NoTitle), $(!REG_VT_DWORD), $(CommonDuplex)}
CloseRegKey $(hParamKey)
EndIf
CloseRegKey $(hNetCardKey)
Else
return STATUS_USERCANCEL
EndIf
return STATUS_SUCCESSFUL
;*******************************************************************************
; Something's busted! The "To" and "From" variables were set to this entry
; point, so any fatal errors would be trapped here.
;*******************************************************************************
FatalError = +
return STATUS_FAILED
;*******************************************************************************
; Install the Option files.
;*******************************************************************************
[Install-Option]
Set STF_VITAL = 1
Set STF_OVERWRITE = "VERIFYSOURCEOLDER"
AddSectionFilesToCopyList "Files-Option-Drivers-NT4" $(SrcDir) +
$(!STF_WINDOWSSYSPATH)\drivers
Set !STF_NCPA_FLUSH_COPYLIST = 1
CopyFilesInCopyList
Exit
[Files-Option-Drivers-NT4]
1, $(NDIS4Src), SIZE=50000, RENAME=$(NDIS4)
;*******************************************************************************
; Adapter Settings Dialog
;*******************************************************************************
[AdapterPropertiesDlg]
DlgType = "RadioCombination"
DlgTemplate = "NE2000"
Caption = $(AdapterDisplayName)" Settings"
Label1 = "Speed"
Label2 = "Duplex"
Combo1List = $(SpeedList)
Combo1Out = $(SpeedValue)
Combo2List = $(DuplexList)
Combo2Out = $(DuplexValue)
ComboListItemsIn = {Combo1List, Combo2List}
ComboListItemsOut = {Combo1Out, Combo2Out}
CBOptionsGreyed = {}
NotifyFields = {NO, NO}
EditTextIn = ""
EditTextLim = ""
HelpContext = ""
Continue = "&OK"
Cancel = "&Cancel"
Help = "&Help"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -