📄 oemsetup.inf
字号:
;
; For each real LAN adapter the transport is bound to...
;
Set AddedNewVirtualAdapter = "No"
ForListDo $(CardList)
Debug-Output "ImSamp: Processing "$($)"..."
;
; Check if this is a virtual adapter that WE created.
;
Set RegKey = $(!NTN_ServiceBase)"\"$($)"\Parameters\Signature"
Debug-Output "ImSamp: pre-check: about to open "$(RegKey)
OpenRegKey $(!REG_H_LOCAL) "" $(RegKey) $(MAXIMUM_ALLOWED) ImSampKey
ifstr(i) $(ImSampKey) == ""
Debug-Output "ImSamp: WILL bind to "$($)
else
Debug-Output "ImSamp: Skipping bind to ourselves "$($)
goto continueCardList
endif
;
; Open/Create the protocol specific key under the adapter's parameters key
;
Set RegKey = $(!NTN_ServiceBase)"\"$($)"\Parameters\"$(TransportProductSoftwareName)
Debug-Output "ImSAmp: about to open "$(RegKey)
OpenRegKey $(!REG_H_LOCAL) "" $(RegKey) $(MAXIMUM_ALLOWED) ImSampKey
ifstr(i) $(ImSampKey) == ""
Debug-Output "ImSamp: creating "$(TransportProductSoftwareName)" key under the adapter"
CreateRegKey $(!REG_H_LOCAL) {$(RegKey),$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" ImSampParamsKey
else
Debug-Output "ImSamp: Have processed "$($)" already"
CloseRegKey $(ImSampKey)
goto continueCardList
endif
ifstr(i) $(ImSampParamsKey) == ""
Debug-Output "ImSamp: Failed to open/create the \Parameters\"$(TransportProductSoftwareName)" key under the adapter"
goto fatalRegistry
endif
;
; Now add a virtual hardware component to represent the ELAN
;
Debug-Output "ImSamp: Adding Adapter Hardware Component to Registry"
Shell $(UtilityInf), AddHardwareComponent, +
$(AdapterProductHardwareName), +
$(STF_CONTEXTINFNAME), +
$(AdapterProductKeyName)
ifint $($ShellCode) != $(!SHELL_CODE_OK)
Debug-Output "ImSamp: ShellCode error."
goto ShellCodeError
endif
set RegistryErrorIndex = $($R0)
Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
Debug-Output "ImSamp: Failed to Add Hardware Component"
CloseRegKey $($R1)
CloseRegKey $($R2)
CloseRegKey $($R3)
goto fatalRegistry
endif
set KeyParameters = $($R3)
set KeyAdapterRules = $($R2)
set AdapterNumber = $($R4)
set NewValueList = {{Manufacturer,$(NoTitle),$(!REG_VT_SZ),$(Manufacturer)},+
{Title,$(NoTitle),$(!REG_VT_SZ),"["$($R4)"] "$(ProductHardwareTitle)},+
{Description,$(NoTitle),$(!REG_VT_SZ),$(ProductHardwareDescription)},+
{ProductName,$(NoTitle),$(!REG_VT_SZ),$(AdapterProductHardwareName)},+
{ServiceName,$(NoTitle),$(!REG_VT_SZ),$($R5)},+
{InstallDate,$(NoTitle),$(!REG_VT_DWORD),*($(Now),1)}}
Shell $(UtilityInf), AddValueList, $($R1), $(NewValueList)
ifint $($ShellCode) != $(!SHELL_CODE_OK)
Debug-Output "ImSamp: ShellCode error"
goto ShellCodeError
endif
CloseRegKey $($R1)
set TempProdName = """"$(AdapterProductHardwareName)$(AdapterNumber)""""
set TempBindForm = $(TempProdName)$(AdapterNetRuleHardwareBindForm)
set NewValueList = {{type,$(NoTitle),$(!REG_VT_SZ),$(AdapterNetRuleHardwareType)},+
{bindform,$(NoTitle),$(!REG_VT_SZ),$(TempBindForm)}, +
{class,$(NoTitle),$(!REG_VT_MULTI_SZ),$(AdapterNetRuleHardwareClass)}, +
{InfOption,$(NoTitle),$(!REG_VT_SZ),$(Option)}}
Shell $(UtilityInf), AddValueList, $(KeyAdapterRules), $(NewValueList)
ifint $($ShellCode) != $(!SHELL_CODE_OK)
Debug-Output "ImSamp: ShellCode error."
goto ShellCodeError
endif
set RegistryErrorIndex = $($R0)
Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
EndWait
Debug-Output "ImSamp: Registry error: add value list."
CloseRegKey $(KeyParameters)
CloseRegKey $(KeyAdapterRules)
goto fatalregistry
endif
CloseRegKey $(KeyAdapterRules)
Set NewValueList = {{MediaType,$(NoTitle),$(!REG_VT_DWORD),1},+
{InstanceNumber,$(NoTitle),$(!REG_VT_DWORD),$(AdapterNumber) }}
Shell $(UtilityInf), AddValueList, $(KeyParameters), $(NewValueList)
; Create a key of the type
; ImSampMP2\Parameters\Signature\
;
Set SigRegKey = $(!NTN_ServiceBase)"\"$(AdapterProductHardwareName)$(AdapterNumber)"\Parameters\Signature"
Debug-Output "SigRegKey is "$(SigRegKey)
CreateRegKey $(!REG_H_LOCAL) {$(SigRegKey),$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" SigKey
ifstr(i) $(SigKey) == ""
Debug-Output "Failed to create "$(SigRegKey)
endif
CloseRegKey $(KeyParameters)
ifint $($ShellCode) != $(!SHELL_CODE_OK)
Debug-Output "ImSamp: ShellCode error."
goto ShellCodeError
endif
set RegistryErrorIndex = $($R0)
Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
Debug-Output "ImSamp: Registry error: Add value list"
goto fatalregistry
endif
;
; Note that a virtual adapter was added.
;
Set AddedNewVirtualAdapter = "Yes"
;
;
ifstr(i) $(ImSampParamsKey) != ""
set NewValueList = {{Device,$(NoTitle),$(!REG_VT_SZ),$(AdapterProductHardwareName)$(AdapterNumber)},+
{AdapterNumber,$(NoTitle),$(!REG_VT_SZ),$(AdapterNumber)}, +
{InstanceNumber,$(NoTitle),$(!REG_VT_DWORD), $(AdapterNumber) } }
Shell $(UtilityInf), AddValueList, $(ImSampParamsKey), $(NewValueList)
CloseRegKey $(ImSampParamsKey)
endif
continueCardList = +
EndForListDo
;
; If we added a virtual adapter, tell NCPA to review bindings
; again after this completes.
;
ifstr(i) $(AddedNewVirtualAdapter) == "Yes"
Set RegKey = $(!NTN_SoftwareBase)"\Microsoft\NCPA\CurrentVersion"
OpenRegKey $(!REG_H_LOCAL) "" $(RegKey) $(MAXIMUM_ALLOWED) NcpaKey
ifstr(i) $(NcpaKey) != ""
SetRegValue $(NcpaKey) {"BindRestart",$(NoTitle),$(!REG_VT_DWORD),1}
Debug-Output "ImSamp: set BindRestart to 1 in "$(RegKey)
CloseRegKey $(NcpaKey)
else
Debug-Output "ImSamp: failed to open "$(RegKey)
endif
endif
endif
goto successful
deinstall = +
ifstr(i) $(!NTN_RegBase) != $(TransportProductKeyName)
set Error = "To uninstall this adapter, remove '"$(TransportProductSoftwareDescription)"' from Protocols"
set from = end
goto nonfatalinfo
endif
;
; Build a list of real LAN adapters that the transport is bound to
;
OpenRegKey $(!REG_H_LOCAL) "" $(TransportLinkageKeyName) $(MAXIMUM_ALLOWED) TransportLinkageKey
ifstr(i) $(TransportLinkageKey) != ""
GetRegValue $(TransportLinkageKey) "Bind" BindList
Debug-Output "ImSamp: Remove: BindList: "$(BindList)
Set Binding = *($(BindList),4)
Debug-Output "ImSamp: Remove: Binding: "$(Binding)
CloseRegKey $(TransportLinkageKey)
else
Debug-Output "ImSamp: failed to open key "$(TransportLinkageKeyName)
goto skipRemoveBindings
endif
set CardList = {}
set CreateCardList = {}
ForListDo $(Binding)
Split-String $($), "\", BindInfo
QueryListSize BindListSize $(BindInfo)
set CardName = *($(BindInfo),$(BindListSize))
Debug-Output "ImSamp: Remove: Cardname: "$(CardName)
ifstr(i) $(CardList) == {}
set CardList = {$(CardName)}
else
set CardList = >($(CardList),$(CardName))
endif
EndForListDo
Debug-Output "ImSamp: Cardlist: "$(CardList)
;
; For each real LAN adapter in the list...
;
ForListDo $(CardList)
;
; Open the params key
;
Set RegKey = $(!NTN_ServiceBase)"\"$($)"\Parameters\"$(TransportProductSoftwareName)
OpenRegKey $(!REG_H_LOCAL) "" $(RegKey) $(MAXIMUM_ALLOWED) ParamsKey
ifstr(i) $(ParamsKey) != ""
;
; get the adapter number
;
GetRegValue $(ParamsKey) "AdapterNumber" AdapterNoValue
CloseRegKey $(ParamsKey)
Set AdapterNo = *($(AdapterNoValue),4)
;
; Remove the virtual hardware component that represents the ELAN.
; This will remove the adapter software component as well.
;
Set AdapterRegBase = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\"$(AdapterNo)
Debug-Output "ImSAmp: removing adapter number "$(AdapterNo)" RegBase "$(AdapterRegBase)
Shell $(UtilityInf), RemoveHardwareComponent, $(Manufacturer), +
$(AdapterProductSoftwareName), $(AdapterRegBase)
ifint $($ShellCode) != $(!SHELL_CODE_OK)
Debug-Output "ImSamp: ShellCode error"
goto ShellCodeError
endif
;
; delete the whole ImSamp transport specific key from the real LAN adapter
;
Set RegKey = $(!NTN_ServiceBase)"\"$($)"\Parameters"
Debug-Output "ImSamp: Deleting protocol specific key from LAN adapter"
Debug-Output "ImSamp: Key is "$(RegKey)
OpenRegKey $(!REG_H_LOCAL) "" $(RegKey) $(MAXIMUM_ALLOWED) ParamsKey
ifstr(i) $(ParamsKey) != ""
DeleteRegTree $(ParamsKey) $(TransportProductSoftwareName)
CloseRegKey $(ParamsKey)
else
Debug-Output "ImSamp: Failed to delete "$(RegKey)
endif
endif
continueRemoveBindings =+
EndForListDo
skipRemoveBindings =+
Debug-Output "ImSamp: Removing "$(TransportProductSoftwareName)" Software Component from Registry"
Shell $(UtilityInf), RemoveSoftwareComponent, $(Manufacturer), +
$(TransportProductSoftwareName)
; ignore errors for now
goto end
configure =+
set Error = "Configuration Not Implemented"
set from = end
goto nonfatalinfo
update = +
set Error = "Update Not Implemented, Remove and Reinstall"
set from = end
goto nonfatalinfo
successful = +
goto end
warning = +
Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), "WARNING", $(Error)
ifint $($ShellCode) != $(!SHELL_CODE_OK)
goto ShellCodeError
endif
ifstr(i) $($R1) == "OK"
goto $(to)
else-ifstr(i) $($R1) == "CANCEL"
goto $(from)
else
goto "end"
endif
nonfatalinfo = +
Set CommonStatus = STATUS_USERCANCEL
Set Severity = STATUS
goto nonfatalmsg
nonfatal = +
Set Severity = NONFATAL
goto nonfatalmsg
nonfatalmsg = +
ifstr(i) $(Error) == ""
Shell $(UtilityInf) RegistryErrorString "SETUP_FAIL"
ifint $($ShellCode) != $(!SHELL_CODE_OK)
goto ShellCodeError
endif
set Error = $($R0)
endif
Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), $(Severity), $(Error)
ifint $($ShellCode) != $(!SHELL_CODE_OK)
goto ShellCodeError
endif
ifstr(i) $($R1) == "OK"
goto $(from)
else
goto "end"
endif
fatalregistry = +
Shell $(UtilityInf) RegistryErrorString $(RegistryErrorIndex)
ifint $($ShellCode) != $(!SHELL_CODE_OK)
goto ShellCodeError
endif
set Error = $($R0)
goto fatal
fatal = +
ifstr(i) $(Error) == ""
Shell $(UtilityInf) RegistryErrorString "SETUP_FAIL"
ifint $($ShellCode) != $(!SHELL_CODE_OK)
goto ShellCodeError
endif
set Error = $($R0)
endif
Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), "FATAL", $(Error)
ifint $($ShellCode) != $(!SHELL_CODE_OK)
goto ShellCodeError
endif
goto setfailed
ShellCodeError = +
set DlgType = "MessageBox"
set STF_MB_TITLE = $(ShellCodeErrorTitle)
set STF_MB_TEXT = $(ShellCodeErrorText)
set STF_MB_TYPE = 1
set STF_MB_ICON = 3
set STF_MB_DEF = 1
ui start "Error Message"
goto setfailed
setfailed = +
set CommonStatus = STATUS_FAILED
ifstr(i) $(OEM_ABANDON_ON) == TRUE
set OEM_ABANDON_ON = FALSE
goto deinstall
endif
goto end
end = +
goto term
term = +
Return $(CommonStatus)
[StripTrailSlash]
Split-String $($0) "\" InList
QueryListSize InListSize, $(InList)
Ifint $(InListSize) <= 1
Return $($0)
Endif
Set NewString = ""
ForListDo $(InList)
ifint $(#) < $(InListSize)
Set NewString = $(NewString)$($)
else-ifstr $($) != "\"
Set NewString = $(NewString)$($)
endif
EndForListDo
Return $(NewString)
[Install-Option]
set STF_VITAL = ""
ifstr(i) $(AddCopy) == "YES"
AddSectionFilesToCopyList Files-Platform-Drivers $(PlatformDir) $(!STF_WINDOWSSYSPATH)\drivers
endif
ifstr(i) $(DoCopy) == "YES"
set !STF_NCPA_FLUSH_COPYLIST = TRUE
CopyFilesInCopyList
endif
ifstr(i) $(DoConfig) == "YES"
endif
Exit
[Install-Update]
set STF_VITAL = ""
set STF_OVERWRITE = "VERIFYSOURCEOLDER"
AddSectionFilesToCopyList Files-Platform-Drivers $(PlatformDir) $(!STF_WINDOWSSYSPATH)\drivers
AddSectionFilesToCopyList Files-Platform-Utility $(PlatformDir) $(!STF_WINDOWSSYSPATH)
AddSectionFilesToCopyList Files-Inf $(InfDir) $(!STF_WINDOWSSYSPATH)
exit
[Source Media Descriptions]
1 = "ImSamp Sample Miniport Driver Installation Disk", TAGFILE = disk1
[ProductType]
STF_PRODUCT = Winnt
[Files-Inf]
1, OEMSETUP.INF, SIZE=999, RENAME=$(!UG_Filename)
[Files-Platform-Drivers]
1, ImSamp.SYS , SIZE=999
[DialogConstantsENG]
Help = "&Help"
Exit = "Cancel"
OK = "OK"
HelpContext = ""
Continue = "Continue"
Cancel = "Cancel"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -