windows-nt/Source/XPSP1/NT/base/ntsetup/inf/beta/ipinfo.inf
2020-09-26 16:20:57 +08:00

86 lines
2.7 KiB
INI

; Copyright (C) 1992 Microsoft Corporation
; All rights reserved.
;
; This file should contained the default gateway IP address, adapter IP
; Addresses and subnet mask IP addresses. To change the default gateway,
; change the line:
; DefaultGateway = "xxx.xxx.xxx.xxx"
; where xxx.xxx.xxx.xxx is a valid IP address. If the default gateway is
; unknown, please change it to:
; DefaultGateway = ""
;
; To change the default IP addresses and subnet mask IP addresses. First,
; change the line:
; NumberOfIPAddress = X
; where X is the number of IP addresses which you want to specify for this
; machine.
;
; Then change or add the following lines for each IP address pair:
; IPAddress<Y> = "xxx.xxx.xxx.xxx"
; SubnetMask<Y> = "xxx.xxx.xxx.xxx"
; where Y is IP addresses pair number and xxx.xxx.xxx.xxx are valid IP
; addresses.
;
; Example:
;
;[DefaultIPInfo]
; DefaultGateway = "11.1.0.0"
; NumberOfIPAddress = 3
; IPAddress1 = "11.1.12.1"
; SubnetMask1 = "255.255.0.1"
; IPAddress2 = "11.1.12.2"
; SubnetMask2 = "255.255.0.2"
; IPAddress3 = "11.1.12.3"
; SubnetMask3 = "255.255.0.3"
[DefaultIPInfo]
DefaultGateway = ""
NumberOfIPAddress = 1
IPAddress1 = ""
SubnetMask1 = "255.255.0.0"
;------------------------------------------------------------------------
; GetIPInfo: Returns the default gateway IP address, a list of default IP
; addresses and a list of default subnet mask IP addresses to the
; caller.
;------------------------------------------------------------------------
[GetIPInfo]
set DefaultGateway = ""
set NumberOfIPAddress = 0
set IPAddressList = ""
set SubnetMaskList = ""
read-syms DefaultIPInfo
set Count = 1
set UseHostFile = TRUE
LoadLibrary "x" $(!STF_CWDDIR)\tcpcfg.dll !TCPCFG_HANDLE
LibraryProcedure Result, $(!TCPCFG_HANDLE), CPlGetIPAddress
freeLibrary $(!TCPCFG_HANDLE)
ifint *($(Result),1) == 0
set IPAddressList = {*($(Result),2)}
else
set UseHostFile = FALSE
endif
LOOP = +
ifint $(Count) <= $(NumberOfIPAddress)
ifstr(i) $(UseHostFile) == FALSE
ifstr(i) $(IPAddressList) == ""
set IPAddressList = $(IPAddress$(Count))
else
set IPAddressList = >($(IPAddressList),$(IPAddress$(Count))))
endif
endif
ifstr(i) $(SubnetMaskList) == ""
set SubnetMaskList = $(SubnetMask$(Count))
else
set SubnetMaskList = >($(SubnetMaskList),$(SubnetMask$(Count)))
endif
set-add Count = $(Count), 1
goto LOOP
endif
return $(DefaultGateway), $(IPAddressList), $(SubnetMaskList)