|
|
;*********************************************************************** ; ; NBINFO.INF ; ; NETBIOS LANA number and provider management inf file. ; ; History: ; ;***********************************************************************
;----------------------------------------------------------------------- ; OPTION TYPE ; ----------- ; This identifies the Option type we are dealing with. The different ; possible types are: ; ; COMPUTER, DISPLAY, MOUSE, KEYBOARD, LAYOUT, SCSI, PRINTER, ... ; ; Types specific to networking: ; ; NetAdapter, a netcard / adapter combination or just a netcard ; NetDriver, just a netcard driver ; NetTransport, a complete NDIS-compliant TDI transport stack ; NetService, an NT networking service ; NetWork, a complete network ensemble. ; NetProvider a complete network which supports NT MPR protocol ;-----------------------------------------------------------------------
[Identification] OptionType = NetProvider
;----------------------------------------------------------------------- ; OPTION LIST ; ----------- ; This section lists the OEM Option key names. These keys are locale ; independent and used to represent the option in a locale independent ; manner. ; ;-----------------------------------------------------------------------
[Options] NETBIOS
;*********************************************************************** ; CONSTANTS FOR USING DIALOGS ;***********************************************************************
[FileConstants] ; ; File names, etc. ; UtilityInf = "UTILITY.INF" subroutineinf = "SUBROUTN.INF" SoftwareType = "driver" Exit_Code = 0 ;ShellCode = 0
; ; EventLog Message File ; NetEventDLL = "%SystemRoot%\System32\netevent.dll" IoLogMsgDLL = "%SystemRoot%\System32\IoLogMsg.dll"
; ; Product Info ; Manufacturer = "Microsoft" ProductMajorVersion = "4" ProductMinorVersion = "0" ProductVersion = $(ProductMajorVersion)"."$(ProductMinorVersion) ; ; Registry Key ; ProductKeyName = $(!NTN_SoftwareBase)"\"$(Manufacturer)"\"$(ProductSoftwareName)"\CurrentVersion" ParamKeyName = $(!NTN_ServiceBase)$(ProductHardwareName)"\Parameters" ; ; Misc ; NbProviderField = "NbProvider" EndPointField = "EndPoint" RouteField = "Route" ExportField = "Export"
[GeneralConstants] ; ; Program flow control variables. ; from = "" to = "" ; ; Return codes; Exit_Code is set to one of these ; ExitCodeOk = 0 ExitCodeCancel = 1 ExitCodeFatal = 2
KeyNull = "" MAXIMUM_ALLOWED = 33554432 RegistryErrorIndex = NO_ERROR KeyProduct = "" KeyParameters = ""
TRUE = 1 FALSE = 0 NoTitle = 0
ExitState = "Active" OldVersionExisted = $(FALSE)
DriverPath = $(!STF_NTPATH)\drivers
[date] ; Now is a list which contains { Sec from 1-1-1970, Year, Month, Day, Hour, ; Minute, Second } Now = {} ? $(!LIBHANDLE) GetSystemDate
;--------------------------------------------------------------------------- ; 1. Identify ; ; DESCRIPTION: To verify that this INF deals with the same type of options ; as we are choosing currently. ; ; INPUT: None ; ; OUTPUT: $($R0): STATUS: STATUS_SUCCESSFUL ; $($R1): Option Type (COMPUTER ...) ; $($R2): Diskette description ;---------------------------------------------------------------------------
[Identify] ; ; read-syms Identification
set Status = STATUS_SUCCESSFUL set Identifier = $(OptionType) set Media = #("Source Media Descriptions", 1, 1)
Return $(Status) $(Identifier) $(Media)
;------------------------------------------------------------------------ ; 2. ReturnOptions: ; ; DESCRIPTION: To return the option list supported by this INF and the ; localised text list representing the options. ; ; ; INPUT: $($0): Language used. ( ENG | FRN | ... ) ; ; OUTPUT: $($R0): STATUS: STATUS_SUCCESSFUL | ; STATUS_NOLANGUAGE ; STATUS_FAILED ; ; $($R1): Option List ; $($R2): Option Text List ;------------------------------------------------------------------------
[ReturnOptions] ; ; set Status = STATUS_FAILED set OptionList = {} set OptionTextList = {}
; ; Check if the language requested is supported ; set LanguageList = ^(LanguagesSupported, 1) Ifcontains(i) $($0) in $(LanguageList) goto returnoptions else set Status = STATUS_NOLANGUAGE goto finish_ReturnOptions endif
; ; form a list of all the options and another of the text representing ;
returnoptions = + set OptionList = ^(Options, 1) set OptionTextList = ^(OptionsText$($0), 1) set Status = STATUS_SUCCESSFUL
finish_ReturnOptions = + Return $(Status) $(OptionList) $(OptionTextList)
;*********************************************************************** ; SETUP (NTLANMAN) INVOCATION SECTION ;*********************************************************************** ;------------------------------------------------------------------------ ; ; InstallOption: ; ; This section is shelled to by main installation processing. ; ; ; FUNCTION: To copy files representing Options ; To configure the installed option ; To update the registry for the installed option ; ; INPUT: $($0): Language to use ; $($1): OptionID to install ; $($2): SourceDirectory ; $($3): AddCopy (YES | NO) ; $($4): DoCopy (YES | NO) ; $($5): DoConfig (YES | NO) ; ; OUTPUT: $($R0): STATUS: STATUS_SUCCESSFUL | ; STATUS_NOLANGUAGE | ; STATUS_USERCANCEL | ; STATUS_FAILED ; ;------------------------------------------------------------------------ [InstallOption] ; ; Set default values for ; set Status = STATUS_FAILED
; ; extract parameters ; set Option = $($1) set SrcDir = $($2) set AddCopy = $($3) set DoCopy = $($4) set DoConfig = $($5)
; ; Check if the language requested is supported ; set LanguageList = ^(LanguagesSupported, 1) Ifcontains(i) $($0) NOT-IN $(LanguageList) Return STATUS_NOLANGUAGE endif ; ; Call the CommonSection ; Shell "" CommonSection $(Option) $(SrcDir) $(AddCopy) $(DoCopy) $(DoConfig)
set Status = $($R0)
Return $(Status)
[BindingsReview] ; ; extract parameters ; set Option = $($1) set SrcDir = $($2) set AddCopy = $($3) set DoCopy = $($4) set DoConfig = $($5)
Shell "" CommonSection $(Option) $(SrcDir) $(AddCopy) $(DoCopy) $(DoConfig)
set Status = $($R0)
Return $(Status)
;*********************************************************************** ; COMMON SECTION ;*********************************************************************** ;------------------------------------------------------------------------ ; ; CommonSection: ; ; This section is shelled to from above by this INF. ; ; ; FUNCTION: To copy files representing Options ; To configure the installed option ; To update the registry for the installed option ; ; INPUT: $($1): OptionID to install ; $($2): SourceDirectory ; $($3): AddCopy (YES | NO) ; $($4): DoCopy (YES | NO) ; $($5): DoConfig (YES | NO) ; ; OUTPUT: $($R0): STATUS: STATUS_SUCCESSFUL | ; STATUS_NOLANGUAGE | ; STATUS_USERCANCEL | ; STATUS_FAILED ; ;------------------------------------------------------------------------ [CommonSection]
StartWait ; ; extract parameters ; set Option = $($1) set SrcDir = $($2) set AddCopy = $($3) set DoCopy = $($4) set DoConfig = $($5)
; define all the constants
set-subst LF = "\n"
read-syms GeneralConstants read-syms FileConstants
read-syms DialogConstants$(!STF_LANGUAGE) read-syms FileConstants$(!STF_LANGUAGE)
detect date
set-title $(FunctionTitle)
set to = Begin set from = Begin ; ; Assume all is well. ; set CommonStatus = STATUS_SUCCESSFUL ; ; Set up the operation-mode-based variables and gaily welcome ; the user. If the "install mode" variable is improperly set, ; assume this is a new installation. ; Begin = + ; ; Open Service key ; OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_ServiceBase) $(MAXIMUM_ALLOWED) ServiceKey
Ifstr $(ServiceKey) == $(KeyNull) set RegistryErrorIndex = $($R0) goto fatalregistry endif
; ; Set the result values to {empty} ; ; List of Route strings from NetBIOS; element form {<NetBIOS linkage route string>} ; Set RouteInformationList = {} ; ; Get the Linkage information from the NetBIOS service. If the NetBIOS key doesn't ; exist, then assume we're not wanted and exit quietly. ; OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_ServiceBase)"\NetBIOS\Linkage" $(MAXIMUM_ALLOWED) NbKey Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS) ; ; NetBIOS service isn't present. Bail out. ; Debug-Output "NBINFO.INF: could not open CurrentControlSet\Services\NetBIOS\Linkage key" goto successful Endif ; ; First the active bindings Route data. ; GetRegValue $(NbKey) Route RouteListValue Ifint $(RegLastError) != 0 Debug-Output "NBINFO.INF: Error reading NetBIOS\Linkage:Route value: "$(RegLastError) Set RouteList = {} Else Set RouteList = *($(RouteListValue),4) Endif
set ActiveRouteList = $(RouteList)
ForListDo $(RouteList) Debug-Output "NBINFO.INF: Adding NetBIOS route value: "$($) Set RouteInformationList = >($(RouteInformationList),$($)) EndForListDo ; ; Read the disabled binding route information; add it to the list ; OpenRegKey $(NbKey) "" "Disabled" $(MAXIMUM_ALLOWED) NbDisKey Ifstr(i) $(NbDisKey) != $(KeyNull) Set RouteList = {} GetRegValue $(NbDisKey) Route RouteListValue Ifint $(RegLastError) == 0 Set RouteList = *($(RouteListValue),4) Endif
ForListDo $(RouteList) Debug-Output "NBINFO.INF: Adding DISABLED NetBIOS route value: "$($) Set RouteInformationList = >($(RouteInformationList),$($)) EndForListDo CloseRegKey $(NbDisKey) Endif
CloseRegKey $(NbKey)
Debug-Output "NBINFO.INF: open N/B info service" ; ; Open the service key in registry. ; If key isn't there, perform [CreateService]. ; ; Leave the Parameters key open for later use. ; OpenRegKey $(ServiceKey) "" "NetBIOSInformation" $(MAXIMUM_ALLOWED) NetBIOSKey
Ifstr(i) $(NetBIOSKey) == "" Shell $(UtilityInf), CreateService, "NetBIOSInformation", "NetBIOSInformation", "", "adapter", "", {}, ""
ifint $($ShellCode) != $(!SHELL_CODE_OK) Debug-Output "NBINFO.INF: Shell error creating service" goto ShellCodeError endif
set RegistryErrorIndex = $($R0) Set ParameterKey = $($R2) CloseRegKey $($R1) CloseRegKey $($R3) Else ; ; Create the Linkage and Parameters keys. ; OpenRegKey $(NetBIOSKey) "" "Linkage" $(MAXIMUM_ALLOWED) LinkageKey Ifstr(i) $(LinkageKey) == $(KeyNull) CreateRegKey $(NetBIOSKey) { "Linkage", $(NoTitle), GenericClass } "" $(MAXIMUM_ALLOWED) "" LinkageKey Endif CloseRegKey $(LinkageKey)
OpenRegKey $(NetBIOSKey) "" "Parameters" $(MAXIMUM_ALLOWED) ParameterKey Ifstr(i) $(ParameterKey) == $(KeyNull) CreateRegKey $(NetBIOSKey) { "Parameters", $(NoTitle), GenericClass } "" $(MAXIMUM_ALLOWED) "" ParameterKey Endif CloseRegKey $(NetBIOSKey) Endif
Ifstr(i) $(ParameterKey) == $(KeyNull) read-syms FatalError1$(!STF_LANGUAGE) goto fatal Endif
; ; Prune old information from NetBIOSInformation\Parameters key. ; ; Iterate the Route list. Any routes found which are not currently associated ; with the NetBIOS service are removed, along with their LanaNum<n> and EnumExport<n> ; values. ; GetRegValue $(ParameterKey) "Route" OrigRouteValue Ifint $(RegLastError) == 0 Set OrigRouteList = *($(OrigRouteValue), 4) ifstr(i) $(OrigRouteList) == "" set OrigRouteList = {} Endif Set OrigIndex = 0 Set NewIndex = 0 Set AnyChanges = 0 Set CurrentRouteList = {} Set NewValueList = {} ForListDo $(OrigRouteList) Set-add OrigIndex = $(OrigIndex),1 Set ThisOrigRoute = $($) ifContains(i) $(ThisOrigRoute) NOT-IN $(RouteInformationList) ; ; A route value has disappeared from the NetBIOS service. ; Remove the corresponding LanaNum and EnumExport values. ; Debug-Output "NBINFO.INF: Removing info for old route: "$(ThisOrigRoute)", index "$(OrigIndex) DeleteRegValue $(ParameterKey) LanaNum$(OrigIndex) DeleteRegValue $(ParameterKey) EnumExport$(OrigIndex) Set AnyChanges = 1 Else Set CurrentRouteList = >($(CurrentRouteList),$(ThisOrigRoute)) Set-add NewIndex = $(NewIndex),1 GetRegValue $(ParameterKey) LanaNum$(OrigIndex) OrigLanaValue Set OrigLanaNum = *($(OrigLanaValue),4) GetRegValue $(ParameterKey) EnumExport$(OrigIndex) OrigExportValue Set OrigExport = *($(OrigExportValue),4) set NewValueList = >($(NewValueList),{LanaNum$(NewIndex), $(NoTitle), $(!REG_VT_DWORD), $(OrigLanaNum) }) set NewValueList = >($(NewValueList),{EnumExport$(NewIndex), $(NoTitle), $(!REG_VT_DWORD), $(OrigExport)}) Endif EndForListDo
Ifint $(AnyChanges) != 0 DeleteNextOldLana = + Ifint $(NewIndex) <= $(OrigIndex) Debug-Output "NBINFO.INF: pruning old lana info for index = "$(NewIndex) DeleteRegValue $(ParameterKey) LanaNum$(NewIndex) DeleteRegValue $(ParameterKey) EnumExport$(NewIndex) Set-add NewIndex = $(NewIndex),1 Goto DeleteNextOldLana Endif
Debug-Output "NBINFO.INF: updating Route, LanaNumX and EnumExportX after pruning" Set NewValueList = >($(NewValueList),{Route, $(NoTitle), $(!REG_VT_MULTI_SZ), $(CurrentRouteList)}) Shell $(UtilityInf), AddValueList, $(ParameterKey), $(NewValueList) Endif Endif
; ; Get the registry values; algorithm: ; ; Read the existing information into a list. ; Debug-Output "NBINFO.INF: Access N/B info route data"
GetRegValue $(ParameterKey) "Route" OldRouteValue set OldRouteList = *($(OldRouteValue), 4) ifstr(i) $(OldRouteList) == "" set OldRouteList = {} Endif
Debug-Output "NBINFO.INF: Enumerate N/B info lananums" EnumRegValue $(ParameterKey) ParameterValue Set HighLana = 0 set UsedLanaNum = {} ForListDo $(ParameterValue) set LanaNumName = *($($), 1) Set LanaNumNum = *($($), 4) LibraryProcedure Result $(!LIBHANDLE) SetupStrncmp $(LanaNumName) "LanaNum" 7 ifint $(Result) == 0 Ifint $(HighLana) < $(LanaNumNum) Set HighLana = $(LanaNumNum) Endif
set UsedLanaNum = >($(UsedLanaNum),$(LanaNumNum)) ; ; remember the zero position ; ifint $(LanaNumNum) == 0 set LanaZeroNum = $(LanaNumName) endif ; ; declare a variable for RPC support: "RpcLanaNum<n> = <n>" ; Set Rpc$(LanaNumName) = $(LanaNumNum) endif EndForListDo
Set NewValueList = {} Set RpcLanaList = {} Set RpcProtoList = {} QueryListSize Position $(OldRouteList) Set LanaNum = 0 Set AnyChanges = 0 Set LanaXnsNum = ""
ForListDo $(RouteInformationList) Set ThisRoute = $($) ifContains(i) $(ThisRoute) NOT-IN $(OldRouteList) ; ; New route; add it to the old list. ; Then find first unused LanaNum. ; Debug-Output "NBINFO.INF: New route to be added: "$(ThisRoute) Set-add Position = $(Position), 1 Set OldRouteList = >($(OldRouteList), $(ThisRoute)) Set AnyChanges = 1
TryAgain = + ifContains(i) $(LanaNum) IN $(UsedLanaNum) set-add LanaNum = $(LanaNum), 1 goto TryAgain else ifint $(LanaNum) == 0 set LanaZeroNum = "LanaNum"$(Position) endif Debug-Output "NBINFO.INF: LanaNum "$(LanaNum)" assigned to "$(ThisRoute) set NewValueList = >($(NewValueList),{LanaNum$(Position), $(NoTitle), $(!REG_VT_DWORD), $(LanaNum) }) set NewValueList = >($(NewValueList),{EnumExport$(Position), $(NoTitle), $(!REG_VT_DWORD), 1}) set UsedLanaNum = >($(UsedLanaNum), $(LanaNum)) Set RpcLanaNum$(Position) = $(LanaNum) Ifint $(HighLana) < $(LanaNum) Set HighLana = $(LanaNum) Endif set-add LanaNum = $(LanaNum), 1 endif ; ; hack: always set xns lananum to 0 ; BUGBUG: this should be based upon an "MS Campus" flag! ; set FLibraryErrCtl = 1 LibraryProcedure Result $(!NCPA_HANDLE) EqualToXnsRoute $(ThisRoute) ifstr(i) $(Result) == "1" set LanaXnsNum = "LanaNum"$(Position) endif endif ; ; Locate the position of this route in the newly-updated OldRouteList. ; Build lists containing RPC lanas and protocol suffix strings. ; Set RouteIndex = ~($(OldRouteList),$(ThisRoute)) Set ThisLana = $(RpcLanaNum$(RouteIndex)) ; ; Locate the provider for this route. Strip the name of the first service from ; the route, open its "Parameters" key, get its "NbProvider" value. ; LibraryProcedure CEPSTemp $(!NCPA_HANDLE) CPlSetup $(!STF_HWND), ROUTETOLIST, $(ThisRoute) Set ThisProto = "" Set ThisService = *($(CEPSTemp),2) Debug-Output "NBINFO.INF: CEPS: "$(ThisRoute)" = "$(CEPSTemp)", ThisService = "$(ThisService) OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_ServiceBase)"\"$(ThisService)"\Parameters" $(!REG_KEY_READ) SrvParmKey Ifint $(RegLastError) == 0 GetRegValue $(SrvParmKey) $(NbProviderField) NbProviderData Ifint $(RegLastError) == 0 Set ThisProto = *($(NbProviderData),4) Debug-Output "NBINFO.INF: Service "$(ThisService)" is a NetBIOS provider: "$(ThisProto) Set RpcSuffixCount$(ThisProto) = 0 Set RpcLanaList = >($(RpcLanaList),$(ThisLana)) Set RpcProtoList = >($(RpcProtoList),$(ThisProto)) Else Debug-Output "NBINFO.INF: "$(ThisService)"\Parameters has no NbProvider value" Endif CloseRegKey $(SrvParmKey) Else Debug-Output "NBINFO.INF: open of key "$(ThisService)"\Parameters FAILED; no provider info" Endif
Debug-Output "NBINFO.INF: RPC string for route "$(ThisRoute)" is "$(ThisProto)" = "$(ThisLana) EndForListDo
Ifint $(AnyChanges) != 0 Debug-Output "NBINFO.INF: Update Parameters..." Set NewValueList = >($(NewValueList),{Route, $(NoTitle), $(!REG_VT_MULTI_SZ), $(OldRouteList)}) Shell $(UtilityInf), AddValueList, $(ParameterKey), $(NewValueList) Endif
set ExportNum = 1 ForListDo $(OldRouteList) Set ThisRoute = *($($),1) Set ThisProto = *($($),2) ; setup the EnumExport value LibraryProcedure "" $(!NCPA_HANDLE) SetEnumExport $(ExportNum) $(ThisRoute) set-add ExportNum = $(ExportNum), 1 EndForListDo
; ; hack: always set xns lananum to 0 ; BUGBUG: this should be based upon an "MS Campus" flag! ; ifstr(i) $(LanaXnsNum) != "" GetRegValue $(ParameterKey) $(LanaXnsNum) LanaXnsInfo GetRegValue $(ParameterKey) $(LanaZeroNum) LanaZeroInfo set XnsNum = *($(LanaXnsInfo), 4) set ZeroNum = *($(LanaZeroInfo), 4) SetRegValue $(ParameterKey) {$(LanaXnsNum),$(NoTitle),$(!REG_VT_DWORD),$(ZeroNum)} SetRegValue $(ParameterKey) {$(LanaZeroNum),$(NoTitle),$(!REG_VT_DWORD),$(XnsNum)} Endif
CloseRegKey $(ParameterKey)
set FLibraryErrCtl = 1 LibraryProcedure "" $(!NCPA_HANDLE), CPlSetupLanaMap
EndWait ; ; Using the lists build above, update the RPC NetBIOS information in the ; SOFTWARE hive. ; ; This starts by deleting the NetBios key to reset all values, then the key is ; recreated and the new values are added. Uses the lists $(RpcLanaList) ; and $(RpcProtoList). The values $(RpcSuffixCount<suffix)) have already been ; set to zero. ; ; This bizarro logic is necessary because RPC wants to have its protocol strings ; sorted into LANA order. There can be no gaps in the numbering of protocol strings, ; but there may be gaps in the numbering of LANAs. ; OpenRegKey $(!REG_H_LOCAL) "" "SOFTWARE\Microsoft\Rpc" $(MAXIMUM_ALLOWED) KeyRpc
Ifstr(i) $(KeyRpc) == "" Debug-Output "NBINFO.INF: Unable to open RPC software key" goto successful Endif
Set RpcValueList = {}
Set NextLana = 0
OpenRegKey $(!REG_H_LOCAL) "" "System\CurrentControlSet\Services\NetBIOS\Linkage" $(MAXIMUM_ALLOWED) NetBiosLinkage ifstr(i) $(NetBiosLinkage) != "" GetRegValue $(NetBiosLinkage) "LanaMap" LanaMapInfo set BindedLana = {} set Odd = 1 ForListDo *($(LanaMapInfo),4) ifint $(Odd) == 1 set Odd = 0 else set Odd = 1 ifstr $(BindedLana) == {} set BindedLana = $($) else set BindedLana = >($(BindedLana),$($)) endif endif EndForListDo CloseRegKey $(NetBiosLinkage) endif ; ; Increment through all the possible LANAs. If one is used for RPC, generate ; the appropriate protocol string and LANA number value; then update the ; suffix for that protocol. ; trynextlana = + Debug-Output "Binded Lana:"$(BindedLana) Debug-Output "NBINFO.INF: HighLana = "$(HighLana)", LanaXnsNum = "$(LanaXnsNum)", XnsNum = "$(XnsNum)", ZeroNum = "$(ZeroNum) Ifint $(NextLana) > $(HighLana) goto updaterpc Endif
Ifcontains(i) $(NextLana) in $(RpcLanaList) Set Index = ~($(RpcLanaList),$(NextLana)) Set ThisProto = *($(RpcProtoList),$(Index)) Set NextSuffix = $(RpcSuffixCount$(ThisProto)) Set-add RpcSuffixCount$(ThisProto) = $(NextSuffix),1 Set ThisString = "ncacn_nb"$(ThisProto)$(NextSuffix) Set UseLana = $(NextLana) Ifstr(i) $(LanaXnsNum) != "" Ifint $(NextLana) == $(XnsNum) Set UseLana = $(ZeroNum) Else-ifint $(NextLana) == $(ZeroNum) Set UseLana = $(XnsNum) Endif Endif Debug-Output "NBINFO.INF: RPC string = "$(ThisString)", lana = "$(UseLana) ifcontains(i) $(UseLana) in $(BindedLana) Set RpcValueList = >($(RpcValueList),{$(ThisString),$(NoTitle),$(!REG_VT_DWORD),$(UseLana)}) endif Endif
Set-add NextLana = $(NextLana),1 Goto trynextlana
updaterpc = + ; ; Delete the Rpc\NetBios key, recreate it, append the generated values. ; The result of the deletion operation is not checked, since recreation will ; fail if the key already exists. ; Set KeyNameNetBios = "NetBios" DeleteRegKey $(KeyRpc) $(KeyNameNetBios) CreateRegKey $(KeyRpc) { $(KeyNameNetBios), $(NoTitle), GenericClass } "" $(MAXIMUM_ALLOWED) "" KeyNetBios Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS) Debug-Output "NBINFO.INF: RpcValueList = "$(RpcValueList) Shell $(UtilityInf), AddValueList, $(KeyNetBios), $(RpcValueList) CloseRegKey $(KeyNetBios) Else Debug-Output "NBINFO.INF: Rpc\Netbios key recreation failed" Endif
CloseRegKey $(KeyRpc)
goto successful
; Escape hatches ; successful = + ; goto end ; ; warning display ; 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 ; Debug-Msg "Error Error Bad DLGEVENT" goto "end" endif
; ; non fatal error display ; nonfatal = + Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), "NONFATAL", $(Error) ifint $($ShellCode) != $(!SHELL_CODE_OK) goto ShellCodeError endif ifstr(i) $($R1) == "OK" goto $(from) else goto "end" endif
; ; Registry is broken ; fatalregistry = + Shell $(UtilityInf) RegistryErrorString $(RegistryErrorIndex) ifint $($ShellCode) != $(!SHELL_CODE_OK) goto ShellCodeError endif set Error = $($R0) goto fatal ; ; fatal error display ; fatal = + Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), "FATAL", $(Error) ifint $($ShellCode) != $(!SHELL_CODE_OK) goto ShellCodeError endif
goto setfailed
; ; Shelling error ; 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 goto end
end = + goto term
term = + Return $(CommonStatus)
;------------------------------------------------------------------------ ; ; CheckMixRpcProtocol ; ; During review binding, this function will be called by other ; inf file. The function will check whether the binding is ; disabled or not. If it is disabled, it will remove the RPC client ; and server protocol ; ; ; FUNCTION: Check active binding for netbios ; remove or add the rpc client or server protocol ; ; INPUT: $($0): Netbios Related protocol name (eg, NetBT) ; $($1): Length of $($0) ; $($2): actual protocol name (eg, tcpip) ; $($3): rpc tag (eg, ncacn_nb_tcp) ; $($4): rpc client dll ; $($5): rpc server dll ; ;------------------------------------------------------------------------ [CheckMixRpcProtocol] read-syms GeneralConstants read-syms FileConstants
OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_ServiceBase)"\NetBIOS\Linkage" $(MAXIMUM_ALLOWED) NbKey Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS) goto CheckMixRpcProtocolReturn endif ; ; First get the active bindings Route data. ; GetRegValue $(NbKey) Route RouteListValue Ifint $(RegLastError) != 0 Debug-Output "NBINFO.INF: Error reading NetBIOS\Linkage:Route value: "$(RegLastError) Set RouteList = {} Else Set RouteList = *($(RouteListValue),4) Endif
set ActiveRouteList = $(RouteList) set CheckedProtocol = """"$($0)"""" set-add Length = $($1),2 set AddedProtocol = $($2) set AddedRpcString = $($3) set AddedClientDLL = $($4) set AddedServerDLL = $($5) set Find = 0 ForListDo $(ActiveRouteList) ; ; see whether we have the related binding ; LibraryProcedure Result $(!LIBHANDLE) SetupStrncmp $($) $(CheckedProtocol) $(Length) ifint $(Result) == 0 set Find = 1 goto FindIt endif EndForListDo FindIt = + ifint $(Find) == 1 ; ; Add the rpc stuff if we have active binding ; Shell $(UtilityInf) AddMixRpcProtocol "Netbios" $(AddedProtocol) $(AddedRpcString) $(AddedClientDLL) $(AddedServerDLL) else ; ; remove the rpc stuff if we don't have the active binding ; Shell $(UtilityInf) RemoveRpcProtocol $(AddedRpcString) endif CheckMixRpcProtocolReturn = + return
|