📄 oemsetup.inf
字号:
Shell $(UtilityInf), GetInfFileNameFromRegistry, $(ProtocolKey)
ifint $($ShellCode) != $(!SHELL_CODE_OK)
Debug-Output "ShellCode error"
goto ShellCodeError
endif
set !UG_Filename = $($R0)
install "Install-Update"
ifstr(i) $(STF_INSTALL_OUTCOME) != STF_SUCCESS
goto fatal
endif
set NewValueList = { +
{"InstallDate", $(NoTitle), $(!REG_VT_DWORD), *($(Now),1)}, +
{"MajorVersion", $(NoTitle), $(!REG_VT_DWORD), $(ProductMajorVersion)},+
{"MinorVersion", $(NoTitle), $(!REG_VT_DWORD), $(ProductMinorVersion)},+
{"OperationsSupport", $(NoTitle), $(!REG_VT_DWORD), $(NDISProtocolOperationsSupport)}+
}
Shell $(UtilityInf), AddValueList, $(ProtocolKey), $(NewValueList)
ifint $($ShellCode) != $(!SHELL_CODE_OK)
Debug-Output "VPCNetNT: ShellCode error - "$($ShellCode)
endif
set NewValueList = { +
{"InstallDate", $(NoTitle), $(!REG_VT_DWORD), *($(Now),1)}, +
{"MajorVersion", $(NoTitle), $(!REG_VT_DWORD), $(ProductMajorVersion)},+
{"MinorVersion", $(NoTitle), $(!REG_VT_DWORD), $(ProductMinorVersion)},+
{"OperationsSupport", $(NoTitle), $(!REG_VT_DWORD), $(NDISMiniportOperationsSupport)}+
}
Shell $(UtilityInf), AddValueList, $(MiniportKey), $(NewValueList)
ifint $($ShellCode) != $(!SHELL_CODE_OK)
Debug-Output "VPCNetNT: ShellCode error - "$($ShellCode)
endif
CloseRegKey $(MiniportKey)
endif
CloseRegKey $(ProtocolKey)
endif
goto ReviewBindings
; -----------------------------------------------
; RemoveSoftware
; -----------------------------------------------
RemoveSoftware = +
Debug-Output "VPCNetNT - RemoveSoftware label"
Debug-Output "VPCNetNT: --> NTN_RegBase : "$(!NTN_RegBase)
ifstr(i) $(!NTN_RegBase) != $(NDISProtocolProductKeyName)
read-syms RemoveProtocolMessageDlg$(!STF_LANGUAGE)
ui start "MessageBox"
ifstr(i) $(DLGEVENT) == "OK" ; DLGEVENT indicates button pressed
Debug-Output "VPCNetNT - user agreed"
endif
else
;; Get the current bindings
Debug-Output "VPCNetNT: Retreiving bindings in "$(NDISProtocolLinkageKeyName)
OpenRegKey $(!REG_H_LOCAL) "" $(NDISProtocolLinkageKeyName) $(MAXIMUM_ALLOWED) NDISProtocolLinkageKey
ifstr(i) $(NDISProtocolLinkageKey) == $(KeyNull)
Debug-Output "VPCNetNT: Failed to open linkage key "$(NDISProtocolLinkageKeyName)
goto fatalregistry
endif
GetRegValue $(NDISProtocolLinkageKey) "Bind" KeyValue
ifint $(RegLastError) == 0
set Bindings = *($(KeyValue), 4)
else
set Bindings = {}
endif
set DisabledBindings = {}
OpenRegKey $(NDISProtocolLinkageKey) "" "Disabled" $(MAXIMUM_ALLOWED) DisabledLinkageKey
ifstr(i) $(DisabledLinkageKey) == $(KeyNull)
Debug-Output "VPCNetNT: Failed to open disabled linkage key "$(NDISProtocolLinkageKeyName)"\Disabled"
else
GetRegValue $(DisabledLinkageKey) "Bind" KeyValue
ifint $(RegLastError) == 0
set DisabledBindings = *($(KeyValue), 4)
endif
CloseRegKey $(DisabledLinkageKey)
endif
CloseRegKey $(NDISProtocolLinkageKey)
Debug-Output "VPCNetNT: Bind : "$(Bindings)
Debug-Output "VPCNetNT: DisabledBindings : "$(DisabledBindings)
;; Parse the bindings to create a list of adapter cards
set CardList = {}
set CreateCardList = {}
ForListDo $(Bindings)
Split-String $($) "\" ValueList
QueryListSize ValueListSize $(ValueList)
set CardServiceName = *($(ValueList), $(ValueListSize))
Debug-Output "VPCNetNT: Found binding to card "$(CardServiceName)
set CardList = >($(CardList), $(CardServiceName))
EndForListDo ; $(Bindings)
ForListDo $(DisabledBindings)
Split-String $($) "\" ValueList
QueryListSize ValueListSize $(ValueList)
set CardServiceName = *($(ValueList), $(ValueListSize))
ifcontains(i) $(CardServiceName) in $(CardList)
Debug-Output "VPCNetNT: Found duplicate disabled binding to card "$(CardServiceName)
else
Debug-Output "VPCNetNT: Found disabled binding to card "$(CardServiceName)
set CardList = >($(CardList), $(CardServiceName))
endif
EndForListDo ; ($DisabledBindings)
Debug-Output "VPCNetNT: CardList == "$(CardList)
set CreatedNewAdapter = FALSE
ForListDo $(CardList)
Debug-Output "VPCNetNT: Processing "$($)"..."
set RegKeyName = $(!NTN_ServiceBase)"\"$($)"\Parameters\"$(NDISProtocolName)
OpenRegKey $(!REG_H_LOCAL) "" $(RegKeyName) $(MAXIMUM_ALLOWED) RegKey
ifstr(i) $(RegKey) == $(KeyNull)
Debug-Output "VPCNetNT: Failed to open key "$(RegKeyName)
else
;; Get the adapter number and remove the virtual adapter
GetRegValue $(RegKey) "AdapterNumber" KeyValue
set AdapterNumber = *($(KeyValue), 4)
CloseRegKey $(RegKey)
Debug-Output "VPCNetNT: Removing adapter number "$(AdapterNumber)
set AdapterRegKeyName = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\"$(AdapterNumber)
Shell $(UtilityInf), RemoveHardwareComponent, $(Manufacturer), $(AdapterName), $(AdapterRegKeyName)
ifint $($ShellCode) != $(!SHELL_CODE_OK)
Debug-Output "VPCNetNT: Failed to remove "$(AdapterRegKeyName)
else
set RegKeyName = $(!NTN_ServiceBase)"\"$($)"\Parameters"
OpenRegKey $(!REG_H_LOCAL) "" $(RegKeyName) $(MAXIMUM_ALLOWED) RegKey
ifstr(i) $(RegKey) == $(KeyNull)
Debug-Output "VPCNetNT: Failed to remove "$(RegKeyName)
else
DeleteRegTree $(RegKey) $(NDISProtocolName)
CloseRegKey $(RegKey)
endif
endif
endif
EndForListDo ; $(CardList)
;; Enable the protocol bindings to the real NIC
;; FIX ME! We should really find some way of dynamically determining
;; the protocols to disable rather than relying on a fixed list of
;; protocols.
ForListDo $(DisableProtocolsList)
Shell "", AdjustBindings, $($), $(CardList), activate
ifint $($ShellCode) != $(!SHELL_CODE_OK)
Debug-Output "VPCNetNT: AdjustBindings failed! ShellCode "$($ShellCode)
endif
EndForListDo ; $(DisableProtocolsList)
Debug-Output "VPCNetNT: Removing "$(NDISProtocolName)
Shell $(UtilityInf), RemoveSoftwareComponent, $(Manufacturer), $(NDISProtocolName)
ifint $($ShellCode) != $(!SHELL_CODE_OK)
Debug-Output "VPCNetNT: Failed to remove "$(NDISProtocolName)" - ShellCode "$($ShellCode)
endif
;; read-syms ReenableBindingsMessageDlg$(!STF_LANGUAGE)
;; ui start "MessageBox"
;; ifstr(i) $(DLGEVENT) == "OK" ; DLGEVENT indicates button pressed
;; Debug-Output "VPCNetNT - user agreed"
;; endif
endif
goto end
; -----------------------------------------------
; Install Adapter
; ----------------------------------------------
installadapter = +
Debug-Output "VPCNetNT - installadapter label"
OpenRegKey $(!REG_H_LOCAL) "" $(NDISProtocolProductKeyName) $(MAXIMUM_ALLOWED) KeyProduct
ifstr $(KeyProduct) != $(KeyNull)
CloseRegKey $(KeyProduct)
Shell $(UtilityInf), VerExistedDlg, $(NDISProtocolTitle),+
$(ProductVersion)
ifint $($ShellCode) != $(!SHELL_CODE_OK)
Debug-Output "ShellCode error: cannot get an error string."
goto ShellCodeError
endif
set CommonStatus = STATUS_USERCANCEL
goto end
endif
StartWait
ifstr(i) $(DoCopy) == "YES"
Shell $(UtilityInf), DoAskSource, $(!STF_CWDDIR), $(SrcDir) YES
Ifint $($ShellCode) != $(!SHELL_CODE_OK)
Goto ShellCodeError
Else-ifstr(i) $($R0) == STATUS_FAILED
Shell $(UtilityInf) RegistryErrorString "ASK_SOURCE_FAIL"
ifint $($ShellCode) != $(!SHELL_CODE_OK)
goto ShellCodeError
endif
set Error = $($R0)
Goto fatal
Else-ifstr(i) $($R0) == STATUS_USERCANCEL
Goto end
Endif
Set SrcDir = $($R1)
endif
Debug-Output "VPCNetNT: Installing files..."
install "Install-Option"
ifstr(i) $(STF_INSTALL_OUTCOME) != STF_SUCCESS
Shell $(UtilityInf) RegistryErrorString "UNABLE_COPY_FILE"
ifint $($ShellCode) != $(!SHELL_CODE_OK)
goto ShellCodeError
endif
set Error = $($R0)
goto fatal
endif
;; Install the NDIS Protocol interface
Debug-Output "VPCNetNT: Installing NDIS Protocol interface..."
Shell $(UtilityInf), AddSoftwareComponent, $(Manufacturer), +
$(NDISProtocolName), +
$(NDISProtocolName), +
$(NDISProtocolTitle), $(STF_CONTEXTINFNAME), +
$(NDISProtocolImagePath), "kernel", "TDI", {}, "",+
$(NetEventDLL)
set OEM_ABANDON_PROTOCOL = TRUE
ifint $($ShellCode) != $(!SHELL_CODE_OK)
Debug-Output "ShellCode error"
goto ShellCodeError
endif
set RegistryErrorIndex = $($R0)
set KeyProduct = $($R1)
Set SoftNetRulesKey = $($R2)
CloseRegKey $($R3)
CloseRegKey $($R4)
CloseRegKey $($R5)
ifstr(i) $(RegistryErrorIndex) != NO_ERROR
EndWait
Debug-Output "Registry error: add software components"
CloseRegKey $(KeyProduct)
CloseRegKey $(SoftNetRulesKey)
goto fatalregistry
endif
set NewValueList = { +
{"Description", $(NoTitle), $(!REG_VT_SZ), $(NDISProtocolDescription)},+
{"Hidden", $(NoTitle), $(!REG_VT_DWORD), $(NDISProtocolHide)},+
{"InstallDate", $(NoTitle), $(!REG_VT_DWORD), *($(Now),1)}, +
{"MajorVersion", $(NoTitle), $(!REG_VT_DWORD), $(ProductMajorVersion)},+
{"MinorVersion", $(NoTitle), $(!REG_VT_DWORD), $(ProductMinorVersion)},+
{"OperationsSupport", $(NoTitle), $(!REG_VT_DWORD), $(NDISProtocolOperationsSupport)},+
{"Review", $(NoTitle), $(!REG_VT_DWORD), $(NDISProtocolReviewBindings)},+
{"ServiceName", $(NoTitle), $(!REG_VT_SZ), $(NDISProtocolName)},+
{"SoftwareType", $(NoTitle), $(!REG_VT_SZ), "transport"},+
{"Title", $(NoTitle), $(!REG_VT_SZ), $(NDISProtocolTitle)} +
}
Shell $(UtilityInf), AddValueList, $(KeyProduct), $(NewValueList)
ifint $($ShellCode) != $(!SHELL_CODE_OK)
Debug-Output "ShellCode error."
goto ShellCodeError
endif
set RegistryErrorIndex = $($R0)
ifstr(i) $(RegistryErrorIndex) != NO_ERROR
EndWait
Debug-Output "Registry error: add value list."
CloseRegKey $(KeyProduct)
CloseRegKey $(SoftNetRulesKey)
goto fatalregistry
endif
set NewValueList = { +
{"type", $(NoTitle), $(!REG_VT_SZ), $(NetRuleNDISProtocolType)},+
{"use", $(NoTitle), $(!REG_VT_SZ), $(NetRuleNDISProtocolUse)}, +
{"bindform", $(NoTitle), $(!REG_VT_SZ), $(NetRuleNDISProtocolBindForm)}, +
{"class", $(NoTitle), $(!REG_VT_MULTI_SZ),$(NetRuleNDISProtocolClass)}, +
{"bindable", $(NoTitle), $(!REG_VT_MULTI_SZ),$(NetRuleNDISProtocolBindable)}, +
{"InfOption",$(NoTitle), $(!REG_VT_SZ), $(Option)} +
}
Shell $(UtilityInf), AddValueList, $(SoftNetRulesKey), $(NewValueList)
ifint $($ShellCode) != $(!SHELL_CODE_OK)
Debug-Output "ShellCode error."
goto ShellCodeError
endif
set RegistryErrorIndex = $($R0)
CloseRegKey $(KeyProduct)
CloseRegKey $(SoftNetRulesKey)
ifstr(i) $(RegistryErrorIndex) != NO_ERROR
EndWait
Debug-Output "Registry error: add value list."
goto fatalregistry
endif
;; Install the NDIS Miniport interface
Debug-Output "VPCNetNT: Installing NDIS Miniport interface..."
Shell $(UtilityInf), AddSoftwareComponent, $(Manufacturer), +
$(NDISMiniportName), +
$(NDISMiniportName), +
$(NDISMiniportTitle), $(STF_CONTEXTINFNAME), +
$(NDISMiniportImagePath), "kernel", "NDIS", {}, "",+
$(NetEventDLL)
set OEM_ABANDON_MINIPORT = TRUE
ifint $($ShellCode) != $(!SHELL_CODE_OK)
Debug-Output "ShellCode error"
goto ShellCodeError
endif
set RegistryErrorIndex = $($R0)
set KeyProduct = $($R1)
Set HardNetRulesKey = $($R2)
CloseRegKey $($R3)
CloseRegKey $($R4)
CloseRegKey $($R5)
ifstr(i) $(RegistryErrorIndex) != NO_ERROR
EndWait
Debug-Output "Registry error: add software components"
CloseRegKey $(KeyProduct)
CloseRegKey $(HardNetRulesKey)
goto fatalregistry
endif
set NewValueList = { +
{"SoftwareType", $(NoTitle), $(!REG_VT_SZ), "driver"},+
{"MajorVersion", $(NoTitle), $(!REG_VT_DWORD), $(ProductMajorVersion)},+
{"MinorVersion", $(NoTitle), $(!REG_VT_DWORD), $(ProductMinorVersion)},+
{"Title", $(NoTitle), $(!REG_VT_SZ), $(NDISMiniportTitle)},+
{"Description", $(NoTitle), $(!REG_VT_SZ), $(NDISMiniportDescription)},+
{"ServiceName", $(NoTitle), $(!REG_VT_SZ), $(NDISMiniportName)},+
{"Review", $(NoTitle), $(!REG_VT_DWORD), $(NDISMiniportReviewBindings)},+
{"Hidden", $(NoTitle), $(!REG_VT_DWORD), $(NDISMiniportHide)},+
{"InstallDate", $(NoTitle), $(!REG_VT_DWORD), *($(Now),1)} +
}
Shell $(UtilityInf), AddValueList, $(KeyProduct), $(NewValueList)
ifint $($ShellCode) != $(!SHELL_CODE_OK)
Debug-Output "ShellCode error."
goto ShellCodeError
endif
set RegistryErrorIndex = $($R0)
ifstr(i) $(RegistryErrorIndex) != NO_ERROR
EndWait
Debug-Output "Registry error: add value list."
CloseRegKey $(KeyProduct)
CloseRegKey $(HardNetRulesKey)
goto fatalregistry
endif
set NewValueList = { +
{"type", $(NoTitle), $(!REG_VT_SZ), $(NetRuleNDISMiniportType)},+
{"use", $(NoTitle), $(!REG_VT_SZ), $(NetRuleNDISMiniportUse)}, +
{"bindform", $(NoTitle), $(!REG_VT_SZ), $(NetRuleNDISMiniportBindForm)}, +
{"class", $(NoTitle), $(!REG_VT_MULTI_SZ),$(NetRuleNDISMiniportClass)}, +
{"bindable", $(NoTitle), $(!REG_VT_MULTI_SZ),$(NetRuleNDISMiniportBindable)}, +
{"InfOption",$(NoTitle), $(!REG_VT_SZ), $(Option)} +
}
Shell $(UtilityInf), AddValueList, $(HardNetRulesKey), $(NewValueList)
ifint $($ShellCode) != $(!SHELL_CODE_OK)
Debug-Output "ShellCode error."
goto ShellCodeError
endif
set RegistryErrorIndex = $($R0)
CloseRegKey $(KeyProduct)
CloseRegKey $(HardNetRulesKey)
ifstr(i) $(RegistryErrorIndex) != NO_ERROR
EndWait
Debug-Output "Resgitry error: add value list."
goto fatalregistry
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -